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
04b6a7275193d314a8cd8296a20421257d5dc4b8
Yurik-xie/mytest
/dropout.py
UTF-8
2,535
2.703125
3
[]
no_license
import tensorflow as tf from sklearn.datasets import load_digits from sklearn.cross_validation import train_test_split from sklearn.preprocessing import LabelBinarizer # load data digits = load_digits() X = digits.data y = digits.target y = LabelBinarizer().fit_transform(y) X_train, X_test, y_train, y_test = train_te...
true
26d48b3a53077968c089e0c6e3c2a13f71a38f73
all1m-algorithm-study/2021-1-Algorithm-Study
/week7/Group4/boj1987_ljwljw8541.py
UTF-8
683
2.875
3
[]
no_license
#boj1987_ljwljw8541 import sys input = sys.stdin.readline R,C = map(int, input().split()) matrix = [list(map(lambda x: ord(x)-65,input())) for _ in range(R)] alphabet = [True]*26 #오,아래,왼,위 kx = [0,1,0,-1] ky = [1,0,-1,0] answer = 0 def dfs(x,y,depth): global answer answer = answer if answer>depth e...
true
e45b31cc096f291aede7c095d4ce862599c00646
jifrankford/PLL
/PLL_src/Red Pitaya/file_server.py
UTF-8
784
2.9375
3
[]
no_license
#file_server.py #from time import sleep import sys import socket # Import socket module port = int(sys.argv[2]) # Reserve a port for your service. s = socket.socket() # Create a socket object s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) host = '10.84.241.80' ...
true
177e469899b4510c68902252b2546d33f39fa620
claytonkristiansen/ENGR217HW_6
/plotdata.py
UTF-8
2,766
3.390625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from math import sqrt from statistics import mean def OpenFile(file_name): file = open(file_name) # Check to see if the file is empty row = file.readline() # read the first line that has column headers if row == '': quit('The file is empty.')...
true
5c876e4d7604cb00085d4b2d131e66d5cdc12e54
joyceho/afib
/afib/risk_scores/tests/test_npoaf.py
UTF-8
1,707
2.53125
3
[ "MIT" ]
permissive
import numpy.testing as npt from afib.risk_scores import npoaf, NPoafC def test_npoaf(): tmp = npoaf(64, "None", False) npt.assert_equal(tmp, 0) tmp = npoaf(65, "None", False) npt.assert_equal(tmp, 2) tmp = npoaf(75, "None", False) npt.assert_equal(tmp, 3) tmp = npoaf(75, "Mild", False) ...
true
9764c11f200f6c54afa9b3cd3e345fc57842bd23
mari756h/The_unemployed_cells
/model/cbow.py
UTF-8
1,227
2.890625
3
[]
no_license
import torch import torch.nn as nn import torch.nn.functional as F class cbow(nn.Module): def __init__(self, vocab_size, embedding_dim=20, padding=True): super(cbow, self).__init__() # num_embeddings is the number of words in your train, val and test set # embedding_dim is the dim...
true
44444baa6643bfe746214c656c5dc5e05e56cc72
IIITSERC/SSAD_2015_A3_Group2_7
/201402087/SpriteObject.py
UTF-8
903
3.34375
3
[]
no_license
#! /usr/bin/env python ####################################### # Author : Dhruv Khattar # ##################################### import pygame import os class SpriteObject(pygame.sprite.Sprite): """ The Basic Sprite Object Class """ """ Constructor Function """ def __init__(self,image_location)...
true
646a05bf3402e31f75e444b5493df273af1cbcdd
laltin/pdf-tools
/overlay.py
UTF-8
1,732
3.171875
3
[]
no_license
#!/usr/bin/python import pyPdf import sys def single_overlay (input_file): """ returns a page object that is overlay of pages of a single pdf file """ input = pyPdf.PdfFileReader( open(input_file, "rb") ) page = input.getPage(0) for i in range(1, input.getNumPages()): page.m...
true
fe200ac4d1b0128d1057efe6857fc8ebf4b2c47f
bghojogh/Fisher-Discriminant-Analysis
/FDA_kernelFDA/my_kernel_PCA.py
UTF-8
10,404
2.78125
3
[]
no_license
import numpy as np from numpy import linalg as LA from numpy.linalg import inv from sklearn.metrics.pairwise import pairwise_kernels from sklearn.preprocessing import StandardScaler from sklearn.neighbors import kneighbors_graph as KNN # https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.kneighb...
true
c9dfb93e25cb971e164646cfd844f5093c2450e0
Roooooobin/Leetcode-Problems
/python/Odd Even Linked List.py
UTF-8
662
3.265625
3
[]
no_license
""" # -*- coding: utf-8 -*- # @FileName: Odd Even Linked List.py # @Author : Robin # @Time : 2019/6/10 22:23 """ class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def oddEvenList(self, head): if head is None or head.next is None: ...
true
d31b105c1ae2d831825af6fcdb8d93010f59bc9e
dpfried/rnng-bert
/scripts/evaluate.py
UTF-8
1,223
2.6875
3
[]
no_license
import subprocess from collections import namedtuple ParseMetrics = namedtuple("ParseMetrics", ["recall", "precision", "f1", "complete_match"]) def eval_b(ref_file, out_file): command = ["EVALB/evalb", "-p", "EVALB/COLLINS.prm", ref_file, out_file] proc = subprocess.Popen(command, stdout=subprocess.PIPE) ...
true
3a6d3dd57620d194dfa9b1c6516a23c52b45b39d
dheidenr/practices
/probabilities/task1.py
UTF-8
641
2.859375
3
[]
no_license
"""Из какого количества элементарных событий состоит пространство элементарных событий для следующего испытания: производится выстрел по мишени, представляющей собой 1010 концентрических кругов, занумерованных числами от 11 до 1010, а затем столько раз кидается игральная кость, сколько очков выбито на мишени.""" if ...
true
eb9fa1bf7d2e018441d72e8a578d25979e1f3121
anits-prudhvi/leetcode
/linked_list.py
UTF-8
716
3.734375
4
[]
no_license
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def convert_list(l:list)->ListNode: h = None t = None for i in l: if t == None: t = ListNode(int(i),None) h = t else: ...
true
4ba2e3743bcbc0a43eb31950037c6ba94919fe6a
nicholaskarlsen/FYS2150
/lab9resist/prelab9.py
UTF-8
949
2.71875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import FYS2150lib as fy from PIL import Image def ex_4(): # Ex 4 Fg = [] vt_2 = [] vt_3 = [] vt_4= [] file = open('terminal_hastighet.dat', 'r') for line in file: cols = line.split() Fg.append( float(cols[0]) ) vt_2....
true
946ff3276dfff01ea00144e6b6274dde31472aae
Wang-Shuo/Data-Structure-and-Algorithm-Practice
/剑指offer/005.py
UTF-8
1,337
3.609375
4
[]
no_license
# -*- coding: utf-8 -*- class Solution: def replaceSpace1(self, s): if not isinstance(s, str): return temp = '' for c in s: if c == ' ': temp += '%20' else: temp += c return temp def replaceSpace2(self, s): ...
true
7d1fa31c5115fc11e8ae1b818d3ee006b5e79c45
not-an-anagram-lover/Python-Hello-World
/Classes and objects/class_3.py
UTF-8
1,551
3.296875
3
[]
no_license
x=0 y=0 z=0 m=[None]*100 w=[None]*100 c=[None]*100 class Ppp: x=0 def tp(m,w,c): sum1=0 for i in range(0,x): sum1=sum1+m[i]+w[i]+c[i] print(sum1,'is the total population overall') def tmp(m): sum2=0 for i in range(0,x): sum2=sum2+m[i] print(sum2,'is the total populatio...
true
efff9068b26b3c3b2919d058dfba68e35e0867fc
ashleyjr/MLH
/Implementation/Python/test2.py
UTF-8
618
2.90625
3
[]
no_license
import serial, time, sys port = serial.Serial("/dev/ttyUSB0", baudrate=115200, timeout=0.1) test=[ 100,0,1,1,1,1, 100,1,1,0,0,0, 100,5, 100,6, 100,2] port.flushInput() while(1): for i in range(0,18): sys.stdout.write( "Send " + str(i) + " " + str(test[i]) + " \n\r")...
true
3bec9297bc46ced09602ced55d554e859567b3b2
dcloud/thatsfantastic
/scraper/tests/test_tasks.py
UTF-8
3,942
2.671875
3
[]
no_license
import unittest import requests import cachecontrol import betamax import os import json from unittest.mock import mock_open, patch from scraper.tasks import * from scraper.scrape import (HTMLScraper,) from scraper.tests import (CASSETTES_DIR,) BASE_TEST_URL = "http://httpbin.org/" class TestScraperTasks(unittest.T...
true
9b582f33d159ca595fe50029455016dda0586dee
jasontbradshaw/iron-tools
/playback.py
UTF-8
8,462
2.921875
3
[]
no_license
import os import logging import threading import time import util import rtp import config from it_exceptions import * class Playback: def __init__(self): self.__lock = threading.Lock() self.rtpplay = rtp.RTPPlay() self.rtpplay_live = rtp.RTPPlay() self.play_address =...
true
b848dc1b6e8f3295ed6b45c555c2e7ab30cb7bb1
Shivani-01/Python-Assignment
/Python-Asignment/Module 1/exercise4/math_eq_a.py
UTF-8
51
3.234375
3
[]
no_license
x,y=2,5 Z=((x+3)*(x**2))/((y-4)*(y+5)) print(Z)
true
3ba71e4c1caa40f472d73f3e26ade942c2191fbb
htmlprogrammist/kege-2021
/tasks_25/solutions/25-97.py
UTF-8
347
2.90625
3
[]
no_license
start, end = 135790, 163228 def allDivs( x ): divs = [1, x] d = 2 while d*d <= x: if x % d == 0: divs.append( d ) if x // d > d: divs.append( x//d ) d += 1 return sorted(divs) for x in range( start, end+1 ): divs = allDivs(x)[1:-1] s = sum(divs) if s > 460000:...
true
7b9d14fe7917f5c3c641885e8fd85d82486016b8
KalasJan/Project-Euler
/PE 48.py
UTF-8
117
3
3
[]
no_license
# Problem 48 # last 10 digits of 1^1 + ... + 1000^1000? print (sum(i**i for i in range (1, 1001)) % 10**10)
true
8c46c864f4a280092c97bcdba7e1435fb6f3b5d2
Vardinghus/Studie
/5. semester/Statistisk inferens for lineære modeller/Scripts/Scripts/likelihood_function.py
UTF-8
425
3.140625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Sep 05 14:49:56 2017 @author: Frederik Vardinghus """ import numpy as np import math as m import matplotlib.pyplot as plt rep = 10 success = 3 def L(theta): return m.factorial(rep)/(m.factorial(success)*m.factorial((rep-success)))*(theta**success)*(1-theta)**(rep-succe...
true
04626e85a5ab6051a7baad5d155ebc47ef028eb7
Stomach-ache/Codeforces
/416B.py
UTF-8
404
2.515625
3
[]
no_license
m, n = map(int, raw_input().split()) s = [] for i in xrange(m): a = map(int, raw_input().split()) tmp = [0] * n; if i == 0: for j in xrange(n): tmp[j] = (0 if j == 0 else tmp[j-1]) + a[j]; s.append(tmp); continue; for j in xrange(n): if j == 0: tmp[j] = s[i-1][0] + a[0]; continue; tmp[j] = a[j] ...
true
33ec5869c2348281856817bd96f995eba77c5c7b
krlong014/PyNonlin
/NewtonBratu.py
UTF-8
1,232
3.296875
3
[]
no_license
# Newton iteration for solution of the Bratu equation # u''=exp(-u), u(-1)=u(1)=0 import numpy.linalg as npla import scipy.sparse.linalg as spla import numpy as np import scipy.sparse as sp from FDLaplacian1D import FDLaplacian1D alpha = 0.5 # Set up an m by m matrix for FD discretization of the Laplacian m = 5 K = ...
true
feafac7be148074d3013150f869109c4a19285d8
ylgh2011/nlp-hw12
/hw1_segmentation/hexiangh/baseline_method/data_struct.py
UTF-8
1,357
2.859375
3
[]
no_license
import sys, codecs, optparse, os import operator class Pdist(dict): "The distribution function over given algorithm" def __init__(self, filename, sep = '\t', N = None, missingfn = None): self.maxlen = 0 for line in file(filename): (key, freq) = line.split(sep) try: ...
true
05166c38e23b6303e226815091ace883882b288e
CaptainDasheng/PDielec
/Python/UnitCell.py
UTF-8
23,095
2.75
3
[ "MIT" ]
permissive
#!/usr/bin/python # # Copyright 2015 John Kendrick # # This file is part of PDielec # # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied wa...
true
8de13a9340bde21f3630d217eccd6eadadf18bc0
Ale1120/Learn-Python
/Fase2-Manejo-de-datos-y-optimizacion/tema6-Funciones/argumentos-referencia.py
UTF-8
387
3.546875
4
[]
no_license
#argumentos por referencia (lista,coleciones tuplas, diccionarios) # su valor general def doble_valor(numeros): for i,n in enumerate(numeros): numeros[i] *= 2 ns =[50,100,200] doble_valor(ns) ns # truco para referencia lista[:] hacemso una copia def doble_valor(numeros): for i,n in enumerate(numeros...
true
fa54671ef561532ef86552698a1cb8588d4ca088
AmanMulani/python_web_crawling
/rank_reset.py
UTF-8
227
2.703125
3
[ "MIT" ]
permissive
import sqlite3 conn = sqlite3.connect('spider.sqlite') cur = conn.cursor() cur.execute(''' UPDATE Pages SET new_rank = 1.0, old_rank = 0.0 ''') conn.commit() cur.close() print('The rank of all pages has been set to 1.0')
true
59e98cdb40d052c171cb4cab65ba5ac02503fd35
shaaker-ma/Operation-Research
/Assignment3/graphColoring.py
UTF-8
1,215
2.9375
3
[]
no_license
import pulp as p Lp_prob = p.LpProblem('Problem', p.LpMinimize) numberOfVertex, numberOfEdges= input().split() variable = [] constrains= [] lpMax = p.LpVariable("lpMax", lowBound = 0) for i in range(int(numberOfVertex)): temp = "x" + str(i) variable.append(p.LpVariable(temp, lowBound = 0)) fo...
true
03704f426cb0ea8e2a76d0a8b9d8d1b25464ef49
oargudo/orometry-terrains
/analysis/peaksdata.py
UTF-8
8,435
2.671875
3
[]
no_license
from utils.distributions import * from utils.coords import * # add extra columns with the metrics to the dataframe def addExtraColumns(df): # add extra columns to the dataframe elevation = feet2m(df['elevation in feet'].values) prominence = feet2m(df['prominence in feet'].values) saddleElev = elevati...
true
b06cb2eae7d9dd6d839fb49ee91079f9fcd8aebd
DanNixon/GettingStartedWithPythonAndRaspberryPi
/Chapter08/weather_xml_sax.py
UTF-8
2,345
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- #!/usr/bin/env python from datetime import datetime import urllib2 import xml.sax from string import Template import sys class WeatherHandler(xml.sax.ContentHandler): def __init__(self): self._tag_buffer = list() self._location_name = '?' self._location_country =...
true
990f2afa9048f46650761a3399b37cb8fda8fd53
icyfig/Backend
/GCJ_20201_Qual_mural.py
UTF-8
4,833
3
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 26 23:49:21 2021 @author: icy """ stateg = '' def main(): global stateg test_cases = int(input()) for iii in range(test_cases): full_inp_list=(input().strip()).split() #x=cj #y=jc X = int(full_inp_list[0]) Y =...
true
4d4efac15bac664866843f4a07ec6acc12d389ed
vieiraeduardos/easy-management
/CoordenacaoFacil/models/University.py
UTF-8
639
2.6875
3
[ "MIT" ]
permissive
from CoordenacaoFacil import db from bson.objectid import ObjectId class University(): def __init__(self, id=0, name="", code=""): self.id = id self.name = name self.code = code def createUniversity(self, university=None): db.universities.insert({ "name": universit...
true
0e219fd9a64d45cb0cb89bf9229ba44f68686ed4
mathFonseca/DB20182
/06 - Extração de Informação/movie.py
UTF-8
3,532
2.9375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*-# from imdb import IMDb import psycopg2; import psycopg2.extras; import psycopg2.extensions psycopg2.extensions.register_type(psycopg2.extensions.UNICODE) psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY) #Conecta ao banco de dados try: connection = psyc...
true
7415a8ab7b4c3cc68aba5a4729d1cf2550dbd596
Songbird0/unicode_printer
/unicode_zsclass_spaces.py
UTF-8
915
2.65625
3
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- from pest_rule_builder import build_to_pest_rule # See also: http://www.fileformat.info/info/unicode/category/Zs/list.htm unicode_zclass_characters = [ 0x0020, # SPACE 0x00A0, # NO-BREAK SPACE 0x1680, # OGHAM SPACE MARK (dash) 0x2000, # EN QUAD 0x2001, # ...
true
82e62fe60286a9fd133d690d7714ed9eaf28549c
SagarSikchi/Math-Interpreter-using-Python
/project/tokens.py
UTF-8
665
2.921875
3
[ "MIT" ]
permissive
# Creates tokens from nodes import * from dataclasses import dataclass from enum import Enum # class for tokentypes class TokenType(Enum): NUMBER = 0 PLUS = 1 MINUS = 2 MULTIPLY = 3 DIVIDE = 4 L_PARENTHESIS = 5 R_PARENTHESIS = 6 MODULO ...
true
669467bfe435999d62ff73b76353064e6a588656
JakubPac/Metody-Numeryczne
/Laboratorium 1/main.py
UTF-8
2,532
3.46875
3
[]
no_license
import math import numpy as np import scipy import numpy.linalg as nl def cylinder_area(r:float,h:float): """Obliczenie pola powierzchni walca. Szczegółowy opis w zadaniu 1. Parameters: r (float): promień podstawy walca h (float): wysokosć walca Returns: float: pole powierzchni...
true
b8b9f471d450884c1743b0ccd7616221c112d7f3
RyanMcDonald/csc485c
/Assignment2/src/asymmetric_friendships.py
UTF-8
652
3.15625
3
[]
no_license
''' Created on Oct 3, 2013 @author: Ryan ''' import sys import MapReduce mr = MapReduce.MapReduce() def mapper(record): person = record[0] friend = record[1] # If a person is friends with someone, emit a 1. Emit for the reverse as well, so that way if that person is also friends # with this pe...
true
ba6e08d861fba18a1d9a826a3795de8fa59935e6
SWShin02/gas-cloud-simultation
/base code/bounce.py
UTF-8
923
3.140625
3
[ "MIT" ]
permissive
import numpy as np import matplotlib.pyplot as plt # 상수 정의 G = 6.67384e-11; M = 5.972e24; R = 6.3781e+6 # 시뮬레이션 조건 r = R v = 5800 angle_i = 0.25*np.pi v_r = v*np.sin(angle_i) r2w = v*np.cos(angle_i) * r w1 = r2w/r**2 theta = 0 dt = 0.1 x = [r*np.cos(theta)] y = [r*np.sin(theta)] while -2 * np.pi ...
true
3a86c4e49199abfc7d19b19902eaa8098269bbf4
jasonwee/asus-rt-n14uhp-mrtg
/src/lesson_application_building_blocks/sched_overlap.py
UTF-8
389
3
3
[ "Apache-2.0" ]
permissive
import sched import time scheduler = sched.scheduler(time.time, time.sleep) def long_event(name): print('BEGIN EVENT :', time.ctime(time.time()), name) time.sleep(2) print('FINISH EVENT:', time.ctime(time.time()), name) print('START:', time.ctime(time.time())) scheduler.enter(2, 1, long_event, ('first'...
true
4305a7ead0d32950bf10809016dd767366080e2e
fulQuan/ift6266h15
/liblearn/sandbox/preprocess_.py
UTF-8
5,647
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jul 19 22:43:26 2013 @author: francis """ import numpy as np import theano as th import theano.tensor as T from os.path import join from learn.utils import shared_x from learn.utils import cast_x from learn.layer ...
true
a1989258b0570dd9c3fbe6ca66c4efccda1c0dda
DaHuO/Supergraph
/codes/CodeJamCrawler/16_0_1/Lilipoho/counting_sheep2.py
UTF-8
697
2.890625
3
[]
no_license
import sys def f(path): with open(path) as fil: lis=fil.readlines() out= open("out.txt","a") i=1 for j in range(int(lis[0])): dic={} num=int(lis[j+1]) n=0 if num ==0: out.write ("Case #%d: INSOMNIA\n" %(i)) i+=1 con...
true
25a9313e82da8c5f9849bab83446d50adc0f8ba6
leejongcheal/algorithm_python
/python_book(이것이 코딩테스트다)/07 이진탐색/7-2 떡볶이 떡 만들기.py
UTF-8
931
3.1875
3
[]
no_license
# 주어진 높이의 합값이 target보다 큰지 비교 # 같으면 0 작으면 -1 크면 1 def l_sum(L, mid, target): sum = 0 for i in L[::-1]: if i > mid: sum += i - mid else: break if sum == target: return 0 elif sum > target: return 1 else: return -1 def binary_serach(L, t...
true
9da1c244d7ef18c6e4566fe3d29093d215542ee9
TangliziGit/dataquest
/Data Analysis with Pandas/Working with Missing Data/WwMD_template.py
UTF-8
13,194
4.15625
4
[]
no_license
# coding: utf-8 # In[1]: from __future__ import print_function # #Data Analysis with Pandas # ##Working with Missing Data # ###1: Finding the missing data # Missing data can be presented a few different ways. # # In python, we have the None keyword and type, which indicates no value. # # pan...
true
320700eac461fef02b6ad9793c4f4851dd9720a3
mychristopher/test
/pyfirstweek/面向对象编程.py
UTF-8
3,137
3.6875
4
[ "Apache-2.0" ]
permissive
#!/usr/bin/python # -*- coding: utf-8 -*- # class Student(object): # # def __init__(self, name, score): # self.__name = name # self.__score = score # # def get_name(self): # return self.__name # # def get_score(self): # return self.__score # # def set_score(self, score):...
true
4c0c7211078f83a2528c1d9a679eef2e1cb8b50b
Saint-Venant/optimisation_cocktails
/Version0/TestPremierRecuit.py
UTF-8
5,574
2.671875
3
[]
no_license
from Version0 import * from PremierRecuit import * import matplotlib.pyplot as plt import numpy as np #nombre de commandes à optimiser nbCommandes = 20 ## création des commandes listeCommandes = [] temps = 0 for i in range(0, nbCommandes): c = commande(i, temps) temps += random.randint(0, 36) #tire u...
true
6790d808801e944269f4063dcaa36d651757595c
Insper/robot21.1
/aula02/webcam.py
UTF-8
1,541
2.90625
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- # Este NÃO é um programa ROS import cv2 import os,sys, os.path import numpy as np import fotogrametria # ->>> !!!! FECHE A JANELA COM A TECLA ESC !!!! <<<<- def calcular_angulo_e_distancia_na_image_da_webcam(img, f): """Não mude ou renomeie esta função ->>> !!!!...
true
1e0aa1d8a68fc2ffe3e6c206b7abe12bd31ad9ea
akhilakr06/pythonluminar
/Basic_test/q6.py
UTF-8
480
3.15625
3
[]
no_license
n=int(input("enter the limit")) def sum_prime(n): sum=0 for i in range(2,n+1): j=2 for j in range(2,i): if (i%j)==0: j=i break if j is not i: sum+=i print("sum of prime numbers up to 50:",sum) sum_prime(n) # l=1 # u=50 # for n...
true
066c61ef2b14a67ad5879045962e16c70006a5c4
ruoilegends/NGUYENTANLOC_43807_CA18A1A
/NguyenTanLoc_43807_CH07/Exercises/Page218_Exercise_06.py
UTF-8
269
2.734375
3
[]
no_license
""" Author: Nguyen Tan Loc Date: 15/10/2021 Problem: The Turtle class includes a method named circle. Import the Turtle class, run help(Turtle.circle), and study the documentation. Then use this method to draw a filled circle and a half moon. Solution: .... """
true
cc068004a9143abdadd4c111ab0609828106ca2f
rhdedgar/toolsets
/python/interview/reverse_e.py
UTF-8
302
3.609375
4
[]
no_license
""" Find the numbers not included in the provided list, within its range. """ from __future__ import print_function # using extended slice sequence method ITEM_0 = 'wasitacatisaw' #ITEM_1 = '' print(ITEM_0) ITEM_REV = ITEM_0[::-1] if ITEM_0 == ITEM_REV: print('yep!') else: print('nope!')
true
71b6dd1dc2091d0523053a6b3581533875c9d825
Mirela22/Formation-Mars---Mai-2017
/1-Exercices Programmation en python/Tableaux/exo3tab.py
UTF-8
296
3.46875
3
[]
no_license
import random tab=[] nbrepositif=0 nbrenegatif=0 for i in range (0,10): b=random.randint (0,100) tab.append(b) if b>0: nbrepositif+=1 else: nbrenegatif+=1 print (tab) print("total de nombre positif: ", nbrepositif) print("total de nombre negatif: ", nbrenegatif)
true
b2e543a13104b90318d24854ff29ee2a9bda50cf
NarayanAdithya/Flask_Works
/selfclientserver/plot.py
UTF-8
695
2.78125
3
[]
no_license
import plotly import plotly.graph_objs as go import plotly.express as px import pandas as pd import numpy as np import json def create_plot(x): new_content=[] for i in range(len(list(x.keys()))//3): Task=x['Task'+str(i)+str(1)] Start=x['Start'+str(i)+str(2)] Finish=x['Finish'+str(i)+st...
true
7946097b84e287e05ec1866fa302f10b3fa9ddfc
alwaysra/PythonDev
/ra_3y_abcj.py
UTF-8
181
3.203125
3
[]
no_license
a=0 b=0 c=0 for a in range(0,10): for b in range(0,10): for c in range(0,10): if((a*100+b*10+c)+(a*100+a*10+c)==(b*100+c*10+c)): print(a,b,c)
true
20c314ea969c63f77cfac572d900ab5a43880e6b
tinglucomputer/RGMTS
/getWords/wordtodocument.py
UTF-8
2,234
2.640625
3
[]
no_license
__author__ = 'liupeng' import os import re import optparse import sys from Porter import PorterStemmer LEN=2665 dicts={} p = PorterStemmer() start=1 def getword(filename): global start print start,filename start+=1 r=open(rfc_path+filename,'r') string=r.read() s=re.findall("[a-z]{2,}",str.l...
true
a327b26f0ecef07e61d51e365fc09bfd2ff71275
S-C-U-B-E/CodeChef-Practise-Beginner-Python
/snake procession.py
UTF-8
184
2.984375
3
[]
no_license
for _ in range(int(input())): l=int(input()) s=input().upper() s=s.replace('.','') print("Valid"*bool(2*s.count("HT")==len(s))+"Invalid"*bool(2*s.count("HT")!=len(s)))
true
14c3a656a52f0d72bcb928c23e88e53f2d39e2d5
TrendingTechnology/pyrustic
/pyrustic/manager/handler/add_handler.py
UTF-8
9,581
3.078125
3
[ "MIT", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
from pyrustic.manager.misc import funcs import os import os.path import pkgutil class AddHandler: """ Description ----------- Use this command to add a file, a package or a regular folder to the Target. Pyrustic Manager will assume that files with extension ".py" are modules. Some conv...
true
ed1550a8b2b0191e5203759b7734fee69c6dfbde
florianhartig/pyecology
/src/analysis/latin_hypercube.py
UTF-8
463
3.171875
3
[]
no_license
''' Created on 23.09.2010 @author: Florian Hartig http://florianhartig.wordpress.com/ ''' import numpy as np def get_hypercube_indices(dimensions, times): out = np.empty((times, dimensions)) for i in xrange(dimensions): arr = np.arange(times) np.random.shuffle(arr) ...
true
1cbaf3a2c972f48a3fafe555d1fa6088eceb6032
pvacey/CTA
/cta.py
UTF-8
5,140
2.84375
3
[ "MIT" ]
permissive
#!venv/bin/python """An efficient way to check your train schedule.""" import json from datetime import datetime import sys import yaml import requests def get_raw_stations(): """Gets the raw station information""" return requests.get('https://data.cityofchicago.org/resource/8mj8-j3c4.json').json() def get_li...
true
8110e095d24e3f6542fc791d5cc00dad699028d3
nikeftekhar/compas_assembly
/examples/stack_interfaces.py
UTF-8
1,053
2.796875
3
[ "MIT" ]
permissive
"""Identify the interfaces of a stack. 1. Load a stack from a json file 2. Identify the interfaces 3. Export to json 4. Visualise """ from math import pi import compas_assembly from compas.geometry import Rotation from compas_assembly.datastructures import Assembly from compas_assembly.datastructures import assemb...
true
fb4729b426211f08e562a064afe504f342b16885
Easyty123/SEEX30
/GRB/HC_plotSweepW.py
UTF-8
735
2.515625
3
[]
no_license
import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np import Load def main(): nStrategies = 7 results = Load.loadFloatMatrix('HC_sweepW', nStrategies, nStrategies) plt.figure() plot = plt.imshow(results, cmap = mpl.cm.Greys, norm = mpl.colors.Normalize(vmin = 0, vm...
true
b81345502129d87ad97dfb1facb5db245cec3254
FireinDark/leetcode_practice
/13_roman_to_int.py
UTF-8
450
3.4375
3
[ "MIT" ]
permissive
class Solution: def romanToInt(self, s: str) -> int: roman_dict = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000} num = 0 for i in range(len(s)): if i<len(s)-1 and roman_dict[s[i]] < roman_dict[s[i+1]]: num -= roman_dict[s[i]] else: ...
true
fa61f7d7f708821fead172354deafd41ac5f5a90
hoyeoness9837/Algorithm-Sources
/python_essentials/non_iterable_types/set/Set.py
UTF-8
723
3.734375
4
[]
no_license
####Set#### # No Overlap, Non-iterable, not subscriptable # useful for checking if any data have been appeared data = set([1, 1, 2, 3, 4, 4, 4, 5]) print(data) #result = {1, 2, 3, 4, 5} the overlapping numbers are removed. data = {1, 1, 2, 2, 3, 4, 5, 6, 7, 7, 7} print(data) #result = {1, 2, 3, 4, 5, 6, 7} the overl...
true
b0bbcf73ed832ac6f667dda54a4b8b098080d6fc
Schwusch/conky_advent
/advent.py
UTF-8
2,537
2.703125
3
[]
no_license
#!/usr/bin/python3 # coding: utf-8 from concurrent.futures import ThreadPoolExecutor import requests import bs4 ADVENTOFCODE = 'http://adventofcode.com/2016/leaderboard/private/view/YOUR_PRIVATE_LEADERBOARD_NR.json' ADVENT_COOKIE = {'session': 'PUT_COOKIE_HERE'} DJUL = 'https://djul.datasektionen.se/toplist' DJUL_COOK...
true
477760c3358cc91771cd7897bcb31198f07bfbeb
nightwiz/Learn-Python
/面向对象/隐藏对象的属性.py
UTF-8
533
4.4375
4
[]
no_license
class Dog: def set_age(self, new_age): if new_age>0 and new_age<=100: self.age = new_age else: self.age = 0 def get_age(self): return self.age dog = Dog() # dog.age = -10 # dog.name = "小白" # print(dog.age) # 用方法来替代 直接获取属性的值 # 定义属性的时候不要让外部直接调用,而是通过方法去获取,例如get_...
true
caf44d6a419915418e35d7db61f1515c51f4f12b
ztzztztt/Py2CByCython
/utils/utils.py
UTF-8
3,996
2.5625
3
[]
no_license
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ @Author : zhoutao @License : (C) Copyright 2013-2017, China University of Petroleum @Contact : zhoutao@s.upc.edu.cn @Software: PyCharm @File : utils.py @Time : 2020/3/21 12:43 @Desc : 编译项目的工具文件 """ import os from shutil import rmtree from config import c...
true
5045def73466e511e034564b119ba4b9915633c3
mehadi-trackrep/StockMarketDataManagementApp
/main.py
UTF-8
6,844
2.6875
3
[]
no_license
from tkinter import * import tkinter as tk from tkinter import ttk from tkinter import messagebox, filedialog import csv import os import json # from database_utils import * import mysql.connector ##TODO - Database mydb = mysql.connector.connect(host="localhost", user="root", passwd=None, port=3306, database="tkinter...
true
5bfa5e40b1a12318c48f989ee9fe6dee6070b632
kchammas/DD2434-assignment-1
/problem7/problem_7.py
UTF-8
15,492
3.203125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from sklearn import decomposition from sklearn import manifold import argparse # Function that loads the dataset and returns dataset, annotations for the points as well as color indexes for the points # # Input: # path-string to the dataset fi...
true
a0bc0abf1dfadf2b103354a83b052c0d8853548e
sbalanovich/cs182finalproject
/project.py
UTF-8
1,956
2.53125
3
[]
no_license
import sys import worker import task import local import csv from constraints import print_cost_summary if __name__ == '__main__': # initialize workers with open("csv/small/worker_skill_increasing_difficulty/task_skill_increasing_rareness/workers.csv", "rb") as workersFile: reader = csv.reader(workersF...
true
2249ee1362579aca258a431de2cc9466fc419225
lijianying10/chart4old_PIC
/src/graph_maker.py
UTF-8
3,313
2.984375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Aug 17 10:40:58 2013 @author: jianyingli """ from pylab import * import matplotlib.axes as ax import matplotlib.pyplot as plt import numpy as np class graph_maker(object): title = '' xtitle = '' ytitle = '' filename = '' color=['b','g','r','c','m','y'] ...
true
d1221ae36ed239517cbd7780bb9e26345de465b2
TrendingTechnology/libacbf
/tests/test_editor/test_edit_book.py
UTF-8
2,624
2.609375
3
[ "BSD-3-Clause" ]
permissive
import pytest from libacbf import ACBFBook def test_references(results_edit): with ACBFBook(results_edit / "test_references.acbf", 'w', archive_type=None) as book: book.book_info.book_title['_'] = "Test Edit references" book.references["test_ref"] = {'_': "This is a new test reference."} ...
true
29cac77719084215b4420ea7a7b57fc588bac1c4
fainle/data_structure
/python/basic/single_linked_list_by_list.py
UTF-8
2,554
3.96875
4
[]
no_license
class Node: """ 基础节点 """ def __init__(self, val): self.val = val self.next = None class SingleLinkedList: """ 单链表 """ def __init__(self): self.head = None self.length = 0 def add(self, val): """ 增加一个节点 :param val: :...
true
39aacffb8d7a77588cb06c559d6261b2efd8fc14
DevelopperIA/Scraping_data_weather
/parallel_scraping_meteo_France.py
UTF-8
3,200
2.921875
3
[]
no_license
import requests from bs4 import BeautifulSoup import pandas as pd import numpy as np import threading import math import time start_time = time.time() dates = [] temperature = [] list_code = [] list_all_src = [] year = input('add the year: ') def parallel_scraping(start, end): for w in n...
true
9999f39402124771f4cc13fd377a7a724616126a
amanpanda/flex-your-sighs
/lexicon_generator.py
UTF-8
11,043
3.375
3
[]
no_license
from random import sample from numpy.random import choice from numpy.random import random import math from enum import Enum import pandas as pd import os MAX_CHOICE_SIZE = 100000000 # Approaches for homophones class HomophoneStrat(Enum): # max probability between homophones maxprob = 0 # add probabilitie...
true
cca16836c3561d7560205a8d6bacc7228714bd43
bsgreenb/py-chess
/check.py
UTF-8
1,463
3.625
4
[]
no_license
import moves # Gets the square of the current turn's king def get_king_square(board, current_turn): for row in range(8): for col in range(8): piece = board[row][col] if piece and piece.piece_type == "K" and piece.team == current_turn: return [row, col] def is_square...
true
909bf46d3bb5092663e934c5451229d095a7582a
Jaggar2018/financial_in_lab
/extract_report.py
UTF-8
3,323
2.609375
3
[]
no_license
import requests import pandas as pd import tushare as ts import re def get_html_text(url): hd = {'user-agent': 'Chrome/10'} r = requests.get(url,headers=hd) r.encoding = r.apparent_encoding try: r.raise_for_status() return r.text except: # 网页请求错误 return -1 de...
true
79fdd2ea174bd01490897ad95e5fe2777b4de9bd
gineer01/programming-challenges
/python/UVA/299_train_swapping.py
UTF-8
501
3.328125
3
[ "MIT" ]
permissive
import fileinput def solve(l, train): swap = 0 for i in range(l): carriage = l - i position = train.index(carriage) expected = carriage - 1 swap += expected - position train.remove(carriage) return swap def main(): f = fileinput.input() t = int(next(f)) ...
true
1e4388ad6e89a20c6b98f3e98344e929b09efcf3
darkost12/CounterReworked
/config.py
UTF-8
2,144
2.671875
3
[ "MIT" ]
permissive
#!/usr/bin/env python import json import sys import os from web3 import Web3 from eth_account import Account def getenv_or_exit(name): """ Gets the required variable from the environment. Closes the application with error if it's not set. Args: name (string) - The name of required environment vari...
true
4b8fdcf735e4c1c18202d6e7438e5373c0d369e0
ISS-Kerui/EAST
/box.py
UTF-8
904
2.71875
3
[]
no_license
import cv2 import numpy as np def get_sub_imgs(img_path, text_path, index): img = cv2.imread(img_path) points = [] with open(text_path) as f: for line in f.readlines(): line = line.strip().split(',') for i in range(0,8,2): points.append((int(line[i]),int(line[i+1]))) points = np.array(points) for i in...
true
1f93c875ef7293215378fadf5cbb6bad03eab451
vbonifaci/westeros-crawler
/crawl-links.py
UTF-8
1,229
2.6875
3
[]
no_license
#!/usr/bin/python2.7 # Requires Python 2.7+ import sys, string, urllib2, os, argparse from bs4 import BeautifulSoup import networkx as nx BASE = 'http://awoiaf.westeros.org/index.php/' opener = urllib2.build_opener() opener.addheaders = [('User-agent', 'Mozilla/5.0')] def read_dic(fname, side): dic = {} file = open...
true
25940c636843f1be46e621c4176c88b5cf1469a8
KeerthipriyaJawahar/Python-Programming
/Beginner Level/Greatestof3.py
UTF-8
278
4.09375
4
[]
no_license
a = input("Enter the 1st number: ") b = input("Enter the 2nd number: ") c = input("Enter the 3rd number: ") if(a<0 or a>=0 or b>0 or b<=0 or c>0 or c<=0): if(a<b>c): print b elif(b<c>a): print c else: print a else: print("Invalid Input")
true
d92efb742e25d5296e0521ccb8b3ce9ef28640af
lion963/Python-Advance-Repo
/Exercise Multidimensional Lists/Matrix Shuffling.py
UTF-8
760
3.140625
3
[]
no_license
rows, columns = map(int, input().split()) matrix = [] for i in range(rows): matrix.append([]) matrix[i] += input().split() while True: line = input() if line == 'END': break command_list = line.split() if command_list[0] == 'swap' and len(command_list) == 5: row1 = int(comma...
true
1ab9920840e9cdfac48b73e42d39637a78e327d4
abhilashkollipara/GUVI
/play_28.py
UTF-8
41
3.140625
3
[]
no_license
n=input() n=n.split() print(''.join(n))
true
c31e6baf1382428927d8dc4e094075d6f884a713
Hermotimos/Learning
/comprehensions.py
UTF-8
1,080
4.5
4
[]
no_license
""" This file is for learning and exercise purposes. Topics: - comprehensions Sources: https://dbader.org/blog/list-dict-set-comprehensions-in-python """ print('LIST COMPREHENSION') x = [x * 2 for x in range(10)] print(x) # simpler: x = list(range(0, 19, 2)) print(x) print('SET COMPREHE...
true
276a20bbb7f2ba310ab48c9a0377080aa9fdf1f5
alopes-sts/Python-Machine_Learning
/Modulo2/4.1._exercicio_extratrees.py
UTF-8
1,547
3.203125
3
[]
no_license
import pandas as pd from sklearn.ensemble import ExtraTreesClassifier from sklearn.model_selection import StratifiedKFold from sklearn.model_selection import cross_val_score pd.set_option('display.max_columns', 23) arquivo = pd.read_csv('C:/Onedrive/Curso_Machine_Learning/Modulo 2/mushroom_dataset.csv') arquivo...
true
a99afe7abbeb433825921df42bfec2f6484fc631
gracejhan/MapReduce
/MapReduce/task5/reduce.py
UTF-8
1,856
3.109375
3
[]
no_license
#!/usr/bin/env python # Big Data Assignment 1 - Task5 # Jungwoo Han (jh5990@nyu.edu) from operator import itemgetter import sys current_registration_state = None registration_state = None current_plate_id = None plate_id = None count = 0 max_count = 0 max_reg_state = None max_plate_id = None # input comes from STDI...
true
7bec721ab1571806c0cad5a96646d57a4d7d260e
kuldeepthesavior/Learning-ML-Begining
/tcs_fresco_oops_python_14_assessment.py
UTF-8
178
2.90625
3
[]
no_license
import cProfile def f1(): f= [i**2 for i in range(1,21)] return f def f2(): g = (x**2 for x in range(1,21)) return g cProfile.run('f1()') cProfile.run('f2()')
true
da4daf44f3bf97b7e4a655246ecb3c0315a58df6
ajaypy/web
/trees_and_graphs/merge_intervals.py
UTF-8
2,748
3.828125
4
[]
no_license
""" Given a list of intervals, merge them """ # Connected Components """ 1.iterate over all the components and collect all that overlap 2.merge the overlapping The merge is recursive 3.use hashmap to keep trace of the overlapping components Space: O(N ** 2) Time: O(N ** 2) """ import collections class mer...
true
1da3f915b46b797298920a1a694bc5753e1a10d2
6igsm0ke/Introduction-to-Programming-Using-Python-Liang-1st-edtion
/CH11/EX11.37.py
UTF-8
1,737
3.9375
4
[]
no_license
# 11.37 (Simulation: self-avoiding random walk) Write a simulation program to show that # the chance of getting dead-end paths increases as the grid size increases. Your program # simulates lattices with sizes from 10 to 80. For each lattice size, simulate a # self-avoiding random walk 10,000 times and display the prob...
true
fc15c59f3cefd8fe487f39cabc850ec694d11e86
nekoTheShadow/algorithm-and-data-structure
/ch11/q_11_01.py
UTF-8
1,110
3.046875
3
[]
no_license
class UnionFind(object): def __init__(self, n): self.parent = list(range(n)) self.size = [1]*n def find(self, x): if self.parent[x] == x: return x self.parent[x] = self.find(self.parent[x]) return self.parent[x] def union(self, x, y): ...
true
e9a470905b1b08371abc4c376aec3f01371aa1b0
xingyuchen515/Tech-savy
/if demo.py
UTF-8
2,165
3.796875
4
[]
no_license
import math # weight = input('What is your weight in lbs?') # height = input('What is your height in inches?')**2 # weight = float(weight) # height = float(height) # # BMI = 703 * weight / (height * height) # # if BMI >= 30: # print('You are in obesity.') # elif 25 <= BMI <= 29.9: # print('You are overweight....
true
661867f0aa6dcc6ca88b8c2f9b2c9f709f7246b2
ilkhem/market-report
/analysis/analysis.py
UTF-8
8,465
2.828125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Jun 30 14:47:35 2016 @author: ilkhem """ __author__ = 'ilkhem' import pandas as pd import numpy as np import matplotlib.pyplot as plt import os import datetime as dt def get_closest_minute(t): """ returns a datetime.datetime object giving the closest minute to a g...
true
f27efc3160bfb501a14ad4ea40de273535592675
alexboyd92/TestLabScripts
/python_scripts/host_scripts/getGVMreadyForUpdate.py
UTF-8
608
2.640625
3
[]
no_license
'''Quick script to disconnect the internal network and reconnect to a NAT network with internet ''' import subprocess from time import sleep def runCommand(bashCommand): process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE) output, error = process.communicate() return 0 def main(): #t...
true
cd3267da5d9d5bd8833e4592a72511d177d32887
987Frogh/Makehuman
/gaphor/storage/storage.py
UTF-8
14,713
2.609375
3
[ "Apache-2.0" ]
permissive
""" Load and save Gaphor models to Gaphors own XML format. Three functions are exported: load(filename) load a model from a file save(filename) store the current model in a file """ __all__ = ["load", "save"] import gc import io import logging import os.path import uuid import gaphas from gaphor import UML...
true
8fe7307b512e4247e3654381ebb6ac5b13dc4527
frogbootz/Python_Diary
/Diary_menu.py
UTF-8
592
3.234375
3
[]
no_license
from tkinter import * import sqlite3 #defining database paramters conec = sqlite3.connect('name.db') cur = conec.cursor() cur.execute("""CREATE TABLE name ( first_name text )""") #creating the first text box for name name_var=Tk() label_1=Label (name_var, text="Please ...
true
eac25d34d9e33f8621dd22126f16797a31a0e3c2
IrinaNizova/json-compare
/load_images/load_images.py
UTF-8
785
2.71875
3
[]
no_license
import argparse import os import requests import io import builtins ip = 'http://localhost' parser = argparse.ArgumentParser(description='Image loader') parser.add_argument('path', help='Path to folder') parser.add_argument('--ip', help='Server ip') args = parser.parse_args() if args.ip: ip = args.ip if not os.path.i...
true
644d168a4dc97fc4e5a0bc58874ca1ff8eb55c92
sykesjd/echonest-research
/gradualswitch/aqplayer.py
UTF-8
2,431
2.765625
3
[]
no_license
__author__ = 'lukestack' import pyaudio import wave import tempfile from echonest.remix.support.ffmpeg import ffmpeg class Player: """ Plays an echonest.remix.audio.AudioQuantum given an echonest.remix.audio.LocalAudioFile. It opens a pyaudio stream and feeds it the wave frames to be played. """ d...
true
855a3e2e55561f8ad1085584fb630d3911756f92
TaurusOlson/Infiniworld
/src/world/__init__.py
UTF-8
18,732
3.25
3
[]
no_license
"""World model.""" # Standard library. import logging import math from operator import attrgetter import weakref # My stuff. import events import evtman import geometry import materials import physics import tile LOGGER = logging.getLogger('world') class WorldError(RuntimeError): """Base exception class for the w...
true
3cb0a6a7f0be04e925802f76490a63a0acf30bbf
HenriqueSaKi/Database-Covid-Test
/Database-Covid-Test.py
UTF-8
1,462
3.0625
3
[]
no_license
import sqlite3 class sqlite_database(): def __init__ (self): pass def createTable(self,con): con.execute('''CREATE TABLE IF NOT EXISTS register_covid_patient (ID INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, occupation TEXT, age INTEGER, test TEXT)''') def insertValues(s...
true
fb593e319568f46e5054067648c47441655d14e8
sohailos/PuzzleSolver
/word_ladder_puzzle.py
UTF-8
5,220
3.578125
4
[]
no_license
from puzzle import Puzzle seen_words = set() class WordLadderPuzzle(Puzzle): """ A word-ladder puzzle that may be solved, unsolved, or even unsolvable. """ def __init__(self, from_word, to_word, ws): """ Create a new word-ladder puzzle with the aim of stepping from from_word t...
true