blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
0e916e2c5c21fa90619c5a498a3f02adb866766d | Python | NewFrenchDev/Coding-Project | /Code python/Script/Trier_fichier.py | UTF-8 | 828 | 2.890625 | 3 | [] | no_license | import shutil
import glob
import os
import time
#path
CUR_DIR = os.path.dirname(__file__)
#Files extension
extensions = {".mp3": "Musique",
".wav": "Musique",
".mp4": "Videos",
".avi": "Videos",
".jpeg": "Images",
".jpg": "Images",
".... | true |
ae210e9cc2991c3923baf123520b633ffc85a1b3 | Python | jm-avila/REST-APIs-Python | /Refresher/06_advanced_set_operations/code.py | UTF-8 | 431 | 3.875 | 4 | [] | no_license | art = {"Bob", "Jen", "Rolf", "Charlie"}
science = {"Bob", "Jen", "Adam", "Anne"}
# difference takes one set and removes the items found at passed set.
onlyArt = art.difference(science)
onlyScience = science.difference(art)
print("only Art", onlyArt)
print("only Science", onlyScience)
print()
# intersection takes one... | true |
0e15b6e8a15f34ec7cdb7e7c3c13ef38d955352d | Python | JGilstrap1/Sportsbook | /exe/SportsBook.py | UTF-8 | 37,040 | 2.765625 | 3 | [] | no_license | import pandas as pd
from pandas import DataFrame
import numpy as np
from tkinter import *
from tkinter import ttk
import statistics
import cmath
root = Tk()
root.title('NHL Prediction Calculator')
root.iconbitmap('/Users/jimbo/Documents/Sportsbook/exe/Skating.ico')
root.geometry("600x1000")
def webScrapeTeamStatsUrl(... | true |
ab3478fbda20466fc7ea7e0121b3867724b60175 | Python | dantin/daylight | /dcp/045/solution.py | UTF-8 | 584 | 3.53125 | 4 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
import random
def rand5():
return random.randint(1, 5)
def rand7():
while True:
num = 5 * (rand5() - 1) + (rand5() - 1)
if num < 21:
return num % 7 + 1
if __name__ == '__main__':
count = 10 ** 6
result_dict = {}
for _ in range(count):
... | true |
5786c068e4f55b1e2d683103a1d2f43ac54dc00a | Python | claying/state-space-energy | /period.py | UTF-8 | 1,725 | 3.4375 | 3 | [] | no_license | import numpy as np
def weekends_array(T):
T1 = 95
T_we = 48
T_wd = 120
weekends = []
for i in range(T):
if i > T1 and (i-T1-1)%168<T_we:
weekends.append(True)
else:
weekends.append(False)
weekends = np.array(weekends)
workdays = np.invert(weekends)
return weekends, workdays
def days_array(T):
T_da... | true |
dc5d54f56c22785f00a277b3730982ca70fe654b | Python | demongolem/MultilevelSentiment | /CharLSTMSentiment.py | UTF-8 | 9,001 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
'''
Created on Sep 19, 2018
@author: g.werner
'''
import Config
import json
from lib_model.bidirectional_lstm import LSTM
import logging
import nltk
from nltk import Tree
from nltk.tokenize import sent_tokenize, word_tokenize
import os
from os import listdir
from os.path import... | true |
8bb363f298f22a6c70291075d6e6769d698a3ca5 | Python | Jonsm/Data_analysis | /T2R_loop_fit.py | UTF-8 | 2,618 | 2.609375 | 3 | [] | no_license | from matplotlib import pyplot as plt
import numpy as np
import h5py
from scipy.optimize import curve_fit
from scipy.optimize import OptimizeWarning
import warnings
warnings.simplefilter("error", OptimizeWarning)
warnings.simplefilter("error", RuntimeWarning)
def func(x, a, b, c, d, g):
return a*np.exp(-x/b)*np.cos... | true |
fff810740eac3d131a1e6ab3f968ede46381b7c8 | Python | gonzalob24/Learning_Central | /Python_Programming/BootCamp/regx.py | UTF-8 | 5,314 | 4.125 | 4 | [] | no_license | import re
patterns = ['term1', 'term2']
text = 'this is a string with term1, but not other term'
# print(re.search('hello', 'hello world'))
for pattern in patterns:
print('Search for "%s" in: \n"%s"' % (pattern, text))
# Check for a match
if re.search(pattern, text):
print("\n")
print("ma... | true |
b8fe3d4664a2ffa4c2d642a0dd6bab1801902142 | Python | rajlath/rkl_codes | /codechef/INTY2018_INF1803.py | UTF-8 | 898 | 2.875 | 3 | [] | no_license |
# -*- coding: utf-8 -*-
# @Date : 2018-10-21 18:32:13
# @Author : raj lath (oorja.halt@gmail.com)
# @Link : link
# @Version : 1.0.0
#learned from solution by huggy_hermit
from sys import stdin
max_val=int(10e12)
min_val=int(-10e12)
def read_int() : return int(stdin.readline())
def read_ints() : retur... | true |
e428e5a679e68058f0d5f55a4d602803f14ef919 | Python | kenneth-miura/Drive-Syncer | /syncer.py | UTF-8 | 3,108 | 2.671875 | 3 | [] | no_license | from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
import glob
import os
import re
import argparse
# TODO: alter so this can take N directories & targets
def set_up_drive(settings_file, credentials_file):
print(
f'Settings File Location: {settings_file} Credentials File Location: {c... | true |
104dd8ebea76a7037dbefff2f51774689eacd740 | Python | fabiocaccamo/python-benedict | /tests/dicts/io/test_io_dict_xls.py | UTF-8 | 10,772 | 2.515625 | 3 | [
"MIT"
] | permissive | from unittest.mock import patch
from decouple import config
from benedict.dicts.io import IODict
from benedict.exceptions import ExtrasRequireModuleNotFoundError
from .test_io_dict import io_dict_test_case
class io_dict_xls_test_case(io_dict_test_case):
"""
This class describes an IODict / xls test case.
... | true |
587785f798ac61ed031c2d1ab2b77144b160392b | Python | feulf/ecc-mul-pow-jsong-pb-denver-070918 | /test/index_test.py | UTF-8 | 475 | 2.765625 | 3 | [] | no_license | from unittest import TestCase
from ipynb.fs.full.index import *
class FieldElementTest(TestCase):
def test_mul(self):
a = FieldElement(24, 31)
b = FieldElement(19, 31)
self.assertEqual(a*b, FieldElement(22, 31))
def test_pow(self):
a = FieldElement(17, 31)
self.assertE... | true |
13016854e8029f2766ebe175a061bef3b15ca74d | Python | pranu46/Pythontrials | /Class_HW/Praveena_Homework3.1.py | UTF-8 | 1,620 | 4.40625 | 4 | [] | no_license | '''
Addition and subtraction of quadratic expressions by using operator overloading.
Check the equality of the quadratic expressions.
Check the co-efficients of the quadratic expressions to put + or - in return string
'''
class Quadratic:
def __init__(self, Q1, Q2, Q3):
self.Q1 = Q1
self.Q2 = Q2
... | true |
426215825b247cf9fa6432c18ee688cd1be21e9d | Python | vishal-1codes/python | /INTRODUCTION_TO_CLASSES/Class_Syntax.py | UTF-8 | 90 | 2.609375 | 3 | [] | no_license | #user-defined Python class names start with a capital letter.
class Animal(object):
pass | true |
99cb5d839933b8df7b2d77d703f342546782bd46 | Python | rk-exxec/micropython | /tests/extmod/vfs_posix.py | UTF-8 | 2,447 | 2.828125 | 3 | [
"MIT",
"GPL-1.0-or-later"
] | permissive | # Test for VfsPosix
try:
import gc
import os
os.VfsPosix
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
# We need a directory for testing that doesn't already exist.
# Skip the test if it does exist.
temp_dir = "micropy_test_dir"
try:
import os
os.stat(temp_dir)
... | true |
4c4615dde5b56c2dac8a11f5cab49c72691edea9 | Python | redstarkeT/CS-115-Assignments | /CS 115 Assignments/lab1-TimothyStephens.py | UTF-8 | 1,170 | 4 | 4 | [] | no_license | """Timothy Stephens, I pledge my honor that I have abided by the Stevens Honor System."""
from math import factorial
from cs115 import reduce
import math
def inverse(n):
"""This function returns the inverse of the number plugged in."""
return 1/n
def add(x,y): return x+y
def e(n):
"""This function ... | true |
23538c4646ce239f3893ffbfd3181c034ae1ad42 | Python | lsx137946009/bandparser | /sensparser/sensomics_utils.py | UTF-8 | 1,933 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 1 15:45:47 2019
@author: lsx
"""
import numpy as np
import time
def function_date_parse(frame, date0_loc, date1_loc, date2_loc, date3_loc):
date0 = '{:08b}'.format(frame[date0_loc])
date1 = '{:08b}'.format(frame[date1_loc])
date2 = '... | true |
cc9eea6bb4ff801b076b262e8a4e22bfbfa4ed33 | Python | BuyankinM/JetBrainsAcademyProjects | /Rock-Paper-Scissors/Problems/Writing to a file immediately/task.py | UTF-8 | 196 | 2.921875 | 3 | [] | no_license | long_list = list(range(1000000))
file_name = "my_file.txt"
opened_file = open(file_name, 'w')
for _item in long_list:
command = "print(_item, file=opened_file, flush=True)"
opened_file.close() | true |
7d18c5412a5559876ba0c732b3e71006c7f5d734 | Python | hzhcui/ScrapingNBA | /Test 1 for basketball-reference.py | UTF-8 | 773 | 2.84375 | 3 | [] | no_license | import urllib
from urllib2 import urlopen
from bs4 import BeautifulSoup
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
def make_soup(url):
thepage = urllib.urlopen(url)
soupdata = BeautifulSoup(thepage, "html.parser")
return soupdata
playerdatasaved=""
soup = make_soup("https://www.basketball-... | true |
e481bc9df7fc980fd0c5f997a3edc159d565a47f | Python | lucasdpn/query_builder | /model/operations.py | UTF-8 | 15,477 | 2.71875 | 3 | [] | no_license | from sqlalchemy.sql import select, and_, or_
from sqlalchemy import Table, cast, Integer, func
from sqlalchemy.sql.expression import literal_column, between
from utils.db import dal
from model import sql_operations
"""
An operation represents a query that is built based on the input configuration
-params- and optio... | true |
e3c759c6c4cdde58c5b8cde67bebfb8c388e4b8c | Python | Aasthaengg/IBMdataset | /Python_codes/p03402/s814954157.py | UTF-8 | 324 | 3.171875 | 3 | [] | no_license | import sys
input = sys.stdin.readline
A,B=map(int,input().split())
a=[["#"]*100 for i in range(50)]
b=[["."]*100 for i in range(50)]
for i in range(A-1):
a[2*(i//50)][2*(i%50)]="."
for i in range(B-1):
b[2*(i//50)+1][2*(i%50)]="#"
print(100,100)
for i in a:
print("".join(i))
for i in b:
print("".join(... | true |
a85fccbb18a4d5a2592c1d98793b460ef465d873 | Python | Cyxapic/arcade | /core/parts/commons/miniature.py | UTF-8 | 919 | 3.421875 | 3 | [
"MIT"
] | permissive | from abc import ABC, abstractmethod
from pygame import image
class Miniature(ABC):
""" Parent class for menu, gameover etc
Arguments:
screen -- Main display surface
image_file -- image file path
"""
def __init__(self, screen, image_file):
self.screen = screen
... | true |
be02294595732e464de715633722a3dba33a3841 | Python | pbudzyns/BigDataITMO2018 | /SparkTask.py | UTF-8 | 15,161 | 2.828125 | 3 | [] | no_license | from pyspark.sql import SparkSession
from pyspark.sql.functions import UserDefinedFunction
from pyspark.sql.functions import collect_set, array_contains, col, max, mean, desc, sum
from pyspark.sql.types import ArrayType
import os
os.environ["PYSPARK_PYTHON"] = "/home/pawel/PycharmProjects/HPC/venv/bin/python3.5"
os.en... | true |
3a5f5a8a5084b16341f89ab254c224c11149da94 | Python | QuantEcon/QuantEcon.py | /quantecon/optimize/tests/test_lcp_lemke.py | UTF-8 | 3,218 | 2.578125 | 3 | [
"MIT"
] | permissive | """
Tests for lcp_lemke
"""
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal
from quantecon.optimize import lcp_lemke
def _assert_ray_termination(res):
# res: lcp result object
assert_(not res.success, "incorrectly reported success")
assert_equal(res.status, 2, "failed... | true |
275229f22a2979a0c26aab289d6dedd4a7af5998 | Python | HyunSeungBum/sbhyun_python_lib | /sbhyun_utils.py | UTF-8 | 5,909 | 2.640625 | 3 | [] | no_license | #!/usr/local/python2.7/bin/python
# -*- coding: UTF-8 -*-
''' Useful function packages '''
__author__ = "Seung-Bum Hyun <orion203@gmail.com>"
__date__ = "27 March 2012"
__version__ = "0.1"
__License__ = "GPL"
import os
import time
import sys
import socket
import fcntl
import struct
import locale
import logging
d... | true |
ae08da179786ac815f8d5fbf495990f85574c185 | Python | Aasthaengg/IBMdataset | /Python_codes/p02582/s956413300.py | UTF-8 | 133 | 3.171875 | 3 | [] | no_license | s = input()
cnt = 0
ans = [0]
for i in range(3):
if s[i] == 'R':
cnt+=1
ans.append(cnt)
else:
cnt = 0
print(max(ans)) | true |
af43a3ccfc523ffee7e0f818b9c24e6f63f989aa | Python | robdunn220/List_Exercises | /sum_num_list.py | UTF-8 | 92 | 3.375 | 3 | [] | no_license | numbers = [1, 2, 3, 4, 5, 6]
num_sum = 0
for x in numbers:
num_sum += x
print num_sum
| true |
c9de04b35b67d01a9ddde260d8e103195fc33de8 | Python | xiaodongdreams/Random-Forest | /DataClean.py | UTF-8 | 908 | 2.6875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import csv
import pandas as pd
import scipy as sp
from sklearn.preprocessing import *
'''
dataSet=[]
with open('all.csv', 'r') as file:
csvReader = csv.reader(file)
for line in csvReader:
dataSet.append(line)
#print dataSet
Data=np.mat(dataSet)
Data=D... | true |
852d1dce8e8552f5f0cdd93065a8c92a8ca3fc54 | Python | ScienceMan117/BabyPython | /Chapter_10/addition.py | UTF-8 | 531 | 4.0625 | 4 | [] | no_license | import math
while True:
# Allows user to input values to be added together
try:
first_number = input ("Enter the first number: ")
if first_number == 'q':
break
second_number = input ("\nEnter the second number: ")
if second_number == 'q':
break
additio... | true |
9c317b83451deedee4d80a4f11a03423039d067a | Python | winstonplaysfetch/binf2111-woo-python | /LotteryGenerator.py | UTF-8 | 229 | 3.34375 | 3 | [] | no_license | #! /usr/bin/env python
import random
def lottery():
for i in xrange(6):
yield random.randint(1,40)
yield random.randint(1,15)
for random_number in lottery():
print "Next lottery number: %d" %random_number
| true |
5b40405315171a3d46d7def37ef8edb99022bb69 | Python | Deepakdv15/Selenium10 | /Prectice/square_test.py | UTF-8 | 352 | 2.890625 | 3 | [] | no_license | import math
import pytest
@pytest.mark.great
def test_sqr():
assert 5==math.sqrt(25)
@pytest.mark.great
def testequal():
assert 7*7==40
@pytest.mark.great
def tesNum():
assert 10==11
@pytest.mark.others
def test_grester_numner():
num=20
assert 21>num
@pytest.mark.others
def test_less_number... | true |
a25fd25bbb217f6e7aaed9ddc913519f900401d2 | Python | ritchie46/concatPDF | /test/test.py | UTF-8 | 800 | 2.625 | 3 | [
"MIT"
] | permissive | import unittest
from concatPDF.builder import Build, str_to_flt, natural_keys
class TestFileOrder(unittest.TestCase):
def test_str_to_flt(self):
self.assertEqual(str_to_flt("2.20"), 2.2)
self.assertEqual(str_to_flt("2.2.0"), "2.2.0")
self.assertEqual(natural_keys("1.1_you"), [1.1, "_you"])... | true |
54b2621d608942bb715acd8332e7f478f1121cfb | Python | nnnazek/ICT | /ict/19.py | UTF-8 | 279 | 3.703125 | 4 | [] | no_license | import math
height = float(input("Please enter a height from which an object is dropped from in meters: "))
acceleration = 9.8
finalVelocity = math.sqrt(2*acceleration*height)
print("The final velocity when the object hits the ground is {}m/s^2.".format(finalVelocity)) | true |
7b948fe8e21adb9a023cff0b5fca18d10fdfe76b | Python | roije/portal_scraper | /portal.py | UTF-8 | 9,079 | 2.828125 | 3 | [] | no_license | import requests
import hashlib
from config import Config
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.c... | true |
dea484075682bce5707bc3cb61eef2c2d6bcfb72 | Python | varun3108/Agent-Selector-based-on-issue | /AgentSelect.py | UTF-8 | 5,430 | 3.203125 | 3 | [] | no_license | import datetime
import random
agent_list= [1001, True, datetime.time(8, 0), 'Support', 1002, True, datetime.time(10, 0), 'Sales', 1003, True, datetime.time(11, 0), 'Spanish speaker', 1004, True, datetime.time(12, 0), 'Sales', 1005, True, datetime.time(11, 0), 'Support', 1006, True, datetime.time(12, 0), 'Spanish sp... | true |
729e3657584d0f00c4c4681672e5c5c1e892e754 | Python | Audi-Un-Autre/TheTranslators | /COGS/errorHandling.py | UTF-8 | 1,248 | 2.796875 | 3 | [] | no_license | # This cog listens to all command calls and reports error directly to the user in the channel
import discord
from discord.ext import commands
from botmain import config
class ErrorHandling(commands.Cog):
def __init__(self, bot):
self.bot = bot
# General error response
@commands.Cog.listener... | true |
6a8266f7275c8f233ef9efb4c1f1eba9886d2e71 | Python | Tom-Adamski/PythonPlayground | /matplotlib/triangle.py | UTF-8 | 1,374 | 2.953125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
width = 50
height = 50
fig, ax = plt.subplots()
ax.set_xlim([0,width])
ax.set_ylim([0,height])
patches = []
N = 100
ratio = 0.01
ratioInv = 1 ... | true |
33cc09f486e7f0c4620b261dfd84f56a4c32ef49 | Python | BenGreenDev/ATDeepLearningAssetGeneration | /ConvNet.py | UTF-8 | 3,266 | 2.640625 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten, Conv2D, MaxPooling2D
from tensorflow.keras.callbacks import TensorBoard
import pickle
import time
import tensorflow.keras
NAME = "Satellite-Image-Classifier-cnn-64x2-{}".form... | true |
218d6ac49e4668947b8f563ee82bf3ee00ec49e9 | Python | Sohailsaifi/Internet-Speed-Test | /test.py | UTF-8 | 374 | 2.96875 | 3 | [] | no_license | import speedtest
s = speedtest.Speedtest()
option = int(input('''What do you want to know :
1 - upload speed
2 - download speed
3 - ping \n'''))
if option == 1:
print(s.upload())
elif option == 2:
print(s.download())
elif option == 3:
server = []
s.get_servers(server)
print(s.results.ping)
el... | true |
e0f3d984d34775a40246acc75fa859013fa4f37f | Python | gagan1510/PythonBasics | /PythonRef/file.py | UTF-8 | 509 | 3.65625 | 4 | [] | no_license | fName = input("Please enter the file name with extension to be read: ")
try:
f = open(fName)
line = f.readline()
while line:
print(line, )
line = f.readline()
f.close()
print("This is being printed using the for loop.\n")
for line in open(fName):
print(line)
f.cl... | true |
6f16c076fad7413890d76074098c478fb1866aea | Python | mina0805/Programming-with-Python | /Programming_Basics_with_Python/02.ПРОСТИ ПРЕСМЯТАНИЯ/10.Radians_To_degrees.py | UTF-8 | 105 | 3.296875 | 3 | [] | no_license | import math
rad = float(input())
deg = (180/math.pi)*rad
deg_round = round(deg, 2)
print(deg_round)
| true |
7cf1928e181b0781f79fc5148dd42522a40eac3d | Python | RichardLaBella/PyLessons | /ex6 | UTF-8 | 668 | 4.25 | 4 | [] | no_license | #!/usr/bin/python
# using %d format character to reference the 10
x = "There are %d types of people." % 10
binary = "binary"
do_not = "don't"
# using %s format character twice to reference the % variable in parenthesis
y = "Those who know %s and those who %s." % (binary, do_not)
# Just printing x and then printing y
... | true |
0878226013543f04a6b03b6bf2f3301139bcbdc7 | Python | gtmkr1234/learn-python39 | /learn-python39/set_Python/practice_questions_sheet.py | UTF-8 | 482 | 4.125 | 4 | [] | no_license | """
Write a Python program to remove an item from a set if it is present in the set. HereBothItem
and Set is enter by the User.
"""
# user data is space separated
h = set(map(int, input().split()))
itm = eval(input('enter the item '))
# h.remove(itm)
h.discard(itm)
print(h)
# 2nd
st1 = set('hello')
st2 = set('hi... | true |
654f0ce008a1716dfbdc396b7328d0de2418085c | Python | ishantk/ENC2020PYAI1 | /Session58C.py | UTF-8 | 417 | 3.515625 | 4 | [] | no_license | import nltk
# nltk.download('punkt') -> Required for word_tokenize
# nltk.download('averaged_perceptron_tagger') -> Required for POS Tagging
from nltk import word_tokenize, pos_tag
sentence = "A very Happy Navratras to All. Code Well. Be at Home. Stay Safe :)"
tokens = word_tokenize(sentence)
print(tokens)
# POS i... | true |
e36286ce329ec9eee60b25f950f32548070c16dc | Python | ljw0096/Python_300_practice | /py121_130.py | UTF-8 | 261 | 3.015625 | 3 | [] | no_license | import requests
btc =requests.get("https://api.bithumb.com/public/ticker/").json()['data']
variation = int(btc['max_price'])-int(btc['min_price'])
res = variation+int(btc['opening_price'])
if res>int(btc['max_price']):
print("up")
else:
print("down") | true |
e775fa42a75450c2e4b675e886b26bf8e0d5a651 | Python | jaimegildesagredo/booby | /booby/inspection.py | UTF-8 | 1,674 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
#
# Copyright 2014 Jaime Gil de Sagredo Luna
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | true |
3a2dfc3cf3ba23889f2658b175a95e195e65d7d6 | Python | AkaiTobira/TetrisAgents | /Libraries/game.py | UTF-8 | 1,604 | 2.625 | 3 | [] | no_license | import pygame
import time
from Libraries.consts import *
from Libraries.Structures.tetrisGame import Tetris
from Libraries.Structures.displayers import FPSDisplayer
from Libraries.Structures.tetrominoSpawner import RandomSpawnTetromino, SimpleSpawnTetrimino
from Libraries.Structures.pl... | true |
9195d7c958e1e050e22466a523e6f4c18a70a23c | Python | rjnp2/deep_learning_from_scratch | /loss/loss.py | UTF-8 | 3,194 | 3.390625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 2 15:57:07 2020
@author: rjn
"""
# importing required library
import cupy as cp
class Loss(object):
def loss(self, y: cp.array ,
y_pred: cp.array ):
'''
Parameters
----------
y... | true |
4d8737f2a14db091ee464476a7abc71547b38d5c | Python | Conor12345/misc | /challenges/venv/challenge7maybe.py | UTF-8 | 145 | 3.375 | 3 | [] | no_license | str1 = "abcdefghijklmnopqrstuvwxyz"
for i in range(0, 26):
foo = str1[i:10]
if foo == "":
break
print(foo)
| true |
65b081ea259df0caab212231a2ed29da08b1a244 | Python | roxor05/Programs | /Python-scripts/ALL-snowflake_tables-arrived-today.py | UTF-8 | 3,688 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
#### Requirement for running this code ####
# First install pip3 then install snowflake connector
# pip3 install asn1crypto==1.3.0
# pip3 install snowflake-connector-python
#########################################################################
impor... | true |
af0ddd3696971ae804471efae6cee7614c1fd13c | Python | ElijahEldredge/Turtlebot_Navigation | /src/navigation/Node.py | UTF-8 | 1,451 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python
# Team 14: Brandon Knox, Elijah Eldredge, Jon Andrews
# RBE 3002, Unified Robotics IV
# Assignment: Final Term Project
import math, geometry_msgs, time
from geometry_msgs.msg import Point
# Node(object)
# This class generates node objects, giving them aspects of
# coordinates, parents, and dis... | true |
aa1d3baff0aef1666687b2b08b5123ce366e1bf5 | Python | threexc/WeatherVane | /vane/weathervane.py | UTF-8 | 5,749 | 3.015625 | 3 | [] | no_license | import requests
import sys
import re
import datetime
import os
import errno
import xml.etree.ElementTree as ET
# WeatherCollector will collect and tidy the necessary METAR and TAF data for
# a specified aerodrome. This is currently hard-coded to work with the NAV
# CANADA website only. This object-oriented implementat... | true |
6d6ca8449fd692bf2ee32c6714d665295b5c81d5 | Python | CS26-BW1-Javascript-Is-Bad/FE-Client | /core/domain/map.py | UTF-8 | 3,554 | 2.625 | 3 | [] | no_license | import math
import core.util.constants as constants
import os.path as path
import pygame as pg
import pytmx
from core.util.colors import *
from core.util.functions import draw_text
from core.util.settings import *
class Map:
def __init__(self, rooms):
self.rooms = rooms
self.size = math.sqrt(len(... | true |
92c32f115940ef9d24b0b0815d5dc0d9424c9cc4 | Python | HardyYao/hardy_python | /project/004 国内三大交易所数据爬虫程序/scraw_shanghai_data.py | UTF-8 | 5,966 | 2.578125 | 3 | [] | no_license | #!usr/bin/env python
'''
#-*- coding:utf-8 -*-
@Author HardyYao
@Time 2017/10/2 7:28
'''
import requests
import xlwt
import time
import random
from urllib.error import URLError, HTTPError
from json.decoder import JSONDecodeError
from conn import headers
class getShangHaiFutures(object):
def scraw_shanghai_data(se... | true |
346c15e9d335d5ef4873cdc58a2f27928178c686 | Python | faemiyah/dnload | /dnload/glsl_name_strip.py | UTF-8 | 5,314 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | import re
from dnload.glsl_name import is_glsl_name
########################################
# GlslNameStrip ########################
########################################
class GlslNameStrip:
"""Strip of names used for renaming purposes."""
def __init__(self, block, name):
"""Constructor."""
... | true |
44d3b1b32fe317b75dc84bcf1a34576766e91631 | Python | jquintus/PiProject | /Feather/button_and_led_matrix/code.py | UTF-8 | 1,168 | 2.609375 | 3 | [
"MIT"
] | permissive | import time
import digitalio
import board
import adafruit_matrixkeypad
import simpleio
cols = [digitalio.DigitalInOut(x) for x in (board.D9, board.D10, board.D11, board.D12, board.D13)]
rows = [digitalio.DigitalInOut(x) for x in (board.D6, board.D7)]
keys = ((1, 2, 4, 8, 16),
(32, 64, 128, 256, 512))
# rowsx ... | true |
192b37702cddbcc526c206775140d87cfb4b4be0 | Python | jbrusey/cogent-house | /tests/model_tests/testRoom.py | UTF-8 | 3,664 | 2.875 | 3 | [] | no_license | """
Test for the Sensor Type Classes
"""
#from datetime import datetime
import datetime
#Python Module Imports
import sqlalchemy.exc
import cogent.base.model as models
import tests.base as base
import json
class TestRoom(base.ModelTestCase):
def _serialobj(self):
"""Helper Method to provde an object ... | true |
966d056edffa7772267f787a2ad80e4d062bc860 | Python | agdsn/pycroft | /tests/helpers/test_functional.py | UTF-8 | 1,305 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) 2023. The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details
import pytest
from pycroft.helpers.functional import map_collecting_errors
@pytest.mark.parametrize(
"... | true |
62f959e0b4126bbc963087ca6ec694a464c31533 | Python | vivek111/Pywork | /stack.py | UTF-8 | 854 | 4.21875 | 4 | [] | no_license | def push(stack,ele):
stack.append(ele)
return
def pop1(stack):
x=stack.pop()
return x
def display(stack):
print(stack)
stack=[]
top=-1
size=10
while True:
print("1.Push\n2.Pop\n3.Display\n4.Exit")
x=int(input("Enter your choice\n"))
if x==1:
if top=... | true |
f9d4c71610b59a7a0415beb1f520e362f83781c5 | Python | SharujanMuthu/NhlDiscordBot | /WebScraper.py | UTF-8 | 1,023 | 2.625 | 3 | [] | no_license | import urllib
import urllib.request
from bs4 import BeautifulSoup
import os
def create_soup(url):
page = urllib.request.urlopen(url)
link = BeautifulSoup(page, 'html.parser')
return link
soup = create_soup('https://www.hockey-reference.com/leagues/NHL_2022_skaters.html#stats::points')
def get_data():
... | true |
38aa6ce2c06c64000a2353e4deb5f8b2804f2a38 | Python | VerstraeteBert/algos-ds | /test/vraag4/src/isbn/71.py | UTF-8 | 3,031 | 3.640625 | 4 | [] | no_license | def isISBN_13(getal):
if isinstance(getal, int):
return False
for i in range(len(getal)):
if getal[i].isalpha():
return False
som1 = 0
som2 = 0
for i in range(1, 12, 2):
som1 += int(getal[i - 1])
for i in range(2, 13, 2):
som2 += int(getal[i - 1])
... | true |
15c01ca5df97d2e0ff861a3f8cc6bd350f4ab89d | Python | quantumech3/WUSB-Donor-Monitor | /Source/debug.py | UTF-8 | 1,223 | 3.59375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
'''
Created by Scott Burgert on 2/20/2019
Project name: WUSB Donor Monitor ©
Module name: debug.py
Module description:
Has methods used by different modules to log events and warnings.
These logs only show when 'VERBOSE' = True
'''
# Hard coded constant. if true, status, log and warnin... | true |
fedbbeb5789f7167280c0130ad18e791785f5498 | Python | stuglaser/advent2020 | /days/day10.py | UTF-8 | 1,162 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python3
from collections import deque
from collections import namedtuple
import enum
import itertools
import unittest
import sys
from utils import *
INPUT = 'inputs/input10.txt'
class TestToday(unittest.TestCase):
def test_common(self):
pass
def main():
nums = []
with open(INPUT... | true |
c0c8c7acfbd1d95de93f87e119551a94fe14c644 | Python | simon-zhangmuye/leetcode | /83.py | UTF-8 | 745 | 3.765625 | 4 | [] | no_license | # coding=utf-8
__author__ = 'Simon Zhang'
__date__ = '2019/10/12 15:26'
# 给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点。
#
# 示例:
#
# 给定一个链表: 1->2->3->4->5, 和 n = 2.
#
# 当删除了倒数第二个节点后,链表变为 1->2->3->5.
class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
end = head
start = head
... | true |
de6d80cd4f822dc2cc6be8d742bc78b5881eee49 | Python | Leoberium/CS | /stepik_data_structures/network_packets.py | UTF-8 | 942 | 3.296875 | 3 | [] | no_license | import sys
class Processor:
def __init__(self, size, n):
self.times = [(-1, -1)] * n
self.free = size
self.queue = []
self.cnt = 0
def add_packet(self, a, d):
time = a
while self.queue and self.times[self.queue[0]][1] <= a:
self.queue.pop(0)
... | true |
21b7e43bb7d5eda5c41ca5496a2d1923ca8efae3 | Python | abrarhamzah/Hearty | /models/classification/Naive_Bayes/naiveBayes.py | UTF-8 | 2,303 | 3.078125 | 3 | [] | no_license | #########################################################
# File : naiveBayes.py
# Project : FIT3164 project
#
# Date : 5/10/2020
# Author : Abrar Fauzan Hamzah
#
# Purpose : Implement Naive Bayes classifier
# & test Gaussian, multinomial and Bernoulli
#################################... | true |
4913910752d8e22574ba640551da0b59adcb2719 | Python | alexlaplap/Pycharm-Exercises | /Exercise 06-Character Length/main.py | UTF-8 | 204 | 3.9375 | 4 | [] | no_license | a = input('Please enter name: ')
b = len(a)
if b < 3:
print('Name must be 3 characters long.')
elif b > 50:
print('Name must not exceed 50 characters long.')
else:
print('Name is registered.') | true |
b8dae593bb847a64e5fc5755c82dbe83a8c5f44e | Python | woider/runoob | /sorting/python_sort.py | UTF-8 | 249 | 2.765625 | 3 | [] | no_license | '''
原生排序
'''
from exec_time import exectime
from random_list import load_random_array
@exectime
def python_sort(array):
array.sort()
return array
array = load_random_array('numbers.json')
print(python_sort(array))
| true |
d54b40791dd81650f2ebf736c25771fe901c0a52 | Python | christinaWiss/math_projects | /math_projects/ShortRatesModels/PythonCode/dothan.py | UTF-8 | 965 | 2.75 | 3 | [] | no_license | import constants
import main
import matplotlib.pyplot as plt
"""The dothan Model model: Here the differential equation is given by dr(t)=βr(t)dt +σr(t)dW∗(t).
"""
beta = -.06
sigma = 0.1
initial_r = 0.08
def short_rate_dothan_model(beta, sigma, initial_r):
Brownian_Motion = [i / (len(constants.gather_unit... | true |
6014c4444fb3b89c61b612b4d488848a56b82964 | Python | leeo1116/PyCharm | /Algorithms/leetcode_charlie/030_substring_with_concatenation_of_all_words.py | UTF-8 | 1,220 | 4.28125 | 4 | [] | no_license | """
You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of
substring(s) in s that is a concatenation of each word in words exactly once and without any intervening characters.
For example, given:
s: "barfoothefoobarman"
words: ["foo", "bar"]
You should ret... | true |
28dfed963268573039baf80a37e6ef29afe16f7b | Python | ulillilu/MachineLearning-DeepLearning | /01-04.All_Download_From_Link/cr_path.py | UTF-8 | 303 | 3.140625 | 3 | [] | no_license | #상대 경로를 절대 경로로 전환
from urllib.parse import urljoin
url = "http://example.com/html/a.html"
print( urljoin(url, "b.html") )
print( urljoin(url, "sub/c.html") )
print( urljoin(url, "../index.html") )
print( urljoin(url, "../img/hoge.png") )
print( urljoin(url, "../css/hoge.css") ) | true |
a6dea4f0755681d6fa631e8d2b1328f10c030e71 | Python | lanking520/CYTON_VETA_FILE | /Internet Model/Client side/gamepad (Always send).py | UTF-8 | 1,070 | 2.8125 | 3 | [] | no_license | import time
import pygame
import SimpleGUICS2Pygame.simpleguics2pygame as simplegui
import socket
pygame.init()
joy = pygame.joystick.Joystick(0)
joy.init()
out = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
s = socket.socket() # Create a socket object
host = '192.168.32.191' # Get local machine IP
port = 12345 ... | true |
1a38483cd4b38802fe04b121692fee8e0b4f6e85 | Python | stat17-hb/algorithm | /geeksforgeeks/n진수 구하기.py | UTF-8 | 816 | 3.5625 | 4 | [] | no_license | #%%
n = 2
number = 32
from collections import deque
deq = deque([number])
res = deque()
while True:
temp = deq.popleft()
deq.append(temp // n) # 몫
res.appendleft(temp % n) # 나머지
if temp // n == 0 : break
res
#%%
n = 2
number = 32
res = []
while True:
q = number // n # 몫
res[:0] = [number % n... | true |
1cef718723094f8741b730dba5c1b74a47c2d8de | Python | ken0105/competitive-programming | /procon-archive/atcoder.jp/dp/dp_h/Main.py | UTF-8 | 846 | 2.78125 | 3 | [] | no_license | def main():
h, w = map(int, input().split())
a = []
for _ in range(h):
a.append(input())
route = [[0] * w for _ in range(h)]
has_wall_w, has_wall_h = False, False
for i in range(h):
for j in range(w):
if i == 0 and a[i][j] == "." and not has_wall_h:
ro... | true |
7031537917e2179a3e115f1a16ce02a816232b81 | Python | fandiandian/python_learning_excerise | /part1.4习题/minima_in_permutation(最小置换).py | UTF-8 | 1,132 | 4.21875 | 4 | [] | no_license | # 最小置换
# minima in permutation
# 生成一个长度为 n ,个数为 m 的二维随机数组,输出生成的排列中从左至右极小数的数量的平均值
# 通过定义函数的,调用函数的方式实现
# (我对这个题目的理解可能有问题)
import random
m = int(input('请输入数组的行数\n'))
n = int(input('请输入数组的列数\n'))
# 随机数的范围定在 [1,20]
# 构建函数
def minima_in_permutation(a,b):
# 构建随机数组
rand_list = [[random.randrange(1,21) for i ... | true |
6cbe8cb84b88dc7f1613e77ed18cfab7bb37bfb6 | Python | jimmyhzuk/morning-stock-market-emails | /ScrapeInformation/pe_ratio.py | UTF-8 | 3,332 | 2.78125 | 3 | [] | no_license | import requests
import time
year_month = time.strftime("%Y-%m-%d")
r = requests.get('https://financialmodelingprep.com/api/v4/industry_price_earning_ratio?date=' + year_month +'&exchange=NYSE&apikey=e49e22b0865cfeea71aa0771ddf965a1')
print(year_month)
ratio = r.json()
# for x in ratio:
# print(x)
year = ['2021']
... | true |
fa31f5e2ba22494e270527767180f8155799e129 | Python | SUDARSHANSHARMA1998/WebMaps | /Map1.py | UTF-8 | 1,218 | 2.828125 | 3 | [] | no_license | import folium
import pandas
data=pandas.read_excel("Volcanoes.xlsx",sheet_name=0)
data = data.dropna(how='any',axis=0)
lat = list(data["Latitude"])
lon = list(data["Longitude"])
elev = list(data["Elevation"])
name= list(data["Volcano Name"])
def color_producer(elevation):
if elevation < 1000:
... | true |
4e11dce24d9fa6ec16ca8a2f5e41107da40dc5ce | Python | zerojpyle/learningPy | /ex10.py | UTF-8 | 502 | 3.921875 | 4 | [] | no_license | tabby_cat = "\tI'm tabbed in."
persian_cat = "I'm split\non a line."
backslash_cat = "I'm \\ a \\ cat."
fat_cat = """
I'll do a list:
\t* Cat food
\t* Fishies
\t* Catnip\n\t* Grass
"""
print(tabby_cat)
print(persian_cat)
print(backslash_cat)
print(fat_cat)
# Practice escape character "\b"
test = "{}{}{}{}"
print(tes... | true |
87a6af65ccfc471025da4bb745d333e02488deeb | Python | dariaserkova/helper_scripts | /git-apies/archivation.py | UTF-8 | 1,643 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
'''
Docs to be written
'''
import yaml
import gitlab
import sys
#####################
## Reading the configuration
#####################
try:
with open("config.yml", 'r') as ymlfile:
cfg = yaml.load(ymlfile)
except IOError:
print('Can not find config.yml in the cu... | true |
cb1bfe7e9ff6642f4f7977bf2609e9ffd3fc57d1 | Python | DQDH/Algorithm_Code | /ProgramForLeetCode/LeetCode/75_sortColors.py | UTF-8 | 1,413 | 3.34375 | 3 | [] | no_license | class Solution(object):
def sortColors(self, nums):
"""
:type nums: List[int]
:rtype: None Do not return anything, modify nums in-place instead.
"""
left,current,right=0,0,len(nums)-1
while current<=right:
if left>right:
break
... | true |
6d8ce500b8d8845ca66bd1949681e7ad7637b2d2 | Python | barmako/cv_cifar10 | /BOWPreprocessor.py | UTF-8 | 1,362 | 2.875 | 3 | [] | no_license | import random
import numpy as np
from sklearn.cluster import MiniBatchKMeans
from SIFTPreprocessor import SIFTPreprocessor
class SIFTBOWPreprocessor:
def __init__(self, decorated=SIFTPreprocessor(concat=False), n_words=1000, kmeans_train_size=5000):
self.kmeans_train_size = kmeans_train_size
self... | true |
8a0bda9cad85e4c958e677d16855b9e8df7b4d81 | Python | ckoryom/MiningGitHub | /Application/menu.py | UTF-8 | 3,601 | 2.671875 | 3 | [] | no_license | '''
Created on May 6, 2014
@author: ckoryom
'''
from Application.mining import Mining
from Model.parameters import Parameters
class Menu(object):
mining = Mining()
def selectMenu (self):
menuId = 0
while (int(menuId) != 1 and int(menuId) != 2 and int(menuId) != 3 and int(menuId) != ... | true |
fd99ccb6903909dc5ead2da77e2e65b44f764e79 | Python | patchiu/math-programmmmm | /ml/gradient descent 1d.py | UTF-8 | 1,460 | 4.0625 | 4 | [] | no_license | #gradient descent 1d
import numpy as np
import matplotlib.pyplot as plt
# 目標函數:y=x^2
def func(x): return np.square(x)
# 目標函數一階導數:dy/dx=2*x
def dfunc(x): return 2 * x
def GD(x_start, df, epochs, lr):
""" 梯度下降法。給定起始點與目標函數的一階導函數,求在epochs次反覆運算中x的更新值
:param x_start: x的起始點
... | true |
145437ddfadf9c210bf34d37104791ff8d3b3c74 | Python | matt-ankerson/racing_prediction | /Scraper/event_scraper.py | UTF-8 | 8,526 | 2.890625 | 3 | [] | no_license | import requests
import re
from datetime import date
from bs4 import BeautifulSoup
from race_event_types import Event
from race_event_types import Race
from race_event_types import Competitor
from race_event_types import Bet
def ScrapeEvent(race_result_url):
month_dict = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'M... | true |
f86ab10f51621e1828f0e14ded911f9a6ebf2b34 | Python | alexandraback/datacollection | /solutions_1483488_1/Python/rfw/actually_c.py | UTF-8 | 839 | 3.25 | 3 | [] | no_license | import math
import multiprocessing
import functools
def rotations(n):
results = []
expn = int(math.log(n, 10))
exp = 10 ** expn
for _ in xrange(0, expn):
n, r = divmod(n, 10)
n += r * exp
results.append(n)
return frozenset(results)
def n_rotations(p, a, b):
results =... | true |
0d0176f631237c0ed0be8fe261d80b91276049a3 | Python | 00116/TouPy | /hai.py | UTF-8 | 1,434 | 3.484375 | 3 | [] | no_license | # 牌の種類などを管理する
class Hai:
KIND = {0: '萬', 1: '筒', 2: '索', 3: '東', 4: '南', 5: '西', 6: '北', 7: '白', 8: '発', 9: '中'}
AKADORA = {16: '赤5萬', 52: '赤5筒', 88: '赤5索'}
# number0to135に0から135の整数を入力するとその牌の内容が生成される
# self.kindは0~3までありそれぞれ萬子筒子索子字牌を表す
# self.numberは数牌では数字(-1)を表し、字牌では0から順に東南西北白発中を表す
# self.akaar... | true |
4de0a47906d8206765327d4100256027f1bef214 | Python | kohei-okazaki/work-3g | /ha-selenium/src/main/python/common/util.py | UTF-8 | 950 | 2.890625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
'''
Created on 2020/06/09
健康管理アプリで使用する共通的な関数をまとめたPython
@version: 1.0.0
'''
from src.main.python.login.login_auth import LoginAuth
from src.main.python.login.login_form import LoginForm
def login_default_selenium_user(driver):
'''
健康情報画面がログイン後の画面のため、最初にログイン処理を行う
@driv... | true |
80f6470d558ab11a59b0e120f880ced6c08ce201 | Python | saraselis/ProgramcaoOrientadaObjetosEC | /Ativades de Sala/Atividade_06/ControleEstoque.py | UTF-8 | 8,404 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
#
# # Atividade 06 - POO
# Projete e implemente o sistema que faz controle de estoque de uma dessas plataformas de venda online, guardando a disposição dos itens nos locais de armazenamento, tipos de pagamento e preço de frete para a entrega.
# * Banco onde vamos gerir o estoqu... | true |
f4dd417072d632fe028beef1070a1551aa29ddad | Python | MCRogersI/Panorama | /Users/features.py | UTF-8 | 3,860 | 3.1875 | 3 | [] | no_license | from pony.orm import *
#Luego deberíamos cambiar la importación de pony para que no se importen todas las cosas con * (mala práctica).
import os
import hashlib
import pandas
from tabulate import tabulate
def createUser(db,name, level,password):
''' Este método crea una nueva entrada en la tabla de Usuarios de la b... | true |
0bcaf54b4debd112f858f07d8bba80b0ee79c2ad | Python | syool/sketchbook | /Recurrenet/cellkit.py | UTF-8 | 4,130 | 3.09375 | 3 | [] | no_license | # cellkit :: recurrent cells module #
# Based on Numpy #
# Austin Hyeon, 2020. "Sociology meets Computer Science" #
import numpy as np
from funckit import *
class VanillaCell:
''' the vanilla cell '''
def __init__(self, Wx, Wh, b):
self.params = [Wx, Wh, b]
self.grads = [np.zeros_like(Wh), n... | true |
a352abcc3291a02b1c3791b4a7e7f020d9170d59 | Python | shi-kejian/nyu | /csuy-1114/lab/2/lab2.py | UTF-8 | 2,164 | 4.25 | 4 | [] | no_license | from math import *
from turtle import *
from datetime import *
def kilo_pound():
kilo = int(input('Please put in the weight in kilograms: '))
KILO_POUND = 2.2046
POUND_OUNCE = 16
pounds_total = kilo * KILO_POUND
pounds = str(pounds_total).split('.')[0]
ounces_float = '.' + str(pounds_total).split('.')[1]
ounce... | true |
90629a407ca0f504f4451dd73cd0b9271f53a200 | Python | alancleetus/Linux-Task-Manager | /processStats.py | UTF-8 | 7,944 | 2.546875 | 3 | [] | no_license | import os
import re
import pwd
import time
import json
import subprocess
from stat import *
from process import Process
from helperFunctions import readFile, round2, BasicCounter
processDict = {}
inodeDict = {}
sysWideCpuTime = 0
vMemTotal = None
phyMemTotal = None
pageSize = None
def setSysWideCpuTime(time):
gl... | true |
c1922f6d97050d45ad1e8db7c9fec4babfa226ba | Python | jorgeOmurillo/Python | /intro/control_structures.py | UTF-8 | 448 | 3.6875 | 4 | [] | no_license | import math
wordlist = ['conejo', 'perro', 'raton', 'gato']
letterlist = []
count =0
contar = 0
for aword in wordlist:
count += 1
for aletter in aword:
contar +=1
letterlist.append(aletter)
print letterlist
print count
print contar
n = 2
if n<0:
print "Sorry"
else:
print math.sqrt(n... | true |
37f57c64d81060a5ee82aeec2e304f9a78c68697 | Python | lilianluong16/cogworks_team4 | /Face_Rec_Package/Face_Rec/__init__.py | UTF-8 | 13,979 | 2.59375 | 3 | [] | no_license | from os import path, makedirs
from pathlib import Path
from camera import take_picture
import os
import pickle
import numpy as np
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import skimage.io as io
import dlib_models
from dlib_models import load_dlib_models
from dlib_models import models
import... | true |
caec9dc5aef8d0e7b90c14f7279598cbf41b4316 | Python | StevenWang30/tx2_sync | /gpio_sync.py | UTF-8 | 1,053 | 2.734375 | 3 | [] | no_license | import Jetson.GPIO as GPIO
import time as time #引用需要用的库
lidar_trigger = 11
camera_trigger = 13
GPIO.setmode(GPIO.BOARD)
# GPIO.setup(lidar_trigger, GPIO.OUT)
# GPIO.setup(camera_trigger, GPIO.OUT)
#
# trig = 0
#
# try:
# while (True):
# if trig % 10 == 0:
# GPIO.output(lidar_trigger, GP... | true |
b658e9e83b22b571a34b10002b6b637f2f852387 | Python | Anusha-A-R/code-library | /codechefmay1.py | UTF-8 | 142 | 2.984375 | 3 | [] | no_license | # cook your dish here
t=int(input())
for i in range(t):
x,a,b=list(map(int,input().split(" ")))
ans=a+(100-x)*b
print(ans*10) | true |
f14ec513d81e84b7c54e077bc849d2aa64753429 | Python | ruthvik4215/openCV | /scripts/face_detection.py | UTF-8 | 1,435 | 2.71875 | 3 | [
"MIT"
] | permissive | import cv2
import random
from random import randrange
# loading the trained data set from the opencv.
trained_face_data = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
# getting live feed form the default webcam or any other video processing programs in your system .
default_v_p = cv2.VideoCa... | true |
c727d51bf36256e09c66aed30ed9dc5c38bbf95e | Python | AppDaemon/appdaemon | /conf/example_apps/yr.py | UTF-8 | 2,128 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import hassapi as hass
import requests
import xml.etree.ElementTree as ET
from datetime import datetime, timedelta
"""
Get detailed Yr weather data
Arguments:
- event: Entity name when publishing event
- interval: Update interval, in minutes. Must be at least 10
- source: Yr xml source
- hours: Number of hours t... | true |
6c3e80eb8f9fa561a06869b27be0ede07008e673 | Python | ollema/AoC | /day3/day3_part2.py | UTF-8 | 489 | 3.515625 | 4 | [] | no_license | file = open('input.txt')
def is_triangle(triangle):
sorted_triangle = sorted(triangle)
return sorted_triangle[2] < sorted_triangle[0] + sorted_triangle[1]
lines = file.readlines()
count = 0
numbers = []
for line in lines:
numbers.extend([int(x) for x in line.rstrip('\n').split()])
if len(numbers) ==... | true |
ad106d4fc0d60f278c0e34cc5f9b0b09f11eebb8 | Python | ZJXD/DropBoxFile | /Python/ShiyanLou/WeatherAnalysis/Pic9-1.py | UTF-8 | 2,043 | 3.28125 | 3 | [] | no_license | # coding:utf-8
# 每个城市的温度折线图
import numpy as np
import pandas as pd
import datetime
df_asti = pd.read_csv('./WeatherData/asti_270615.csv')
df_bologna = pd.read_csv('./WeatherData/bologna_270615.csv')
df_cesena = pd.read_csv('./WeatherData/cesena_270615.csv')
df_faenza = pd.read_csv('./WeatherData/faenza_270615.csv')
d... | true |