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
aca51ddcc4f226c5a10b18afc601d3336f79e894
Kre4/Discrete_Math_ITMO
/HW_1/help_functions.py
UTF-8
4,232
3.078125
3
[]
no_license
import networkx as nx import matplotlib.pyplot as plt null_degree_nodes = ["CY", "IS", "MT"] COLORS = ["b", "g", "y", "#9457EB", "#004242", "#FF43A4", "#FA8837", "#05AFB2", "#B22030", "#A0785A"] def biggest_component(G): Graph = nx.Graph(G) Graph.remove_nodes_from(null_degree_nodes) component = min(nx.c...
true
6a18f25eecff3aa676f5a49c841025357dc5d216
palxex/palresearch
/PackageUtils/deyj2.py
UTF-8
960
2.578125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import os import utilcommon from ctypes import * def deYJ2(input): dll=cdll.LoadLibrary(utilcommon.getPallibPath()) buffer=POINTER(c_byte)() length=c_int() dll.decodeyj2(input,byref(buffer),byref(length)) return string_at(buffer,lengt...
true
cbceb41f2ffb3b445dd9bfbe3b77929b8c75ecb4
oluizcomz/SEII-LuizdaSilvaMoura
/Semana02/matplot01.py
UTF-8
857
3.546875
4
[]
no_license
#work with graphs and pandas import matplotlib.pyplot as plt import numpy as np plt.figure(figsize = (5,3), dpi = 100)#redimencionando a escala x = [1,2,3,4,5] y = [2,4,6,8,10] x2 = np.arange(0,4,0.5) plt.plot(x2[:5],x2[:5]**2,'r',label = 'X^2') plt.plot(x2[4:],x2[4:]**2,'r--',label = 'X^2') plt.plot(x,y,label = ...
true
e00cf7b452d6ece132bd65be1da68c516832aa9b
sabrikrdnz/LYK-17-Python-Examples
/numpy/6numpy_matrixA.py
UTF-8
274
2.984375
3
[]
no_license
import numpy as np A = np.array([[n+m*10 for n in range(5)] for m in range(5)]) v1 = np.arange(0, 5) #print(np.dot(A, A)) #array uzerinden matris carpimi #print(np.dot(A, v1)) #alingment üzerinden matris carpimi M = np.matrix(A) v = np.matrix(v1).T print(A*A) print(M*v)
true
a0f4ee98052219be863ec50bac8d329458a398ec
subho2107/Codechef
/May long challenge/Coronavirus spread.py
UTF-8
607
3.140625
3
[]
no_license
t = int(input()) for _ in range(t): n = int(input()) arr = list(map(int, input().rstrip().split())) bestCase = float("inf") worstCase = float("-inf") for pos in range(len(arr)): back = pos affected = 1 while back >= 1 and arr[back] - arr[back-1] <= 2: affected += ...
true
0aa5fc359fd63f0f8b29ac33f1ee6cd9e3f47386
adonis-lau/LeetCode-Python
/project/8.string-to-integer-atoi.py
UTF-8
846
3.671875
4
[]
no_license
#!/usr/bin/python3 # -*- coding: UTF-8 -*- """ 8. String to Integer (atoi) https://leetcode.com/problems/string-to-integer-atoi/ """ class Solution: def myAtoi(self, str: str) -> int: INT_MIN = -2 ** 31 INT_MAX = 2 ** 31 - 1 str = str.strip() if not str: return 0 ...
true
c18459cfbcabd708b50babea80be9855b7a74410
adreena/MyStudyCorner
/LeetCode/codes/BinaryTree/199.py
UTF-8
784
3.015625
3
[]
no_license
# time O(N) # space: O(N) # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def rightSideView(self, root: TreeNode) -> List[int]: output = defaultd...
true
5182a669e3cf9a18dab544f40e3d903935f68271
lokendra1704/Competitive-Programming
/OctoberCodechef/POSAND.py
UTF-8
617
2.78125
3
[]
no_license
import sys from math import * from collections import * from functools import lru_cache, reduce from itertools import * cin = lambda: int(input()) car = lambda:map(int,sys.stdin.readline().split()) carr = lambda:list(map(int,sys.stdin.readline().split())) #Partial def fun(n): l = [i for i in range(1,n+1)] for a...
true
46fef1dade0471ccfcaaad6ff8e0e9be7a622441
billy1kaplan/AdventofCode
/2017/src/day2.py
UTF-8
605
3.46875
3
[]
no_license
# Day 2: Corruption Checksum def checksum(): with open('assets/day2_input.txt') as file: sum = 0 for line in file: list = [int(i) for i in line.split()] sum += max(list) - min(list) print(sum) def checksum_2(): with open('assets/day2_input.txt') as file: ...
true
47d26492c6987bff15fabdd0b7c351e54c57ce6a
NikDrakulovic/niksrepo
/Nik/Alien Invasion/settings.py
UTF-8
762
2.59375
3
[]
no_license
class Settings: #A class to store all of the settings for alien invasion def __init__(self): #initialize the games settings #screen settings self.screen_width = 1200 self.screen_height = 800 self.bg_color = (230,230,230) #bullet settings self....
true
6fadb9d45e76f3488c9d63ca0133f4344d5f9141
brynjabergmann/DublinBikes
/dublin_bikes/weather.py
UTF-8
463
2.75
3
[ "MIT" ]
permissive
''' Created on Mar 30, 2018 @author: Brynja ''' # Reference from https://stackoverflow.com/questions/7243750/download-file-from-web-in-python-3 import urllib.request def get_json_from_url (url, filename): urllib.request.urlretrieve(url, filename) def updateWeather(): get_json_from_url('http://...
true
49943cccfae099525b7d0a8b746bd8b43f18ba9e
ibiehler/isabelleb
/Labs/CTA Map/L_stations.py
UTF-8
2,209
3.140625
3
[]
no_license
# Folium train map import folium import csv from folium import plugins ''' 15pts - Use folium to plot all of the L train stops in Chicago. Use an appropriate start zoom level. * 5pts - Add the name to each stop as a popup. Add a train icon to each marker. Save as an html page in the same folder. * 3pts - Color code a...
true
4f22ca21c5cf4e658ec9fe83e94fb2d4b683239b
robert75RG/python_bootcamp
/zjazd1/podstawy_zad14.py
UTF-8
872
4.4375
4
[]
no_license
'''i =0 while True: i += 1 liczba = input('Podaj liczbę: ') if liczba == 'koniec': break temp = int(liczba) if i == 1: min = max = temp else: if max < temp: max = temp if min > temp: min = temp print(f'Wartość maksymalkn...
true
6731bb851f329656df29c51dd69c4b5393d293fa
nacro90/user-activity-generator
/src/data/datamanager.py
UTF-8
4,598
2.53125
3
[ "MIT" ]
permissive
import random from abc import ABC, abstractmethod from pathlib import Path from typing import Any, ClassVar, List, Optional, Sequence, Set, Tuple import numpy import pandas import pyarrow from keras.utils import Sequence as KerasSequence from keras.utils import to_categorical from pandas import DataFrame from pyarrow....
true
277b0b1a4b201c24e60e700fdf872139bbce42dc
wuhao2/Python_learning
/互联网笔试/招商.py
UTF-8
368
3.21875
3
[]
no_license
# _*_ coding: utf-8 _*_ __author__ = 'wuhao' __date__ = '2017/9/13 20:01' a, b, n = input("please input:").split(' ') print(a, b, n) print(type(a), type(b), type(n)) def CommonMutipleCount(a, b, n): res = [] s = a * b i = 1 while (i*s) <= n: i += 1 res.append(i*s) return len(res) p...
true
8bd407491a8e784e9a96950d3cc966e43f376bd2
PaulBenMarsh/BlenderAPI-IsometricSpritesheet
/spritesheet.py
UTF-8
3,462
2.84375
3
[]
no_license
class OutputSettings: from pathlib import Path output_path = Path("C:/users/studio/desktop/frame_renders") scene_name = "scene" action_name = "idle" number_of_directions = 8 file_format = "PNG" frame_file_name_prefix = "frame" composite_file_name_p...
true
8f2e9fa9bfa66d90da3a98ca39d9a06e5a5fa4c4
munakata0299/Python_Lesson
/python_programming/lesson27.py
UTF-8
133
3.796875
4
[]
no_license
# num: int = 10 def add_num(a : int , b : int) -> int: return a + b r = add_num(10, 20) print(r) r = add_num('a', 'b') print(r)
true
dec18e23789fcd393e099950d07e64cb839171ad
evilino/LeetCode
/Week08/62.py
UTF-8
627
3.140625
3
[]
no_license
#! /usr/bin/env python # -*- coding: utf-8 -*- class Solution(object): def uniquePaths(self, m, n): """ :type m: int :type n: int :rtype: int """ if not m or not n: return 0 # dp[i][j] unique paths from (0, 0) to (i-1, j-1) dp = [[0 for i...
true
f45a157d52da5bddcd465a24e4a4dd3466df1a95
anuragpathak2608/MyPython
/python_concepts/python_sets.py
UTF-8
1,901
3.9375
4
[]
no_license
''' A Set is an unordered collection data type and unindexed It is iterable, mutable, and has no duplicate elements. Frozen Sets Frozen sets are immutable objects that only support methods and operators ''' #sets in python set = {'a', '1', 'b', '2', '3', 4} set1 = {1, 2, 3, 4} #list in python list = ['a', 'b', 'c', '...
true
beb9a478ff487e7357fd59f599b3972c4c2595dd
tusharnema/Implementing-Algorithms-in-python
/binary_tree.py
UTF-8
1,030
3.734375
4
[]
no_license
from collections import deque class Node: def __init__(self,data): self.data=data self.left=None self.right=None def printLevelOrder(root): dq=deque() temp=root while temp is not None: print(temp.data) dq.append(temp.left) dq.append(temp.right) temp=dq.popleft() def height(root): if(root): retu...
true
c0d54f1e284bb4a3d206bc70a948c5635a742667
rishikeshpuri/python-codes
/armstrong number.py
UTF-8
273
3.75
4
[]
no_license
n=int(input("Enter a number")) for i in range(n): l=len(str(n)) sum=0 i=n while i>0: digit=i%10 sum=sum+digit**l i=i//10 if n==sum: print("{} is armstrong number".format(n)) else: print("{} is NOT armstrong number".format(n))
true
bb902f7f784b05a990a2b9e70cb776124c6bce2b
vara/runapp
/ide_projects/boot-app/scripts/posix/python/utils/Info.py
UTF-8
660
3.03125
3
[]
no_license
# -*- coding: utf-8 -*- # User: Grzegorz (vara) Warywoda # Date: 2010-11-10 # Time: 22:56:44 # From http://en.wikipedia.org/wiki/%3Azanurkuj_w_pythonie def info(object, spacing=10, collapse=1): #(1) (2) (3) u"""Wypisuje metody i ich notki dokumentacyjne. Argumentem może być moduł, klasa, lista, słownik, czy też ła...
true
12ddc1d9f34aa438b8fa008230779f1ce00e3561
14Si28/python
/trangle_area.py
UTF-8
191
4.15625
4
[]
no_license
print("Program to calculate the area of the triangle") b = input("Enter the base: ") b=int(b) h = input("Enter the height: ") h = int(h) area = 0.5*b*h print("Area of the triangle is: ",area)
true
58744390df28c746b5b371ebd1725458fbc55662
aerolalit/Auto-Testing
/for python/data/ahsaeed/pframe.py
UTF-8
307
3.796875
4
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# 350111 # a3.p10.py # Ahmad Saeed # ah.saeed@jacobs-university.d def print_frame(n,m,c): print(m*c) for n in range (1,n-1): print(c , end="") print((m-2)*' ',end="") print(c) print(m*c) n=int(input("Enter rows: ")) m=int(input("Enter columns: ")) c=input("Give a character: ") print_...
true
02912be9988b2fcc772e341002470ce549bca123
Pavlenkovv/Cafe-heroku
/menu/models.py
UTF-8
942
2.515625
3
[]
no_license
from django.db import models from os import path from uuid import uuid4 class Category(models.Model): title = models.CharField(max_length=50, unique=True) category_order = models.IntegerField() is_visible = models.BooleanField(default=True) def __str__(self): return self.title class Dish(mo...
true
d2b5c9b075940ad5072d19a6689b7c1da0f6d086
rajeevdodda/Codeforces
/CF-B/1401-1500/CF1454-D3-B.py
UTF-8
534
3
3
[]
no_license
# https://codeforces.com/problemset/problem/1454/B for _ in range(int(input())): n = int(input()) a = tuple(map(int, input().split())) hash_map = {} for i in a: hash_map[i] = hash_map.get(i, 0) + 1 key = None for k, v in hash_map.items(): if v == 1: if key: ...
true
8152595dfe9cbfa6f963aa92b3831cb756e5847b
vicb1/deep-learning
/1-notebook-examples/keras-udemy-course/bayesian_ml/2/probit.py
UTF-8
3,706
3.109375
3
[ "MIT" ]
permissive
# probit regression import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.stats import norm # from scipy.stats import t from sortedcontainers import SortedList class ProbitRegression: def fit(self, X, Y, sigma=1.5, lam=1, show_w=set(), Q=None): # setup N, D = X.shape self.w...
true
6aa1aec1d4f353eb140a7e14f566b7cb4d2e8f0f
mayartmal/kode
/source/test_check_permutation/word.py
UTF-8
690
3.84375
4
[]
no_license
class Word: def __init__(self, text: str): self.__text = text def __str__(self): return self.__text def is_permutation(self, word) -> bool: if not str(self) or not str(word): return False if len(str(self)) != len(str(word)): return False ...
true
c747c7589c5434c30f67a6b7c09493b4642c631b
GabrielFrizzo/MProg2019
/programasfeitos/uri/1120.py
UTF-8
148
2.859375
3
[]
no_license
while True: inp = input() if inp == '0 0': break x, n = inp.split() ans = n.replace(x, '') print(int(ans) if ans != '' else 0)
true
2b94c7803a28f5a4eb1f6846da92407232089938
rafibarash/blackjack-simulation
/person.py
UTF-8
8,921
4.03125
4
[ "MIT" ]
permissive
# have all in method # have method that kicks lo$$ers out of game # also take out any characters that aren't numbers for bet # if you split aces, autimatically end turn class Person(): def __init__(self): self.hand = '' def highestScore(self): '''returns person's best blackjack score''' ...
true
d4550aa23201ad48096bdf3a000380fe46cfe5a8
AnkyBistt/Python
/Python classes/functions.py
UTF-8
781
4.40625
4
[]
no_license
#function without argument ##def functionName(): ## print("Hello world!") ## ##functionName() # function that return a value ##def sum(firstNumber, secondNumber): ## thirdNumber = firstNumber + secondNumber ## return thirdNumber ## ## ##result = sum(10, 20) ##print(result) def ca...
true
9cebcce05e754efcb6aed16aa54f0a9bae3ed129
tatianafrattale/python-challenge
/PyPoll/main.py
UTF-8
3,545
3.5625
4
[]
no_license
# You will be give a set of poll data called election_data.csv. The dataset is composed of three columns: Voter ID, County, and Candidate. Your task is to create a Python script that analyzes the votes and calculates each of the following: # The total number of votes cast # A complete list of candidates who received vo...
true
1dd5cc74ff293cd66fc98eba2db8d95d039820b0
zhaoqic/coursera-scraper
/main.py
UTF-8
988
2.53125
3
[]
no_license
import xml.etree.ElementTree as ET from tqdm import tqdm from Scraper import CourseScraper, ReviewScraper SCRAPE_COURSE = False SCRAPE_REVIEW = True if SCRAPE_COURSE: courses_xmlroot = ET.parse('sitemap/courses.xml').getroot() courses_urls = [url[0].text for url in courses_xmlroot] course_scraper = Cours...
true
a47c9d2382018d0c3ed17cd0fd3fb6af3ad068a0
sidv/Assignments
/Pavan/Aug25/emp_gui.py
UTF-8
2,195
2.828125
3
[]
no_license
import tkinter as tk from emp import Employee employee = [] win = tk.Tk() win.title("Employee") win.geometry("600x400") left_fr = tk.Frame(win) left_fr.grid(row=0,column=0) right_fr = tk.Frame(win) right_fr.grid(row=0,column=1) eid = tk.IntVar(left_fr) name = tk.StringVar(left_fr) age = tk.IntVar(left_fr) gender =...
true
cf67b0ada74ccfa03fd3fcbe0c9fd0860a64e53f
felixdorrek/DLVC
/mini_batch.py
UTF-8
4,425
2.71875
3
[]
no_license
import math import numpy as np import os import keras from keras.utils import np_utils class MiniBatchGenerator: # Create minibatches of a given size from a dataset. # Preserves the original sample order unless shuffle() is used. def __init__(self, dataset, bs, tform=None): self.dataset = dataset ...
true
057289ce0ea9bf9e31d6a3e32ff659a6a87edbfc
nathankong/RobustRCA
/CovarianceEstimators.py
UTF-8
1,626
3.453125
3
[]
no_license
import numpy as np class CovarianceEstimatorBase(object): def __init__(self, estimator_type): # estimator_type: string (e.g. "maximum_likelihood") self.estimator_type = estimator_type def compute_covariance(self, X, Y): # Computes cross-covariance or auto-covariance matrix depending on...
true
a8eabd1789a2ccd20c702cb62e5f9c7fb1298631
Acekicker277/alx-higher_level_programming
/0x05-python-exceptions/4-list_division.py
UTF-8
889
3.796875
4
[]
no_license
#!/usr/bin/python3 def safe_division(a, b): quotient = 0 try: quotient = a / b except ZeroDivisionError: print("division by 0") except TypeError: print("wrong type") finally: return quotient def list_division(my_list_1, my_list_2, list_length): result_li = [] ...
true
51b79d8a3ba67a9b77481ad4d962988e421d49e6
pr8x/unicode_tests
/unicode_tests/level_order_tree.py
UTF-8
660
3.015625
3
[]
no_license
# int eytzinger(int i = 0, int k = 1) { # if (k <= n) { # i = eytzinger(i, 2 * k); # b[k] = a[i++]; # i = eytzinger(i, 2 * k + 1); # } # return i; # } def eytzinger(i, k, a, b): if k <= len(a): i = eytzinger(i, 2 * k, a, b) b[k] = a[i] i += 1 i =...
true
e3a310e2d9820b7aaa1b9f171616ab179f70bd7d
anhnguyendepocen/EE-Complexity17
/sol_lab_DYN/Solow_1_classes.py
UTF-8
1,789
3.109375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Aug 8 13:27:08 2017 @author: Miriam Fischer, Ron Yaroslav Grodko and Kenneth Donkor-Hyiaman """ import numpy as np import matplotlib.pyplot as plt class Solow: def __init__(self): self.K = [] self.L = [] self.Y = [] ...
true
fcf02f4afa47ddac2458a061d798f11dc3e83ece
CharlesPeng1998/HKU_COMP7404_ML
/a2/multiAgents.py
UTF-8
13,306
3.515625
4
[]
no_license
from util import manhattanDistance from game import Directions import random, util from game import Agent class ReflexAgent(Agent): """ A reflex agent chooses an action at each choice point by examining its alternatives via a state evaluation function. The code below is provided as a guide. Yo...
true
0610d5b0a5da4d58e149f0ec5d1f440d6db5c823
Aasthaengg/IBMdataset
/Python_codes/p03910/s186902469.py
UTF-8
139
2.921875
3
[]
no_license
N=int(input()) k=d=0 while k<=N: k+=1 d=k*(k+1)//2 if d >= N: break for i in range(1,k+1): if i==d-N: continue print(i)
true
b559511ea4ef17a2fab131c750c386dce5269bca
git4o/processorSTOPDON-TKILLME
/secondary.py
UTF-8
957
3.078125
3
[]
no_license
import time from colorama import * print("//////////////////////////////////////////////////\n") print("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n") print("===================================================\n") print(Fore.RED+"The. "+Fore.BLUE+"Ultimate. "+Fo...
true
c839174410faa7e5fb0b0d4e7ea2a715a88a328b
steffemb/fys3150
/project3/project3/solarsystem/build-solarsystem-Desktop-Debug/plot.py
UTF-8
1,258
2.703125
3
[]
no_license
import matplotlib.pyplot as plt from math import * from numpy import* def readfile(name): data = [] infile = open('%s.dat' % name, 'r') numberoflines = MagicNumbers(name)[0] numberofobjects = MagicNumbers(name)[1] #print numberoflines #print numberofobjects for q in range(numberofobjects): data.append([]) #p...
true
48b0f6f11d4e5fd6cdf0d9aa5166c97e7b4fb4a8
neelambuj2/Dynamic-Programming
/construct array.py
UTF-8
742
3.265625
3
[]
no_license
#!/bin/python3 import math import os import random import re import sys # Complete the countArray function below. def countArray(n, k, x): a = [0 for i in range(n+1)] b = [0 for i in range(n+1)] a[0] = 1 if x == 1 else 0 b[0] = 0 if x == 1 else 1 for i in range(1, n): ...
true
dc9cd663f6e328587e1db8adfb4a6eda214aefa3
zmh19941223/heimatest2021
/04、 python编程/day02/3-code/04-课堂练习-两个数相除.py
UTF-8
239
3.609375
4
[]
no_license
# num1通过input输入的数字 # num2通过input输入的数字 num1 = int(input("请输入num1的值")) num2 = int(input("请输入num2的值")) # 如果num2不等于0,计算num1 除以num2的结果 if num2 != 0: print(num1 / num2)
true
df47ae45cd99f440fc8a51cec41b7a5d8ff8f432
younesben/tkinter-tutorial
/tkinter/window.py
UTF-8
1,898
3.75
4
[]
no_license
from Tkinter import Tk, BOTH from ttk import Style, Frame, Button # Inherits the Frame class from ttk. "Self" is an instance of Frame class Window(Frame): # Constructor def __init__(self, parent): # Calling the constructor method of the inherited class # Background specifies the color of the Frame widget ...
true
3dd49580457a2e8be1434e7d4d8b7e15d2f4bbb5
KahiniWadhawan/WordEmbeddings_BioNLP
/KahiniCode-ver2/bio_wordEmb_torch/WE_tests/extract_mesh_supplementals.py
UTF-8
3,542
2.609375
3
[]
no_license
#--------------------------------------------------------------------- # This file extracts MeSH(medical Subject Headings) Descriptors data #--------------------------------------------------------------------- import xml.etree.ElementTree as ET def parse_XML(): tree = ET.parse('../data/mesh/supp2016.xml') pri...
true
5f5d6497b84d5f615ad14aeb4f556f8849ec2e9d
robomakery/ucsd-ece-191-2020
/robot_ws/src/pvcchair_behavior/src/swerve_logic_updates.py
UTF-8
5,327
3
3
[]
no_license
#!/usr/bin/env python # make sure to use chmod +x swerve_logic.py to make to program runable by ros # then should use rosrun swerve_logic.py to access python code import math #pi is math.pi import rospy class wheel: #strting speeds of wheels speed_fr = 0 speed_fl = 0 speed_rl = 0 speed_rr = 0 ...
true
5777e52cce13b2e184234f97f5cd09ed84c538dc
ThiaguinhoLS/Code
/django/_class_based_views/training/library/forms.py
UTF-8
1,632
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- from django import forms from .models import Author, Book from .validators import validate_age class AuthorModelForm(forms.ModelForm): class Meta: model = Author fields = '__all__' class BookModelForm(forms.ModelForm): class Meta: model = Book fields = '__all__' class AuthorForm...
true
56d4c12cab210081e0ee3f5be21859b6bead2bf6
tmajest/project-euler
/python/p50/p50.py
UTF-8
509
3.21875
3
[]
no_license
# Project euler problem 50 # http://projecteuler.net/problem=50 import prime_tools primes = prime_tools.primes_up_to(1000000) prime_set = set(primes) max_prime_sum = (0, 0) for i in xrange(len(primes)): total = 0 for j in xrange(i, len(primes)): prime = primes[j] total += prime if t...
true
dcb41de4c4732381f20ea74a07f9272dbf3b82bc
ChristopherMotes/flux
/file.sh
UTF-8
381
3.390625
3
[]
no_license
#!/usr/bin/python attempt=0 primeNumber=0 while primeNumber < 6: print "prime Number top of loop " + str(primeNumber) testValue = 2 while testValue <= 9: if attempt % testValue != 0: print "I found Not Prime" else: primeNumber+=1 testValue+=1 print "primeN...
true
bb4e4931d2ca4c1c7a0952df43b2275b554ae976
Aasthaengg/IBMdataset
/Python_codes/p02411/s963709384.py
UTF-8
582
3.25
3
[]
no_license
results = [] while True: m, f, r = map(int, input().split()) result = "" if m == f == r == -1: break elif m == -1 or f == -1: result = "F" else: if 80 <= m + f: result = "A" elif 65 <= m + f < 80: result = "B" elif 50 <= m + f < 65: ...
true
aae035929641088c65d36e6006a055215280f712
endokazuki/deep_leaning
/practice/practice.py
UTF-8
202
2.734375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from matplotlib.image import imread x =np.arange(0,6,0.1) y =np.sin(x) plt.plot(x,y) plt.show() img =imread('test.jpg') plt.imshow(img) plt.show()
true
bc9e9bc51c8b9c8a3fad362dbc038467b960461d
igorecarrasco/covidbot
/covidbot/local/utils.py
UTF-8
262
2.9375
3
[ "MIT" ]
permissive
""" Utility functions """ from numpy import random def distribution(n): """ Returns a Pareto distribution of n length """ d = random.pareto(1, n) distribution = list(d / d.sum(axis=0, keepdims=1)).sort(reverse=True) return distribution
true
ad398c9d71148490913ffc9e10f9422d8e7bd27f
JetBrains/intellij-community
/python/testData/refactoring/introduceConstant/stringLiteralArgumentInComprehension.py
UTF-8
91
2.578125
3
[ "Apache-2.0" ]
permissive
def func(xs): return [x for x in xs if x.startswith(<selection>'constant'</selection>)]
true
657b5b268cbc56d770ac1357fdf4e52c68a9aa96
sakateka/atb
/src/course1/week4_divide_and_conquer/_6_closest_points/closest.py
UTF-8
4,262
3.125
3
[]
no_license
# Uses python3 import math import os import sys def naive_minimum_distance(x, y): points = list(sorted(zip(x, y), key=lambda x: x[0])) return naive_minimum_distance_int(points) def naive_minimum_distance_int(points): min_distance = 10 ** 18 for (i, p1) in enumerate(points): sub_list = points...
true
bb2c8afb25670c8ab6493a701918f8e19008e986
nolemretaw/BADOU-AI-Tsinghua
/98-楼圣韬-杭州/第二周作业/灰度图、二值图以及边缘图.py
UTF-8
2,167
2.953125
3
[]
no_license
from typing import Any import imutils from skimage.color import rgb2gray import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl from PIL import Image import cv2 img = cv2.imread("lenna.png") # 手动转灰度,利用权重:R:0.3,G:0.59,B:0.11 ''' h,w = img.shape[:2] # 用h,w获取元组的前两个数据 img_gray = np.zer...
true
87a562dda0e5dadff241bda7d3d6c7887eed800a
hamzayn/My_HackerRank_Solutions
/ninth.py
UTF-8
911
3.0625
3
[]
no_license
# Enter your code here. Read input from STDIN. Print output to STDOUT S = input() store = list() for i in range(len(S)): if i == len(S) - 1: if S[i] not in store: if store: print("(%s, %s) "%(len(store), store[0]), end="") store.clear() store.appen...
true
ae42d5627a3843b41713e0f9d3870b2d2884820a
terryshen/jianshu_searchengine
/jianshu_scrawler/jianshu_scrawler/main.py
UTF-8
2,542
2.84375
3
[]
no_license
import os import codecs from jianshu_scrawler.spiders.scrawl_user_list import get_user_path, get_article_id_sets from jianshu_scrawler.database.create_jianshufull_index_es import CreateIndices from jianshu_scrawler.path.path_file import get_user_path_file, get_crawleduser_path_file from jianshu_scrawler.spiders.scrawl_...
true
4d0d35b15571fffe16835b0664274cac9ba184d3
Andchh/recommendationSystem
/API/Purchase.py
UTF-8
716
2.796875
3
[]
no_license
import pandas as pd from Recommendation import Recommendation class Purchase: def add(self, entry): new_rec = Recommendation() df = pd.read_csv('data_armz.csv', sep = ';') new_values = pd.DataFrame(entry) new_values.head() #Deleting possible providers - they cause ...
true
a2b1450316690e1560a8970ac80beedb757ac1e0
shbz1690/Rosalind.Info-Python-problems-solution
/continue/sign1.py
UTF-8
272
3.21875
3
[]
no_license
import itertools from math import factorial n = 4 numbers = range(1,n+1) print(factorial(n)*(2**n)) for p in itertools.permutations(numbers): for i in range(2**n): print(' '.join( str(value if i & (1<<j) else -value) for j,value in enumerate(p) ) )
true
ec170fc7705a8fea543377da96ae0d72bd4b56b5
hergenraderljac/comment_classification
/tfidCluster.py
UTF-8
2,921
2.9375
3
[]
no_license
import csv #import tensorflow as tf import numpy as np from numpy import linalg as LA #Import a text feature extraction method from scikit. TfidVectorize applies both term #frequency and inverse document frequency to the input data. from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.multiclass im...
true
b2d5dda29b787876b73e237a97d5e98a6234904b
sleepingsaint/py_server
/py_server.py
UTF-8
2,609
2.890625
3
[]
no_license
import socket import select from time import strftime, gmtime # defining IP address and PORT number IP = "127.0.0.1" PORT = 8080 HEADER_LENGTH = 10 # creating and initializing socket server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.setsockopt(socket.SOL_SO...
true
a0beb02688796f09a3a6cf02dbaa8365c7d1649f
aader3914/puzzle
/img_split.py
UTF-8
3,733
3.828125
4
[]
no_license
# -*- coding: utf-8 -*- ''' 將圖片填充為正方形圖片, 在依需求分割成 level x level 個小圖 ''' from PIL import Image class split_image: def __init__(self, img_path="img/demo.jpg", level=3): self.__img_path = img_path self.__level = level self.__size = -1 # 原圖形需要 resize 的尺寸, < 10 則不要 resize self.__message = "" self.__im...
true
87bf6d1930545fddfab12b62808d39dbbfc0ca73
Juan611x/TallerHerramineta
/punto1.py
UTF-8
122
3.015625
3
[]
no_license
#punto1 def triangulo(): a = int(input()) b = int(input()) area = (b * a)/2 print(area) triangulo()
true
1ed0f8c81105f763055e6c84ff23c0ba5755ca39
albertkklam/hackerrank
/python/algorithms/jumpingClouds.py
UTF-8
296
2.796875
3
[]
no_license
# Jumping on the Clouds: Revisited ## https://www.hackerrank.com/challenges/jumping-on-the-clouds-revisited n,k = raw_input().strip().split(' ') n,k = [int(n),int(k)] c = map(int,raw_input().strip().split(' ')) print 100 - sum([1 if x == 0 else 3 for x in [c[i] for i in range(n) if i%k == 0]])
true
3abcf1380d0c3fa02c2859866d0589d60f2f6909
shy2913/python-tutorial-2
/p300.py
UTF-8
54
2.859375
3
[]
no_license
a = {1: 'a'} a['name'] = "익명" del a[1] print(a)
true
01df3e7785f2bd103fd28af07782152ef87ff29a
qfan/bladerunner
/bladerunner/formatting.py
UTF-8
16,920
2.859375
3
[]
no_license
#coding: utf-8 """Bladerunner output formatting functions. Copyright (c) 2014, Activision Publishing, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain t...
true
3ec7b61ad5ea90715ccf4ff2fb2f3b64e4d8f319
hustlestar/stock-api
/back/api/entity/stock_processed.py
UTF-8
3,545
2.921875
3
[]
no_license
class StockProcessed: def __init__(self, stock_raw): self.stock_raw = stock_raw self.first_open_price = 0 self.last_close_price = 0 self.max_price = 0 self.min_price = 100000 self.change_for_period = 0 self.change_percent = 0 self.max_positive...
true
4943727c99269fdd0782d8e0acb4deaf06029f04
Fengyongming0311/TANUKI
/技术文档资料/python文件和目录操作方法大全(含实例).py
UTF-8
6,428
3.765625
4
[]
no_license
一、python中对文件、文件夹操作时经常用到的os模块和shutil模块常用方法。 1.得到当前工作目录,即当前Python脚本工作的目录路径: os.getcwd() 2.返回指定目录下的所有文件和目录名:os.listdir() 3.函数用来删除一个文件:os.remove() 4.删除多个目录:os.removedirs(r“c:\python”) 5.检验给出的路径是否是一个文件:os.path.isfile() 6.检验给出的路径是否是一个目录:os.path.isdir() 7.判断是否是绝对路径:os.path.isabs() 8.检验给出的路径是否真地存:os.path.exists() 9.返回一个路径的目录名和...
true
09494bf745de7f6dc8ed5153784668bb1a0651d1
kootenpv/reddit_ml_challenge
/challenge/calculate.py
UTF-8
373
2.53125
3
[]
no_license
import numpy as np from sklearn.metrics import f1_score def score(clf, X, y): if not hasattr(y, "shape"): y = np.array(y) if len(y.shape) == 1 or y.shape[1] == 1: predictions = clf.predict(X) else: predictions = np.argmax(clf.predict(X), axis=1) y = np.argmax(y, axis=1) ...
true
b0b06bb612de5c70a5501111becb991183ca04b4
hobson/ggpy
/ggpy/cruft/autocode/FileUtils.py
UTF-8
1,177
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ generated source for module FileUtils """ # package: org.ggp.base.util.files import java.io.BufferedReader import java.io.File import java.io.FileNotFoundException import java.io.FileOutputStream import java.io.FileReader import java.io.IOException import java.io.PrintStream class FileU...
true
6f396e0c75d2953400733a1cbdfe5778ea752e8f
stjordanis/autogluon
/multimodal/src/autogluon/multimodal/models/fusion/fusion_mlp.py
UTF-8
7,327
2.703125
3
[ "Apache-2.0" ]
permissive
import logging from typing import List, Optional import torch from torch import nn from ...constants import AUTOMM, FEATURES, LABEL, LOGITS, WEIGHT from ..mlp import MLP from ..utils import init_weights, run_model from .base import AbstractMultimodalFusionModel logger = logging.getLogger(__name__) class Multimodal...
true
689a448248b69a2792f67e2189bd5a349c001c79
San1357/Leetcode_Problem
/Validate_Binary_Search _Tree.Py
UTF-8
1,054
3.40625
3
[]
no_license
'''Problem : Validate Binary Search Tree ''' #CODE : class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None # Morris Traversal Solution class Solution(object): # @param root, a tree node # @return a list of integers def isValidB...
true
e8d5e9482b65d90ca0e4474330c6701fe9652308
SelcukDE/Python_2020
/20200710_set.py
UTF-8
4,009
4.03125
4
[]
no_license
# set # {} # set() # ********************************************************* set_1 = {"red", "blue", "pink", "red"} colors = "red", "blue", "pink", "red" set_2 = set(colors) print(set_1) print(set_2) print(type(set_1)) print(type(colors)) print(type(set_2)) # *******************************************************...
true
2ed94f301a41fd798620244e4017c20436c25f65
HyunSung-Na/TIL-algorism
/알고리즘/알고리즘-스터디/pr_위장.py
UTF-8
1,014
3.359375
3
[]
no_license
import itertools def solution(clothes): answer = 0 dic_clothes = dict(clothes) result = [] for i in range(1, len(clothes) + 1): product = itertools.combinations(dic_clothes, i) for p in product: flag = True key_dic = [] for e in range(len(p)): ...
true
afa769dcc06b4d43207492e0d0c2a92af1cca63f
balamurugan1999v/DataStructure
/llistqueue.py
UTF-8
1,126
3.65625
4
[]
no_license
class Node: def __init__(self,data): self.data=data self.next=None class SLL: def __init__(self): self.head=None self.tail=None def front(self,data): if (self.head==None): self.head=self.tail=Node(data) else: newnode=Node(data) ...
true
5b7451f2b4364b0ac481488cab3b47b016a9c7cc
omkumbhar/heart-diseases-prediction
/form.py
UTF-8
1,365
2.546875
3
[]
no_license
from wtforms import Form, BooleanField, IntegerField,SelectField,SubmitField, StringField ,FloatField from wtforms.validators import DataRequired,Length class PredictForm(Form): male = SelectField("What is your gender ", choices=[(1,'Yes'),(2,'No')],validators=[DataRequired()]) age = I...
true
d841e89e5114eafbf5ef056d8b3ffa8d8bef037f
sjburt/FaceTrackerPan
/Python/PyBasicComms/PyBasicComms mac.py
UTF-8
2,304
3.046875
3
[]
no_license
# -*- coding: utf-8 -*- # A basic communications with the board import serial import threading import time class SerThread(threading.Thread): i = 512 def __init__(self,flag): threading.Thread.__init__(self) self.ser = serial.Serial("/dev/tty.usbmodemfd121",9600,timeout=None) self.f...
true
4880b76f205195cedd8eefd640fb1a6b95cb7e5f
jajajag/SMAC3
/smac/epm/hoag/lr_hoag.py
UTF-8
3,636
2.609375
3
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "LicenseRef-scancode-philippe-de-muyter", "BSD-2-Clause" ]
permissive
import numpy as np from smac.epm.hoag.abstract_hoag import AbstractHOAG from sklearn.linear_model.logistic import _logistic_loss_and_grad, \ _logistic_grad_hess, LogisticRegression from scipy.sparse import linalg as splinalg from smac.epm.hoag.abstract_hoag_functions import AbstractHOAGFunctions class LRHOAG(Abst...
true
b8d7830361159ba1fdadec5498ae3672d7f97e01
nanli-7/algorithms
/209-minimum-size-subarray-sum.py
UTF-8
2,044
3.984375
4
[]
no_license
""" 209. Minimum Size Subarray Sum - Medium ##array #two pointers #binary search Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't one, return 0 instead. Example: Input: s = 7, nums = [2,3,1,2,4,3] Output: 2 Explanati...
true
cd0d77ef133d4e8aee99a83bcec22536aed41739
dominico120/covid19-2
/covid19-arima.py
UTF-8
1,423
2.84375
3
[]
no_license
import datetime import pandas as pd from matplotlib import pylab as plt import japanize_matplotlib import statsmodels.api as sm def get_data(): url = 'https://www.mhlw.go.jp/content/pcr_positive_daily.csv' df = pd.read_csv(url, usecols=[0, 1], names=['date', 'positive...
true
6e1f5a8c65e495d25516660c2f76f3f33bf72d22
5g-media/ss-cno-teleimmersive-game
/results/make_session_diagrams.py
UTF-8
2,550
2.546875
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import os labels = [('Number of Produced Profiles', 'number_of_produced_profiles'), ('Percentage of GPU Users', 'percentage_of_gpu_users'), ('Average Mean Opinion Score (MOS)', 'average_mos'), ('Transcoding Cost', 'transcoding_cost'), ('QoE Sum to Cost Rate', 'qoe_sum_to_cost_ra...
true
ec77178fc79508795cab1dde17c98d258141c5a1
tom-schultz/serverless-cat-facts
/cat_facts.py
UTF-8
1,035
2.5625
3
[ "MIT" ]
permissive
""" HTTP Cat facts delivery from DynamoDB """ import json import os import uuid import boto3 from boto3.dynamodb.conditions import Key TABLE = boto3.resource('dynamodb').Table(os.environ['TABLE_NAME']) #def get(event, context): def get(): """ Get method returning cat fact. """ random_uuid = uuid.uuid4() ...
true
608e1e15e4be34086e09782048e379961c7f083f
rliffredo/advent-of-code
/aoc_21/21.py
UTF-8
2,674
3.4375
3
[]
no_license
import functools import itertools from common import read_data def parse_data(): lines = read_data("21", True) return [int(lines[0].split()[-1]), int(lines[1].split()[-1])] def new_state(new_state_for_player, player_id, old_state): other_player = (player_id + 1) % 2 new_results = [0, 0] new_res...
true
b507973552e18dfb65d50685e010e02b6ae60f97
atom015/py_boj
/4000번/4504_배수 찾기.py
UTF-8
218
4.09375
4
[]
no_license
t = int(input()) while True: n = int(input()) if n == 0: break if n % t == 0: print("{} is a multiple of {}.".format(n,t)) else: print("{} is NOT a multiple of {}.".format(n,t))
true
a268994b446483d367ba2ddff7f7ec551686def0
jamesdchong/BattleShip
/BattleShipFolder/my_module/BattleShip.py
UTF-8
3,189
4.3125
4
[]
no_license
from PlayerInfo import PlayerInfo from ShipInfo import ShipInfo from setupPlayers import setupPlayers from printBoard import printBoard from placeGuess import placeGuess from checkMove import checkMove from checkWin import checkWin import string import random """ Main Driver Program """ print("\nWelcome to Mini-Battl...
true
613f3f21ec95ad2c5a9c943debda981ee20f5666
verena91/irp-importer
/importer-egresos.py
UTF-8
5,342
2.625
3
[]
no_license
import csv import datetime import json # TODO: Debería ser un switch con todas las opciones (tiene solo lo que yo uso) def obtener_tipo_documento_texto(codigo): if codigo == '1': return 'Factura' elif codigo == '2': return 'Autofactura' elif codigo == '3': return 'Boleta de Venta' ...
true
a204f42377442e1af2f1c78e50fa76e299fe3bb6
tiago-ferreira/game-simulator
/apps/house.py
UTF-8
523
3.1875
3
[]
no_license
# -*- coding: utf-8 -*- class House: def __init__(self, valueToBuy, valueToLoan): self.__valueToBuy = valueToBuy self.__valueToLoan = valueToLoan @property def valueToBuy(self): return self.__valueToBuy @valueToBuy.setter def valueToBuy(self, valueToBuy): self.__va...
true
bcecab131bb14a9e6b4f694b9fc6582483bdacd8
dariusWhidbee/question.py
/questionDW01.py
UTF-8
1,061
3.921875
4
[]
no_license
# Fix Errors # Variables corr = 0 q1r = False q1a = 3 # Introduction, asks the user 1 question print(" Hello, this program only runs one question. All you have to do is" " choose one of the options below that you think is right") print() print("""What object has teeth but can't bite? 1) A zipper 2) A saw 3) A...
true
91eb77dbbbd5af474e7d71d8ac2161cddd12dcd3
publicmays/LeetCode
/valid_sudoku.py
UTF-8
1,050
2.796875
3
[]
no_license
class Solution(object): def isValidSudoku(self, board): for i in xrange(9): horiz, vert = dict(), dict() for j in xrange(9): if board[i][j] == '.': pass elif board[i][j] in horiz: return False el...
true
e6a282b0b22d825cd93c4d0be20d0f730fb48b03
asreedh3/Machine-Learning
/First.py
UTF-8
1,127
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Oct 16 13:09:04 2018 @author: Ashlin """ import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.pipeline import Pipeline mydata=pd.read_csv('Data.csv') print mydata.head() print mydata.iloc[:,0] print mydata.head() X=mydata.iloc[...
true
52ac947ef95cf5988077e65139f42e4dc7852762
honzaKovar/Projects
/Codewars/odd_and_even.py
UTF-8
1,217
4.59375
5
[]
no_license
""" Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob — to check his answers, he needs a program that among the given numbers finds one that is ...
true
8faf6788c4e711a87f1883630a2f100e37afb704
bengimizrahi/PokerGym
/pokergym.py
UTF-8
1,680
3.015625
3
[]
no_license
from poker_core import * import itertools def printTable(hands, communityCards): communityCardsStr = " ".join((str(c) for c in communityCards)) print("""\033c N: {} {} W: {} E: {} S: {}""".format(han...
true
317fb78876a9d09feba28ae29d1741505a4e833a
goalkeeperfyc/crawler_opgg
/crawler/test_multiprocessing7.py
UTF-8
445
2.78125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Oct 1 11:59:32 2018 @author: fangyucheng """ import multiprocessing def worker(num): """thread worker function""" open_file = open('/home/fangyucheng/test_multiprocessing', 'a') open_file.write(str(num)) open_file.write('\n') open_file.flush() open_...
true
abb47afcc40edb7699196e5d4a0d1f6cb94fee4d
MonaVana/python-012021
/python-012021-lekce7/lekce7-ukol35.py
UTF-8
384
2.796875
3
[]
no_license
#import wget #wget.download("https://raw.githubusercontent.com/pesikj/python-012021/master/zadani/5/temperature.csv") import matplotlib.pyplot as plt import pandas teploty = pandas.read_csv("temperature.csv") teplota_mesta = teploty[teploty["City"].isin(["Helsinki", "Miami Beach", "Tokyo"])][["City", "AvgTemperature...
true
bea1847fd360279cc97d14d255181386526ff0b4
learningsimulator/learningsimulator
/tests/test_parse_stimulus_elements.py
UTF-8
4,752
2.734375
3
[ "MIT" ]
permissive
from .testutil import LsTestCase from keywords import STIMULUS_ELEMENTS from parsing import Script def parse(text): script = Script(text) script.parse() return script.script_parser.parameters.val[STIMULUS_ELEMENTS] class TestBasic(LsTestCase): def setUp(self): pass def test_simple(self)...
true
2370259b2866895b7804cd5e5dbdb340c59e53b4
stayhungry134/microbit
/2-button/button_heart.py
UTF-8
730
3.09375
3
[]
no_license
from microbit import * # 创建三个心形图形 heart1 = Image("01010:" "10101:" "10001:" "01010:" "00100") heart2 = Image("04040:" "44444:" "44044:" "04440:" "00400") heart3 = Image("07070:" "777...
true
5cfe294a46a1e064e0801f8fbf51de9cce709b9f
SwarnaPavani/prime
/prime.py
UTF-8
100
3.328125
3
[]
no_license
num=input() for i in range(2,int(num/2)): if num % i==0: print("no") break else: print("yes")
true
3a4aa6f56895f90a1cfd7d63a358917128e78781
RainsWang/Python2.7-Selenium
/Project/Page_object/Page_object/DistributionlineVoluDayCalcTransLoss.py
UTF-8
3,996
2.65625
3
[]
no_license
# -*- coding: utf-8 -*- ''' -------------------------------------漂亮的分割线---------------------------------------------- 作者 :王禹 IDE :PyCharm 时间 :2018/10/23 0023 下午 3:26 当前项目名称 :Auto 功能 :理论线损容量法日计算变压器损耗结果验证 -------------------------------------漂亮的分割线------------------------------------...
true