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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9c963e316ebaad0d57fbe0f7acfd103d5716ed34 | Python | AdamBures/TKINTER-GUI | /downloader.py | UTF-8 | 3,318 | 3.109375 | 3 | [] | no_license | import tkinter as tk
import requests
from bs4 import BeautifulSoup
import json, requests,urllib.request
from PIL import Image, ImageTk
import re
win = tk.Tk()
win.title("Downloader")
win.resizable(False,False)
win.geometry("500x600")
insta_id = tk.StringVar()
dwl_text= tk.StringVar()
def Downloader(... | true |
cfd03c5bef708ed620f765565b37e74e608beab1 | Python | contea95/1Day-1Commit-AlgorithmStudy | /BOJ/Python/11729.하노이탑이동순서/11729.py | UTF-8 | 321 | 3.421875 | 3 | [] | no_license | def hanoi(N, start, to, via):
global matrix
if N == 1:
matrix.append(start + " " + to)
else:
hanoi(N-1, start, via, to)
hanoi(1, start, to, via)
hanoi(N-1, via, to, start)
matrix = []
N = int(input())
hanoi(N, "1", "3", "2")
print(len(matrix))
for i in matrix:
print(i)... | true |
0a92e78ce0d9d4c0c78cfe80dbcfafac89725fec | Python | b12io/room-with-a-view | /room_with_a_view/room_with_a_view.py | UTF-8 | 16,961 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import os
import re
from operator import attrgetter
import psycopg2
import yaml
# Matches a view or function definition
SQL_VIEW_STATEMENT_RE = re.compile(
r'(?P<declaration>'
'create\s+(or replace\s+)?' # Matches 'create [or replace]'
'(?P<... | true |
428182311850f8ba88551611162b1a1256d3669b | Python | VojtechBrezina/RTLScript | /utils/tokens.py | UTF-8 | 1,743 | 3.4375 | 3 | [] | no_license | from typing import *
from utils.tokenizing import *
TT_all = []
class TokenType:
"""A class that defines one type of token.
A token type has a name for debugging purposes, a regex to perform the check and a clean function called to e.g. remove
qotes from a string literal and unwrap the escapes.
... | true |
91204f99a8735b5729b942fb26d1c1141c476bcc | Python | anon-usr/INLUCB | /core/attribute.py | UTF-8 | 4,942 | 3.90625 | 4 | [
"MIT"
] | permissive | import math
class Attribute(object):
"""A class for handling an attribute.
Attribute can be either numeric or nominal and should never be changed after creation.
Note:
This class is based on the Weka implementation (weka.core.Attribute) to make porting existing
Java algorithms an easier task.
Args:
name ... | true |
e60070d17c8358f9371295bc85341e8abac641db | Python | allisoncstafford/advent_of_code | /day_5/day5_pt1.py | UTF-8 | 4,207 | 3.703125 | 4 | [
"MIT"
] | permissive | import numpy as np
def intcode_comp(puzzle_input):
"""Compute based on the intcode instructions below
# position mode:
# 1: positional add
# 2: positional multiply
# 3: get input and save it at location of parameter
# 4: output value located at parameter
# immediate mode:
... | true |
dceda0a7faff2a39cc0022bbef0852513be6937f | Python | gauravshilpakar/MachineLearning | /Capstone Project/Submission/maxpool.py | UTF-8 | 1,503 | 2.59375 | 3 | [] | no_license | import numpy as np
class Maxpool2D:
def __init__(self, pool=(2, 2), stride=(2, 2), padding=None):
self.stride_h, self.stride_w = stride
self.pool_h, self.pool_w = pool
if padding is not None:
self.pad_h, self.pad_w = padding
else:
self.pad_h, self.pad_w = (0... | true |
9bcd00397c604779af3d193da4aacaa73d6e56fb | Python | Moulick/codechef | /FRMQ.py | UTF-8 | 8,403 | 3.84375 | 4 | [] | no_license | # Chef and Array
#
# Chef has an array A[] of N elements denoted by A0, A1, ..., AN-1.
#
# He thinks about M questions of following kind: "What is the maximum element among Ai where i lies
# between min{x, y} and max{x, y} both inclusive?"
#
# You have to help Chef to find out sum of answers of all the M questions.
#
#... | true |
c83ea04813c4a391afbb7238328fb43ea10f73e0 | Python | louisdang/govhack2016 | /sides/utils.py | UTF-8 | 3,839 | 2.96875 | 3 | [] | no_license | import googlemaps
gmaps = googlemaps.Client(key='AIzaSyDPvDQc0_i1cT9sMoT7vnHRUuk8vF3D1CE')
from pulp import LpProblem, LpMinimize, LpInteger, LpVariable, lpSum
import collections
import logging
logging.basicConfig()
log = logging.getLogger(__name__)
def convert_int(x):
if x is None:
return 0
try:
... | true |
883b031a84dae58a67f407fd6a4eb33e28de4ce3 | Python | raceconditions/PiSpeedTrap | /client.py | UTF-8 | 1,941 | 2.921875 | 3 | [] | no_license | import socket
import sys
import io
import struct
import numpy as np
import cv2
import time
# Create a TCP/IP socket
lic_ip = "192.168.100.120"
# Connect the socket to the port on the server given by the caller
server_address = (lic_ip, 10000)
def getLicensePlateImage(filePath):
try:
sock = socket.socket(... | true |
b8c57f1fa7a43e086abcbbe44d7ac84bcc71105d | Python | FAndersson/polynomials_on_simplices | /polynomials_on_simplices/visualization/plot_triangles.py | UTF-8 | 5,476 | 2.90625 | 3 | [
"MIT"
] | permissive | """Functionality for plotting triangles."""
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # noqa # Avoid warning about unused import (req. for 3d plots to work)
import numpy as np
from polynomials_on_simplices.visualization.plot_lines import plot_space_curve
def plot_triangle_mesh(t... | true |
f630329a691bc405e4f78cf406d3759b2d1e5510 | Python | Ekeopara-Praise/python-challenge-solutions | /Ekeopara_Praise/Phase 2/FILE I & O/Day80 Tasks/Task3.py | UTF-8 | 289 | 3.875 | 4 | [
"MIT"
] | permissive | '''3. Write a Python program to count the number of lines in a text file.'''
def file_lengthy(fname):
with open(fname) as f:
for i, l in enumerate(f):
pass
return i + 1
print("Number of lines in the file: ",file_lengthy("test.txt")) | true |
73c2b72245fd8b547afcbe5fdf9eeb97386e75cc | Python | MinzhengHuang/Python_Imooc | /Python_Rudiment/chapter_04/chapter_4.07.py | UTF-8 | 949 | 4.6875 | 5 | [] | no_license | # coding=utf-8
# Python之创建tuple
# tuple是另一种有序的列表,中文翻译为“ 元组 ”。tuple 和 list 非常类似,但是,tuple一旦创建完毕,就不能修改了。
# 同样是表示班里同学的名称,用tuple表示如下:
# >>> t = ('Adam', 'Lisa', 'Bart')
# 创建tuple和创建list唯一不同之处是用( )替代了[ ]。
# 现在,这个 t 就不能改变了,tuple没有 append()方法,也没有insert()和pop()方法。所以,新同学没法直接往 tuple 中添加,老同学想退出 tuple 也不行。
# 获取 tuple 元素的方式和 li... | true |
7c27eaf33f5cc2e200bcf5dc5ca0d258f1c5c40d | Python | gabrielegr/FEM3D | /application/classes.py | UTF-8 | 1,114 | 2.671875 | 3 | [] | no_license | import numpy as np
class Node:
def __init__(self, id, x, y,z):
self.id = id
self.x = x
self.y = y
self.z = z
self.index = id - 1 # the index in a vector
class Element:
def __init__(self, id, node1, node2, node3, node4, node5, node6, node7, node8, node9, node10... | true |
66a6782d48869d1f516a0aa2d6c6f2bacce459d1 | Python | cdelcastillo21/tapisv2_apps | /tapis-pylauncher/job_configs/shell_demo/generator.py | UTF-8 | 661 | 2.546875 | 3 | [] | no_license | import argparse
import json
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("iter", type=int)
parser.add_argument("np", type=int)
parser.add_argument("--message", type=str, default="Hello World!")
parser.add_argument("--num-jobs", type=int, default=5)
args = parser.parse_... | true |
5e09e3d9201ebd9a76e7df3fc4b0408887476cc4 | Python | christianwarloe/robotBuilder | /svggen/api/composables/graph/Joint.py | UTF-8 | 871 | 2.515625 | 3 | [] | no_license | from svggen.utils import mymath as math
class Joint:
#ANDYTODO: transform these into sublclasses of HyperEdge and/or component
def __repr__(self):
return repr(None)
types = ["REVOLUTE", "PRISMATIC"]
dirs = ["ALONG", "ACROSS", "NORM"]
jointType = "REVOLUTE"
lowerLimit = None
u... | true |
26bf76ec9b44eb924c4fe954b1f36aa9d51fc8c7 | Python | cWjL/views | /src/visit.py | UTF-8 | 948 | 2.8125 | 3 | [] | no_license | import time
from progressbar import ProgressBar
from random import randint
class visit():
def __init__(self, tor, url, n, log):
self.tor_driver = tor
self.url = url
self.n = int(n)
self.log = log
def run(self):
bar = ProgressBar()
for _ in bar(range(self.n)):
... | true |
fde9684c7079ddcc7d1fdffa9ed5f2bca17e5d41 | Python | krishnajain/Disarium-Number | /Disarium Number.py | UTF-8 | 482 | 4.0625 | 4 | [
"MIT"
] | permissive | def calculateLength(n):
length = 0;
while(n != 0):
length = length + 1;
n = n//10;
return length;
num = int(input("Enter Number :"));
rem = sum = 0;
len = calculateLength(num);
n = num;
while(num > 0):
rem = num%10;
sum = sum + int(rem**len);
... | true |
41dd5fda906952933aacaeeea728c610087c979a | Python | Lucas-Urbano/Python_Start | /Desafio03_02.py | UTF-8 | 138 | 4.125 | 4 | [] | no_license | n1 = int(input("Escreva um número: "))
n2 = int(input("Escreva outro número: "))
s = n1 + n2
print("A soma entre", n1, "e", n2, "é", s) | true |
e353fa0dcb5c5f7e467791f16912ed3027301633 | Python | megatroom/dojo-python | /secretfriend/secret_friend.py | UTF-8 | 283 | 3.921875 | 4 | [
"MIT"
] | permissive | from random import choice
friends = input("Digite o nome dos amigos: ").split(",")
friends_copy = friends.copy()
print("Sorteio:")
for friend in friends:
secret_friend = choice(friends_copy)
print(f"{friend:10} => {secret_friend}")
friends_copy.remove(secret_friend)
| true |
254079b93b5cfd753684cdc14e7368fe51aa851c | Python | annaandraszek/Matching-Predicting-Scientific-Variables | /language_processing.py | UTF-8 | 1,088 | 2.78125 | 3 | [] | no_license | import nltk
#nltk.download('punkt')
#nltk.download('stopwords')
from nltk.tokenize import WordPunctTokenizer
from nltk.corpus import stopwords
from nltk.corpus import wordnet
from nltk.stem import PorterStemmer
from nltk.stem import WordNetLemmatizer
#from pattern.en import suggest
def tokenise(string):
return nlt... | true |
0649309f56a61864dcd37087f0ae80df9a06a5bf | Python | rcrowther/dancer | /parser/ConsoleStreamReporter.py | UTF-8 | 572 | 2.65625 | 3 | [] | no_license |
from Reporter import Reporter
from Position import NoPosition
##
# Add colour
class ConsoleStreamReporter(Reporter):
def __init__(self):
Reporter.__init__(self)
def error(self, m, pos = NoPosition):
Reporter.error(self, m, pos)
print(pos.toDisplayString('Error: ' + m))
def wa... | true |
5d7c70288b6ac1f8b8174b56af643070e989ae81 | Python | bibinss/opencv | /faces_train.py | UTF-8 | 1,148 | 2.65625 | 3 | [] | no_license | import cv2 as cv
import os
import numpy as np
stars = ['sachin', 'gavaskar', 'lara']
DIR = r'Train'
features = []
labels = []
haar_cascade = cv.CascadeClassifier('haar_face.xml')
def create_train():
for person in stars:
path = os.path.join(DIR, person)
label = stars.index(person)
for img... | true |
b34568abc5e58e7e31b33f77ef51a7a36535a59c | Python | cryptofreed/python-web-scrapers | /bluesalleyscraper.py | UTF-8 | 9,180 | 3.15625 | 3 | [] | no_license |
from urllib.request import urlopen #for pulling info from websites
from bs4 import BeautifulSoup #for manipulating info pulled from websites
import re #real expressions
import datetime
import csv #comma-separated values
import scraperLibrary #custom library for venue site scraping
pages = set() #create an empty set ... | true |
850f5e479c54b042dae034971d08264a60c34889 | Python | htethtethtunjewel/coding-sprint | /ex14.py | UTF-8 | 478 | 3.640625 | 4 | [] | no_license | from sys import argv
script, user_name = argv
pmp = '>>'
print(f"Hi {user_name},I'm the {script} script.")
print("I'd like to ask you a few question")
print(f"Do you like me {user_name}?")
likes = input(pmp)
print(f"Where do you live {user_name}?")
lives = input(pmp)
print("What kind of computer do you have?")
computer... | true |
49694343efb8ae958409b097ba76dde6ce2922b1 | Python | SergioDev22/Piscine_Esti_2021 | /Piscine_2021/tri.py | UTF-8 | 259 | 3.125 | 3 | [] | no_license | #coding:utf-8:
fichier=open("fichier.txt","r")
ligne=fichier.readlines()
i=0
dico={}
for mot in ligne:
b=list(mot.split())
dico[int(b[i+1])]=str(b[i])
for kle, valeur in sorted(dico.items(), key=lambda x: x[0]):
print("%s: %s" % (kle, valeur))
| true |
e7a5a9b133c53ce7fa1493f86d2fc78e569ed8ea | Python | CodecoolBPwswp/wswp-proman-magic-mongooses | /main.py | UTF-8 | 3,841 | 2.578125 | 3 | [] | no_license | from flask import Flask, render_template, request, session, redirect, url_for
import data_manager
import json
import password_handler
app = Flask(__name__)
@app.route("/")
def boards():
""" this is a one-pager which shows all the boards and cards """
if "user" not in session:
return redirect(url_for(... | true |
7d0fb5204325ee4bc639060c404cdf31d0fb2781 | Python | Aasthaengg/IBMdataset | /Python_codes/p03127/s601727730.py | UTF-8 | 161 | 2.734375 | 3 | [] | no_license | from fractions import gcd
n = int(input())
a = [int(i) for i in input().split()]
g = a[0]
for i in a[1:]:
g = gcd(g, i)
if g == 1:
break
print(g) | true |
5197630eea9903f381cf1a2563bea5ee6d0886fc | Python | MiringuNgure/Pytho_codes | /inheritance/inheritance.py | UTF-8 | 952 | 4.09375 | 4 | [] | no_license | class Employee:
def __init__(self, name, age, salary):
self.name = name
self.age = age
self.salary = salary
def work(self):
print(f"{self.name} is working ....")
def __str__ (self):
return f"{self.name} , {self.age}, {self.salary}"
class SoftwareEngineer(Employee):... | true |
1710b66a0b00aa75d9851a41d62227593548ab98 | Python | RakshanaGovindarajan/SparseMatrix | /TestSparseMatrix.py | UTF-8 | 11,338 | 3.65625 | 4 | [] | no_license | # File: TestSparseMatrix.py
# Description: Sparse matrix representation has a single linked
# list having the row, column, and non-zero data in each link
# Student Name: Rakshana Govindarajan
# Student UT EID: rg38236
# Course Name: CS 313E
# Unique Number: 50945
# Date Created: 12 April 2016
# Date La... | true |
97f769e54e633effdbad6960cc7966fcc6455e57 | Python | matslindh/codingchallenges | /knowit2020/16.py | UTF-8 | 628 | 3.453125 | 3 | [
"MIT"
] | permissive | from cachetools import cached
from math import sqrt
# @cached(cache={})
def divisors(n):
divs = {1, n}
for x in range(2, int(sqrt(n))+1):
if n % x == 0:
divs.add(x)
divs.add(n // x)
return divs
def test_divisors():
assert divisors(12) == {1, 2, 3, 4, 6, 12}
if... | true |
550fb3a44855c6540cd733a5895612e265ecfe98 | Python | PacktPublishing/OpenCV-Computer-Vision-Projects-with-Python | /Module 2/1/image_filters.py | UTF-8 | 2,407 | 2.890625 | 3 | [
"MIT"
] | permissive | # http://lodev.org/cgtutor/filtering.html
import cv2
import numpy as np
#img = cv2.imread('../images/input_sharp_edges.jpg', cv2.IMREAD_GRAYSCALE)
img = cv2.imread('../images/input_tree.jpg')
rows, cols = img.shape[:2]
#cv2.imshow('Original', img)
###################
# Motion Blur
size = 15
kernel_motion_blur = np.z... | true |
abd3664097b7ad198fc124196be8496bc8d70d09 | Python | LihuaJulieZhu/OneStopRNAseq | /snakemake/script/tsv2xlsx.py | UTF-8 | 213 | 2.90625 | 3 | [] | no_license | import pandas as pd
import sys
print("usage: xlsx2txt.py name.txt")
print("output: name.txt.xlsx")
fname = sys.argv[1]
oname = fname + ".xlsx"
df = pd.read_table(fname)
print(df)
df.to_excel(oname, index=False)
| true |
bfd8b7eec17d2e9f7f286b42623bbb1adb9bef7f | Python | kgtdbx/gluent-eng | /gluent_eng/process_logs.py | UTF-8 | 16,548 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | #! /usr/bin/env python
""" ProcessLogs: Discover and present 'logs' from running Linux processes
Logs = text files with 'relevant' (user controlled) extensions, i.e. .txt or .log
"""
import logging
import os
import os.path
import re
import socket
from .linux_cmd import LinuxCmd
from .log_setup import LogSetup
... | true |
e3f9fe356c426735b5eefd318f464025d49f4a35 | Python | zhaoqyu/DeepLearningForTSF | /4.时间序列案例研究/1.室内运动时间序列分类(KNN)/06.将文件按照关联关系拼成train和test集合,每个文件取25条,不足25补0.py | UTF-8 | 3,289 | 2.828125 | 3 | [] | no_license | # prepare fixed length vector dataset
from os import listdir
from numpy import array
from numpy import savetxt
from pandas import read_csv
from numpy import pad
# 加载IndoorMovement/dataset和IndoorMovement/groups下的所有文件
def load_dataset(prefix=''):
grps_dir, data_dir = prefix+'groups/', prefix+'dataset/'
# 读取单个文件,Moveme... | true |
b7a986ff80d6cce59aa7ba8269b414b645f81f19 | Python | viren-patel/fishgame | /10/xclients | UTF-8 | 5,089 | 3.078125 | 3 | [] | no_license | #!/usr/bin/python3
import argparse
import sys
import json
import socket
import time
from threading import Thread
sys.path.insert(1, '../Fish')
from Player.strategy import MinimaxStrategy
from Common.game_tree import GameTreeNode
from Common.state import State
from Common.utils import parse_json
CLIENT_DEPTH = 1
DEFAU... | true |
223aec03d4de6327ee090d8da1635d50e0675d51 | Python | joseph-x-li/fedlearn | /src/arguments.py | UTF-8 | 3,196 | 2.734375 | 3 | [] | no_license | import argparse
def args_parser():
parser = argparse.ArgumentParser()
# Learning Arguments
parser.add_argument("--epochs", type=int, default=10,
help="Number of rounds of training.")
parser.add_argument("--local_ep", type=int, default=10,
help="The num... | true |
72280c215c07a4634f8b2d2e2fc61297e8091250 | Python | hui-shao/python-toolkit | /file-tools/move-by-date/main.py | UTF-8 | 2,473 | 2.765625 | 3 | [
"Python-2.0",
"MIT"
] | permissive | import getopt
import os
import re
import shutil
import sys
import time
def main():
os.chdir(sys.path[0]) # 切换到脚本所在目录(pyinstaller打包时需要注释掉)
options()
loop(filenames)
def options():
"""用于处理传入参数"""
print("")
global overwrite
global filenames
opts, args = getopt.getopt(sys.argv[1:], '-h-... | true |
e1a32187a5454375e6ed74b44800079753bca330 | Python | BBode11/CIT228 | /Lesson5/Chapter_10/glossary.py | UTF-8 | 3,124 | 4.25 | 4 | [] | no_license | print("\t*---------- Hands on #4 ----------*")
import json
def menu():
selection = int(input("1 -- create file, 2 -- read file, 3 -- add to file, 4 -- quit"))
while selection != 1 and selection != 2 and selection != 3 and selection != 4:
print("You made an invalid selection... Please try again.")
... | true |
07a77988dc1ee92e02b11e77e9e27c36bb9bafe9 | Python | newjokker/PyUtil | /ReadData/RandomUtil.py | UTF-8 | 1,408 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# -*- author: jokker -*-
# todo add random array
import random
import numpy as np
class RandomUtil(object):
@staticmethod
def choice(data):
"""Choose a random element from a non-empty sequence."""
return random.choice(data)
@staticmethod
def randint(min_num... | true |
dd929fc9ae9b9d92a6a993aa90b2f247a2a06f42 | Python | dstansby/publication-code | /2018-density-structures/library/derived.py | UTF-8 | 2,305 | 3.0625 | 3 | [] | no_license | import astropy.units as u
import astropy.constants as const
import numpy as np
def p_mag(B):
return B**2 / (2 * const.mu0)
def p_th(n, T):
return n * const.k_B * T
def beta(n, T, B):
return p_th(n, T) / p_mag(B)
def calc_derived(corefit):
'''
Method to calculate derived plasma values
Th... | true |
f8e7a726b97f4b7b594275f4116588459350bad5 | Python | scsa3/mysite | /tools/utilities/nfo_finder.py | UTF-8 | 662 | 3 | 3 | [] | no_license | import sys
import re
from pathlib import Path
from typing import List
def nfos_finder(source_directory: Path) -> List[Path]:
pattern = r'^[a-zA-Z]{2,5}-?[0-9]{3,5}' \
r'\.nfo$'
result = []
for path in source_directory.glob('**/*'):
if re.search(pattern, path.name):
result... | true |
2e57248c09ac5d6b6b66dc5b4ea52b47f9a5b68a | Python | bigbugbb/OCR | /OCR/dataset/dataset.py | UTF-8 | 4,406 | 2.625 | 3 | [] | no_license | from __future__ import print_function
import sys
import csv
import copy
import random
def load_original_dataset(path):
data = []
with open(path, 'r', 4096) as csvfile:
dialect = csv.Sniffer().sniff(csvfile.read(), delimiters='\t ')
csvfile.seek(0)
reader = csv.reader(csvfile, d... | true |
2bd736d39e3d915367ce5c6d0fc93920b75d761e | Python | trinhhoaichuong/gamedev | /shmup/shmup-12.py | UTF-8 | 8,651 | 2.953125 | 3 | [
"MIT"
] | permissive | # Shmup - Part 12
# powerups (shield)
# by KidsCanCode 2015
# A space shmup in multiple parts
# For educational purposes only
# Art from Kenney.nl
# Frozen Jam by tgfcoder <https://twitter.com/tgfcoder> licensed under CC-BY-3
import pygame
import random
from os import path
sound_dir = path.join(path.dirname(__file_... | true |
96611467ff6abe4291ec2ee49a5826cadff37a7e | Python | joudaPROTO/python_prcts | /full_name.py | UTF-8 | 822 | 3.46875 | 3 | [] | no_license | first_name = "jouda"
last_name = "almeghari"
full_name = f"{first_name} {last_name}" # f-strings(f for format )
print(full_name)
print(f"Hello, {full_name.title()}!") # .title changes the name to title case
massage = f"Hello, {full_name.title()}!" # f-string can be used to hold a massage,
... | true |
a0cea206c3018c236d6b2e28c33c1dedc6a935ba | Python | amalbh1999/supreme-court-transcripts | /supremecourtapp/app.py | UTF-8 | 3,273 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
import flask
from flask import Response, request, send_file
import json
import sqlite3
import csv
# Create the application.
app = flask.Flask(__name__)
@app.route('/')
def index():
"""
Displays the home page that leads users into different pages
"""
return flask.render_template('index.html'... | true |
73100f9b37fe81d340b4a41adac6d163888be514 | Python | brooke-zhou/Equilibrium-Criteria-by-Voronoi-Tessellation | /three_atom_stat.py | UTF-8 | 17,110 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 15 22:20:22 2018
@author: Yacong
"""
import glob,os
from initialize_dict import initialize_dict
def create_type_table(type_lookup_file):
type_table = {0:0}
# os.system('ls')
with open(type_lookup_file,'r') as type_lookup:
for lc... | true |
48d57763cbd758383d9fce440ed2c672afc39ce7 | Python | yuhaozhang/nnjm-global | /code/io_model.py | UTF-8 | 2,262 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
A module that is used to save and load the model parameters.
"""
usage = "A module that is used to save and load the model parameters."
import os
import sys
import time
import re
import codecs
import cPickle
def save_model(model_file, classifier):
sys.stderr.write('---> Save model to %s... | true |
2226a33cc83c4a3bbf34786e264674c0412a3206 | Python | Rvk1605/Python | /Programs/User Input.py | UTF-8 | 163 | 3.25 | 3 | [] | no_license | from array import*
a=array('i',[])
print("Enter No. of Elements:")
n=int(input())
for i in range(n):
a.append(int(input()))=List(map(int,input().split())) | true |
27f3f20929e0884e4850ca663ca907e40e6753a7 | Python | EmuRaha/MyPythonCodes | /project23.py | UTF-8 | 503 | 3.46875 | 3 | [] | no_license | n=int(input("length="))
list=[]
for i in range(n):
j=int(input('Enter number='))
list.append(j)
print(list)
print()
from array import *
n=int(input("length="))
vals=array('i',[])
for i in range(n):
p=int(input('Enter something according to the typecode='))
vals.append(p)
print(v... | true |
fcc922e3a0322a60f3c48e7582c7884085095f93 | Python | Marsable/python_exec | /Python_base/test08.py | UTF-8 | 404 | 3.34375 | 3 | [] | no_license | a = {'姓名':'高小一','年龄':18,'薪资':30000,'城市':'北京'}
b = {'姓名':'高小二','年龄':19,'薪资':20000,'城市':'上海'}
c = {'姓名':'高小五','年龄':20,'薪资':10000,'城市':'广州'}
d = [a,b,c]
print(d)
for i in range(len(d)):
print(d[i].get("薪资"))
for i in range(len(d)):
print(d[i].get("姓名"),d[i].get("年龄"),d[i].get("薪资"),d[i].get("城市"))
| true |
f1542e987b2360f3799fa9ff22578a57db73c835 | Python | luciodj/OLED-Picture-Editor | /OLEDGUI.py | UTF-8 | 7,352 | 2.984375 | 3 | [] | no_license | #!usr/bin/env python
#
# OLED display picture editor
#
import sys
from Tkinter import *
from itertools import imap
from os import path
import tkMessageBox
#
# window definition
#
class EditorWindow():
def __init__(self, parent = None, name=''):
win = Tk()
win.title( 'OLED Picture Editor')
w... | true |
d3a838090bffa907e7ac07059a5504717dbb2437 | Python | mseyne/bansoko | /bansoko/gui/navigator.py | UTF-8 | 5,362 | 3.59375 | 4 | [
"MIT"
] | permissive | """Module for game screens management."""
import abc
from typing import Optional, Callable, List
from bansoko.gui.input import InputSystem
from bansoko.gui.screen import Screen
class ScreenController(abc.ABC):
"""Base class for all game screen controllers that suppose to be managed by ScreenNavigator.
... | true |
21253cc22740055f92ad3d8f09250c2329edf7c6 | Python | ragibayon/Python_Crash_Course | /Code/Module 3/Graded_Assessment_EX_3.py | UTF-8 | 517 | 4.46875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 2 19:37:45 2020
Complete the function digits(n) that returns how many digits the number has.
For example: 25 has 2 digits and 144 has 3 digits.
Tip: you can figure out the digits of a number by dividing it by 10 once per digit until there are no digits left.
@author: Ra... | true |
8bfbb0519fa5bab2e31c487738736dcb93de71b8 | Python | SteffTek/Gunther-Bot | /tools/learning.py | UTF-8 | 917 | 2.9375 | 3 | [] | no_license | import threading
import time
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from chatterbot.trainers import ChatterBotCorpusTrainer
class learning:
def __init__ (self, main, bot):
self.__main = main
self.__bot = bot
self.__list_trainer = ListTrainer(self.__bot... | true |
09eec58425d5d0b1642f8061f7b42b1f51903321 | Python | kkacan/Osnove_Programiranja | /Vjezba4/vjezba4_zd06.py | UTF-8 | 324 | 3.640625 | 4 | [] | no_license | # Kristijan Kačan, 16.11.2017.
# Vježba 4 zadatak 6
# unos niza znakova
niz_1=str(input("Unesite prvi niz znakova: "))
niz_2=str(input("Unesite drugi niz znakova: "))
# provjera i ispis
if niz_1 in niz_2:
print (niz_2[niz_2.find(niz_1)+len(niz_1):])
else:
print("Niz",niz_1,"ne pojavljuje se u niz... | true |
7d12c4bc9b1965d34b7d96e45887fe191a7d3c2f | Python | roy-basmacier/LeetCode | /Solutions/1160. Find Words That Can Be Formed by Characters.py | UTF-8 | 808 | 3.234375 | 3 | [] | no_license | class Solution:
def countCharacters(self, words: List[str], chars: str) -> int:
# Time Complexity -> O(n)
# Space Complexity -> O(n)
freq = {}
for ch in chars:
if ch in freq:
freq[ch] += 1
else:
freq[ch] = 1
cn... | true |
336ee2685d6e2429b64d1af67e7b460e2fcc9f0f | Python | python279/pyairmonitor | /server/data_process.py | UTF-8 | 1,737 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#
# lhq@python279.org
import os
import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
if __name__ == '__main__':
columns = ['timestamp', 'temperature', 'humidity', 'pm2.5', 'pm10', 'pm1.0']
columns_without_index = ['temperature', 'humidity', 'pm2.5', 'pm10'... | true |
d6442b3b7eefdb4298163d75a4e68de057577c2a | Python | koiked/projectcodes | /pythonproject/3dplot.py | UTF-8 | 1,473 | 3 | 3 | [] | no_license | # =-=-=-=-=-=-=-=-=-=-=-=- module -=-=-=-=-=-=-=-=-=-=-=-= #
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
from mpl_toolkits.mplot3d import Axes3D
import seaborn as sns
import math, os, argparse
sns.set_style('whitegrid')
# =-=-=-=-=-=-=-=-=-=-=-=- main -=-=-=-=-=-=-=-=... | true |
3b07fc9cf10b71b477854930d2839b869cf8ba1c | Python | kerwin-ly/python-learning | /function/map_reduce.py | UTF-8 | 322 | 3.96875 | 4 | [] | no_license | from functools import reduce
def multiple(x):
return x * x + 100
# map: abstract formula with a function
map_num = map(multiple, [1, 2, 3, 4])
print(list(map_num)) # 1, 4, 9, 16
# reduce: use the function result to calculate
def transfer(x, y):
return x * 10 + y
print(reduce(transfer, [1, 2, 3, 4])) # 1234... | true |
3af10f5dbf4f92f270856a5e88f738ab31834b2d | Python | gitter-badger/astrality | /astrality/resolver.py | UTF-8 | 5,023 | 3.53125 | 4 | [
"MIT"
] | permissive | """Module defining Resolver class for templating context handling."""
from math import inf
from numbers import Number
from typing import (
Any,
Dict,
ItemsView,
Iterable,
KeysView,
ValuesView,
Optional,
Union,
)
Real = Union[int, float]
Key = Union[str, Real]
Value = Any
class Resol... | true |
9bac856e84cd63f9af761ec346f6c0de061f93a5 | Python | SouvikBhattacharji2020/My_Code | /Python/Password/Password_Using_Tkinter.py | UTF-8 | 668 | 3.203125 | 3 | [] | no_license | import tkinter
window = tkinter.Tk()
window.geometry("500x250")
# to rename the title of the window
window.title("AsansaSolution 2020")
# pack is used to show the object in the window
label1 = tkinter.Label(window, text = "Enter your user id :").place(x = 30,y = 50)
# Entry is used to show the object in the window
... | true |
1351862aa6f5c09919084a21319c9ae23fda977e | Python | baballev/EzLearner | /EzLearner.py | UTF-8 | 6,781 | 3.546875 | 4 | [] | no_license | # coding: utf8
from __future__ import unicode_literals
import os
import random
import sys
import time
import pickle
import math
import io
# EzLearner 0.2
#TODO:
# 1) Main menu - Modes: Version / Thème
# 2) gestion des parenthèses / des slashs
'''
n = number of words
Every word start with weight 16.
Iitial capacity... | true |
422d1cd73b46f6db38f530816b539f3d1fcc80d3 | Python | heyder/ctf | /htb/boxes/control/hex_to_string.py | UTF-8 | 198 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import codecs
filename = sys.argv[1]
with open(filename, 'rb') as f:
content = f.read()
page = codecs.decode(content.strip(),'hex')
print(page.decode('utf-8'))
| true |
60871302539ed53e43884ba30ac08333f7a4426b | Python | chiminwon/Python365 | /charpter03/02_notation.py | UTF-8 | 197 | 3.078125 | 3 | [] | no_license | # 第一个注释
print("Hello, Python!")
# 第二个注释
# 第一个注释
# 第二个注释
'''
第三注释
第四注释
'''
"""
第五注释
第六注释
"""
print("Hello, Python!") | true |
4577a9fec6dd6e47b68ab7517a6d73a6ae98ca4c | Python | scut2sjtu/python-code | /machine learning codes/tree_h.py | UTF-8 | 4,994 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
from sklearn.tree import DecisionTreeRegressor
from sklearn import cross_validation
import matplotlib.pyplot as plt
# 随机产生的数据集
def creat_data(n):
np.random.seed(0)
X = 5 * np.random.rand(n, 1) # 保证每次生成的随机数相同
y = np.sin(X).ravel()
noise_num = (int)(n / 5)
... | true |
61e8d4e06a109fd9f1ab980946a5632a36810256 | Python | joelchartier/python-mega-course | /open_cv_exercices/camera_capture.py | UTF-8 | 296 | 2.5625 | 3 | [] | no_license | import cv2, time
video = cv2.VideoCapture(0)
while True:
check, frame = video.read()
gray_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow("Captured", gray_frame)
key = cv2.waitKey(500)
if key == ord('q'):
break
video.release()
cv2.destroyAllWindows()
| true |
621cd6a4ec42278bcd6874b431913aafa2b616d7 | Python | ZhuangLab/storm-control | /storm_control/hal4000/testing/testSequencing.py | UTF-8 | 2,227 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
These are for testing that HAL modules process messages in
the expected FIFO fashion.
Hazen 03/18
"""
import time
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.hal4000.halLib.halModule as halModule
class TestSimpleSequencing(halModule.HalModule):
"""... | true |
d218b8392c4b5f50a1295f5d4b412fd7de7934b5 | Python | peterhajas/control | /alexa/PyEcho/EchoDispatch.py | UTF-8 | 947 | 3.359375 | 3 | [
"BSD-2-Clause"
] | permissive | # A dispatch script for PyEcho. This script triggers events
# based on commands that are spoken to Alexa.
# By Scott Vanderlind, January 15 2015
import PyEcho, getpass, time
# Create an Echo object
email = raw_input("Email: ")
password = getpass.getpass()
echo = PyEcho.PyEcho(email, password)
# If we successfully lo... | true |
661cafa717f859807df1418891baf6e17634c9e7 | Python | rishi-s8/PageRank | /PagerankVectorized.py | UTF-8 | 871 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import random
import graph
# In[2]:
pages, links = 100, 250 #map(int,input().split())
epsilon = 1e-9
d = 0.85
iterations = 10000000
assert links <= pages*pages
assert d <= 1
# In[3]:
pageGraph = np.zeros(shape=(pages,pages))
# In[4]:
for ... | true |
656769fe85d58bf1282f0455c4d1dcd681a00173 | Python | yuanee/GraphTransfer | /code/Yuan/junk/Factorization.py | UTF-8 | 2,869 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 19 17:11:38 2018
@author: yuanneu
"""
import numpy as np
import networkx as nx
import tensorflow as tf
import math
import random
import time
def sigmoid_fun(x):
y=1/(1+np.exp(-x))
return y
def factorization_graph(nx_graph):
adj_mat=... | true |
4b985654bd74f9df7a661106b89c5041c17d10d8 | Python | Natacha7/Python | /Ejercicios_unidad2.py/Entero_mayor.py | UTF-8 | 219 | 4.15625 | 4 | [] | no_license | '''
Leer dos número enteros y determinar cuál es el mayor
'''
s=int(input("Digite un número s: "))
q=int(input("Digite un número q: "))
if s > q:
print("s es mayor que q")
else:
print("q es mayor que s")
| true |
cf5206ea4c6bf8e20097ee1b7f8a1f9791d13721 | Python | wuyou8933/Leetcode | /pan/lib/python2.7/site-packages/telegraf/tests.py | UTF-8 | 7,262 | 2.71875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from telegraf.client import ClientBase, TelegrafClient, HttpClient
from telegraf.protocol import Line
from telegraf.utils import format_string, format_value
import unittest
import mock
class TestLine(unittest.TestCase):
def test_format_key(self):
self.assertEquals(format_string('... | true |
8c0ee5c24dd1fc63993a7529047ce0384d8d613a | Python | VinayakSingoriya/Data-Structures-Python | /Sorting_algorithm/Selection_sort.py | UTF-8 | 478 | 3.984375 | 4 | [] | no_license | # Program for implementation of Selection_sort algorithm
arr = [25, 45, 34, 21, 6, 55]
for i in range(len(arr)): #Time complexity : O(n^2)
# Find the minimum element in a remaining unsorted array
min_index = i
for j in range(i+1, len(arr)):
if(arr[min_index] > arr[j]):
min_ind... | true |
a4bef85dd7c71fd102c14decfd960517cf92d718 | Python | roshani98/Human-Motion-Detection | /closest_point2.py | UTF-8 | 360 | 3.015625 | 3 | [
"MIT"
] | permissive | import sys
import math
def dist(a, b):
return math.sqrt(((a[0]-b[0])**2) + ((a[1]-b[1])**2))
def closest_point_pair(s1,s2):
if len(s1)==0 or len(s2)==0:
return -1
f1 = 0
f2 = 0
current_min = sys.maxsize
for p1 in s1:
for p2 in s2:
if dist(p1, p2)<current_min:
current_min = dist(p1, p2)
f1 = p1
... | true |
46022f55b84221214b054ea663af086ad9131cab | Python | hoik92/Algorithm-python-java- | /my_hobby/1861.py | UTF-8 | 1,091 | 2.734375 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10000)
def dfs(x, y, cnt, st):
global N, result, start, end
if start == m[x][y]:
start = st
result += cnt - 1
return
if cnt >= result:
if cnt > result:
start = st
end = m[x][y]
else:
if start > st:... | true |
e1a180f120bc9bbe81269e59fa5d1d963e326cea | Python | uutahan/OpenGL_ExampleProjects | /UmutUtkuTahan/position.py | UTF-8 | 675 | 3.1875 | 3 | [] | no_license | #CENG487 Assignment1 by
#Umut Utku Tahan
#250201086
#January 2020
from vec3d import Vec3d
from homogeneus import Homogeneus
#sys.path.append("graphic1.py")
#sys.path.append("homogeneus.py")
class Position( Homogeneus): #This is a vector class which have homogeneus coordinates
def __init__(self,x,y,z):
... | true |
d6489cb366235abd9b99ca1b65f4246c04165f74 | Python | TessaSmulders/SIOT | /Sensing/DATA/DualTimeSeries.py | UTF-8 | 2,946 | 2.75 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sodapy import Socrata
import datetime
from bokeh.models import HoverTool, ColumnDataSource
from collections import OrderedDict, Counter
from bokeh.plotting import figure, show, output_file
from bokeh.embed import components
# COLLECT DATA AND WRITE TO DATAFRAME
client = Soc... | true |
92eb554b57f87fd225e85b2f4fbc90ae34c4986c | Python | CPNV-ES/QUIZZ | /models/Quizz.py | UTF-8 | 1,385 | 2.75 | 3 | [] | no_license | '''
Quizz model for MongoDB database
Author : Steven Avelino
'''
from mongoengine import *
from .Question import Question
from .User import User
from bson import json_util
'''
Custom queryset for the class
Created for the purpose to modify the to_json method
'''
class CustomQuerySet(QuerySet):
def to_json(self):... | true |
04cdef2f19e67fe5aa423e8611b57018ee12d1a5 | Python | 981377660LMT/algorithm-study | /20_杂题/atc競プロ/AtCoder Beginner Contest/216/D - Pair of Balls.py | UTF-8 | 1,788 | 3.515625 | 4 | [] | no_license | """羊了个羊
有n个数,每个数都会出现两次。m个柱子,并给出柱子上的数。
当且仅当两个相同的数都处于柱子的最上面时,才能够将两个数删除。
问最后能否将柱子的数都删除。
n,m<=2e5
处于柱子的最上面:不存在依赖
!拓扑排序(注意到消除下面之前必须要消除上面)
"""
import sys
sys.setrecursionlimit(int(1e9))
input = lambda: sys.stdin.readline().rstrip("\r\n")
MOD = 998244353
INF = int(4e18)
from typing import List
from c... | true |
2d369f30172e9a30f8fa04b246ee6bab500ec6e3 | Python | IJustWantToSleep/ITMO_ICT_WebDevelopment_2020-2021 | /students/K33421/Kustova_Ekaterina/Lr1/Task2/sclient.py | UTF-8 | 432 | 3.09375 | 3 | [
"MIT"
] | permissive | import socket
# Задание №2
# КЛИЕНТ
def main():
conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
conn.connect(("127.0.0.1", 14900))
question = "What is the area of a trapezoid?"
conn.send(question.encode("utf-8"))
data = input()
conn.send(data.encode("utf-8"))
result = conn.recv(1... | true |
7d394172212f61e98fb986ae0a3a039dc34c6417 | Python | chencoolhero/hthassignments | /testScores.py | UTF-8 | 432 | 3.328125 | 3 | [] | no_license | testResults = [
[75, 65, 42, 73],
[62, 65, 67, 79],
[13, 17, 19, 17]
]
def studentScores(name):
if name == "Bob":
return testResults[0]
elif name == "Helen":
return testResults[1]
elif name == "Vic":
return testResults[2]
else:
return "Please enter a valid name"
p... | true |
efb4e20a1195bb5fc847e625aedf572389a263e4 | Python | LeonardoPoletti/Machine-Learning-e-Data-Science-com-Python | /Redes Neurais/Aula 02 - Redes Neurais com PyBrain.py | UTF-8 | 1,013 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 4 2017
@author: Leonardo
"""
from pybrain.datasets import SupervisedDataSet
from pybrain.tools.shortcuts import buildNetwork
from pybrain.supervised import BackpropTrainer
# passa as dimensões dos vetores de entrada e do objetivo
dataset = SupervisedDataSet(2, 1)
data... | true |
83ff7faa40ef6d4aa0c0d535e05d4980a5cc0eaa | Python | Akash-Nayar/deBot | /fact_opinion/factuality_training.py | UTF-8 | 1,260 | 2.53125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | import pickle
import numpy as np
from noggin import create_plot
import factuality_model as fm
from mynn.optimizers.adam import Adam
from mygrad.nnet.losses import softmax_crossentropy
import mygrad as mg
import matplotlib.pyplot as plt
def load_pickle():
pickle_in = open("factual.pickle", "rb")
fact_dict = pi... | true |
643d083c0b3e42471da61361a34a25cd1e20e3cb | Python | DeannaWagner/fullstack-nanodegree-vm | /vagrant/tournament/extra_credit_test.py | UTF-8 | 3,889 | 2.953125 | 3 | [] | no_license | # !/usr/bin/env python
# Project 2: Tournament Results Application is copyright 2015 Deanna M. Wagner.
# Test determines if the prevention of rematches extra credit option, found in
# in tournament.py is functioning as it should.
#
from tournament import *
import math
def matchCount(player1, player2):
"""Counts... | true |
928bd6ce4159c05d05d9d5f3e4e764666a945c71 | Python | Hashininirasha/Face_Recognition-App | /face.py | UTF-8 | 662 | 2.625 | 3 | [] | no_license | import cv2
cap = cv2.VideoCapture(0)
cascade=cv2.CascadeClassifier("im/haarcascade_frontalface_default.xml")
smilecascade=cv2.CascadeClassifier("im/haarcascade_smile.xml")
while True:
success,frame=cap.read()
gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
faces=cascade.detectMultiScale(gray,1.3,5)
for (x... | true |
ebbef3b02573172457c306c41c79f5415aaa53a9 | Python | Jma353/Hospital-Salary-v-Readmission-Rate-Data-Visualization | /scrape_salary.py | UTF-8 | 2,867 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python
from lxml import html
import requests
import re # Regular expressions
import json
states = {}
with open('state_info.json') as data_file:
states = json.load(data_file)
# Get a list of purely the towns where physician data exists for a given state
def towns_of_physic... | true |
8be8a7bc3d07821623ad887abc93c87bc9300104 | Python | arthurDz/algorithm-studies | /SystemDesign/multithreading and concurrency/data_race.py | UTF-8 | 381 | 3.484375 | 3 | [] | no_license | import threading
def modify_value():
global a
for _ in range(10_000_000):
a += 1
if __name__ == '__main__':
a = 0
thread_1 = threading.Thread(target=modify_value)
thread_2 = threading.Thread(target=modify_value)
thread_1.start()
thread_2.start()
thread_1.join()
thread_2... | true |
d98872ae41ef34852f6fad384d23a26841e7f073 | Python | IqbalSingh7077/Hr_Analytics | /Hr_analytics1.py | UTF-8 | 22,846 | 3.109375 | 3 | [] | no_license | #stage 1
#importing the useful libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
## importing the file
hr_train = pd.read_csv("aug_train.csv")
hr_test = pd.read_csv("aug_test.csv")
hr_train = pd.DataFrame(hr_train)
hr_test = pd.DataFrame(hr_test)
... | true |
8c04eb915f8fc1afea38174981108c1170bf5ecd | Python | ChampionsofEurope/Pattern | /Number Pattern 4.py | UTF-8 | 142 | 3.875 | 4 | [] | no_license | n = int(input("Enter the number of Rows:"))
for i in range(0, n+1):
for j in range(0, i + 1 + 1):
print(j, end = "")
print()
| true |
d5a52e8a8f67e26e1f8e4eb090879214dd0152b6 | Python | anwesha999/Data-Analysis-using-Microsoft-Azure | /histogram plot from data code.py | UTF-8 | 429 | 2.546875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
df_swing = pd.read_csv('fatalities.csv')
print(df_swing[['state', 'county', 'Rate_of_fatalities']])
"""
bin_edges = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
_ = plt.hist(df_swing['dem_share'], bins=bin_edges... | true |
7f684d12cec5b482333d2662aa26814c50aad3cb | Python | yuhanlyu/coding-challenge | /lintcode/count_of_smaller_numbers.py | UTF-8 | 576 | 3.265625 | 3 | [] | no_license | class Solution:
"""
@param A: A list of integer
@return: The number of element in the array that
are smaller that the given integer
"""
def countOfSmallerNumber(self, A, queries):
A.sort()
result = []
for q in queries:
left, right = 0, len(A) - 1
... | true |
0f69083eae8b3ce61d2e108d3f6f69a146cdfe9b | Python | IamGianluca/ufldl-tutorial | /exercises/ex1a_linreg.py | UTF-8 | 1,875 | 3.421875 | 3 | [
"MIT"
] | permissive | # This exercise uses a data from the UCI repository:
# Bache, K. & Lichman, M. (2013). UCI Machine Learning Repository
# http://archive.ics.uci.edu/ml
# Irvine, CA: University of California, School of Information and
# Computer Science.
# Data created by:
# Harrison, D. and Rubinfeld, D.L.
# ''Hedonic pr... | true |
5fffc8e74a93b622826d12333e259fdbe2e3233c | Python | mabiesen/ScrollphatPythonDice-PY | /dice.py | UTF-8 | 2,862 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python
#Import the following
import math
import sys
import time
import random
#Not inherent! need to download from Pimoroni
import scrollphat
#This section defines the lines that we will use to draw our numbers
def pos1():
scrollphat.set_pixel(7,0,1)
scrollphat.set_pixel(6,0,1)
scrollpha... | true |
8d314997f2f948c4e6ced2328106824aead08217 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2553/60730/304241.py | UTF-8 | 1,549 | 3.421875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int n;//二叉树节点数
struct tree//二叉树
{
int fa;//父亲节点
int l;//左孩子
int r;//右孩子
}tr[100005];
int w[100005];//结点的数值
int inord[100005];//中序遍历
int k;
int lis[100005];//最长不降子序列
void inorder(int root)//中序遍历
{
if(tr[root].l)//如果左儿子不为空
inorder(tr[root].l);//... | true |
29361e6813af2d86e78163af8c02d484ec9d5942 | Python | WhiteAu/SRL-PSL | /FB_to_PB.py | UTF-8 | 1,034 | 2.609375 | 3 | [] | no_license | import csv
from util import *
def fb_to_pb_map(map_file):
"""
Read a mappings file.
"""
f2p = {}
f = open(map_file,'r')
header=True
for line in f:
if header or line.strip()=='':
header=False
continue
(fbr,pbr,fba,pba) = line.strip().split(',')
... | true |
0b12271b9b46aa46eefbdc457f1e1c9fa84b0e03 | Python | xloso/m02_preboot | /retrocontador.py | UTF-8 | 272 | 2.828125 | 3 | [] | no_license | def retrocontador(e):
print("{},".format(e), end="") # el end es para que no haya salto linea
if e>0: #tiene que haber alguna condicion para que no entre en bucle infinito
retrocontador (e-1)
#esto es una función recursiva
retrocontador(10)
| true |
62fb18a3a87d6d776b2f0bf1317c1a182215ccc6 | Python | AdelAIawad/Communicate-Data-Findings | /slide_deck_template.py | UTF-8 | 4,498 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[3]:
# import all packages and set plots to be embedded inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sb
get_ipython().run_line_magic('matplotlib', 'inline')
import warnings
warnings.simplefilter("ignore")
# In[4]:
# load... | true |
610b975e9f6f8659652978c00577e1c95f84a201 | Python | khj68/algorithm | /Tree/1008_h.py | UTF-8 | 602 | 3.328125 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def bstFromPreorder(self, preorder: List[int]) -> TreeNode:
def helper(i, j):
if i==j: r... | true |
02e8f7a3fcd6282b8831bcb1e9ef716e84ee2d89 | Python | KostyaEsmukov/afancontrol | /tests/test_exec.py | UTF-8 | 826 | 2.609375 | 3 | [
"MIT"
] | permissive | import subprocess
import pytest
from afancontrol.exec import exec_shell_command
def test_exec_shell_command_successful():
assert "42\n" == exec_shell_command("echo 42")
def test_exec_shell_command_ignores_stderr():
assert "42\n" == exec_shell_command("echo 111 >&2; echo 42")
def test_exec_shell_command_... | true |