blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
18b9ba0ad410314d6886cac69f3b2b47432e3460
vcchang-zz/coding-practice
/Binary Trees/DFS/dfs-iterative.py
UTF-8
1,857
4.4375
4
[]
no_license
# DFS (depth-first search) # Good for traversing nodes in trees and graphs only once # Iterative approach # Time: O(n) -> visit each node in tree w/ n nodes once # Space: O(n) -> path list takes up n space. # Stack can also take up - in worst case - # n space (tree that's a straight line...
true
22a101df0a3f29fa6a63983cdd5d79ec160db3f6
hi-math/EPT
/page/torch/text_field.py
UTF-8
9,121
3.078125
3
[]
no_license
from collections import namedtuple from typing import List import torch from torchtext.data import RawField from transformers import PreTrainedTokenizer from page.const import * from page.util import find_numbers_in_text """ Text instance field for encoder - token: List of tokens in the text - pad: Indicatin...
true
3131b7c3b1347f4feddb6642506fd9958047cfa0
NamJinWoo/BaekJoonAlgorithm_Python
/Baekjoon_1431.py
UTF-8
1,221
4.125
4
[]
no_license
# 합을 구하는 함수 def sum(string): result = 0 for s in string: if s.isdigit(): result += int(s) return result # 비교하는 함수 def compare(str1, str2): # 조건 1 if len(str1) < len(str2): return True # true이면 앞에온다 elif len(str1) > len(str2): return False # false이면 에온다 ...
true
53a0ce69e77141bca70f80ee3eb56da1b8b61325
BlandineLemaire/StegaPy
/tools/other.py
UTF-8
4,918
3.90625
4
[]
no_license
# Import des librairies necessaire au code from PIL import Image import os ''' Fonction : sizeFinder(image) image : image dont on souhaite trouver la hauteur et la largeur Explication : sizeFinder est une fonction qui permet de trouver et retourner la taille de l'image qui est donnee en ...
true
49f5eec656cab821aa70c7afc5280aed387cf68e
nlmupdy01/hacker_rank_python3
/Python CHALLENGE/Frequency Queries.py
UTF-8
801
2.765625
3
[]
no_license
#!/bin/python3 import math import os import random import re import sys from collections import defaultdict # Complete the freqQuery function below. def freqQuery(queries): res = [] fre = defaultdict(int) for x in queries: if x[0] == 1: fre[x[1]] += 1 elif x[0] == 2: ...
true
20e9a016b2a61100941e91059d7dd98aff8dd581
Sekitakovich/challenger
/BH/defs.py
UTF-8
137
2.53125
3
[]
no_license
from dataclasses import dataclass @dataclass() class Note(object): key: int # 鍵盤の位置 volume: int # 打鍵の強さ
true
818990515f7635337128791b46480117c2cbe683
ReenaSubanandharaj/Python-Programming
/Beginner/Largest number.py
UTF-8
278
4.09375
4
[]
no_license
a=int(input("Enter the first value:")) b=int(input("Enter the second value:")) c=int(input("Enter the third value:")) if(a>b)and(a>c): print("The largest number is ",a) elif(b>a)and(b>c): print ("The largest number is ",b) else: print ("The largest number is ",c)
true
4717ef31da34074bd2b14364cb7433853245d159
MisaelUrq/ProjectoAlmacenesDatos
/main.py
UTF-8
6,318
2.515625
3
[]
no_license
import mysql.connector from xml.dom import minidom import json # Pre install in python 3.7 import folium # Install import webbrowser # Pre install in python3.7 import tkinter class ZipCodeCounter: def __init__(self, name, count): self.name = name self.count = count class GeoData: def __init...
true
5877a8acf416032ed21aed49b79d23338855da87
wolfejar/PythonNeuralNetwork
/TestNetwork.py
UTF-8
3,479
3.03125
3
[]
no_license
import numpy class TestNetwork: def __init__(self, layers, x_sample, y_sample, max_accepted_error): self.layers = layers self.x_sample = x_sample self.y_sample = y_sample self.max_accepted_error = max_accepted_error self.threshold = 0.5 self.true_positives = 0 ...
true
9795a1dfb381f4d964e8145661634fa0f13b5355
Gusten/DotaCreeper
/Server/run.py
UTF-8
1,081
2.515625
3
[]
no_license
from flask import Flask import requests import json app = Flask(__name__) steamApiKey = "6F39056ADA5041ED08F9480773890A58" interestingTeams = ["Alliance", "Evil Geniuses", "OG Dota2"] #@app.route("/") def getMatches(): r = requests.get("https://api.steampowered.com/IDOTA2Match_570/GetLiveLeagueGames/v1/?key=" + s...
true
54b6ee5d57ff8a660351d0d024a610dee0af2b7b
noisyoscillator/qtrader
/qtrader/utils/gym.py
UTF-8
5,026
2.65625
3
[ "Apache-2.0" ]
permissive
import numpy as np from gym import Env import typing import os def cardinalities(env: Env) -> typing.Tuple[int, int]: """Fetch observation and action spaces cardinalities. Parameters ---------- env: gym.Env OpenAI Gym compatible environment Returns ------- observation_space_car...
true
315e838cb8050397f2a4d63b89e4fdc579d426ea
QuiqueScampini/jarvis
/app/Jarvis.py
UTF-8
2,242
2.578125
3
[]
no_license
import logging import os from multiprocessing import Queue from gps.GpsReader import GpsReader from sensorsReading.SensorsReader import SensorsReader from processHandler.ProcessHandler import ProcessHandler from messageServer.MessageServer import MessageServer from ultron.Ultron import Ultron class Jarvis: def ...
true
97c5aff71980031157578a93a5b7fd4a4dd38ab9
LoopGlitch26/Blockchain-practicals
/001 Without UI/001 Binary/hash_utils.py
UTF-8
448
3.421875
3
[]
no_license
import json import hashlib def hash_string_256(string): return hashlib.sha256(string).hexdigest() def hash_block(block): """Hashing a block and returns a string reprensentation of it. Arguments: :block: The block that should be hashed. """ # Converting the "block" (which i...
true
ea883ba3440855f8c0012460752e65c83f44e883
dinobrkanic/Zadace_RPA
/BrkanicDino_samostalni.7.py
UTF-8
604
3
3
[]
no_license
class KarteIgra (Exception): def __init__(self, code = 000): self.error_message = None self.error_dict = { 000: 'ERROR-000: Nespecificirana pogreška', 101: 'ERROR-101: Greška povezana s korisnikovim unosom!', 102: 'ERROR-102: Greška povezana s neispravnim unosom t...
true
477cad23ec9082880020df3dcf8e754f7b1c970b
noaavi94/tdh20
/generalStatistics.py
UTF-8
3,599
3.46875
3
[]
no_license
import xlrd import matplotlib.pyplot as plt # remember to update "num_of_movies" and the file path female_sum_for_female_plot = 0 male_sum_for_female_plot = 0 male_sum_for_male_plot = 0 female_sum_for_male_plot = 0 female_plot_counter = 0 male_plot_counter = 0 female_amount = 0 male_amount = 0 plots_by_year = {} for...
true
3b359789a3e93736172c5508fa10ddeb23aef553
summychou/GGFilm
/WeRoBot/script/init_cache.py
UTF-8
1,430
2.5625
3
[ "Apache-2.0" ]
permissive
import sqlite3 as sqlite import redis connection = sqlite.connect("db.sqlite3") cursor = connection.cursor() try: cursor.execute("SELECT DISTINCT film FROM myrobot_filmsearch WHERE a35mm != '' ORDER BY film") except Exception, e: cursor.execute("SELECT DISTINCT film FROM myrobot_filmsearch WHERE a35mm <> '' OR...
true
12c82a981a1be9d82b09e3a23f07235aff6d097b
lrrieke/class-work
/people.py
UTF-8
606
3.25
3
[]
no_license
people = { 'renee' : { 'first name' : 'renee', 'last name' : 'rieke', 'location' : 'las vegas', 'age' : '55' }, 'patrick' : { 'first name' : 'patrick', 'last name' : 'caddick', 'location' : 'las vegas', 'age' : '27' }, 'lena' : { 'first name' : 'lena', 'last name' : 'rieke', 'location' ...
true
c420ee6290f91d06b16b43c96e69794b9a764b67
rittikbasu/hatespeech-detector
/docs/webscraper.py
UTF-8
540
3.25
3
[]
no_license
from bs4 import BeautifulSoup import pandas as pd with open ('index.html') as html_file: soup = BeautifulSoup(html_file, 'lxml') print(soup.prettify()) # Create Dictionary sn_tweets ={} tweets_no = 0 for texts in soup.find_all('div', class_="tweets-card"): tweets = texts.p.text tweets_no ...
true
9a162a1c67eca1a9d9e9cacc0b5f361deb6ff13b
ranjeet-floyd/redis-woker-queue
/main/worker_service.py
UTF-8
1,429
2.734375
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- from simple_redis_queue import SimpleRedisQueue from ast import literal_eval import time import logging from logging.config import fileConfig import os from logging.config import fileConfig fileConfig(os.path.join(os.path.dirname(__file__) , 'logging_config.ini')) # fileConfig...
true
03f27ea0a70468591c90a155a782466316a99881
pig0726/LeetCode
/problemset/Count_and_Say.py
UTF-8
635
3.140625
3
[]
no_license
class Solution(object): def countAndSay(self, n): """ :type n: int :rtype: str """ ret1 = "1" ret2 = [] for turn in xrange(2, n+1): length, cnt = len(ret1), 0 for i in xrange(length): if i == 0: cnt =...
true
885c2dc268952fb2c2164d9ec76e8268e8525155
Paxton0222/Python-AI-class
/題目20200728/第五章/Ch5_2_1a.py
UTF-8
279
2.9375
3
[]
no_license
from bs4 import BeautifulSoup with open("Example.html", "r", encoding="utf8") as fp: soup = BeautifulSoup(fp, "html.parser") # 使用id屬性搜尋<div>標籤 tag_div = soup.find(id="q2") #搜尋 id="q2" tag_a = tag_div.find("a") #搜尋 "a" print(tag_a.string)
true
e6d7d7c022cc81496af712d8209e6e67e95bdc80
stens0n/PYGAME_Snake
/main.py
UTF-8
5,315
3.171875
3
[]
no_license
import sys, random import pygame from pygame.math import Vector2 class SNAKE: def __init__(self): self.body = [Vector2(5, 10), Vector2(4, 10), Vector2(3, 10)] self.direction = Vector2(1, 0) self.new_block = False self.head_up = pygame.image.load('graphics/head_up.png').convert_alp...
true
405688a165e7f3132e75ddf3537501960c0b8833
hagego/SmartHome
/FS20ShutterControl/FS20/UdpControl.py
UTF-8
994
2.953125
3
[]
no_license
#!/usr/bin/env python import socket import sys HOST = '192.168.178.71' PORT = 5000 # open socket connection try: sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) except socket.error as msg: sys.stderr.write("[ERROR] %s\n" % msg) sys.exit(1) try: sock.connect((HOST, PORT)) except socke...
true
55aa7afd66896cfdd7e31c9ea5c43e2ba020d3fe
ManCaveMedia/kia_uvo
/custom_components/kia_uvo/Token.py
UTF-8
811
2.625
3
[ "MIT" ]
permissive
from datetime import datetime from .const import DATE_FORMAT class Token(object): def __init__(self, data): self.__dict__ = data def set( self, access_token, refresh_token, device_id, vehicle_name, vehicle_id, vehicle_model, vehicle_regi...
true
bf9f0be48cd7f759aa7f5db3d139f36b02e231f0
JefteKeller/server-load-manager
/tests/test_main.py
UTF-8
1,139
2.765625
3
[]
no_license
from os import path from main import main from . import BaseTestCase class TestMainApp(BaseTestCase): def test_should_not_manage_and_log_servers_with_invalid_file_content(self): output_filename = 'output.txt' expected_file_data = [ '0\n', '0', ] invalid_fil...
true
e0d2e3cf664a0f883da50df6c98e8012e5d7ce35
hchkrdtn/advent-of-code
/2020/d08.py
UTF-8
4,169
3.125
3
[]
no_license
#!/usr/bin/env python3 import numpy as np import copy def pcounter(inpt): # for idx in range(0, len(instr)): # if idx == 0: # p = 0, instr[p] = 0, acc = 0, accum = 0 # elif idx == 1: # p = 1, instr[p] = 1, acc = 1, accum = 1 # elif idx == 2: # p = 2, in...
true
b93ca1dd7a6783d68ff9f552c87e44e4ba78d1f4
dineshsathis/Python_Projects
/Read_Excel_CPM_Major_UK_Brands.py
UTF-8
1,276
2.8125
3
[]
no_license
import pandas as pd import numpy as np import os #Iterate over the CPM files, pick the rank for each metric for the selected competitor set #GETS IMAGE RANKING FOR EACH COMPETITOR WITHIN THE SET fpath = "C:\Work\Relationship Analytics\Satisfaction Analytics\CPM\\" df=pd.read_excel(os.path.join(fpath,"Satisfacti...
true
5ca7c14df5f8f5c1e250d4c45e770165c6245219
wanghuafeng/lc
/二叉树/113.路径总和 II.py
UTF-8
1,405
3.609375
4
[]
no_license
#!-*- coding:utf-8 -*- """ https://leetcode-cn.com/problems/path-sum-ii/ 给定一个二叉树和一个目标和,找到所有从根节点到叶子节点路径总和等于给定目标和的路径。 说明: 叶子节点是指没有子节点的节点。 示例: 给定如下二叉树,以及目标和 sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ / \ 7 ...
true
ecd192808c1df88f0997dbcc9a94f7d5c584c1e0
dowski/scoreboard
/plugins/smallboard/smallboard/multiplexor.py
UTF-8
2,497
3.109375
3
[ "MIT" ]
permissive
import time from . import control class Multiplexor(object): """Drives a board with two-digit 7-segment displays. It supports multiple displays if the board has them connected with daisy-chained shift registers. To render a two-digit number the code must multiplex between the two display digits...
true
39eaaaaa4f518133adc0f6ef625e0ce9cca262b0
chrislucas/hackerrank-10-days-of-statistics
/python/GeometricDistributionI/solution/ExpectativeAndVariance.py
UTF-8
876
2.921875
3
[]
no_license
''' https://en.wikipedia.org/wiki/Geometric_distribution ''' from pip._vendor.distlib.util import proceed ''' a expectativa de numero de falhas antes do primeiro sucesso e dada pela formula E(Y) = (1 - p) / p onde p = probabilidade de sucesso Tambem conhecido pela media de numero de falhas antes do primerio sucesso '...
true
8bb13f702561e29fa165a3fc9b0f5fcf6915f900
vesloguzov/xlsx-lab
/test2.py
UTF-8
347
3.125
3
[ "MIT" ]
permissive
def approx_equal(x, y, tol=3, rel=0.00005): if tol is rel is None: raise TypeError('cannot specify both absolute and relative errors are None') tests = [] if tol is not None: tests.append(tol) if rel is not None: tests.append(rel*abs(x)) assert tests return abs(x - y) <= max(tests) prin...
true
11c584bbe11092db9b013975c3024c12d7625395
SMAPPNYU/urlExpander
/setup.py
UTF-8
1,224
2.578125
3
[ "MIT" ]
permissive
import sys from setuptools import setup long_description = """This package makes working with link data from social media and webpages easier. It not only expands links, but catches errors, and makes parallel link expansion quick and efficient. ``` import urlexpander urlexpander.expand('https://trib.al/xXI5ruM') ``` r...
true
87e38e57318fd15f1ac49ad863429147e1d1a1c3
alaisgomes/data-challenge_product-hunt
/data.py
UTF-8
2,310
3.0625
3
[]
no_license
#!/usr/bin/python import MySQLdb import datetime import csv # open connection to database # fill up with needed credentials db = MySQLdb.connect(host="localhost", user="root", passwd="", db="ProductHunt") # Executing queries try: cursor = db.cursor() # cursor to manipulate database # sql query cursor.execut...
true
62d2c6c6c4fd8435489d8a30af305e1760015b4f
himap2569/Google-Foobar-Challenge
/codedMessage.py
UTF-8
3,209
3.828125
4
[]
no_license
'''Please-Pass-the-Coded-Messages ============================== You need to pass a message to the bunny prisoners, but to avoid detection, the code you agreed to use is… obscure, to say the least. The bunnies are given food on standard-issue prison plates that are stamped with the numbers 0-9 for easier sorting, and...
true
f39458f4aca435d80b67d184ac6a2698f533a82b
Aasthaengg/IBMdataset
/Python_codes/p02392/s118694660.py
UTF-8
95
2.859375
3
[]
no_license
a=map(int,raw_input().split()) if a[0]<a[1] and a[1]<a[2]: print 'Yes' else: print 'No'
true
79eb1baeb7d4368046532f8afc1c01634424666a
GrigLars/buildabeast
/build1.py
UTF-8
1,436
3.265625
3
[]
no_license
#!/usr/bin/env python import random head = ["head of a bear", "head of a cat", "head of a stork", "head of an elephant", "head of a roswell alien", "head of a fish", "head of a dragon", "head of a dog", "head of a cow", "head of a human female", ...
true
2ac4b1037282c7748b72708d55b531bc4fc14e71
vulbsti/Smile_detection
/smile_debian.py
UTF-8
1,230
2.59375
3
[]
no_license
import cv2 import pyautogui face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') smile_cascade = cv2.CascadeClassifier('haarcascade_smile.xml') c=0 def detect(gray, frame,d,c): faces = face_cascade.detectMultiScale(gray, 1.3, 5) for (x, y, w, h) in faces: cv2.re...
true
042327a74a65872d7158b1e7e2958999b61327b8
kdelwat/boomerang
/boomerang/server.py
UTF-8
21,505
2.53125
3
[ "MIT" ]
permissive
import uvloop import json import aiohttp import hashlib import functools import collections from sanic import Sanic from sanic.log import log import sanic.response as response from . import events, messages from .exceptions import BoomerangException, MessengerAPIException class Messenger: '''The base class that...
true
75c08520b8ecc9b66e418f2b7a302af7465ff621
ronweikamp/advent_of_code2019
/day9/day9_test.py
UTF-8
817
2.71875
3
[]
no_license
import unittest from day9 import run_with_mem, get_init_state class MyTestCase(unittest.TestCase): def testcases(self): self.assertEqual([109, 1, 204, -1, 1001, 100, 1, 100, 1008, 100, 16, 101, 1006, 101, 0, 99], run_with_mem( [109, 1, 204, -1, 1001, 100, 1, 100, 100...
true
3a9d56aab2fe4d477c76e75aa723a1cdb3cef364
yangjian615/My_python_pro
/python_workspace/CSA_code_demo/nearest.py
UTF-8
183
2.5625
3
[]
no_license
#!/usr/bin/env python def nearest(array, value): residuals = array - value val, idx = min((val, idx) for (idx, val) in enumerate(abs(residuals))) return [array[idx], idx]
true
13e15696fc312eecb323fdd7dc019ef47d471c8e
root-lzq/LEO-Satellite-Network-Emulation-System
/server1/create_docker_with_docker-compose/vxlan_create_docker_docker-compose
UTF-8
3,829
2.65625
3
[]
no_license
#!/usr/bin/python3.6 # 创建200个docker # docker name from b1 to b200 import os def name_id(number): # 获取docker短id #【参数】number : int ; #【返回值】result : string ; import subprocess string = ' "name=^b' +str(number) + '$"' total_string = "docker ps -aqf{}".format(string) result=subprocess...
true
192474523b9a41fd53e9e0acf827b0597af62285
bhackettpy/Alien-Invasion-Project
/settings.py
UTF-8
856
2.71875
3
[]
no_license
class Settings: """all settings for Alien Invasion.""" def __init__(self): # screen settings self.screen_width = 1200 self.screen_height = 800 self.bg_color = (230, 230, 230) # Ship settings, speed slowed for smooth movement and 3 lives per game self....
true
ab098da4187281e3269e5e88ab24e8da18ce85de
cuibinghua84/pydata
/python_data_analysis/07-数据清洗和准备/7.2.6-检测和过滤异常值.py
UTF-8
525
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- """ @author: 东风 @file: 7.2.6-检测和过滤异常值.py @time: 2019/10/30 9:54 """ import numpy as np from numpy import nan as NA import pandas as pd from pandas import Series, DataFrame from pprint import pprint import sys import csv import json data = pd.DataFrame(np.random.randn(1000, 4)) print(data.descr...
true
c5596615b2dae4369f1b4ccb5f82a61b43767ae8
eli7eb/python_rk_puzzle_pygame
/rk_code/player_input/player_input.py
UTF-8
1,937
3.109375
3
[]
no_license
import pygame import sys def main(args=None): """The main routine.""" if args is None: args = sys.argv[1:] print("This is the main routine.") print("It should do something interesting.") ''' pressed = pygame.key.get_pressed() alt_held = pressed[pygame.K_LALT] or pressed[pygam...
true
6b4dfdc4932c0da6d036cca045a1e3f4a2a025fe
narinn-star/Python
/Review/Chapter04/4-20.py
UTF-8
124
2.9375
3
[]
no_license
sender = 'tim@abc.com' recipient = 'tom@xyz.org' subject = 'Hello!' print(f'From: {sender} \nTo: {recipient} \nSubject: {subject}')
true
c6118532b1a3a309bf611a999296d99a7c462260
Spuriosity1/basilbot
/main.py
UTF-8
1,048
2.546875
3
[]
no_license
#!/usr/bin/python3 import subprocess import discord import threading import time import os from libbasil_I2C import * DISCORD_TOKEN = os.environ['DISCORD_TOKEN'] HELPTEXT='''Commands: (basil pay respects) (basil play [SONG]) !basil help !basil flip the table !basil chuck a yeet ''' client=discord.Client() @client...
true
99c893ee2492f61216d87adf7ed54cf9dbf984d7
tn15aan/oop-monster-inc
/class_monster.py
UTF-8
381
3.28125
3
[]
no_license
class Monster(): def __init__(self, name, skills): self.name = name self.skills = skills def sleep(self): return 'zzzz' def eat(self): return 'nom nom' def scare_attack(self): return 'RAAAHHH' def add_skills(self, skills): the_monster_in_question ...
true
73baf67bc15a421835aacc403fc24afe58a3e1fc
yasuaki9973/pandas-like-dataframe
/tests/test.py
UTF-8
456
2.71875
3
[]
no_license
# TODO import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import random import pandola as pd values = [ { 'user_id': i + 1, 'group_name': 'Group' + ('A' if (random.randint(0, 1) == 0) else 'B'), 'user_name': 'user' + str(i + 1), 'email': 'user' ...
true
54cc533dbf5d30bfcdc93169f4e3511e447da09b
KoshikawaShinya/atcoder
/ABC_0530/C_2.py
UTF-8
238
2.9375
3
[]
no_license
n, k = [int(x) for x in input().split()] friend = [] for _ in range(n): friend.append([int(x) for x in input().split()]) friend = sorted(friend) for x in friend: if x[0] > k: break else: k += x[1] print(k)
true
aa5ad86bfead9d6c0978f44c7fb3c782d2bac353
ArthurSpillere/AulaEntra21_ArthurSpillere
/Exercícios Resolvidos/Aula04/exercicio14.py
UTF-8
197
4.03125
4
[]
no_license
# Exercicio 14 # Crie um programa que solicite o valor de x (inteiro) # # calcule usando a fórmula 2x+3 # # mostre o resultado x=int(input('Insira o valor de X: ')) print(f'2x + 3 = {2*x+3}')
true
e5106caab893f87f90c97b33bd27354bee3ad4c0
tnakaicode/jburkardt-python
/polyomino/polyomino_embed.py
UTF-8
9,961
2.875
3
[]
no_license
#! /usr/bin/env python3 # import numpy as np import matplotlib.pyplot as plt import platform import time import sys import os import math from mpl_toolkits.mplot3d import Axes3D from sys import exit sys.path.append(os.path.join("../")) from base import plot2d, plotocc from timestamp.timestamp import timestamp def p...
true
77d9e3f81d7c65e20ed25c407c0f1a88fb2fd0ab
linjiesen/pythonscraps
/movie_multithread.py
UTF-8
1,177
3.015625
3
[]
no_license
import requests from lxml import etree from time import time from threading import Thread url='https://movie.douban.com/top250' def fetch_page(url): response=requests.get(url) return response def parse(url): response=fetch_page(url) page=response.content html=etree.HTML(page) xpath_movie='//...
true
7ef6371c77072ab45f41c39ddcc4c9cc0a5a7370
danielyu11765/qbb2016-answers
/day4-lunch/day4-lunch-01.py
UTF-8
869
2.65625
3
[]
no_license
#!/usr/bin/env python import sys import pandas as pd import matplotlib.pyplot as plt import numpy as np df_ctab = pd.read_csv(sys.argv[1], sep="\t") df2_ctab = pd.read_csv(sys.argv[2], sep="\t") #read ctab df_roi = df_ctab["FPKM"] > 0 df_ctab2 = df_ctab[df_roi] df_roi2 = df_ctab2["gene_name"] == "Sxl" df_sxl...
true
e31295be95a9e3a3c6a2c4516345dbef52c1f4fe
gaukhar98/python-tasks
/something/image.py
UTF-8
527
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jan 23 14:06:23 2018 @author: hp """ from PIL import Image import pytesseract #import subprocess #import cv2 #import os #image = cv2.imread("cisco 2/example.jpg") #import Image #from tesseract import image_to_string #print(os.getcwd()) #print (pytesseract.i...
true
5177362d58dda7c422dd8f9845a840f8d90ccca9
gaoshao52/pythonProject
/高级FTP/ftp_client/libs/FtpClient.py
UTF-8
7,725
3.0625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import socket, os, json, hashlib from libs.progressBar import ProgressBar import time class FtpClient(object): def __init__(self): self.client = socket.socket() def help(self): '''查看帮助''' msg = ''' ls # 查看当前目录文件 pwd # 查看当前...
true
d3a225683362662aef7745b727494cc208ec896d
jess-roberts/oosa-2020
/task2.py
UTF-8
6,987
2.8125
3
[]
no_license
import numpy as np import rasterio import gdal, ogr, os, osr import pandas as pd import argparse from processLVIS import lvisGround from lvisClass import lvisData from task1 import flightLine from scipy.ndimage import label, binary_dilation from rasterio.merge import merge from rasterio.plot import show import glob imp...
true
41fadbd22439901fefa9897e3d3ab8d7c4ef7fee
Artcann/AIPE_2019
/TestModel.py
UTF-8
388
2.796875
3
[]
no_license
# coding: utf-8 from model.Salle import * from model.Carte import * carte1 = Carte("127.0.0.1") carte2 = Carte("127.0.0.2") salle1 = Salle(carte1, "N16") salle2 = Salle(carte1, "N18") carte1.ajouterSalle(salle1) carte1.ajouterSalle(salle2) print(salle1.getLocalisation()) print(carte1.getDictSalle()) print(carte1...
true
82625711f928adbff37b4c77e17d94a69192ada9
aiwo9zou/NLP
/2019/05/20/getCurrency.py
UTF-8
1,989
2.75
3
[]
no_license
import urllib import urllib.request as request import re import time import os # The notifier function def notify(title, subtitle, message, url): t = '-title {!r}'.format(title) s = '-subtitle {!r}'.format(subtitle) m = '-message {!r}'.format(message) o = '-open {!r}'.format(url) os.system('termi...
true
b6d60121ea377369b8d7d5f0bb49c375270cd9c8
msb55/MCSAutonomousAgents
/Patricia/Pacman/multiagent_python3/multiAgents.py
UTF-8
12,905
3.21875
3
[]
no_license
# multiAgents.py # -------------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkeley.e...
true
240ea9028d6b063b9a71b65421cda54f505fa8a6
MadcowD/tensorgym
/actor_critic_demo/complete.py
UTF-8
5,757
2.953125
3
[]
no_license
import gym import numpy as np import random import tensorflow as tf class PolicyGradientNNAgent(): def __init__(self, actor_lr=0.2, critic_lr=0.5, gamma=0.99, lam=0.002, state_size=4, action_size=2, n_hidden_1=20, n_hidden_2=20, scope="pg" ): """ args epsilon...
true
71ddebc1de0c148a4ba92f93a7573632302677e7
AileenXie/leetcode
/牛客周赛/09/01.py
UTF-8
1,608
2.96875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/8/6 9:28 PM # @Author : aileen # @File : 01_0-1背包问题.py # @Software: PyCharm import functools # class Solution: # def solve(self, n, m, a): # # write code here # max_len = 0 # cur_len = 0 # black=0 # for c in a: # ...
true
070f3cfa2acc895882f9060d3891457811bc2433
subnr01/Programming_interviews
/programming-challanges-master/codeeval/087_query-board.py
UTF-8
1,850
4.1875
4
[]
no_license
#!/usr/bin/env python """ Query Board Challenge Description: There is a board (matrix). Every cell of the board contains one integer, which is 0 initially. The next operations can be applied to the Query Board: SetRow i x: it means that all values in the cells on row "i" have been changed to value "x" after t...
true
82c3928a7d4b80c3fd41f321c5eb2402c2aef6db
tamarinvs19/ppl-2019_tasks
/seminar1/add_two_numbers/tests.py
UTF-8
1,946
2.9375
3
[]
no_license
import pytest import add_two_numbers def test_solution_0(): l1 = add_two_numbers.ListNode(1) l2 = add_two_numbers.ListNode(2) s = add_two_numbers.Solution() res = s.addTwoNumbers(l1, l2) assert res.val == 3 assert res.next == None def test_solution_1(): l1 = add_two_numbers.ListNode(1) ...
true
cef507ad2f8f911d373ce9885e9b28df86e347aa
qiubite31/Leetcode
/Array/leetcode-442.py
UTF-8
1,075
4.09375
4
[]
no_license
""" 442. Find All Duplicates in an Array Difficulty: Medium Related Topic: Array Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twice in this array. Could you do it without extra space and in O(n) runtime? ...
true
f9d1f1b70e6d6b10acad6351e2fb7593fc6ce5bf
madsop/scrapy_facebooker
/scrapy_facebooker/faceblib/faceblib.py
UTF-8
573
2.65625
3
[ "MIT" ]
permissive
import re import requests from scrapy_facebooker.faceblib.url import get_facebook_url_from_username def get_facebook_page_id(username): """ Get Facebook page id :param username: Username of the facebook page that its page id will be fetched. :return: Facebook page id....
true
f7a74fd4012b61b156ecc4518b26bf958bcb53ae
andyarnell/cci_connectivity
/a2_creating_hexagons_20160108.py
UTF-8
3,713
2.5625
3
[]
no_license
# !/usr/bin/env python # coding:utf-8 # Author: D.E.Smith # Date: # Description: Generate Hexagons. # Credit: graber and twhiteaker's comment from http://blogs.esri.com/esri/arcgis/2013/05/06/a-new-tool-for-creating-sampling-hexagons/ # Notes: # ToDo: 1) Need to convert the AOI to a geometry object and compare the hex...
true
59603216365bef3b83dfa5d9b17ceb042ceb7af9
kippum99/learning_systems
/Final/svm.py
UTF-8
553
2.96875
3
[]
no_license
import numpy as np from sklearn import svm def transform(matx): matz = np.zeros(shape=(len(matx), 2)) for i in range(len(matx)): x1 = matx[i, 0] x2 = matx[i, 1] z1 = x2 ** 2 - 2 * x1 - 1 z2 = x1 ** 2 - 2 * x2 + 1 matz[i] = [z1, z2] return matz matx = np.matrix([[1, ...
true
a50673d3cdddc9f77b4d00cdcaf79aa389240c7f
oomoto-a/kadai_python
/study06/error_exception.py
UTF-8
423
3.015625
3
[]
no_license
# -*- coding: utf-8 -*- class HttpStatusRakutenException(Exception): """ httpステータスの例外 """ def __init__(self): pass def set_param(self, http_status, error_message): self.http_status = http_status self.error_message = error_message def __str__(self): return "httpス...
true
3c807f6f30387f538d81059d0e93102b9e9d9535
Raymongd007/CS760_Machine_learning
/hw2/src/bayes.py
UTF-8
9,949
2.6875
3
[]
no_license
#!/usr/bin/Python # -*- coding: utf-8 -*- import arff import numpy as np import matplotlib.pyplot as plt import math import sys,getopt from heapq import * from Queue import * import random random.seed(a=None) # # MutualInfo stores the # class MutualInfo: # def __init__(self,a,b,value): # self.nodePair =...
true
2537a6bcb82f395550b7f0c8442178d7e0e8d9e7
cyinwei/tamu_cs489_cloud_computing
/project/project-4-aggiestack/lib/display.py
UTF-8
2,740
3.4375
3
[]
no_license
""" Displays the state of a configuration (hardware, image, flavor) based on the stored state. """ from lib.utils.io_helpers import load_state def _generate_body(data, keys): """ Generate the body (all the rows after the column names) as a list of lines. Each line is a list of row elements to be formatte...
true
30a72f163725f66a72d19f05a7893c5fb340f9cd
CrepeMaker/NLPLibrary
/data_shape.py
UTF-8
2,229
2.71875
3
[]
no_license
def reshape_retty_comment(): with open("resources/R_comment_目黒区.csv", "r") as intxt, open("resources/Rc_shaped.csv", "w") as out: allstr = intxt.read().split(",https://retty.me/area/") for num, review in enumerate(allstr[1:]): review_elements = review.split(",") url = "http...
true
bf1126ce4fd38ce3d31deb3d64e35d1b961256f0
ojenksdev/dataquest
/python-programming-beginner/Introduction to Functions-357.py
UTF-8
2,871
3.75
4
[]
no_license
## 1. Overview ## f = open("movie_metadata.csv", "r") data = f.read() data_split = data.split("\n") movie_data = [] for row in data_split: r_split = row.split(",") movie_data.append(r_split) print(movie_data[:5]) ## 3. Writing Our Own Functions ## def el_in_list(input_lst): d_list = [] for e i...
true
aa525ef02ee72ea2170db0d80e641576d5d60769
TheMetaphysicalCrook/memorykloud
/DataAnalytics/step2_retain_english_only/retain_english_1.py
UTF-8
371
3.125
3
[]
no_license
import os import sys def is_ascii(s): return all(ord(c) < 128 for c in s) with open("english.txt", 'w') as dest: with open("step1_output.txt", 'r') as src: while 1: line = src.readline() if not line: break # test if the line contains unicode outside ascii tabs = line.split('\t') if (is...
true
67824bdbb0e96d6bbcbd44942b312d4f27e78a57
Coalin/Daily-LeetCode-Exercise
/11_Container-with-Most-Water.py
UTF-8
1,502
3.78125
4
[ "MIT" ]
permissive
class Solution: def maxArea(self, height): """ :type height: List[int] :rtype: int """ left = 0 right = len(height)-1 final_res = 0 while left < right: temp_res = min(height[left], height[right])*(right-left) final_res = max(fin...
true
79716de66f2beb8cdcb22652ffe33e7ecf157144
manicmaniac/Project_Euler
/python/Problem51.py
UTF-8
1,202
3.859375
4
[]
no_license
# coding:utf-8 """ By replacing the 1^st digit of *3, it turns out that six of the nine possible values: 13, 23, 43, 53, 73, and 83, are all prime. By replacing the 3^rd and 4^th digits of 56**3 with the same digit, this 5-digit number is the first example having seven primes among the ten generated numbers, yielding ...
true
6ce4fd4a4404df0053387226198dfbc2142959fa
maxmoulds/cs344
/programpy/mypython.py
UTF-8
642
3.34375
3
[]
no_license
import string import random def random_char(x): return ''.join(random.choice(string.ascii_lowercase) for y in range(x)) num_files = 3 num_chars_in_files = 10 file_names = [] for x in range(0, num_files): #zero based still, aww snap random_chars = random_char(num_chars_in_files) #print(random_chars, " is random...
true
a921c003c3119df586371c269d64d705d00f1543
FavebookSUTD/favebook_backend
/app/namespaces/book_search.py
UTF-8
1,807
2.671875
3
[]
no_license
from flask_restplus import Namespace, Resource from flask import jsonify import re api = Namespace('books/search', description='Books Search Resource') from .. import mongo from .lib import sanitize, PROJECTION books = mongo.db.kindle_metadata2 @api.route('/autocomplete/<string:prefix>') @api.route('/autocomplete/<...
true
62a240722c7dd6a2d9d2728d9833aaaa2cddaeff
opethe1st/PyJschema
/tests/draft_2019_09/reject_all_test.py
UTF-8
618
2.671875
3
[]
no_license
import unittest import parameterized from pyjschema.draft_2019_09 import validate class TestRejectAll(unittest.TestCase): @parameterized.parameterized.expand( [ ("random int", False, 1234), ("random string", False, "1234"), ("null", False, None), ("false",...
true
321ad29260bb4d5f3c8767c12c8bb4874be097ff
likhesh-mahajan/Python_Boto_Tips_and_Tricks
/project07/create_dynamodb_table.py
UTF-8
1,960
2.859375
3
[]
no_license
import boto3 class DynamoDB(object): def __init__(self, *args, **kwargs): #self.tablename = tablename self.__dict__.update(kwargs) # Query client and list_tables to see if table exists or not def QueryCreate(self, tablename): # Instantiate your dynamo client object client =...
true
7d74254d1307ddde8ebb0a58b5cd9814d6164462
R-Ceph/BOReL
/environments/example_env.py
UTF-8
1,086
3.0625
3
[]
no_license
import gym class ExampleEnv(gym.Env): def __init__(self): super(ExampleEnv, self).__init__() def get_task(self): """ Return a task description, such as goal position or target velocity. """ pass def set_goal(self, goal): """ Sets goal manually. Mai...
true
a0a3f0a4340731e1945c5eded239fdcb616f1780
Medioxx/PKM2.2
/PKM2/ALGORYTMY/przeszkody.py
UTF-8
2,817
3.140625
3
[]
no_license
import cv2 import numpy as np def przeszkody(frame,counter_proste,counter_widac_tory): ''' Opis: Wykrywa przeszkody na obrazie Zmienne wejściowe: obraz z kamery, licznik zwiększany w momencie wykrycia prostych, licznik zwiększany w momencie wykrycia torów Zmienne wyjsciowe: licznik zwiększany w momenc...
true
a4d2b68ba1dce1b4ec53e491eac30456f810aca6
nickest14/Leetcode-python
/python/easy/Solution_690.py
UTF-8
1,050
3.890625
4
[]
no_license
# 690. Employee Importance from typing import List # Definition for Employee. class Employee: def __init__(self, id: int, importance: int, subordinates: List[int]): self.id = id self.importance = importance self.subordinates = subordinates class Solution: def getImportance(self, emp...
true
1f7a2232e5b8d14b8895ebbf66cffdf63184ba90
sunshinezxf/neuralvis
/flask/nn/network_model.py
UTF-8
12,769
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- import os import json import math from io import StringIO import keras from keras.models import Sequential from keras import backend as backend from keras.preprocessing.image import img_to_array from keras.layers import Conv2D, Dense, Flatten, MaxPooling2D from keras.datasets import mnist ...
true
5ef6a694672b06cd8f56d8c28f26e095faeec167
Ransu-ll/generic-8ball-microbit
/main.py
UTF-8
1,364
3.0625
3
[]
no_license
def on_gesture_shake(): # "random" loading time for y in range(randint(1,4)): for x in range(4): loading[x].show_image(0) basic.pause(100) # show answer basic.clear_screen() basic.show_string(possibleAnswers[randint(0,20)], 70) input.on_gesture(Gesture.Shake, on_gest...
true
bb1294ce01f76328b303a6330adc0b480acf7d30
micheldavalos/flask_20A
/conexion.py
UTF-8
529
2.6875
3
[]
no_license
import mysql.connector bd = mysql.connector.connect( user='michel', password='12345678', database='escuela' ) cursor = bd.cursor() def get_alumnos(): consulta = "SELECT * FROM alumno" cursor.execute(consulta) lista = [] for row in cursor.fetchall(): a = { 'id': row[0],...
true
84a7b21c70cc7865e469f6d7bde5bb27a2ed21fa
shenmishajing/python
/week2/7-12.py
UTF-8
189
3.1875
3
[]
no_license
n, m = [int(x) for x in input().split()] if n <= m: print("fahr celsius") for i in range(n, m + 1, 2): print("%d%6.1f" % (i, 5 * (i - 32) / 9)) else: print("Invalid.")
true
af824fbe34534fba0dc0a1c0f8358783209c2353
nickvirden/deep-learning-portfolio
/Fundamentals/Deep Learning/Section 39 - Artificial Neural Networks (ANN)/artificial_neural_network.py
UTF-8
4,573
3.53125
4
[]
no_license
# Artificial Neural Networks # GPU => Graphical Processing Unit # CPU => Central Processing Unit # GPU can run more floating point calculations and parallel calculations than a CPU # Install Theano # pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git # Theano is a numerical computations li...
true
0fcf0517962ed489b64d8cc52e5082d05a5dfcbc
tedajax/TempFlux
/fnt2json.py
UTF-8
1,680
2.859375
3
[]
no_license
from __future__ import print_function from xml.dom import minidom import json import jsonpickle import sys class Point: x = 0 y = 0 def __init__(self, x, y): self.x = x self.y = y class Rect: x = 0 y = 0 w = 0 h = 0 def __init__(self, x, y, w, h): self.x = x self.y = y self.w = w self.h = h cla...
true
0b90f85148262929056016573e4830744d1b2e13
dcthomson/Advent-of-Code
/2015/20 - Infinite Elves and Infinite Houses/part2.py
UTF-8
572
3.09375
3
[]
no_license
import sys from functools import reduce def factors(n): return set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))) totalpresents = int(sys.argv[1]) house = 1 elves = dict() while True: presents = 0 for factor in factors(house): if factor not i...
true
536160370aeb7ca51c3e9cf7d5b20781a2cff3ae
tashif-hoda/APS-2020
/journey to the moon.py
UTF-8
1,041
2.90625
3
[]
no_license
# Enter your code here. Read input from STDIN. Print output to STDOUT\ # Complete the journeyToMoon function below. import sys def dfs_count(graph, visited, node, count): if visited[node]==False: visited[node]=True count+=1 for n in graph[node]: count = dfs_count(graph, visited,...
true
007c943034dadd71072eaa433a67902eff972439
quitegreensky/KivyIdeas
/src/classes/uix/scrollview.py
UTF-8
1,171
2.765625
3
[]
no_license
from kivy.animation import Animation from kivy.clock import Clock from kivy.lang.builder import Builder from kivy.properties import BooleanProperty, NumericProperty from kivy.uix.scrollview import ScrollView Builder.load_string( """ #:import ScrollEffect kivy.effects.scroll.ScrollEffect <NoTransitionScrollView>...
true
89a793e8b78fee7c8b1332c14476a3e6732fdd02
null223/Django-wishlist
/wants/views.py
UTF-8
620
2.578125
3
[]
no_license
from django.views import generic from .forms import SearchForm from .models import Wish # Create your views here. class IndexView(generic.ListView): model = Wish paginate_by = 10 def get_context_data(self): context = super().get_context_data() context['form'] = SearchForm(self.request.GET) return context ...
true
a95a7b0e5ff794803de8bca624ce09148fb4fee5
MakeSchool-17/trees-mazes-python-anselb
/generate_maze.py
UTF-8
1,222
3.546875
4
[]
no_license
import maze import random # Create maze using Pre-Order DFS maze creation algorithm def create_dfs(m): unvisited_neighbors = [] current_cell = random.randint(0, m.total_cells - 1) visited_cells = 1 while visited_cells < m.total_cells: current_neighbors = m.cell_neighbors(current_cell) ...
true
d3171ccd4a7d4cee63bd74860cdf5f16f67f0f17
alohali/coding
/practice/43.py
UTF-8
952
3.171875
3
[]
no_license
#!/usr/bin/env python class Solution(object): def multiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ data1 = [int(i) for i in num1] data2 = [int(i) for i in num2] mul = [0 for i in xrange(len(data1)+len(data2)-1)]...
true
29d4ba5a8de75f4294c1d4214a157f5a846c21ad
CaptN-JP/first_django_blog
/src- django_blog/users/models.py
UTF-8
895
2.546875
3
[]
no_license
from django.db import models from django.contrib.auth.models import User from PIL import Image class Profile(models.Model): user = models.OneToOneField(User, on_delete = models.CASCADE) """ if the user is deleted, the profile will also get deleted. If we delete the profile it won't delete the user """ image = mode...
true
78a643ec75a1b63890bd910df9a6167b22723288
AsmNoob/PROJ3IND
/Algorithm/Scenario.py
UTF-8
144
2.578125
3
[]
no_license
class Scenario(object): """This class stores all the information related to 1 specific scenario.""" def __init__(self, arg): self.arg = arg
true
9482c4bf6e858343a49925501dc0584cd01e7c36
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/223/users/1330/codes/1834_1274.py
UTF-8
190
3
3
[]
no_license
from numpy import * from numpy.linalg import * n = int(input()) matriz = zeros ((n,n), dtype = int) for i in range(0,n): for j in range(0,n): matriz[i,j] = min(i,j)+1 print (matriz)
true
a2bae007914453ede7eff610f7280140cdba15f8
Dearyyyyy/TCG
/data/3922/WA_py/508904.py
UTF-8
185
2.828125
3
[]
no_license
# coding=utf-8 while True: a,b=map(int,input().split()) if b==0: print("error") continue c=a/b d=a//b if c%1>0.499999: d=d+1 print(d)
true
0f2f22ec83fb5f31ed42d855e51dd36190e24c62
NatanLisboa/python
/exercicios-cursoemvideo/Mundo2/ex040.py
UTF-8
731
4.53125
5
[]
no_license
# Mundo 2 - Aula 12 - Condições Aninhadas # Desafio 040 - Crie um programa que leia duas notas de um aluno e calcule sua média, mostrando uma mensagem no final, # de acordo com a média atingida # - Média abaixo de 5.0: REPROVADO # - Média entre 5.0 e 6.9: RECUPERAÇÃO # - Média 7.0 ou superior: APROVADO print('\nDesa...
true
ff1bf98d5524d85f34a9a21db5a1ae665a5ba938
mishutka200101/Python-Practice-2
/task_9.4.py
UTF-8
639
2.953125
3
[]
no_license
fridge_count = int(input()) fridge_products = [] good_recipes = [] for i in range(0, fridge_count): fridge_products.append(input()) recipes = int(input()) recipe_products = [] is_ok = False for i in range(0, recipes): recipe_name = input() products_count = int(input()) for j in range(0, products_count):...
true