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
72e93461a7bc22d829ef78e21da1f2fdbd5b7e3d
minigonche/big_data_lab_1
/reto3/reto3_mapper.py
UTF-8
683
3.234375
3
[]
no_license
#!/usr/bin/env python """reto1_mapper.py""" import sys import re #import json #Mapper para el Reto 1 del Laboratorio 1 de Big Data #input comes from STDIN (standard input) for line in sys.stdin: if('"country"' in line): #Extrae el titulo #ajusta las dobles comillas line = line.replace('\\"...
true
de1e8424e7f5eb6ce3d0fd784144c1947abd6417
qmnguyenw/python_py4e
/geeksforgeeks/python/medium/13_4.py
UTF-8
19,887
4.65625
5
[]
no_license
Python Itertools Python’s Itertool is a module that provides various functions that work on iterators to produce complex iterators. This module works as a fast, memory- efficient tool that is used either by themselves or in combination to form **iterator algebra**. For example, let’s suppose there are two ...
true
7d005dacd13bd0aaa0b1fa08fc183ce31df86182
seal0112/ptt-push-crawler
/pttCrawler.py
UTF-8
2,751
2.6875
3
[]
no_license
import requests from bs4 import BeautifulSoup import re import time def crawlPostLink(board, userNames, continuePage=None): headers = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'} url = 'https://www.ptt.cc/bbs/%s' % board data = r...
true
0a481b3eb6de375b2a447e30d3fb7e16817a3bb1
Matiochnl/roguelike
/inv.py
UTF-8
205
3.328125
3
[]
no_license
def add_to_inventory(inventory, added_items): for element in added_items: if element in inventory: inventory[element] += 1 else: inventory.update({element: 1})
true
6b60d55615a0b02bce2a45545849386f5b281062
IDSC-io/handwritten-text-recognition-prototype
/src/preprocessor.py
UTF-8
1,312
2.96875
3
[ "MIT" ]
permissive
import random import numpy as np import cv2 def preprocess(image, image_size, data_augmentation = False): """ Preprocesses the image to fit the 128/32 Image that the model expects. The images get normalized too. :param image: The given input image. :param image_size: the size the image needs to h...
true
795c57b044cd015e33769effc593145e2a649748
profoundr/Algorithms
/MoveZeroEnd.py
UTF-8
306
3.34375
3
[]
no_license
def moveZero(arr,n): count = 0 for i in range(n): if arr[i] != 0: arr[count] = arr[i] count += 1 while count < n: arr[count] = 0 count += 1 arr = [1,2,3,0,0,5,4,3,0,5,5,0,0] n=len(arr) moveZero(arr,n) for i in range(n): print(arr[i]) nn
true
02fa2883facb68848f875b2f861b24bbd29b413b
jeremymcrae/denovonear
/tests/test_simulate_p_value.py
UTF-8
3,605
2.71875
3
[ "MIT" ]
permissive
""" unit test the WeightedChoice class""" from __future__ import division import os import unittest import math from denovonear.weights import WeightedChoice from gencodegenes.transcript import Transcript from denovonear.site_specific_rates import SiteRates from denovonear.load_mutation_rates import load_mutation_ra...
true
ae37fd1c8eb6dad388df31c9e91df9d90d7a5e9f
eamorgado/BaseDados20182019
/EmbededSql/Try1/Main.py
UTF-8
1,422
2.625
3
[]
no_license
import DataBase as DB from Data import data from Data import movies db = DB.DataBase("localhost","root","123pass")#123pass--passwd for mysql in my machine, replace it with yours cursor = db.getCursor() if db.findDataBase("testdb"): db.deleteDataBase("testdb") db.makeDataBase("testdb") db = db.connectTo("testdb") c...
true
bbaceeca3dd131d053a652ea37b2da7a29b4e01d
goFrendiAsgard/kakera-py
/groundtruth.py
UTF-8
3,955
2.875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat May 12 09:47:38 2012 @author: gofrendi """ import matplotlib.pyplot as plt import os from skimage.io import imread #from skimage.io import imsave from skimage.filter import threshold_otsu from scipy import std, mean def getImageFeature(imagefile, groundTruthImageFile, m=3,...
true
ed63614d365a5dc8e13fe0ed97611c6c6e15530d
smHeironimus/Dairy-Shrink
/all-sales.py
UTF-8
1,911
3.046875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt def main(): days = 7 ind = np.arange(days) p8_week_1 = (1660.08, 815.42, 806.09, 1131.10, 804.39, 874.19, 1488.50) p8_week_2 = (1573.14, 1062.79, 1000.42, 1017.26, 2218.39, 657.99, 1009.80) p8_week_3 = (2552.43, 1502.99, 851.82, 1171.10, 721.15, ...
true
3ab6ee5d17dc2425ca149445ed5727c9070abf10
SingAREN/radsecproxy-log-analyser
/lib/server_load_html_generator.py
UTF-8
7,138
2.75
3
[]
no_license
import os import datetime def server_load_web_page_template(current_date): """ Creates the html template of the total usage statistics for all the institutes and the data visualisation tool. :param current_date: datetime.date value :return: """ first_date = datetime.date(day=1, month=current_d...
true
5cb693a91437c4d69dcfb9db37dba8fdf698140b
Diaret/CIAN_project
/parser_code.py
UTF-8
16,690
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- # Dmitrij Lebedev import requests import re from bs4 import BeautifulSoup import pandas as pd import numpy as np # import time # ПОДРОБНОЕ ОПИСАНИЕ КОДА В ФАЙЛЕ ipynb # Страница ЦИАНа по которой будем ходить - собирать квартиры # p = число - номер страницы (поставим туда {}, чтоб подставлять...
true
d7581325a1621d5e4010e0304b94f2ab92f42620
Garima73/Python-Core
/Day1.py
UTF-8
947
3.796875
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: x=2 print(x) # In[8]: print("I have" + str("2") + "Apples") # In[9]: x=1 y=2 z=x x=y z=x+y print(z) # In[10]: 2+2.67 # In[11]: (1.9+2.7)-1.6 # In[12]: 399.01/3 # In[13]: 399.01//3 # In[14]: 398/3 # In[15]: 398//3 # In[16]: 2.2 **5 ...
true
2cdc6200196944ff242a086adf0b57d706c4ee53
pbhuss/meowbot
/meowbot/external_api.py
UTF-8
1,787
2.546875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import requests from meowbot.util import ( get_redis, get_strava_client_id, get_strava_client_secret, get_config, ) class StravaApi: def __init__(self): redis = get_redis() self._access_token = _get_strava_access_token(redis) @property def _headers(self): return {...
true
f3a11bad790649c3378726c626f8dcd89719d7a2
inacica/casadellibro
/librotest.py
UTF-8
2,107
2.546875
3
[]
no_license
import unittest import time from selenium import webdriver from selenium.webdriver.chrome.options import Options from locators import Locators from pages import HomePage, CartPage, CreateAccountAndPay class Test_Search_Base(unittest.TestCase): def setUp(self): option = Options() opt...
true
069a6ac53af08c9b76405b2a8a477e7c52039dba
binbin-xu/yac
/scripts/marg_sandbox.py
UTF-8
1,105
2.875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import numpy as np import pandas import matplotlib.pylab as plt m = 6 H = pandas.read_csv("/tmp/H.csv", header=None).to_numpy() b = pandas.read_csv("/tmp/b.csv", header=None).to_numpy() def shur_complement(H, b): # Schur complement H_mm = H[0:m, 0:m] H_mr = H[0:m, m:] H_rm = H[m:, 0:m]...
true
8ab607bb8340f384261f7b6f3636773be41df1be
DivyaVelugula/TwitterDataAnalysis
/Phase-2/Tweetcollection.py
UTF-8
1,301
2.8125
3
[]
no_license
#Import the necessary methods from tweepy library from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream #Variables that contains the user credentials to access Twitter API access_token = "1089997729219178496-BvhcwdDw6eGPbPJM5wJYqOvsq7rE7G" access_token_secret = "xZu9ILs...
true
9103fd87dafcde7a59d2f9bb0059552106c09a76
ChrisW68/ClassWork
/Python/Append to file.py
UTF-8
180
3.421875
3
[]
no_license
appendMe = "Here is some more text" # 'a' is for append saveFile = open('exampleFile.txt','a') # \n makes new line saveFile.write('\n') saveFile.write(appendMe) saveFile.close()
true
0681ebe6161d44e1ea699522377a0979fe68f7ef
aFlyWeight/NeuralNetworkHomeWork
/神经网络HW3/codeanddata/reading.py
UTF-8
1,502
2.703125
3
[ "MIT" ]
permissive
import pickle ''' with open('data.pkl', 'rb') as f: data = pickle.load(f) print(data.keys()) print('\n') for item in list(data.keys()): print(item) print(data[item]['data'].shape) print(data[item]['label'].shape) print('\n') ''' def load_data(): with open('data.pkl', 'rb') as f: data0...
true
598294e10f4ae463e11b92b725bd87d658cf800c
Nimrais/Linear_Regression
/utils.py
UTF-8
854
3.421875
3
[]
no_license
import numpy as np from sklearn.metrics import mean_squared_error, r2_score def generate_poly_features(df, cols, max_degree=3): """ Function to add polynomial transformation (x -> x^i) for column names in cols (iterable) in df (Dataframe) max_degree - maximum degree of polynomial features to be added "...
true
e10b9c237462649460c850e97b2c1f97f31f124b
Aasthaengg/IBMdataset
/Python_codes/p02918/s448183395.py
UTF-8
405
2.84375
3
[]
no_license
from bisect import bisect N,K = map(int,input().split()) S = list(input()) f = S[0] for i in range(N): if K == 0: break if S[i] != f: S[i] = f for j in range(i+1,N): if S[j] == f: break S[j] = f K -= 1 i = 0 res = 0 while i < N-1: f = S[i] for j in range(i+1,N): ...
true
939a41acd1cd45110a292f29dd4e564c66b0464d
prashant97sikarwar/data-structure-and-algorithms
/searching/smallest_positive_missing_number.py
UTF-8
685
3.09375
3
[]
no_license
def segregate(arr,n): j = 0 for i in range(n): if arr[i] <= 0: arr[i],arr[j] = arr[j],arr[i] j += 1 return j def find(arr,size): for i in range(size): if abs(arr[i]) -1 < size and arr[abs(arr[i])-1] > 0: arr[abs(arr[i])-1] = -arr[abs(arr[i])-1] fo...
true
1ad87e9615256a01f6f69c52c87f7c75fc60ef92
Light-Alex/offer
/test13.py
UTF-8
1,079
4.1875
4
[]
no_license
''' 题目: 反转链表 输入一个链表,反转链表后,输出新链表的表头。 ''' # 使用3个指针,firstPoint, secondPoint, thirdPoint class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: # 返回ListNode def ReverseList(self, pHead): # write code here if pHead == None: return None...
true
91ed8b48109891fd9a791d4b3fc4a04715dc650d
FilipeIlunga/CPD-Trabalho-Final
/main.py
UTF-8
4,741
3.015625
3
[]
no_license
import os from csvArq import * import time #--coding: ANSI - - # Funções # ================================================================================================================================== def switch(menu, handler): #implementação de menu com iteração caso usuário faça escolhas erradas. whil...
true
281f6c18684ccee343fb1b030349369a90ef49c6
SimonNagaitis/minesweeper
/minesweeper.py
UTF-8
3,992
3.515625
4
[]
no_license
import random class GameService: def __init__(self, boardservice, movementservice): self.boardService = boardservice self.movementService = movementservice self.moveResult = MoveResult() self.initializegame() def initializegame(self): self.moveResult = MoveResult() ...
true
10f3da98fa8086c61622a8cd7bd56e36dcfd2f68
survi/LeetCode
/Python/13. Roman to Integer.py
UTF-8
1,544
3.359375
3
[]
no_license
class Solution(object): def romanToInt(self, s): """ :type s: str :rtype: int """ outint = (s.count('M')*1000 - s.count('CM')*200 + s.count('D')*500 - s.count('CD')*200 + s.count('C')*100 - s.count('XC')*20 + s.count('L')*50 - s.count('XL')...
true
5c55ccc221a8ed1d0b8797d52136dcd50ec56c7e
Kushagra-0801/Advent-Of-Code
/2015/Day 13-1.py
UTF-8
719
3.203125
3
[ "Unlicense" ]
permissive
from itertools import permutations with open('Day 13 - input', 'r') as f: happiness_table = {} people = set() for line in f: line = line.strip().split() happiness_table[(line[0], line[-1][:-1])] = (int(line[3]) if line[2] == 'gain' else -int(line[3])) people.add(line[0]) max_happ...
true
80261fc681b058f2f94623d05ca14ce11255a0d1
pmlandwehr/flo
/flo/resources/base.py
UTF-8
4,555
3.265625
3
[ "MIT" ]
permissive
"""Base resource here """ import hashlib class BaseResource(object): """A resource is any `creates` or `depends` or `task` that is mentioned in a flo.yaml. A resource can be on the file system, in a database, etc. The basic functionality of an resource is to assess the state of the resource and ...
true
2889a2828dac59f7d94a3d5675f302c94e49e0c5
alimogh/AlgorithmsDesignAndAnalysis
/dijkstraData.py
UTF-8
1,794
3.859375
4
[]
no_license
''' Programming assignment 5: implement the Dijkstra's algorithm for computing shortest paths in a graph. If there is no path, define its distance as 1000000. ''' import heapq def readUndirectedGraph(filename): adjlist = [] f = open(filename) #lines = open(filename).read().splitlines() ...
true
243a2ddbb1449c1c39d3159d99f8606da45b6dc2
Pulecz/symmetrical-bills
/db.py
UTF-8
756
2.65625
3
[]
no_license
#!/usr/bin/env python from sqlalchemy import create_engine # motor from sqlalchemy import Column # structure from sqlalchemy import Boolean, DateTime, Integer, String, Unicode # datatypes from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() # one table for the actuall bills """ Column(F...
true
74e1762ecd7f6004dec7552df9a9849f556c8c17
manasivaraiya/sorting-list
/sort list in python.py
UTF-8
65
3.28125
3
[]
no_license
numbers = [1, 3, 4, 2] numbers.sort() print(numbers)
true
fd0203cb5f282749e3867d9dc638a2e865f68f21
mahtab04/Python-Programming-Practice
/Day17/q59.py
UTF-8
176
3.78125
4
[]
no_license
# Extract Numbers from a string __author__ = "Mahtab Alam" import re def numbers(str): return re.findall('\d+', str) s = "Python123" num = numbers(s) print(''.join(num))
true
6d72e915c4d3d484ca4099b54b0f303d85e1762f
johnmanny/proj6-mongo
/memos/tests/test_db.py
UTF-8
506
2.640625
3
[ "Artistic-2.0" ]
permissive
""" author: john nemeth sources: class material, previous testcases description: test for database functions """ import db from db import enterinDB, removefromDB, getmemos import arrow import nose #tests for correct sorting order of memos (by date) def test_datesort(): testrecords = db.getmemos() prevdate = ar...
true
1c8eb59143e43c03cf0371f7d305f999eb011ad5
sha-shrestha/swblocks-baselib
/scripts/cl.py
UTF-8
2,860
2.578125
3
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
#!/usr/bin/env python # # run msvs compiler with /showincludes and generate make dependencies # from optparse import OptionParser, BadOptionError from os.path import basename, splitext from subprocess import Popen, PIPE, STDOUT from sys import argv # an options parser that will pass-through unrecognized options class...
true
460306703d70308b5970b4db34eaa8f07f82ab13
Mark7E/coding_dojo
/python/fundamentals/oop/users_w_bank.py
UTF-8
3,009
3.734375
4
[]
no_license
''' Update your existing User class to have an association with the BankAccount class. You should not have to change anything in the BankAccount class. The method signatures of the User class (the first line of the method with the def keyword) should also remain the same. For example, our User class currently has a ...
true
00c5903fa3ed5cb8f15e0f0b04d3ea1bc57bd16b
v-shash/nido
/nido-config/configuration/configuration_test.py
UTF-8
4,165
2.59375
3
[]
no_license
import unittest import json import os import logging from configuration_builder import ConfigurationBuilder APP_CONFIG_SAMPLE = { "HTTPPort": 8000, "Env": 'dev', "Logger": { "Level": "Notice", "File": "/tmp/config.out" } } def get_logger(): logging.basicConfig() logger =...
true
b0a20ce9ea23125542a34ae5b4e61e8017d1712a
mariopuebla17/PythonExercicios
/ex039.py
UTF-8
438
3.703125
4
[]
no_license
from datetime import date anoNasc = int(input('Informe seu ano de nascimento: ')) anoAtual = date.today().year if anoAtual - anoNasc < 18: print('Ainda faltam {} anos para seu alistamento!'.format(18 - (anoAtual - anoNasc))) elif anoAtual - anoNasc == 18: print('Você está no ano de alistamento!') else: pr...
true
54a15b36b2802a6ad8f9972080e663ace49b10ea
HectorGarciaPY/primer1.py
/ultimodigito.py
UTF-8
144
3.78125
4
[]
no_license
print("Escribe un numero sin importar los digitos:") digito=input() x=int(digito) print("El ultimo digito de tu numero es:", x -10 * (x // 10))
true
ba90c87074aff7cda89de7500ac61bd289d08671
vidhan-arora/my_repo
/day 4/range.py
UTF-8
123
2.671875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jan 9 17:37:25 2019 @author: lenovo """ for x in range(21): print(x)
true
56c15bb76dea70b94a5a13ca5514ea1f7074d436
vlasove/sum_pu_1
/Lecture2/func_second.py
UTF-8
197
3.25
3
[]
no_license
def Summer(a,b): return a+b #parametric type print(Summer(2,3),Summer("lol","kek")) def Mult(a,b=1,c=2,d=3,e=3,f=6,g=8,h=9,lol=20): return a*b*c*d*e*f*lol print(Mult(5,7, f = 10))
true
6f545fd3a53b2eda3d9e4e5d38a41bcb409b7a84
andriykislitsyn/macuitest
/src/macuitest/lib/apps/application.py
UTF-8
7,493
2.671875
3
[ "MIT" ]
permissive
import logging import os import time from typing import Dict from typing import List from typing import Union from macuitest.lib.applescript_lib.applescript_wrapper import AppleScriptError from macuitest.lib.applescript_lib.applescript_wrapper import as_wrapper from macuitest.lib.core import wait_condition from macuit...
true
10ba51b2bf67a684352b9c2df58f1d20c6f5c382
Heim-AI/micromagneticmodel
/micromagneticmodel/driver.py
UTF-8
352
2.5625
3
[ "BSD-3-Clause" ]
permissive
import abc import micromagneticmodel as mm class Driver(mm.abstract.Abstract): """An abstract class for deriving drivers. """ @abc.abstractmethod def drive(self, system, **kwargs): """Drive method. This method must be implemented by a specific micromagnetic calculator. """ ...
true
e6e757bb7fcfa134564d6d48c8f01c2d8083b99d
Fyefee/PSIT-Ejudge
/100 PickThem.py
UTF-8
267
3.234375
3
[]
no_license
"""<3 Jeffy""" import json def main(num): """PickThem""" result = json.loads(num) count = 0 for i in result: if int(i) % 2 == 0: print(i) count += 1 if count == 0: print("Nope") main(input())
true
c2c5a5b466e7e0b6899733fa3aa0c737f79622f8
RT-Thread/mpy-snippets
/examples/03.board/1.stm32l4_pandora/timer.py
UTF-8
1,456
2.609375
3
[]
no_license
# # Copyright (c) 2006-2019, RT-Thread Development Team # # SPDX-License-Identifier: MIT License # # Change Logs: # Date Author Notes # 2019-06-29 ChenYong first version # from machine import Timer import utime as time def callback_periodic(obj): # defined preio...
true
d1c76c6afe88f46a6f32bac67f5c9412726867c8
aavila320/comp401
/project05/DragonCurve.py
UTF-8
1,431
4.0625
4
[]
no_license
# This program will create a fractal dragon curve using turtle graphics. # The results are saved as an eps. # A dragon curve is created by recursive 90 degree angles. from turtle import * def draw_fractal(length, angle, level, initial_position, target, replacement, new_target, new_replacement): position = initial...
true
2d966f69a1f1f8b51f1e3a5af7c4834966e4575c
pombredanne/curdling
/tests/unit/_test_curdling.py
UTF-8
5,337
2.953125
3
[]
no_license
import os from datetime import datetime from mock import patch, call from curdling.old import CurdManager, Curd, hash_files @patch('curdling.old.io.open') def test_hashing_files(io_open): "It should be possible to get a uniq hash that identifies a list of files" # Given that I have a list of files and a mock...
true
6ed1ee90835e2b3d318a4b77a790fdc4c5d0f30c
atomassi/mapping_distrinet
/distriopt/packing/algorithms/greedy.py
UTF-8
2,975
2.578125
3
[ "LicenseRef-scancode-proprietary-license", "MIT" ]
permissive
import logging from distriopt.constants import * from distriopt.decorators import timeit from distriopt.packing import PackingSolver from distriopt.packing.solution import Solution from .utils import Bin _log = logging.getLogger(__name__) class PackGreedy(PackingSolver): @timeit def solve(self, **kwargs): ...
true
7c63e703410cc4f9215c9811cf93c9348453c7d9
curio-sitas/MeteoScrap
/meteo.py
UTF-8
3,095
3.296875
3
[ "MIT" ]
permissive
#!/usr/bin/python3 """ IMPORTS """ import requests import sys import json """ BRIAN SINQUIN - METEO """ """ CONSTANTS """ # openweather API key app_key="835295f911955ff31de25a0226a08f11" # Please register your own key """ PRINTING METHODS """ # console colors class bcolors: HEADER = '\033[95m' ...
true
70aef26428f56bd2ae5a17495107b3132bbff0d1
ilya16/audio-watermarking
/metrics.py
UTF-8
342
2.984375
3
[]
no_license
""" Evaluation metrics. """ import numpy as np def snr(original, target): """ Signal-to-noise ratio. """ return 10 * np.log10(np.sum(original ** 2) / np.sum((original - target) ** 2)) def nc(w1, w2): """ Normalized correlation coefficient. """ return (w1 * w2).sum() / np.sqrt((w1 ** 2).sum()) / np....
true
abdeab5c07df6e4fc9f5b21eb49a6dafbf5c223c
zzsfornlp/nlp-readings
/tools/excel2json.py
UTF-8
913
2.625
3
[]
no_license
# # from excel to json file import pandas as pd import sys import json DEALING_FS = { "": str, "group": str, "proc": str, "title": str, "link": str, "description": str, "year": int, "task": lambda x: x.split("|"), "tag": lambda x: x.split("|"), } def main(fin: str, fout: str): df = pd.read_e...
true
5abe9a1ddbb49e6e9345b9fd2b3a9ef85ff62ff5
PiyushChaturvedii/My-Leetcode-Solutions-Python-
/Leetcode 2/K-Similar Strings.py
UTF-8
1,109
3.15625
3
[]
no_license
class Solution: def kSimilarity(self, A, B): """ :type A: str :type B: str :rtype: int """ if A==B: return 0 count=0 k=len(A) i=0 while A[i]==B[i]: i+=1 pastset=set() stack=[[A,i]] ...
true
1b9bda530a865d0f3e36fef81ca60dc368e64169
dunovank/Hierarchical-Attention-Network-1
/data_utils.py
UTF-8
3,682
3.109375
3
[]
no_license
""" Take in (text, labels) 1. Break down documents into sentences 2. Break down sentences into words 3. Data : [n_docs, sentences, words] 4. Since the HAN expects sentences the data needs to be packed as: [docs_in_batch, max_sents, max_words] For WordGRU, batch dimension is for the sentences. For SentenceGRU, b...
true
e7703e7faf342e92e294be9a81e5e82012f7c28b
PavlAA79/Labs_TMO
/KR_TMO/KR_TMO.py
UTF-8
5,754
2.90625
3
[]
no_license
import streamlit as st import seaborn as sns import pandas as pd import numpy as np from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsRegressor from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import ...
true
37728cd889b91c9bc27b9071cc2adacefee7996f
jacklyQinqin/trainning
/pythonTest/TkiniterBase/界面综合讲解12-3 表格布局.py
UTF-8
528
2.828125
3
[]
no_license
#!/usr/bin/env python/ # -*- coding: utf-8 -*- import time import tkinter from tkinter import ttk win = tkinter.Tk() win.title("绝对布局") win.geometry("600x400+200+40") label1 = tkinter.Label(win,text= "good ",bg="blue") label2 = tkinter.Label(win,text= "nice ",bg="red") label3 = tkinter.Label(win,text= "cool ...
true
917f46e6b6f7c6f7db7a22c84f0bfb9046ed6985
ShunKaiZhang/LeetCode
/sqrt_x.py
UTF-8
312
3.671875
4
[]
no_license
# python3 # Implement int sqrt(int x). # Compute and return the square root of x. # My solution class Solution(object): def mySqrt(self, x): """ :type x: int :rtype: int """ r = x while r*r > x: r = (r + x/r) / 2 return r
true
f4a68cee219069cdfc37faecfa8e45374140b10e
RugeljGG/AdventOfCode
/2019/day7.py
UTF-8
7,159
2.90625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Dec 7 05:59:16 2019 @author: gape """ from collections import deque with open('day7.txt') as file: raw_data = next(file).strip().split(',') #raw_data = '3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26,27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5'.strip().split(',')...
true
c4c25658eb3b4ca9c2afeced7d050078dffc4a42
sugia/leetcode
/Course Schedule II.py
UTF-8
2,719
4
4
[ "Apache-2.0" ]
permissive
''' There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] Given the total number of courses and a list of prerequisite pairs, return the ordering of courses you sho...
true
6c7189e7b603272360e52c7c53637463f70547fc
ThomKaar/generational-genotype-simulator
/Reproduce.py
UTF-8
1,554
3.296875
3
[ "MIT" ]
permissive
import random from Creature import Creature class Reproduce: # punnett square for the genes # random 0 to 2 to figure out how many offspring # create punnet square as list length 4 # for each offspring # random 0 to 3 to index into punnet square to select offspring # add Offspring to offspr...
true
59aba46632af155f81414d7145c7589bb479e682
LoicGrobol/python-im
/exos/examen_20161207.py
UTF-8
2,246
3.515625
4
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # examen python M2 - 07/12/2016 import re def nb_emprunts(data): """ calcule le nombre d'emprunts dans le jeu de données argument arg: data (list of lists) return: int """ res = 0 for item in data: res += int(item[-1]) return res ...
true
d5070d3bd424dd9888f60b48a42018c482c1ebc8
SamX23/python_learning
/fungsi.py
UTF-8
1,565
4.21875
4
[]
no_license
def displayme(str): print(str) ex = input('apapun: ') displayme(ex) # Return func def sum(arg1, arg2): total = arg1 + arg2 print('Ini ada didalam fungsi: {}'.format(total)) return total def kuadrat(x): return x * x ex = sum(2, 2) print('Ini ada diluar fungsi: {}'.format(ex)) x = 12 ex = kua...
true
a66469d28f2085d7d155f3c40720c0e752a19aed
ayushi710/basic-python-program
/nestedwhile.py
UTF-8
206
4.09375
4
[]
no_license
print("Enter Number :",end=" ") num = int(input()) i = 1 while i <= num: j = 1 while j <= 10: print(str(i) + " * " + str(j) + " = " + str(j * i)) j = j+1 print("\r") i = i+1
true
6e5588f22c05ee2e9263fa87f1460dd2c831c1f1
kwx4github/facebook-hackercup-problem-sets
/2015/qualifying_round/1.Cooking_the_Books/solutions/sources/348.Kevin
UTF-8
536
2.9375
3
[]
no_license
#!/usr/bin/python import sys for test_case in xrange(1, 1+int(sys.stdin.readline())): N = int(sys.stdin.readline()) Ns = str(N) smallest = N largest = N for i, ci in enumerate(Ns): for j in xrange(i+1,len(Ns)): cj = Ns[j] if not (i == 0 and cj == '0'): swapped = list(Ns) swapp...
true
bd5f9e345f6208cfadda5fd8f159fc435587c538
zhangjh12492/ares_terra
/qr/bc_img_read.py
UTF-8
2,738
2.53125
3
[]
no_license
import os from array import array import cv2 import pytesseract from PIL import Image pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe' tessdata_dir_config = '--tessdata-dir "C:\\Program Files (x86)\\Tesseract-OCR\\tessdata"' custom_seq = '\\' # 图片存放路径 pic_path = '{}{}i...
true
b11f71b2eca6cd67b1656b1984037e5028302b20
AJRMcCann/public-floodsystem
/Task2G.py
UTF-8
1,697
3
3
[ "MIT" ]
permissive
from floodsystem.stationdata import build_station_list, update_water_levels from floodsystem.flood import stations_level_over_threshold, stations_highest_rel_level # noqa from floodsystem.analysis import risk_by_gradients import matplotlib.pyplot as plt # requirement # noqa # ---------------------------------...
true
6b4b721deb78ea56a9da3450ee466a5db83f2451
Makhanya/PythonMasterClass
/Lambdas/lambdas1.py
UTF-8
246
3.421875
3
[]
no_license
""" Lambdas """ def square(num): return num*num # print(square(9)) def square2(num): return num*num def add(a, b): return a+b print(square2(9)) print(add(3, 10)) print(square2.__name__) print(square.__name__) print(add.__name__)
true
49f5bd31389680440dec10e03c52f653968d7511
alexseong/dsy_python_intro_4
/src/exercise_4.1.2.py
UTF-8
155
2.9375
3
[]
no_license
fhand = open('mbox-short.txt') count = 0 for line in fhand: if line.startswith('From '): words = line.rstrip().split() print(words[2])
true
8f51bf4ee317ebc2ed749e117da038a8039a9b53
loganyu/leetcode
/problems/2554_maximum_number_of_integers_to_choose_from_a_range_i.py
UTF-8
1,513
3.734375
4
[]
no_license
''' You are given an integer array banned and two integers n and maxSum. You are choosing some number of integers following the below rules: The chosen integers have to be in the range [1, n]. Each integer can be chosen at most once. The chosen integers should not be in the array banned. The sum of the chosen integers...
true
b21cc3b09fa15125254c5e08fbacf0ac23489a03
YJL33/LeetCode
/current_session/python/1029.py
UTF-8
1,924
3.703125
4
[]
no_license
""" 1029 """ from typing import List import heapq class Solution: # clarification # any restrictions on time/space complexity? (e.g. timeout/memory...) # upper/lower bound of costs[i]? # length of costs? # is is possible to have multiple distributions that meets the same cost? (e.g. [[1,1],[2,2]]...
true
ab3b0c12dcd2d3e870e787d223789f953c2f0bc5
oddeirikigland/ist-data-science
/modules/classification/xg_boost.py
UTF-8
1,884
2.890625
3
[]
no_license
import xgboost as xgb import matplotlib.pyplot as plt from modules.functions import calculte_models_auc_score, multiple_line_chart def xg_boost(trnX, tstX, trnY, tstY, multi_class, plot=False): best_score = 0 best_model = None best_learning_rate = 0 best_depth = 0 best_estimator = 0 learning_...
true
10fdd3a25b2402cde9113a8e97208b319b0231b0
TTTheMaTTT/Author-Attribution
/TextInstruments/TextChunksCreators.py
UTF-8
3,671
3.421875
3
[]
no_license
# Здесь находятся все модули, отвечающие за разбитие всех текстов всех авторов на куски, которые соответствуют некоторым # критериям (например, размеры кусков не должны слишком сильно отличаться или кол-ва кусков одного автора должны быть # одни и те же между авторами) import os from os import listdir class Simple_Te...
true
5793606411ed57286f8ccce6929aa8913d02ead1
filozyu/leetcode-journey
/src/dynamic-programming/house_robber_iii.py
UTF-8
1,124
3.828125
4
[]
no_license
from utils import list2binary_tree def rob(root): """ Dynamic programming on trees (post order traversal) Time: O(n) n - number of nodes in the tree Space: O(logn) the depth of the tree (recursion stack) """ def dfs(node): # dfs returns a list of two numbers: # dp[0] denotes t...
true
287693ad00cad3179a09c99e800ad69d09bcdc65
fgonzalezmir/ud032-DataWranglingWithMongoDB
/01_Excel_01.py
UTF-8
2,166
3.6875
4
[]
no_license
#!/usr/bin/env python """ Your task is as follows: - read the provided Excel file - find and return the min, max and average values for the COAST region - find and return the time value for the min and max entries - the time values should be returned as Python tuples Please see the test function for the expect...
true
cfeed6ad9df645b8d835d9c596f6b21ebae8d6f0
007HarshChaudhary/Google-Coding-Questions
/WordDictionart-Leetcode.py
UTF-8
1,448
3.40625
3
[]
no_license
# class WordDictionary: # def __init__(self): # """ # Initialize your data structure here. # """ # self.root = dict() # self.finish = False # def addWord(self, word: str) -> None: # node = self # for char in word: # if c...
true
1610bb6bd3212c592508b8546b4c75496d1a2eb3
gitcnk/covid_community_vulnerability
/scripts/merge_clean_data.py
UTF-8
27,422
2.640625
3
[]
no_license
import pandas as pd import numpy as np import sklearn as skl from sklearn import preprocessing import matplotlib.pyplot as plt PRINTING = 1 if PRINTING: print('Creating merged dataset...') ########################## # County Health Rankings # ########################## if PRINTING: print('Merging County Heal...
true
32e953e1330ddafd55693fb390084113ff970d3c
shaquille-hall/university_classes_proof
/testdata.py
UTF-8
2,570
2.75
3
[]
no_license
COLLEGE_OF_ENGINEERING = "College of Engineering" COLLEGE_OF_BUSINESS = "College of Business" COLLEGE_OF_SOCIAL_SCIENCE = "College of Social Sciences" ENGINEERING_DEPARTMENTS = ["Electrical Engineering", "Mechanical", "Civil"] ENGINEERING_STUDENTS = [ [1, 3.56, "Sam", "Smith", "smith.sam@drexel.edu", "215-123-4567", ...
true
02a49102f2daac6f3bf7ac24ccec0396479f4c83
514840279/crawler
/common/HtmlSource.py
UTF-8
4,120
2.53125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # develop 514840279 #-----系统自带必备模块引用----- import requests import re #正则处理 import urllib import chardet from urllib import parse from bs4 import BeautifulSoup as bs_4 from selenium import webdriver # 浏览器引擎webdriver模块 from lxml import etree import json import os from seleni...
true
2920659779e7ef4304b1f33bf5e36cb34dfb51d7
DiabCh/pdf_processor
/processors/text_parser.py
UTF-8
945
2.890625
3
[]
no_license
from .abstract_class import PdfParserAbstract import fitz import re class PdfParser(PdfParserAbstract): def __init__(self, filepath, search_terms=None): self.filepath = filepath self.data = None self.search_terms = search_terms def retrieve_text(self): document = fitz.open(sel...
true
ba3d2b1ca79bf8d0bdf4afd38df3eaebc9b2b46e
amrit2356/Dev-Training-Ray
/Ray_Google_Colab/ray_video_processing/video_reader.py
UTF-8
2,357
2.578125
3
[]
no_license
import sys import time from queue import Queue from threading import Thread import cv2 import ray from edisn_frame import EdisnFrame @ray.remote class VideoReader: initialized = False enable_logging = False def __init__(self, video_path, enable_logging=False, queue_size=32): self.stream = cv2....
true
8157a9b18f2c6026b3a8cf798bdaece078068255
jann-cabudoy/PyCite
/PyCite/PyCite.py
UTF-8
1,410
2.75
3
[]
no_license
from tkinter import * from tkinter import ttk #Main window set up root = Tk() root.title("PyCite") content = ttk.Frame(root, padding="3 3 12 12") fn = StringVar() ln = StringVar() pd = StringVar() city = StringVar() state = StringVar() pub = StringVar() first_name = ttk.Entry(content, textvariable=fn) last_name = ...
true
4fec733588954fceb55f7e2cfee24918f045ca72
PhoneixZhou/PyTorch_CodeReview
/examples/fx/fuser.py
UTF-8
5,558
2.890625
3
[]
no_license
from typing import Type, Dict, Any, Tuple, Iterable import copy import torch.fx as fx import torch import torch.nn as nn class WrappedBatchNorm(nn.Module): def __init__(self): super().__init__() self.mod = nn.BatchNorm2d(1) def forward(self, x): return self.mod(x) class M(nn.Modul...
true
551e70d5bed22bcd1e5ee0abafc0fe2b28e35ebb
shan1015/shanshan6
/shanshan6.py
UTF-8
1,054
3.78125
4
[]
no_license
#include <bits/stdc++.h> using namespace std; // remove ':' and convert it into an integer int removeColon(string s) { if (s.size() == 4) s.replace(1, 1, ""); if (s.size() == 5) s.replace(2, 1, ""); return stoi(s); } // Main function which finds difference s...
true
8d2969c346b69be617b71136fb2e088efd46da9d
SangwookCheon/mitocw600SC
/mitocw600SC/problem_set_4/testing.py
UTF-8
1,066
2.78125
3
[]
no_license
# # a = [(1,2,3),(1,2)] # # # # print a[0][2] # # b = 'Do Androids Dream of Electric Sheep?' # print b[3:] # # a = [(2,),(4,)] # a[0] += (3,) # a[1] += (6,7,) # # print a # # wordl = [] # text = 'as, ab, and dog!' # word = '' # word_cue = 0 # shifts = [] # for chr in text: # if chr != ' ' and chr not in " !@#$%^&*(...
true
d62d908d669c2702aea59c07aa7f0852edc9d394
josealbm/PracticasPython
/Práctica 5/P5E2.py
UTF-8
611
4.3125
4
[]
no_license
#Práctica 5 - Ejercicio 2 - José Alberto Martín #Escriu un programa que te demani nombres i els guar #di en una llista. Per a terminar d'introduir #nombres, simplement pitja Enter. El programa termin #a escrivint la llista de nombres. #Escriu un nombre: # 14 #Escriu un altre nombre: # 123 #Escriu un altre nombre: # -...
true
27d4853aa8c5ed69ace06999a44828147ae60a5c
aimlessness/python_tutorial
/lesson-003/main2.py
UTF-8
404
3.109375
3
[]
no_license
#!/usr/bin/env python import sys, string import add import minus count = len(sys.argv) if count != 4: print "Error: count is not 4" sys.exit(1) op = sys.argv[1] x = string.atoi(sys.argv[2]) y = string.atoi(sys.argv[3]) if op == 'add': print add.add(x,y) sys.exit(0) elif op == 'minus': print minus...
true
e52931c51fc9af968d847d4d6ec4b79827fdee06
vmirisas/Python_Lessons
/lesson3/odd.even.py
UTF-8
103
4.03125
4
[]
no_license
x = int(input("type an integer : ")) if x % 2 == 0: print("x is even") else: print("x is odd")
true
06525e32eb2b9edbadc8a34487c9e3078df09217
benchizhao/Oslo
/Q2-d-test.py
UTF-8
1,640
2.703125
3
[]
no_license
from Oslo_model import RelaxModel from operator import add import matplotlib.pyplot as plt import pickle import numpy as np import math with open("Q2-d.txt", "rb") as fp: h_tilde = pickle.load(fp) print(h_tilde[-1][:600]) with open("Q2-a.txt", "rb") as fp: stop_point = pickle.load(fp) stop_poin...
true
c16c91ad5ec24d5cd4ba7c1d6ef3f6b0bed3600b
kuprinaga/titanic-prediction-python
/analyse.py
UTF-8
1,212
2.890625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 10 19:12:22 2018 @author: kuprina_laptop """ import os as os import pandas as pd import numpy as np from fancyimpute import KNN import matplotlib.pyplot as plt os.chdir('/Users/kuprina_laptop/Documents/titanic/') data_test = pd.read_csv('test.csv'...
true
6148510acfd579cf65c34cdcb48a3f5187489657
WhiteKey-xt/python_midterm_20
/31.py
UTF-8
490
3.625
4
[]
no_license
n20=float(input("國文:")) n21=float(input("英文:")) n22=float(input("微積分:")) n23=float(input("體育:")) n24=float(input("程式設計:")) t11=float((n20+n21+n22+n23+n24)/5) print("平均分數:%2.2f" % (t11)) t12=dict(n20="國文",n21="英文",n22="微積分",n23="體育",n24="程式設計") t13=max(n20,n21,n22,n23,n24) t14=min(n20,n21,n22,n23,n24) print("最高分科目:程式設計"...
true
a71b234937b6b91a9b00ff988cdbeda56b971049
swagufied/cnv_library
/generic_utils/cnv_utils.py
UTF-8
686
2.984375
3
[]
no_license
from generic_utils.value_manipulations import list_to_lower, clean_string def check_CNV_match(CNVObject1, cnv_value1, CNVObject2, cnv_value2): values1 = CNVObject1.get_cnvType_values() values2 = CNVObject2.get_cnvType_values() #make sure same key exists in both objects key1 = None for key in values1: if clean_...
true
18a722b59100b9354264e4dc8d6547f06459e3d7
Cosmin013/Facultate
/Python/lab5/s5.py
UTF-8
281
3.234375
3
[]
no_license
def problem1(my_list): odd = [element for element in my_list if element % 2 == 1] even = [element for element in my_list if element % 2 == 0] return list(zip(even, odd)) if __name__ == "__main__": print(problem1( [2, 2, 2, 4, 5, 5, 5, 7, 7, 2, 4, 5, 7, 7, 4, 4]))
true
0d251421e1507a9622a3e67f6977e1c8bcbd0789
jsexton-portfolio/pyocle
/pyocle/form.py
UTF-8
3,859
2.8125
3
[ "MIT" ]
permissive
from typing import Sequence, Union, Dict, Any, Type, TypeVar, Optional import jsonpickle from pydantic import ValidationError, BaseModel, conint class FormValidationError(Exception): """ Error raised when an incoming request form is invalid """ def __init__(self, errors: Optional[Se...
true
03259be1e5dcc86d6641ceab79ebcaae30328f0d
FlavP/corepy
/chapter1/twolayer.py
UTF-8
1,906
3.390625
3
[]
no_license
import numpy as np class NeuronLayer: def __init__(self, nodes, inputs_per_node): self.weights = 2 * np.random.random((inputs_per_node, nodes)) - 1 class TwoLayerNN: def __init__(self, layer1, layer2): self.layer1 = layer1 self.layer2 = layer2 def sigmoid(self, z, deriv=False): ...
true
8a326875bab0e97ac29aea2bca9fe9983d211386
nordap/BOJ
/2920.py
UTF-8
236
3.75
4
[]
no_license
def func(arr): if arr == '1 2 3 4 5 6 7 8': print("ascending") elif arr == '8 7 6 5 4 3 2 1': print("descending") else: print("mixed") if __name__ == "__main__": arr = input() func(arr)
true
9b6b2e195e97700c16e869a578f6d82e9e6da88d
SamboVisal/Pycharm-Project
/FirstPorject/exercise/Factorial.py
UTF-8
104
3.703125
4
[]
no_license
num=int(input("Enter Number ")) i=1 result=1 while(i<=num): result=result*i i=i+1 print(result)
true
a1b75da507d0cd45461d8945997f593d2cf75953
Aasthaengg/IBMdataset
/Python_codes/p02647/s407344210.py
UTF-8
418
2.765625
3
[]
no_license
from itertools import accumulate n,k = map(int, input().split()) As = list(map(int, input().split())) for i in range(k): imos = [0] * (n+1) for i,a in enumerate(As): l = max(0, i-a) r = min(n, i+a+1) imos[l] += 1 imos[r] -= 1 acc = list(accumulate(imos)) # 指数関数的に増える i...
true
05668860f4e770295be7462f558f7f5f334b838b
juanchax/MagaPython
/Week 2/07. Exam Grading Print.py
UTF-8
627
4.25
4
[]
no_license
# 07 --------------- # # Crear un diccionario con 5 estudiantes y sus respectivas notas. Imprimir # por pantalla los alumnos que aprobaron y su nota (no en forma de diccionario, # si no con nombre : nota). Tener en cuenta que para aprobar el alumno debe # sacarse una nota mayor o igual a 7 y menor o igual a 10. studen...
true
33433923bbf8e79eae6a5f0032963699a1210478
jcuna/noc-list
/src/tests.py
UTF-8
7,090
2.90625
3
[]
no_license
""" __author__ = 'Jon Garcia jcuna@joncuna.com' Tests preparation lines. Run order is very important so injection happens correctly """ import io import logging import sys exceptions = [] logger = logging.getLogger() io_stream = io.StringIO() logger.addHandler(logging.StreamHandler(io_stream)) logger.propagate = Fa...
true
58044f508480a3a2cbb23e64c1252e741b36a2a9
Charllys-Brauwol/Projeto-Programa-o-BD
/Final/cidades.py
UTF-8
1,616
2.84375
3
[]
no_license
from PyQt5 import uic,QtWidgets import sqlite3 def listar_dados_cidades(): tela_cidades_2.show() banco = sqlite3.connect('banco_cidades.db') cursor = banco.cursor() cursor.execute("SELECT * FROM dados") dados_lidos = cursor.fetchall() tela_cidades_2.tableWidget.setRowCount(len(dados_lidos)) ...
true
eebd604d128000cffe102b6e454154cfbab87898
piotor87/verkko
/plots/test_heatmaps.py
UTF-8
2,052
2.796875
3
[]
no_license
import heatmaps as hm import os import numpy as np from matplotlib import pyplot as plt import matplotlib.gridspec as gridspec def test(): n_points = 10000 x_vals = np.exp(np.random.randn(n_points)) y_vals = x_vals * 0 + np.exp(np.random.randn(n_points)) fig, ax, cbar, im = hm.plot_counts(x_vals, y_va...
true
7185026bc0e74f8178a994b9e64bfbdc13c96272
dmlc/dgl
/python/dgl/nn/pytorch/explain/pgexplainer.py
UTF-8
30,333
2.8125
3
[ "Apache-2.0" ]
permissive
"""Torch Module for PGExplainer""" import math import torch import torch.nn as nn import torch.nn.functional as F from .... import batch, ETYPE, khop_in_subgraph, NID, to_homogeneous __all__ = ["PGExplainer", "HeteroPGExplainer"] class PGExplainer(nn.Module): r"""PGExplainer from `Parameterized Explainer for G...
true