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
2bb9a6d776db859f50f624f824b2a383186e2175
MrHamdulay/csc3-capstone
/examples/data/Assignment_5/mbyken001/question1.py
UTF-8
1,426
3.96875
4
[]
no_license
#Assignment 5-Question 1 #kenton mobey #Introduction and Menu def menu(): print( "Welcome to UCT BBS") print( "MENU") print( "(E)nter a message" ) print( "(V)iew message" ) print( "(L)ist files" ) print( "(D)isplay file" ) print( "e(X)it" ) selection = 0 message = "" ...
true
804ec8d5e416cb8ed675a9793815818546099ee2
yasheymateen/holbertonschool-machine_learning
/supervised_learning/0x04-error_analysis/4-f1_score.py
UTF-8
379
2.859375
3
[]
no_license
#!/usr/bin/env python3 """ calculates f1 score of confusion matrix """ import numpy as np sensitivity = __import__('1-sensitivity').sensitivity precision = __import__('2-precision').precision def f1_score(confusion): """ calculates f1 score of confusion matrix """ sen = sensitivity(confusion) prec = pre...
true
ca164194a9a848ca4bcea850f6a6637237466ee4
valerpenko/jakob
/DataStructures/matrix_with_generators.py
UTF-8
91
2.75
3
[]
no_license
import random n=6 l=[ [random.randint(1,10) for j in range(n)] for i in range(n) ] print(l)
true
cf77e0a05de279872ba7e1f81465ef2437d0d7ba
jashyaman/pyth
/htmlParser.py
UTF-8
390
3
3
[]
no_license
''' plan : read the html content from url decipher the required text populate a variable with the values as json populate a variable with values as csv save to file ''' try: import urllib.request as urllib2 except ImportError: import urllib2 response = urllib2.urlopen('https://en.wikipedia.org/wiki/List_of_Sup...
true
66e72def9fa372953a9aa553649376fe3f84e78c
lin13k/practice
/algo_problems/q1-20/q09.py
UTF-8
422
3.0625
3
[]
no_license
class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x < 0: return False n = len(str(x)) for i in range(n // 2): rightDigit = x % 10**(i + 1) // 10**(i) leftDigit = (x % 10**(n - i)) // 10*...
true
bfc83614f742ebfad93b4d8142cc6b62ec8c149b
pyvelepor/poker-hand-analyser
/poker.py
UTF-8
4,151
3.21875
3
[ "MIT" ]
permissive
from collections import namedtuple class Card(namedtuple('Card', 'face, suit')): def __repr__(self): return ''.join(self) suit = '♥ ♦ ♣ ♠'.split() # ordered strings of faces faces = '2 3 4 5 6 7 8 9 10 j q k a' lowaces = 'a 2 3 4 5 6 7 8 9 10 j q k' # faces as lists face = faces.split() lowace = lowaces...
true
cfc1c92599b1e0b4c1d9176507c5d4d601c7b2ca
songdy0511/gy-1906
/demo/day03/dict_demo.py
UTF-8
1,040
4.0625
4
[]
no_license
# 字典的特性 # 1. 字典中的key可是唯一的 # 2. key 不可改变 数字,字符串,元组 # 元组(1,2,3,4)可作为key,(1,【3】)不可 # 3. 字典只能通过key访问value,不能直接访问value # 4. 字典中数据是无序的 # 创建 a = {} # 在字典中新增一对数据 a["姓名"] = '宋丹阳' print(a) # 改 a["姓名"] = "晓虹" print(a) a[1] = 333 print(a) a[(1,2)] = 333 print(a) # 删 pop参数只能为key # a.pop((1,2)) # print(a) # # 清空字典 # # a.clear() #...
true
49ace83562be20033cadce21978ba5cfb91f1e3c
Maulik5041/Level_up_Python
/Leveraging Data Structures/generators_examples.py
UTF-8
1,613
4.625
5
[]
no_license
"""Generators are used to save memory""" import sys g = (i for i in range(6)) print(g) print(next(g)) print(next(g)) print(next(g)) print(next(g)) print(next(g)) print(next(g)) # This should throw an error as there are no more values to iterate # print(next(g)) # For adding all the values from 1 to 1000 using li...
true
dbe8b5679cbf27a3e83c7a4b479c261717bff778
nipy/nipy
/nipy/labs/group/glm_twolevel.pyx
UTF-8
5,158
2.828125
3
[ "BSD-3-Clause" ]
permissive
# -*- Mode: Python -*- Not really, but the syntax is close enough """ Two-level general linear model for group analyses. Author: Alexis Roche, 2008. """ __version__ = '0.1' # Includes from fff cimport * # Exports from fff_glm_twolevel.h cdef extern from "fff_glm_twolevel.h": ctypedef struct fff_glm_twolevel_...
true
5927df69ce62041ac7421547ecf0d7276d614d2b
fordfasterr/ip_monitor
/pinger.py
UTF-8
147
2.640625
3
[]
no_license
import os def ping(host): response = os.system("ping -c 1 " + host) if response == 0: return True else: return False
true
f4a522122e82d8bd1392c40aa10b7549d2e01b0c
AakashPanchal/Python-Codes-for-learning
/head_tail.py
UTF-8
141
2.953125
3
[]
no_license
import pandas as pd , numpy as np df = pd.DataFrame({'a': pd.Series(np.arange(1,50)),'b': pd.Series(np.arange(51,100))}) print(df.tail(10))
true
4e608d09397e6db0b26e7ea4d2d3c67eadf3b6ad
fmcardoso/aco-scs
/generator.py
UTF-8
1,146
3.140625
3
[ "MIT" ]
permissive
#!/usr/bin/python3 import string import random import math from random import randint def generate(fragmentsDir, genomeDir, id, genomeSize = 1000, fragmentMinSize = 35, fragmentMaxSize = 50, coverage = 2): random.seed(1234 * id) # Calcula o numero de fragmentos dada a cobertura numFragments = math.ceil(ge...
true
c309b7500fd5bee44136bb8cf1b9cd950d5566c4
trriplejay/synonymize
/synonymize.py
UTF-8
7,317
3.421875
3
[]
no_license
from bighugelabsAPI import BigHugeLabAPI from secret_key import API_KEY import sys from random import shuffle, randint from string import punctuation """ haikume.net: step 1: "synonymize me" takes in a sentence and returns many equivalent sentences using synonyms.. user can pick the one they like best. step 2...
true
b0ce934b830e9a0c062ce2da9c7e696733e461fe
simpeg/simpeg
/SimPEG/electromagnetics/frequency_domain/survey.py
UTF-8
2,696
3.1875
3
[ "MIT" ]
permissive
from ...survey import BaseSurvey from .sources import BaseFDEMSrc from ...utils import validate_list_of_types class Survey(BaseSurvey): """Frequency domain electromagnetic survey Parameters ---------- source_list : list of SimPEG.electromagnetic.frequency_domain.sources.BaseFDEMSrc List of Si...
true
d69c61a06e1f1c68c4977aa6f20669b56ef83535
danielsenhwong/danielsenhwong
/danielsenhwong.py
UTF-8
4,486
2.640625
3
[]
no_license
# danielsenhwong.py # # A Python app using the Flask framework to serve a simple database-driven bio page. import os import sqlite3 from flask import (Flask, Response, render_template, request, session, g, url_for, abort, redirect, flash) from contextlib import closing ##### # VARIABLES ##### database_cnf_path = '/ho...
true
bd94211b0e73bc1f37c4e03220820237c9e13fd2
odcowl/Codes_for_blog
/声学相关代码积累/STFT_local2.py
UTF-8
1,689
2.921875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 11 15:12:44 2021 @author: yujiayang """ import scipy, pylab def stft(x, fs, framesz, hop): """x is the time-domain signal fs is the sampling frequency framesz is the frame size, in seconds hop is the the time between the start of ...
true
88b63274709afa17dda683fe3db0600d0e16006b
wbknez/evored-warrior
/evored/algorithm/__init__.py
UTF-8
2,005
3.203125
3
[ "Apache-2.0" ]
permissive
""" Contains all classes and functions designed to make a uniform API for performing different evolutionary operations on a list of genomes. """ from abc import abstractmethod, ABCMeta class EvolvingAlgorithm(metaclass=ABCMeta): """ Represents a single facet of a genetic algorithm that alters, reorganizes...
true
ebdaeb924bb38d59f4692168af051bc333f772d8
xiaoqibao-growing/Algorithm
/Algorithm/reverse_integer.py
UTF-8
747
3.953125
4
[]
no_license
# -*- coding=utf-8 -*- """ 问题描述:Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 The input is assumed to be a 32-bit signed integer. Your function should return 0 when the reversed integer overflows. """ import sys import os class Solution(object): ...
true
b6b39dbbe0dc8bd4ed90c7fed759ab14b3167957
robbyvan/-
/動的計画法/279_Perfect Squares.py
UTF-8
1,392
3.625
4
[]
no_license
# 279_Perfect Squares # 1.找硬币DP, opt(k, target) = min(opt(k - 1, target), opt(k, target - Vk) + 1) # 与416的区别: 基本硬币面额可以重复使用, 所以是opt(k, target - Vk) + 1; 背包问题, 物品只有一个, 选择后就没有了 # 2.BFS, 每次扫描所有的硬币, 确定下次开始找零金额 class Solution: def numSquares(self, n): if n < 2: return n i, coins = 1, [] while i * i <= n:...
true
b6ddb5b2deb16650ca506de561f8704dc1b5bb95
Soare-Robert-Daniel/diploma-de-licenta
/app/simulator/objects/target.py
UTF-8
764
3.140625
3
[]
no_license
import numpy as np class Target: kind = "target" def __init__(self, position, size=10): self.pos = position self.size = size # def distance_to(self, car: Car): # return np.linalg.norm(self.pos - car.pos) - self.size - car.length def get_kind(self): retu...
true
d976075b57e6910def7012bdab9241c8410146c4
Mohan125/Covid19_model
/Covid_model.py
UTF-8
983
2.96875
3
[]
no_license
import numpy as np import pandas as pd from matplotlib import pyplot as plt dataset= pd.read_csv('csvfile.csv') x= dataset.iloc[:,0:-1].values y= dataset.iloc[:,-1].values from sklearn.linear_model import LinearRegression lr=LinearRegression() lr.fit(x,y) from sklearn.preprocessing import PolynomialFeatures p...
true
421f719cb6288d6296c73c278604c4ca45ac9fcc
freeplay-sandbox/core
/nodes/move_sandbox_items
UTF-8
5,719
2.53125
3
[]
no_license
#! /usr/bin/env python """ This ROS node creates an action server that waits for a goal (item, 2D target location). It then calls a planning service (provided by playground_map_and_plan) to find a path for the item through the playground, and execute this plan by publishing successive 'touches' (as ROS Poses) to be in...
true
3185f67dcd79fe5abc882cd03d3eafe243861b30
rafaelperazzo/programacao-web
/moodledata/vpl_data/74/usersdata/149/35263/submittedfiles/lecker.py
UTF-8
573
3.390625
3
[]
no_license
# -*- coding: utf-8 -*- import math a=int(input('digitite o valor 1:')) b=int(input('digitite o valor 2:')) c=int(input('digitite o valor 3:')) d=int(input('digitite o valor 4:')) if b>a and b>c or c>b and c>d: print('S') if c>a and c>b or b>c and b>d: print('S') if b>d and b>c or c>b and c>a: print('S') if...
true
4d1c0b10324c30c64d35aadfea62d2f7a2074fdb
sglavoie/code-snippets
/python/strings/pangram.py
UTF-8
294
3.328125
3
[ "MIT" ]
permissive
import string def is_pangram(user_str): alpha_str = set() for char in user_str.lower(): if char in string.ascii_lowercase and char not in alpha_str: alpha_str.add(char) if len(alpha_str) == 26: return "pangram" return "not pangram"
true
f5f30141ef4a6ed1046f9424cb9bd16ad39e7797
ThomsonKernel/nesdumper
/main/dumper.py
UTF-8
2,223
2.515625
3
[]
no_license
from serial import Serial ######Serial Interface###### baud=115200 tty="/dev/cu.wchusbserial1410" buf=64 chunk=buf>>1 dev=None def write(h): dev.write(h) def read(size=1): return dev.read(size) def fetch(addr): write(addr) return read(chunk) def reset(): dev.reset_input_buffer() dev.setDTR(False...
true
7bde229614f756ffc0a90eb6d75dfb8c9d87d2cc
zhlinh/leetcode
/0146.LRU Cache/solution.py
UTF-8
2,441
3.671875
4
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ***************************************** Author: zhlinh Email: zhlinhng@gmail.com Version: 0.0.1 Created Time: 2016-03-18 Last_modify: 2016-03-18 ****************************************** ''' ''' Design and implement a data structure for ...
true
a58341fa1e5bfd6d466e39e42464e1ff0d4e5e50
obsidianla/leetcode
/python/move_zeros.py
UTF-8
477
2.796875
3
[]
no_license
def moveZeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ j = 0 for num in nums: if num != 0: nums[j] = num j +=1 for i in range(j,len(nums)): ...
true
e167fa79b6db429bea9517642b712e7e65f83496
jihongeek/Algo
/baekjoon/1697.py
UTF-8
1,076
3.296875
3
[]
no_license
from sys import stdin from collections import deque def is_visitable(location): if not 0 <= location <= 100000: return False if visited[location] == True: return False return True def find(location): minimum_time = 100000 time = 0 visited[location] = True queue = deque() ...
true
f8279a7362b819fa4ce70c43bf3410c724873a2b
thomasschal/textspinning
/write_to_json.py
UTF-8
1,645
2.578125
3
[]
no_license
import dl_translate as dlt import string import nltk import numpy as np import pandas as pd import json import uuid #nltk.download('punkt') from nltk.translate.bleu_score import sentence_bleu import math import re from collections import Counter from strsimpy.cosine import Cosine from bert_score import score # Transl...
true
9743790c86bff1abd5ddade5f1d358806ba369ad
JLangowitz/AutoSchematic
/AutoSchematicWebsite/getWireData.py
UTF-8
3,133
3.25
3
[]
no_license
import zipfile as zf import xml.etree.ElementTree as et import math # def main(): # print getWireData('./uploads/','Electrical_Diagram') def getWireData(filepath, filename): """ Gets the wire data from the specified file and parses it into a format to send to the arduino. See helper functions for de...
true
cab5ae66c2d8d4caae4d055b9fdcd8fab340fcd9
gianargamosa/stitch
/middlewares/faker/__init__.py
UTF-8
4,027
3.171875
3
[ "MIT" ]
permissive
import random import warnings import data import patterns from utils import rand, numerify, domain, secondary_address # deprecation_message = """Start seeding""" warnings.simplefilter("always", PendingDeprecationWarning) # warnings.warn(deprecation_message, PendingDeprecationWarning) # Decorator for methods that ne...
true
807b836ff6664e5e663bcd1573aafc9f58892b0c
npetsev/RRT_search
/lattice.py
UTF-8
1,285
3.328125
3
[]
no_license
import numpy as np class Lattice: """ Lattice operations class """ def __init__(self, xbins, ndim): """ Create lattice xbins - number of points/bins for each dimension ndim - number of dimensions """ # Single-ax...
true
6cd7b1b5b9d0e469da49ece104ec0fb7fea8baac
qkralswl689/CodingTestStudy
/Algorithm_python/Greedy/bj2839.py
UTF-8
240
3.109375
3
[]
no_license
import sys A = 5 B = 3 N = int(sys.stdin.readline()) count = 0 while True: if (N % A) == 0 : count += int(N / A) print(count) break N = N - B count += 1 if N < 0 : print(-1) break
true
3ae2feed469516db0402679ba5faa5810da9f489
Haidaansko/RICH_GAN_misc
/coopetition/scoring_program/score.py
UTF-8
1,624
2.546875
3
[]
no_license
import sys, os import yaml import numpy as np import pandas as pd from scipy.stats import ks_2samp scoring_program_path, input_dir, output_dir = sys.argv[1:] config_file_name = os.path.join(scoring_program_path, 'config.yml') with open(config_file_name) as f: config = yaml.load(f) submit_dir = os.path.join(i...
true
fb2d9d0a6fe6b69924e85417e9292994409d2e26
mszynka/PythonCrawler
/Crawl/crawler.py
UTF-8
1,265
2.78125
3
[]
no_license
""" ---------------------- Crawler module ---------------------- """ import time import urllib from urllib.error import HTTPError from urllib.request import urlopen from Base.base_class import BaseClass from Benchmark.benchmark_data import BenchmarkData from Benchmark.time_capsule import time_capsule from Parse.respo...
true
3061a7190f39ffd5fa06078fbc88e2a444d2d5c8
saeedsiddik/SnifferDog
/download_lib_versions.py
UTF-8
1,108
2.609375
3
[]
no_license
import json import sys import os import requests import wget import tarfile #invalid_suffixes = ('.exe', '.whl') invalid_suffixes = ('.exe') data_dir = '.' def single_package(package_name): url = "https://pypi.python.org/pypi/{}/json".format(package_name) r = requests.get(url) if r.status_code != 200: ...
true
4fd34bf9f2ffdf2f63b8881a78aa7e16d9da10f5
andresesfm/coding_challenges
/leetcode.com/combination-sum.py
UTF-8
1,673
2.9375
3
[]
no_license
from typing import List class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: l = len(candidates) candidates = sorted(candidates) DP=[[[] for j in range(l+1)] for i in range(target+1)] for i in range(target+1): DP[i][0] = None ...
true
0fde08f39557b5206791da228b221252d831959e
StevenH237/Stat-Calculator
/statcalc.py
UTF-8
4,446
3.96875
4
[]
no_license
"""As expected, imports at the top. I'll be explaining what the are next to them.""" from sys import argv #Commandline arguments. Only needed for the initial check. from pprint import pprint #"Pretty" print. It formats lists and dicts and such to be much easier to read in the console import argpars...
true
d29e987d10f4f492d49d66065ba23b24c41a88fd
rogalski/aoc2016
/src/day5.py
UTF-8
363
2.96875
3
[]
no_license
import hashlib import itertools door_id = "abbhdwsy" password = [] for i in itertools.count(): base = door_id + str(i) hashed = hashlib.md5(base.encode('ascii')) hashed_hex = hashed.hexdigest() if hashed_hex.startswith("0"*5): password.append(hashed_hex[5]) if len(password) == 8: ...
true
2cbb5b6a7dd2ed7de87dcf5411ed2fb5193696fd
4Kaylum/Synergy
/cogs/error_handler.py
UTF-8
4,269
2.609375
3
[]
no_license
import discord from discord.ext import commands from cogs import utils class ErrorHandler(utils.Cog): async def send_to_ctx_or_author(self, ctx:utils.Context, text:str, author_text:str=None): """Tries to send the given text to ctx, but failing that, tries to send it to the author instead. If it ...
true
978f3bee9de3fe3629259f664775568ab928ddf3
segunadelowo/product-microservice
/models/category.py
UTF-8
1,134
2.9375
3
[]
no_license
import sqlite3 from db import db class CategoryModel(db.Model): __tablename__ = 'categories' id = db.Column(db.Integer, primary_key=True) category_uuid = db.Column(db.String(80)) name = db.Column(db.String(80)) def __init__(self, category_uuid, name): self.category_uuid = category_uuid ...
true
e9a426f7e667b884d2c6760ffa65c014b9e389a4
jrmidkiff/arlington-data
/data_portal.py
UTF-8
2,626
2.828125
3
[]
no_license
from collections import namedtuple import json import pandas as pd import requests class Arlington: def __init__(self): self.limit = None def police_incidents(self, limit=None): """ Retrieve jsonify'd police incident data from Open Data Portal """ police_log = self.ge...
true
f291048c3e5417ea6b73ee36ca44b7547f98ff2d
pythonGuru/Python_Practice
/memoization_fact.py
UTF-8
219
3.5
4
[]
no_license
memo = {} def memoization_fact(n): if n < 2: return 1 if n in memo.keys(): return memo[n] else: memo[n] = n * memoization_fact(n-1) return memo[n] print memoization_fact(7)
true
9af03b2f4f39e2fd3c720682ca847e18a561bdcb
Jromary/Python_Exemple
/test_decorateur.py
UTF-8
496
3.171875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Import des modules import decorateur # Déclaration des fonctions @decorateur.afficher_temps def test1(): print("Hello World!") total = 0.0 for i in range(1, 100000 + 1): total += i ** 2 / i ** 1.5 print("Finished!") @decorateur.no_closing_con...
true
ff88b1fe9bbc46f738f4449263e5281ca8a63c5c
huy-hng/boulderslot_detector
/main.py
UTF-8
1,527
2.6875
3
[]
no_license
# %% import json import os from datetime import datetime import pandas as pd import requests from dotenv import load_dotenv load_dotenv() # %% url = 'https://backend.dr-plano.de/courses_dates?id=67152448&start=1614553200000&end=1617228000000' res = requests.get(url) slots = json.loads(res.text) df = pd.DataFrame(slo...
true
99c3718f44bc4b14676fa58285d588a4bfbe535e
I-G-P/Python
/Programming Basics/Simple Operations and Calculations - Exercise/03. 2D Rectangle Area.py
UTF-8
245
3.75
4
[]
no_license
import math x1 = float(input()) y1 = float(input()) x2 = float(input()) y2 = float(input()) side_a = abs(x1 - x2) side_b = abs(y1 - y2) area = side_a * side_b perimeter = 2 * side_a + 2 * side_b print(f"{area:.2f}") print(f"{perimeter:.2f}")
true
ee241ce1df3ba283845cf7d751975904b38aaedf
pulak777/cs5000
/pset7/houses/import.py
UTF-8
916
2.671875
3
[]
no_license
# TODO import csv, sqlite3 from sys import argv def dataload(argv): if len(argv) != 2: print("input error") return 1 db = sqlite3.connect('students.db') with open(argv[1], 'r') as csvf: dr = csv.DictReader(csvf) for row in dr: names = row['name'].split() ...
true
823d6d31abbebb9b23a6ff7fa48281a3c9917882
abecus/DS-and-Algorithms
/problems/CTCI/commonPrimes.py
UTF-8
863
3.34375
3
[]
no_license
import math from itertools import product def primeFactors(n, t): l = set() l.add(1) # l.add(n) app = l.add while n % 2 == 0: app(2) n = n/2 for i in range(3,int(math.sqrt(t))+1,2): while n % i== 0: app(i) n = n / i if n > 2: app...
true
b6dbb8b4988aae0c8c363c06ecd399ec7c4c3035
Annihilation7/Ds-and-Al
/tests/test_ds/test_rb_tree.py
UTF-8
440
2.765625
3
[]
no_license
# -*- coding: utf-8 -*- # Email: 763366463@qq.com # Created: 2020-02-07 03:41am import unittest from src.ds.rb_tree import RbTree class Test_RbTree(unittest.TestCase): def setUp(self) -> None: self.processer = RbTree() self.elems = [5, 3, 6, 8, 4, 2] def test_all(self): for elem in...
true
ec9cc913e31d9b14aec93645f4178c2c60b32c6f
sgango/Y1-Project
/dev-test/1_euler/daniel/2nd Order - Euler.py
UTF-8
707
3.21875
3
[ "BSD-2-Clause" ]
permissive
""" Daniel Buguks """ ### Defining function def dxdt(x,v,t): return -6*v-9*x+sp.cos(3*t) ### Initial condition t0=0 x0=0.5 v0=0 dt=0.1 stop=3 steps=int(stop/dx) t=sp.linspace(0,stop,steps) xval=sp.zeros(steps) vval=sp.zeros(steps) xval[0]=x0 vval[0]=v0 ### Loop for numerical solutions for i in range(0,s...
true
b7052ae78e89284aa6422c76b84c788acfcd3f23
at-bradley/python_Main
/Sublime/TIY4b.py
UTF-8
1,236
4.25
4
[]
no_license
# 4-3 print "\n" for value in range(1,21): print value print "\n" # 4-4 for value in range(1, 100000000): # Works, but memory error. print value print "\n" numbers_up_to_1000 = [value for value in range(0,100)] print numbers_up_to_1000 print"\n" print min(numbers_up_to_1000) print max(numbers_up_to_1000) print sum...
true
585e39eb2c9abcef860fbd335954b092d6561da3
GolamRabbani20/PYTHON-A2Z
/1000_PROBLEMS/ExamplesOnStrings/Problem-11.py
UTF-8
267
4.46875
4
[]
no_license
#Python Program to Count Number of Lowercase Characters in a String x=input("Enter a string:") count1=0 for i in x: #if i>='a' and i<='z': #count1+=1 if (i.islower()): count1+=1 print("Number of lower case character in the string is:",count1)
true
b4ffe129f99bcba7384b62a05a99ccbb7859c896
devendraingale2/PythonPrograms
/anglesoftriangle.py
UTF-8
218
3.671875
4
[]
no_license
a,b,c=input("Input:").split(" ") d=int(a) e=int(b) f=int(c) if d+e+f!=180: print("The Triangle with Angles",d,e,"&",f,"is an Invalid One.") else: print("The Triangle with Angles",d,e,"&",f,"is a Valid One.")
true
b217643f1fef5600c8babb3a2c193e55268e2154
yordan-marinov/advanced_python
/multidimensional_lists/sum_matrix_elements.py
UTF-8
800
3.546875
4
[]
no_license
""" 3, 6 # rows_length, columns_length 7, 1, 3, 3, 2, 1 # 1, 3, 9, 8, 5, 6 # matrix 4, 6, 7, 9, 1, 0 # """ rows_length, columns_length = [int(i) for i in input().split(", ")] matrix = [] for _ in range(rows_length): row = [int(i) for i in input().split(", ")] matrix.append(row) # matrix = ...
true
41debe0773eaa7210b6f7f6088737672343474e5
CristianeNaves/HMRSsim
/simulator/components/Pickable.py
UTF-8
153
2.765625
3
[]
no_license
class Pickable: def __init__(self, weight, name, skeleton): self.weight = weight self.name = name self.skeleton = skeleton
true
c20726398ec93bcbc0a8e9ec886bbc639dfea822
zomux/utils
/parse-sentence-to-trees.py
UTF-8
624
2.671875
3
[]
no_license
import sys, os, tempfile if len(sys.argv) != 2: print "python parse-sentence-to-trees.py [sentence]" def execute(cmd): print cmd os.system(cmd) _, sentence = sys.argv sentence = sentence.strip() _, pathText = tempfile.mkstemp() _, pathCFG = tempfile.mkstemp() _, pathDep = tempfile.mkstemp() open(pathText, "...
true
ed5a993f23da81e1b0481c5ad9126967f58374f3
prasanna12510/prefork-sample
/server.py
UTF-8
1,538
2.625
3
[]
no_license
import time import datetime import tornado.web from tornado.ioloop import IOLoop from tornado import gen import tornado.wsgi from tornado.httpclient import AsyncHTTPClient count = 0 data = range(10000) print "Loading data: %s" % len(data) class SleepHandler(tornado.web.RequestHandler): @tornado.web.asynchronous ...
true
70cd61ee25e668aa51f18a134d586637757c98f7
yasenstar/python
/draw/tkinter/ch1_6.py
UTF-8
248
2.890625
3
[]
no_license
from tkinter import * root = Tk() screenWidth = root.winfo_screenwidth() screenHeight = root.winfo_screenheight() w = 300 h = 160 x = (screenWidth - w) / 2 y = (screenHeight - h) / 2 y = 200 root.geometry("%dx%d+%d+%d" % (w,h,x,y)) root.mainloop()
true
7cb42eebfa711f9414871c68b408bb3648a39d04
ltakuno/arquivos
/python/URI/Basico/uri1160.py
UTF-8
430
3.8125
4
[]
no_license
# 1160 - crescimento populacional t = int(input()) while(t): l = input().split() pa = int(l[0]) pb = int(l[1]) g1 = 1.0 + float(l[2])/100.0 g2 = 1.0 + float(l[3])/100.0 anos = 0 while (pa <= pb and anos < 110): pa = int(pa * g1) pb = int(pb * g2) anos += 1 if ...
true
a3a91fa7d4b02ee728b0db8a00016ef463d51388
soumeet/apriori-algorithm
/test11.py
UTF-8
6,060
2.515625
3
[]
no_license
import sys import csv import time dataset=sys.argv[1] min_support=float(sys.argv[2]) min_confidence=float(sys.argv[3]) transactions=[] no_of_transactions=0 itemset=[] itemset_support={} itemset_count={} frequent_1itemset=[] itemset2=[] itemset2_support={} itemset2_count={} itemset2_confidence={} frequent_2itemset=[]...
true
c3f53f2b7242004ed3c5a67bac2b8aa8a4d0c6dc
AleksasMurauskas/ECSE-416-Telecommunication-Networks
/Lab 1 Submission/server.py
UTF-8
2,350
3.203125
3
[]
no_license
""" Aleksas Murauskas 260718389 Florence Diep 260727117 ECSE 416 Lab 1: Client/Server Server Side """ #import statements import socket import sys import pickle from PIL import Image #Set server information ServerName = '127.0.0.2' serverPort = 12345 #Create Socket serverSocket = socket.socket(...
true
29bed90be96605dc9325e5e54583ad3b25164086
nedstarksbastard/petal_challenge
/petal.py
UTF-8
3,163
3.234375
3
[]
no_license
import pandas as pd import numpy as np import multiprocessing as mp from chunk_iter import iter_chunk_by_id def escaped_split(s, delim="|"): """function to delimit the provided string in the right manner taking care of escaoed delimiter""" ret = [] current = [] itr = iter(s) for ch in itr: ...
true
992fd90fcbde34d0eaca97e5c0a9101b3c14e77e
anuhyav/nfq
/nfq.py
UTF-8
4,362
2.71875
3
[ "MIT" ]
permissive
#!/usr/bin/env python import random import torch import torch.optim as optim import torch.nn.functional as F import models import envs def set_random_seeds(train_env, test_env, seed=0xc0ffee): """ Set random seeds for reproducibility. """ train_env.seed(seed) test_env.seed(seed) random.seed(s...
true
7923b971c860b432a3aef18ee018e00b3b8249c8
0826hihi/AlgorithmStudy
/Part3/q25.py
UTF-8
474
2.828125
3
[]
no_license
def solution(N, stages): answer=[] count=[0]*(N+1) challenging=[0]*(N+1) for stage in stages: for i in range(stage): count[i]+=1 challenging[stage-1]+=1 for i in range(N): if count[i]==0: result=0 else: result=challenging[i]/count[...
true
86b85dfbb4f87ac4aded58b8d0f2800734fc2d1a
YongfeiYan/Neural-Document-Modeling
/scripts/topic_interpretability/SplitSVM.py
UTF-8
1,736
2.9375
3
[ "MIT" ]
permissive
""" Split SVM input into 10 partitions for doing 10-fold cross validation. Usage: SplitSVM.py <output_dir> Stdin: original svm input Stdout: N/A Other Input: N/A Other Output: 10 paritions of the original input Author: Jey Han Lau Date: Nov 10 """ import sys if len(sy...
true
9b6b33de09bb8f3da481f400b039b6f90339554f
seo0/MLstudy
/adsa_2016/module13_graphs01/graph_manipulation1.py
UTF-8
264
2.875
3
[]
no_license
# IDEA: build a graph, find a shortest path (undirected graphs) # implement methods to remove a list of vertices and all the nodes incident on them? # build a graph, e.g., Ulsan map # remove a list of vertices from a graph and all the nodes incident on them
true
aad4da70e2693345363c40761b8ccbed8eaee689
ComplianceAsCode/content
/utils/build_profiler_report.py
UTF-8
10,112
3.15625
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/python3 """Compare and present build times to user and generate an HTML interactive graph""" import sys import argparse def load_log_file(file) -> dict: """Loads Targets and their durations from ninja logfile `file` and returns them in a dict""" with open(file, 'r') as file_pointer: lines ...
true
70fc79325ad1646fe6570cb42b8b788d1fd40965
JayPay108/Python-Chess-Engine-and-AI
/Board.py
UTF-8
7,090
3.4375
3
[]
no_license
from Piece import * from Config import * from PieceSquareTables import squareTables class Board: def __init__(self): # Piece declaration: # PieceType(isWhite, (rowNum, colNum)) self.board = [[Rook(False, (0, 0)), Knight(False, (0, 1)), Bishop(False, (0, 2)), Queen(False, (0, 3)), King(Fals...
true
86d8b2263a19efc93966a3258e1d491bd20e9a8d
matt-deboer/dpMMlowVar
/python/buffered.py
UTF-8
2,812
2.6875
3
[]
no_license
# Copyright (c) 2015, Julian Straub <jstraub@csail.mit.edu> Licensed # under the MIT license. See the license file LICENSE. import os import pickle from config import Config2String class BufferedResult(object): ''' buffers the result of a computation of function fct with data (dict) in a local path (if nf...
true
9c871d42f3827005f254c9b1c36b926347056e13
PRAWINM/beginner
/set7 64.py
UTF-8
97
2.90625
3
[]
no_license
if sum(map(int,input("Enter Two values").split(' ')))%2==0: print("even") else: print("odd")
true
9004abf40de31b78d4c61a13077f5573c0c5c45f
shivamchoudhary2121997/Seoul-Bike-trip-duration-prediction-deployment
/app.py
UTF-8
3,022
3.3125
3
[]
no_license
import joblib import pandas as pd import numpy as np import streamlit as st import time from math import pi, radians, cos, sin, asin, sqrt import datetime import pickle import xgboost def calc_haversine(lon1, lat1, lon2, lat2, is_deg=True): """ Calculate the great circle distance between two points on the...
true
c7ce44f10d0884885122b4a2adf115d2e20c1c37
pep8speaks/robosub-ros
/catkin_ws/src/motion_planning/scripts/move_tasks.py
UTF-8
2,021
2.671875
3
[]
no_license
from task import Task from geometry_msgs.msg import Pose, Quaternion from tf.transformations import quaternion_from_euler import tf import task_utils import rospy class MoveToPoseGlobalTask(Task): """Move to pose given in global coordinates.""" def __init__(self, x, y, z, roll, pitch, yaw, *args, **kwargs): ...
true
95d77fc1a38ca7679d17151a424097b1a3a3d94e
hellrich/metal_lyric_topic_modeling
/describe-with-topics.py
UTF-8
1,329
3.109375
3
[ "MIT" ]
permissive
from docopt import docopt from collections import OrderedDict from math import sqrt def get_doc_topics(f): results = [] with open(f, "r") as docs: for doc in docs: doc = doc.split() _id = doc[0] name = doc[1].split("/")[-1:][0].replace(".html.txt","") t...
true
80d2664df1426f441f1369557fb6b2fd829cdeed
vivianndai/markov-horoscopes
/mem_generator.py
UTF-8
3,217
3.640625
4
[]
no_license
import json import unidecode from collections import defaultdict, Counter import random # List of tuples of starting words starting_states = [] STATE_LENGTH = 3 def load_data(dfile): """ Loads the data from a json file. """ with open(dfile) as json_data: jsonData = json.load(json_data) ret...
true
2a2e1bb48c18a8123ae4a2d9af37198221309766
santosmichele/Python
/Roteiro3/garcom.py
UTF-8
852
3.203125
3
[]
no_license
############################################################################################### ###################################### Michele Santos ######################################### ################################# Algoritimos e Programação I ################################# ################################...
true
145261cc7a7c47571b22e0b94d1de2d78ddf4517
subokita/guided_filter
/guided_filter.py
UTF-8
2,349
2.96875
3
[]
no_license
#!/usr/bin/env python # encoding: utf-8 # Based on http://kaiminghe.com/publications/eccv10guidedfilter.pdf # and https://github.com/pfchai/GuidedFilter from scipy.misc import imread import numpy as np import scipy.misc as sci import matplotlib.pyplot as plot class GuidedFilter( object ): @cl...
true
6585d69644ec9df19780f16ee3aecb6559749edc
reks93/Python
/Day12_RemoveDuplicatesinLinkedlist.py
UTF-8
1,754
4.4375
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Sep 9 21:50:17 2020 @author: bairavi """ #Finding the duplicate strings in a linked list. You are given a linked list with some elements and you have to write a function to list all the strings occurring more than once. But each such string should be printed only once,...
true
9f74ee4bf5c83d1c1c65d85ba43d029ed62b2f3c
DuCeh/ARobot
/camera_calibration.py
UTF-8
3,310
2.546875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # 摄像头和机械臂的位置校准 import cv2 import numpy as np import time import threading import signal import LeArm import kinematics as kin import RPi.GPIO as GPIO debug = True stream = "http://127.0.0.1:8080/?action=stream?dummy=param.mjpg" cap = cv2.VideoCapture(strea...
true
bee4cc1a8b5ea17eba78fce3b47dddc9ded04cd0
sumi89/Computer_Vision
/lab2_.py
UTF-8
2,457
2.9375
3
[]
no_license
#Apendix: import numpy as np import os import cv2 import time import matplotlib.pyplot as plt from scipy import interpolate def eqHist(original): image = original.copy() image[:,:,0] = cv2.equalizeHist(image[:,:,0]) image[:,:,1] = cv2.equalizeHist(image[:,:,1]) image[:,:,2] = cv2.equalizeHist(image...
true
cabde0f13bde3192cc1d015ddbcabb989a69e5c8
Algorithm-P0/meanjung
/2021/14499.py
UTF-8
992
3.015625
3
[]
no_license
import sys N, M, y, x, K = map(int, sys.stdin.readline().split()) graph = [] for _ in range(N): graph.append(list(map(int, sys.stdin.readline().split()))) order = list(map(int, sys.stdin.readline().split())) dice = [0,0,0,0,0,0,0] #d 1동 2서 3북 4남 dy = [0,0,0,-1,1] dx = [0,1,-1,0,0] def move(direction): if direc...
true
7c152a7b115d411c4010da071a154de7a77a5e58
TTurn/Hohi
/hiho-project/149_forbidden.py
UTF-8
2,686
2.96875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2017/7/21 21:16 # @Author : Tuhailong # @Site : # @File : 149_forbidden.py # @Software: PyCharm Community Edition #https://hihocoder.com/contest/hiho149/problem/1 #匹配第一个 class TrieNode(object): def __init__(self): self.child = [None, None...
true
42e20946cfac4005c2aca8544bddc9838a9ba650
hirokitnk/python_online_judge
/ITP1/ITP1_7_A.py
UTF-8
495
3.015625
3
[]
no_license
while True: scores = list(map(int,input().split(" "))) m = scores[0] f = scores[1] r = scores[2] total = m + f if m == -1 and f == -1 and r == -1: break elif m == -1 or f == -1: print("F") elif total >= 80: print("A") elif total >= 65: print("B") e...
true
ea9f90c98927120cdc71194bf96f57245b8402d6
josefdv0103/Aprendendo_OpenCV
/draw.py
UTF-8
1,203
3.40625
3
[]
no_license
import cv2 as cv import numpy as np blank = np.zeros((500, 500, 3), dtype = 'uint8')#dtype = datatype cv.imshow("Em Branco", blank) # Pontuar a imagem com uma certa cor #Verde #blank[:] = 0, 255, 0 #Vermelho #blank[:] = 0, 0, 255 #Tamanho dentro do display blank #blank[200:300, 300:400] = 0, 0, 255 #cv.imshow('Re...
true
65a6ce9e971e4f8db55b94394d828532852a5ff0
SuperMartinYang/learning_algorithm
/leetcode/medium/combination_sum4.py
UTF-8
1,006
3.296875
3
[]
no_license
class Solution(object): _res = 0 def combinationSum4(self, nums, target): """ backtracking TLE :type nums: List[int] :type target: int :rtype: int """ self.helper(nums, target) return self._res def helper(self, nums, rem): if rem == 0...
true
c458bae97107b2a7583ade01313b2db5d2fee389
tarynblack/glacier-edges
/glaciers.py
UTF-8
1,802
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Dec 11 08:15:21 2018 @author: courtney """ import subprocess import os import matplotlib.pyplot as plt init_path = r"/home/courtney/Desktop/practice/" os.chdir(init_path) glaciers_path = r"/home/courtney/Desktop/practice/glaciers.txt" mosaics_path = r"/home/courtney/Deskto...
true
fc1c3794a15f80a8c96ad20cfd4686882da3be11
Matthew-Ruben/ZenHubTest
/hotelroom.py
UTF-8
2,419
3.703125
4
[]
no_license
def main(): room1 = HotelRoom("Room 1") if __name__ == '__main__': main() # First commit fom this branch # MERGED SUCCESSFULLY - YEETLYFE class HotelRoom: room_count = 0 # class variable def __init__(self, room_name): """ Initialize the room with a name :param room_name: (string) name the room wi...
true
e0916b2ae5e500f9b55a84d684b5b4d2d513032f
edgardoruiz/-FD-_Tareas_de_clases_en_Python_00170019
/factorial.py
UTF-8
313
3.921875
4
[]
no_license
factorial = 1 a = int(input("Ingresa un numero " )) b = 1 if a < 0: print ("El factorial es: ") print(factorial) elif a == 0 : print ("El factorial es: ") print (factorial) else : for b in range (1,a+1): factorial = b * factorial print("El factorial es: ") print(factorial)
true
99810f00e0988d871eb0368433acb03705f447e2
ahsiang/AutoMorph
/run2dmorph/extractoutline.py
UTF-8
5,374
2.640625
3
[]
no_license
#!/usr/bin/env python # 2022-04: Python2 to Python3 conversion by Allison Hsiang import filters # Exception for run3dmorph operation try: import images import save except: pass import os import cv2 import numpy as np def extractOutline(settings,image_name,image,run3dmorph): ''' Runs image filt...
true
a70c07574ee472d00e382075ee66f2cbf327181d
warna720/Simple-chat-server
/server.py
UTF-8
2,231
2.765625
3
[]
no_license
#!/usr/bin/env python3 #-*- coding: utf-8 -*- import socket, select, cPickle, collections, chat_pb2 def send_data(sock, data): try: sock.send(cPickle.dumps(data)) except: print("Error: probably broken pipe") def recv_data(sock): try: return cPickle.loads(sock.recv(4096)) ...
true
613e465d11d9a7e24707b4461300e48e9b40d81d
Vestara/audiogame
/lib/AudioBox/__init__.py
UTF-8
1,506
2.90625
3
[]
no_license
# Author: Stephen Luttrell """Provides an audio only interface for menus and basic popups Fixed Constants --------------- ESCAPE : integer, 1 Sets the escape keyboard key to exit the current focus HOME_AND_END : integer, 3 Sets the home and end keyboard keys to jump the cursor to the top or bottom of a menu respecti...
true
5800bf5376fcc135c5c760f3d945d00e8aaa29a4
aiedward/Awesome-Computer-Vision-Guide
/src/01 - Image/02-Image_Processing.py
UTF-8
1,194
3.109375
3
[ "MIT" ]
permissive
''' output : Output image can be resize named window can be use to resize the window imwrite to save the image ''' # Import package import cv2 import numpy as np # Display the set of flags which start with COLOR_ flags = [i for i in dir(cv2) if i.startswith('COLOR_')] print(flags) # Read image img ...
true
9891c1a4e832ae6aaa3eb792c31c8364632a5b12
florisvb/flybot
/optic_flow/nodes/float_msg_to_numpy.py
UTF-8
130
2.546875
3
[]
no_license
import numpy as np def get_numpy_array(shape, data): data_array = np.asarray(data).reshape(shape) return data_array
true
7991cc6381a5c355d775b998729b706419398938
lebomorojele/investecbot
/server/tests.py
UTF-8
7,297
3.125
3
[]
no_license
from run import Card, Transaction, Merchant from run import and_ from run import c1, c2 from run import m1, m2, m3 from run import t1, t2, t3, t4, t5, t6, t7 from run import buildFilter from run import queryObjects """"" Abstract Transaction Lookups 1) Creates filter from abstracted operator and operands eg. Transa...
true
5e28e022d0738d97333cde2bfcca2e6395ae4452
sueisbest/lpthw
/maopao.py
UTF-8
464
3.234375
3
[]
no_license
# -*- coding:utf-8 -*- yas = [100, -1, 50, 22, 100, 0, 88] for a in range(0, len(yas) - 1): for i in range(0, len(yas) - a - 1): if yas[i] > yas[i + 1]: yas[i], yas[i + 1] = yas[i + 1], yas[i] else: pass print(yas) for a in range(0, len(yas) - 1): for i in range(0, le...
true
bbb34df04f3db26529c1d299632e04a2a4d40d92
donghoney/Algorithm
/Samsung/14503.py
UTF-8
896
2.828125
3
[]
no_license
n, m = map(int, input().split()) r, c, d = map(int, input().split()) clean = [list(map(int, input().split())) for _ in range(n)] dx = [-1, 0, 1, 0] dy = [0, 1, 0, -1] ans = 0 def move(x, y, di): global ans queue = [[x, y]] while queue: cur = queue.pop() no = 0 if clean[cur[0]][cu...
true
5e7065ab3824ec2c78b9e33f0e8312bee1fcd5d6
amrka/nilearn_tutorials
/nilearn_clustering_006.py
UTF-8
4,399
2.84375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # # <font color=red>3.5.3.2. Compressed representation # ## 8.4.12. Clustering methods to learn a brain parcellation from rest fMRI # In[13]: from nilearn import datasets, image, plotting dataset = datasets.fetch_adhd(n_subjects=1) # ### <font color=green> Brain parcellati...
true
3584d9f857c4cc6aea67627e6f867a6f99538223
mars-project/mars
/mars/tensor/arithmetic/isreal.py
UTF-8
1,661
2.515625
3
[ "BSD-3-Clause", "MIT", "ISC", "Apache-2.0", "CC0-1.0", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2021 Alibaba Group Holding Ltd. # # 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-...
true
ff367c65e3d57eb550e124954cd0df72c0351be3
relientm96/capstone2020
/src/training/unit-testing/removeConfidenceAndAppend.py
UTF-8
2,850
2.59375
3
[]
no_license
#/usr/bin/env/python # created by matthew, nebulaM78 team; capstone 2020; # unit testing for the relevant modules in gestureRecognition.py and serverOpenPose.py # 1. removeConfidenceAndAppend() import sys import cv2 import os from sys import platform import argparse import errno import shutil import json def removeCo...
true
10431f865e42a035db07ac262d6b451a47df5203
tracholar/ml-homework-cz
/basic-optimization/getstart/main.py
UTF-8
1,673
3.03125
3
[]
no_license
#coding:utf-8 def bgd_optimizer(w, g, lr=0.1, l1=0, l2=0.1): """ 实现批量梯度下降 :param w: :param g: :param lr: :return: """ if l1 == 0: raise NotImplementedError() else: # l1范数软阈值算法 raise NotImplementedError() return w def sgd_optimizer(w, g, lr=0.1, l1=0, l2=0.1): ...
true
40e3d56c2c8a47dca71d163c186000b8a8d5f914
piotr-urb/python_kurs
/Hackaton_2/02_gra_rpg/tavern_dice.py
UTF-8
3,862
3.84375
4
[]
no_license
# taver_dice import random filename = "eq.txt" with open(filename, 'r') as f: content = f.readlines() print(content) adventurer = content[0].split()[1] purse = (content[3].split()[1]) def forester(): print(" Its take you 8 hours to got to the forest man, so your supply are diminish to half") print("...
true