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
fbce039d6a22ff99c4a0426205f54479cee34aec
cthacker/Cosmology
/integrate.py
UTF-8
462
2.984375
3
[]
no_license
#!/usr/bin/env python import math def Simpsonint(a, b, n,func): #Uses composite Simpson's rule to numerically integrate from a to b #There are 2*n steps n *= 2 h = (float(b)-a)/n fx = 0.0 fy = 0.0 for i in range(1,n,2): xi = a + i*h fx += func(xi) for i in ran...
true
5e7e165790cc99f9475b64f35732c348c99f902f
henry-aw/CU_FinTech_Workspace
/18_Blockchain_with_Python/03-Hashing_a_Block/Unsolved/app.py
UTF-8
3,958
4.3125
4
[]
no_license
# Hashing a Block ################################################################################ # In this activity, you’ll create a Streamlit application that can create a new # block of data and display the hash for that block. # # Complete the following steps: # 1. Review the starter code included for both the `Bl...
true
93faaf6db95247627f4781e31c47028f602a2d0d
Thewessen/hello-world
/Exercism/python/minesweeper/minesweeper.py
UTF-8
939
3.046875
3
[ "MIT" ]
permissive
def annotate(minefield: list) -> list: """Creates annotations for minesweeper field""" if len(minefield) == 0: return minefield width = max(len(row) for row in minefield) if width == 0: return minefield if not all(len(row) == width for row in minefield): raise ValueError("Min...
true
47e92ffdb01c9f1fcbf6435de46f9a0fa9d9157b
wllmnc/hackerRank
/string/camelcase
UTF-8
202
3.0625
3
[]
no_license
#!/bin/python #https://www.hackerrank.com/challenges/camelcase import sys s = raw_input().strip() cont=1 for i in xrange(len(s)): cont=cont+ (1 if ord(s[i])>64 and ord(s[i])<91 else 0) print cont
true
7499c01619bedda1b4f736a8d00767fdf35e21df
sbobbala76/Python.HackerRank
/6 - Python/Regex And Patterns/3 - Group(), Groups() & Groupdict().py
UTF-8
90
2.625
3
[ "MIT" ]
permissive
import re S = input() m = re.search("(\w(?!_))\\1+", S) print(m.group(1) if m else "-1")
true
5a1d7e90258332c707eae28ddeae38d5d50b357d
MENGJIAOMAX/HR_system
/Models/leave.py
UTF-8
276
2.9375
3
[]
no_license
class Leave: def __init__(self, leave_id, leave_status): self.leave_id = leave_id self.leave_status = leave_status def get_leave_dict(self): leave_dict = {"leave_id": self.leave_id, "leave_status": self.leave_status} return leave_dict
true
4bbb0b275e0609bd40e58fa2bf91e98f2fe3461b
romu42/aoc2019
/day3/manhattan_distance.py
UTF-8
2,002
3.640625
4
[]
no_license
# https://adventofcode.com/2019/day/3 """ R, Right is +x L, Left is -x U, Up is +y D, Down is -y manhattan distance is |x1 - x2| + |y1 - y2| """ def closest_intersect(path1: list, path2: list) -> int: common = set(path1) & set(path2) positions = [element for element in common if element ...
true
35b3e4c3c5d6fd6f8dcedbff7dcd4423a5de3bfe
weijiasun2013/Algorithms
/hashing/all_subarry_with_zero_sum/all_subarry_with_zero_sum.py
UTF-8
821
3.578125
4
[]
no_license
def all_subarry_with_zero_sum(arr): # Print all subarrays with 0 sum d = dict() sum = 0 for idx,ele in enumerate(arr): sum += ele if sum not in d: d[sum] = [idx] else: d[sum].append(idx) rslt = [] for k,lst in d.items(): ...
true
01aea5dfb410792b1c4c4fc2e254be20d34655e0
yydlmzyz/PCGCv1
/models/conditional_entropy_model.py
UTF-8
6,556
2.796875
3
[ "Apache-2.0" ]
permissive
# Copyright (c) Nanjing University, Vision Lab. # Last update: 2019.10.07 import tensorflow as tf import numpy as np from tensorflow.contrib.coder.python.ops import coder_ops class SymmetricConditional(tf.keras.layers.Layer): """Symmetric conditional entropy model. Argument: likelihood_bound; range_code...
true
c9ae4893fe3e5fd13896c972340334c6252cc5cb
AmmarMian/Numeral-recognition-lab
/tests/test_reconnaissance.py
UTF-8
1,446
2.953125
3
[]
no_license
import sys sys.path.append('../src') sys.path.append('./src') from image import Image import numpy as np import unittest from reconnaissance import lecture_modeles, reconnaissance_chiffre path_to_assets = '../assets/' class Test_reconnaissance_chiffre(unittest.TestCase): def test_reconnaissance_is_not_None(self):...
true
8276a3feeae4c4abd0c983b4ed58bf05704b3782
ravenclaw-10/Python_basics
/basic/sort_sep_hyphen.py
UTF-8
442
4.1875
4
[]
no_license
'''Write a Python program that accepts a hyphen separated sequence of words as input and prints the words in a hyphen-separated sequence after sorting them alphabetically. Sample Items: green-red-yellow-black-white Expected Result: black-green-red-white-yellow''' seq=input("Enter the sequence:-") upd_seq=[] s...
true
129dfad1faf0838672d9ad7bbfdc383342421901
DustinFlynn297/Intro-to-python
/Intro to OOP/magician.py
UTF-8
657
4.09375
4
[]
no_license
from card import Card class Magician: def __init__(self): self.cards = [] self.chosen_card_value = 0 def create_cards(self): i = 2 while i <= 10: self.cards.append(Card(i)) i += 1 else: for card in self.cards: print(c...
true
fc030fd7570c18a61e71474cf916aced0c1b3563
tandat-1305/Relax_code
/1_list_cau_lenh_131.py
UTF-8
877
4.09375
4
[]
no_license
list1 = [1,2,3,4,5,6] list1.remove(1) #xóa phần tử đầu print(list1) list1.pop() #xóa phần tử cuối print(list1) list2 = [1,2,3,4,5,6,7,8,9] del list2[1] #xóa phần tử thứ 2 del list2[0:3] #xóa phần tử đầu đến 2 list3 = [0,2,4,6,8] del list3[0:2:4] #del list[i,j,t] => xóa ptu có chỉ số i,...
true
35a797f945e1788bb98de304a21758ad0aab0abc
clintonboys/starfall-sim
/token.py
UTF-8
1,359
3.078125
3
[]
no_license
import math class Token(object): def __init__(self, stars, comets, planets, moons, cloud, black_holes): self.stars = stars self.comets = comets self.planets = planets self.moons = moons self.cloud = cloud self.has_cloud = 1 if self.cloud != 'no' else 0 self....
true
ea89b87d9ac14c7c1b93035f5618afed36d35e1d
godesteem/rental
/chore/services/available_products.py
UTF-8
2,306
2.515625
3
[]
no_license
import datetime import typing from django.db.models import QuerySet, F, Sum, Case, When from chore.services.rental_periods import RentalPeriodService class AvailableProductsService: def __init__(self, from_date: datetime.datetime, to_date: datetime.datetime) -> None: self.from_date = fr...
true
5d164acd38f59a92fbeffd9170140419a79ad721
olemb/nonsense
/fizzbuzz/functions.py
UTF-8
257
3.765625
4
[]
no_license
def fizz(i): if i % 3 == 0: return 'Fizz' def buzz(i): if i % 5 == 0: return 'Buzz' def fizzbuzz(i): if fizz(i) and buzz(i): return 'FizzBuzz' for i in range(1, 101): print(fizzbuzz(i) or fizz(i) or buzz(i) or i)
true
e6c4390b9fc933c31ef5cfb8492604c6d510e981
drussellmrichie/uconn_jterm_python_workshops
/python-psychopy/psychopy-tutorial-pack/code/02_image.py
UTF-8
924
3.328125
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Demo for presenting image stimuli with Psychopy Psychopy Tutorial by Monica Li, 10-18-2016 """ # set up current folder path parent_dir = "/Users/mli/Desktop/psychopy-tutorial/" # load Psychopy modules for visual stimuli and clock from psychopy import visual, core # ...
true
08526af5b986589003949310105bd1f90db9f238
foncea/protocolo-empresas
/medidas_preventivas/correr_simulacion.py
UTF-8
958
2.59375
3
[]
no_license
import os import time import datetime # Parametros alg = ['Bios', 'BiosPrevencion', 'HacerNada'] # frec_test = [3, 3, 0, 0] * 2 ctna_dur = [14] * 12 ctna_inic = [1] * 6 pob = [100] * 20 r0 = [3] * 20 tiempo = [156] * 6 iteraciones = [3000] * 20 fecha = ['...
true
1a0d0cae378d9d4ce9258f7620a82a1e62b0a915
gnikolaropoulos/AdventOfCode2020
/day13/main.py
UTF-8
1,274
3.5625
4
[]
no_license
def solve_part_1(timestamp, buses): waiting = 0 while True: for buss in buses.values(): if buss != 0: if (timestamp + waiting) % buss == 0: return waiting * buss waiting += 1 def solve_part_2(buses): time = 0 jump = buses[0] for times...
true
7325b98d9577b63bbf4cd065103709d604ba6ae1
NitikeshDubey011/Self_supermarket
/product.py
UTF-8
1,086
3.640625
4
[]
no_license
class product(): # list in which products will be keep list_products = [] # default constructor which have parameters i.e. product code, product name , product weight and product amount def __init__(self, pro_code, pro_name, pro_weight, pro_amount): # this is the product code which will be scan...
true
6fdc9bf0c54a438b43f7a3a4989bb73d74bdf74b
gschen/sctu-ds-2020
/1906101018-湛鑫/Day0317/第四次作业/01.py
UTF-8
2,801
4.1875
4
[]
no_license
# "''回合制人物Pk游戏 # 创建一个角色类(类),包含属性有:角色名称、角色血量、攻击力、暴击率、闪避率。 # 创建一个游戏类,属性包含参加游戏的双方(对象),方法有playGame,参加游戏的双方互相攻击,可能产生暴击-----攻击力*2,可能闪避----闪避当前对方的攻击,直到一方血量<0,游戏结束。该方法打印每一轮游戏的情况,以及最终的获胜情况。 # 备注:如果暴击率是0.2可以用以下语句判断是否造成暴击 # if random.random() <= 0.2: # pass''' import random class Player(): def __init__(self,name,blood,attack,cr...
true
e23437bfc29c76757e23c090d2a01d98453e132a
bbalin12/DAT5_BOS_students
/mm-wang/Class 10 Ensemble Methods/10_homework.py
UTF-8
15,969
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Feb 25 21:09:44 2015 @author: Margaret """ import sqlite3 import pandas from sklearn import preprocessing from sklearn.preprocessing import Imputer from sklearn import ensemble import numpy from sklearn.feature_selection import RFECV from sklearn.cross_validation import cros...
true
a235802dfcbfb7e6998f49532983ac52647e445a
manuelvsousa/fp-labs
/lesson03_solved/7.py
UTF-8
177
3.671875
4
[ "MIT" ]
permissive
def arctg(x,n): a=0 while n>=0: a+=((((-1)**n)*(x**(2*n+1)))/(2*n+1)) n-=1 return a x=int(input("X: ")) n=int(input("N: ")) print(arctg(x,n))
true
6bbbb25fc0067042d9c45db1644cf3336d44e21f
lstrait2/Portfolio-Site
/view/portfolio_views.py
UTF-8
4,166
2.78125
3
[]
no_license
from flask import Blueprint, render_template, abort, request from model.portfolio.entries import Comment from app import db def construct_portfolio_blueprint(portfolio): """ Blueprint to create routes for portfolio site :param portfolio: portfolio data created by XMLParser :return: blueprint with registered routes...
true
89054d88db15747e2dbb65b52ee25192ba591584
PedroHonda/fuelControl
/fuelControlDatabaseService/src/myDB.py
UTF-8
5,057
3.234375
3
[]
no_license
# Script made to create the database for the API import sqlite3 class myDB: def __init__(self, dbName): self.connection = sqlite3.connect(dbName) self.cursor = self.connection.cursor() self.tables = {} def createTable (self, tables): """ Input: table - dictionary with table's...
true
0c15e351af1c1e3c24ecf847808bd410cf5233cc
JoshFeldman95/checklist
/checklist/cli.py
UTF-8
520
3.15625
3
[]
no_license
import click from .checklist import load_checklist @click.command() def main(): cl = load_checklist() # print warnings for idx, w in enumerate(cl.warnings, 1): click.echo(f"\nWARNING {idx}: "+w) click.echo('\n') # print checklist completed = {} for itm in cl.items: complet...
true
c0b83b869fe915c16fe91a3509b9bcef7411a790
quanted/ubertool
/ubertool/ted/ted_functions.py
UTF-8
158,720
2.9375
3
[ "Unlicense" ]
permissive
from __future__ import division # brings in Python 3.0 mixed type calculation rules import logging import numpy as np from numpy import math import pandas as pd import math class TedFunctions(object): """ Function class for TED model. """ def __init__(self): """Class representing the functio...
true
0b58e64b1d5668efe1ab4399b06393083453c0a4
jsnkde/revel
/shop/catalog/templatetags/custom_tags.py
UTF-8
424
2.53125
3
[]
no_license
from django import template register = template.Library() @register.filter def range(value, end): return value[:end] @register.filter def slice(value, argstr): args = argstr.split(',') start = 0 end = None step = 1 try: if len(args) > 0: start = int(args[0]) if len(args) > 1: end = int(args[1])...
true
0d6eaff61da6ee64c99d9df8209da47187e74537
kevinsuo/CS7357
/linear-regression/lr.py
UTF-8
1,945
3.359375
3
[]
no_license
from collections import OrderedDict from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt import pandas as pd examDict={ 'Study time':[0.50,0.75,1.00,1.25,1.50,1.75,1.75,2.00,2.25, 2.50,2.75,3.00,3.25,3.50,4.00,4.25,4.50,4...
true
9b79c48da3be81d98299ae8b71286e2bb45d25de
jiangshen95/UbuntuLeetCode
/BattleshipsinaBoard.py
UTF-8
720
3.265625
3
[]
no_license
class Solution: def countBattleships(self, board): """ :type board: List[List[str]] :rtype: int """ count = 0 for i in range(len(board)): for j in range(len(board[i])): # if board[i][j] == 'X' and (i == 0 or board[i - 1][j] != 'X') and (j =...
true
b7374ee6f585de676119a87d2296336efc58923b
HBinhCT/Q-project
/hackerearth/Basic Programming/Input-Output/Basics of Input-Output/Roy and Profile Picture/solution.py
UTF-8
231
2.75
3
[ "MIT" ]
permissive
l = int(input()) n = int(input()) for _ in range(n): w, h = map(int, input().strip().split()) if w < l or h < l: print('UPLOAD ANOTHER') elif w == h: print('ACCEPTED') else: print('CROP IT')
true
7fafa0c3a917d93d2057e7c11fcbee21b4b8e225
bebe-shannu/Mycaptaintasks-AI-
/Positive number.py
UTF-8
219
3.40625
3
[]
no_license
#input1 list1 = [12, -7,5,64,-14] for pn in list1: if pn>=0: print(pn) #input2 list2 = [12, 14,-95,3] positivenumbers= [num for num in list2 if num>=0] print("output2: ", positivenumbers)
true
8e3fad032d9491de37262b2763338bbb7241edb4
mostellerja/CS3531-Bioinformatics
/project2.py
UTF-8
4,293
2.578125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import os from os import listdir from os.path import isfile, join RNA_seq = 'GGCCGCGGCAGGUUCGAGUCCUGCCGCGAUCGCCAC' RNA_sec_struct = '((((((((((((.......)))))))))...)))..' S1 = [] S2 = [] S3 = [] def count_bps(rna_seq, rna_sec_struct): count_au = 0 ...
true
09229dc4c6fc2d28f76fe68cb0d17091d7259579
AdamZhouSE/pythonHomework
/Code/CodeRecords/2530/60885/273437.py
UTF-8
339
2.890625
3
[]
no_license
def resolve(rule): line = input() counter = [0 for i in range(len(rule))] ans = '' for c in line: if c in rule: counter[rule.index(c)] += 1 else: ans += c for i in range(len(rule)): ans += rule[i] * counter[i] return ans rule = input() ans = resol...
true
4813d428d2b7c63289d61ad07bb33fbde13264ee
asiasuarez95/Natural-Language-Processing
/Regular Expressions/rexep_program.py
UTF-8
2,273
3.515625
4
[]
no_license
# Find all dollar amounts and phone numbers in a document and place brackets [] around them #This command places brackets,[], around matches of the regular expressions. #It then writes the new bracketed text into a file, that must be previously created #called output_dollar.txt. import nltk import re regex = '(\$)(...
true
39646e388174d84b929a0c037b8b2f1d3506af9f
tejdeep24/Python-Programming
/DataManipulation_CaseStudy 2.py
UTF-8
1,923
3.25
3
[]
no_license
# coding: utf-8 # In[60]: #Q1 import pandas as pd salary_df = pd.read_csv('Salaries.csv') salary_df = salary_df.fillna(0, axis=1) salary_df_2011_totalpay = salary_df[salary_df['Year'] == 2011]['TotalPay'] salary_df_2014_totalpay = salary_df[salary_df['Year'] == 2014]['TotalPay'] sum_totalpay_2011 = round(sum(salary...
true
d3e468db7f3d3ecac24c01a1175cd1eabfc2f870
winlp4ever/algos
/codeforces/r638/distribution.py
UTF-8
376
2.671875
3
[]
no_license
t = int(input()) def sol(): n, k = map(int, input().split()) sr = input().strip() s = sorted([c for c in sr]) if k == 1: return ''.join(s) if s[k-1] != s[0] or k == n: return s[k-1] if s[k] == s[n-1]: return s[k-1] + s[k] * ((n-1) // k) return ''.join(s[k-1:]) ...
true
64347f8d228fc8aa522099e319e5d65289f23fb0
SKam23/UCB-CS61A
/Testing/cs61a-summer-2020-final/q4/q4.py
UTF-8
2,539
3.578125
4
[]
no_license
email = 'skam@berkeley.edu' def compress(kale, spinach): """ Write a function compress that takes in two lists of positive integers, kale and spinach, and determines if kale can be compressed into spinach. A compression is when two adjacent elements in the list are either addded or subtrac...
true
13d278454e656793526934fcb21a79d23a668348
IQSS/miniverse
/dv_apps/slackbot/test_01.py
UTF-8
2,971
2.703125
3
[]
no_license
import json from os import environ from slackclient import SlackClient SLACK_TEST_TOKEN = environ.get('SLACK_TEST_TOKEN') slack_client = SlackClient(SLACK_TEST_TOKEN) #print slack_client.api_call("api.test") #print slack_client.api_call("auth.test") def get_channels(): channels_call = slack_client.api_call("cha...
true
e0a47cf2d9ce5a88626b381cf834f4db43baae5e
wrld3d/wrld-icon-tools
/src/icons/scalable_icon_factory.py
UTF-8
1,300
2.578125
3
[ "BSD-2-Clause" ]
permissive
import json import os import shutil class ScalableIconFactory: @staticmethod def create_icons(input_manifest, output_path_param, json_output_path): json_dto = {} icon_dtos = [] for icon_definition in input_manifest["icons"]: icon_file = input_manifest["path"] + str(icon_...
true
71e9f803f5f0d4e3cc3e8e9c956cac5d86af230c
iloverugs/pcc_2e_student
/chapter_09/restaurant.py
UTF-8
1,958
4.0625
4
[]
no_license
"""A class used to represent restaurants""" class Restaurant: """Represents aspects of a restaurant.""" def __init__(self, restaurant_name, cuisine_type): """Initialize name, cuisine type, number served""" self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type ...
true
5a0f1775b90d049b72f9c18d74727489b3ce53e9
hthzkjh/selfstudy-adversarial-robustness
/common/framework.py
UTF-8
9,951
3.0625
3
[ "Apache-2.0" ]
permissive
# Copyright 2021 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
true
213b968ba95dbd60ba7896784d1e0c46f8c98c9d
alexdalton/leno
/ece220/gradeMP2/gradeMP2.py
UTF-8
4,728
2.609375
3
[]
no_license
import subprocess import os import string import re from optparse import OptionParser def getArgs(): parser = OptionParser() parser.add_option("-b", "--mpdir", dest="mpdir", help="directory of pulled student MPs") parser.add_option("-r", "--roster", dest="roster", ...
true
bc53d005f9ef23ae8cfccec0ddbb252639160e9a
gopalbala/codingninjas
/pythondatastructures/ContinuousSubsetWithZerosum.py
UTF-8
583
2.734375
3
[]
no_license
def subsetSum(l): #Implement Your Code Here map = {0:[-1,-1]} longest = 0 for i in range(len(l)): sum += l[i] if map.get(sum,'NF') == 'NF': map[sum] = [i,i] else: map[sum][1] = i maxlen = 0 for ele in map: li = map[ele] ...
true
a6edf7b058d42dd66762af6f325be42e43a4b3cf
ljrky/leetcode_python
/python/easy/longest_common_prefix.py
UTF-8
392
3.265625
3
[]
no_license
def longestCommonPrefix(strs): if len(strs) == 0: return '' compare_string = strs[0] for str in strs[1:]: i = 0 while i < len(compare_string) and i < len(str) and compare_string[i] == str[i]: i = i + 1 compare_string = compare_string[:i] return compare_stri...
true
181bd9667db9f27ced26a88c607f5cac1c5b9031
sanket-k/Assignment_py
/python-files/Question 4.py
UTF-8
1,531
4.6875
5
[]
no_license
# coding: utf-8 # ### Question 4 # Write a program that accepts a sequence of whitespace separated words as input and prints the # words after removing all duplicate words and sorting them alphanumerically. # # Suppose the following input is supplied to the program: # # hello world and practice makes perfect and h...
true
ac5eba671a8d03b970376968e2737b06371e2af1
wileong/Data_Science_Directory
/Lecture-04-28/max_length.py
UTF-8
965
3.140625
3
[ "MIT" ]
permissive
#jupyter magic #writes to filename specified #wrote code below to file.py # see new file! #use pass to do nothing from mrjob.job import MRJob # get the length of the longest word in a document class MaxLength(MRJob): def mapper(self, _, line): # FOCUS ON #underscore means we will not be using this arg a...
true
8c0d46ce91d5d1951dd0f3efab3e195b772e4f06
gavinz0228/AlgoPractice
/LeetCode/1161 - Maximum Level Sum of a Binary Tree/maximumLevelSumOfABinaryTree.py
UTF-8
755
3.515625
4
[]
no_license
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def maxLevelSum(self, root: 'TreeNode') -> int: self.all_sum = [] self.aux(root, 1) maxs = max(self.al...
true
5bf3b0f53c1c75d739a9b56351804777fa868a78
marcofpsantoni/SFinance
/EquilibriumBonds&Headging/c-Bonds.py
UTF-8
3,354
2.703125
3
[]
no_license
import sympy as sy import numpy as np from pylab import mpl, plt import numba as nb import scipy.optimize as sco import numexpr as ne np.set_printoptions(formatter={'float': lambda x: '%8.3f' % x}) # stima per il coupon mortgage ys2 = 30 # fixed rate mortgage int_rate_today = 0.06 # tasso di interesse oggi inte = 0...
true
f4d090272ac452fb67a4fd4528b169568b62ae2c
big-c-note/prometheus-operator
/lib/charms/prometheus_k8s/v1/prometheus.py
UTF-8
16,938
3.03125
3
[ "Apache-2.0" ]
permissive
""" ## Overview This document explains how to integrate with the Prometheus charm for the purposes of providing a metrics endpoint to Prometheus. It also explains how alternative implementations of the Prometheus charm may maintain the same interface and be backward compatible with all currently integrated charms. Fin...
true
f0430f9c99958634f4f8842fd5a4b35b681d4bbc
naxus1/python
/Challenges/pruebamas2.py
UTF-8
830
2.96875
3
[]
no_license
def getMovieTitles(substr): list_movies = [] counter = 1 try: json_list = "https://jsonmock.hackerrank.com/api/movies/search/?Title={}".format(substr) user = {'User-Agent': ''} my_list = requests.get(json_list, headers=user, params={'limit': 10}) all_pages = int(my_list.json...
true
4163e5d0fcd4ef08ce2e08573584aaa9600fc2d5
jiwawa112/python-Notes
/python-basic/test_closure.py.py
UTF-8
542
3.625
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- x = 300 def test1(): x = 200 def test2(): nonlocal x print("---1---x=%d" % x) x = 100 print("---1---x=%d" % x) return test2 t1 = test1() print(t1) t1() # 闭包中不能修改外部作用域的局部变量 # 修改全局变量 global # 修改闭包外函数定义的变量 nonlocal # 用途1:当闭包执行完后,...
true
c9339a03ca6a1512799e782015a1d088774ea858
idxcky/code
/金融/Word_Cloud/demo2_中文.py
UTF-8
406
3.09375
3
[]
no_license
import wordcloud from PIL import Image w = wordcloud.WordCloud(width=1000, height=700, background_color='white', font_path='msyh.ttc') w.generate('从明天起,做一个幸福的人。喂马、劈柴,周游世界。从明天起,关心粮食和蔬菜。我有一所房子,面朝大海,春暖花开') w.to_file('output2.png') img = Image.open("./output2.png") # type: Image.Image img.show()
true
67f78275afdb52faebd65200f1f400055c5d2c4c
SutronPyto/LinkPython
/projects/Sampler_Turbidity/sampler_trigger.py
UTF-8
8,464
3.1875
3
[]
no_license
""" Triggers ISCO sampler via SDI-12 command, based on a measurement, and the time of the last sample. Very similar to the sampler_turbidity.py script, but more general purpose, triggering on any measurement. To use script: 1) Setup a measurement and connect it to the sampler_meas function 2) S...
true
0bc03c69a36b424deb612279e318337cc9a76d22
chenjeyok/Chatrooms_Server
/client02_username.py
UTF-8
1,390
2.65625
3
[]
no_license
import socket, select, string, sys def prompt(): sys.stdout.write("<me> ") sys.stdout.flush() if(len(sys.argv) < 4): print "Usage: python client.py server_ip server_port USERNAME" sys.exit() host = sys.argv[1] port = int(sys.argv[2]) username = sys.argv[3] s = socket.socket(socket.AF_INET, socket....
true
13f1c85720ee61cf00458663bc648cb3d7d06aed
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_81/142.py
UTF-8
1,388
2.671875
3
[]
no_license
#!/usr/bin/env python import sys infile = sys.argv[1] #outfile = sys.argv[2] indata = open(infile, 'r').readlines() #print indata numcases = int(indata[0].strip()) lines = [x.strip() for x in indata[1:]] for j in range(0, numcases): numteams = int(lines[0]) windata = lines[1:numteams+1] assert(numteams == len(win...
true
20a6d2f614fdf6f267b849b7b2cd2e3d5288e6c2
abdullahkitr0/python
/Basit Örnekler/Çeviiri.py
UTF-8
2,112
2.65625
3
[ "MIT" ]
permissive
from textblob import TextBlob from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * import sys class Pencere(QWidget): def __init__(self): super().__init__() self.setUI() def setUI(self): form = QFormLayout() self.giris1 = QLineEdit...
true
62a80430310f28a960b34bcc341113f233d185e7
fruxc/Python
/Lab3/program1.py
UTF-8
516
3.90625
4
[]
no_license
a = [] c = [] n=int(input("Enter number of elements:")) for i in range(1,n+1): b=int(input("Enter element:")) a.append(b) n=int(input("Enter number of elements:")) for i in range(1,n+1): b=int(input("Enter element:")) c.append(b) s = a+c n = len(s) for i in range(n): for j in range(0, n-i-1): if ...
true
02a3da7be47ace695ce892ecd44a347e3adbd2e2
sheviv/projects
/ml_algorithms/decision_trees/decision_tree_sklearn.py
UTF-8
1,668
3.1875
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.preprocessing import LabelEncoder # for train test splitting from sklearn.model_selection import train_test_split # for decision tree object from sklearn.tree import DecisionTreeClassifier # for checking testing...
true
2a2d89b74982d0fe744614bcaa02d0b4100bbbd9
ramezbenaribia/Python_Simplex
/Simplexe.py
UTF-8
2,767
3.03125
3
[]
no_license
import numpy as np import math PL = input("Entrer les coefficients de votre PL :") PL = PL.split() longeur = len(PL) for i in range(longeur): PL[i] = int(PL[i]) longeur_rows = input("Saisir le nombre de variable 'ei' : ") longeur_rows = int(longeur_rows) matrice = [] print("saisir votre matrice : ") for i in ra...
true
d7c319044ddc472b1508890db17bcfb83473e495
SeldomQA/seldom
/seldom/running/loader_extend.py
UTF-8
7,281
2.859375
3
[ "Apache-2.0" ]
permissive
"""seldom Loading unittests.""" import os import sys import functools from fnmatch import fnmatchcase from unittest.loader import TestLoader class SeldomTestLoader(TestLoader): """ This class is responsible for loading tests according to various criteria and returning them wrapped in a TestSuite """ ...
true
9059080736222e8680cab3cdd39e8f954e79d27c
TheBrotherFromASouthernMother/Python-Exercises-DigitalCrafts
/Day3/TurtleExercises/test.py
UTF-8
299
3.546875
4
[]
no_license
def primes(n): if n<=2: return [] sieve=[True]*(n+1) for x in range(3,int(n**0.5)+1,2): for y in range(3,(n//x)+1,2): sieve[(x*y)]=False return [2]+[i for i in range(3,n,2) if sieve[i]] arr = [1,2,3,4,5,6,7,8,9,] for i in arr: print(primes(i))
true
ba2eae2c0a8286249f5c39e82fb14c259e938131
alexis-martin33/project_euler
/q_09.py
UTF-8
426
3.5625
4
[]
no_license
## Generate the triples with n and m formula ## we know from handwork that c < 500 ## therefore m > n, m < sqrt(500) n=1 stop ='no' for m in range(2,24): print(m) while n < m and stop == 'no': print(n) a = m**2 - n**2 b = 2*m*n c = m**2 + n**2 if a + b + c == 1000: answer = a*b*c s...
true
7c29a50c99fef70e7ada1b06a7314ac74c6f98c4
SpAiN2097/raster-GRID-processing
/chart.py
UTF-8
3,002
2.734375
3
[]
no_license
""" * Daniel Bitters * 2018 * * This script analyzes netCDF data by creating an ArcGIS Pro chart of the * frequencies of temperature differences from two previous rasters from the "Raster Creation" tool. """ import os import arcpy import numpy from arcpy import env from arcpy import mp #env.workspace= 'c:/GISClass...
true
5eb63bd23e9e3141aaa8d9bd29725fe6233d88f7
nicholsonjf/Zander
/zander.py
UTF-8
1,797
2.828125
3
[ "MIT" ]
permissive
import sqlite3, csv # Config db_path = 'master.db' schema_path = 'schema.sql' def db_con(): return sqlite3.connect(db_path) def db_cursor(db): return db_con().cursor() def db_init(): with open(schema_path) as my_schema: script = my_schema.read() db = db_con() dbc1 = db_cursor(db) dbc1....
true
86833a2f08d3225edc1bcc1361c5fb964f805156
npinger/onboard_exercise
/blog/application/blog_service.py
UTF-8
4,444
2.9375
3
[]
no_license
from typing import List # Import for typehinting from analytics.domain.models import View from blog.domain.models import Category, Comment, Post # Import for queries from analytics.domain.repository import ViewRepositoryInteface from blog.domain.models import CommentRepositoryInterface, PostRepositoryInterface clas...
true
f81d71dfc1ab387bc35b98235ac346f585029ee5
nortonhelton1/classcode
/writing-json/writing-json/activity2.py
UTF-8
411
3.859375
4
[]
no_license
import json users = [] while True: name = input("Enter name: ") age = int(input("Enter age: ")) # write name and age to a JSON doc with open("users.json", "w") as file_object: user = {"name": name, "age": age} users.append(user) json.dump(users, file_object) choice ...
true
2df73847fbcfdd1e3bf18f21c319618366eb6ed6
embasa/EulerProjects
/p027.py
UTF-8
959
3.84375
4
[]
no_license
""" Euler discovered the remarkable quadratic formula: n^2 + n + 41 It turns out that the formula will produce 40 primes for the consecutive values n = 0 to 39. However, when n = 40, 402 + 40 + 41 = 40(40 + 1) + 41 is divisible by 41, and certainly when n = 41, 41^2 + 41 + 41 is clearly divisible by 41. Find the pro...
true
98c3e1447a96602197d53055e7b6c3af56a0a562
frankieliu/problems
/leetcode/python/1035/sol.py
UTF-8
2,096
3.234375
3
[]
no_license
In leetcode init [TRACE] inited plugin: cookie.chrome [TRACE] skipped plugin: lintcode [TRACE] skipped plugin: leetcode.cn [TRACE] inited plugin: retry [TRACE] inited plugin: cache [TRACE] inited plugin: company [TRACE] inited plugin: solution.discuss [DEBUG] cache hit: problems.json [DEBUG] cache hit: 1035.uncrossed-l...
true
e3249e927135be0c51056ad0201eed4227c6db2d
nischalmishra/TEMPO_python
/spectrometer_level_processing/process_tempo_SDO.py
UTF-8
15,359
2.625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Aug 23 15:34:45 2017 @author: nmishra This function creates Processed TEMPO SPECTROMETER IMAGE. All these routines are stored in a script called PROCESS_TEMPO_Spectrometer_Data.py and imported to this code via Python import. Eg. @ line 27. Processing Steps ...
true
514ec9156317ad87a17fec705f2b86ef97fbe36c
DavidFontalba/DAW-Python
/POO/Fecha.py
UTF-8
13,268
4.09375
4
[]
no_license
class FechaErronea(Exception): def __init__(self, mensaje): Exception.__init__(self) self.mensaje = mensaje class Fecha: """ * Versión 2.0 * -Añadidos respecto a la 1.0 * · Añadido el método __str__ * * Clase para manejar fechas en cadenas de caracteres. * *...
true
1fde4499526e0f9d4b25542bc0a43da664f509dd
Michael8968/skulpt
/example/test/L16_homework.py
UTF-8
1,234
2.625
3
[ "MIT", "Python-2.0" ]
permissive
import pygame from pygame.locals import * pygame.init() screen = pygame.display.set_mode((600,800)) pygame.display.set_caption("homework") ###############写课后作业################ ###############写课后作业############### shouce={ '小傲':{ '性别':'男孩', '身高': 1.6, '爱好':'足球', ...
true
5ce1ffe488ee7bec9a7aa101f8e10e487edcb2f2
karinemiras/evolvable_morphologies
/evolvable-morphologies_v2/GenomeIndirect.py
UTF-8
8,509
3.09375
3
[]
no_license
from Lsystem import * from Vertex import * from random import randint class GenomeIndirect: def __init__(self, id, params, id_parent1, id_parent2 ): self.params = params self.grammar = dict() self.id = id self.id_parent1 = id_parent1 self.id_parent2 = id_parent2 ...
true
0fad6da1eef263cdbb82d3316a58d993b900adea
emirju/myapps
/Netmiko/Backup_config.py
UTF-8
1,662
2.875
3
[]
no_license
from netmiko import ConnectHandler # getting the current date (year-month-day) from datetime import datetime ## First datetime is the Module and second one is there is a Class called datetime now = datetime.now() year = now.year month = now.month day = now.day hour = now.hour minutes = now.minute IP = input("Enter th...
true
905dfbca2fb664854e7d9a76a6dd07e28d44d23d
michaelwong121/RL_Atari
/REINFORCE/reinforce_episodic.py
UTF-8
3,872
2.6875
3
[]
no_license
import sys import gym.spaces import itertools import numpy as np import random import tensorflow as tf import tensorflow.contrib.layers as layers import collections from utils import * """ following the code in https://github.com/dennybritz/reinforcement-learning/blob/master/PolicyGradient/CliffWalk%2...
true
fa9c8f8096010390e0dbf3b1ead7df32047dc4fe
neo-cc/CarND-Vehicle-Detection
/extract_frame.py
UTF-8
556
3.125
3
[]
no_license
# create a folder to store extracted images # http://stackoverflow.com/questions/33311153/python-extracting-and-saving-video-frames # use opencv to do the job import cv2 import os folder = 'test' print(cv2.__version__) # my version is 3.1.0 vidcap = cv2.VideoCapture('test_video.mp4') count = 0 while True: success...
true
7a358d374550f9fce6ba54b0d7e49b05a61ce379
BryanKoo/english-word-translation
/extract_trans_jawikt.py
UTF-8
10,446
3.046875
3
[]
no_license
#-*- coding: utf-8 -*- import pdb import sys import re reload(sys) sys.setdefaultencoding('utf-8') def is_all_english(text): for ch in text: if not is_english(ch): return False return True def is_english(ch): if is_alphanum(ch) or is_punctuation(ch): return True return False def is_alphanum(ch...
true
96a45e5ef42d310a668fc21cd1908667a608b905
mavridiSS/Programming101-3
/week4/1-Music-Library/music_crawler.py
UTF-8
1,080
2.921875
3
[]
no_license
from song import Song from playlist import Playlist from mutagen.mp3 import MP3 from mutagen.easyid3 import EasyID3 import datetime import os class MusicCrawler: def __init__(self, path): self.path = path def getTags(self, path): m = MP3(self.path + path, ID3=EasyID3) if 'title' in m ...
true
8f869a450fc6fe903fcce014f3fe56d5600b9ba8
Michael-mag/Advanced-Python
/Advanced Python/a3/a3.p1.py
UTF-8
549
4.375
4
[]
no_license
""" 350112 a3 1.py MICHAEL MAGAISA m.magaisa@jacobs-university.de """ from student import Student name1=input("Enter the first student's name: ") name2=input("Enter the second student's name: ") s1=Student(name1,2) s2=Student(name2,3) print("Checking for not being equal") if s1!=s2: ...
true
f88e1c647547e19007502904782dafa6b32ac1de
danielperez660/Crawler-and-search-engine
/main.py
UTF-8
5,351
2.796875
3
[]
no_license
import requests as r import parsers import time import file_manager as fm import operator print("System started") term_index = {} url_index = {} raw_index = {} def robots_check(url): req = r.get(url + "/robots.txt").text.split("\n") time.sleep(5) disallow = [] for ir in req: if "Disallow:" ...
true
ec4fbdd6c3f120037d67b24b759a5ac27ef245c2
avishome/TestsRoomBot
/sendUpdates.py
UTF-8
2,944
2.578125
3
[]
no_license
import requests import json from pymongo import MongoClient import csv import telegram import os import tempfile uri = "mongodb://"+user+":"+password+"@"+server bot = None def webhook(request): bot = telegram.Bot(token=Token) url = 'http:'+request.args.get('url') print(requests.get(url).content) Fileu...
true
faf62c15f8317b2f6ac7da40eb64489ef9a0217c
dearleiii/LeetCode
/UnionFind_DictionaryTree/UnionFind.py
UTF-8
654
3.453125
3
[]
no_license
Def init(self, n): def.father = {} for i in range(): father(i) = i; ## In order to find the Big Brother node in O(1): 路径压缩 # No need to know the detailed path, # for node1, only need to know : 1. 1 upper; 2. Root Node 数据结构扁平化 # Method1 Recursion: def find(self, node): if node == seld.father[node]: ...
true
7dc3121a97ecdaf53c13895882731131df2a5eda
vilioja/gradu
/images/chainscatter.py
UTF-8
395
2.859375
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import random x = np.zeros(11) y = np.zeros(11) #random.seed(9856) for i in range(1,11): x[i] = random.uniform(-10,10) y[i] = random.uniform(-10,10) plt.scatter(x,y) plt.xlim(-10,10) plt.ylim(-10,10) plt.axes().set_aspect('equal') plt.gca().axes.get_xaxis().s...
true
53c205c69227decc80fcd55753d44f7b7ded89b0
vaishnavimukala/100-Days-Challenge
/reverse_of_list.py
UTF-8
333
3.84375
4
[]
no_license
n=int(input("Enter the size of list:")) li=[] print("Enter the list elements:") for i in range(0,n): ele=int(input()) li.append(ele) def rever(l): rlist=[] for k in range(len(l)-1,-1,-1): rlist.append(l[k]) return rlist print("Original list:",li) print("Reversed list:",rever...
true
a2742e983e8be32d83b0203dffb41baf20658dc3
jialiu-uwf/rbfscore
/src/rbf-score/data.py
UTF-8
2,596
3.25
3
[]
no_license
""" Data module """ from pathlib import Path import networkx import numpy as np import pandas as pd from scipy.io import loadmat supported_exts = { '.mat': 'Matlab format adjacency matrix', '.txt': 'Adjacency matrix', '.dat': 'Edge list of undirected unweighted graph', '.csv': 'Adjacency matrix in CS...
true
70996c4ba3d319d393adeba8dd2bd909ddf8c1e8
cccccsf/Masterarbeit
/Cluster/atom.py
UTF-8
849
2.78125
3
[]
no_license
#!/usr/bin/python3 from Data.Periodict_Table import periodic_table_rev class Atom(object): def __init__(self, nat, x, y, z, no=1, type=1, coor=1, coor_vec=[]): self.nat = nat self.element = periodic_table_rev[int(nat)] self.x = x self.y = y self.z = z self.no = no ...
true
bf24998d84ca550f46a668de2f3302c285e51445
Neokoldstudio/Rogue-project
/assets/objects/PlayerSword.py
UTF-8
652
3.28125
3
[]
no_license
import math import pygame import os class Sword(): def __init__(self,screen,position, size): self.screen = screen self.collisionSize = size self.rect = pygame.Rect(position[0],position[1],position[0]+self.collisionSize[0], position[1]+self.collisionSize[1]) self.rect.x = position[0]...
true
a685f6f142cc806faf81ba210ab4c06600a1264f
rjovelin/MitoVariants
/MakeSummaryCoverageFile.py
UTF-8
2,457
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Mar 8 18:12:58 2016 @author: RJovelin """ # use this script to generate a summary file with average read depth per individual # place this script in the folder with the mitoseek subfolders # usage: python3 MakeSummaryCoverageFile.py [options] # - cancer_name # - [WGS/RNA...
true
0ed13080dcec751e02a07ede85b40a389f8fa24c
Shaibujnr/kanban-ddd
/src/kanban/domain/models/column.py
UTF-8
1,061
2.65625
3
[]
no_license
from eventsourcing.domain.model.entity import DomainEntity class Column(DomainEntity): def __init__(self, name: str, *args, **kwargs): super().__init__(*args, **kwargs) if not name: raise Exception("Column name must cannot be empty") self._name = name self._workitem_ids...
true
285d28ca943cd7aa44abfafac91a229ff9a7ceb4
charrea6/SimpleRobotFramework
/simplerobot/controllers/servo.py
UTF-8
3,814
2.78125
3
[]
no_license
from simplerobot.mqtt import Component import asyncio try: import Adafruit_PCA9685 pwm = Adafruit_PCA9685.PCA9685() pwm.set_pwm_freq(50) except: class PWMEmulator: def set_pwm(self, servo, start, stop): print(f"Servo {servo} Start {start} Stop {stop}") pwm = PWMEmulator() cl...
true
139dfe8cf8280517da76a892471e4ea9dcdc4fee
Yasaswini230901ReddySagili/string_assignment
/string_assignment_character_frequency.py
UTF-8
126
3.875
4
[]
no_license
s=input('enter a string ') total=0 for i in s: total=total+1 print('total number of characters in this string=',total)
true
52137f27c94a972038fd3e5787ef1003e5d16fca
CarlosSanabriaM/topics_and_summary
/topics_and_summary/datasets/common.py
UTF-8
8,540
3.265625
3
[ "MIT" ]
permissive
import abc import os import warnings from copy import deepcopy from typing import List, Callable import pandas as pd from topics_and_summary.preprocessing.dataset_preprocessing_options import DatasetPreprocessingOptions from topics_and_summary.utils import join_paths, load_obj_from_disk, save_obj_to_disk, \ get_a...
true
b8acd530f32b3871061e4b8371fb413d9ac5dc6f
sszkdevelop/python-helpers
/py scripts/date.py
UTF-8
2,223
3.390625
3
[]
no_license
""" Sriharsha Samala """ class DateProcessor(object): """ processes date things """ def __init__(self): self = self self.month_abbrs = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] self.month_proper = ['January', 'February', 'March', 'April...
true
beb87a54067631b7a9dfe37df8bd045b3dd5b200
leoHeidel/XAI-in-RL
/multiagent_particles/utilities/env_wrapper.py
UTF-8
2,593
2.71875
3
[]
no_license
from multiagent.environment import MultiAgentEnv import multiagent.scenarios as scenarios from multiagent.scenarios.simple_tag import random_action import numpy as np from gym import spaces class EnvWrapper(MultiAgentEnv): def __init__(self, scenario_name, benchmark=False, random_prey=True): scenario = sc...
true
a1073bf6a8e277efb07bb089d4117dfeba4ff90d
Azimath/Guo-RTS-Schedule-Generator
/src/main.py
UTF-8
2,265
2.984375
3
[]
no_license
from ScheduleGenerator import createRandomTasks, scaleTaskCosts from ScheduleValidator import checkSchedule, measureUtilization def findAverageBreakdown(preemption, preemptCost, numIterations, workerNumber=0): breakdownUtilizations = [] for i in range(numIterations): taskSet = createRandomTasks(5, ext...
true
962aba5ace288f8863786047ffa40b3e4b9059ff
1412hyde/ApplicationInImageProcessing
/imageSearchEngineWithPython/app/search/searcher.py
UTF-8
1,075
2.5625
3
[]
no_license
# coding=utf-8 import numpy as np import pymongo import cv2 class Searcher(object): def __init__(self, queryFeatures): self.results = {} self.queryFeatures = queryFeatures # 消费者 def Chi(self): r = None while True: feature = yield r id = feature["_id...
true
d25710d87bebaba7a2253602d2f570e942ab9135
ammuaj/CodeSignal-PySolutions
/subarray_sum/solution.py
UTF-8
380
3.90625
4
[]
no_license
def subarraySum(nums, k): """ Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. """ count = 0 s = 0 for i in range(len(nums)): s += nums[i] if s % k == 0: count += 1 return count...
true
981709c72f4e7ead29cf5f9eee300cacca4e14c4
CallMeReznov/code
/NodeMcu_Temperature/main.py
UTF-8
288
2.921875
3
[]
no_license
import serial import atexit import time com = serial.Serial('COM3',9600,timeout=1) @atexit.register def clean(): com.close() print('手动关闭') while True: time.sleep(1) #print(com.readline()) print(str(com.readline(),'UTF-8').replace('\r','').replace('\n',''))
true
8a86385639965bdd0609ab0ac1b9fd3b35302069
tomwilkie/awesomation
/src/pi/scanning_proxy.py
UTF-8
1,444
2.765625
3
[ "MIT" ]
permissive
"""Philips hue proxy code.""" import abc import logging import sys import threading from pi import proxy class ScanningProxy(proxy.Proxy): """A proxy object with a background scan thread.""" __metaclass__ = abc.ABCMeta def __init__(self, refresh_period): self._refresh_period = refresh_period self._...
true
9f82bcad08c7c787a7616aa8bb0267932c3f20fd
isidaruk/task
/extractor.py
UTF-8
2,699
3.21875
3
[]
no_license
""" Extractor Script is used for read locally stored HTML file and analyze open jobs on the page, save the extracted job info into a CSV file, formatted as follows: jobs.csv format: --- Job Title, Category, Status, Location Accounts Payable Specialist, Finance Accounting, Regular, Los Angeles Senior Accountant, Finan...
true