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
03595200a51930f2e04658dc6a714e8959259d6c
Python
TestCoders/testautomation_casus
/v1/backend_proxy/project/service/movie_calls.py
UTF-8
1,304
2.5625
3
[ "MIT" ]
permissive
import requests import json from json import JSONDecodeError from project.middleware.error_handler import InvalidUsage class MovieProxyAccess(object): def __init__(self, url): self.url = url def get_movie_id_based(self, id): r = requests.get(self.url + '/' + id) return json.loads(r.t...
true
41137cc0122b870dfac531b20addd5feb01dd088
Python
DmitrySerg/CMF
/Option Pricing/BlackScholes.py
UTF-8
4,895
3.0625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Mar 3 14:57:27 2016 @author: Auditore """ from math import log, exp import scipy.stats class DividendOption(): def __init__(self, Type, UnderlyingPrice, StrikePrice, TimeToExpiration, Int...
true
350dc347f929381cd6fead83215a84d1d1d4552f
Python
SoftwearDevelopment/spynl
/spynl/tests/test_log_error.py
UTF-8
3,050
2.8125
3
[ "MIT" ]
permissive
"""Test functions from spynl.main.""" from pyramid.testing import DummyRequest from spynl.main.utils import log_error from spynl.main.exceptions import SpynlException TOP_MSG = "TEST Error of type %s with message: '%s'" def test_log_error_msg(caplog): """Test casting the exception to string.""" class Erro...
true
ca95498f6424fdcbe43802d9ce210f34c1f0e8d0
Python
zyyxydwl/Python-Learning
/python3/Basics/2-logical/operation.py
UTF-8
984
2.9375
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- # @Time : 2018/1/23 21:41 # @Author : zhouyuyao # @File : operation.py # PyCharm 2017.3.2 (Community Edition) # Build #PC-173.4127.16, built on December 19, 2017 # JRE: 1.8.0_152-release-1024-b8 amd64 # JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o # Windows 10 10....
true
9c62a10bc51d72cb886f6c7c900b4d488b835070
Python
flavray/airtasker-challenge
/airtasker_challenge/rate_limiter/rate_limiter.py
UTF-8
8,611
3.15625
3
[]
no_license
import time from typing import Dict from typing import List from typing import Optional from .store import Store class RateLimiter: """ RateLimiter allows to guard access to any resource by limiting the number of permits allowed for any given requestor for a period of time. Any requestor will have l...
true
1795ee28def293c85879743a33c8f04ae59ae8fb
Python
bransorem/dataleaf
/interface.py
UTF-8
1,553
2.625
3
[]
no_license
# ==================================================== # Author: Brannen Sorem ============================== # Date Created: 05-09-11 ============================= # ==================================================== # Modified: 05-09-11 ================================= # ===========================================...
true
3682b9715c7f200a8c57085bd4f23b126e6571f7
Python
stacyzhao/weather-report
/astronomy.py
UTF-8
439
3.1875
3
[]
no_license
class Astronomy: def __init__(self, data): self.data = data self.sunrise = self.get_astro_time('sunrise') self.sunset = self.get_astro_time('sunset') def get_astro_time(self, phase): phase_data = self.data['sun_phase'] return phase_data[phase]['hour'] + ":" + phase_data[...
true
9908bbf9a3a0454415c5082f079b1663f9564902
Python
meteopascal/octopus
/j4/try_sqlalchemy.py
UTF-8
3,374
2.984375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Préparation: * sqlite: la table 'SITES' de la base 'Sites.sqlite' contenait des clefs étrangères, inutilisables en l'absence de l'autre table référencée. On a enlevé ces colonnes avec le plugin "Sqlite Manager" de Firefox (click droit / drop) On a aussi ...
true
4bfaa45cd48a787b50a47b4d5c6a6c8685f30a61
Python
acutesoftware/dev_setup
/stats_code.py
UTF-8
2,965
2.671875
3
[]
no_license
# stats_code.py import collections import os import ast import time base_fldr = 'T:\\user\\dev\\src\\python\\' opfile = 'code_stats.md' code_folders = ['AIKIF\\aikif', 'rawdata\\rawdata', 'virtual-AI-simulator\\vais', 'worldbuild\\worldbuild', 'web_...
true
3cf5d8c64ef42c5c17247ca943aba5c7576ebd25
Python
yli166/lintcode
/Check Full Binary Tree.py
UTF-8
564
3.4375
3
[]
no_license
import collections class Solution: """ @param: : the given tree @return: Whether it is a full tree """ def isFullTree(self, root): if not root: return True stack = collections.deque([(root)]) while stack: node = stack.popleft() if not no...
true
2ee186a5e4ae6bf7857017edac58e25c504690f9
Python
Libensemble/libensemble
/scripts/print_fields.py
UTF-8
1,567
2.65625
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
#!/usr/bin/env python import argparse import sys import numpy as np desc = "Script to print selected fields of a libEnsemble history array from a file" example = """examples: ./print_fields.py out1.npy --fields sim_id x f returned If no fields are supplied the whole array is printed. You can filter by using con...
true
63e23b1ff4329a0ec9a6a1381a3b2413b2e52a72
Python
tmukh/skluma-local-deploy
/extractors/main_extractor/topic/corpus.py
UTF-8
3,349
3.3125
3
[]
no_license
import pickle import math from collections import Counter from .preprocessing import preprocess class Corpus: ''' Class to compute and store various bag-of-words statistics for a corpus of text documents. :doc_freqs: counter that counts number of docs a word occurs in :global_tf: counter for tot...
true
9bf05b5463e234e87d0311deb194f778813a2da5
Python
aldotele/the_python_workbook
/introduction_to_programming/ex32.py
UTF-8
242
4.21875
4
[]
no_license
# exercise 32: Sum of the Digits in an Integer value = int(input('enter integer of four digits: ')) value_str = str(value) sum_of_digits = int(value_str[0]) + int(value_str[1]) + int(value_str[2]) + int(value_str[3]) print(sum_of_digits)
true
ecb60b5fd7192197ce10703c9107de60518220c7
Python
UNIMIBInside/ew-shopp-public
/keyword_clustering/cluster_keywords.py
UTF-8
19,183
3.140625
3
[]
no_license
# Developed in Python 3.6.7 # Code for clustering sets of keywords using FastText word vectors for representation. # FastText website: https://fasttext.cc # FastText word vectors: https://fasttext.cc/docs/en/crawl-vectors.html import json import re import csv from collections import Counter import fasttext import n...
true
105ba05769505def0a0890fdd141d38e9bef3bce
Python
karmacharya20/basicpython
/oop1.py
UTF-8
269
3.5
4
[]
no_license
from __future__ import print_function import math def circumference(radius): return math.pi * 2 * radius circles = [["First circle",4.4,2],["Second circle",3.7,3],["Third circle",8.4,4]] circles[0][2] = circumference(circles[1][1]) print (circles[0][2])
true
d0a423020247624fa6e604dc7d2a44853b66699f
Python
csyhhu/LeetCodePratice
/Codes/378/378.py
UTF-8
908
3.421875
3
[]
no_license
def kthSmallest_heap(matrix, k): import heapq heap = [] for row in matrix: for ele in row: if len(heap) < k: heapq.heappush(heap, -ele) else: if heap[0] < -ele: heapq.heappop(heap) heapq.heappush(heap, -...
true
2ba62ee267f9fd907a6fccd99a4a76b725b2a0eb
Python
qqdtf98/othello
/othello.py
UTF-8
5,699
2.90625
3
[ "MIT" ]
permissive
from bangtal import * from enum import Enum setGameOption(GameOption.ROOM_TITLE, False) setGameOption(GameOption.INVENTORY_BUTTON, False) setGameOption(GameOption.MESSAGE_BOX_BUTTON, False) scene = Scene("Othello", "Images/background.png") class State(Enum): BLANK = 0 POSSIBLE = 1 BLACK = 2 WHITE = 3 cla...
true
91c49b4d072a76342baa8aef9c90dfdc27379a39
Python
Mariappan/LearnPython
/Excercises/findListSizeInArray.py
UTF-8
328
3.4375
3
[]
no_license
#!/usr/bin/env python def solution(A): # write your code in Python 3.6 index=0 count=0 viewedIndex = set() while (index not in viewedIndex) and index !=-1: viewedIndex.add(index) index=A[index] count+=1 return count a = [1, 4, -1, 3, 2] print ("Count is " + str(soluti...
true
80ff684edfc4b20fc92635324735c634742655b4
Python
940643218/test01
/selenium/table.py
UTF-8
193
2.640625
3
[]
no_license
from selenium import webdriver import time driver=webdriver.Chrome() driver.get("file:///D:/table.html") t=driver.find_element_by_xpath("//table[@id='myTable']/tbody/tr[2]/td[1]") print(t.text)
true
1bedabd5653f28b45a6c8c2b9a46ccd0a2cc479a
Python
Jaxang/ComplexSystemCannibalism
/src/cannibalist.py
UTF-8
694
3.1875
3
[]
no_license
from src.base_agent import BaseAgent import random class Cannibalist(BaseAgent): def eat(self, food_energy, other, other_dead=False): if not other_dead: self.change_energy(food_energy/2) other.change_energy(food_energy/2) else: r = random.random() i...
true
d089d8e93d752ef9cf368b52bf5d69d1d97a35b4
Python
orkinyo/BlocksOfGuru
/Tools/ShooshxTools/PyCutter.py
UTF-8
1,120
3.078125
3
[]
no_license
# creates txt files in the form of "db 0x12" of the survivors path = "C:/Users/alond/Documents/בצפר/כיתה יא/codeGuru/corewars8086-survivors-master/corewars8086-survivors-master/cgx2019/phase2" surv = "Candiru" def main_func(path,surv): for i in [1,2]: f = open(f"{path}/{surv}{i}", 'rb') barr = b...
true
708a460f739891ad97b2cf529b7e91775863a1de
Python
lmhale99/potentials
/potentials/record/Parameter.py
UTF-8
5,447
2.875
3
[ "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-public-domain" ]
permissive
# coding: utf-8 # Standard Python libraries import io from typing import Optional, Tuple, Union # https://github.com/usnistgov/DataModelDict from DataModelDict import DataModelDict as DM # https://github.com/usnistgov/yabadaba from yabadaba.record import Record class Parameter(Record): """ Class for describi...
true
856b13f44ebf82336a1371c9cafa72856a794855
Python
allanvictor/videodrmkiller
/videodrmkiller.py
UTF-8
3,103
2.546875
3
[ "MIT" ]
permissive
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import TimeoutException from selenium.webdriver.common.by import By import time from dat...
true
b285e7beb3f296b6bbce030743d29ae338c5e953
Python
Salias/static-website-generator
/generator.py
UTF-8
2,758
2.78125
3
[ "MIT" ]
permissive
""" This code is an adaptation of the followig: Credits to http://www.willmcginnis.com/2016/03/20/really-minimal-static-website-generator-python-jinja2/ """ from jinja2 import Environment import os import json import shutil from jinja2 import BaseLoader, TemplateNotFound from os.path import join, exists,...
true
7ff0beb2ee5c30c38e2e9c5e018efd66cab93434
Python
adamj57/pywarships
/strategies/analytical_strategy.py
UTF-8
6,701
3.21875
3
[ "MIT" ]
permissive
import random from engine.warships import GridPoint, Grid, CheckResult from strategies.strategy import Strategy class AnalyticalStrategy(Strategy): def run(self, grid: Grid): self.init_vars(grid) while not grid.is_won(): if self.mode == "HUNT": self.hunt() ...
true
fa30c7ba41321669b976c543f15838e582115612
Python
AngstyDuck/Previous-Projects
/Misc_Projects/Term 3/Week 11/templates/cs1_alternate_template.py
UTF-8
726
2.9375
3
[]
no_license
from kivy.app import App from kivy.uix.scatter import Scatter from kivy.uix.label import Label from kivy.uix.button import Button from kivy.uix.floatlayout import FloatLayout from kivy.uix.textinput import TextInput from kivy.uix.boxlayout import BoxLayout class AlternateApp(App): state = 0 def build(self): b = ...
true
2295f9cb62ced743e4232fe710fa304c8d14691c
Python
navyakhare/Tetris-game
/level.py
UTF-8
391
3
3
[]
no_license
def level(score): if score>=1000: return 5 elif score>=500: return 4 elif score>=250: return 3 elif score>=100: return 2 elif score<=100: return 1 def time(l): if l==1: return 800 elif l==2: return 600 elif l==3: return 400...
true
4e9c23bdc59d8a77287786a59605673cdb010308
Python
wonsim00/discord_screenshots
/resources/channel.py
UTF-8
2,315
2.71875
3
[]
no_license
from .resource import Resource from .message import Message from utils.decorators import cached class Channel(Resource): def __init__(self, **kwargs): super(Channel, self).__init__(**kwargs) self._set_private_attr('__messages', []) self._set_private_attr('__message_ids', set()) self...
true
a2e4bc6fd517a6ac87c5de89b17e5f86f0eab3ea
Python
vivianamarquez/Royardo
/holasoydani.py
UTF-8
2,212
2.953125
3
[]
no_license
######################################################## # Import Librarires ######################################################## import re import json import random import pandas as pd import tweepy from tweepy import Stream from tweepy.streaming import StreamListener ###########################################...
true
5bcb30bafb904823dff8c22284ec2ed80a3f0471
Python
3bbasDev/Companies-Profit
/stock_Index_Price_tkinter.py
UTF-8
4,036
3.09375
3
[]
no_license
import pandas as pd from sklearn import linear_model import tkinter as tk import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg Stock_Market = {'Year': [2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2016,2016,2016,2016,2016,2016,2016,2016,2016,2016,2016,2016], ...
true
83bf0609ebeffbcaebc401dc564eddd17739ad85
Python
HiroTestStudent/FoundationsAlgorithm
/linear_search_practice.py
UTF-8
132
3.40625
3
[]
no_license
list = range(100) # [0, 1, 2...99] target = 3 for n in list: if (n == target): break # 検索が一致した
true
ad886682752717662f5991049ed7bef2c7ba453a
Python
bingzgxsm/PythonCode
/第16章/Listing_16-3.py
UTF-8
632
3.21875
3
[]
no_license
# Listing_16-3.py # Copyright Warren & Carter Sande, 2013 # Released under MIT license http://www.opensource.org/licenses/mit-license.php # Version $version ---------------------------- # Drawing a circle import pygame, sys pygame.init() screen = pygame.display.set_mode([640,480]) screen.fill([255,255,25...
true
8cd5d586b9273195f6a51374ee366320b3220cbc
Python
Msalah593/Python-Tutorials
/Regex tutorial.py
UTF-8
416
3.34375
3
[]
no_license
import re def match(): text="1 3eqwewem33224 3 435343 3fefe5eeed 3 5 6 4rtrtmlr44 5" inletters=['zero','one','two','three','four','five','six','seven','eight','nine'] ptr=re.compile(r'\b\d\b') result=re.findall(ptr,text) for x in range(len(result)): ind=int(result[x]) newpattern=r"\...
true
7b277a23d96000f658e9aff968b1e6d22ab0cfeb
Python
xiaosimao/get_proxy_ips
/db/SQLiteHelper.py
UTF-8
4,518
2.515625
3
[]
no_license
# coding:utf-8 from config import DB_CONFIG from db.SqlHelper import SqlHelper import MySQLdb import sys reload(sys) sys.setdefaultencoding("utf-8") class SqliteHelper(SqlHelper): tableName = 'proxy' def __init__(self): ''' 建立数据库的链接 :return: ''' self.database = MySQL...
true
fdba7a486f7d8e19fe7fefce70db62f0ffee80db
Python
Zacard274/flask-study
/app1/app.py
UTF-8
1,231
2.75
3
[]
no_license
from flask import Flask,request, render_template from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = "mysql+pymysql://fn:123@localhost/study" db = SQLAlchemy(app) class User(db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True, aut...
true
8e1f47a8fe924a57be76735fdd1de695f63539e5
Python
ww8007/SiliconWildCat
/backend/web/inference.py
UTF-8
6,846
2.65625
3
[]
no_license
import os import re import sys from unicodedata import normalize from pathlib import Path from TTS.utils.synthesizer import Synthesizer from g2pK import g2pk g2p = g2pk.G2p() def normalize_text(text): text = text.strip() for c in ",;:": text = text.replace(c, ".") text = remove_duplicated_punctua...
true
e083b4033c519393c5de11afd3b86b20da2c7d88
Python
andrelgl/Maqui-de-busca-imagens-em-diretorios
/compare.py
UTF-8
1,271
2.84375
3
[]
no_license
from skimage import measure import matplotlib.pyplot as plt import numpy as np import cv2 import os import operator ssim_min = 0.7 max_obj = 5 imgs = os.listdir('images') class Model(): def __init__(self, img, valor): self.img = img self.valor = valor original = cv2.imread("jp_gates_origi...
true
51d566e1c37024c6a82b08ce8bc6f6dbacd7e8a6
Python
aaw/backtrack
/test/grid.py
UTF-8
722
3.640625
4
[ "Unlicense" ]
permissive
#!/usr/bin/python3 # Usage: python3 grid.py n # # Generates an n x n grid graph # # 0--1--2 # | | | # 3--4--5 # | | | # 6--7--8 import io import itertools import sys def grid(n): buffer = io.StringIO() for i in range(n*n-1): if i % n == n-1: continue buffer.write("e {} {}\n".format(i+1,i+...
true
ec19f4fe689a308787e3ac3d2082924775c5e4b0
Python
OfirKP/pip-licenses
/scrape_licenses.py
UTF-8
4,814
2.578125
3
[ "BSD-3-Clause", "JSON", "MIT" ]
permissive
from typing import Iterable, Optional import requests from bs4 import BeautifulSoup import re from urllib.parse import urlparse, urlunparse, urljoin import os GITHUB_PATTERN = re.compile('github.com/.*/.*') VARIANTS = ['LICENSE', 'COPYING', 'COPYRIGHT', 'LICENCE'] class URL: @staticmethod def normalize_url(u...
true
faf9d3f40188936e1b6658536dcbf493a2d47e63
Python
kikobr82/Python
/Lambda/S3-List-Object.py
UTF-8
287
2.578125
3
[]
no_license
#!/usr/bin/env python import boto3 import sys bucket_list = sys.argv[1] print 'Bucket that will be listed:', bucket_list client = boto3.client('s3') response = client.list_objects_v2(Bucket = str(bucket_list)) for obj in response['Contents']: print 'Object Name: %s' % obj['Key']
true
cd40924048a0b15166ec21388b119cd3023f77d6
Python
kziovas/uni-project-python-mini-tasks
/Exercises/askish8.py
UTF-8
1,360
3.3125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Mar 11 02:05:27 2019 @author: Kostas Ziovas """ #-----Library calls----# from urllib.request import urlopen from bs4 import BeautifulSoup as BS #---------Definitions--------# url="https://akispetretzikis.com/el/categories/zymarika/garidomakaronada" html = urlop...
true
71760752a261aaf2ca2250c8332ffa113962b00e
Python
OddPhantom/advent_2016
/python/p15.py
UTF-8
1,259
3.0625
3
[]
no_license
# -*- coding: utf-8 -*- import sys import os import helpers from collections import deque import hashlib import binascii # Disc #1 has 17 positions; at time=0, it is at position 1. # Disc #2 has 7 positions; at time=0, it is at position 0. # Disc #3 has 19 positions; at time=0, it is at position 2. # Disc #4 has 5 po...
true
5c078ac57f676e75fc02b235aa0c4eb225763682
Python
dangkhoadl/Udacity-Full-Stack-Web-Developer-Nanodegree
/1_Movie-Trailer-website/media.py
UTF-8
655
2.96875
3
[]
no_license
import fresh_tomatoes class Movie(): """ Documentations: This is the class to store movie attributes: movie titles, box art, poster images, and movie trailer URLs""" # Constructor def __init__(self, movie_title, movie_storyline, poster_im...
true
4783bc604337afdb569d680374ef99b4ed682753
Python
dubon1/Python
/daniel/bsearch.py
UTF-8
644
4.0625
4
[]
no_license
#!/usr/bin/python3 def binary_search(item_list, item): first = 0 round=0 last = len(item_list)-1 # index information print(' 1st = ', first, ' last ', last) found = False while( first<=last and not found): mid = (first + last)//2 round+=1 if item_list[mid] == item : ...
true
8edefbd97803fcd73c9122bee6e2e8d89d025a07
Python
haiwenzhu/leetcode
/set_matrix_zeroes.py
UTF-8
2,112
3.3125
3
[]
no_license
class Solution: """ @see https://oj.leetcode.com/problems/set-matrix-zeroes/ """ # @param matrix, a list of lists of integers # RETURN NOTHING, MODIFY matrix IN PLACE. def setZeroes(self, matrix): row1 = 1 col1 = 1 m = len(matrix) n = 0 if m == 0 else le...
true
e9d1502c2c2016d174ac76e1fe46482070418dc6
Python
gulamd/python
/lc_intro.py
UTF-8
130
3.65625
4
[]
no_license
sqaures = [] for i in range(1,11): sqaures.append(i**2) print(sqaures) sqaure2 = [i**2 for i in range(1,11)] print(sqaure2)
true
c5c038afda2738fdd24f4ed596e0d3310e6eea1d
Python
fuleying/cvbase
/cvbase/io.py
UTF-8
2,542
2.765625
3
[]
no_license
import json import os import sys try: import cPickle as pickle except: import pickle from multiprocessing import Process, Queue from os import path def json_dump(obj, filename, **kwargs): with open(filename, 'w') as f: json.dump(obj, f, **kwargs) def json_load(filename): with open(filename, ...
true
830d036e27ae213e79269fed30024f185bbfedd5
Python
Aasthaengg/IBMdataset
/Python_codes/p02639/s627489014.py
UTF-8
174
3.203125
3
[]
no_license
x, x1, x2, x3, x4 = map(int, input().split()) if x == 0: print(1) if x1 == 0: print(2) if x2 == 0: print(3) if x3 == 0: print(4) if x4 == 0: print(5)
true
d1bbd679dc3355c4f6fa89cd1ea472d77562c910
Python
tsubone/test2
/hello.py
UTF-8
482
2.875
3
[]
no_license
#!/usr/bin/env python import datetime import math import sys import mycalc as hoho from mycalc import add #import enum import sets print "hoho.add=", hoho.add(1,2) print "add=", add(1,2) def squre (n): return n*n class FirstClass: a = "hello" def m(self): print FirstClass.a print "Hell...
true
293f758595ad873345942ab3ccb3f271a0c8235d
Python
sarthak2401/aadil
/hello_world.py
UTF-8
59
3.140625
3
[]
no_license
a=[1,2,3,4,5,67,8,9] s=0 for x in a: s=s+x print(x**2)
true
fbd9b16a5b17690e682d9812e1be7bc4ef439ed8
Python
jayten-jeon/problem-solving
/leetcode/48-rotate-image.py
UTF-8
432
3.265625
3
[]
no_license
class Solution: def rotate(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ n = len(matrix) tmp = [] for i in range(n): col = list(reversed([row[i] for row in matrix])) tmp.append(col) ...
true
106321b0ee164d5aea7e76d56f616990403b4212
Python
agga1/MOWNiT
/lab9/zad1/fourier.py
UTF-8
1,033
3.5
4
[]
no_license
import numpy as np from numpy import fft, rot90 import matplotlib.pyplot as plt def display_gray(array): plt.imshow(array, cmap="gray") plt.show() def find_pattern(array: np.array, pattern: np.array, threshold: float): """ finds correlation in frequency dimension between given pattern and array,...
true
58d802bec1383c02531fc78f84990fa18f3de4f0
Python
LucasXS/PythonHUB
/PyhtonHUB-Instragram/WhatOutput/DrawingPie-Chart.py
UTF-8
467
3.765625
4
[]
no_license
from matplotlib import pyplot as plt # Pie chart, where the slices will be ordered and platted counter-clockwise: Players = "Ronaldo", "Lucas", "Sthefanie", "Lorena" Score = [45, 30, 15, 10] explode = [0.1, 0, 0, 0] # "explode" the 1st slice fig1, ax1 = plt.subplots() ax1.pie(Score, explode=explode, labels=Players...
true
f97808a6a5a3910f2605197b9d6cf752fe1c426a
Python
byAbaddon/Book-Introduction-to-Programming-with----JavaScript____and____Python
/Pyrhon - Introduction to Programming/4.2. Complex Conditions - Exam Problems/04. Match Tickets.py
UTF-8
598
3.484375
3
[]
no_license
budget, ticket, people = float(input()), input(), int(input()) tickets_type = {'VIP' : 499.99, 'Normal': 249.99} if 1 <= people <= 4: budget *= 0.25 elif 5 <= people <= 9: budget *= 0.40 elif 10 <= people <= 24: budget *= 0.50 elif 25 <= people <= 49: budget *= 0.60 else: budget *= 0.75 ticket_pr...
true
60e837765c86d5dc0f6d178567dc82463efc5d68
Python
XD-OB/DSLR
/src/description.py
UTF-8
5,090
3.375
3
[]
no_license
# **************************************************************************** # # # # ::: :::::::: # # description.py :+: :+: :+: ...
true
9516bc44371efe03ba9c5c7deb3ced7bd27d485e
Python
cucurrupil/Functions1
/Functions_2/Ex04.py
UTF-8
184
3.296875
3
[]
no_license
def inv(s): rs = '' index = len(s) while index > 0: rs += s[index - 1] index = index - 1 return rs print(inv('correr'))
true
95d7b4202ae4d7662d69332814fd47d078ea16d0
Python
yangwen1997/ASR
/util/file_util/rename.py
UTF-8
2,177
3.015625
3
[]
no_license
#!/usr/bin/env python # encoding: utf-8 ''' @author: 罗成 @contact: luocheng@dgg.net @file: rename.py @time: 2019-07-12 16:48 @desc:用于重命名文件名字 ''' import os import sys import datetime def is_in_dir(file_path, replace_name): for dir2 in dirs: if replace_name in dir2: print(dir2) def rename_dir(f...
true
675e06955f29b3a1446a9d301635904bf15c46ad
Python
amirsh7000/lecture2
/1_2_example_variables.py
UTF-8
636
3.71875
4
[]
no_license
# calculator of circle area ##################################### ### define a new varibale called pi # ##################################### pi = 3.1415 ######################################### ### define a new varibale called radius # ######################################### radius = 4 ############################...
true
9f8864c116a320ded0ca3f713008a671f6d2f777
Python
Gowtham-Sridhar/python-files
/classes/user.py
UTF-8
1,691
3.65625
4
[]
no_license
class User(): ''' creating user model ''' def __init__(self, firstname, lastname, age, gender, email, country): ''' initialize attributes for user ''' self.firstname = firstname self.lastname = lastname self.age = age self.gender = gender self.email = email ...
true
fd049c47c06c30be5bb6fcaba53ce9247d86df49
Python
danielalvaradob/Algorithms
/quick_sort.py
UTF-8
2,146
4.21875
4
[]
no_license
# Python program for implementation of quick_sort_aux Sort # This function takes last element as pivot, places # the pivot element at its correct position in sorted # array, and places all smaller (smaller than pivot) # to left of pivot and all greater elements to right # of pivot def partition(arr,low,high): ...
true
7f4207a4839228c932056fc736c8e31e223513d4
Python
jayala-29/Project-Euler
/Problem21.py
UTF-8
534
3.171875
3
[]
no_license
# python implementation def Problem21 (first, last): tracker = [] for i in range (first, last + 1) : s = 0 for j in range (1,i) : if i % j == 0 : s += j tracker += [s] pairs = [] for i in range(last - first + 1) : ind = tracker[i] ...
true
d5887d2c977705d93f4b9a8456cb3e7dfa5b647b
Python
elubow/dcos-introspect
/dcos_introspect/cli.py
UTF-8
537
2.640625
3
[]
no_license
"""DCOS Introspect Example Subcommand Usage: dcos introspect --info Options: --help Show this screen --version Show version """ import docopt from dcos_introspect import constants def main(): args = docopt.docopt( __doc__, version='dcos-introspect version {}'.format(...
true
111624c2b600bcce37cae042b52ea4cb4539d606
Python
Cezar-Azevedo/PO
/5.0-Matriz_de_arquivo.py
UTF-8
318
2.984375
3
[]
no_license
with open('matriz.txt', 'r') as f: matriz = [[int(num) for num in line.split(' ')] for line in f] for line in f: if (line.strip() == ""): print (entrou) matriz2 = [[int(num) for num in line.split(' ')]for line in f] print(matriz) print(matriz2)
true
bc8ca529e5e8b95e221274ed9e76f5b188c3453d
Python
renatus/DisplayMedicalData
/windows/window_pressure_line_plots.py
UTF-8
9,501
3.265625
3
[]
no_license
# Function to draw Matplotlib window def draw(plt, dfBTemp, temperatureByDayMean, temperatureByDayMax, temperatureByDayMin, temperatureMA100, bloodPressureByDayMean, bloodPressureByDayMax, bloodPressureByDayMin, pressureSystolicMA30, dfMedicationStartStop, dfCycle, dfBloodPressure): # Open window ...
true
a9208a86b02be826d5de753b978d3fef3a1158ab
Python
idesign0/Programming-Repo
/Python/7.LISTS/shell.py
UTF-8
667
2.734375
3
[ "MIT" ]
permissive
Python 3.7.2rc1 (tags/v3.7.2rc1:75a402a217, Dec 11 2018, 23:05:39) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> numbers = [20,54,869,75,15,31] >>> numbers [20, 54, 869, 75, 15, 31] >>> numbers[2] 869 >>> numbers[2]=25 >>> numbers [20, 54, 25, 75, 15, ...
true
c21ac75389bfee43f2e0865b26c6ce282ece74b6
Python
leadscloud/Jingoal
/weekly_worklog.py
UTF-8
9,105
2.515625
3
[]
no_license
from jingoal import JinGoal from GoogleAanlytics import ga_main import datetime import time PROXY_HOST = '192.168.1.2' PROXY_PORT = 1690 """ 工作小结 第34周 上周总结: 1. 菲律宾站内搜索网站完成。 2. 沙特阿语优化网站,关键词更新,外链发布。 3. 日常外链发布 ,排名优化工作。 本周计划: 1. 针对菲律宾,沙特开发新的引流平台。 2. 肯尼亚网站流量有下降趋势,安排外链工作。 3. 日常外链发布 ,排名优化工作。 """ CURRENT_WEEK_LOG = """ 上...
true
0bb95cb06c0eb3d8e58970606fa7832fb4ed939f
Python
antohneo/pythonProgramming3rdEdition
/PPCh8PE1.py
UTF-8
565
4.40625
4
[]
no_license
# aaa # python3 # Python Programming: An Introduction to Computer Science # Chapter 8 # Programming Excercise 1 def main(): print("This program computes the N-th Fibonacci number, N is specified.") n = int(input("Enter the N-th Fibonacci number to calculate [1-999,999]: ")) i = 0 fib = 0 fib_n1 ...
true
884b1f6366f304899ceb4083b5674a67094fcb08
Python
alistairpott/intaka
/get-articles.py
UTF-8
1,214
3.171875
3
[]
no_license
import os from articles.factory import ArticleFactory from docbuilder import DocBuilder #get the input article list fin = open('articles.txt','r') article_list = fin.readlines() fin.close() #from now on we work in the output directory os.chdir('output') #remove any old pictures that are in the output images folder f...
true
9497c8c887e63a9e35065d8ca6df3a966c890fdd
Python
pgorecki/python-ddd
/src/seedwork/tests/infrastructure/test_sqlalchemy_repository.py
UTF-8
5,189
2.796875
3
[ "MIT" ]
permissive
import uuid from dataclasses import dataclass import pytest from sqlalchemy import Column, String from sqlalchemy.orm import Session from sqlalchemy_utils import UUIDType from seedwork.domain.entities import Entity from seedwork.domain.exceptions import EntityNotFoundException from seedwork.infrastructure.data_mapper...
true
15964f0bce4887f2658a5217c4eb5569c70bdb9c
Python
SimZhou/algorithm014-algorithm014
/Week_04/Homeworks/874. 模拟行走机器人.py
UTF-8
882
3.125
3
[]
no_license
# https://leetcode-cn.com/problems/walking-robot-simulation/ class Solution: def robotSim(self, commands: List[int], obstacles: List[List[int]]) -> int: start = [0, 0] go = (0, 1) obstacles = set((i, j) for i, j in obstacles) res = 0 '''逆时针90°:[[0,-1],[1, 0]]''' '''...
true
6ffa261bf78a280e49c13f1b0ccaefd501803f09
Python
rycktessman/Cholera-Calibration
/Cholera_Calibration_IMIS_June2020.py
UTF-8
7,047
2.515625
3
[]
no_license
##################################################################################### # Author: Theresa Ryckman (tessryckman@gmail.com) # # Purpose: run multivariate normal sampling part of IMIS # # Run this file after running Cholera_Calibration_SIR2_June202...
true
99fb6d97a8c363e1e5b42a9a4bc7990c3f1651b5
Python
sakharovmaksim/acceptance-core-py
/testing_projects_common/blocks/input_field.py
UTF-8
1,490
2.671875
3
[]
no_license
from acceptance_core_py.core.actions import driver_actions from testing_projects_common.blocks.base_block import BaseBlock class InputField(BaseBlock): """Любое поле для ввода, например, текста""" def input_with_check(self, string_to_input: str, need_click_by_html: bool = False): """Используй этот ме...
true
a7617970a34a31905848500f19fd2cc37c0e45f0
Python
abeneze/gitTest
/test.py
UTF-8
166
2.8125
3
[]
no_license
inputData = input("skriv orden :- ").split() print("".join([x+y for x in inputData[0] for y in inputData[1]])) test = input("skriv talen").split() print("test 2")
true
9e61dddf2bb9e22d16ab51c82de7942561fe1d8d
Python
notBroman/AdventOfCode_2020
/python/05/day5_1.py
UTF-8
1,144
4.0625
4
[]
no_license
# Roman Berger # a program that finds my seat on a plane by scanning all the other tickets # ticket format : 1-7 F(ront) or B(ack) describes the 128 rows: 0-127 # 8-10 L(eft) or R(ight) describes 8 colums: 0-7 # convert seats into binaty number -> convert into decimal # f=0 b=1 && l=0 r=1 def get_data...
true
f65b00f3b1c8ee00fe47256b7991abaaa7c51d4b
Python
Diego780527/ADSI
/practica_1.py
UTF-8
560
3.34375
3
[]
no_license
""" Ejercicio: Crear un programa que por teclado se introduce nombres y apellidos de tres usuarios y los muestre por pantalla """ nombres_1 = input("Ingrese nombres:") apellidos_1 = input("ingrese apellidos:") nombres_2 = input("Ingrese nombres:") apellidos_2 = input("ingrese apellidos:") nombres_3 = input("Ingrese ...
true
4161ab47407d1d188f86e89fbc5fc9c4e125f50c
Python
pjok1122/baekjoon-online-judge-practice
/DP/Fibonacci(1003).py
UTF-8
1,197
3.828125
4
[]
no_license
#피보나치 함수 ''' L[n]=[...] 공간에 f[n]을 호출 했을때 f(1)이 몇번, f(0)이 몇번 등장하는지 튜플로서 저장해둔다. 그리고 호출 될때마다 반복적으로 호출되는 연산을 막기 위해 L[n] R[n]이 존재할 경우에는 곧바로 참조한다. ''' L=[-1 for x in range(41)] R=[-1 for y in range(41)] def FibCount(n): #n번째 피보나치 수는 몇 번의 f(0)과 f(1)로 이루어져있는지 반환 global L global R if L[n]!=-1: ...
true
658d871a31997e24a63e352d60537af7a1b4aee9
Python
Saurav-Raghaw/ML16-Recommendation-Sysytem
/main.py
UTF-8
6,967
2.578125
3
[ "MIT" ]
permissive
from flask import Flask, render_template, request import pickle import numpy as np from numpy.core.numeric import moveaxis import pandas as pd # import urllib library from urllib.request import urlopen import os from numpy import load # import json import json app = Flask(__name__) api_key = "" #Your API key if os...
true
8507c80a2044c46f0789317abad550d142deaa35
Python
toanqz/ktpm2013
/triangle/test.py
UTF-8
4,256
2.984375
3
[]
no_license
import unittest import math import triangle class test(unittest.TestCase): #test tam giac deu def test_triangleDeu1(self): self.assertEquals(triangle.detect_triangle(1.0, 1.0, 1.0), "Tam giac deu") def test_triangleDeu2(self): self.assertEquals(triangle.detect_triangle(2**32.0-1, 2...
true
e0d2f6d4d375339caa60cedfe984dfe86a62b736
Python
mryangxu/pythonPractice
/常用内建模块/urllib/practice_one.py
UTF-8
382
2.5625
3
[]
no_license
from urllib import request import json def fetch_data(url): with request.urlopen(url) as f: res = f.read().decode('utf-8') return json.loads(res) # print(res) # 测试 URL = 'https://yesno.wtf/api' data = fetch_data(URL) print(data) assert data['answer'] == 'no' # assert data['query']['results...
true
b0b1fe8010b49d2a01460cfc899004bc45bb1a12
Python
sampathl/basics
/python/w3resource_python_exercises/list/basic.py
UTF-8
1,280
3.234375
3
[]
no_license
import random import itertools list1=[1,2,3,4,5,6,7] sum=0 mul=1 for i in list1: sum+=i mul*=i print(sum,mul, max(list1), min(list1)) sample11=['abc', 'xyz', 'aba', '1221'] count=0 for i in sample11: if len(i)>2: if i[0]==i[-1]: count+=1 print(count) sort_to=[(2, 5), (1, 2), (4, 4), (2...
true
b9782ca5379b50a4050dd43d03c0a5daf15ee3e6
Python
levchCode/GA-intfactor
/GA_integer_factorization.py
UTF-8
2,335
3.328125
3
[]
no_license
import random N = 85 pop = [] pop_size = 10 dna_size = 2 def fitness(dna): p = int(dna[0]) q = int(dna[1]) if p == 1 or q == 1: return 10000 else: return abs(N - p * q) def zeroes(): dna = [] p = "" q = "" for i in range(dna_size): p += '0' q += '0...
true
5638a05599109531b35b3036cacf392f8943883b
Python
JalfLSD/HumanTaskService
/HumanTaskService/database.py
UTF-8
1,976
2.515625
3
[]
no_license
import mysql.connector # Return the database connection def get_connection(): try: cnx = mysql.connector.connect(user='root', password='hard99', host='localhost', database='humantaskservice'); except mysql.connector.Error as err: ...
true
635788139be6d856f7ca4114625983bb527fb39c
Python
zopepy/leetcode
/battleship.py
UTF-8
823
3.15625
3
[]
no_license
class Solution: def countBattleships(self, board): """ :type board: List[List[str]] :rtype: int """ l=len(board) b=len(board[0]) i = 0 j = 0 count = 0 while i<l and j<b: local = 0 bs = 0 for r in range(0, b): ...
true
cb75d1b5c25624749dada8925b235f3b1ba65a84
Python
Aleks-Ya/yaal_examples
/Java+/Libs+/Jython/resourcesTest/jython/methods.py
UTF-8
83
2.921875
3
[]
no_license
def contains(string, substring): return string is None or substring in string
true
c200fda5e00dd382da08d237ee97fc6e12948b3e
Python
MFMdeRooij/CRISPRscreen
/SangerSeq/Sanger.py
UTF-8
3,159
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- """ Quick Sanger Sequence Analysis of cloning a sgRNA or shRNA insert into a plasmid: - Install the Biopython package (command line: conda install -c anaconda biopython) - Add the reference sequences (like the Gibson oligo sequences) to Sanger_RefsCloningOligo.csv - Add the ab1 ...
true
c432a5675c0d3795ffd55f77ec6355c55c553b91
Python
imjoung/hongik_univ
/_WSpython/Python06_22_DataTypeEx07_최임정.py
UTF-8
157
3.234375
3
[]
no_license
a=[1,2,3] b=a[:] a[1]=4 print(a) print(b) print("="*15) from copy import copy a=[1,2,3] b=copy(a) print(a) print(b) print(id(a)) print(id(b))
true
23490110ae47ac70c0d32ea66b43f759107397f5
Python
praveengadiyaram369/leetcode_submissions
/leetcode_557.py
UTF-8
586
3.71875
4
[]
no_license
# _557. Reverse Words in a String III class Solution: def reverseWords(self, s: str) -> str: l = r = 0 result = '' s = s.strip() for char in s: if char != ' ': r += 1 else: space_index = r + 1 while l < r: ...
true
9194a32dfa300a7bfaf1bb1d6a771352b6e13a94
Python
tomoki/project-euler
/47/main.py
UTF-8
793
3.390625
3
[]
no_license
#!/usr/bin/env python #coding:utf-8 from math import * from string import * from fractions import * from itertools import * def sieve(N): primes = set() for i in range(2,N): primes.add(i) for i in range(2,int(ceil(sqrt(N)))): if i in primes: for j in range(i*i,N,i): ...
true
b97c882616eb885de6f24f24d7f471c1586d5e92
Python
pombredanne/tools-2
/url.py
UTF-8
601
2.953125
3
[]
no_license
#!/usr/bin/python ''' Created on Apr 26, 2011 URL Expander @author: kbandla ''' import sys import httplib, urlparse, urllib def main(url): if not url.startswith('http'): url = "http://"+url url = urlparse.urlparse(url) conn = httplib.HTTPConnection(url.netloc,80) conn.request("GET",url.path) ...
true
0ce54ae98ae7a8b5d4d8ecf88d616766886e3f4b
Python
spatiumlucis/ilcs
/sensor_subsystem/Version 2/5-11-17/rgb_sensor.py
UTF-8
1,511
2.609375
3
[]
no_license
import time import os import signal import subprocess import circadian """ Global variables """ SLEEP_MODE = False COLOR_THRESHOLD = 0 MASTER_CIRCADIAN_TABLE = circadian.init_circadian_table() """ Signal Handlers """ def handle_change_cmd(signum, stack): print "Changing parameter..." time.sl...
true
4fc0f156598529894f51487be9f42ca287a4a7fb
Python
bobo6668/PythonProject
/pythonLiao/1_2_For.py
UTF-8
785
3.375
3
[]
no_license
# -*- coding: utf-8 -*- def findMinAndMax(L): my_max = None my_min = None if L is None: # 特殊处理 L是None的情况 return None, None else: for i in L: if my_max is None and my_min is None: # 初始化 my_max = i my_min = i else: if ...
true
6a954890fde618915daeba2424f83f165c5aa434
Python
Emil1483/gl_test
/vector.py
UTF-8
2,823
3.75
4
[]
no_license
import functools import math import random def random_unit_vector(): a = random.random() * 2 * math.pi return Vector(math.cos(a), math.sin(a)) def random_vector_in_range(max_x, max_y): return Vector( random.random() * max_x, random.random() * max_y ) def random_vector_in_circle(pos, r...
true
c729f131817669a52513c887feb0ecca79cdb9be
Python
damienpontifex/tf-keras-unet
/unet/model.py
UTF-8
2,807
2.765625
3
[]
no_license
import tensorflow as tf l = tf.keras.layers def _conv_block(inputs: tf.Tensor, filters: int, repeat=2) -> tf.Tensor: """Repeated 3x3 2d convolutions with ReLU""" layer = inputs for _ in range(repeat): layer = l.Conv2D(filters, kernel_size=3, activation=tf.nn.relu, padding='same')(layer) return...
true
a68e62694aca1ba2744f4e55cf299982219f74e3
Python
kamimi01/coding_practice
/AtCoder_Beginner_Contest_184/c.py
UTF-8
1,046
3.671875
4
[]
no_license
# 間違い!!(動画見ても、どこかの解説見ても理解できん) r1, c1 = map(int, input().split()) r2, c2 = map(int, input().split()) ans = 0 def check(a, b, c, d): isOk = False if a + b == c + d or a - b == c - d or abs(a - c) + abs(b - d) <= 3: isOk = True return isOk okResult = check(r1, c2, r2, c2) # 少なくとも3手でどこでもいける # パリティ(斜めに白と黒)の、...
true
922644af87b0e9d46663a60cf935e98769deca11
Python
mokuo/nlp100
/ch01/p02.py
UTF-8
183
3.328125
3
[]
no_license
def main(): str1 = "パトカー" str2 = "タクシー" result = "" for i in range(len(str1)): result += str1[i] result += str2[i] return result
true
290ac8c99bf0f3e36471a9b4b843d543bbe82256
Python
ysjin94/Slaying-the-Spire
/card_dictionary.py
UTF-8
7,039
3.1875
3
[ "MIT" ]
permissive
#dict of cards #cost, target, function, type, ethereal #target true = card can target enemy #target false = card just gets played #type = A for Attack, P for Power, S for Skill #ethereal = whether the card is exhausted after end of turn #choose_headbut(), choose_armaments() = False, if not need #will need new type fo...
true
0f8ae3f84faaf6d1b395a50f6a96cae91d39012e
Python
dpaucarj/2doParcial
/archivotxt.py
UTF-8
789
3.125
3
[]
no_license
archivo, f ='datos.txt',"" docentes= [{'nombre':'Darwin', 'edad':30, 'fac': 'ingenieria'}, {'nombre':'Juan', 'edad':30, 'fac': 'salud'}, {'nombre':'Yadi ', 'edad':40, 'fac': 'administrativa'}] with open (archivo, 'w') as writer: for i in range (len (docentes)): linea ='' for clave , valor ...
true
9078821302163c1bdebd678a64272b3bbd82d1a6
Python
siddharthrangnani/pyprograms
/argumentsfunction.py
UTF-8
84
3.3125
3
[]
no_license
#formal and actual arguments def sum(a,b): c=a+b print(c) x=10 y=11 sum(x,y)
true
bb44ccb6f1771f5cd32cd7d1a1b6fbbd4ce26657
Python
naveenkratos/OptivInterviewProject
/TableCreator.py
UTF-8
726
2.96875
3
[]
no_license
from prettytable import PrettyTable class TableCreator: def __init__(self,config,mongo): self.config = config self.mongo = mongo self.createTable() self.rowCount = 0 def createTable(self): tabular_fields = ["S.NO","IP", "Country", "Owner","Detected urls","UnDetected ...
true
5e27c09e392730f97fd1db82208647d1c1f10508
Python
csancini/Course-Overview
/week_5/HW/unit5.py
UTF-8
1,436
3.921875
4
[]
no_license
import sys from collections import defaultdict from collections import Counter from collections import OrderedDict for place in sys.path: print(place) periodic_table = defaultdict(int) periodic_table.update({"Hydrogen": 1, "Helium": 2}) print(periodic_table["Hydrogen"]) # adds an element with the s...
true