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 |
|---|---|---|---|---|---|---|---|---|---|---|
43732231efc380e60bb851779b58e5fa4e6bc214 | natTP/2110101-comp-prog | /05_List/0511-MissingDigits.py | UTF-8 | 176 | 3.484375 | 3 | [] | no_license | inp = input()
notin = ""
for i in range(10):
if str(i) not in inp:
notin += str(i) + ","
if len(notin) == 0:
print("None")
else:
print(notin[:-1])
| true |
6041351ed9ba64038a20bbf669d1e3ed71740025 | mcalmeida13/web-scraping | /web_scraping_ztm_course.py | UTF-8 | 1,033 | 3.5 | 4 | [] | no_license | import requests
from bs4 import BeautifulSoup
import pprint
print("Everything works!")
# Request the data
res = requests.get('https://news.ycombinator.com/news')
soup = BeautifulSoup(res.text,'html.parser')
links = soup.select('.storylink')
subtext = soup.select('.subtext')
def sort_stories_by_votes(hnlist):
... | true |
03d7d1951c900b4d4c91a7ab4f1bfa6c88e2c92a | yolotester/learngit | /HmVideoCode/hm_python_improve/Mysql/sql1.py | UTF-8 | 2,881 | 3.3125 | 3 | [] | no_license | from pymysql import *
class JD(object):
def __init__(self):
# 创建connect连接
self.conn = connect(host='localhost', port=3306, user='root', password='Zz114963', database='jing_dong',
charset='utf8')
# 创建游标对象
self.cursor = self.conn.cursor()
def __del__(self):... | true |
34602a6541ceaedb255ef26a67fdef25cc926ee0 | JosjaVanBever/AbinitTutorials | /Si/bulk/SCAN/Try1/results27286_strikt/PlotConvergence.py | UTF-8 | 1,768 | 3.03125 | 3 | [] | no_license | #!/bin/python
# Input:
# - The current directory contains directories with names key1_key2.
# Those are enlisted in stdin (ls -1 | script).
# - Names of parameters to plot as arguments
# Output:
# - A plot containing a 2D convergence plot for each parameter
import sys
import matplotlib.pyplot as plt
import subproce... | true |
2c6b6d4dba20077de1447fee27863984734a2083 | manuelpagan/assignment4 | /problem6.py | UTF-8 | 182 | 3.28125 | 3 | [] | no_license | # Manny Pagan
# Sept 24th Python Course
# Assignment 5
# Due: Oct 10th
breakfast = ['Cheerios', 'Lucky Charms', 'Corn Flakes']
for cereal in breakfast:
print(cereal + " are yummy!") | true |
194944d0004786ff9a5462ecdbc46b19dab16fa0 | wcsze/algorithm | /Assignment4_1809733.py | UTF-8 | 647 | 3.578125 | 4 | [] | no_license |
def condition(arr,key,i):
if(arr[i]==0 and (i+key+1)<len(arr) and arr[i+key+1]==0):
return True
def fill_arr(arr,key):
if(key==0):
for i in range(len(arr)):
print(arr[i], end=" ")
print("")
return True
for i in range(len(arr)):
if(conditio... | true |
8877d98ec82610be59b727517427cc479720d22e | danrol/HW1Python | /venv/Lib/site-packages/pylablib/core/utils/thread.py | UTF-8 | 4,245 | 3.265625 | 3 | [] | no_license | """
Simple threading routines.
A more extensive threading library is contained in the core.mthread package.
"""
import threading
try:
from Queue import Queue, Empty
except ImportError:
from queue import Queue, Empty
class PeriodicThread(object):
"""
A thread that runs in an infinite loop (until exte... | true |
b38ed0721ffa0e56d1d1f1122ddd0a6e9d46e547 | eggsys/python_log | /m1.py | UTF-8 | 907 | 3.25 | 3 | [] | no_license | class main_file(object) :
def __init__(self) -> None:
pass
print("init")
self.title = ("Rungkrit")
self.first(self.title)
def first(self, name):
print("say hello to :",name)
def method(self, arg1, arg2):
print ("in method (args):", arg1, arg2)
def ... | true |
51677af6680bd02bd227bf13ddc946a266acc4f3 | Guardian99/Reddit-Flair-Detector | /Final.py | UTF-8 | 2,710 | 2.640625 | 3 | [] | no_license | import math
import praw
import pprint
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from sklearn.neural_network import MLPClassifier
from sklearn.linear_model import SGDClassifier
from sklearn.ensemble import RandomForestClassifier... | true |
f9b41feb91cf7d4c1b6188e04424f39d1453221c | cyy-hub/InterviewCoding | /cyy_pdd_2.py | UTF-8 | 668 | 3.25 | 3 | [] | no_license | import sys
line = sys.stdin.readline().strip().split(" ")
n, m = int(line[0]), int(line[1])
arr = []
for i in range(n):
# 读取每一行
line = sys.stdin.readline().strip()
# 把每一行的数字分隔后转化成int列表
values = list(map(int, line.split(" ")))
arr.append(values)
# 统计岛屿数量
res = 0
cout = 0
def dfs(r,c):
count += 1
... | true |
6576a9f16929f921af5c57cc15c0e62377d95f91 | Chen-Isaac/pythonLearning | /与孩子一起学编程/chapter11/printStar.py | UTF-8 | 108 | 3.578125 | 4 | [] | no_license | numStars = int(raw_input ("How many stars do you want? "))
for i in range (1, numStars + 1):
print '*',
| true |
e1f22dcbf72b10c6022ca8243b167a081f758b85 | nigorshkov/telegram_bot | /lib/database.py | UTF-8 | 3,763 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sqlite3
class SQL:
def __init__(self, database):
self.connection = sqlite3.connect(database, check_same_thread=False)
self.cursor = self.connection.cursor()
def select_all(self, name_table):
""" Считаем все строки из таблицы"""
with self.connectio... | true |
13efa096ad1ed27254e516e639ddb4e6bbed573e | Aasthaengg/IBMdataset | /Python_codes/p02577/s429336140.py | UTF-8 | 107 | 3.359375 | 3 | [] | no_license | N = input()
a=0
for i in range(len(N)):
a+=int(N[i])%9
if a%9==0:
print('Yes')
if a%9!=0:
print('No') | true |
ae655c562a79d4f5e619553f9a20cbb349c74131 | mccricardo/project_euler | /problem_12/problem12.py | UTF-8 | 1,060 | 3.578125 | 4 | [] | no_license | from math import sqrt
from sieve_of_atkin import SieveOfAtkin
def NumberOfDivisors(number):
nod = 0
s = int(sqrt(number))
for i in range(1, s):
if number % i == 0:
nod += 2
if s * s == number:
nod -= 1
return nod
def PrimeFactorisationNoD(number, prime_list):
nod = 1
remain... | true |
d242f13f5bbfd5f0a1d940bd304254ac0c837597 | arjuna12009/twitter-sentiment-analysis | /big_data_producer.py | UTF-8 | 2,144 | 2.859375 | 3 | [] | no_license | import json
import sys
import os
import tweepy
import boto3
# OAuth authentication credentials
consumer_key = 'QHvTETppk2QrZNB0AQGnpapdd'
consumer_secret = 'Y6Gs12OhpQBeJU6qn5MIP9Elqmn2dXWEmrKtpglejIBXBcrQlo'
access_token = '1139245487226273792-CvF2nSxvPyyqqY4qJth1Dnk8pMHq48'
access_secret = 'NXL0hh7KKVPiB0vbk... | true |
8fc6e591cb25c507dce1c8ab235c73d822dd2aa6 | NehaGupta-28/DummyTest1 | /HelloWorld15/strings2.py | UTF-8 | 745 | 3.515625 | 4 | [] | no_license | #parrot = "Norwegian Blue"
# print(parrot)
# print(parrot[3])
# print(parrot[4])
# print(parrot[9])
# print(parrot[3])
# print(parrot[6])
# print(parrot[8])
#
# print()
#
# print(parrot[-11])
# print(parrot[-1])
# print(parrot[-5])
# print(parrot[-11])
# print(parrot[-8])
# print(parrot[-14])
# print(parrot[0:6])
# pr... | true |
6a51b4cc2fa0a029064facc3ac4701e519013534 | RajParab/100DaysOfAlgo | /Day 4/GoldMine.py | UTF-8 | 1,401 | 3.453125 | 3 | [] | no_license | """
Answer to the Gold Mine problem ->https://leetcode.com/problems/path-with-maximum-gold/
This is backtracking problem with logic similar to the maze problem
"""
class Solution:
def getMaximumGold(self, grid: List[List[int]]) -> int:
self.nums=grid.copy()
self.results=[]
self.visited=... | true |
b48bb2dc50e8772eebf6e092db7537895acb41b0 | Terry-Ma/Leetcode | /73-矩阵置零-a.py | UTF-8 | 700 | 3.03125 | 3 | [] | no_license | class Solution:
def setZeroes(self, matrix: List[List[int]]) -> None:
"""
Do not return anything, modify matrix in-place instead.
"""
if matrix:
row_set = set()
col_set = set()
for row in range(len(matrix)):
for col in range(len(mat... | true |
75929c4959aacc7590837203620a6b6ca610b108 | fakegit/curlconverter | /fixtures/python/put_xput.py | UTF-8 | 838 | 2.5625 | 3 | [
"MIT"
] | permissive | import requests
headers = {
'Content-Type': 'application/json',
}
params = [
('pretty', ''),
]
json_data = {
'properties': {
'email': {
'type': 'keyword',
},
},
}
response = requests.put('http://localhost:9200/twitter/_mapping/user', headers=headers, params=params, json=j... | true |
b2b3c2cc46fbf4003b29f836aa870c9b668ee7e9 | Clinical-Genomics/cg | /tests/meta/workflow/test_balsamic.py | UTF-8 | 6,284 | 2.546875 | 3 | [] | no_license | """Tests for BALSAMIC analysis"""
from pathlib import Path
import pytest
from cg.constants.observations import ObservationsFileWildcards
from cg.constants.sequencing import Variants
from cg.constants.subject import Gender
from cg.exc import BalsamicStartError
from cg.meta.workflow.balsamic import BalsamicAnalysisAPI... | true |
bc5f91913db24b4646d2becfaae3d431e6143b34 | Sneppys/KancolleBot | /tools/shipdatatests.py | UTF-8 | 3,299 | 3.03125 | 3 | [] | no_license | """Tests that all data in the ships json file is valid"""
import json
import os
import sys
with open(os.path.join(os.path.dirname(__file__), '../ships.json'), 'r', encoding='utf-8') as jsonfile:
data = json.load(jsonfile)
def warn(sid, text):
print(f"WARNING[{sid}]: " + text)
def error(sid, text):
prin... | true |
e74a4a6ca5ee4ad9aefc1fc55bf3e890f362c0eb | sathvik-sankruth/Data_Mining-CSE5334 | /tfidf.py | UTF-8 | 12,182 | 2.890625 | 3 | [] | no_license | from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem import PorterStemmer
from collections import Counter
#from num2words import num2words
import math
import pandas as pd
from nltk.tokenize import RegexpTokenizer
from nltk.corpus import stopwords
from nltk.stem.porter import PorterSt... | true |
93ad819e2c4f605d3ec6d754aa7e6f9e4492d9f3 | tmonca/simr2d2 | /topo.py | UTF-8 | 764 | 2.71875 | 3 | [] | no_license |
#!/usr/bin/python
import glob
import os
import subprocess
import sys
import math
# I need to set 1 VM per host, hosts are then numbered sequentially across
# the whole data centre. Ideally I pass N,m (N servers spread across m racks)
def topo(NumSrv=4, NumToR=1):
file = open('layout.txt', 'w')
# we'll start wit... | true |
eaecd55f4a31181469ea4dd045bbf6c3a7cecc0c | parmarjh/100day-coding-challenge | /day 69/rotate_matrix.py | UTF-8 | 661 | 3.84375 | 4 | [] | no_license | R = 4
C = 4
def reverseColumns(arr):
for i in range(C):
j = 0
k = C-1
while j < k:
t = arr[j][i]
arr[j][i] = arr[k][i]
arr[k][i] = t
j += 1
k -= 1
# Function for do transpose of matrix
def transpose(arr):
for i in range(R):
for j in range(i, C):
t = arr[i][j]
arr[i][j] = arr... | true |
1652e544bcee9d6015c5fc1972ed01fb218001a7 | Kumarozh/Modration_bot | /cogs/misc.py | UTF-8 | 5,187 | 2.53125 | 3 | [
"MIT"
] | permissive | import discord
from discord.ext import commands
from discord import Embed, Member
from discord.ext.commands import BucketType
from typing import Optional
import datetime
class misc(commands.Cog):
def __init__(self, client):
self.client = client
#avatar command
@commands.command()
@commands.guild... | true |
20b244fb0e84c53ef901bfb684a62860ad9412c6 | Chepubelja/LinearAlgebra | /matrix.py | UTF-8 | 1,753 | 3.390625 | 3 | [] | no_license | import numpy as np
class Matrix():
def __init__(self, matrix):
self.matrix = matrix
self.m = len(matrix)
self.n = len(matrix[0])
def parse_matrix(self, matrix):
pass
def display(self):
Matrix.display_matrix(self.matrix)
def display_matrix(matrix):
for ... | true |
6d01b35433704c657542bdf7e99399526a73ed20 | prateekkggupta/codecheff_python | /HS08TEST.py | UTF-8 | 170 | 3.046875 | 3 | [] | no_license | x = input( )
debit = float(x.split( )[0])
balance = float(x.split( )[1])
if (debit%5 == 0)&(balance-debit-0.5>=0) :
balance = balance-debit-0.5
print('%.2f'%balance)
| true |
ba6e1090aec6fb8fbea5429dae8d1369e210b822 | cordeirolibel/imgClassification | /interface.py | UTF-8 | 3,919 | 2.953125 | 3 | [] | no_license | #>>>>>>>> Interface <<<<<<<<<<#
# Cordeiro Libel - UTFPR - may of 2017 #
#-------------------------------------------------------#
from commons import *
import Tkinter as tk #for keyboard read
import threading
#---------------------------------------------
#------Auxiliary
#------------------------------... | true |
9ae2ae968e7938ba61c10c15333b2493ca94fc59 | anthony-tresontani/simulator | /tests/unit_tests/materials_tests.py | UTF-8 | 825 | 3.046875 | 3 | [] | no_license | from unittest.case import TestCase
from core.material import Material
from core.specification import Specification, MaterialInputConstraint
class InputTest(TestCase):
def setUp(self):
self.input = Material("input", 3)
def test_consume(self):
spec = Specification()
spec.add(MaterialInp... | true |
88520efa943fb8718d12889366cabafd251e2d04 | panumas300/project1 | /september 15/try_except_finally.py | UTF-8 | 678 | 3.859375 | 4 | [] | no_license | """def main():
try:
a, b = map(int,input('Input 2 integer values: ').split())
x = divide(a, b)
except Exception as err:
print(err)
else:
print("result is",x)
finally:
print('executing finally clause')
def divide(x, y):
result = x / y
retu... | true |
429c5d9df26cfba8ae354ced8108bc2ac792f6a0 | Nash0990/PythonCourse_Udemy_Giles | /Section4_05042020.py | UTF-8 | 343 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 5 02:00:36 2020
@author: lifecell
"""
x=5
y=12
z=x+y
print(z)
z=x-y
print(z)
phrase1="Cat sat on the mouse!"
phrase2="And so did the dog!!"
phrase3=phrase1+ " " +phrase2
print(phrase3)
user_input=int(input("How many apples do you have ?\... | true |
6cfa12464d78635b400e0909dd70dc21012bb3cd | rumblesan/PovRayPyWrapper | /wrapper.py | UTF-8 | 4,080 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
from subprocess import Popen, PIPE
from time import sleep
import sys
import os
import json
import shutil
class Povray():
process = None
args = []
return_value = None
completed = False
def __init__(self, config_json, node_number):
config_info = json... | true |
74ded75b1e6e45bf246f93b35a0ff2e5301f26c7 | subho781/MCA-python-assignment-6 | /Q9.py | UTF-8 | 132 | 3.515625 | 4 | [] | no_license | def seq(n):
l=[]
for i in range(0,n+1):
item=pow(i,2)+1
l.append(item)
return l
n=5
print(seq(n)) | true |
e691397d2aa8fe771ca58ea380e390c4f8745806 | JesseAldridge/yc_still_good | /data_collection/pitchbook/parse_ddg_pitchbook.py | UTF-8 | 853 | 2.5625 | 3 | [] | no_license | import re, urllib, glob, json, os
company_dicts = []
for path in glob.glob('ddg_results/*.html'):
with open(path) as f:
text = f.read()
for h2_match in re.finditer('<h2 class="result__title">.+?</h2>', text, re.DOTALL):
if len(h2_match.group(0)) > 1000: # skip ads
continue
h2_text = h2_match.gro... | true |
edafe3010c0bc2c974a5c1a032d40efbd2335e0b | SarahYuHanCheng/AudioStreamCtl | /untitled3.py | UTF-8 | 418 | 2.6875 | 3 | [] | no_license | import sys
userID = str(sys.argv) #input("userID:")
print("0 1 2 3 4 5 6 7 8 9")#eq
print("21")#serial number
# serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# # bind the socket to a public host, and a well-known port
# serversocket.bind((socket.gethostname(), 80))
# # become a server socket
... | true |
43a7436b513d5b6add1b51463e1b279759d825b3 | zcutlip/pyonepassword | /tests/fixtures/expected_ssh_key_data.py | UTF-8 | 1,987 | 2.53125 | 3 | [
"MIT"
] | permissive | from .expected_item import ExpectedItemBase, ExpectedItemData
"""
"Example SSH Key": {
"id": "k7t4uzbuf3fn7d7wrajh5xb3gi",
"title": "Example SSH Key",
"category": "SSH_KEY",
"last_edited_by": "5GHHPJK5HZC5BAT7WDUXW57G44",
"created_at": "2022-06-20T21:06:07Z",... | true |
493d39f48184ea5b5764c6f5cdea0d169ca44b4c | MehrdadTV68/grasp-synergy | /src/grasp_synergy/grasp_synergy.py | UTF-8 | 5,632 | 3 | 3 | [] | no_license | import numpy as np
from sklearn.decomposition import PCA
import rospy
import rosbag
"""
This is the GraspSynergy class. It does the book-keeping of the low-dimensional
grasp representations (the eigen-grasps).
For the ROS functionality, see synergy_node.py.
Author: Felix Duvallet <felixd@gmail.com>
"""
class Gras... | true |
4e3dd68e932bb3bf6a96be4f0827458be437ee05 | jasonw930/ImageColorization | /pet_color_processing.py | UTF-8 | 1,448 | 2.859375 | 3 | [] | no_license | # Input: 128x128 L channel
# Output: 32x32 ab channel
# Upscale: 128x128 image
import os
import cv2
from tqdm import tqdm
import numpy as np
import matplotlib.pyplot as plt
# INTER_AREA
# INTER_CUBIC
dataset_x = []
dataset_y = []
# for folder in ['PetImages/Cat', 'PetImages/Dog'][:]:
for folder in ['LandImages']:
... | true |
7eb253a2dd77564c6b5e5e10a679365b8b791f82 | Blackth01/Panasonic-Viera-Voice-Control | /getcredentials.py | UTF-8 | 388 | 2.71875 | 3 | [
"MIT"
] | permissive | import panasonic_viera
rc = panasonic_viera.RemoteControl("TV_IP")
# Make the TV display a pairing pin code
rc.request_pin_code()
# Interactively ask the user for the pin code
pin = input("Enter the displayed pin code: ")
# Authorize the pin code with the TV
rc.authorize_pin_code(pincode=pin)
# Display credentials (app... | true |
c7a88ca282b0d7fae57a6c836c80213b755295c4 | ibozkurt79/kaggle-plasticc | /scale.py | UTF-8 | 3,327 | 3.109375 | 3 | [
"MIT"
] | permissive | """Scale raw predictions to add to 1 and apply regularisation."""
import pandas as pd
import numpy as np
import datetime as dt
import os
# read raw predictions
prediction = pd.read_csv('Prediction_raw.csv', dtype={'object_id': np.int32})
col_dict = {'mjd': np.float64, 'flux': np.float32, 'flux_err': np.float... | true |
0956574d507a7db6bd865054149b5df1031057e6 | Th3Shadowbroker/tic-tac-toe-ai | /tictactoe/game/Field.py | UTF-8 | 454 | 3.0625 | 3 | [
"MIT"
] | permissive | from tictactoe.game import FieldState
class Field:
def __init__(self, x: int, y: int, s: FieldState):
self.__x = x
self.__y = y
self.__state = s
@property
def x(self) -> int:
return self.__x
@property
def y(self) -> int:
return self.__y
@property
... | true |
fe482f358b678f9c4a8217ce76e0853ffa2a8c80 | GH-Lim/AlgorithmHomeworkshop | /homework/2기서울2반10월4일임건혁/2115_벌꿀채취.py | UTF-8 | 2,363 | 2.75 | 3 | [] | no_license | # import sys
# sys.stdin = open('2115.txt', 'r')
def find_max(L):
Max = L[0] ** 2
for i in range(M - 1):
for j in range(i + 1, M):
k = j
Sum = L[i]
sub_max = L[i] ** 2
while k < M:
if Sum + L[k] <= C:
Sum += L[k]
... | true |
d144f32a5b0f10d2fe8ee0ca9923abb7452460c5 | ryancey1/Rosalind | /Bioinformatics-Stronghold/05-computing-gc-content.py | UTF-8 | 1,484 | 3.09375 | 3 | [] | no_license | #! /usr/bin/env python3
'''
'''
import sys
import re
import bioinformatics_tools as bfx
# def count_gc(dna):
# dna = dna.replace('\n', '')
# g, c = dna.count('G'), dna.count('C')
# gc = g + c
# gc_pct = (gc/len(dna)) * 100
# return gc_pct
# def find_max(dictionary):
# K, V = None, -1
# f... | true |
eb60074dd21dbaaec257e1b7d0a68f67dd4ff803 | jay6413682/Leetcode | /test_Longest_Substring_Without_Repeating_Characters_10.py | UTF-8 | 839 | 3.328125 | 3 | [] | no_license | '''
Created on Jun 11, 2015
@author: ljiang
'''
import pytest
from Longest_Substring_Without_Repeating_Characters_10 import Longest_Substring_Without_Repeating_Characters_10
@pytest.mark.parametrize("n,expectation",[("abcabcdabd",4),("1233212345",5),("ffffff",1),("abcbcdedf",4)])
def test_Longest_Substring_Witho... | true |
3062af510a05138eac9cfc8bd6ba0d7f465da255 | gaurakshay/ShellDuplicateDetection | /python-submissions/2.py | UTF-8 | 4,862 | 3.15625 | 3 | [
"MIT"
] | permissive |
from __future__ import division
import codecs
import json
import nltk
from nltk import sent_tokenize
from nltk import word_tokenize
with codecs.open("twitter.txt", encoding='utf-8') as f:
#output strings
csvString = ""
xmlString = ""
jsonString = ""
#split input file by ... | true |
f64412f8e6b606fc77b80056ee826eb2957ff031 | topshed/AoC2015 | /1/day1_2.py | UTF-8 | 328 | 3.609375 | 4 | [] | no_license | instructions = []
with open("input.txt") as file:
for line in file:
line = line.strip()
for c in line:
instructions.append(c)
floor = 0
c = 1
for i in instructions:
if floor == -1:
print(c)
if i == "(":
floor+=1
elif i == ")":
floor-=1
c+=1
print(... | true |
b64cb727bf3cc2a6ca03889b3809c852dd2c699b | oddo3o/LPTHW3 | /ex21.py | UTF-8 | 1,051 | 4.78125 | 5 | [] | no_license | def add(a, b):
print(f"ADDING {a} + {b}")
# Return
# Once function is done running values "a" "b" returned to values
# Values are left open for next function call to replace "a" "b"
return a + b
def subtract(a, b):
print(f"SUBTRACTING {a} - {b}")
return a - b
def multiply(a, b):
prin... | true |
1a049d3b7748f8d837298cb4b4c29e1859a7312c | danirod/dummyauth | /dummyauth/forms.py | UTF-8 | 3,227 | 3.3125 | 3 | [
"ISC"
] | permissive | from flask_wtf import FlaskForm
from wtforms.validators import DataRequired, URL, ValidationError
from wtforms import Field, StringField
from urllib.parse import urlsplit, urlunsplit
from ipaddress import ip_address
class CanonicalFilter(object):
"""
This object behaves as a callable. The callable receives th... | true |
da2f37a735f7b7c027284a10d7273ed5a3bcc7ac | linshan5/Python-Classification-Problem | /orange juice Purchase Classification.py | UTF-8 | 14,037 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # [Shanshan, Lin]¶
# # [2020-08-08]
# # Question: Choose an appropriate metric to analyze a model’s performance. Justify.
# In[1]:
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import ... | true |
5b7bf7c8e364e8c179777d435fcf7f97e0eac15b | MalyshevValery/Image_Analysis_DL | /tests/nn/metrics/precision.py | UTF-8 | 2,413 | 2.671875 | 3 | [
"MIT"
] | permissive | """Test shapes and values of precision metric"""
import unittest
import torch
from imagedl.nn.metrics import Precision
class PrecisionTestCase(unittest.TestCase):
def test_binary(self) -> None:
self.__compare(Precision(),
torch.Tensor([1, 1, 1, 1, -1, -1]),
... | true |
af0b346faba023780451fa349089214bb8d403a3 | austinmroczek/skybellpy | /skybellpy/utils.py | UTF-8 | 925 | 2.953125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """Skybellpy utility methods."""
import pickle
import random
import string
import uuid
def save_cache(data, filename):
"""Save cookies to a file."""
with open(filename, 'wb') as handle:
pickle.dump(data, handle)
def load_cache(filename):
"""Load cookies from a file."""
with open(filename, 'r... | true |
15ed147f904752afcbb958b3a99f946c99a05859 | NIco007/setp03 | /cuenta_palabras.py | UTF-8 | 501 | 3.578125 | 4 | [] | no_license | def cuenta_palabras(diccionario,cantidad):
if(len(diccionario)>0):
algo, numero = diccionario.popitem()
cantidad = cantidad + numero
return cuenta_palabras(diccionario,cantidad)
else:
return cantidad
cantidad = 0
diccionario = {"hola":5 , "coma":6, "poasa":20,"vac... | true |
1acccf006bff1a5d8a9088e3b99cbbc19ace6356 | fuscadan/hoopsearch | /run.py | UTF-8 | 1,097 | 2.859375 | 3 | [] | no_license | """
Created on Tue October 08 2019
@author danie
Launches the HoopSearch app on a local server that can be accessed via a
web browser by navigating to http://127.0.0.1:5000/. Enter a query in the
search bar, and the search engine returns up to ten games relevant to the
query, including th... | true |
428f5916c0662ca9fb08a83b7f952a1c2eaa3280 | sbd2309/Adv.Python | /linked_pair_swap.py | UTF-8 | 482 | 3.1875 | 3 | [] | no_license | def pair_swap(l):
if len(l)%2==0:
for i in range(0,len(l),2):
x=l[i]
y=l[i+1]
l[i]=y
l[i+1]=x
for i in l:
print(i)
else:
for i in range (0,len(l)-1,2):
x = l[i]
y = l[i + 1]
l[i] = y
... | true |
696dfced0a4c4c5cdad05a15b8b9fc3603535132 | gaobiyun/day1 | /day1/Mrandom.py | UTF-8 | 308 | 2.90625 | 3 | [] | no_license | import random
if __name__ == '__main__':
#随机一个整型值
n=random.randint(4,9)
print(n)
#随机出现的一个数值
v=random.choice(range(10))
print(v)
#
s=random.randrange(1,10)
print(s)
#随机出现的浮点数 实数
h=random.uniform(1,2)
print(h) | true |
e6d1c5f7d8122a744fb1ce501acd459a3d195464 | markanson25/python-fundamentals | /02_basic_datatypes/2_strings/02_09_vowel.py | UTF-8 | 1,084 | 4.59375 | 5 | [] | no_license | '''
Write a script that prints the total number of vowels that are used in a user-inputted string.
CHALLENGE: Can you change the script so that it counts the occurrence of each individual vowel
in the string and print a count for each of them?
'''
sentence = input("Please enter a sentence: ")
vowel1 = "a... | true |
4db754a40f1e273e138041d4c00cf62ac5fa4c5a | Emechebe/REGRESSION | /Wk1_SimpleRegression/GetRegressionPrediction.py | UTF-8 | 727 | 3.4375 | 3 | [] | no_license | # Machine Learning Course: Regression. From Drs Emily & Carlos. University of Washington
# Written by Uchenna Emechebe
# This function takes a list of input, and using the intercept and slope calculated by RegressionModel.py,
# returns back a column of predicted values based on the line of best fit for this model
imp... | true |
004f6a6a6d78fc24e9c4ab5bdfde0277c4549730 | annabechang/leetcode | /016_3Sum_Closest.py | UTF-8 | 1,457 | 3.75 | 4 | [] | no_license | """
16. 3Sum Closest
Medium
Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
Example:
Given array nums = [-1, 2, 1, -4], and target = 1.
T... | true |
9675ed85c8197893d3ba71aa865a5b80816d2d4a | fregulationn/python-REST | /rest/experiments/model/logistic_regression.py | UTF-8 | 1,027 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
File Name: logistic_regression
Author : junjie.zhang
-------------------------------------------------
"""
import os
import pickle
from time import time
from sklearn import metrics
from sklearn.linear_model import LogisticRegression
def train(out_dir, X_train, X_test, y_train, y... | true |
18e480e2cf83681df231b54bebb83e7c2e61e03b | WyckliffeAluga/potential-happiness | /ai-healthcare/hippocampal-volume-quantification-in-Alzheimer-progression/deep-learning/segmentation/segmentation.py | UTF-8 | 7,267 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 3 23:37:33 2020
@author: wyckliffe
"""
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy.ma as ma
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import nibabel as nib
from collections import OrderedDict
import... | true |
36988371c66672acadeb449d0e72f2c8743380a7 | mdirfan-code/HackerRank_Solutions | /detect_html_tag_attr_attrval.py | UTF-8 | 495 | 3.125 | 3 | [] | no_license | import re
n=int(input())
s=""
for i in range(n):
s+=input()
lst=list(re.findall(r'''([^\s<!-]+)<([\w]+)\s?([A-Za-z0-9='.\s/"-]+)*>''',s))
print()
print(lst)
print()
for t in lst:
if("!" not in t[0]):
print(t[1])
if(t[2] !='' ):
v=t[2].split()
for i in v:
... | true |
4fe11d1c6215c273d0cf25f363697a3d6327a41b | natachit/SecVis | /week4/2-convert.py | UTF-8 | 1,581 | 2.5625 | 3 | [] | no_license | import csv
import json
import random
from collections import OrderedDict
fileName = './2.csv'
csvfile = open(fileName)
reader = csv.DictReader(csvfile)
data = []
all0 = []
all1 = []
all2 = []
all3 = []
all4 = []
user = ['RMUn6owxz3Npjow@ku.ac.th',
'RMUjtMPNJ6aT3TB@ku.ac.th',
'RMUpKGYn9d5by4N@ku.ac.th'... | true |
325a33f2f8b85a24c44f87b1bd4afdee5697f4a2 | madhuripawar12/python_basic | /sort_2nd_sublist.py | UTF-8 | 369 | 3.171875 | 3 | [] | no_license | def Sort(sub_li):
l = len(sub_li)
for i in range(0, l):
for j in range(0, l-i-1):
if (sub_li[j][1] > sub_li[j + 1][1]):
tempo = sub_li[j]
sub_li[j]= sub_li[j + 1]
sub_li[j + 1]= tempo
return sub_li
sub_li =[['kirti', 10], ['akash', 5], ['... | true |
eccb677fc1dd965e4f550442223cabd6dbfc77f7 | Aasthaengg/IBMdataset | /Python_codes/p03638/s865687441.py | UTF-8 | 364 | 2.828125 | 3 | [] | no_license | H, W = map(int, input().split())
N = int(input())
A = list(map(int, input().split()))
grid = [[0] * W for _ in range(H)]
i, j, k = 0, 0, 0
while i < H:
step = 1 if i % 2 == 0 else -1
grid[i][j] = k + 1
A[k] -= 1
if A[k] == 0:
k += 1
if j + step in (-1, W):
i += 1
else:
... | true |
e47d3924d31163d8fbc17fef6f3a56f237feec8d | felipe84841/Other | /python/eu.py | UTF-8 | 581 | 3.40625 | 3 | [] | no_license | #-------------------------------------------------------------------------------
# Name: Euclidean algorithm
# Purpose:
# Greatest common divisor
#
# Author: Felipe Desiglo
#
# Created: 04/10/2016
# Copyright: (c) Desiglo 2016
#------------------------------------------------------------------... | true |
1c4bf2cfda936cce0beaf07fd5a8a62a582ac666 | jevans1029/PlaceRequestLambdaFunctionDemo | /GoogleRequest.py | UTF-8 | 1,780 | 3.0625 | 3 | [] | no_license | import requests
from Place import *
from datetime import datetime
apikey = "xxxxxxxxxxxxxxxxxxxxxxx"
##Main function that calls the other functions
# uses formURL to form the request then passes json to getplaces then
#
def requestNearbyPlaces(lat, lng, type):
assert (-90.0 <= lat <= 90.0)
assert (-180.0 <= l... | true |
5f6804fe1893a68ab0d926460729ff926c376a22 | wumingpu/Leetcode | /algorithm/find_length_of_LCIS.py | UTF-8 | 1,266 | 3.9375 | 4 | [] | no_license | """
最长连续递增序列
给定一个未经排序的整数数组,找到最长且连续的的递增序列。
示例 1:
输入: [1,3,5,4,7]
输出: 3
解释: 最长连续递增序列是 [1,3,5], 长度为3。
尽管 [1,3,5,7] 也是升序的子序列, 但它不是连续的,因为5和7在原数组里被4隔开。
示例 2:
输入: [2,2,2,2,2]
输出: 1
解释: 最长连续递增序列是 [2], 长度为1。
注意:数组长度不会超过10000。
"""
class Solution(object):
def findLengthOfLCIS(self, nums):
"""
:type nums: ... | true |
3096a935ba67da4709c738a20d3156a77756851a | PlusWayne/Leetcode-solution | /160.intersection-of-two-linked-lists/intersection-of-two-linked-lists.py | UTF-8 | 994 | 3.59375 | 4 | [] | no_license | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def getIntersectionNode(self, headA, headB):
"""
:type head1, head1: ListNode
:rtype: ListNode
"""
# use two ... | true |
55eedb84b1ba806cfb3d738cae96cba464888b1d | cwu392/Machine-Learning-for-Trading | /strategy learner/experiment1.py | UTF-8 | 1,793 | 2.546875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import datetime
import pandas as pd
import util as ut
import BagLearner as bl
import DTLearner as dl
import numpy as np
import StrategyLearner as sl
from marketsim import marketsim
import ManualStrategy as ms
import random
def author(self):
return 'cwu392'
if __name__ == '__main__'... | true |
ccda431043045caf06733e44f50e4b4fde1ed856 | cliptic/Absentism | /module.py | UTF-8 | 4,188 | 2.71875 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn import metrics
from sklearn.linear_model import LogisticRegression
from sklearn.base import BaseEstimator, TransformerMixin
import pickle
class CustomScaler(BaseEsti... | true |
2087bc173326827c6776391cd2b5909707c4d6e4 | mcr222/rumor_analytics | /rule_mining.py | UTF-8 | 1,498 | 2.953125 | 3 | [
"MIT"
] | permissive | from __future__ import division
import FilterStem
def find_original_word(stemmed_word,tweet_id_to_text):
'''
This function returns the word without stemming that corresponds to
the input stemmed_word
'''
for value in tweet_id_to_text.itervalues():
words, words_without_stem = FilterStem.f_li... | true |
fc5536d7f349956ffb3cb4ff4b522aa76422239f | gravesprite/seq2seq_with_deep_attention | /runners/run_loung.py | UTF-8 | 7,306 | 2.515625 | 3 | [] | no_license | ###!/usr/bin/env python
#%%
"""
Example for date conversion
"""
__author__ = "AL-Tam Faroq"
__copyright__ = "Copyright 2020, UALG"
__credits__ = ["Faroq AL-Tam"]
__license__ = "GPL"
__version__ = "1.0.1"
__maintainer__ = "Faroq AL-Tam"
__email__ = "ftam@ualg.pt"
__status__ = "Production"
import sys
sys.path.append(".... | true |
1914318d731bc70bdf0239ca28c37f6af43cbd87 | dr-aryone/BiblioPixel | /bibliopixel/drivers/PiWS281X.py | UTF-8 | 4,294 | 2.578125 | 3 | [
"MIT"
] | permissive | # Original code by msurguy:
# https://github.com/ManiacalLabs/BiblioPixel/issues/51#issuecomment-228662943
import os, sys
from . channel_order import ChannelOrder
from . driver_base import DriverBase
from .. util import log
from .. colors import gamma
WS_ERROR = """
PiWS281X Requires the rpi_ws281x C extension.
Inst... | true |
99c2d276a9a2e9f3ecd3d5860bde22e3d18c70a8 | dean-shaff/plotface | /plotter.py | UTF-8 | 2,617 | 2.875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from matplotlib import rcParams
from matplotlib.backends import qt4_compat
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
rcParams['axes.labelsize'] = 14
rcParams[... | true |
9f143620383b10e706c75ab20a19eb44a5e37399 | sochic2/TIL | /algorithm/2020_03/2.py | UTF-8 | 769 | 3 | 3 | [] | no_license | def solution(answer_sheet, sheets):
answer = 0
for i in range(len(sheets)):
for j in range(i+1, len(sheets)):
total = 0
llen = 0
maxlen = -987654321
for chk in range(len(answer_sheet)):
if sheets[i][chk] == sheets[j][chk] != answer_sheet[ch... | true |
fe7a35d580dc2b8e1e594716a78373d898431060 | rikhiparth/Python-project | /project.py | UTF-8 | 8,721 | 3.3125 | 3 | [] | no_license | #------------------------------------------------------------- PYTHON PROJECT ------------------------------------------------------------
from tkinter import *
import tkinter
top=tkinter.Tk()
count=0
bookid=StringVar()
bookname=StringVar()
bookprice=StringVar()
bookauthor=StringVar()
bookpublisher=StringVar()
#----... | true |
48c18fb9856d4cda47ce997c3ace2857d8b0c617 | erccarls/rpi_environment | /rpi_environment/sensors/dht.py | UTF-8 | 3,128 | 3.15625 | 3 | [
"MIT"
] | permissive | import Adafruit_DHT
import numpy as np
from concurrent.futures import ThreadPoolExecutor
from w1thermsensor import W1ThermSensor
EXECUTOR = ThreadPoolExecutor(16)
SENSOR_MAP = {
'DHT11': Adafruit_DHT.DHT11,
'DHT22': Adafruit_DHT.DHT11,
'DS18B20': 'DS18B20'
}
def read_humidity_and_temp(sensor_spec):
... | true |
5bdbd6934e166539aec542be61bc0dac00957f2e | whaag/python_game | /ship.py | UTF-8 | 2,174 | 3.90625 | 4 | [] | no_license | import pygame
from pygame.sprite import Sprite
class Ship(Sprite):
def __init__(self, screen, game_settings):
""""Initialise the ship and set its starting position."""
super(Ship, self).__init__()
self.screen = screen
self.game_settings = game_settings
# Load the ship imag... | true |
2186d3ef848a8a99d688ccc7cb3423d8f89c255c | abhipaiangle/Autumn-of-Automation | /ROS/catkin_ws/src/quaterions/src/q1.py | UTF-8 | 1,101 | 2.890625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
import rospy
from conversion.msg import quaternion, euler
import math
roll = pitch = yaw = 0.0
def convert(q):
global roll, pitch, yaw
#roll (x-axis rotation)
sinr_cosp = 2 * (q.w * q.x + q.y * q.z)
cosr_cosp = 1 - 2 * (q.x * q.x + q.y * q.y)
roll = math.atan2(sinr_cosp, cosr_c... | true |
30babd361465f6e77741dcc9fa0c1831f0084a47 | mendako1015/Kkai-Hackathon-2021sp | /HQ9+.py | UTF-8 | 985 | 3.234375 | 3 | [] | no_license | import sys
import os.path
accumulator = 0
argvs = sys.argv
argc = len(argvs)
def command_h():
print("Hello, World!")
def command_plus():
global accumulator
accumulator += 1
def command_9():
file = open('beer.txt', 'r')
txt = file.read
print(txt)
file.close()
pass
def command_q(sourcecode):
print(... | true |
5d01db5aa2434695daa97173b8760e0512bb9c79 | mshinoda88/style_transfer | /src/transform.py | UTF-8 | 6,453 | 2.671875 | 3 | [] | no_license | from keras.optimizers import Adam
from keras.preprocessing.image import ImageDataGenerator
from keras import backend as K
import h5py
import tensorflow as tf
from skimage import color
from scipy import ndimage
from scipy.ndimage.filters import median_filter
from imageio import imwrite
from loss import dummy_loss
impo... | true |
5f298d00d03a4f2ec797172c733f1e63455141b2 | SkewwG/Python_demo | /demo_dict/demo_values.py | UTF-8 | 271 | 3.671875 | 4 | [] | no_license |
'''
values(...)
D.values() -> an object providing a view on D's values
'''
print(help(dict.values))
a = {'one': 1, 'two': 2, 'four': {'five': 5}}
b = a.values()
print(b) # dict_values([1, {'five': 5}, 2])
print(list(b)) # [1, {'five': 5}, 2]
| true |
6b574368dbd409ae3f2a31630fe3da3790a6377d | cbalea/LM-AUTOMATION | /Panda/utils/random_generators.py | UTF-8 | 373 | 2.984375 | 3 | [] | no_license | '''
Created on 20.09.2012
@author: cbalea
'''
import random
import string
class RandomGenerators(object):
def generateRandomString(self, length):
return ''.join(random.sample(string.ascii_uppercase + string.digits, length))
def generateRandomDigits(self, lengthOfDigits):
return ... | true |
1e959472b0bb8e72f00e79c56df9c25e0b28548c | jimsrc/corpad | /code_processing/taus/new/freq.colission.py | UTF-8 | 2,161 | 2.796875 | 3 | [] | no_license | from pylab import *
import numpy as np
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def beta(Ek, Eo):
g = gamma(Ek, Eo)
b = (1. - g**-2)**.5
return b
def gamma(Ek, Eo):
return Ek/Eo + 1.
def kperp(Lc, sigma, b):
c = 3e10 # [cm/s]
v = b*c # [cm/s]
return 5.*v*... | true |
cc01f5a4a2421e3c3081799ceda00f8eb3d3268d | sassoo/drfjsonapi | /drfjsonapi/pagination.py | UTF-8 | 4,355 | 2.9375 | 3 | [
"ISC"
] | permissive | """
drfjsonapi.pagination
~~~~~~~~~~~~~~~~~~~~~~
DRF custom pagination to assist with a JSONAPI spec
compliant API.
"""
from rest_framework.pagination import LimitOffsetPagination as _LimitOffsetPagination
from rest_framework.utils.urls import remove_query_param, replace_query_param
from .exceptions ... | true |
e1f02d2c1c132a642e53ce2f9b8877c539e09e0e | WoutjeParys/thesis | /Model2/test_elasticities.py | UTF-8 | 1,062 | 2.765625 | 3 | [] | no_license | __author__ = 'Wout'
import sqlite3 as sq
import csv
import xlrd
import os
#choose winter-spring-summer-autumn
season = 4
#choose weekday (1) or weekend (2)
day = 2
if day==1:
offset=0
else:
offset=4
delta_price = 0.2
bookelast = xlrd.open_workbook(os.path.join(os.getcwd() , "excel\Elasticity.xlsx"))
bookde... | true |
367bc379c955da8f9cf629f6bc246a64933b9faf | gugarosa/textformer | /textformer/models/encoders/conv.py | UTF-8 | 4,132 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | """Convolutional encoder.
"""
import math
import torch
from torch import nn
import textformer.utils.logging as l
from textformer.core import Encoder
logger = l.get_logger(__name__)
class ConvEncoder(Encoder):
"""A ConvEncoder is used to supply the encoding part of the Convolutional Seq2Seq architecture.
... | true |
4de18bdab8f37d970e78ab5d2f7bbf212ce6fe7a | joakimnordling/migrate-anything | /migrate_anything/tests/test_migrator.py | UTF-8 | 2,221 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | import imp
from os.path import join, dirname, sep, exists
import pytest
from migrate_anything import CSVStorage
from migrate_anything.migrator import _check_module, run
from migrate_anything.tests.common import (
GOOD_CODE,
WITHOUT_DOWN,
WITHOUT_UP,
clean_files,
clean_filesystem,
)
try:
from ... | true |
735cfb9e651f1dbc96eaf070fd2bf961a1f2e428 | linomarcos/webcrawler | /crawler_node.py | UTF-8 | 1,688 | 3.1875 | 3 | [
"BSD-2-Clause"
] | permissive | import json
import yaml
import redis
import logging
class CrawlerNode(object):
"""Implements logic for distributed Breadth-First Search"""
QUEUE_NS = 'crawler:queue'
VISITED_NS = 'crawler:visited'
def __init__(self, redis_config, graph_api):
"""
@redis_config: Redis client connection... | true |
591ab65f3aae060babd0b8a9b2e4b8ce56e0fd27 | oleglite/syne | /src/syne_audio/tools.py | UTF-8 | 329 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import struct
def bytes_to_ints(bytes):
"""
>>> bytes_to_ints(b'\x01\x10\x02')
(1, 16, 2)
"""
return struct.unpack('>%sB' % len(bytes), bytes)
def ints_to_bytes(ints):
"""
>>> list(ints_to_bytes((1, 16, 2)))
b'\x01\x10\x02'
"""
return struct.pack('>B'... | true |
7652a84e1a170b748108ecd1e8b78ed963521a36 | boscotsang/doudizhu | /tests/test_game.py | UTF-8 | 3,376 | 3.0625 | 3 | [
"MIT"
] | permissive | import unittest
import doudizhu
from doudizhu import Card
def CardStrListToCardIntSet(cards):
return set([Card.new(card_str) for card_str in cards])
def CardStrListToCardIntList(cards):
return [Card.new(card_str) for card_str in cards]
class TestDoudizhuGame(unittest.TestCase):
def test_doudizhu_new_... | true |
d7d456a2ad875e759d90e95b3958dc25d1651bfa | sunboHub/sunbo | /PY/酷我音樂/窗口.py | UTF-8 | 2,533 | 2.859375 | 3 | [] | no_license | import tkinter as tk
from tkinter import ttk
window = tk.Tk() # 创建窗口对象
window.geometry('320x600') # 设置窗口大小
window.title('VIP解析') # 设置窗口标题
# 设置上边frame框架控件;在屏幕上显示一个矩形区域,多用来作为容器
# 用来放两个标签,下拉框和输入框
ContentBoxTop = tk.Frame(window, w... | true |
3ce0a8ee2b0af7d7afac9ab30624fc8415051edc | shiki7/leetcode | /1137: N-th Tribonacci Number/solution.py | UTF-8 | 325 | 3.25 | 3 | [] | no_license | class Solution:
def tribonacci(self, n: int) -> int:
a,b,c = 0,1,1
val = 0
if n == 0:
return 0
if n == 1 or n == 2:
return 1
for i in range(3, n+1):
val = a+b+c
a = b
b = c
c = val
return... | true |
e3256db4102d27f786c88721b97c829ee00e0702 | giladbi/learning-python | /intro3.py | UTF-8 | 1,310 | 3.265625 | 3 | [] | no_license | """
https://www.youtube.com/watch?v=2BrpKpWwT2A&index=1&list=PLQVvvaa0QuDcOdF96TBtRtuQksErCEBYZ
Intro and Getting Stock Price Data - Python Programming for Finance p.1
getting daily OHLCV from yahoo for a specific symbol
"""
import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
im... | true |
e90266bb1ebc50460d2e6cee79fb95d1515e0bab | dmark/cv_tax | /cvt.py | UTF-8 | 2,127 | 3.75 | 4 | [
"MIT"
] | permissive | import argparse
def get_args():
"""Processes command line arguments"""
parser = argparse.ArgumentParser(description='Continuously variable tax rate calculator.')
parser.add_argument('-i', '--income')
parser.add_argument('-r', '--rate_min', help='Minimum tax rate')
parser.add_argument('-R', '--rate... | true |
5d361d098471f42109cdb42d5c76f1138cb55e47 | GunterOdimm/python | /section01/03-operator.py | UTF-8 | 595 | 3.84375 | 4 | [] | no_license | #-*- coding:utf-8 -*-
#연산 결과는 새로운 변수에 할당 하거나 직접 출력이 가능
a = 3
b = 4
c = a + b
print(c)
print(a - b)
print(a * b)
print(a / b)
#나눗셈의 몫을 구한다
#처리 가능한 단위까지 계산한다 단 마지막에 오차가 발생한다.
print( 10 / 3)
#나눗셈에서ㅓ 소숫점 아래를 버리고 몫만 계산
print( 10 // 3)
#나눗셈의 나머지를 구한다
#정수 단위에서만 연산후 종료
print( 10 % 3)
#제곱 구하기
print( 10 ** 3)
#단항 연산자
a = ... | true |
343d6253743b9d48da3f8dd042b3f005d4f44360 | xiaoxiaodu/library | /utils/text_util.py | UTF-8 | 2,586 | 3.171875 | 3 | [] | no_license | # coding: utf8
import hashlib, re, string
HTML_TAG_PATTERN = re.compile('<[^>]+>')
def filter_html_tag(content):
if isinstance(content, unicode):
content = content.encode('utf-8')
content = HTML_TAG_PATTERN.sub("", content)
return content
def clean_content(content):
# 过滤html标签
con... | true |
92df11c1c6a3608d3136f0ca784e4c324f238906 | sqiprasanna/coding-questions | /Graph/find_whether_path_exists.py | UTF-8 | 2,270 | 4.03125 | 4 | [] | no_license | """
url : https://practice.geeksforgeeks.org/problems/find-whether-path-exist/0
Given a N X N matrix (M) filled with 1 , 0 , 2 , 3 . Your task is to find whether there is a path possible from source to destination, while traversing through blank cells only. You can traverse up, down, right and left.
A value of cell 1... | true |
212d8d6048601c474ec7d30cb6db83bb7e054684 | astoeff/clean-code-course-project | /tests/test_fight.py | UTF-8 | 6,529 | 3.234375 | 3 | [] | no_license | import unittest
from main.models.hero import Hero
from main.models.enemy import Enemy
from main.fight import Fight
from main.treasures.weapon import Weapon
from main.constants import (FIGHT_INITIAL_INFORMATION_PART, FIGHT_HERO_CANNOT_ATTACK_INFORMATION_PART,
FIGHT_HERO_ATTACK_INFORMATION_PAR... | true |
9481c7accd0c134cd65fa7bac6b35010045ec113 | croguerrero/pythonexercises | /ejenumpy.py | UTF-8 | 548 | 3.25 | 3 | [] | no_license | import numpy as np
A = np.empty((2, 3))
B = np.empty_like(A)
print(A)
print(B)
c = np.zeros((3, 5))
d = np.zeros_like(A)
print(c)
print(d)
e = np.ones((1, 4))
print(e)
d = np.ones_like(B)
print(d)
##ejercicio con numpy
M = np.matrix([[1, 0, -3, 2], [2, 0, 1, 1], [-1, 0, -1, 0]])
B = np.matrix([[-1, -2, 0, 6], [-2... | true |