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 |
|---|---|---|---|---|---|---|---|---|---|---|
94e40960925d6b888d5949d66c3467ae5cd3a3a6 | PaddyCox/project-euler | /problem_105/p_105.py | UTF-8 | 992 | 3.375 | 3 | [] | no_license | import itertools
import csv
def itertools_sum_check(list_1):
list_1.sort()
number_items = len(list_1)
set_list = set(list_1)
if len(set_list) != number_items:
return False
check_up_to = number_items // 2
lower_half = (number_items + 1) // 2
large_sum = sum(list_1[0:lower_half])
... | true |
c9c5a1b65c57fefc1818f9ea79e1f8aac0e12ac0 | Vasadaz/calculator | /test_calculator.py | UTF-8 | 2,747 | 3.671875 | 4 | [] | no_license | import unittest
from calculator import fun_calculator
class TestCalculator(unittest.TestCase):
def test_1(self):
assert fun_calculator("2*2") == 2 * 2 # 4
def test_2(self):
assert fun_calculator("(-4)/4") == (-4) / 4 # -1
def test_3(self):
assert fun_calculator("(-4)/4**2") ==... | true |
415d7244028fa104aee5ce4ae9160731743a064f | matawalle4u/PDFExtraction | /extr_.py | UTF-8 | 4,803 | 2.71875 | 3 | [] | no_license | import json, os, subprocess, sys,re
from PyPDF2 import PdfFileReader, PdfFileWriter
"""
USAGE
1. Ensure You have only the pdf file you want to extract in the folder
2.
"""
class CheckPackages:
packages = [
'PyPDF2'
]
def __init__(self):
try:
import pip
... | true |
6a6a28a163cc677a00e701f4c2fee8713de9220d | OktayGardener/LeetCode | /Python/594.py | UTF-8 | 308 | 2.859375 | 3 | [] | no_license | class Solution:
def findLHS(self, nums: List[int]) -> int:
d = {}
res = 0
for i in range(len(nums)):
d[nums[i]] = d.get(nums[i], 0) + 1
for k in d.keys():
if k + 1 in d:
res = max(res, d.get(k) + d.get(k + 1))
return res
| true |
ff2276c9cf15e5d2cbf6824b7947984d459ade64 | andyyvo/CS111 | /PS 2/ps2pr4.py | UTF-8 | 1,279 | 4.3125 | 4 | [] | no_license | #
# problem 4: functions on strings and lists, part 2
#
# 1. mirror function
#
def mirror(s):
"""returns a mirrored version of that is twice the length of the original string."""
mirror = s[::-1]
return s + mirror
#
# 2. is the string a mirrored string function
#
def is_mirror(s):
""" returns a boole... | true |
e171f6a7d2df6170cd24ee5f21392378541c854b | mocchiis/research | /neural_net/random_data.py | UTF-8 | 2,358 | 2.6875 | 3 | [] | no_license | import numpy as np
import math
def random_data(sensor_df):
X_sensor = np.array(sensor_df.loc[:,'front':'left'])
length = len(sensor_df)
action = np.array(np.zeros(length))
action = np.array(sensor_df.loc[:,'action'])
# 各行の最小センサ値の列名
minimum_kind = sensor_df.loc[:,'front':'left'].idxmin(axis = ... | true |
899bb58a1e69a85b90ddca9fe70cc697969ed564 | gsimore/rock-paper-scissors | /rps2.py | UTF-8 | 1,950 | 4.0625 | 4 | [] | no_license | '''
Rock paper scissors.
vs. the computer
rock > scissors ; 0 > 2
scissors > paper;
paper > rock
First player with a score of 3 wins!
* mod: play to get best 2 out of 3
'''
import random
choices = ('r', 'p', 's')
user_name = input('Enter your user name: ')
play_prompt = 'Enter (r)ock, (p)aper, or (s)cissors: '
... | true |
fa479fa0cd9984965e50b12cf126f90ad08f8115 | kaisjessa/Project-Euler | /pe055.py | UTF-8 | 869 | 3.96875 | 4 | [] | no_license | def reverse_digits(n):
s = ""
for i in range(len(str(n))-1, -1, -1):
s += str(n)[i]
return(s)
def is_palindromic(n):
if(len(str(n)) % 2 == 0):
return(str(n)[:int(len(str(n))/2)] == reverse_digits(str(n)[int(len(str(n))/2):]))
else:
return(str(n)[:int((len(str(n))-1)/2)] == reverse_digits(str(n)[int((len(str... | true |
f05714bd7deb9e40c98de24388ce08d1ffedf149 | ChaBoxxHF/Licence-Informatique | /Licence_2/S3/I33/tp3.py | UTF-8 | 724 | 3.296875 | 3 | [] | no_license | #exo 1
def decompose(n):
l=[]
while n!=0:
l+=[n%2]
n//=2
return l[::-1]
#exo 2
def eval_poly(P,b):
i=0
pb=0
while i<len(P)-1:
pb+=P[i]
pb*=b
i+=1
pb+=P[i]
return pb
#exo 3
def multbyalpha(b,f):
resultat = b << 1
taille = len(bin(f)) - ... | true |
e41f68197138e703794c507bd96e493ca9ab7cd9 | shabanuosman/learn-python-hard-way-3 | /test2.py | UTF-8 | 35 | 3.0625 | 3 | [] | no_license | a=5
b=6
c= a if a>b else b
print(c) | true |
1669d3d208af421ee4cc000f655472cddb43b9be | qiangsiwei/hangzhou_zones | /code/som.py | UTF-8 | 5,722 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from math import exp
import networkx as nx
import numpy as np
import pylab as pl,random
from mpl_toolkits.mplot3d import Axes3D
def draw_figure(fignum,data,pos):
fig = pl.figure(fignum)
pl.clf()
ax = fig.add_subplot(111)
x,y = zip(*data)
x1,y1 = zip(*pos)
ax.scatter(x,y... | true |
c5e4ba60b409b977976f2d4d8222e943521df85a | antonioloison/wjsma | /attack/generate_attacks.py | UTF-8 | 3,370 | 2.890625 | 3 | [] | no_license | """
Generates the adversarial samples against the specified model and saves each attack in a single CSV file
"""
import tensorflow as tf
import pandas as pd
import numpy as np
from attack.saliency_map_attack import SaliencyMapMethod
from cleverhans.utils import other_classes
from cleverhans.utils_tf import model_a... | true |
c2a9fce46285fed8f679f54614d7c063ec9583d9 | cdriehuys/ultimanager-api | /ultimanager_api/account/tests/models/test_user_model.py | UTF-8 | 616 | 2.65625 | 3 | [
"MIT"
] | permissive | from account import models
def test_create_user(db):
"""
Test creating a new user.
"""
user = models.User(email='test@example.com')
user.save()
# Test defaults.
assert not user.email_verified
assert not user.is_staff
def test_get_full_name(user_factory):
"""
The user's full ... | true |
b0fdfe06c84d7e2a211ebf36c15ec739a630022f | gastondg/Tecnocom | /pruebas/line_detection.py | UTF-8 | 1,281 | 2.890625 | 3 | [] | no_license | import cv2
import numpy as np
nombre= "2019-11-05 16-04 rejilla1.avi"
cap = cv2.VideoCapture('./Videos/Videos/' + nombre)
print("Analizando " + nombre)
print()
band = False
while cap.isOpened():
# Capture frame-by-frame
ret, frame = cap.read()
if ret == True:
k = cv2.waitKey(1)
fr... | true |
f42dce96fd6b5f59d6d7e2acd9c0818f3bc5cf36 | HuangYin0514/reid-custom | /metrics/rank.py | UTF-8 | 1,896 | 2.640625 | 3 | [] | no_license |
import numpy as np
def compute_AP(a_rank, query_camid, query_pid, gallery_camids, gallery_pids, mode='inter-camera'):
'''given a query and all galleries, compute its ap and cmc'''
if mode == 'inter-camera':
junk_index_1 = in1d(np.argwhere(query_pid == gallery_pids), np.argwhere(query_camid == gallery... | true |
a488530529b1124b40fe316cecfb4497e000e305 | ajkannan/Classics | /Utilities/doc_intertext_txt_parser.py | UTF-8 | 2,637 | 3.015625 | 3 | [] | no_license | import sys
from pprint import pprint, pformat
import numpy as np
def parse_txt_file(filename):
text_input = open(filename, 'r')
first_line = True
results_dict = {}
first_line = True
last_line = False
current_line = ""
bhattacharyya_data = {}
while ")])]}" not in current_line:
current_line = te... | true |
478f799ed6993d631510d52f82c561b58f128693 | pauvrepetit/leetcode | /1424/main.py | UTF-8 | 846 | 3.640625 | 4 | [
"MIT"
] | permissive | # 1424. 对角线遍历 II
#
# 20200915
# huao
# 排序,就是有点慢
from typing import List
from functools import cmp_to_key
def cmp(x, y):
if x[0] == y[0]:
if x[1] > y[1]:
return -1
elif x[1] == y[1]:
return 0
else:
return 1
elif x[0] > y[0]:
return 1
else... | true |
92a3d6207b2db28fee4a3aae391d2a79ee32ce54 | EternalFeather/zh-NER-model | /data_loader.py | UTF-8 | 4,588 | 2.90625 | 3 | [] | no_license | import pickle, random
from collections import defaultdict
from string import punctuation as p
import re
tag2label = {'O': 0, 'B-VER': 1, 'I-VER': 2, 'B-ENG': 3, 'I-ENG': 4, 'B-NOR': 5, 'I-NOR': 6,
'B-OTH': 7, 'I-OTH': 8}
def build_vocabulary(vocab_path, corpus_path, min_count):
'''
Bu... | true |
fbc2e1afc3d7f98d7e11f2504bf02581de969b04 | kaundal7/Blockchain | /block.py | UTF-8 | 1,088 | 2.875 | 3 | [] | no_license | import hashlib
import time as t
def valid_noance(g_hash):
if g_hash[:4] == "0000":
return True
else:
return False
def cal_noance(pre_hash, c_hash):
noance = 0
guess = f'{pre_hash}{c_hash}{noance}'.encode()
g_hash = hashlib.sha256(guess).hexdigest()
while(not valid_noance(g_hash... | true |
48eb230fb38f6c3903c4087aeeea7518e21b7eff | tiagobratzheck/dtls-project | /entities/server.py | UTF-8 | 1,011 | 2.953125 | 3 | [] | no_license | import random
class Server(object):
def __init__(self, name):
self.name = name
def verifyHello(self, hello):
return "<<<<<<= Verify the " + hello + " hello... ", self.name
def serverHello(self):
return "<<<<<<= Hello from " + self.name + " ."
def sendCertificate(s... | true |
bcc9aac2e0d17d72066d12eec0515854d2ac8ab0 | fordownloads/pythonka | /pythonka_border.pyw | UTF-8 | 12,081 | 2.578125 | 3 | [] | no_license | from os import environ
from time import time
from scores import *
import pygame
import random
pygame.init()
PAD = 8
CELL = 30
FIELD = 20
SPEED_DEF = 5
DEBUG = False
COLLISION_OFF = False
FPS = pygame.time.Clock()
USERNAME = environ["USERNAME"]
apple_xy = [-1, -1]
max_score = {
2: 0,
4: 0,... | true |
fee23fe8599640737213a035e15d97eeb5e0cfcc | jsmith716/AlarmClock | /AlarmClock.py | UTF-8 | 6,403 | 3.265625 | 3 | [] | no_license | '''
This is just practice stuff.
Alarm clock that plays either the top trending YouTube video or a random video
from a local file named videolist.txt. The decision as to which to play is based
on user input when script is run.
The alarm clock does not terminate once the alarm triggers. Instead, it starts
over so ... | true |
7a85cf035294662df71eeeb4198887ca579f3fc3 | anjalie-kini/sublime-text-file-sync | /update_local.py | UTF-8 | 711 | 2.828125 | 3 | [
"MIT"
] | permissive | import sublime
import sublime_plugin
from .DropboxRequest import DropboxRequest
import os
class UpdateLocalCommand(sublime_plugin.TextCommand):
"""
Updates the local window with the file that is hosted on Dropbox.
"""
def run(self, edit):
current_dir = os.getcwd()
token = open(current_dir + "/sublime-text-fil... | true |
54ee1c3ab97fb25f8e124a5e1154f3907448393c | haowen-xu/tfsnippet | /tests/dataflows/test_gather_flow.py | UTF-8 | 1,098 | 2.625 | 3 | [
"MIT"
] | permissive | import unittest
import numpy as np
import pytest
from tfsnippet.dataflows import DataFlow
from tfsnippet.dataflows.gather_flow import GatherFlow
class GatherFlowTestCase(unittest.TestCase):
def test_flow(self):
x_flow = DataFlow.arrays([np.arange(10)], batch_size=4)
y_flow = DataFlow.arrays([np... | true |
6cc0175d5b86205751b10dd3c331d623eb5717e1 | hdelva/fosite | /examples/endless_loop.py | UTF-8 | 190 | 3.734375 | 4 | [] | no_license | def square(x, n):
if n == 0:
return 1
y = 1
while n > 1:
if n % 2 == 0:
x = x ** 2
#n //= 2
else:
y = x * y
x = x ** 2
n = (n-1) / 2
return x * y
square(500, 30) | true |
cc6401c3c29fd2fb6e8782d1ed4814bf0a27d24f | AyushSingh445132/What-I-have-learnt-so-far-in-Python | /6.0.Dictionary & It's Function Explained.py | UTF-8 | 1,006 | 4.65625 | 5 | [] | no_license | # Making a dicitionary?
dic1 = {'duck':'quack','cow':'mooh','tiger':'roar'}
print(dic1['cow'])
# Accesing Elements
# get vs [] for retrieving elements
my_dic = {'name':'Jack','age':'26'}
# Output : Jack
print(my_dic['name'])
# Output : 26
print(my_dic['age'])
... | true |
77736a50f37dfa4bbb82e8aa5c19dac6c2572773 | bhupender009sharma/python | /python_tutorials/classes_and_objects/classes_and_object.py | UTF-8 | 346 | 3.6875 | 4 | [] | no_license | class Enemy:
life = 3
def attack(self):
print("aaaa")
self.life-=1
def life_check(self):
if self.life>0:
print(self.life, 'life left')
else:
print("sended to valhalla")
enemy1 = Enemy()
enemy2 = Enemy()
enemy1.attack()
enemy1.attack()
enemy1.life_c... | true |
d66fad47b223403a0967d1d153db516d851a67b0 | Emmandez/The-Python-Mega-Course | /Seccion_14/exercise/multiWidget.py | UTF-8 | 715 | 3.375 | 3 | [] | no_license | from tkinter import *
window = Tk()
def convertKg():
grams = float(e1_value.get())*1000
pounds = float(e1_value.get())*2.20462
ounces = float(e1_value.get())*35.274
t1.insert(END, grams)
t2.insert(END, pounds)
t3.insert(END, ounces)
l1=Label(window,text="Kg")
l1.grid(row=0,column=0)
e1_value ... | true |
e4321d49765752c896d09f37a0c5fa28582cbce9 | galeanojav/Animal_foraging_model | /levy_flight.py | UTF-8 | 1,600 | 3.390625 | 3 | [] | no_license | #Simulating the Levy flight
import numpy as np
from matplotlib import pyplot as plt
x = np.array([0,0]) #origin
N = 2000 #number of steps
def polar_to_cart(r,theta):
#Converts polar coordinates to cartesian coordinates
z = r * np.exp( 1j * theta )
x_coord = np.real(z)
... | true |
0027108fbc41c731b882ec27efbb5077c62d96c2 | ShohruhAbduqayumov/Python_tutorial | /17.07.2021/klass1.py | UTF-8 | 297 | 3.28125 | 3 | [] | no_license | class Xodim:
def __init__(self, ism, fam, yosh):
self.ism = ism
self.fam = fam
self.yosh = yosh
s = Xodim("Shohruh", "Abduqayumov", 28)
a = Xodim("Oybek", "Narzullayev", 22)
print(s.__dict__)
print(a.__dict__)
print(s.ism, s.fam, s.yosh)
print(a.ism, a.fam, a.yosh)
| true |
35d1ddefafc5005ee9ee0fb0c7a86a05b29b7135 | sharnajh/csc101 | /python/net_pay/calcnet.py | UTF-8 | 1,075 | 4.53125 | 5 | [] | no_license | # CSC 101
# Sharna Hossain
# module for net_pay.py
def calculate_gross(hours, rate):
return float(hours * rate)
def calculate_net(gross, tax):
# Deduct taxes to calculate the net
gross -= float(gross * tax)
# Return gross
return gross
def get_info(tax):
# Create empty dictionary to store e... | true |
94e75d0a81490b6a23d18bd396a0c4593c7ada72 | JosephBushagour/CFU-Playground | /proj/mnv2_first/gateware/output.py | UTF-8 | 1,798 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/env python
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | true |
83ce7e793332212818f59d5334c710966d8db78b | PabloLanza/curso-python3 | /exercicios-python/curso-python/ex012.py | UTF-8 | 139 | 3.84375 | 4 | [
"MIT"
] | permissive | import math
num = float(input('Digite um número: '))
numint = math.floor(num)
print('A porção inteira de {} é {}' .format(num, numint)) | true |
81da3b7d65daeed10511145036bbaf049cc9205c | anurag5398/DSA-Problems | /Queue/NIntegers123.py | UTF-8 | 1,563 | 3.828125 | 4 | [] | no_license | """
Given an integer A. Find and Return first positive A integers in ascending order containing only digits 1, 2 and 3.
NOTE: All the A integers will fit in 32 bit integer.
"""
class Queue:
def __init__(self, size):
self.size = size
self.queue = [None]*self.size
self.r , self.f = -1, -1
... | true |
2e901ddb9603f66480e0432f491668950f250381 | tiagosm1/Python_Nilo_Ney | /exercicios_resolvidos3/exercicios3/capitulo 04/exercicio-04-09.py | UTF-8 | 894 | 3.734375 | 4 | [
"MIT"
] | permissive | ##############################################################################
# Parte do livro Introdução à Programação com Python
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2020
# Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8
# Segunda edição - Junho/2014 - ISBN 978-85-7522-408-3
# Terce... | true |
f066fbf9e3519b046d08b66bb0e73bc2815ca97e | nirtiac/RedditAccommodation | /cohesion.py | UTF-8 | 1,934 | 3.703125 | 4 | [] | no_license | __author__ = 'Sunyam'
from nltk import pos_tag
from nltk.tokenize import word_tokenize
import random
'''
Input:
C: stylistic dimension
turns: list of tuples where each tuple is a reply-pair
Output:
Cohesion value
'''
def cohesion_value(C, turns):
total_number_of_turns = len(turns)
turns... | true |
5cba1ae61cd94e3715bf838da2c109268056a402 | BStob/Python-programs | /Lab4/Lab4ex4.py | UTF-8 | 473 | 3.859375 | 4 | [] | no_license | def getPort():
x = int(input("Please enter a TCP port number: "))
return x
def isValidPort(x):
if x >= 1 and x <= 1023:
return "True"
else:
print("Invalid Port Number")
return "False"
def displayPort(x):
print("The entered port number was:", x)
def main():
validCheck = "... | true |
30f9e70ca4f6c29240553bb49ee00fe6f41d0133 | jinwoo1225/ProblemSolving | /1189.py | UTF-8 | 668 | 2.765625 | 3 | [] | no_license | R, C, K = map(int, input().split())
board = [input() for _ in range(R)]
visited = set()
visited.add((R - 1, 0))
moves = []
DY = (0, 0, 1, -1)
DX = (1, -1, 0, 0)
def dfs(y, x, move):
global R, C
if y == 0 and x == C - 1:
moves.append(move)
return
for t in range(4):
next_y = DY[t... | true |
86259cf77a2a4d5e3d1569ae9fdd146ec005bc0c | abielzulio/math | /math.py | UTF-8 | 5,360 | 3.734375 | 4 | [] | no_license | import numpy as np
import pandas as pd
from math import sqrt
def narcissistic(n):
print("[NARCISSISTIC CHECKER PROGRAM]", "\n")
cacah = len(str(n))
listnarsis = []
for i in str(n):
narsis = int(i) ** cacah
listnarsis.append(int(narsis))
narsistik = sum(listnarsis)
if nar... | true |
1ab65d67bb90cc4547839241bf7b3dcb6b78dfd0 | alexchungio/Tensorflow-Learning-Advance | /Image_Processing/base64_process.py | UTF-8 | 2,185 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @ File Inception_v1.py
# @ Description :
# @ Author alexchung
# @ Time 29/10/2019 AM 10:29
import os
import base64
import numpy as np
import cv2 as cv
origin_path = os.getcwd()
data_path = '/home/alex/Documents/datasets/flower_photos/sunflowers'
image_path = os.path.jo... | true |
e48ac2d04a13bc333660564a7a8997d34ef9db97 | ddeveloper72/mongodb | /02_mongo_insert.py | UTF-8 | 778 | 2.765625 | 3 | [] | no_license | import os
import pymongo
from dotenv import load_dotenv
load_dotenv()
MONGODB_URI = os.getenv("MONGO_URI")
DBS_NAME = "mytestdb"
COLLECTION_NAME = "myFirstMDB"
def mongo_connect(url):
try:
conn = pymongo.MongoClient(url)
print("Mongo is connected!")
return conn
except pymongo.errors... | true |
6c316cb9e4ad452412b57c2fecc8ebc97171c8a7 | shantanudwvd/PythonHackerrank | /Simple_Binary.py | UTF-8 | 587 | 3.34375 | 3 | [] | no_license | def subString(Str, n):
myList = []
for Len in range(1, n + 1):
for i in range(n - Len + 1):
j = i + Len - 1
temp = ""
for k in range(i, j + 1):
temp += Str[k]
myList.append(temp)
myList.remove(Str)
ct = 0
for i in set(myList):
... | true |
dc9025c4d4a54199f54811d543c3f38db7600c01 | RohiniKamble10598/Python_tut | /07_pr_02.py | UTF-8 | 355 | 3.53125 | 4 | [] | no_license | m1 =int(input("Enter marks of sub_1\n "))
m2 =int(input("Enter marks of sub_2\n"))
m3 =int(input("Enter marks of sub_3\n "))
if(m1<33 or m2<33 or m3<33):
print("You Are FAil due to percentage less than 33")
elif(m1+m2+m3)/3 < 40:
print("you are fail due to percentage less than 40")
else:
print... | true |
f5b0d60164a71217e1f3bcfb71409c5a87907506 | johnzhoudev/python-citations-helper | /citations/auto_table_3.py | UTF-8 | 679 | 2.90625 | 3 | [] | no_license | #! /opt/anaconda3/bin/python
import pyperclip
# Open file containing input and read
table_data_file = open('./auto_table_3.txt', 'r')
table_data = table_data_file.readlines()
table_data_file.close()
table_str = ""
for i in range(len(table_data)):
#split by "-"
strings = table_data[i].split("–")
rest = ... | true |
afbaf408e6c84faf7126ebecbdc17ad8d8cfef66 | up276/YouTubeAnalyzer2K15 | /YoutubeAnalysis/DataExplorer.py | UTF-8 | 4,884 | 3.21875 | 3 | [] | no_license | '''
Created on Dec 5, 2015
@authors: urjit0209,vec241, mc3784
'''
import sys
import matplotlib.pyplot as plt
import DataPlotter as dataplotter
import time
class DataStatistics():
features = {"1":"viewCount", "2":"likeCount", "3":"dislikeCount", "4":"favoriteCount","5":"commentCount","6":"dimension", "7":"definit... | true |
08df6cc8724195dece987b50a4d381458d0e4367 | faiz-lisp/Python-useful | /markdowntohtml/markdowntohtml.py | UTF-8 | 802 | 3.046875 | 3 | [
"MIT"
] | permissive | import sys
import argparse
import markdown
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--filename', help='你的markdown文件名(.md为后缀).')
parser.add_argument('-o', '--output', default='output.html',
help='输出的html文件名(.html为后缀),默认名为output.html.')
args = parser.parse_args()
# check argume... | true |
5c7803c42880606b02e8b4f00c7442ba657d4538 | KronosOceanus/python | /recproject/goods/recpack/popular.py | UTF-8 | 830 | 2.53125 | 3 | [] | no_license | from goods.utils.recUtils import *
# 2. 热门推荐
def MostPopular(user, train, N):
items = {}
for user in train:
for item in train[user]:
if item not in items:
items[item] = 0
items[item] += 1
# 随机推荐N个没见过的最热门的
user_items = set(train[user])
rec_items = {k... | true |
64ab5164bd2d2e251a0f358bcbe2bdda0f01a88e | Pleiades0428/PythonLearning | /pleiades/02io_pleiades.py | UTF-8 | 227 | 3.625 | 4 | [
"MIT"
] | permissive | #learn print
print('Hello Python3 IO.')
print('This', 'is', 'Python3')
print('150 + 250 =', 100 + 200)
#learn input
print('What''s your name?')
name = input()
print('Hello,', name)
#practice
print('1024 * 768 =', 1024 * 768)
| true |
67fde2e47555bcf210e7dc0d3470316c1ca76b50 | opencfdtraining/adv-intro-cfd-2012 | /project/plot_history.py | UTF-8 | 3,935 | 2.796875 | 3 | [] | no_license | """Tool to plot the history of a run using history.tec files.
This file is used for make some plots in the report of iterative
residuals.
"""
import numpy as np
import matplotlib.pyplot as plt
## Where to save things
save_dir = '/home/isaac/Desktop/adv-intro-cfd-2012/project/report/figs/'
save_figures = True
g... | true |
0a9d13e3695a47cf8010009dabeb6ba0cd400acd | taketakeyyy/atcoder | /abc/057/b.py | UTF-8 | 707 | 3.046875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
def solve():
N, M = list(map(int, input().split()))
start = []
for i in range(N):
a, b = list(map(int, input().split()))
start.append((a, b))
checkpoints = []
for i in range(M):
c, d = list(map(int, input().split()))
checkpoints.append((c,... | true |
c1556bc48bf8a60df9fc00264bd6eca76a44baae | Bigscholar/python- | /第五章/字符串反转.py | UTF-8 | 120 | 3.0625 | 3 | [] | no_license | def rsv(s):
if s == '':
return s
else:
return (rsv(s[1:])+s[0])
s='abc'
rsv(s)
print(s)
| true |
409a8d357e6e5ca2881125b08c74cd3cbfc947ac | sergeant-wizard/slack_logger | /slack_logger/slack_logger.py | UTF-8 | 798 | 2.59375 | 3 | [] | no_license | import json
import logging
import platform
import requests
class HostnameFilter(logging.Filter):
hostname = platform.node()
def filter(self, record):
record.hostname = HostnameFilter.hostname
return True
class SlackHandler(logging.Handler):
def __init__(self, url: str) -> None:
... | true |
5cc06bc348a65d870a9da70806fd84fcc9e86cbc | samblau/pymatgen | /pymatgen/io/tests/test_core.py | UTF-8 | 7,499 | 2.65625 | 3 | [
"MIT"
] | permissive | from __future__ import annotations
import copy
import os
import pytest
from monty.serialization import MontyDecoder
from pymatgen.core.structure import Structure
from pymatgen.io.cif import CifParser, CifWriter
from pymatgen.io.core import InputFile, InputSet
from pymatgen.util.testing import PymatgenTest
test_dir ... | true |
cbe81e3eda3a161837af167d05b23a38a98a7619 | james-rae/iStealPolys | /thief.py | UTF-8 | 1,137 | 2.8125 | 3 | [] | no_license | # steal some geometry
import arcpy
import json
# A list of features and coordinate pairs (raw arrays)
feature_info = []
print "eating polygons..."
# open a file
with open('rawdata.json') as json_file:
rawjson = json.load(json_file)
# crawl through the json, and extract all the separate polygons into one
# nice... | true |
74413d1d83440c8362793580b3b15341bf8ea5ca | rafaelmakaha/competition-programming | /codeforces/tep/contest/05contest/e.py | UTF-8 | 519 | 2.6875 | 3 | [] | no_license | def solve():
a = [x for x in input()]
b = [x for x in input()]
tam = len(a)
if tam % 2 != 0:
# print("aqui")
return print("NO")
if ''.join(a) == ''.join(b):
return print("YES")
mid = tam//2
a1 = a[:mid]
a2 = a[mid:]
b1 = b[:mid]
b2 = b[mid:]
# print(a1... | true |
9ad0e75b662b9e38d6308a0ce49a5812f881af38 | siegltomas/xsiegl_PV248 | /02-classes/scorelib.py | UTF-8 | 9,200 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
import re
class Print:
def __init__(self, edition, print_id, partiture):
self.edition = edition
self.print_id = print_id
self.partiture = partiture
def format(self):
print("Print Number:", self.print_id)
self.composition().format()
self.e... | true |
02a2cf958c9a5d5a7311c76af2f5df42429b6f40 | naren-m/programming_practice | /leetcode/26-Remove-Duplicates-from-Sorted-Array.py | UTF-8 | 1,015 | 3.78125 | 4 | [] | no_license | # https://leetcode.com/problems/remove-duplicates-from-sorted-array/
# https://leetcode.com/explore/learn/card/fun-with-arrays/526/deleting-items-from-an-array/3248/
class Solution:
def search(self, nums, target):
l = 0
r = len(nums)
return self.binarySearch(l, r, nums, target)
... | true |
75107fcb8c0398c3bb8863b12aab5dc7c36781fc | shirshir05/Learn-Team-10 | /our_model.py | UTF-8 | 14,416 | 2.875 | 3 | [] | no_license | from datetime import datetime
import pandas as pd
from pandas.api.types import is_numeric_dtype
# https://machinelearningmastery.com/feature-selection-machine-learning-python/
from random_forest import random_forest
class our_model:
def __init__(self):
self.country_dataframe = None
self.league_d... | true |
9db8b4314a53c9e61c97894fb628aa22a609f545 | oddrune/dotfiles | /bin/space_to_underscore.py | UTF-8 | 284 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
import os, glob, sys
try:
replace_char = sys.argv[1]
assert len(replace_char) == 1
except:
replace_char = "_"
for oldname in glob.glob("*"):
newname = oldname.replace(" ", replace_char)
if newname != oldname:
os.rename(oldname, newname)
| true |
bf6a63dbee2aadecdb5cfbcaee6553a180260539 | binoy-d/chess-bot | /bot.py | UTF-8 | 607 | 2.609375 | 3 | [] | no_license | # bot.py
import os
import discord
from dotenv import load_dotenv
from discord.ext import commands
from cog import Chess
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
GUILD = os.getenv('DISCORD_GUILD')
bot = commands.Bot(command_prefix = '[]')
@bot.event
async def on_ready():
for guild in bot.guilds:
... | true |
0cbd16a2ed0d0c3700316d94f8ebffb9e23a5aca | Gauravjsh127/python-learnings | /9-strings-leetcode/4-valid-anagram.py | UTF-8 | 883 | 3.71875 | 4 | [] | no_license |
"""
Valid anagram
Given two strings s and t , write a function to determine if t is an anagram of s.
Example 1: Input: s = "anagram", t = "nagaram" Output: true
Example 2: Input: s = "rat", t = "car" Output: false
Source:
https://leetcode.com/explore/featured/card/top-interview-questions-easy/127/strings/882/
""... | true |
b21ce305f54b0a67ce7f11d1556c8fcad5b94af8 | nagyist/dhis2-utils | /tools/dhis2-data-time-shifter/populate_period_table.py | UTF-8 | 5,981 | 2.75 | 3 | [] | no_license | import json
import chardet
from dhis2 import Api, RequestException, setup_logger, logger, is_valid_uid, generate_uid
from re import match, findall, compile, search, sub
from datetime import date, datetime, timedelta
# Date in format yyyy-mm-dd
def get_periods(frequency, start_date, end_date):
# datetime.strptime(... | true |
cc60c9b8cd48f4bd216bb34ce8d99b42f95bd45d | adityauj/Hybrid-Distributed-Intrusion-Detection-System | /module/Extras/ensembletest.py | UTF-8 | 1,110 | 2.671875 | 3 | [] | no_license | from sklearn.ensemble import VotingClassifier
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
from s... | true |
2b7fe86dc213db65185c56c6f15a1ddd7b8d1d1e | salvador-dali/algorithms_general | /interview_bits/level_4/04_backtracking/04_permutations/01_permutations.py | UTF-8 | 1,073 | 3.453125 | 3 | [] | no_license | # https://www.interviewbit.com/problems/permutations/
from math import factorial
def next_permutation(arr):
for i in xrange(len(arr) - 1, 0, -1):
if arr[i] > arr[i - 1]:
break
will_change = arr[i - 1]
bigger = min(el for el in arr[i:] if el > will_change)
last = [el for el in arr[... | true |
b0089f032aaf00abd6e74bf9bdf0f5a5259eb8ac | ruben-lou/design-patterns | /structural-patterns/proxy.py | UTF-8 | 1,161 | 3.890625 | 4 | [] | no_license | import time
class Producer:
"""Define the 'resource-intensive' object to instantiate"""
@staticmethod
def produce():
print("Producer is working hard!")
@staticmethod
def meet():
print("Producer has time to meet you now!")
class Proxy:
"""Define the relatively less resource-in... | true |
59099266029516ff41ae65cf062f9d3688888ae3 | zylkowski/CarDQN_ECS | /src/data/systems/DQNSystems/DQNStateUpdateSystem.py | UTF-8 | 4,231 | 2.578125 | 3 | [] | no_license | import ecs
import data.components.DQNComponents as DQNComponents
import data.systems.game_state_system as game_state_system
import data.components.segment as segment
import data.components.physics as physics
import torch
import numpy as np
class DQNStateUpdateSystem(ecs.System):
def __init__(self):
super(... | true |
94297acafde4be2585808e5cff203aa59c62998d | haole1683/Python_learning | /Python/2019-8-12-py构造+析构.py | UTF-8 | 1,451 | 3.078125 | 3 | [] | no_license | Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> class CapStr(str):
def __new__(cls,string):
string = string.upper()
return str.__name__(cls,string)
>>> a = CapStr('I Love')
Tra... | true |
0f6c1aada482525bb9acefde42964d87d5634a2d | Prasanna25-png/Assignments_Skillsanta | /swap.py | UTF-8 | 122 | 2.625 | 3 | [] | no_license | list1=[4,17,83,6,8,3,8]
Temp=list1[0],list1[1]
list1[0],list1[1]=list1[-1],list1[-2]
list1[-1],list1[-2]=Temp
print(list1) | true |
e15f2e968ad93feb25018ab69c6a23e8622bed53 | superjax/NNOA | /construct/src/agents/ddpg/memory.py | UTF-8 | 5,609 | 2.59375 | 3 | [] | no_license | """Code from https://github.com/tambetm/simple_dqn/blob/master/src/replay_memory.py"""
import random
import numpy as np
from threading import Lock
from collections import deque
from construct import GazeboEnvironment
class Memory:
def __init__(self, phi_frames, replay_memory_size, environment):
odo_space, ... | true |
760ae80f7854396ea15fa3d29c60c2b9a4e658b4 | jeanlucshaw/mxtoolbox | /read/wod.py | UTF-8 | 8,286 | 3.0625 | 3 | [] | no_license | """
Python functions to access/manipulate world ocean database ragged arrays.
"""
import xarray as xr
from numpy import isfinite, nan, ones_like
import gsw
__all__ = ['wod_cast_n']
def wod_cast_n(rag_arr,
n,
var_names=['Temperature', 'Salinity'],
anc_names=None,
... | true |
e4bb7a3454f7ed522b5b894f38144e953d32a7e4 | leonhard2004/SnakeKI | /snake_KI.py | UTF-8 | 5,332 | 3.34375 | 3 | [] | no_license | import pygame as pg, random as rnd
from snake_learn import lernen #gibt infos am ende des Programms an den Kopf der KI.
screen = pg.display.set_mode([1000, 600])
import math
def diagonaler_abstand(abstand_1, abstand_2):
diagonale = abstand_1, abstand_2 #abstand_1 und abstand_2 werden auf die kleinere Z... | true |
b5fcbb10178ec3b162946b430ebdce816f8f8430 | dogilla/Inteligencia-Artificial | /Snake/snake.py | UTF-8 | 8,811 | 3.34375 | 3 | [] | no_license | import math
import random
from random import randint
import pygame
import tkinter as tk
from tkinter import messagebox
class Cuadro(object):
""" clase que representa un cuadro del tablero de juego"""
filas = 20
w = 500
def __init__(self,inicio,dirnx=1,dirny=0,color=(255,0,0)):
self.pos = inici... | true |
6c020ac54ed441c3fd3e41eb2f732f4e5ec0bfee | Zhangyang12138/API | /LearnRequests/07.设置代理.py | UTF-8 | 332 | 2.6875 | 3 | [] | no_license | '''
1、爬虫之类的场景,避免服务器认为是攻击,将IP屏蔽掉
2、代理抓包,定位问题
'''
import requests
proxy={
"http":"http://127.0.0.1:8888",
"https":"http://127.0.0.1:8888"
}
r=requests.get("http://www.httpbin.org",proxies=proxy)
print(r.status_code)
print(r.text)
| true |
4feecf486c130cc5d62fa9715fa651423670aa87 | openclosebrackets/scikit-learn-tests | /tutorials/regression/linear/python/main_ridge_regression.py | UTF-8 | 1,008 | 3.046875 | 3 | [
"MIT"
] | permissive | from classes import *
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
import numpy as np
def error(ypred, ytarg):
return 100 - 100 * np.dot(ypred, ytarg) / np.dot(ytarg, ytarg)
if __name__ == '__main__':
boston_dataset = load_boston()
y = boston_dataset.targ... | true |
b88d9a856ec1451a6f376c14c5ed2871fe367286 | techguy16/Logitech-G203-Lightsync-RGB | /etc/ltunify-logs/converter.py | UTF-8 | 244 | 2.984375 | 3 | [] | no_license | import sys
if (1>=len(sys.argv)):
exit()
with open(sys.argv[1], 'r') as data:
plaintext = data.read()
plaintext = plaintext.lower()
plaintext = plaintext.replace(' ', '\\x')
plaintext = plaintext.replace(' ', '\\x')
print(plaintext)
| true |
b7c8a3217cc521ebe43e33b8dac058e9e453b55c | zivatar/thesis | /climate/classes/Year.py | UTF-8 | 247 | 3.3125 | 3 | [] | no_license | class Year:
"""
| Utilities for handling years
"""
@staticmethod
def get_months_of_year():
"""
Get the months of the year
"""
a = []
[a.append(i) for i in range(1, 13)]
return a
| true |
94789a696a5d02a4ff28294b980212fe1730e33b | tectronics/extensiblesimulationofplanetsandcomets | / extensiblesimulationofplanetsandcomets --username lasxrcista/Body.py | UTF-8 | 858 | 2.515625 | 3 | [] | no_license | from BaseBody import BaseBody
from OpenGL import *
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
class Body(BaseBody):
'This represents a celestial body, its attributes and functions/methods'
def __init__(self, bodyName, bodyRadius, bodyMass, bodyRedColor, \
bodyGreen... | true |
0e3189268289a5003ce8b8511aaeb12d1ff4672f | nickfang/classes | /udemy/pythonBuildDataAnalysisProgram/workingWithFiles.py | UTF-8 | 818 | 2.625 | 3 | [] | no_license | # file=open("testing.txt",'w')
# file.close()
import os
# dir(os)
# dir(os.path)
# help(os.path)
print(os.getcwd())
os.chdir("c:\\users\\nfang\\repos\\classes\\udemy\\pythinbuilddataanalysisprogram")
os.makedirs
# to allow for cross platform
fullpath = ""
filename=os.path.basename(fullpath)
#only filename
os.pat... | true |
537d0d8f23eecc46dccbedc945d76485033452ff | MyNameIsSevin/HHBK_Chemicals | /Klassendiagramm und PAP mit Geter und While TimeSleep Verzweigung Zeitmessung 201110.py | UTF-8 | 3,084 | 2.71875 | 3 | [] | no_license | #import time
class Ventil:
def oeffnen(self):
ausgangVentil=1
def schliessen(self):
ausgangVentil=0
class Ruehrer:
def ruehrenEin(self):
ausgangRuehrer=1
def ruehrerAus(self):
ausgangRuehrer=0
class Temperatursensor:
def __init__(self):
self.__Solltemper... | true |
e340405e8df76be322c14ee6d9bc996c1cac81c3 | vinicius-gadanha/python-courses-cev | /MUNDO 3/ex091.py | UTF-8 | 578 | 3.703125 | 4 | [] | no_license | from random import randint
from time import sleep
from operator import itemgetter
rank = list()
jogo = dict()
print('=' * 30)
print('Valores sorteados:')
for c in range(1, 5):
jogo[f'Jogador{c}'] = randint(1, 6)
print(f' O Jogador{c} tirou: {jogo[f"Jogador{c}"]}')
sleep(0.4)
print('=' * 30)
... | true |
628c7e6bdaf3a690c84c9f511fae753fc2a31b8d | judiths1618/experiment20171120 | /first/gantt_data.py | UTF-8 | 5,879 | 2.578125 | 3 | [] | no_license | import csv
import re
# csv_file = '.\\datafile\\res.csv'
def pid_num(csv_file):
"""
返回进程号列表
:param csv_file: 输出文件
:return: 进程号(相当于虚拟机标识)
"""
with open(csv_file, newline='') as f:
reader = csv.DictReader(f)
pid_num = [row['pid_num'] for row in reader]
return pid_num
def vm_... | true |
0054cbd10faf5e5f5557f81d66946535f634819f | ShekarBrahma/irritating-doggo | /Victim/crypto/crypto.py | UTF-8 | 2,353 | 3.328125 | 3 | [] | no_license | import os
from Crypto import Random
from Crypto.Cipher import AES
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
def encrypt_file(file_name):
"""
Encrypts the given file using AES.
:param file_name: file to be encrypted
"""
with open(file_name, 'rb') as f:
text = f.r... | true |
64dae5ec04dd0194252e64473550331cf60afc25 | Enfors/syscond | /check/lib/loadavg | UTF-8 | 396 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python3
yellow_threshold = 4.0
red_threshold = 6.0
with open("/proc/loadavg") as f:
line = f.readline()
words = line.strip().split(" ")
load_avg = float(words[1])
if load_avg > red_threshold:
cond = 2
elif load_avg > yellow_threshold:
cond = 1
else:
cond = 0
print("%d\tThe load a... | true |
0e521296ef4ded1c53b61ccfa50a74f5fab92e43 | liangguoru/AItrade | /pairtrade.py | UTF-8 | 2,630 | 2.546875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.tsa.stattools import adfuller
from statsmodels.tsa.stattools import coint
def find_date_index(pd,value):
return pd.date[pd.date == value].index.tolist()[0]
def plot_data():
# a_price = pd.read_csv('./data... | true |
d4c5b8e79bf5615cfba2abef1cffa1b39bcb91c0 | ronykeller/Sales-prediction-Model-Lstm-D-L-small-Data | /miniproject-renew.py | UTF-8 | 17,806 | 3.234375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 27 14:12:28 2021
@author: Rony's PC
"""
"""
0.
Table of Contents:
------------------
1. whether small data tabular could be predictable ?
2. Libraries to import.
3. Managinig the place dic in Cach memory.
4. Load and check data.
... | true |
7c5592dfdb156dcc4f8ac63da0935200073340e7 | Markovskij/i2pd-tools | /baddiefinder/baddiefinder/filter.py | UTF-8 | 889 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive |
from . import util
class Filter:
name = "unnamed filter"
def process(self, info):
"""
process an info and return a string representation of a reason to add to blocklist
any other return value will cause this info to NOT be added to blocklist
"""
class FloodfillFilter(Fil... | true |
784ecab8ceb0d315514db1415174cab9718aa263 | wdzxy7/Fast-Select-Data | /test_air.py | UTF-8 | 2,180 | 2.515625 | 3 | [] | no_license | import single_test as st
import pymysql
from pandas import DataFrame
from sqlalchemy import create_engine
import sql_connect
if __name__ == '__main__':
sql_con = sql_connect.Sql_c()
sql2 = 'TRUNCATE TABLE unknown_data.dbscan_result;'
sql6 = 'TRUNCATE TABLE unknown_data.avg_dbscan_result;'
clear_sql = ... | true |
a71a1798270ba5bd75588e78fd1eb95306d36f87 | Lokesh-Jothivincent/AppliedMath_Lab | /StandardLibrary/problem_1.py | UTF-8 | 247 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""Python Essentials: The Standard Library.
<Name> Lokesh
<Class> Mth 520
<Date> 1/22/21
"""
def list_out(L):
return (min(L),max(L),sum(L)/len(L))
if __name__ == "__main__":
print(list_out([1,2,3,4,5])) | true |
c24e882dafce1b34d3fb96f61d53b3bc3e39d435 | bsridatta/jina-hub | /encoders/image/VSEImageEncoder/__init__.py | UTF-8 | 3,537 | 2.578125 | 3 | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] | permissive | __copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
import numpy as np
from jina.executors.decorators import batching, as_ndarray
from jina.executors.encoders.frameworks import BaseTorchEncoder
class VSEImageEncoder(BaseTorchEncoder):
"""
:class:`VSEImageEnc... | true |
5b4a286a8ded88c3d7f7a70cdfb73391d0764042 | rileyvanderbyl/orbit | /initpos_to_orbit.py | UTF-8 | 3,872 | 2.734375 | 3 | [] | no_license | import numpy as np
import quat
def initpos_to_orbit(r_vec,v_vec,mu):
#r_vec is a vector giving cartesian coordinates of orbiting object,
#v_vec is velocity
#mu is gravitational parameter of object being orbited (=G * mass of object)
#angular momentum vector, points perpendicular to plane of orbit
h_vec = np.cros... | true |
2ae8b33ebfe0f955165a91c3b9ad3f1a66c6f2f3 | moustafa85/Udacity-Project01 | /bikshare.py | UTF-8 | 12,752 | 3.734375 | 4 | [] | no_license | import time
import pandas as pd
from os import system, name
CITY_DATA = {'chicago': 'chicago.csv',
'new york city': 'new_york_city.csv',
'washington': 'washington.csv'}
days = ['saturday', 'sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'all']
months = ['january', 'february'... | true |
48f0babc3d28632fd9b02d2ec00575d884a241f3 | jasnei/opencv_pysimple_image_display | /pysimplegui_opencv_displayimage.py | UTF-8 | 7,531 | 3 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 8 19:47:08 2020
@author: AlbertYang
jasnei@163.com
version v1.0
"""
import PySimpleGUI as sg
import cv2
import numpy as np
"""
Demo program that displays image using OpenCV and applies some very basic image functions
- functions from top to bottom -
... | true |
6ef690a33586baa038f4e94ed5d6ccbdc3567337 | duongcao74/PythonHW | /hw6/homework6.py | UTF-8 | 10,358 | 3.71875 | 4 | [] | no_license | # ----------------------------------------------------------------------
# Name: homework6
# Purpose:
#
# Author(s): Haitao Huang, Duong Cao
# ----------------------------------------------------------------------
"""
Implement four Python classes to represent and manipulate items sold by
a fictional online store.
... | true |
d95134133431614fc29f158dd3fc93489d3458c6 | SyllPierre/Licence-Informatique | /L2/S3/AP/TP2AP2/Recursion/src/fractals.py | UTF-8 | 1,808 | 3.296875 | 3 | [] | no_license | from turtle import *
up()
goto(-280,100)
down()
speed(10)
color("blue")
def koch(l, n):
"""
Trace with turtle a curve of Van Koch.
:param l: number (int or float)
:param n: number (int)
"""
if n == 0:
forward(l)
else:
koch(l/3, n-1)
left(60)
koch(l... | true |
ebcec99d3215398cc3548391a15253bf04a6821c | nehay06/AngryBirds | /bird/Bird.py | UTF-8 | 808 | 2.609375 | 3 | [] | no_license | import constants.Constants as constants
import utils.Utils as utils
class Bird:
def __init__(self):
#self._makeBird()
self._testing_makeBird()
def _makeBird(self):
self.id = constants.BirdConstants.DEFAULT_BIRD_ID
self.duration = utils.getInRange(constants.BirdConstants.MIN_DU... | true |
45ce3f2ceb245c7ce4961171ea9955cd52dd16ba | LightSys/kardia-text-indexing | /sanity_check.py | UTF-8 | 1,787 | 2.765625 | 3 | [] | no_license | import data_access
import fnmatch
import tokenizer
import os
import importers.txt_importer as txt
import importers.pdf_importer as pdf
import importers.doc_importer as doc
data_accessor = data_access.MySQLDataAccessor()
occ_counts = {}
line_counts = {}
for occ in data_accessor.get_all_occurrences():
if occ.docume... | true |
75e3c2c8729e2f6e5712dd438a3660508f8e8f7e | codenara/Exin1 | /So2/Python1/Python1.py | UTF-8 | 671 | 3.125 | 3 | [
"MIT"
] | permissive | # Open & Read Excel File
# pip install pywin32
import win32com.client
# Initialize the Excel Application object
exApplication = win32com.client.Dispatch("Excel.Application")
# Set Visible property to true
exApplication.Visible = True
# Open Workbook
exWorkbook = exApplication.Workbooks.Open(r"c:\Work\test2.xlsx")
... | true |
e71283c2d4453ca2e060f87ad06e7c8b6c0860dd | markliammurphy/TemporalNetworks | /TimeVaryingNetwork.py | UTF-8 | 15,448 | 3.046875 | 3 | [] | no_license | import networkx as nx
import numpy as np
import itertools
import matplotlib.pyplot as plt
from scipy import sparse
from mpl_toolkits.mplot3d import Axes3D
import math
def time_plot(func):
'''
Decorator function for plotting global attributes over time
:param func: plotting function
:return: modified p... | true |
b36a0c6321309cd115acdb51ff91901ac1006f74 | PrivacyEngineering/timse | /app/purpose.py | UTF-8 | 516 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Purpose:
CHECK_IDENTITY = 'Check identity'
CHECK_CREDITWORTHINESS = 'Check Creditwothiness'
CHECK_HEALTH_STATUS = 'Check health status'
CHECK_INTEGRITY = 'Check integrity'
def OTHER(self, abbreviation, full_... | true |
970aaa20833991dd4bff5a50b2819d99a6fc8371 | autozimu/projecteuler | /054/main.py | UTF-8 | 6,012 | 3.3125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import numpy as np
valueL = np.array(['2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'])
colorL = np.array(['C', 'D', 'H', 'S'])
def cards(cs):
"""Parse cards"""
cs = cs.split(' ')
result = np.zeros([len(valueL), len(colorL)], int)
for c in cs:
result[np.w... | true |