blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f2ee8a91493fc943872ab6c503c1edf2f7e73ea6 | Python | GarrettMooney/moonpy | /tests/conftest.py | UTF-8 | 325 | 2.6875 | 3 | [
"MIT"
] | permissive | import pytest
@pytest.fixture(scope="module")
def data():
return {
"data": {"a": 1, "c": 3, "b": 2},
"file_contents": '{\n "hello": "world"\n}',
"invalid_file_contents": '{\n "hello": world\n}',
"file_name": "tmp.json",
"sorted_file_contents": '{"a":1,"b":2,"c":3}',
... | true |
f152fa1ecf8d134c9da19aabc612e8427caffd9f | Python | Sarastro72/Advent-of-Code | /2019/16/puzzle2.py | UTF-8 | 586 | 3.09375 | 3 | [] | no_license | #!/usr/local/bin/python3
with open("input") as fp:
string = fp.readline().strip()
input = list(map(int, list(string)))
input = input * 10000
skip = int("".join([str(i) for i in input[:7]]))
length = len(input)
count = 1
for i in range(100):
output = [0] * length
for p in range(length-1, skip-1, -1):... | true |
98d5ed72f32044d030a84b51e1be48657e190fdd | Python | Paryaxify/450dsa | /Practice/LeetCode/97_interleaving_strings.py | UTF-8 | 1,395 | 3.953125 | 4 | [] | no_license | def isInterleaving(s1: str, s2: str, s3: str) -> bool:
l1 = len(s1)
l2 = len(s2)
l3 = len(s3)
# check whether the length of s3 is comparable to s1 and s2 or not
if l1 + l2 != l3:
return False
# set starting pointer to 0 for the strings
queue = [(0, 0)]
# add to visited set if t... | true |
9792aaf92212eddfc97e299cd331fc73b29a6f8c | Python | jainharshit27/P7_T | /P7_T.py | UTF-8 | 600 | 3.078125 | 3 | [] | no_license | import pygame
pygame.init()
screen = pygame.display.set_mode((200, 200))
countdown = 10
font = pygame.font.Font("freesansbold.ttf", 32)
# Add while condition such that the countdown will run until it is greater than 0
screen.fill((0,0,0))
for event in pygame.event.get():
if event.type =... | true |
46ed010784b55a81bde3a397700150a9f7d2c3c9 | Python | vanyaeccles/Android-HumanActivityRecognition | /Networking/basicUDPSocket.py | UTF-8 | 1,126 | 3 | 3 | [] | no_license | import socket, traceback
import time, os
from datetime import datetime
import keyboard
#simple script that streams data from port 5555 to the terminal
host = ''
port = 5555
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, s... | true |
0d960d2896624690a3c6de42e2e87016fb9db46b | Python | laurenah/image-downloader | /download_images.py | UTF-8 | 1,988 | 3.84375 | 4 | [] | no_license | # imports
import urllib.request
import argparse
# parser
parser = argparse.ArgumentParser(description="Download multiple images from a URL into the folder where this file is located. For example: " +
"using 'https://acnhapi.com/v1/icons/fish/' as the base URL, where ev... | true |
294e88c3aea81842e5a0ad76ef6e63b1f8a2bc5e | Python | dongyifeng/algorithm | /python/interview/matrix/transposition.py | UTF-8 | 364 | 3.453125 | 3 | [] | no_license | #coding:utf-8
# 矩阵倒置
# 将倒置矩阵
def transposition(matrix):
if matrix is None and len(matrix) > 0:return
n = len(matrix)
m = len(matrix[0])
if m <= 0 :return
r = [[0 for j in range(n)] for i in range(m)]
for i in range(n):
for j in range(m):
r[j][i] = matrix[i][j]
return r
m = [[1,2,3],[4,5,6]]
print m
t =... | true |
e8cea498bf64d7ac16d4b2b8c218885b0d3a9c10 | Python | gsi-upm/soba | /projects/GreenSOBA/agents/light.py | UTF-8 | 1,814 | 2.546875 | 3 | [
"MIT"
] | permissive | from transitions import Machine
from mesa import Agent, Model
from transitions import State
import configuration.settings
class Light(Agent):
states = [
State(name='off', on_enter=['set_off']),
State(name='on', on_enter=['set_on'])
]
def __init__(self, unique_id, model, room):
... | true |
20ef51f2dbb8e3f48f4b3dd0baebb73d8834500f | Python | 3dankateers/nitrogenspider | /pro_match.py | UTF-8 | 9,504 | 2.65625 | 3 | [] | no_license | ## Model for match
## matches: id, team1_name, team2_name, map_number, match_day, champs1, champs2, win, match_date, is_test, tournament_id, first_blood, kills_5, status
##odds (is embedded inside ProMatch)
## status possibilities: "nitrogen" or "csv or "both" or None
from nitrogen_db_client import NitrogenDbClient
fr... | true |
9bb934b9a72bcfcd9f27be0857bae2003881f11e | Python | Piropoo/dashboard | /dashboard/blueprints/views.py | UTF-8 | 2,847 | 2.625 | 3 | [
"MIT"
] | permissive | from flask import Blueprint, session, redirect, render_template, url_for, request, flash
from dashboard.ext.database import Usuario
bp = Blueprint('views', __name__)
@bp.route('/')
def index():
if 'usuario_logado' not in session:
session['usuario_logado'] = False
if not session['usuario_logado']:
... | true |
000e8412ebef8e7ac02231097df7b325babda5f1 | Python | liuwang1/tefla | /tefla/core/losses.py | UTF-8 | 13,373 | 2.953125 | 3 | [
"MIT"
] | permissive | # -------------------------------------------------------------------#
# Written by Mrinal Haloi
# Contact: mrinal.haloi11@gmail.com
# Copyright 2016, Mrinal Haloi
# -------------------------------------------------------------------#
import tensorflow as tf
import numpy as np
log_loss = tf.contrib.losses.log_loss
d... | true |
c6911b3ab0a8451f81b9c4ce9d92104da3aee688 | Python | ymsk-sky/atcoder | /abc217/a.py | UTF-8 | 59 | 2.921875 | 3 | [] | no_license | s,t=map(str,input().split())
print('Yes' if s<t else 'No')
| true |
9df23fbde85f293e598e5e644550e6f837b7c845 | Python | mjdroz/StatisticsCalculator | /UnitTests/test_random_generator.py | UTF-8 | 3,966 | 3.59375 | 4 | [
"MIT"
] | permissive | import unittest
from pprint import pprint
from RandomGenerator.random_generator import random
class MyTestCase(unittest.TestCase):
def setUp( self ) -> None:
self.random = random()
self.start = 1
self.end = 100
self.length = 6
self.seed = 8
self.num_val = 3
s... | true |
95b55ca47783f34a639950f1941e312ddd4a8e24 | Python | tobyhsu73/lidar | /draw.py | UTF-8 | 691 | 3.171875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import math
theta=np.arange(0,2*np.pi,0.02)
#for i in range (315):
#print(math.degrees(theta[i]))
x=[math.radians(45),math.radians(46),math.radians(47),math.radians(48),math.radians(49)]
print(x)
y=[1.3,1.4,1.5,1.4,1.6]
plt.subplot(polar=True)
plt.plot(theta,2*np.o... | true |
c74c3234a56b4c7ce4ae0c9930ecf8700d14bcf8 | Python | dastronmighty/literate-guacamole | /Data/GenData.py | UTF-8 | 1,664 | 3.0625 | 3 | [] | no_license | import numpy as np
import os
def add_xor_data(X):
return X[:, 0] + X[:, 1]
def gen_XOr_data():
x = np.array([[0, 0],
[0, 1],
[1, 0],
[1, 1]])
y = np.array([[0], [1], [1], [0]])
return x, y
def add_sub_sin_helper(x):
return x[:, 0] - x[:, 1]... | true |
146fe53beb4c0676119671a7204bb1385d03d5af | Python | Taxiozaurus/GeometricRunner | /scoreBoard.py | UTF-8 | 2,164 | 3.015625 | 3 | [] | no_license | import MySQLdb
# for this class to work you will need a MySQL database that presumably has 2 tables
# t1:
# users
# id int primary auto_inc
# nick
# password
#
# t2
# hiscore
# u_id int FK_users_id
# level varchar
# score
class Score :
def __init__(self) :
self.db_... | true |
060656cb9d176d2d95a7e477a3bc78c7f4fee4fd | Python | sreshthakashyap/OralScreen | /OralCellDataPreparation/predict_patch.py | UTF-8 | 2,033 | 2.796875 | 3 | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | # -*- coding: utf-8 -*-
import cv2
from tqdm import tqdm
import csv
from glob import glob
import os
#%%
z_offsets = ['z0', 'z400', 'z-400', 'z800', 'z-800', 'z1200', 'z-1200', 'z1600', 'z-1600', 'z2000', 'z-2000']
#%%
def generate_patch(w=80):
"""
Arguments:
w -- window size for patches
... | true |
6cf0fe329e96e57cded2e19b8c392fccb1484cc4 | Python | sinhlt58/mc_functions | /aniblock/blocks.py | UTF-8 | 1,162 | 2.53125 | 3 | [] | no_license |
from aniblock.constants import *
from aniblock.utils import *
class Block:
pass
class CommandBlock(Block):
def __init__(self, command, type="command_block"):
self.command = command
self.type = type
def to_mc_commands(self, pos, facing, relative=POS_RELATIVE_W):
pos_str = pos_t... | true |
b40ea948373cf881045e59ea34ab94018e2d7a23 | Python | dylanjorgensen/modules | /(custom)/single-script/mod.py | UTF-8 | 263 | 3.21875 | 3 | [] | no_license |
# Import
print 'this line printed just because you imported me'
# Function
def func():
return 'you called a function inside a module script'
# Class
class Classy(object):
def meth(self):
return 'you called a function with a class in it'
| true |
a27f23f0419598bdcd5f952e605d22ba904fdf8d | Python | tommylees112/esowc_notes | /analysis_scripts/spatial_r2.py | UTF-8 | 1,327 | 2.515625 | 3 | [] | no_license | #
true_da_shape = (true_da.lat.shape[0], true_da.lon.shape[0])
pred_da_shape = (pred_da.lat.shape[0], pred_da.lon.shape[0])
assert true_da_shape == pred_da_shape
vals = np.sqrt(
np.nansum((true_da.values - pred_da.values) ** 2, axis=0) / pred_da.shape[0]
)
da = xr.ones_like(pred_da).isel(time=0)
da.values = vals
# ... | true |
f4ffd341dcb2c6989f5c0ed37752f895a2abab12 | Python | constantine77/python | /basics/test.py | UTF-8 | 616 | 4.25 | 4 | [] | no_license |
#Data Structures in Python
def simple_list_iteration():
'''
List iteration
:return:
'''
A = [1,2,3,4,5]
for x in A:
print(x,type(x))
x += 1
print(x)
def list_index_iteration():
'''
List iteration with index
:return:
'''
A = [1,2,3,4,5]
for k in ... | true |
3e7741822e712c83e70c6bb8d2b3a602e2526e20 | Python | Dunkash/GroupTask3 | /helpers.py | UTF-8 | 2,800 | 3.015625 | 3 | [] | no_license | import numpy as np
def hex_to_rgb(hex_str):
return int(hex_str[1:3], 16), int(hex_str[3:5], 16), int(hex_str[5:7], 16)
class Point:
def __init__(self, x=0, y=0):
self.X = x
self.Y = y
def line(x1, y1, x2, y2, img, line_color):
beg = Point(x1, y1)
end = Point(x2, y2... | true |
f9f3f3bd4bfdb379b7c200c23701cd9501157c8d | Python | jhgdike/leetCode | /medium/different_ways_to_add_parenthese.py | UTF-8 | 1,809 | 3.3125 | 3 | [] | no_license | # coding: utf-8
class Solution(object):
def diffWaysToCompute(self, input):
"""
:type input: str
:rtype: List[int]
"""
res = []
length = len(input)
for i in range(0, length):
if input[i] in '+-*':
res1 = self.diffWaysToCompute(in... | true |
5280f4bf7e2aafa4a478a2c15884fc6e93f2c68f | Python | SVwrite/Web_Scrapers | /Book_scraper/book_scrapper.py | UTF-8 | 2,844 | 2.96875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
# import re
import os
import time
class Book:
def __init__(self, title= None, author = None, publisher = None, year =None, url = None, formats = None):
self.title = title
self.author = author
self.publisher = publisher
self.year = year
... | true |
3766aa7435651b8dbe2c3931d3e66e19c3c6fae1 | Python | JustLonggg/NLP_notes | /分词、词性标注以及命名实体识别/词性标注及信息提取/extract_data.py | UTF-8 | 293 | 2.515625 | 3 | [] | no_license | #encoding=utf8
import jieba
import re
from tokenizer import seg_sentences
fp = open('text.txt','r',encoding='utf-8')
fout = open('out.txt','w',encoding='utf-8')
for line in fp:
line = line.strip()
if len(line) > 0:
fout.write(' '.join(seg_sentences(line)) + '\n')
fout.close() | true |
99791b4c95d975c1d60413cce833a5930408a4ca | Python | flilyday/upgrade | /vervreqests/29._slots_ effect.py | UTF-8 | 3,011 | 3.90625 | 4 | [] | no_license | # 29._slots_ effect.py
# __dict__의 단점과 해결책
# 단점 : 객체의 값을 관리할 때 '키'를 이용해서 '값'을 얻게 하므로 리스트나 튜플보다 메모리 사용량이 많아진다.
# 그러므로 많은 수의 객체를 생성하려고 할 때는 메모리에 부담이 된다.
# 해결책 -> __slots__의 사용
# 0.일반적인 경우 : __dict__에 값이 할당
class Point3D :
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def __... | true |
6eeb769f77025bfe2f71669630bfb8c68321b794 | Python | bit-meddler/skunkWorks | /toys/viconFiles.py | UTF-8 | 7,817 | 2.796875 | 3 | [] | no_license | """
collection of functions to read vicon data, staring simple with the XML stuff
XCP
VSK
VSS
Then on to the hard one, x2d
X2D
"""
import numpy as np
from xml.dom import minidom
from quaternions import Quaternion
# In case we run out of precision
FLOAT_T = np.float32
INT_T = ... | true |
c01c5d78f3321bb3ee41216c7a8ba0ae70995123 | Python | shiftsayan/python-2048 | /play.py | UTF-8 | 5,691 | 3.15625 | 3 | [
"MIT"
] | permissive | ####################################
# Imports
####################################
from tkinter import *
from helper import *
from ai import *
####################################
# Draw Functions
####################################
def draw_win(canvas, data):
# Background
canvas.create_rectangle(0, 0, da... | true |
dcc8303f2f2c9683080515a40ce2af10afa0c328 | Python | Stihotvor/python3_magic_method_examples | /representation_and_validations.py | UTF-8 | 1,046 | 3.609375 | 4 | [
"MIT"
] | permissive | class Vessel:
def __init__(self, name: str):
"""
Initializing class instance with vessel name
:param name:
"""
self.name = name
self.fuel = 0.0
# list of dicts with passenger attributes
self.passengers = []
def __lt__(self, other):
"""
... | true |
1691fe8b8e5d967ed7b2c37820974ccac4cf4b35 | Python | davendiy/forpythonanywhere | /hackatons/materials/algo/source/T7_Graphs/P2/__test_ways.py | UTF-8 | 1,222 | 3.578125 | 4 | [] | no_license | from source.T7_Graphs.P1.GraphForAlgorithms import GraphForAlgorithms
from source.T7_Graphs.P2.BFS import BFS
from source.T7_Graphs.P2.DFS import DFS
from source.T7_Graphs.P2.Ways import waySearch, waySearchByWave
def show_way(vertices: list, weight, tag):
if vertices is None: # шляху не існує
print(tag... | true |
97c779d7fc7cd527675e6a63fd70d8cef29d9d4e | Python | W-KE/Leetcode-Solutions | /challenge/30-day-leetcoding-challenge/week1/maximum-subarray.py | UTF-8 | 440 | 3.140625 | 3 | [
"MIT"
] | permissive | from typing import List
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
maximum = nums[0]
subarray = []
for num in nums:
if num > maximum:
maximum = num
if num > 0:
subarray.append(num)
if subarray:
... | true |
9df4c6c22dd5f1a6617e7d9785b27930315c61e8 | Python | gdcohan/deepmedic-preprocess | /qtim_tools/qtim_pipelines/deep_learning.py | UTF-8 | 13,014 | 2.53125 | 3 | [] | no_license | import numpy as np
import glob
import os
import yaml
from shutil import copy, rmtree
from ..qtim_preprocessing.motion_correction import motion_correction
from ..qtim_preprocessing.threshold import crop_with_mask
from ..qtim_preprocessing.resample import resample
from ..qtim_preprocessing.normalization import zero_mea... | true |
d1ec62316dd6eeb0af2e2c6e7002d36de8f02ded | Python | akulikova64/cgm_3d_cnn | /src/rotations.py | UTF-8 | 2,205 | 3.796875 | 4 | [
"MIT"
] | permissive | # this module contains rotation functions for a 9 x 9 x 9 cube.
import math
import random
# axis is the axis across which the rotation occurs
# rot_num is the number of 90 degree rotations needed (0, 1, 2 or 3)
def rotate_box(pre_box, axis, rot_num = 0, box_size = 9): #box size is the number of bins
""" rotates box... | true |
4615786737b604251596ce66e01461ab48f5881f | Python | joseluisgarciad/Hacking | /hacking.py | UTF-8 | 3,169 | 3.59375 | 4 | [] | no_license | # Versión 2
# Este es un juego basado en adivinar una password de una lista de potenciales paswords
# generados por la computadora.
# Se muestra la lista de passwords posibles
# El jugador tiene permitido 1 intento para adivinar la password.
# El juego indica que el jugador falla al adivinar la password correcta.
# Ind... | true |
c7ff2893e0220f4269525b06a4e71faeb2faeec7 | Python | Sirisha111102/Python | /lowercaseinrange.py | UTF-8 | 191 | 3.8125 | 4 | [] | no_license | #print lowercaseletters up to a range n
"""import string
s=int(input())
print(string.ascii_lowercase[:s])"""
s=int(input())
a=97
for i in range(s):
print(chr(a),end="")
a+=1
| true |
4d28ca24e2d70be3c51a46c93af62a7b8a650e88 | Python | ToniCaimari/Codewars | /Python/kyu8/Is_he_gonna_survive.py | UTF-8 | 125 | 2.703125 | 3 | [] | no_license | def hero(bullets, dragons):
ammo = dragons*2
if bullets-ammo < 0:
return False
else:
return True
| true |
ab77864ea6682256d5f28a7733db451bcb891617 | Python | panosadamop/pythonCourses | /trionymo.py | UTF-8 | 501 | 3.875 | 4 | [] | no_license | import math as m
a = int(input("Enter the value of a: "))
b = int(input("Enter the value of b: "))
c = int(input("Enter the value of c: "))
d = b**2-4*a*c
if d > 0:
x1 = (-b + m.sqrt((b ** 2) - (4 * (a * c)))) / (2 * a)
x2 = (-b - m.sqrt((b ** 2) - (4 * (a * c)))) / (2 * a)
print("This equation has two s... | true |
a2d4b452f1d4b0d25d142e698d49893133a9f23b | Python | gselva28/100_days_of_code | /DAY 14/game_code.py | UTF-8 | 2,081 | 3.78125 | 4 | [] | no_license | #Higher Lower Game Code
import random
import os
clear = lambda: os.system('cls')
from game_art import logo, vs
from game_data import data
def format_data(account):
""" Format the account data into printable format """
account_name = account["name"]
account_descr = account["description"]
account_coun... | true |
e6d2fe7aa9805e56d388186ee972545859ea06d7 | Python | zhanglongliu/Crawl | /movie/spiders/awesome_movie.py | UTF-8 | 1,093 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from scrapy.spiders import Rule, CrawlSpider
from scrapy.linkextractors import LinkExtractor
from movie.items import MovieItem
class AwesomeMovieSpider(CrawlSpider):
name = 'awesome_movie'
start_urls = ['https://movie.douban.com/subject/3011091/']
rules= (
... | true |
721cff03035b65eab07ffbd2d33f1f21381cca67 | Python | lvoegtlin/crnn.pytorch | /datasets/dataset.py | UTF-8 | 3,045 | 2.75 | 3 | [
"MIT"
] | permissive | import os
import torch
import torch.utils.data as data
from datasets.datahelpers import default_loader
class DigitsDataset(data.Dataset):
"""Digits dataset."""
def __init__(self, mode, data_root, transform=None, loader=default_loader):
if not (mode == 'train' or mode == 'dev'):
raise(Runt... | true |
7511692c16fcd2d811f71b5e043953af34a5d1d7 | Python | rodriguezmatirp/Lab-Main | /Sem 4/CN_Lab/PS_5/2/server.py | UTF-8 | 709 | 2.828125 | 3 | [] | no_license | import socket
import crc
LOCALHOST = '127.0.0.1'
PORT = 65432
if __name__ == '__main__':
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.bind((LOCALHOST, PORT))
sock.listen()
while True:
conn, addr = sock.accept()
print('Connection address : ... | true |
acbaacc8032d1a5f420b2d5cf39435da1bc6b525 | Python | DaiMaDaiMa/PythonStudy | /面向对象class/classdemo6.py | UTF-8 | 444 | 3.78125 | 4 | [] | no_license | """
通过对象和类分别访问私有方法
但类无法访问对象的属性,无论是公有还是私有
"""
class Person():
def __init__(self, name):
self.name = name
self.__age = 18
def __secret(self):
print("%s 的年龄是 %d" % (self.name, self.__age))
if __name__ == "__main__":
p = Person("xiaofang")
print(p._Person__age)
p._P... | true |
18ee506b695076f8b61c9742295d47bb66da9b00 | Python | nberrehouma/Developpement-systeme-sous-Linux | /chapitre-21/exemple-buffers.py | UTF-8 | 459 | 3.171875 | 3 | [] | no_license | #! /usr/bin/python
from __future__ import print_function
import sys
print("1 stdout : ligne + \\n")
print("2 stdout : ligne seule", end='')
print("\n3 stderr : avant flush()", file=sys.stderr)
sys.stdout.flush()
print("\n4 stderr : apres flush ()", file=sys.stderr)
print("5 stdout : ligne seule ", end='')
print("\n6 s... | true |
c79e44a4b427c0d7f1235cf8fae5cf0dc1811541 | Python | jonjanelle/ChaosGame | /ChaosGame.py | UTF-8 | 1,653 | 3.71875 | 4 | [] | no_license | '''
Chaos game
1) place three starting posts
2) stamp turtle at random position
3) choose starting post at random, move to midpoint of current position and post, and stamp
4) repeat step 3 a few thousand times
Note: Stamp by moving forward 1 unit.
... | true |
4af0d61b4c756f0b190b22fdb36b1c96a1e5a4d9 | Python | 3ngthrust/Fast-Switching-Webradio | /webradio_parallel.py | UTF-8 | 5,608 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: 3ngthrust
"""
import os
import gpiozero
import functools
import time
from MCP3002 import MCP3002
def split_into_equal_sublists(a_list, number_of_parts):
""" Splits a list into a list of sublists
Arguments
----------
a_list : list object
... | true |
ae6111c9cfe3e44bb9f9272c47bc94a1e8d9a636 | Python | adithya-tp/leet_code | /0112_path_sum/solution.py | UTF-8 | 668 | 3.1875 | 3 | [] | no_license | class Solution:
def __init__(self):
self.fs = 0
def hasPathSum(self, r: TreeNode, s: int) -> bool:
if r is None:
return False
if (r.left is not None):
self.fs += r.val
if(self.hasPathSum(r.left, s)):
return True
self.fs -= r... | true |
b42ed761d108c1995beeb653da3ffe848e8a3b74 | Python | DaveIndeed/Pumpvakt | /core/InternetKommunikation.py | UTF-8 | 733 | 3.65625 | 4 | [] | no_license | import socket
class InternetKommunikation:
"""
Hanterar kommunikation med internet
"""
def isAnslutenTillInternet(self, host="8.8.8.8", port=53, timeout=3):
"""Undersök om man är ansluten till internet"""
try:
socket.setdefaulttimeout(timeout)
... | true |
a33b871c85b25019049f392fa5ed4db1cffbca3f | Python | x-coode/WIFI_H | /Wifi_H.py | UTF-8 | 2,487 | 2.515625 | 3 | [] | no_license | # by x-c0de
# instagram x.c0de
import os
import os.path
import time,sys
try:
import pywifi
from pywifi import PyWiFi
from pywifi import const
from pywifi import Profile
except:
print("\033[1;34mInstalling pywifi\n\n")
time.sleep(0.5)
os.system("pip install pywifi")
prin... | true |
386d8254a0d8de0dfcd959dd55971f031b4211fc | Python | daviddwlee84/LeetCode | /Contest/LeetCodeWeeklyContest/WeeklyContest243/3_fail4.py | UTF-8 | 1,187 | 2.59375 | 3 | [] | no_license | from typing import List
import heapq
from collections import defaultdict, deque
class Solution:
def assignTasks(self, servers: List[int], tasks: List[int]) -> List[int]:
server_heap = [(weight, i) for i, weight in enumerate(servers)]
heapq.heapify(server_heap)
server_free = defaultdict(lis... | true |
08aa4a5dd9710886715f420caecf840fc0466267 | Python | curtiskoo/miscellaneous_scripts | /data_parsing_poc/xlstuff.py | UTF-8 | 1,429 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 13 21:22:54 2018
@author: curtiskoo
"""
import openpyxl
from openpyxl import load_workbook
wb = load_workbook('testcolor.xlsx',data_only=True)
sh = wb['Sheet1']
cell = 'B3'
rgb = sh[cell].fill.start_color.rgb
#print(rgb)
for x in range(1,5):
f... | true |
9907ee276f378748947bfc7c5cd7eeca669589c3 | Python | Hangyuge/scrapy | /coser/coser/spiders/douban.py | UTF-8 | 559 | 2.65625 | 3 | [] | no_license | import scrapy
from coser.items import DoubanspiderItem
class DOubanSpider(scrapy.Spider):
name = 'douban'
allowed_domains = ['movie.douban.com']
start = 0
url = 'https://movie.douban.com/top250?start='
ends = '&filter='
start_urls = [url + str(start) + ends]
def parse(self,response):
... | true |
f98d5291d0f11dfae13b5213e62b0332dae0174b | Python | monir06/Algorithms-1 | /Machine Learning/Regression/data.py | UTF-8 | 573 | 2.984375 | 3 | [] | no_license | # Setup data into two arrays
import scipy as sp
import matplotlib.pyplot as plt
from error import error
data = sp.genfromtxt("web_traffic.tsv", delimiter="\t")
x = data[:, 0]
y = data[:, 1]
x = x[~sp.isnan(y)]
y = y[~sp.isnan(y)]
# Setup graph for plotting
plt.scatter(x, y, s=2)
plt.title("Web traffic over last month")... | true |
6d5975ff52b258c5e4304dc41e37a973b9177332 | Python | diegoamorin/APIDropbox_v2 | /download_files_apidropbox.py | UTF-8 | 393 | 2.921875 | 3 | [] | no_license | """
EJEMPLOS:
TOKEN = Token de la aplicación
ARCHIVO_LOCAL = Poner la ruta y nombredel archivo
en el que se va almacenar.
RUTA_REMOTA = LA ruta donde se encuentra tu archivo
en Dropbox + nombre del archivo.
"""
import dropbox
dbx = dropbox.Dropbox("TOKEN")
with open("<ARCHIVO_LOCAL>", "wb") as f:
md, r... | true |
e97559d11ba69abc082b46c85e2220954c79de53 | Python | HisarCS/HisarCS-PiWarsUK | /HisarCS_PiWarsUK/MotorControl.py | UTF-8 | 2,835 | 3.125 | 3 | [
"MIT"
] | permissive | import Adafruit_PCA9685
import RPi.GPIO as GPIO
import board
import pygame
import math
class MotorControl:
def __init__(self, rightChannel, rightDIR, leftChannel, leftDIR, GPIONumbering=GPIO.BCM):
self.rightChannel = rightChannel
self.leftChannel = leftChannel
self.GPIONumbering = GPION... | true |
ecccba6d02d21f2708f7a9b497dcc364c27afc9f | Python | sohannaik7/python-fun-logic-programs- | /guess_the_number_game_usingpython.py | UTF-8 | 1,429 | 3.8125 | 4 | [] | no_license | import random
def check(val,ran):
if ran == val:
print("you have guessed correct number that is ", ran)
return False
elif ran > val:
print("it woant that far, was't ", val)
return True
elif ran < val:
print("you have gonne too far, it was", val)
... | true |
c07bb00cc90c28fbdd984aecd6186e305a74e683 | Python | KimOanhuit/khoa-luan-document | /Tai lieu tham khao/Draft/Source_code/cook_files.py | UTF-8 | 1,582 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @author: JapHien
import os, re, time
start_time = time.time()
folder_path = 'DATA/MATERIAL/'
save_path = 'DATA/COOKED/'
def get_stopwords():
tmp_stop_words = []
stop_words = []
for file in os.listdir('./stopword/'):
print ('Found stop word file', file)
with open ('./stopword/' + file... | true |
51f8738eb8f33469600f6c9bd5f6cd6e1857b3e3 | Python | NeaHerforth/Completed-Kattis-Files | /quick estimate.py | UTF-8 | 167 | 2.90625 | 3 | [] | no_license | #! /usr/bin/env python3
import sys
#s=sys.stdin.read().splitlines()
s='''3
0
10
100'''
s=s.splitlines()
n=int(s[0])
for i in range(1, len(s)):
print(len(s[i])) | true |
3e5ea900c670dd81f4293da9881f45a4c8a97091 | Python | takoe-sebe/2019-fall-polytech-cs | /sketch_191204a_list61.pyde | UTF-8 | 412 | 2.75 | 3 | [
"MIT"
] | permissive | k=random(5,15)
xCoordinate = [k]
def setup():
size(500,500)
smooth()
noStroke()
for i in range(len(xCoordinate)):
xCoordinate[i] = 35*i + 90
def draw():
background(50)
for coordinate in xCoordinate:
fill(200)
ellipse(coordinate, 250, 30, 30)
fill(0)
ellip... | true |
1bfde23c256733f3c9bc627ad9d642e8f34d8d1b | Python | NguyenBang98/PythonExercise | /Ex14.py | UTF-8 | 120 | 3.828125 | 4 | [] | no_license | def sumOfSquare(x):
sum = 0
for i in range(1, x + 1):
sum += i ** 2
return sum
print(sumOfSquare(5)) | true |
26cabcca3e88d01db887ef8775bf1449bea76080 | Python | ihayhurst/StormyRoseSplice | /mandelbrot.py | UTF-8 | 12,777 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
# coding: utf-8
import sys, math, copy, os
import numpy as np
from PIL import Image, ImageOps
from numba import jit, int32, complex64
from functools import cmp_to_key
import pyopencl as cl
from matplotlib import colormaps
@jit
def mandelbrot(c, maxiter):
z = c
for n in range(maxiter):
... | true |
d309cd3f5bc3f0bb482d37499044bee6002bce77 | Python | HyeonJun97/Python_study | /Chapter05/Chapter5_pb53.py | UTF-8 | 1,025 | 3.78125 | 4 | [] | no_license | #Q5.53
import turtle
import math
turtle.penup()
turtle.goto(-200,0)
turtle.pendown()
turtle.goto(200,0)
turtle.setheading(150)
turtle.forward(20)
turtle.goto(200,0)
turtle.setheading(210)
turtle.forward(20) #축 화살표 그리기
turtle.penup()
turtle.goto(0,-80)
turtle.pendown()
turtle.goto(0,80)
turtl... | true |
5e369d5441c722baa93843ff30750e7be4232d41 | Python | dariosanfilippo/bitstream_DSP_ANN | /freq_est_plot.py | UTF-8 | 1,387 | 3.03125 | 3 | [
"MIT"
] | permissive | # This program generates scatter plots from .csv files data.
# Run this from within the folder containing the .csv files to
# convert them all into .pdf plots.
#
# Make sure to change the title to reflect your data.
#
# Copyright (c) Dario Sanfilippo 2021
import sys
import glob
import numpy as np
import sc... | true |
db72f7b5a472f5d4d90879257bfce1485cb51d8f | Python | maxweldsouza/reps | /moderate/tic_tac_win.py | UTF-8 | 1,261 | 3.53125 | 4 | [] | no_license | # ctci 16.4
import unittest
def tictacwin(board):
score = {'X': 0, 'Y': 0, ' ': 0}
def match(a, b, c):
if a == b == c:
score[a] += 1
for i in range(3):
match(*board[i])
transpose = zip(*board)
for i in range(3):
match(*transpose[i])
match(board[0][0], board[1... | true |
4a6dad3e35e3fea5d71726c73cf4e31667fecbfb | Python | IvayloSavov/OOP | /Exercise_Attributes_and_Methods/gym/project/trainer.py | UTF-8 | 336 | 3.078125 | 3 | [] | no_license | class Trainer:
_count_trainers = 0
def __init__(self, name: str):
Trainer._count_trainers += 1
self.name = name
self.id = Trainer._count_trainers
def __repr__(self):
return f"Trainer <{self.id}> {self.name}"
@classmethod
def get_next_id(cls):
return cls._co... | true |
b3bfedbd3f2f2f90622819aee5e00340f99e88e2 | Python | martat96/K-Means-Visualization | /Menu.py | UTF-8 | 6,519 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from tkinter import *
import tkFileDialog
from PIL import Image, ImageTk
import numpy as np
import cv2
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import colors
import plotly.express as px
import plotly.graph_objects as go
import scipy.misc
... | true |
ae0a243d2befdeb9a7835bd10e5e88f0fe888d5d | Python | LourdesOshiroIgarashi/coursera-ime-usp | /Python 1/Semana 8/Tarefa de programação/1-remove_repetidos.py | UTF-8 | 517 | 4.3125 | 4 | [
"MIT"
] | permissive | # Escreva a função remove_repetidos que recebe como parâmetro uma lista com números inteiros,
# verifica se tal lista possui elementos repetidos e os remove.
# A função deve devolver uma lista correspondente à primeira lista, sem elementos repetidos.
# A lista devolvida deve estar ordenada.
# Dica: Você pode usar ... | true |
55f3f195b2a390e8dfef3babb0f2fbdd71426c9f | Python | s123600g/asr_edgetpu_demo | /plot_audio.py | UTF-8 | 4,463 | 2.546875 | 3 | [
"MIT"
] | permissive | # -*- coding:utf-8 -*-
import librosa
import librosa.display
import os
import numpy as np
import matplotlib.pyplot as plt
sample_rate = 16000
channel = 1 # 單一通道(single channel)
Audio_Data_DirectoryName = "prediction_data"
Audio_Data_Path = os.path.join(
os.getcwd(),
Audio_Data_DirectoryName
)
Save_Img_Root_... | true |
72a306ac2a15db909b1cc4fd2d019f046fcea8d5 | Python | PigSupreme/clayton-rpi-tactical | /castle01.py | UTF-8 | 2,928 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
"""
Student-designed FSM
"""
# for python3 compat
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import print_function
from random import randint as roll_int
# Game world constants
from fsm_student01.gamedata import WALL_MAX, LADDER_HEIGHT, WINNIN... | true |
bbbbe12fc88b8db073cdfd8856a0b3fdfa7a08c6 | Python | chandramouli369/courseplan | /fileupload/uploads/individual_timetable/1_Hash Code.py | UTF-8 | 913 | 2.65625 | 3 | [] | no_license | for k in range(1,2):
file = open("input"+str(k)+".txt", "r")
tot_books,tot_lib,tot_days=map(int, file.readline().split())
scores = list(map(int, file.readline().split()))
sort_index = []
sl=len(scores)
for i in range(sl):
m=max(scores[i:])
t=scores[i]
scores[i] = m
scores[scores.index(m)]
print()
# ... | true |
d38c067e932ec012e07216f16317c3ec409f9e75 | Python | asolisn/-ejercicios-de-python | /ejercicios de python/ejercicio 7.py | UTF-8 | 346 | 3 | 3 | [] | no_license | #string
nombres='Arianna Solis'
dirDomiciaria= "Chile y Guayaquil"
Tipo_sexo='M'
#Boolean
#Colecciones
usuario=('dchiki','1234','chiki@gmail.com')
materias=['Programacion Web','PHP','POO']
docente={'nombre','Arianna','edad':20,'fac':'faci'}
#Imprimir
print("""Mi nombre es {},tengo {} años"""format(nombres,e... | true |
def9eb0023e1409c1abbdc202add0f94f4b7b0b8 | Python | yezigege/offer | /定时任务/官方文档/test002.py | UTF-8 | 661 | 3.078125 | 3 | [] | no_license | from datetime import date
from apscheduler.schedulers.blocking import BlockingScheduler
sched = BlockingScheduler()
def my_job(text):
print(text)
"""
date 在指定时间点触发任务
"""
# 在2019年12月5日执行
# sched.add_job(my_job, 'date', run_date=date(2009, 12, 5), args=['text'])
# datetime类型(用于精确时间) 在2019年11月6日 16:30:05执行
# sc... | true |
7e50b031583e22a1b41e7173968acdd4e90fb42d | Python | yubanUpreti/IWAcademy_PythonAssignment | /Python Assignment III/Question-A/tower_of_hanoi.py | UTF-8 | 488 | 3.96875 | 4 | [] | no_license | print("#"*50)
print("")
print("*"*20+" Tower of Hanoi problem for ‘n’ number of disks. "+"*"*20)
def tower_of_hanoi(number_of_disks,src,dst,temp):
if number_of_disks == 1:
print(f" Move disk {number_of_disks} from {src} to {dst} ")
return
tower_of_hanoi(number_of_disks-1,src,dst,temp)
print(f" Move ... | true |
67c321616dde3afafef263e98c35d74fd4bfe09c | Python | ogandolfo/Mid-Earth-Python | /Python - Curso em vídeo/Mundo 1/desafios/desafio023 - Separando dígitos de um número.py | UTF-8 | 379 | 4.5 | 4 | [] | no_license | # Faça um programa que leia um númer de 0 a 9999 e mostre na tela cada um dos digitos separados
num = int(input("Digite um número entre '1' e '9999': "))
m = num // 1000 % 10
c = num // 100 % 10
d = num // 10 % 10
u = num // 1 % 10
print(f'Analisando o número {num}')
print(f'Milhar: {m}')
print(f'Centena:... | true |
e2d1376b8bc60516d10bfed7007416fce5c4156c | Python | bfernando1/pynet | /week3/exercise2.py | UTF-8 | 1,645 | 3.703125 | 4 | [] | no_license | #! /usr/bin/env python3
"""
Author: Bradley Fernando
Purpose: Reads in a file from a `show arp` output. Uses a loop to find the ip/
mac addresses and prints them to standard output if it meets a
condition. Once conditons are met, the loop terminates.
Usage:
python exercise2.py
Output:... | true |
3f3b19fd1a4abe0fe43d2eeaf1c0c8534838358d | Python | msabbir007/Introduction-to-Python | /Assignment (Round5)/isthe_listin_order.py | UTF-8 | 195 | 3.09375 | 3 | [] | no_license | def is_the_list_in_order(l):
if len(l) == 0:
return True
else:
sort_l=sorted(l)
if sort_l == l:
return True
else:
return False
| true |
a59cedd2b868e5207111fbe56a5d9cdeae18c67c | Python | Allenhe123/PythonAlgorithm | /Other/scipyTest.py | UTF-8 | 925 | 2.546875 | 3 | [] | no_license | import numpy as np
import scipy as sp
'''
based on the effective data structures of numpy, scipy provides the senior algorithm applications.
数值分析算法库: 矩阵运算,线性代数,最优化方法,聚类,空间运算,FFT
cluster - 层次聚类(cluster.hierarchy) 矢量量化/K均值(cluster.vq)
constants - 物理和数学常量 转换方法
fftpack - 离散傅里叶变换
integrate - 积分例程
interpolate - 插值(线性,三... | true |
41c293535fa9355195d86b7396d0e62e6f774f8f | Python | salasgar/Ecosystems | /Biotope.py | UTF-8 | 14,640 | 3.15625 | 3 | [] | no_license | from basic_tools import Matrix, is_number
from random import shuffle, choice
from math import sqrt
from basic_tools import is_function
from basic_tools import print_methods_names
class Feature(object): # A float variable
def __init__(self, feature_name, feature_settings, parent_ecosystem):
self.feature_... | true |
fc6d2cb7b184110bf0a77eff30f005bc022f9268 | Python | rahuljain1310/BillReader | /filter.py | UTF-8 | 1,041 | 2.890625 | 3 | [] | no_license |
from utilities import saveImage, GetColoredSegmentationMask, isText, getArea
def applyAreaFilter(segPositions, area, threshold = 0.3):
""" Requires a list of pos_coord tuples """
""" Output THose segmentations With Less Area """
segPositions = segPositions[[getArea(pos_coord) < threshold *area for pos_coord in ... | true |
657f687d15e346ce970ecb3562fd178c901e2a9e | Python | Aasthaengg/IBMdataset | /Python_codes/p02762/s060694594.py | UTF-8 | 2,092 | 3.546875 | 4 | [] | no_license | import sys
from collections import defaultdict
# https://ikatakos.com/pot/programming_algorithm/data_structure/union_find_tree
class UnionFind:
def __init__(self, n):
# 負 : 根であることを示す。絶対値はランクを示す
# 非負: 根でないことを示す。値は親を示す
self.table = [-1] * n
def _root(self, x):
stack = []
... | true |
cfd64fb723f75043d6ecd3c903fd32e02575d44f | Python | rohanJa/LCM-LeetCodeMaychallenge- | /arrayManipulation.py | UTF-8 | 792 | 2.875 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the arrayManipulation function below.
def arrayManipulation(n, queries):
list_=[0 for i in range(0,n+2)]
itre=len(queries)
m=-1
for query in queries:
i=query[0]
while(i<=query[1]):
list_[i]=... | true |
330fef4d70318b6cb027cac0c6c6b602aa3d5474 | Python | OmranKaddah/Disentangled-Representation-Learning | /source_code/models/layers.py | UTF-8 | 562 | 2.796875 | 3 | [
"MIT"
] | permissive | import torch
from torch import nn
class Lambda(nn.Module):
def __init__(self, lambda_function):
super(Lambda, self).__init__()
self.lambda_function = lambda_function
def forward(self, *args):
if len(args) == 1:
return self.lambda_function(args[0])
else:
... | true |
559b10b739a63006f6eac211e5142961273a217c | Python | iamabdil/python_competition | /Q10.py | UTF-8 | 1,726 | 4.46875 | 4 | [] | no_license | '''
Q10: Create a function called summary that gets a list of filenames as a parameter. The input files should contain a floating point number on each line of the file. Make your function read these numbers and then return a triple containing the sum, average, and standard deviation of these numbers for the file. http... | true |
991a1d998a429a1ca676a997035931375409e5c0 | Python | isaiahh812/Lab7 | /ED.py | UTF-8 | 920 | 3.390625 | 3 | [] | no_license | #Isaiah Hernandez
#80591211
#date modified 12/14/18
#cs2302
S1 = "fool"
S2 = "fuel"
s1List = list(S1)#seperates both strings into list
s2List = list(S2)#seperates both strings into list
Table = [[0 for i in range(len(s1List)+1)] for j in range(len(s2List)+1)]
for i in range(len(s1List)+1):#set the first row
Table[0... | true |
6e0026018f816f4b1c29f0bdb7e145f919ce4e6c | Python | Insanityandme/python-the-hard-way | /pthway/recap_ex22.py | UTF-8 | 1,747 | 3.40625 | 3 | [] | no_license | from sys import argv
import datetime
script, in_file, out_file = argv
print "calling on: %s, in_file: %s, out_file: %s)" % (script, in_file, out_file)
f = open(in_file, 'w+')
f2 = open(out_file, 'w+')
write_to_file = f.write(raw_input("Write something in here please: "))
f.seek(0)
read_file = f.read()
print "%s: %... | true |
74a46f3a5c164302e802ff9206ed2a5ed47ac123 | Python | Villafly/Principled-approach-to-the-selection-of-the-embedding-dimension-of-networks | /embedding_dist.py | UTF-8 | 3,586 | 2.6875 | 3 | [
"MIT"
] | permissive | import numpy as np
import networkx as nx
import node2vec
from gensim.models import Word2Vec
from scipy.spatial.distance import cdist
from scipy import optimize
import math
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def read_graph(args):
'''
Reads the input network in networkx.
... | true |
0735654cd3c50a7ee212fd06b15cf87a8856ab0b | Python | 351116682/Test | /21.py | UTF-8 | 737 | 4.1875 | 4 | [] | no_license | coding=utf-8
'''
使用lambda来创建匿名函数。关键在于lambda表达式紧跟参数,以分号分隔后的表达式只能为算术逻辑表达式,不能有判断等语句
'''
MAX = lambda x,y: (x > y) * x + (x < y) * y
MIN = lambda x,y: (x < y) * x + (x > y) * y
SUM = lambda x,y: x + y
SUB = lambda x,y: (x > y) * (x) + (x < y) * (y - x)
MUT = lambda x,y:(x != 0) * (x * y) or 0
DIV = lambda x,y: (x * y != 0... | true |
5fec9f285b19bc194a3928aea4608a4dd1f4cf0e | Python | Vipning/latest-chinese-ner-model | /bilstm-crf/dataset_loader.py | UTF-8 | 2,241 | 2.9375 | 3 | [] | no_license | import math
import random
class BatchManager(object):
def __init__(self,data,batch_size,vocab,label2id,shuffle=True):
self.data = data
self.shuffle = shuffle
self.batch_size=batch_size
self.vocab = vocab
self.label2id = label2id
self.reset()
def reset(self):
... | true |
3aa6866737f775030cf94d8ba9b135ad46e04fb7 | Python | Man1exter/otherGames.py | /gam.py | UTF-8 | 2,465 | 3.21875 | 3 | [] | no_license | import instaloader
import sys
import pygame
import os
from sgame import seek
from sec import geckon
import io
import pyttsx3
import phonenumbers
from phonenumbers import geocoder, carrier, timezone
def panel():
print("[1] => Info About Application <= ")
print("[2] => SnakeGame 1s game <= ")
print("[3] => ... | true |
01c4ca868ef7095e7facf81b91d62d8d163d57c6 | Python | jnibali/software-extra-credit | /unit_test.py | UTF-8 | 371 | 2.6875 | 3 | [] | no_license | import unittest
import sentence_reverse
class testCaseAdd(unittest.TestCase):
def test_volume(self):
self.assertEqual(sentence_reverse.reverse("My name is V Tadimeti"),"Tadimeti V is name My")
#tests for additon, then subtraction, then multiply, and then division
#select right options in terminal w... | true |
bf9a8a5ac094f6359ffa7ed700af263eeba56a78 | Python | hmasha/MTF_Alabi | /MTF_predict.py | UTF-8 | 2,470 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 8 16:08:32 2019
https://stackoverflow.com/questions/18869550/python-pil-cut-off-my-16-bit-grayscale-image-at-8-bit
https://stackoverflow.com/questions/8832714/how-to-use-multiple-wildcards-in-python-file-dialog
https://www.datacamp.com/community/tut... | true |
2bbcd46bb9404811e8d121c33f63bf9419e873ab | Python | quoppy/sbscraper | /sbscraper/executable.py | UTF-8 | 2,694 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Console script."""
import logging
import os
import sys
import sbscraper
import sbscraper.scraper
# Environment variables.
PREFIX = 'SBSCRAPER'
EXTRACTOR_CATEGORIES = 'EXTRACTOR_CATEGORIES'
EXTRACTOR_URL = 'EXTRACTOR_URL'
LOADER_URI = 'LOADER_URI'
SCRAPER_LABEL = 'SC... | true |
87825ca5593e1ca4370a38ae4825c31f528dc005 | Python | stefansilverio/holbertonschool-higher_level_programming | /0x0F-python-object_relational_mapping/3-my_safe_filter_states.py | UTF-8 | 511 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python3
"""display matching arguments"""
import MySQLdb
import sqlalchemy
import sys
if __name__ == '__main__':
db = MySQLdb.connect(host="localhost", user=sys.argv[1],
passwd=sys.argv[2],
db=sys.argv[3], port=3306)
c = db.cursor()
c.execute("SELE... | true |
0ba416b037876b940093ceb0f49b5c096f2dd806 | Python | kh7160/algorithm | /SWExpert/1940.py | UTF-8 | 542 | 3.296875 | 3 | [] | no_license | # import sys
# sys.stdin = open("input.txt", "r")
t = int(input())
for case in range(t):
n = int(input())
speed = 0
length = 0
for i in range(n):
line = input().split(' ')
if line[0] == '0':
length += speed
elif line[0] == '1':
speed += int(line[1])
... | true |
cc1f95114d60e7cb4931b996a3c16da68fa164ce | Python | zoulala/exercise | /nlps/Alg_VSM.py | UTF-8 | 2,999 | 3.109375 | 3 | [] | no_license | #!/user/bin/env python
#-*- coding: utf-8 -*-
'''
Created on 2017年3月23日
@author: zoulingwei
vsm向量空间模型实现,计算两个文本的相似度(通过构建文档的字频向量,计算两个文档字频向量的相似度)
'''
# first: cipintongji
import math
import ast
from collections import Counter
wordsCount=0#variable for wordsfrequency
def CountKeyByWen(fileName1):#... | true |
ed9a10ee0974e87b2256f08f1855acce19e5f7c7 | Python | janhapis/Hangaroo | /Hangaroo_HAPIS.py | UTF-8 | 3,332 | 3.84375 | 4 | [] | no_license | import random
import string
import time
words = ['apple', 'orange', 'mango', 'cherry']
secretWord = random.choice(words)
lettersGuessed = []
def isWordGuessed(secretWord, lettersGuessed):
update = 0
for i, character in enumerate(secretWord):
if character in lettersGuessed:
update += 1
... | true |
ecc204ba8bef8c519897bd8250df92ace30f3672 | Python | ninjanoodles/python_scripts | /cust-packages/diff.py | UTF-8 | 498 | 2.65625 | 3 | [] | no_license | def diff_func(set1, set2, lines2, lines1):
file2_added = set2 - set1
file2_removed = set1 - set2
results = []
results.append('Lines added to')
count = 1
for line in lines2:
if line in file2_added:
text = str(count) + ': ' + line
results.append(text)
count += 1
results.append('Lines... | true |
1c1dd2649a5ca00680d8fde69e322886bb074a50 | Python | chris09/Python-tut | /Master_Python/02-basic/loops.py | UTF-8 | 224 | 3.8125 | 4 | [] | no_license | name = input("What's your name? ")
for i in name:
print(name, i)
x = 0
while True:
print(x)
x += 1
if x == 15:
break
my_list = ['lions', 'tigers', 'bears', 'ohmy']
for i in my_list:
print(i)
| true |
675816aae197d4a4b058ccbd18a827f956e1c4f1 | Python | Ananda9470/programming_practise | /BST/findClosestValueInBst.py | UTF-8 | 1,438 | 3.890625 | 4 | [] | no_license | from BST import BST
# O(n) | O(1)
# Θ(log(n)) | O(1)
def findClosestValueInBst1(tree, target):
closest = float("inf")
while True:
if abs(tree.value - target) < abs(closest - target):
closest = tree.value
if tree.value > target:
if tree.left is not None:
... | true |
39106a397121e9b3b6772a4945ee4cabf99b712a | Python | GeorgeZ1917/Python | /Algorithms.py | UTF-8 | 8,562 | 3.03125 | 3 | [] | no_license | #Algorithms.py
#Basic sorting algorithms
from random import randint
from copy import copy
from math import inf
length = 10 ** 1
bubbleSort = [ randint ( 0, length ) for data in range ( 0, length ) ]
insertionSort = bubbleSort.copy()
selectionSort = bubbleSort.copy()
countingSort = bubbleSort.copy()
heapSo... | true |
6b3c9e957c6a982e7d90549c482b009a1586a8b0 | Python | paulocheque/django-dynamic-fixture | /django_dynamic_fixture/tests/test_ddf_teaching_and_lessons.py | UTF-8 | 9,709 | 2.65625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | import re
from django.test import TestCase
import pytest
from django_dynamic_fixture.models_test import *
from django_dynamic_fixture.ddf import *
from django_dynamic_fixture.fixture_algorithms.sequential_fixture import SequentialDataFixture
data_fixture = SequentialDataFixture()
class DDFTestCase(TestCase):
... | true |