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
31a3d80a8585b43b91ee0d1a1228c530f052c98c
wachira90/python-webscrap
/testscap.py
UTF-8
504
3.046875
3
[]
no_license
#!python from bs4 import BeautifulSoup # import bs4 ''' easy_install beautifulsoup4 pip install beautifulsoup4 ''' with open('index.html','r') as html_file: content = html_file.read() soup = BeautifulSoup(content, 'lxml') # print(soup) course_cards = soup.find_all('div',class_='card') ...
true
b8834022fc52c9d678dc0fab12c9eb60e6f3d10a
aws/aws-sam-cli
/samcli/lib/schemas/schemas_directory_hierarchy_builder.py
UTF-8
1,027
2.890625
3
[ "Apache-2.0", "BSD-3-Clause", "MIT", "BSD-2-Clause" ]
permissive
""" Responsible for building schema code directory hierarchy based on schema name """ import re # To sanitize schema package name and root name. During code generation schema service follows # convention to replace all the special character except [a-zA-Z0-9_@] via _. CHARACTER_TO_SANITIZE = "[^a-zA-Z0-9_@]" POTENTIA...
true
64ebaf899dc153b0718f06b439b991e3f955ea8e
TheaZh/NGN-Project
/src/Assignment.py
UTF-8
5,101
2.984375
3
[]
no_license
from pymongo import MongoClient from Course import Course ''' assignment = { 'assignment_id': assignment_id, 'description': description, 'submitted_file_dict': {}, 'upload_file_dict':{}, 'grade_dict': {} } ''' class Assignment: def __init__(self): self.mongo_u...
true
b46552b92ffb75b060ce13338895e1399e90831d
cccccccccccccc/Myleetcode
/739/dailytemperatures.py
UTF-8
702
3.296875
3
[ "Apache-2.0" ]
permissive
from typing import List class Solution: def dailyTemperatures(self, T: List[int]) -> List[int]: if T is None: return T output = [0]*len(T) stk = [] for i in range(len(T)): if stk: while stk: tmptemper = stk[-1][0] ...
true
2ff2c945da1881e045add4646d2b1ba0f131e06f
vishal17209/RL_M2018
/HW3/Random Walks (for Q6).py
UTF-8
5,354
3.703125
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[15]: import numpy as np import matplotlib.pyplot as plt import random import seaborn from tqdm import tqdm #this is used to detect infinite loops for debugging # In[16]: ''' Class that is used to generate the environment for Random Walks problem from th...
true
f56b913e2302cfc8ac87e6af3de7ba58c3badb8b
calviniap/TRLc
/flaskapp/dev/app/peewee_.py
UTF-8
10,397
3.28125
3
[]
no_license
# /usr/bin/python # encoding:utf-8 import time start = time.time() from peewee import * from datetime import date # 新建数据库 db db = SqliteDatabase('people.db') #db = MySQLDatabase("mydb", user="root", passwd="root") #表格模型 Person:这是一个Model的概念 #连接数据库db #db.connect() class Person(Model): #CharField 为抽象数据类型 相当于 varchar...
true
914c3c054208bc3137574285979aa8faea69ff5f
chananiiii/Algorithm
/Simulation/Stick.py
UTF-8
374
3.59375
4
[]
no_license
''' 백준 1094번 - 막대기 ''' import sys initialLength = 64 count = 0 goalLength = int(sys.stdin.readline()) while True : if initialLength > goalLength : initialLength /= 2 continue elif initialLength < goalLength : count += 1 goalLength -= initialLength continue else : ...
true
9e70e2ac9ef4067469587de92c6a321efa781d59
kangyangWHU/MGAAttack
/mi_fgsm.py
UTF-8
4,150
2.625
3
[]
no_license
import torch import torch.nn as nn from utils import * import numpy as np import config as flags class MI_FGSM_ENS(object): def __init__(self,models, weights=None, epsilon=0.1, stepsize=0.01, iters=10, mu=1, random_start=True, loss_fn=nn.CrossEntropyLoss(),pnorm=np.inf, ...
true
735bf25bfdb1f6e25fffd13d440853373862f37c
gpaumier/refsdomains
/refurls.py
UTF-8
674
3.09375
3
[ "MIT" ]
permissive
#!/usr/bin/python import io import sys def main(): reduce_domains('sorted_domains.txt') def reduce_domains(file_name): with io.open(file_name, 'r', encoding='utf8') as file: count = 0 previous_domain='' for domain in file: ...
true
81b833fd1fa2c3411a3fe11a9532c901b40dc132
fjros/ebury
/api/api/adapter/rate/resource.py
UTF-8
867
2.65625
3
[]
no_license
from pydantic import BaseModel from pydantic import validator from api.adapter.common.resource import ToDictMixin from api.core.currency.model import Currency from api.core.rate.model import Rate class RateRequest(BaseModel): """API request model to query the rates for a given base ('sell') currency """ ...
true
dd70dca2b0c97705675a14ace92f875ecffeaf1e
pranshiyadav06/review-bias-normalization
/Scripts/data_clean.py
UTF-8
562
2.578125
3
[]
no_license
import sys import os import numpy as np def main(): #user_id, item_id, score data_file = sys.argv[1] clean_data_file = sys.argv[2] fp_read = open(data_file,"r") fp_write = open(clean_data_file,"w+") for line in fp_read: line = line.strip("\n") line = line.split(",") userId = line[2] productId = line[1] ...
true
d110a398b4bec118a0bb8480b8307c73b93e1ce3
MiqueiasMaia/Feedforward-neural-network
/XOR/xor.py
UTF-8
1,039
2.671875
3
[]
no_license
from pybrain.tools.shortcuts import buildNetwork from pybrain.datasets import SupervisedDataSet from pybrain.supervised.trainers import BackpropTrainer from pybrain.structure.modules import SoftmaxLayer from pybrain.structure.modules import SigmoidLayer # rede = buildNetwork(2, 3, 1, outclass = SoftmaxLayer, hiddencla...
true
880b302dd4987c7a648df4a4139946978c9a3ab3
doubrtom/project-euler-solutions
/problem10.py
UTF-8
287
3.453125
3
[ "MIT" ]
permissive
size = 2000001 prime_flags = [True] * size for i in range(2, size): if not prime_flags[i]: continue for j in range(2*i, size, i): prime_flags[j] = False sum_of_primes = sum(x for x in range(2, size) if prime_flags[x]) print("Sum is {}".format(sum_of_primes))
true
032f1ddf13f3848471a47203539d793b56b10fab
SamuelDeleglise/qunoise
/mc.py
UTF-8
6,198
2.609375
3
[]
no_license
from numpy import array, pi, sqrt, arange, \ exp, matrix, zeros, concatenate, linspace, diag from pylab import plot, legend from numpy.random import normal class MonteCarlo: def __init__(self,record_trajectory=True): self.shape_pdc = None self.shape_cool = None self.record_t...
true
66127f601b78d164b0b1f9b7ebb7e575e973b6ad
rdtsc/codeeval-solutions
/src/moderate/meet-comb-sort/solutions/python/solution.py
UTF-8
548
3.140625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import sys with open(sys.argv[1]) as file: for line in (line.rstrip() for line in file): values = list(map(int, line.split())) margin = len(values) result = 0 while True: traded = False margin = max(int(margin / 1.25), 1) for i in range(len(values) - margin...
true
20b4bb4d21f9560d594d3ffe7fae9f890b775197
PythonAberdeen/user_group
/2019/2019-12/level2/fragmad/ellwood_level2.py
UTF-8
1,018
4.21875
4
[ "Unlicense" ]
permissive
def count_words(input_string): result = {} string_list = input_string.split(" ") string_set = set(string_list) for word in string_set: result[word] = 0 for token in string_list: if word == token: result[word] = result[word] + 1 return result def insens...
true
73ca100ead2d050ddd0083c33f84a85a3d70d872
ahven/did
/did/interval.py
UTF-8
3,232
3.046875
3
[]
no_license
# -*- coding: utf-8 -*- """ Copyright (C) 2012-2020 Michał Czuczman This file is part of Did. Did is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later ve...
true
50422289c50503cc0a306ad18223af2fe650a13c
freekang/DIVINE
/GAIL-DeepPath/scripts/generator.py
UTF-8
2,055
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import division import tensorflow as tf import numpy as np import sys from networks import policy_nn from utils import * relation = sys.argv[1] class Generator(object): """docstring for Generator""" def __init__(self, learning_rate=0.001): self.initializer = ...
true
0e8c531ea049cb56282805adc6be11a66a5fab53
srimathiselvakumaran/contd..py
/s1nextno.py
UTF-8
34
2.640625
3
[]
no_license
nn=int(input()) nn=nn+1 print(nn)
true
3f001cc2948472bab0f3a696624bcdd4f9e42133
xiaoloinzi/pycharm_02
/20190422/make_sheet_file.py
UTF-8
956
3.203125
3
[]
no_license
# encoding=utf-8 from openpyxl import Workbook wb = Workbook() ws = wb.create_sheet("Mysheet1") ws1 = wb.create_sheet("Mysheet")#创建一个sheet ws1.title = "New Title"#设定一个sheet的名字 ws2 = wb.create_sheet("Mysheet",0)#设定sheet的插入位置 ws2.title = u"光荣之路自动化测试培训"#设定一个sheet的名字 ws1.sheet_properties.tabColor = "1072BA"#设定sheet标签的背...
true
e4b1b9b1a389c287afbfe10041cafc4e7ef15658
abdelrahmanzied/elbow-and-kmeans
/elbow-and-kmeans/elbow-and-kmeans.py
UTF-8
1,060
3.21875
3
[]
no_license
import numpy as np import pandas as pd from sklearn.cluster import KMeans import matplotlib.pyplot as plt #Data X = np.array(pd.read_csv('data.csv')) print(X.shape) #Elbow ls = [] n = 8 for i in range(1, n): k_means = KMeans(n_clusters=i, init='random') k_means.fit(X) ls.append(k_means.inertia_) plt...
true
0aedd6accfe7cb0c946e1fa85c14b4f3f8bb5606
ptiengou/Zenon-internship
/sls_model.py
UTF-8
5,522
3.1875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt """ Functions to model the SLS rocket Used to determine the ratio between what mass can be brought to a Moon/Mars orbit and what mass can be brought to the surface of the Moon/Mars, using the same rocket """ ## constant ## g0 = 9.81 ## functions ## def one_stage_cal...
true
b913fe0b182b758217845cbcc0152fc12a514ba3
lythm/orb3d
/labs/python/py001/framework/event_hub.py
UTF-8
570
2.625
3
[]
no_license
class Event: _eid = 0; def GetID(): return _eid; class EventHub: _handler_map = {}; def __init__(self): pass def Dispatch(self, events): for e in events: if e._eid in self._handler_map: for handler in self._handler_map[e._eid]: handler(e); def RegisterEvent(self, eid, hand...
true
2aee2c597973bf9d77fa46503011c5440fa60d7b
michaelJwilson/LBGCMB
/dropouts/ext_laws/ext_laws.py
UTF-8
7,520
2.640625
3
[]
no_license
import extinction import numpy as np from scipy.interpolate import interp1d def calzetti(ils, Fi, Ap=0.1, Rp=4.05, name = 'NGC6090'): """ Intrinsic shape of the stellar emission, F_i(lambda), is recovered using the starburst reddening curve: k'(lambda) = A'(lambda) / E_s(B-V) with F_i(l...
true
58cc5a8255136e85fa37fe8a1219500370c563e6
MRCIEU/godmc-api
/app/functions.py
UTF-8
9,465
2.6875
3
[]
no_license
import json import PySQLPool import itertools def merge_lists(l1, l2, key): merged = {} for item in l1+l2: if item[key] in merged: merged[item[key]].update(item) else: merged[item[key]] = item return [val for (_, val) in merged.items()] def get_connection(fn): with open(fn) as f: db_config = json.loa...
true
ff5edfc02981aa7a80d6149a0caf9787e25c988f
karimbahgat/PyCRS
/testbatch.py
UTF-8
11,635
2.515625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import pycrs import traceback import logging ########################### # Drawing routine for testing raw = None def render_world(crs, savename): import urllib2 import json import pygeoj import pyagg import pyproj import random # load world borders global raw if not raw: ...
true
d7e2fd982f7f760e2cdf1eef151d75f1d349c816
AnzorHapcev/weather_neew
/weather.py
UTF-8
985
3.171875
3
[]
no_license
import requests import pprint import datetime city = input('Введите город ', ) app_id = '7732bdde0a28cc9ee8dbaf3488444130' responce = requests.get(f'http://api.openweathermap.org/data/2.5/forecast?q={city}&appid={app_id}') responce = responce.json() responce_city = responce['city'] responce_list = responce['list'] ...
true
fedb10d1dce2c2decb39672045b2569ea3ecb482
sharksmhi/sharkpylib
/sharkpylib/eea/mapping.py
UTF-8
5,127
2.71875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import os try: import pandas as pd except: pass class Codelist(): """ Created 20181010 Hold information in EEA codelist document. https://www.eea.europa.eu/data-and-maps/data/waterbase-transitional-coastal-and-marine-waters-9#tab-additional-information """ def ...
true
4f69c7bf05913db4ed43493e0007c2eaa4f18377
passcert-project/dummy-server
/generate_sites_policies.py
UTF-8
2,972
2.953125
3
[]
no_license
#!/usr/bin/env python3 import sys from bs4 import BeautifulSoup as bs from colorama import Fore, Back, Style if len(sys.argv) == 2 and sys.argv[1] == 'help': print(Fore.LIGHTCYAN_EX + "Usage:\npython generate_sites_policies.py arg1 arg2\n\n - arg1: the type of policies you want in the website.\n - arg2: the tit...
true
2f9cc5df232606f1c09b6caba3f023379a326705
Celedence/class
/higher_order.py
UTF-8
765
4.15625
4
[]
no_license
def sum(n, func): total = 0 for num in range(1, n+1): total += func(num) return total def square(x): return x*x def cube(x): return x*x*x print(sum(3,cube)) print(sum(3,square)) # cubing 3 cubing 2 cubing 1 and adding them together #nested function from random import choice def greet(p...
true
264ea00bdd4b1b21466858c503e1893ba01f7202
cmembreno/CrackingCoding
/1.5.py
UTF-8
926
3.453125
3
[]
no_license
def arrayMethod(array1, array2): if(abs(len(array1)-len(array2)>1)): print("False") word = {} result = 0 j = 0 if(len(array1)>len(array2)): for i in range(0,len(array1)): if(array1[i]==array2[j]): j+=1 continue else: ...
true
902d63db3a29189d3163d7454dbed54c6782fff8
v2thegreat/Greatest-Common-Divisor
/GCD.py
UTF-8
195
3.546875
4
[ "MIT" ]
permissive
def gcd(a,b): a1 = a if a > b else b b1 = b if a > b else a r = -1 while r != 0 : r = a1%b1 a1 = b1 b1=r return a1 if __name__ =='__main__': print(gcd(74381920,3421))
true
af3d8a67dd3940e3bf0d65d3ca9c6b71e913d167
gkp0106/learn-python
/作业/2-1.py
UTF-8
165
3.65625
4
[]
no_license
m = eval(input("输入第一个整数:")) n = eval(input("输入第二个整数:")) s = m + n avg = (m+n) / 2 print("和为:",s) print("平均值为:",avg)
true
44da079f117614dad6f8155f42b7beceaae2b978
intelligentCoding/100daysofcodechallengeDAY1
/main.py
UTF-8
2,557
3.515625
4
[]
no_license
MENU = { "espresso": { "ingredients": { "water": 50, "coffee": 18, }, "cost": 1.5, }, "latte": { "ingredients": { "water": 200, "milk": 150, "coffee": 24, }, "cost": 2.5, }, "cappuccino": { ...
true
ebc44bf124bf76f8c8288c7e60e71f9d9d9fedd7
qlyoung/pyjsonata
/pyjsonata/tests/test_pyjsonata.py
UTF-8
2,602
2.75
3
[ "MIT" ]
permissive
import os import json import types import time import pytest from ..pyjsonata import jsonata, PyjsonataError PATH_DATATREES = os.path.join(os.path.dirname(__file__), "inputs") @pytest.fixture(scope="module") def config_pairs(): """ Generate list of 2-lists. Each inner list has the format [ "{ ....
true
3549d8d4aa755bff7bfea53104296d6c03613ad0
abiogenic/dexter
/Dexter 1.0/Dexter.py
UTF-8
4,596
3.3125
3
[]
no_license
import sys import findPokemon print("") print("") print("") print("******************************************************************") print("*** Hello! I'm Dexter! I can answer your Pokémon questions! ***") print("") print(" ") print(" /EEEEEEEEEEEE...
true
40f98eefbca8aa21713ed1bacb9d31dcac823ff6
rbitshift/pyEuler
/src/pr_67.py
UTF-8
1,905
3.75
4
[]
no_license
''' By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 4 2 4 6 8 5 9 3 That is, 3 + 7 + 4 + 9 = 23. Find the maximum total from top to bottom in triangle.txt (right click and 'Save Link/Target As...'), a 15K text file containi...
true
fcb343995b9d784578dd207a89268abf5d17a62f
erikfilias/ac-opf-bounds
/compute-bounds.py
UTF-8
14,928
2.59375
3
[ "MIT" ]
permissive
#!/usr/bin/python import sys import argparse try: from gurobipy import * except ImportError: raise Exception('gurobipy not found.\nthis code requires gurobi to be installed in python') from parse_matpower import * from qc_lib import * import time import sys import pandas as pd version = '1.0.0' def build_p...
true
ae3fc3d3c6724a535d01c1d173f7db46d9a60542
vvalotto/Patrones_Disenio_Python
/principios_SOLID/SPR/Ejemplo 1 - SPR/calculador_deduccion.py
UTF-8
1,632
3.3125
3
[]
no_license
''' Created on 04/01/2014 @author: vvalotto ''' from abc import ABCMeta, abstractmethod class ACalculadorDeduccion(object): ''' Clase Abstracta que especifica el calculador de deducciones ''' @abstractmethod def calcular(self, factura): pass class CalculadorDeduccion(AC...
true
067b8c567a1a67ffc934e1f211f68dc54a5faeac
baizoukou/my-python-lab
/my-python-lab/applistfunction.py
UTF-8
1,172
3.8125
4
[ "MIT" ]
permissive
lucky_numbers = [2, 4, 8, 1, 7, 15, 27, 25, 10] friends = ["yacubu", "rolan", "anatol", "patrick", "jony", "bel"] friends.extend(lucky_numbers)## take friend and value of lucky num in it print(friends) friends.append("toby") friends.insert(1, "rolax")## add value at index value and all other value get push back p...
true
0f153b2cf099531f34c42d7e98907527f2b55b63
priyankaauti123/Python
/string/compare_2_str.py
UTF-8
123
3.890625
4
[]
no_license
str1=input("Enter string:=") str2=input("Enter 2nd string:=") if str1==str2: print "equal" else: print "not equal"
true
069d7349ed5db0c332acec2edca8b1d9fd0f7c37
NicolasBelissent/HillCipher
/test/test3.py
UTF-8
216
3.0625
3
[]
no_license
from src.HillCipher import HillCipher x = input('What do you want to encode ? '); cipher = HillCipher() encoded = cipher.encode(x) print("Encoded word : ", encoded) print("Decoded word :", cipher.decode(encoded))
true
f536ce28d61b3c69976f1150d2e9804b71123039
keysafe-cloud/KSC-Tools
/scripts/decode-ble-lock-status.py
UTF-8
5,394
2.921875
3
[ "MIT" ]
permissive
#!/usr/bin/env python # coding=utf-8 """ Copyright 2019-2020 (c) KeySafe-Cloud, all rights reserved. Script to decode KeySafe-Cloud (KSC) compatible lock status values as obtained from the Bluetooth Low Energy (BLE) interface using the Status Characteristic of the Lock Service. Depending on the lock model, the BLE lo...
true
9b7acf13aeda53499d724793d12c9576711e374e
flipthedog/FaceDraw
/Archive/Moving_old.py
UTF-8
10,289
3.640625
4
[]
no_license
# Moving.py # Purpose: Slice the loaded image into G-code commands # Import import math from ImageProcessing import process_image import numpy as np import _datetime import cv2 as cv class Moving: def __init__(self, image, bed_size, line_width = 1.0, lock_ratio = True): """ Initialize the object...
true
4685922a7085514a4008c7db8ba8d068dcf321dc
brendonwelsh/SimpleGame
/src/coin.py
UTF-8
312
3.25
3
[]
no_license
class Coin: def __init__(self, x, y, sprites): self.x = x self.y = y self.sprite_number = 0 self.sprites = sprites def update_sprite_status(self): if self.sprite_number == 5: self.sprite_number = 0 else: self.sprite_number += 1
true
263415eca498ff12e369ae6ff570c299096c708b
camirmas/ctci-python
/tests/test_one_away.py
UTF-8
989
2.765625
3
[]
no_license
import unittest from src.ch1.one_away import one_away class OneAwayTestCase(unittest.TestCase): def test_one_away(self): self.assertTrue(one_away("pale", "ple")) self.assertTrue(one_away("ple", "pale")) self.assertTrue(one_away("pales", "pale")) self.assertTrue(one_away("pale", "...
true
3f2ee2d59e7d6f2466567456566c5a6b0401f8e6
JaunIgciona/DataBootcamp_Nov2020
/2_Ejercicios/Primera_parte/Entregables/1. Ejercicios_python_precurso/deck.py
UTF-8
562
4.59375
5
[ "Apache-2.0" ]
permissive
#Make a program using while that generates a deck of cards of 4 different suits. The deck must have 40 cards. import random suits = ["clubs", "diamonds", "hearts", "spades"] new_deck = [] while len(new_deck) < 40: random_pick = random.choice(suits) repeats = 0 for elem in new_deck: if random_pic...
true
4eae29ea5acc71d2f010f819a2ec2ecc51318b8d
Hubert-Guzowski/MachineLearning_ImageRetrieval
/lab7/custom_layers.py
UTF-8
2,228
3.40625
3
[]
no_license
import numpy as np from keras import backend as K from keras.layers import Input from keras.layers import Layer from keras.models import Model ''' -build(input_shape) -call(input) -compute_output_shape(input_shape) The build method is called when the model containing the layer is built. This is where you set up the ...
true
2305e5adbe5cf8eb7b0204b47a66f523b8ba1a03
bryanlimy/calculate-time-on-mars
/frac_time_to_min.py
UTF-8
373
3.875
4
[]
no_license
def frac_time_to_min(t): '''(float) -> int Given a positive fractional time in hours, returns the minutes as an integer.''' if t >=0 and t <=24: frac_time_to_min = ((t - (t // 1)) *60)//1 return frac_time_to_min elif t > 24: frac_time_to_min = ((t - (t//24)*24) *60)//1 r...
true
0cac63b6c9de7d44864619db2a280d5a09b25c64
moonmedtwo/excellogger
/comm.py
UTF-8
797
2.75
3
[]
no_license
import serial.tools.list_ports import time, threading, datetime CONNECTED = False PORT_CHECKING_INTERVAL = 0.5 import datetime, threading, time def checkingPortThread(): global CONNECTED, PORT_CHECKING_INTERVAL next_call = time.time() while CONNECTED == False: ports = list(serial.tools.list_por...
true
2d48247b6dbd923bf897692f55e47cfb38520090
Aasthaengg/IBMdataset
/Python_codes/p03853/s994858052.py
UTF-8
170
2.953125
3
[]
no_license
# -*- coding: utf-8 -*- h, w = map(int, input().split()) rct = [] for x in range(h): pix = str(input()) rct.append(pix) for x in rct: print(x) print(x)
true
7c276d8f52cec2c3b2531015c525530b46338387
Zzpecter/Coursera_AlgorithmicToolbox
/week2/5_fibonacci_number_again.py
UTF-8
757
3.78125
4
[]
no_license
# Created by: René Vilar S. # Algorithmic Toolbox - Coursera 2021 def get_fibonacci_modulo_rene(n, m): pisano_period = get_pisano_period(m) remainder_n = n % pisano_period if remainder_n == 0: return 0 previous, current = 0, 1 for _ in range(remainder_n - 1): previous, current = ...
true
f03faaa6557460c17d88fe10ec9f67f7ecf30a20
tanvircs/Protein_Protein_Data_Analysis_Networkx
/src/Eigen_Vector_Centrality_Histogram.py
UTF-8
481
2.84375
3
[]
no_license
import networkx as nx import matplotlib.pyplot as plt plt.switch_backend('agg') import numpy as np import os file = os.path.join("Eigen_Vector_Centrality_Output.txt") eigen_list=[] with open(file) as p: next(p) for line in p: s=line.split() eigen_list.append(float(s[1])) fig, ax = plt.subplo...
true
36ec5f3cef3a84e238baa6c2a7880b1738983daa
paulni123/CryptoBot
/Training4.py
UTF-8
2,872
2.703125
3
[]
no_license
import numpy import matplotlib.pyplot as plt import pandas as pd import math from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from sklearn.preprocessing import MinMaxScaler from sklearn.metrics import mean_squared_error import json from CoinbaseClient import CoinbaseClien...
true
0e26c64694f0f72aefcfe61b77417226be60157a
kshitijashelar/TextAnalytics
/word cloud/pra4.py
UTF-8
3,511
2.890625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Oct 25 09:14:54 2020 @author: kshit """ from nltk.tokenize import TweetTokenizer from nltk.corpus import stopwords doc=["Climate change is extreme crisis today with drastic change in climate","The extreme impact of climate change have been detected on the globe the years","...
true
f498cf27ab4a83dc34071f16f84cdb8d809dbdf5
jabuddie/CSI-445_Stock_Watcher
/src/stockwatch.py
UTF-8
6,413
3.046875
3
[]
no_license
__author__ = "Justine" #program to extract tweets for each dow jones company #saves all data into files labelled by company in a folder for the date run #with a scheduler and timer to run 4 times a day starting at 5PM import time, datetime, os import twitter, sys, json from os.path import join as j from apscheduler.s...
true
2ec5f5b7c6280d4a0d73df4a5ad7340bbeaf5a0f
vvspearlvvs/CodingTest
/4.기출문제/카카오/문자열압축/kakao.py
UTF-8
1,713
3.203125
3
[]
no_license
def solution(S): print("input:{}".format(S)) answer = 0 length=[] #n개단위로 짜른 문자열 : n은 len(st//2)까지 #2부터 하면 안됌. 예외:aabbaccc for n in range(1,len(S)//2+1): print() print("{}개단위로 짜르기".format(n)) #짜른단위만큼 같은 문자가 몇개 있는지(count X) count=1 result='' tmpstr=...
true
a8ea71ec05ef3db3e7839462ef1c2cd0e03eeafc
MrCredulous/18797TeamProject
/demo/resnet_v2_gen.py
UTF-8
5,248
2.53125
3
[ "MIT" ]
permissive
from random import shuffle import os import sys import mxnet as mx from mxnet import autograd, ndarray as nd import numpy as np import matplotlib.pyplot as plt from time import time def patch_path(path): return os.path.join(os.path.dirname(__file__), path) def classifier_loss(X, classifier): # Get label for...
true
bbd22118ecfc1f8113f0bb8c4e2859ba787b09eb
Yaakoubi/TSP
/main.py
UTF-8
3,060
2.75
3
[]
no_license
from read_stsp import read_edges from read_stsp import read_header from read_stsp import read_nodes from graph import Graph from cycle import Cycle from random import randint if __name__ == "__main__": import sys finstance = sys.argv[1] G = Graph() with open(finstance, "r") as fd: header = rea...
true
632feba42d52bfa743ba56e2076e020194e66a1e
jezzicrux/Python-Alumni-Course
/Excercises/New_HW4.py
UTF-8
2,852
4.5625
5
[]
no_license
def main(): numb_pick() print("") byte_size() #This function is to ask the user to enter their number to see if its a prime number def numb_pick(): print ("Enter any number to see if it's a Prime number.") a = int(input(">>")) prime_num(a) #This function is to see if the users number is a prim...
true
09d7d30220ecbd6bf380e011da93fb949180afb7
jssong1592/python_practices
/algorithm_practices/unsorted_practices/baek_4948.py
UTF-8
263
3.046875
3
[]
no_license
import sys N = 123456 * 2 che = [0,0] + [1] * (N-1) for i in range(2,int(N**0.5)+1): j = 2 while i * j <= N: che[i*j] = 0 j += 1 for num in sys.stdin: if int(num) == 0: continue print(sum(che[int(num)+1:int(num)*2 + 1]))
true
680a01f7811f1e458f0ce3fa73f7c28fdded6f78
coding-Benny/algorithm-interview
/Programmers/Level1/add-positive-and-negative-numbers.py
UTF-8
374
3.125
3
[]
no_license
def solution(absolutes: list, signs: list) -> int: total = 0 for i, number in enumerate(absolutes): if not signs[i]: absolutes[i] *= -1 total += absolutes[i] return total if __name__ == '__main__': res = solution([4, 7, 12], [True, False, True]) print(res) res = sol...
true
55d96dda7a212ebcc50d67204eff9afe34c43d5e
chan-gil/DD
/gc2.py
UTF-8
436
2.546875
3
[]
no_license
# import folium lat_long = [49.2856399, -123.1201878] # map2 = folium.Map(location = lat_long, zoom_start=13) # map2.Marker(location = lat_long, radius=500, popup='downtown', line_color='#3186cc', fill_color='#3186cc') # # map2.create_map(path='downtown.html') import folium map_osm=folium.Map(lat_long, zoom_start...
true
96d8cd3773c4fa61b1b0a43fd95b458f9a8fedd6
wechuli/python
/refresher/functions/kwargs2.py
UTF-8
391
3.453125
3
[]
no_license
def combine_words(word, **kwargs): if 'prefix' in kwargs.keys(): prefix = kwargs['prefix'] return f'{prefix}{word}' elif 'suffix' in kwargs.keys(): suffix = kwargs['suffix'] return f'{word}{suffix}' else: return word print(combine_words('child')) print(combine_wor...
true
9f95eac544de792a49c1c5ed496a43f0e6fc75c5
Datacraft-GaaS/iso-8583
/Pyso8583/utils.py
UTF-8
946
3.046875
3
[]
no_license
# encoding: utf-8 def print_iso(str_obs, value): print("{}\n\t{}".format(str_obs,value)) def print_json(str_obs, value): print("\t{{ \'{}\':{} }}".format(str_obs,value)) def get_hex(obj): #in case of list if "list" in str(type(obj)): l_obj = [] for x in range(0,len(obj)): l...
true
5f0fa7dc08844571ea4809cbc49601d59c99c121
jmayfield74/nextiva_foo
/nextiva_foo/utils/spirals.py
UTF-8
1,468
3.9375
4
[]
no_license
""" Spiral sort functions """ # API ========================================================================= def sort(matrix=[]): """ Return spiral sorted items from a matrix. >>> sort([ ... ["a", "b", "c", "d", "e"], ... ["f", "g", "h", "i", "j"], ... ["k", "l", "m", "n", "o"],...
true
82875748d01aa9a52eaca9e86a9a6e4bb98951f6
wafindotca/pythonToys
/leetcode/maxPointsOnALine.py
UTF-8
1,424
3.984375
4
[]
no_license
# https://leetcode.com/problems/max-points-on-a-line/ # Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. # Idea: generate all possible lines between all possible points. See if any other points exist on the same line. # Problem: the complexity of this is shit. Becaus...
true
8e64bcf1c435a6d4c9c91a59ccd8f25c2314e1c5
kypopthuk1996/python_learning
/Type/Task/task_4_5.py
UTF-8
573
3.015625
3
[]
no_license
# -*- coding: utf-8 -*- #Из строк command1 и command2 получить список VLANов, которые есть и в команде command1 и в команде command2. #Результатом должен быть список: ['1', '3', '8'] command1 = 'switchport trunk allowed vlan 1,2,3,5,8' command2 = 'switchport trunk allowed vlan 1,3,8,9' command1 = command1.split( ) c...
true
de0ce64a24b8c8c79648396e7cbd461f8d2b23a8
SyntaxError2013/The-CodeMarines
/elections/electionsguess/database.py
UTF-8
509
2.796875
3
[]
no_license
from bs4 import BeautifulSoup from urllib import urlopen page=urlopen("http://electionaffairs.com/states/himachal.html").read() soup=BeautifulSoup(page) india=[] for items in soup.findAll("table",attrs={'cellpadding':"4","cellspacing":"4"}): for data in items.findAll("tr"): for consti in data.findAll("td"):...
true
d2684c64a3cfd7a75d009f910185913448be3676
SaratogaMSET/Nigiri2019
/webdashboard/wd_ds/venv/lib/python2.7/site-packages/ntcore/support/compat.py
UTF-8
2,581
2.78125
3
[]
no_license
# notrack import os import sys try: from configparser import RawConfigParser, NoSectionError except ImportError: from ConfigParser import RawConfigParser, NoSectionError try: from time import monotonic except ImportError: from monotonic import monotonic if sys.version_info[0] <= 2: range = xrang...
true
2296c54b5fdd2b77462a946089031a86eb9dfd41
pzy636588/wodedaima
/计算序列的长度,最大值和最小值.py
UTF-8
372
3.640625
4
[]
no_license
num=[45,5,2,54,21,1,12,1,45454,454,454,545,6,] print("序列长度:",len(num)) print("序列是最大值",max(num)) print("序列最小值:",min(num)) print("序列的和:",sum(num)) print("排序:",sorted(num)) print(45 not in num) #检查元素是不是序列的成员 print(6 in num) import datetime day=datetime.datetime.now() print(day)
true
ff429ada4954957487d4feb9ce46171c69c21592
Kay-Towner/homework
/collatz_skeleton.py
UTF-8
1,560
3.890625
4
[]
no_license
import numpy as np def number_of_steps_to_one(number): """Function which determines how many steps it takes for a number to reach 1 in the Collatz sequence input: number (a positive integer) output: steps """ if not isinstance(number, int): raise ValueError("number must be integer"...
true
f43e4c7228c23d9e24ff2d007cf4f1cdc47e9318
themagicbean/Machine-Learning-Course-1
/2 Regression/E Decision Tree/my_decision_tree_regression.py
UTF-8
1,705
3.609375
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jun 20 23:40:45 2018 @author: USER """ # L 69 DECISION TREE # L70 #copypasta from template # Regression Template # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read...
true
37e78617fb44863a9f51f94d084c87a1d3fead8f
Hugens25/School-Projects
/Python/tryexcept1.py
UTF-8
165
3.453125
3
[]
no_license
for i in ['a','b','c','d']: try: print (i**2) except TypeError: print("Invalid Type") except: print("Something went wrong")
true
a9217536ff7e27c7e16a86bc46c3fb39aa29eea3
xuanphuc97/SmartSystem-PBL4
/Server/api.py
UTF-8
4,128
3
3
[]
no_license
import face_recognition as fr import numpy as np import cv2 def face_alignment(img, scale=0.9, face_size=(400,400)): ''' API căn chỉnh khuôn mặt cho một hình ảnh, lấy điểm mốc của mắt và mũi sau đó thực hiện chuyển đổi param face_img: một hình ảnh bao gồm cả khuôn mặt param scale: hệ số tỷ lệ để đánh g...
true
018beec2bce448760ced74b6538ca13e342d38f6
HE-Arc/Extrusion---web-interface
/api/package/sequence/queue_manager.py
UTF-8
2,519
3.265625
3
[]
no_license
import queue class QueueManger: """Class to manage a thread-safe queue """ def __init__(self, size): """Constructor of QueueManage The Queue is a deque :param size: size of queue """ self.size = size self.process_pool = queue.Queue(size) self.cur...
true
7973ad3cd9bbaae477ad0d74907b4cd6901df7c6
MisterMeeseek/music-recommendation-challenge
/EDA Notepad.txt
UTF-8
1,626
3.09375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Feb 10 11:56:42 2019 @author: Joel """ ### Using this as a note taking pad ### Men seem to be slightly more likely to repeat plays, but the numbers don't support a significant difference between genders. My library is definitely the preferred area fo...
true
6a131ac1d75f1a5a8a7e3e72be45d25f2fd70183
cpp-css/backEndFall2020
/backend/api/admin.py
UTF-8
3,971
2.546875
3
[]
no_license
from api.helpers import requires_auth from config import app, db from database.organization import Organization from database.role import Role, Roles from database.user import User, UserSchema from database.session import Session from flask import jsonify, request from sqlalchemy import or_ @app.route('/organization/...
true
656f9bb4435d094483579dc9fd67b97bc4920ad7
bruceyoungsysu/AI_TTT
/project01.1/board.py
UTF-8
4,499
3.21875
3
[]
no_license
import copy def copy_dict(src): # cpoy from a src dict to a dst dict dst = {} for k in src.keys(): dst[k] = src[k][:] return dst def copy_state(state): # copy a source state to a dst dict dst = [] for line in state: c = [] for col in line: c.append(copy_dict(c...
true
ba3667c9a4531969116206143130d58c5e5f4c97
Aasthaengg/IBMdataset
/Python_codes/p02382/s831330311.py
UTF-8
311
3.03125
3
[]
no_license
def dist(X, Y, p): res = 0 for x, y in zip(X, Y): res += abs(x - y) ** p return res ** (1.0 / p) n = int(raw_input()) X = map(int, raw_input().split()) Y = map(int, raw_input().split()) for i in [1, 2, 3]: print dist(X, Y, i) print max(map(lambda xy: abs(xy[0] - xy[1]), zip(X, Y)))
true
6da121bf1d3c52328bea889ce188e3187d82ab3f
skipperBSAS/toyMontecarlo
/grilla/loop_MC_grilla.py
UTF-8
543
2.609375
3
[]
no_license
# Este codigo corre toyMC para diferentes parametros de entrada # R es una etiqueta para el numero de run pero no juega ningun rol dentro de toyMC import os,sys command = "" for N in range(200,201): for iDC in range(0,1): DC=iDC for A in [240,270]: for B in [11, 110]: # This number will be divided by 10.000 ...
true
d7fa2a83a66eef24a01efc39aabb669746ac2e99
vickyg3/coursera
/algo2/week2/q1.py
UTF-8
3,001
3.765625
4
[]
no_license
#! /usr/bin/python # In this programming problem and the next you'll code up the clustering # algorithm from lecture for computing a max-spacing k-clustering. Download the # text file here. This file describes a distance function (equivalently, a # complete graph with edge costs). It has the following format: # [numbe...
true
6693884a654bb693e2ad894cf60260eb6d012c55
JoseYoung/PyQt5
/student management.py
UTF-8
2,089
2.640625
3
[]
no_license
from PySide2.QtWidgets import QApplication, QMainWindow, QPushButton, QPlainTextEdit, QLabel,QMessageBox import os, sys import PySide2 import Login_UI dirname = os.path.dirname(PySide2.__file__) plugin_path = os.path.join(dirname, 'plugins', 'platforms') os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path print(...
true
d4cad5f997b02655c22fafb6011f02683bc8acf6
Hquanquan/AutomationTestProject
/课程代码/day3/pylib/utlis/configer.py
UTF-8
1,040
2.796875
3
[]
no_license
''' @author: haiwen @date: 2020/11/22 @file: configer.py ''' import yaml def read_yml(path): with open(path,encoding='utf8') as f: content=f.read() return yaml.safe_load(content) class DemoApi(): def __init__(self): res=read_yml('../../conf/api_conf.yml') #获取当前类的class——name ...
true
ec6102105c87eb3de629dd8383e0aa208efe39fe
ogeronimo/finance
/application.py
UTF-8
12,978
2.6875
3
[]
no_license
import os import re # Python 3.x code # Imports import tkinter from tkinter import messagebox from cs50 import SQL from flask import Flask, flash, jsonify, redirect, render_template, request, session from flask_session import Session from tempfile import mkdtemp from werkzeug.exceptions import default_exceptions, HTTP...
true
2a2aa27335d2b8ec837404659143b42aee062e27
yuanxialee/GoPiGoTeam10
/lab3/intersect.py
UTF-8
1,025
2.78125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from graph import edge, graph, vertex if __name__ == '__main__': p1 = np.array([0,0]) p2 = np.array([2,4]) p3 = np.array([3,3]) p4 = np.array([2,0]) #p1 = np.array([0,0]) #p2 = np.array([1,1]) #p3 = np.array([2,3]) #p4 = np.array([2,0])...
true
7cd22b6823dcf2a580f5e56ce92d2dc8109be462
mmohan01/Scripts
/Fretboard Memorisation/random_guitar_note.py
UTF-8
1,880
3.59375
4
[]
no_license
"""Script to randomly generate and print a note in the chromatic scale and string on the guitar.""" import msvcrt import random import signal import sys import time notes = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"] strings = ["low E", "A", "D", "G", "B", "high E"] def exit_program(...
true
1cc05af78081418dd89a5ba5fc7f2bd9e4ae39ca
GeorgeII/news-and-articles
/telegram/request.py
UTF-8
541
2.5625
3
[]
no_license
import requests import json from model.article import Article def send_message(model: Article): with open("resources/telegram-config.json") as f: telegram_conf = json.load(f) bot_token = telegram_conf["bot-token"] chat_id = telegram_conf["chat-id"] url = "https://api.telegram.org/bot" + bot...
true
d1bb02d328d24969c03a3dae9c94b23ae5e79bd8
EdgarPozas/DataStructures
/List.py
UTF-8
3,904
3.46875
3
[]
no_license
class SimpleList: def __init__(self): self.head=None self.size=0 def add(self,position,value): node=SimpleNodeList(value) if not node: return -1 if not self.head: self.head=node else: if position==0: nodePrev=se...
true
14945fe74c2c6615bee1b86d5e1742760b78b54d
sakethreddy997/PythonPractice
/Pattern.py
UTF-8
386
4.03125
4
[]
no_license
print("Number Pattern ") # Decide the row count. (above pattern contains 5 rows) row = int(input("Please provide the number")) # start: 1 # stop: row+1 (range never include stop number in result) # step: 1 # run loop 5 times for i in range(1, row + 1): # Run inner loop i+1 times for j in range(1, i + 1): ...
true
88d02b6e35b4e95644d9239be9f660b8d7e40cb0
wjddn279/Algorithms
/Programmers/방문 길이.py
UTF-8
856
3.125
3
[]
no_license
def prin(a): for i in a: print(i) print() def solution(dirs): def iswall(x,y): if x < -5 or y < -5: return False elif x > 5 or y > 5: return False else: return True def rev(dir): if dir == 0: return 1 if dir == 1: return 0 if dir == 2: return 3 ...
true
2e547c81d61d134e9fb425c2300a5180e9790608
vikingen13/VOD-Image-Resize-CloudFront
/ReferenceImage/ReferenceImage.py
UTF-8
1,143
2.65625
3
[]
no_license
import json import os import boto3 from botocore.exceptions import ClientError import logging logger = logging.getLogger() logger.setLevel(logging.INFO) def lambda_handler(event, context): """If this lambda is executed, it means that the resized image has been stored in the website bucket """ try: #he...
true
f3b1c3d0f5ee8370adfba86795aca66ebe80161d
provoke-vagueness/prefixtree
/tests/test_prefixset.py
UTF-8
4,050
2.671875
3
[ "Apache-2.0" ]
permissive
import itertools import operator import pickle import string try: # python 2.x import unittest2 as unittest except ImportError: # python 3.x import unittest try: # python 2.x from itertools import ifilterfalse as filterfalse except ImportError: # python 3.x from itertools import filter...
true
bb53c0bef5e869ee6b479d8572a119966b1599e9
sambhu-padhan/My_Python_Practice
/50_Else_Finally_in_try_except.py
UTF-8
327
3.078125
3
[]
no_license
#...Else_Finally_in_try_except....... f = open("sambhu.txt") try: f1 = open("song.mp3") except Exception as e : print(e) # [Errno 2] No such file or directory: 'dd.txt' else: print("Exception is not here.") finally: print("this will be run anyway...") f.close() f1.cl...
true
ac032289b7406c22a6e00bed0cd14cd3d9088a37
dmtrbrlkv/SecretInstaSpaceBot
/main.py
UTF-8
829
2.65625
3
[]
no_license
import telebot import os import logging logging.basicConfig(level=logging.INFO, format='[%(asctime)s] %(levelname).1s %(message)s', datefmt='%Y.%m.%d %H:%M:%S') logging.info(f"Start") bot = telebot.TeleBot(os.environ.get("TG_TOKEN")) line = "\n\n" secret_space = "\n⠀\n" @bot.message_handler(commands=['start']) def...
true
e8080fc7dd254fac9903f4d76ff99dfd592a5eb5
angkasatech/prep.proj2
/geometry/segitiga.py
UTF-8
167
2.6875
3
[]
no_license
def hitung_luas_segitiga(alas, tinggi): luas_segitiga = alas * tinggi / 2 return luas_segitiga def infosegitiga(): return 'Modul menghitung luas segitiga'
true
03f3e7c6821a1fc7ea6fc35ec8548caab81a244d
harishravi121/Pythoncodes
/Polyvinylchloride.py
UTF-8
138
2.71875
3
[]
no_license
import random a=random.randint(5,30) C=2+a H=6+3*a Cl=a HC='C'+str(C)+'H'+str(H)+'Cl_'+str(Cl) print('Poly vinyl chloride ', HC)
true
8675f99de881fc5f8f7592c8897d0c22b637f6f0
lxchavez/Yeezy-Taught-Me
/src/MSongsDB/Tasks_Demos/ArtistRecognition/process_train_set.py
UTF-8
14,164
2.578125
3
[ "GPL-1.0-or-later", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain", "CC-BY-NC-SA-2.0", "LicenseRef-scancode-proprietary-license", "MIT" ]
permissive
""" Thierry Bertin-Mahieux (2011) Columbia University tb2332@columbia.edu Code to parse the whole training set, get a summary of the features, and save them in a KNN-ready format. This is part of the Million Song Dataset project from LabROSA (Columbia University) and The Echo Nest. Copyright (c) 2011, Thierry Bertin...
true
cc43f95002d501aef68df8533c8f8293a8b43333
AnLi-Mi/Python_Studying_Projects
/trying_learning_exercises/anna_module testing.py
UTF-8
533
3.046875
3
[]
no_license
import anna_module print(dir(anna_module)) name = input(f"What's your name? ") anna_module.greeting(name) #importing specific pull for the game pull = anna_module.srp_pull #randomly selecting one item from the imported list guess = anna_module.random_selection(pull) #requesting input from the user choice = inpu...
true
ecc9c3fb184bc8c414fbeabd645c4f7d4e15b74c
rob-kn/ApplicationScraper
/get_app_ids.py
UTF-8
3,047
2.625
3
[]
no_license
from bs4 import BeautifulSoup from pprint import pprint from get_url import simple_get def get_app_categories(raw_html): categories = [] html = BeautifulSoup(raw_html, 'html.parser') for a in html.select('a'): # Ignore 'Games' and 'Family' section of dropdown # if a['href'].startswith("/st...
true