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
4acbde50e8676c43de4eb727d6770f250ad6c794
hmchen47/DataScience
/DSFund-BerkeleyX/1-CompThinkWPython/labs/lab05/tests/q2_3.py
UTF-8
641
2.5625
3
[]
no_license
test = { 'name': '', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" >>> # Check your column labels and spelling >>> region_counts.labels == ('region', 'count') True """, 'hidden': False, 'locked': False }, ...
true
0b2bddd86926437868ced9c1c8fe6f0444b77353
Weijiang-Xiong/pyIntro
/officialTutorial/classes/info_hiding.py
UTF-8
195
2.5625
3
[]
no_license
class infoHiding(object): def __init__(self): self.visible = 'Look at me' self.__alsoVisible__ = 'Look at me too' self.__invisible = 'Don\'t look at me directly'
true
863b9840449801462a1ee0ba41e25d82dfab43c8
SharpLu/Sympathy-for-data-benchmark
/Library/Library/sympathy/data/adaf/node_sort_adafs.py
UTF-8
4,101
2.5625
3
[ "BSD-3-Clause" ]
permissive
# Copyright (c) 2013, System Engineering Software Society # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, thi...
true
802bbd9b1d113f456edcd5068f5915a02a029b88
NegatioN/BulkTorrentDownload
/downloadTorrents.py
UTF-8
3,265
2.859375
3
[]
no_license
__author__ = 'NegatioN' import requests from bs4 import BeautifulSoup import re import os #TODO thread-optimise download of torrents and crawling of pages. class OutColors: DEFAULT = '\033[0m' BW = '\033[1m' LG = '\033[0m\033[32m' LR = '\033[0m\033[31m' #get contents of an url def getContents(url): ...
true
0cad7be245406915ed0d295377f472e3945c2549
give333/UnivLic
/P1/prática.1.py
UTF-8
333
3.609375
4
[]
no_license
def ConvertDollar(): #te = float(td * 0,78801896) td = float(input(' Introduza o valor em Dollars: ')) te = float(td * 0.78801896) print(' O resultado em Euros é: ', te , '€') ConvertDollar() ...
true
0fc62611f7847e088d708d090b22aef0bc51a1f0
vsoch/DisorderBehavior
/brainbehavior/cognitiveatlas.py
UTF-8
1,674
2.84375
3
[]
no_license
#!/usr/bin/env python """ CognitiveAtlas: part of the brainbehavior python package BrainBehavior: This module will work with three databases that combined can make inferences about disorders and behaviors: NeuroVault: functional and structural group analyses Cognitive Atlas: ontology of cognitive concepts, tasks, ...
true
225c6674e0621382786ff17c8a07535545c047de
Jdatechong/WinSwitchCtr
/src/services/win_event_handler.py
UTF-8
4,299
3.171875
3
[ "Unlicense" ]
permissive
""" Script using the Windows API to register for window focus changes and print the titles of newly focused windows. This uses open source code from https://github.com/Danesprite/windows-fun on 3/1/21 """ import ctypes import ctypes.wintypes import threading class ObservableWindowChange(object): def __init__(sel...
true
8aeec5b98f556acd2c2ff5e4f1c0c93ee51db252
gauravb8/Whatsapp-chatbot
/app/db.py
UTF-8
3,492
2.59375
3
[ "MIT" ]
permissive
from flask import current_app as app import pymongo from pymongo.errors import WriteError, PyMongoError from urllib.parse import quote as urlencode from datetime import datetime, timedelta class DataBase(object): CONTEXT_VALIDITY_MINS = 3 def __init__(self, connection_string, username, password): print('Connectin...
true
eceea42f4582a62823b8a78b244cf1f9f4e86e3e
aishwaryaiyer22/Leetcode-Problems
/max_gap.py
UTF-8
886
2.9375
3
[]
no_license
import math num = [20,5,13,9,11,32] if len(num) < 2: print 0 imin = imax = num[0] for i in num: imin = min(imin,i) imax = max(imax,i) gap = int( math.ceil( float(imax - imin)/(len(num)-1) ) ) print gap # actually needed bucket numbers, reduce useless bucket bucketNum = int( math.ceil(float(imax - imin)/gap ) ) buck...
true
4ae23f43459069a36e410a7935f01491763a0b2f
travishathaway/supermarkets
/scripts/calc_distances.py
UTF-8
6,464
2.90625
3
[]
no_license
""" This is a short-n-dirty script that calculates the distances between two points using a local instance the Vahalla routing server There was a nice technique I picked up for splitting a list in batches from SO: - https://stackoverflow.com/questions/1624883/alternative-way-to-split-a-list-into-groups-of-n """ im...
true
df15ca43727b02c142a761fea1f89aede8ed3f86
uwtcat/oswvalidators
/node_connectivity.py
UTF-8
4,958
2.828125
3
[]
no_license
import numpy as np import pandas as pd import json import matplotlib.pylab as plt import networkx as nx import os import ntpath import copy import time import util_defs # EDA Plots def plot_nodes_vs_ways(utild, cf): """ Plot frequency distribution of #Nodes in each way TO DO : CHECK IF NODES SHOULD MEAN A...
true
817cb8f738a6131807844a5e38309440dfd69e97
jeremiedecock/snippets
/python/pyqt/pyqt5/widget_QWebEngineView_with_mathjax_offline.py
UTF-8
5,942
3.0625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # See http://doc.qt.io/qt-5/qwebengineview.html#details # This class replace the deprecated QWebView (based on QtWebKit). # See: # - https://stackoverflow.com/questions/29055475/qwebview-or-qwebengineview # - https://wiki.qt.io/QtWebEngine/Porting_from_QtWebKit HTML = r...
true
b73f5837f7d8e9938f543c13169a8101d79959da
AlessandroFMello/EstruturaDeRepeticao
/Exercício001.py
UTF-8
545
3.5
4
[]
no_license
import msvcrt while True: while True: nota = float( input('Digite uma nota entre 1 e 10:\n').replace(',', '.')) if nota >= 0 and nota <= 10: False print('Nota: %s' % nota) print('Nota Válida\n') break else: ...
true
f902ab7841423d5d806396e809238ae5f0ff69d8
sidpremkumar/PiBox
/PiBox-Client/PiBox-Daemon/PiBoxDaemon/Daemon/queueHandler.py
UTF-8
1,650
3.328125
3
[]
no_license
"""Queue watcher, will pull from the queue and deal with events as they come""" import time from watchdog.events import FileSystemEventHandler, FileDeletedEvent, DirDeletedEvent, FileCreatedEvent, DirCreatedEvent, DirModifiedEvent, FileModifiedEvent, FileMovedEvent, DirMovedEvent from PiBoxDaemon.Daemon.events import...
true
c7abec1942c6c6843534504867ff61c8ce16967c
Bhuvana-hub/Python
/Problem set 2/sum_digits_check.py
UTF-8
692
4.59375
5
[]
no_license
# -*- coding: utf-8 -*- """ Implement a function that meets the specification below. Use a try-except block. def sumDigits(s): Assumes s is a string Returns the sum of the decimal digits in s For example, if s is 'a2b3c' it returns 5 """ import math def sumDigits(num1): sumlist=[] try: for i in n...
true
b2b772ef53966990fbd8c6954020d2ab2f3fab05
sschube6/Simulations
/Auction3pGameTheory.py
UTF-8
1,287
2.8125
3
[]
no_license
import numpy as np N = 200 alpha = np.zeros(N-1) alpha[-1] = 1 alpha[-2] = np.sqrt(3) for k in range(3,N): alpha_km1 = alpha[-(k-1)] alpha_km2 = alpha[-(k-2)] alpha[-k] = np.sqrt(np.power(alpha_km1+alpha_km2,4)/(4*alpha_km2*alpha_km2) - np.sum(alpha*alpha)) # print alpha p = np.zeros(N) p[-1] = 1/(np.sum(alpha)+1...
true
4475fd3ab3573d2bd67fc9c16a941842cf9c4983
lstosik/datasci_course_materials
/assignment3/asymmetric_friendships.py
UTF-8
788
2.734375
3
[]
no_license
import MapReduce import sys """ Inverted Index """ mr = MapReduce.MapReduce() # ============================= # Do not modify above this line def mapper(record): target = record[0] friendof = record[1] mr.emit_intermediate(target, ('incoming', friendof)) mr.emit_intermediate(friendof, ('outgoing', target)) def...
true
9d9eb4f1c0b69db9dca53d8a108f10fd878699a1
ugwls/PRACTICAL_FILE
/15.py
UTF-8
1,350
4.6875
5
[ "MIT" ]
permissive
# Write a program to create a list by entering countries and respective # capital and population. The program should accept the name of a country # as an input and print the corresponding capital name and population as # output. Otherwise, the program should print an appropriate message if # the country is not found in...
true
b3ab44c948018422645e84a18771adf65a667755
brennerswenson/image-classifier
/predict.py
UTF-8
5,032
2.890625
3
[]
no_license
import argparse import json import sys import time import numpy as np import torch from PIL import Image from torch.autograd import Variable from torchvision import models parser = argparse.ArgumentParser(description='PyTorch Image Predicter') parser.add_argument('image', type=str, help='path to i...
true
912932842483d47d64a0fad0d82d9602ba2d7dea
zhilyakov1986/Algorithms
/bisect_Search_bad copy.py
UTF-8
649
2.921875
3
[]
no_license
ef bisect_search2(L,e): ''' O(log n) complexity it is lower because the list is never copied, just re-passed ''' def bisect_search_helper(L,e,low,high): if high==low: return L[low] == e mid = (low+high)//2 if L[mid]==e: return True elif L[mid]...
true
1993ce52d3e89ac233aa3276428e1b6c343ba96f
ruimgf/AIDS
/p1/src/assemblyProb.py
UTF-8
9,804
3.171875
3
[ "MIT" ]
permissive
import itertools from heapq import heappop, heappush,heapify #import pulp ############################################################################### class ourPriorityQueue(): def __init__(self): self.queue = [] # list of entries arranged in a heap def put(self,task, priority=0): 'Add a n...
true
993c89a633bf7f3219eeb55ac0ad81743bc3c00f
festeh/VAE_GAN
/GAN_cond_D_VAE_rec/networks.py
UTF-8
2,171
2.53125
3
[]
no_license
import tensorflow as tf from tensorflow.contrib import layers def generator(inputs, weight_decay=2.5e-5, is_training=True): noise, _ = inputs with tf.contrib.framework.arg_scope( [layers.fully_connected, layers.conv2d_transpose], activation_fn=tf.nn.relu, normalizer_fn=layers.batch_no...
true
c2f73a8d927cc8973cad3d165579288910a6c73c
Hinen/SSU_PythonBasics
/Week11/Week11Main.py
UTF-8
519
3.796875
4
[]
no_license
def print_baggage_items(*items, **item_with_count): print("# 단일 품목") if len(items) == 0: print("존재하지 않습니다.") else: for item in items: print(item) print("\n# 다중 품목") if len(item_with_count) == 0: print("존재하지 않습니다.") else: for key in item_with_count.key...
true
25facd0ad3d433a228a9cee17bd597d66ac098d1
wilsonhsu76/python_study
/ch2/linkedList.py
UTF-8
2,174
3.765625
4
[]
no_license
class Node: __slots__ = 'data', 'next', 'prev' def __init__(self, data = None, next = None, prev = None): self.data = data self.next = next self.prev = prev def __str__(self): return str(self.data) from random import randint class Linked_list: def __init__...
true
88c98a5f209c7af90f5898126c5b9f0892e20cc9
nneesshh/openresty-oss
/openresty-win32-build/thirdparty/x86/pgsql/pgAdmin 4/venv/Lib/site-packages/testtools/assertions.py
UTF-8
819
2.765625
3
[ "MIT", "LicenseRef-scancode-ssleay", "BSD-3-Clause", "LicenseRef-scancode-openssl", "LicenseRef-scancode-ssleay-windows", "LicenseRef-scancode-pcre", "LicenseRef-scancode-public-domain", "Zlib", "BSD-2-Clause" ]
permissive
# Copyright (c) 2008-2017 testtools developers. See LICENSE for details. """Assertion helpers.""" from testtools.matchers import ( Annotate, MismatchError, ) def assert_that(matchee, matcher, message='', verbose=False): """Assert that matchee is matched by matcher. This should only be used when...
true
8e2b59bdae4428335cbbf14c7ff51b60170244e0
anobhama/Intern-Pie-Infocomm-Pvt-Lmt
/Python Basics/q2_addNum.py
UTF-8
200
3.875
4
[]
no_license
# -*- coding: utf-8 -*- """ @author: Anobhama """ #WAP to input two numbers and print the sum. num1=int(input("Enter the 1st number: ")) num2 = int(input("Enter the 2nd number: ")) print(num1+num2)
true
722c93f0a8ee419d28fcb7823228ef295d550791
bernardsabag/RPGDB
/RPG/character/models.py
UTF-8
1,122
2.59375
3
[]
no_license
from django.db import models from django.contrib.auth.models import User # Create your models here. class Character(models.Model): user = models.ForeignKey(User, null=True, on_delete=models.CASCADE) name = models.CharField(max_length=50) race = models.CharField(null=True, max_length=30) def...
true
4b3602dd34a3445da24917bf13ebc43af8cbc034
sharmishah/guvi
/code kata/playposit.py
UTF-8
90
2.75
3
[]
no_license
m=list(map(int,input().split())) n= list(map(int,input().split())) print(n.index(m[1])+1)
true
803054c17bddd0ce58baac88f335e2c5e1ebac43
woolly-of-cv/pytorch-lib
/woollylib/bp/losses/backpropagation.py
UTF-8
2,707
2.75
3
[ "MIT" ]
permissive
import torch from torch import nn import torch.nn.functional as F from torch.optim import SGD import numpy as np from torch.nn.modules.loss import _WeightedLoss torch.manual_seed(1) class LabelSmoothingLoss(nn.Module): def __init__(self, classes=10, smoothing=0.0, dim=-1, weight=None): """if smoothing ==...
true
863c84dc8aeeb8b253ff75859a0caa2f408e9be4
lleonova/jobeasy-algorithms-course
/2 lesson/Multiplication.py
UTF-8
304
4.1875
4
[]
no_license
# Write a Python program to multiply two integers without using the * operator in python def multiplication(number_1, number_2): iterator = 0 result = 0 while iterator < number_1: result += number_2 iterator += 1 return result print(multiplication(6, 6)) print(6 * 6)
true
cf35037619b8c9fb093b985db4a4f90ccee105ee
TTwilight/tornado_study
/demo1/The_Alpha_Munger/main.py
UTF-8
1,605
2.515625
3
[]
no_license
import os import tornado.web import tornado.httpserver import tornado.ioloop import tornado.options import random from tornado.options import options,define define('port',default=8088,type=int,help='input port') class IndexHandler(tornado.web.RequestHandler): def get(self): self.render('index.html') clas...
true
21337ddc70ea271ccb8199dd9c7562e7b7924559
haokr/PythonProgramming_Advanced
/chapter4_class_object/class_method.py
UTF-8
1,376
4.09375
4
[]
no_license
class Date: # 构造函数 def __init__(self, year, month, day): self.year = year self.month = month self.day = day # 实例方法 def tomorrow(self): self.day += 1 # 静态方法,不需要传self参数,调用必须用Date @staticmethod def parse_from_string(date_str): year, month, day = tuple(d...
true
8e09bcb4580ce17bc5c24017d7b20a001d284828
nkukarl/lintcode
/Q110.py
UTF-8
551
3.046875
3
[]
no_license
class Solution: def minPathSum(self, grid): if not grid: return 0 row, col = len(grid), len(grid[0]) dp = [[0] * col for _ in range(row)] dp[0][0] = grid[0][0] for r in range(1, row): dp[r][0] = dp[r - 1][0] + grid[r][0] for c in range(1, col): dp[0][c] = dp[0][c - 1] + grid[0][c] for r in range...
true
97ab49938077a286c5f716590a02d498c6dc3a33
lahmyycfire/2048
/test.py
UTF-8
1,073
3.09375
3
[]
no_license
import random import time import os # 用4个数组来保存数据 list1 = [[0, 0, 0, 0], [0, 0, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0]] # print(list1[2][1]) # 生成2和4, 2的权重70%, 4的权重%30 def random_weights(choice={'4': 30, '2': 70,}): sum_weights = sum(choice.values()) rn = random.uniform(0, sum_weights) # print(sum, rn) res...
true
33d5a8c1298fe2428d7369e71381443e0d726c3b
k-konst/Pill_dispenser
/pilldispenser.py
UTF-8
1,811
3.34375
3
[]
no_license
#using machine and utime Micropython libraries import machine import utime buzzer = machine.Pin(2,machine.Pin.OUT) #The buzzer is attached to pin D4 on the NodeMCU motor = machine.PWM(machine.Pin(14), freq = 50) #The motor driver is attached to pin D5 on the NodeMCU #time parameters defined as empty arrays first_rel...
true
a12f3beb1060daa8c6c27a1b38b409341ad9ac14
scientiacoder/ALG
/ALG/324wiggleSort.py
UTF-8
471
3.15625
3
[]
no_license
# -*- coding:utf-8 -*- # __author__='' class Solution(object): def wiggleSort(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ nums.sort() mid = len(nums[::2]) nums[::2], nums[1::2] = nums[:mid][::-1...
true
581192314a7ed261cfe6b5733028638e0c6371c2
mountain/suan-demo
/src/train_yago.py
UTF-8
3,933
2.578125
3
[ "Unlicense" ]
permissive
from __future__ import print_function import argparse import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from dataset.yago import Yago2Dataset from torch.optim.lr_scheduler import StepLR class Embeding(nn.Module): def __init__(self, node_num, l...
true
73073455bda3e6aff6510179f33aef1e4e22d4f6
raojinlin/leetcode
/test/P1266_MinimumTimeVisitingAllPointsTest.py
UTF-8
345
2.5625
3
[]
no_license
import unittest from lettcode.P1266_MinimumTimeVisitingAllPoints import Solution class P1266MinimumTimeVisitingAllPoints(unittest.TestCase): def test_solution(self): self.assertEqual(7, Solution().minTimeToVisitAllPoints([[1, 1], [3, 4], [-1, 0]])) self.assertEqual(5, Solution().minTimeToVisitAllP...
true
d2ed8918935e0a3cb04f2082e2eab5b71740f8e1
deniseiras/tensorFace
/src/business/TrainConfiguration.py
UTF-8
1,705
2.6875
3
[]
no_license
from sqlalchemy import String, Integer, Float, Column from sqlalchemy_dao import Model class TrainConfiguration(Model): id = Column(Integer, primary_key=True) name = Column(String(100), unique=True) train_steps = Column(Integer()) arch_name = Column(String(100)) input_height = Column(Integer()) ...
true
42177a083045160bae87275f31494dc2c51eb69c
gouarin/GenEO
/GenEO/rhs.py
UTF-8
762
2.625
3
[ "BSD-3-Clause" ]
permissive
# Authors: # Loic Gouarin <loic.gouarin@cmap.polytechnique.fr> # Nicole Spillane <nicole.spillane@cmap.polytechnique.fr> # # License: BSD 3 clause from .utils import buildVecWithFunction from.assembling import buildMassMatrix def buildRHS(da, h, apply_func): """ Construct the right hand side of the ela...
true
4322428b95a164cd806c8b16fe68d02f1e69d0bb
alex-petrenko/seed_rl
/algorithms/utils/multi_agent.py
UTF-8
634
3.078125
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
from gym import Wrapper class MultiAgentWrapper(Wrapper): """ This wrapper allows us to treat a single-agent environment as multi-agent with 1 agent. That is, the data (obs, rewards, etc.) is converted into lists of length 1 """ def __init__(self, env): super().__init__(env) sel...
true
f8c6bd4c8d096365dfacd04ae765233ce5e9a299
roma-kisel/automata-minimize
/mka.py
UTF-8
5,531
3.3125
3
[]
no_license
""" This script was created to minimize and analyze finite automata (FA). The FA provided as input should be a well-specified. Running this sript without parameter will verify correctness of the FA and will output the automata in normalised form. Parameters: --help Outputs the help message. --i...
true
316387599d5bfca42cb81b630c4963e73abec627
frozenbanana/mobilxperten-flask
/assets/image_resizer.py
UTF-8
396
2.78125
3
[]
no_license
import glob from PIL import Image from resizeimage import resizeimage images = glob.glob("deviceImages/*") for img in images: print(img) with open(img, 'r+b') as f: with Image.open(f) as image: imgf = resizeimage.resize_cover(image, [350, 350]) imgf = resizeimage.resize_crop(imgf,[320,320]) output_path...
true
0717414bbe7ab37b7a39f26ffe0ea64820b22747
Manish-rai21bit/training-species-detection
/dataset_tools/image.py
UTF-8
476
3.296875
3
[]
no_license
"""This function reads a raw image, resizes it with aspect ratio preservation and returns the byte string""" from PIL import Image import numpy as np import io def resize_jpeg(image, max_side): """ Take Raw JPEG resize with aspect ratio preservation and return bytes """ img = Image.open(image) ...
true
ef26375035a656e6f2094e74cae3d7d6af8fa328
AydenMartin/p2pProject
/peer.py
UTF-8
5,074
2.578125
3
[]
no_license
import socket from tkinter import * import tkinter as tk import threading class Application(tk.Frame): global frame def __init__(self, master=None): super().__init__(master) self.master = master master.title("Peer to Peer gui") frame = Frame(master, width=500, height=...
true
1771532b79be3c05c122d9c74d05c7922cd4784d
moqi112358/leetcode
/solutions/0994-prison-cells-after-n-days/prison-cells-after-n-days.py
UTF-8
2,460
3.828125
4
[]
no_license
# There are 8 prison cells in a row, and each cell is either occupied or vacant. # # Each day, whether the cell is occupied or vacant changes according to the following rules: # # # If a cell has two adjacent neighbors that are both occupied or both vacant, then the cell becomes occupied. # Otherwise, it becomes v...
true
b00fb91a4cc5d3f0a4d4a9b188e512712d5448ed
Nithinmelala/shot-change-detection
/news.py
UTF-8
2,496
2.65625
3
[]
no_license
import numpy as np import cv2 import os vidcap = cv2.VideoCapture('news.mpg') success,image = vidcap.read() no_frames = int(vidcap.get(cv2.CAP_PROP_FRAME_COUNT)) print('Tottal_no_soccer_frames :',no_frames ) dimns = image.shape print('dimension:',dimns) print("Please wait program is executing") co...
true
4ca7273dee69e696bbcab37eb926152e1324ad5d
Nurzhan097/lern_py
/classes/Parser.py
UTF-8
1,403
3.078125
3
[]
no_license
from bs4 import BeautifulSoup import urllib.request class Parser: raw_html = "" html = "" results = [] def __init__(self, url, file_path): self.url = url self.file_path = file_path def get_html(self): req = urllib.request.urlopen(self.url) self.raw_html = req.rea...
true
88a1dd3602de84f4fc0f50144dc3b996ae8bf7e9
samrithasudhagar/guvi2
/196.py
UTF-8
155
2.8125
3
[]
no_license
a=int(input()) l=list(map(int,input().split())) p=[] for i in l: p.append(l.count(i)) for i in range(len(p)): if p[i]==min(p): print(l[i])
true
cfd936d66ff68b68f6c11b38d3bc4d3bb410538a
diwadd/sport
/at_martial_artist.py
UTF-8
754
3.34375
3
[]
no_license
n = int(input()) graph = [] class Node: def __init__(self, id, t, seq): self.id = id self.t = t self.seq = seq self.visited = False def __str__(self): return f"{self.id} {self.t} {self.visited} {self.seq}" def __repr__(self): return self.__str__() for id ...
true
d5ce19ca230ae55d063d609342f0e4f00c21a185
SotaM2016/Python-Challenges
/DrunkPirate.py
UTF-8
260
4.0625
4
[]
no_license
import turtle from random import randint turns = int(input("Enter the amount of turns the pirate makes: ")) window = turtle.Screen() pirate = turtle.Turtle() while turns > 0: random = randint(0, 360) pirate.right(random) pirate.forward(100) turns -= 1
true
c35428a63bfb23f3634678e6c5cf38cafc611d5c
JosephFasogbon/pythonassignment
/pythonassignemt/rotate2.py
UTF-8
689
3.4375
3
[]
no_license
def print_rotate(word = 'rotate', direction=4): if (direction >= 1) and (direction <= 4): word = word[::-1] centering = 0 if direction % 2 == 0: if direction % 4 == 0: for letter in word: print(' '*len(word) + letter) ...
true
b83dc54e9a9849d4f8e8b95f9f9929b1f2fa5b1c
sherlockliu/Pythonic
/decorator/loop_decorator.py
UTF-8
679
3.65625
4
[ "MIT" ]
permissive
# !/usr/bin/python def p_decorator(func): def func_wrapper(name): return "<p>{0}</p>".format(func(name)) return func_wrapper def strong_decorator(func): def func_wrapper(name): return "<strong>{0}</strong>".format(func(name)) return func_wrapper def div_decorator(func): def f...
true
b800e0255286188f6a0bcfe65b187b0c7ba71b1b
cranelli/aQGC_Signal
/Analysis/test/scripts/Normalize.py
UTF-8
4,077
2.515625
3
[]
no_license
# Functions for Normalization # Python script created by Christopher Anelli, 5/6/2015 # Example Execution # python Normalize.py from ROOT import TH1F from ROOT import TFile import os CHANNELS = ["MuonChannel", "ElectronChannel"] #PHOTON_LOCATIONS=["All", "EBEB", "EBEE", "EEEB", "EBEEandEEEB"] BASE= "/Users/Chris...
true
f847c30920baeee7d1ad81eca273b4d44ccfa696
AUSTlNC/batched-apriori-movie-recommendation
/preprocess.py
UTF-8
1,439
3.21875
3
[]
no_license
import time import pandas as pd def readFile(customer_to_movie, name): file = open(name,'r') movieID = "null" count = 1 for line in file: line = line.rstrip() if ':' in line: movieID = line[:len(line)-1] if int(movieID)%100==0: print(mo...
true
fc1372a54947f3be4b9d42fd032efba9f5b36ff1
CapSOSkw/UI_AUTOMATION_TESTING
/steps/company_steps/user_can_add_a_new_company.py
UTF-8
2,604
2.75
3
[]
no_license
from behave import * from config import Url from pages.login_page import LoginPage import time import config import random, string from pages.dashboard_page import DashboardPage from pages.admin_page import AdminPage from pages.base import Page from pages.inactive_drivers_page import InactiveDriverPage from pages.compa...
true
96ecbd47f862850e95e581242c83b4fe458977ef
jszaltys/BehavioralCloning
/model.py
UTF-8
6,396
2.71875
3
[]
no_license
import csv import cv2 import skimage.transform as sktransform import random import os import shutil import numpy as np from sklearn import model_selection from sklearn.model_selection import train_test_split from keras import optimizers from keras.models import Sequential from keras.layers import Flat...
true
602b4e430826f51085627f8784e2e24264158416
CthulhuDen/SubtitlesRenamer
/SubtitlesRenamer.py
UTF-8
1,928
2.75
3
[]
no_license
#! /usr/bin/env python from os import * import string,re print "Welcome user!\nYou may choose some options below but beware!\nAll changes are irreversible so take care!" def checkOnZero(a,n): if a=='': a=([r'(\d+).(\d+)','.avi','.srt'])[n] return a a=[r"Now enter media file pattern (empty for '(\d+).(\d+)'):...
true
bc7685e7fa67245de86be21228f64418c1319303
liadbiz/ai_books
/machine_learning_algorithms_from_scratch/code/chapter_08/predict.py
UTF-8
383
3.859375
4
[]
no_license
# Example of making a prediction with coefficients # Make a prediction def predict(row, coefficients): yhat = coefficients[0] for i in range(len(row)-1): yhat += coefficients[i + 1] * row[i] return yhat dataset = [[1, 1], [2, 3], [4, 3], [3, 2], [5, 5]] coef = [0.4, 0.8] for row in dataset: yhat = predict(row, ...
true
521bb4c7e1262f80bdce6865ddb45738ba244131
Mahendhiran-K/My
/All string.py
UTF-8
6,834
4.3125
4
[]
no_license
''' #capitalize() Converts the first character to upper case Name = "mahi" a = Name.capitalize() print(a) #casefold() Converts string into lower case a = "MAHi" b = a.casefold() print(b) #center() Returns a centered string a = "Mahi" b = a.center(70) print(b) #count() Returns the number o...
true
991b3f19c5d56c0051fb27f382ef441347190272
hw11/PythonVehicleSimulator
/vehicles/tanker.py
UTF-8
10,192
2.984375
3
[]
no_license
# -*- coding: utf-8 -*- """ tanker.py: Class for a large tanker, length L = 304.8 m and draft T = 18.46 m. The input variable 'depth' can be used to simulate shallow water effects. tanker() Step input, rudder angle tanker('headingAutopilot',psi_d,V_current...
true
0bdd4eb20a375faf1ce5db48049a8359bfacaca2
kazewong/flowMC
/src/flowMC/nfmodel/rqSpline.py
UTF-8
18,406
2.578125
3
[ "LicenseRef-scancode-free-unknown", "MIT" ]
permissive
from typing import Sequence, Tuple import jax import jax.numpy as jnp from jaxtyping import Array import equinox as eqx from flowMC.nfmodel.base import NFModel, Bijection, Distribution from flowMC.nfmodel.common import MaskedCouplingLayer, ScalarAffine, MLP, Gaussian from functools import partial @partial(jax.vmap, ...
true
299ecff95d4aabefe0f09c9d13d8792d8f476249
skysamer/first_python
/코딩예제/list_in.py
UTF-8
83
3.15625
3
[]
no_license
# 리스트를 선언합니다. array=[i*i for i in range(0, 20, 2)] print(array)
true
30894360976be8aeb3034c3c3d81ea988befdbad
ifd3f/trans-data-analysis
/scrape/ballotpedia/candidates_page.py
UTF-8
1,236
2.65625
3
[]
no_license
from pathlib import Path import bs4 def get_candidates(soup: bs4.BeautifulSoup): political_leaders = soup.find(text='Political Leaders:').find_parent('big') tables = political_leaders.find_next_siblings('table') links = [] for table in tables: for a in table.select('td a'): name ...
true
e13a81f36178d4e33e45ba4678456c9451eaac8f
nancymewada/basic-programs-python
/spiral.py
UTF-8
499
2.75
3
[]
no_license
n = 7 range_n = n-1 d = (n*n) + 1 a= [[i for i in range(i,i+n)] for i in range(1,n*n,n)] nd =n c = 0 for i in range(0,(n/2)): for ab in range(i,nd-i): c += 1 if c < d: print a[i][ab] else: break for cd in range(i+1,nd-i): c += 1 if c < d: print a[cd][range_n-i] else: break for ef in range(r...
true
c38570155459d4431d8b5a9d90b0af8791289b65
Vorgh/keno
/keno.py
UTF-8
4,479
2.9375
3
[]
no_license
import csv import os from xsorted import xsorter HEADER_FIELDS = ['numbers', 'frequency'] HEADER = ';'.join(HEADER_FIELDS) DAY_LIMIT = 99999 def process_row(current_row): results = [] for a in range(0, 15): for b in range(a + 1, 16): for c in range(b + 1, 17): for d in ran...
true
8cee31d0e5cb6578811e4f8503c24022999946f7
EOPAtCal/wiki-crawler
/preprocess.py
UTF-8
2,335
2.796875
3
[ "BSD-3-Clause" ]
permissive
from bs4 import BeautifulSoup import re import os import shutil from utils import * source_dir = "files" results_dir = "clean" base_url = "https://ce3-wiki.herokuapp.com/" wiki_url = "http://eop.wikidot.com/" def setup_dir(directory): if not os.path.exists(directory): os.makedirs(directory) else: ...
true
37e9ec0a60b4228b7f3df7927f49d7f0b63aa2c0
sunsided/AIND-Sudoku
/solution.py
UTF-8
11,807
3.046875
3
[]
no_license
from functools import lru_cache as cache from typing import List, Set, Dict, Union Box = str Values = str Unit = List[Box] SudokuDict = Dict[Box, Values] MaybeSolution = Union[SudokuDict, bool] assignments = [] # noinspection SpellCheckingInspection rows = 'ABCDEFGHI' cols = '123456789' digits = '123456789' @cache...
true
f3880f75532d6bf2c9456d9504e8ae78b37f6fc7
kit1980/google-code-jam
/2009/Round 2/C. Stock Charts/preprocess-prolog.py
UTF-8
962
3.109375
3
[]
no_license
# Input preprocessor for Prolog-based solutions. # # Output: # number of test cases. # Then, for each test case: # number of stocks; # number of pairs of conflicting stocks (that can't be on the same chart); # pairs of conflicting stock ids (stock ids are not necessarily correspond to original inputs). def main(): ...
true
23205eea59daad52a29c1cf3ece5fde2b945ba9e
singhst/fyp-honor-project
/3 Fast Localization - LLS Backend RPi/fyp_rpi_server (git)/mymodule/myNCR_v2.py
UTF-8
1,599
3.109375
3
[]
no_license
''' # Modified from: Sham Yik Yee (2018-19): /Sigfox vs LoRa/FYP/myNCR.py LAM KA HO (2017-2018): /Simulation.Mphil/module/NCR.py # Last Modified: 27th Feburary 2020 # Modified by: Sing (2019-2020) # Description: Functions: 1. Find out the combination of the inputs ''' import math import numpy c...
true
20e5783b66589e37485fe6d16a56e0946e36d312
j8lp/Jackson-Lane-W205-Repo
/exercise_2/tweetwordcount/src/bolts/wordcount.py
UTF-8
2,057
2.65625
3
[]
no_license
from __future__ import absolute_import, print_function, unicode_literals from collections import Counter from streamparse.bolt import Bolt import psycopg2 import re class WordCounter(Bolt): def initialize(self, conf, ctx): self.counts = Counter() ##for some reason, Postgres created my database as...
true
9ade2bbdaa8eafd034548410f8d19ddff8888778
BengineerZ/2CW_IDP
/final_comp/V_IDP_sim/controllers/master/utils.py
UTF-8
3,337
3.140625
3
[]
no_license
#!/home/ben/anaconda3/bin/python3.8 import numpy as np import matplotlib.pyplot as plt ### General utility function defs: def bound(coord, a=0, b=79): ''' bounds a value args: numpy array: coord - value to be bounded int/float: a - lower bound int/float: b - upper bound return: int/float: k - bounded value...
true
ebfbea506b8a8a7192b871a8a589b647dbd512a7
MarySerna/holbertonschool-higher_level_programming
/0x0B-python-input_output/9-add_item.py
UTF-8
441
2.75
3
[]
no_license
#!/usr/bin/python3 """Module to add all arguments to a list """ import json from sys import argv save_to_json_file = __import__('7-save_to_json_file').save_to_json_file load_from_json_file = __import__('8-load_from_json_file').load_from_json_file filename = 'add_item.json' try: new_file = load_from_json_file(f...
true
3fcdde04d4bda53799dc6841ac5b5caf5b30fd08
notAlex2/Translation-Team08-IFT6759
/code/GRU_embeddings.py
UTF-8
3,711
2.984375
3
[]
no_license
import argparse import utils_GRU from gensim.models import Word2Vec from gensim.models import FastText # tokenization and punctuation removal # already done with the script provided by the TA for both unaligned corpus # these files are in the data_folder of the GRU_config.json file def list_of_examples(GRU_config, l...
true
28b26822a38fe7adef6224732cb8bca47cd761ab
tertychnyy/dolg
/app/views.py
UTF-8
476
2.84375
3
[]
no_license
from app import app import json @app.route('/') @app.route('/index') def index(): return "Hello, World!" @app.route('/api/events') def api_events(): data = {} event1 = {'name': 'Поездка в Португалию', 'id': 1, 'startdate': '2015-08-04 05:35'} event2 = {'name': 'Может в каль...
true
036d4a7e6514818f8210f5947fcac2fdf2f0640c
dazvid/cryptopals
/1_7.py
UTF-8
1,100
3.578125
4
[]
no_license
#!/usr/bin/python3 """ 1_7.py AES in ECB mode The Base64-encoded content in this file has been encrypted via AES-128 in ECB mode under the key "YELLOW SUBMARINE". (case-sensitive, without the quotes; exactly 16 characters; I like "YELLOW SUBMARINE" because it's exactly 16 bytes long, and now you do too). Decr...
true
7bfdd1b90295258730def3f2bf8d3576cd9770f9
nvk141988/Python-LoginMsg-App
/LoginMsg-App.py
UTF-8
2,278
3.203125
3
[]
no_license
import requests import json from datetime import datetime import PySimpleGUI as ui import isConnected as conn """ Simple welcome application using REST API, Data-time and PySimpleGUI """ def getJoke(): try: url = 'https://v2.jokeapi.dev/joke/Any?blacklistFlags=racist,sexist,explicit' # URL + params e...
true
b84459faa1ce33bbc11ce4777e74fd79e026182c
OnShift/TurboJinja2
/turbojinja/widgets.py
UTF-8
2,113
2.515625
3
[]
no_license
"Template support for jinja2" from __future__ import absolute_import, division, print_function import os import inspect import jinja2 from bazman import templatetags def is_mod_function(mod, func): return inspect.isfunction(func) and inspect.getmodule(func) == mod def list_functions(mod): return [func for ...
true
92d86367c69ac017966289501b40f628891d16f7
williammarino/learn_python
/ex11.py
UTF-8
539
3.296875
3
[]
no_license
#print "How old are you?", #age = raw_input() #print "How tall are you?", #height = raw_input() #print "How much do you weight?", #weight = raw_input() #print "So, your %r old, %r tall and %r heavy." % ( # age, height, weight) print ('-' * 30) print ('Main Menu') print ('-' * 30) print ('1.Backup oracle database') ...
true
58e6374120e20dc030a1c462cd77985edba82c7b
rodrigomanhaes/GetFeed
/getfeed/__init__.py
UTF-8
947
2.8125
3
[]
no_license
import feedparser import pynotify from apscheduler.scheduler import Scheduler class Feed(object): def __init__(self, title): self.title = title self.alert = pynotify.Notification(title) def show(self): self.alert.show() class GetFeed(object): def __init__(self, url): s...
true
6604065187e3487f6a633820ab25e46af6af95fa
daniellibin/USTC-SSE-ML2020
/实验1_贝叶斯分类器的设计及应用实验/Bayes.py
UTF-8
3,081
3.34375
3
[]
no_license
import math import numpy as np import jieba def loadDataSet():#数据格式 postingList=[['my', 'dog', 'has', 'flea', 'problems', 'help', 'please'], ['maybe', 'not', 'take', 'him', 'to', 'dog', 'park', 'stupid'], ['my', 'dalmation', 'is', 'so', 'cute', 'I', 'love', 'him'], ...
true
6ff19173f251080a1a6bd883c3a35919d98de2f0
KSaiPremika/PerkinsonsDiseasePrediction
/Perkinsons.py
UTF-8
1,637
2.953125
3
[]
no_license
import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.preprocessing import MinMaxScaler from sklearn.linear_model import LogisticRegression from sklearn.neighbors import KNeighborsClassifier from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import ...
true
c6fdf32dbb8fd75b9ac68a770a87a4cec4287a5e
JetimLee/DI_Bootcamp
/pythonlearning/week1/lists.py
UTF-8
414
4.21875
4
[]
no_license
li = [1, 2, 3, 4, 5] # basically a JavaScript array # list slicing array = ['hello', 'gavin', 'this', 'is', 'an', 'array'] print(array[5]) # print(array[0:3:]) # to copy a list do this new_array = array[:] # this works because slicing an array and storing it in another variable will create another array in memory #...
true
cd186b8c45b115fbacfc6795a14d2c4924463224
romulopro/thinkInPython
/Cap10/Exercise10-9.py
UTF-8
637
3.28125
3
[]
no_license
''' Created on 17 de mai de 2018 @author: Romulo ''' import time ''' start_time = time.time() main() print("--- %s seconds ---" % (time.time() - start_time))''' if __name__ == '__main__': fin = open("words.txt") listOfWords1 = [] start_time = time.time() for line in fin: listOfWords1 = listOfWo...
true
ef27cb80cc0190ce81c4794810751bbbff7c079e
gh0stxplt/ServiceNow-API-to-CSV
/sn_table_api_call_to_csv.py
UTF-8
2,536
2.875
3
[]
no_license
# Required Packages import json import requests import pandas as pd from flatten_json import flatten # Set the request parameters url = 'https://{servicenow instance url}/api/now/table/incident?sysparm_limit=5' # Eg. User name="admin", Password="admin" for this code sample. user = '' pwd = '' # Set proper headers h...
true
3af0a105d213ca5a7e7349f01fb9094c40429fe3
choijiwoong/-ROKA-torch-tutorial-files
/7. Convolutional Neural Network/7-3)Classification of MNIST data by deep CNN.py
UTF-8
3,248
2.875
3
[ "Unlicense" ]
permissive
import torch import torchvision.datasets as dsets import torchvision.transforms as transforms import torch.nn.init device='cuda' if torch.cuda.is_available() else 'cpu' #Set parameters for training learning_rate=0.01 training_epochs=15 batch_size=100 mnist_train=dsets.MNIST(root='MNIST_data/',#location ...
true
10924e1c9f5d62cc79fa870100ce39f1432768c8
wuxianjun666/MasterProject
/stap3/I3DModelWrapper.py
UTF-8
1,555
2.6875
3
[ "MIT" ]
permissive
import tensorflow as tf import atexit class I3DModel: def __init__(self, frozen_graph_path): self.graph = self.load_graph(frozen_graph_path) gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.75) self.sess = tf.Session(graph=self.graph, config=tf.ConfigProto(gpu_options=gpu_opti...
true
fe6402b2b45fd4e5b3c361112cb9963c934a9602
krismile37/project-bokeh
/data_table.py
UTF-8
501
2.796875
3
[]
no_license
import pandas as pd from bokeh.io import output_file, show from bokeh.models import ColumnDataSource, DataTable, TableColumn output_file("data_table.html") df = pd.read_csv('data-20200422-structure-20190827.csv', encoding="cp1251") source = ColumnDataSource(df) columns = [ TableColumn(field="Subj...
true
705015595b497c25b7743cdfd78b5e3590946e40
dev-parvej/python-learning
/circle.py
UTF-8
244
3.46875
3
[]
no_license
# circle area from math import pi def circle_area(r): if r < 0 : raise ValueError("Number can't be negative") if type(r) not in [int, float]: raise TypeError("Number must be float or integer") return pi * (r ** 2)
true
13d9388269a48aab25b3471a0ba4d453162e7c49
Sablayrolles/debates
/step_1/DATA/scripts/educe/wordreprs/tests.py
UTF-8
970
2.796875
3
[]
no_license
"""Unit tests for basic integration of word representations""" from __future__ import print_function, absolute_import from educe.wordreprs.brown_clusters_acl2010 import fetch_brown_clusters def test_brown_clusters_acl2010(): """Fetch and print Brown clusters for some discourse connectors""" clu...
true
e92d17cf3e4237d3ad747fb63abd8484f733d957
flbdx/AoC_2017
/day_16.py
UTF-8
2,287
3.171875
3
[]
no_license
#!/usr/bin/python3 #encoding: UTF-8 import fileinput import sys if len(sys.argv) == 1: sys.argv += ["input_16"] class Danse(object): def __init__(self, line): self.programs = [chr(ord('a') + c) for c in range(16)] self.instructions = [] for sequence in line.split(","): ...
true
0c09b2cd2e72217cf587af7060e01a915d248d91
ianlaiky/FYPJ-DuplicateCheck
/nltkLan/nltkLanguageModelVer2.py
UTF-8
979
3.375
3
[]
no_license
from nltk.corpus import reuters from collections import Counter counts = Counter(reuters.words()) total_count = len(reuters.words()) # The most common 20 words are ... print(counts.most_common(n=20)) # [(u'.', 94687), (u',', 72360), (u'the', 58251), (u'of', 35979), (u'to', 34035), (u'in', 26478), (u'said', 25224), (u...
true
7d4257d1d0270810281caff09981443090f90cff
YELLOW0804/thinkpython
/11/11-7.py
UTF-8
427
2.84375
3
[]
no_license
def ack(m, n): if m == 0: return n + 1 if n == 0: return ack(m - 1, 1) return ack(m - 1, ack(m, n - 1)) know = {} def ackermann(m, n): if (m, n) in know: return know[m, n] if m == 0: return n + 1 if n == 0: return ackermann(m - 1, 1) know[m, n] = acker...
true
974c9e8e7b1e72c8b1fd1dee4540999b0b14caee
KevinCastroP/AirBnB_clone
/models/base_model.py
UTF-8
1,457
2.9375
3
[]
no_license
#!/user/bin/python3 """ Class Base """ import models import uuid from datetime import datetime class BaseModel: """Base class""" def __init__(self, *args, **kwargs): """Class constructor""" if not kwargs: self.id = str(uuid.uuid4()) self.created_at = datetime.now() ...
true
3828e834f50a1f2725ccd446ba4ee3c8e0335ce8
JensOstertag/CameraBot
/camerabot.py
UTF-8
3,172
2.953125
3
[ "MIT" ]
permissive
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) from picamera import PiCamera from time import sleep from tkinter import * screen_width = 1024 screen_height = 600 # Motor1 for Left/Right Movement motor1_dir = 29 motor1_stp = 31 motor1_ena = 32 GPIO.setup(motor1_dir, GPIO.OUT) GPIO.setup(motor1_stp, GPI...
true
bbfee3f344c911b8f6ffdaa1ca6a2ac7fbf35cee
hongchhe/myhadoop
/spark/scripts/convert_encoding.py
UTF-8
1,466
2.96875
3
[ "Apache-2.0" ]
permissive
# coding: utf-8 def handle_argument(): '''handle the argument. ''' import argparse description = 'This script is used to convert one encoding file to another encoding file.' epilog = """ """ parser = argparse.ArgumentParser(prog="convert_encoding", description=...
true
1c8badd972db759ffac443c3b31b7ad5cb09eaf7
cyrillemidingoyi/RestrictedPython
/tests/transformer/operators/test_logical_operators.py
UTF-8
249
2.75
3
[ "ZPL-2.1" ]
permissive
from tests import e_eval import pytest @pytest.mark.parametrize(*e_eval) def test_In(e_eval): assert e_eval('1 in [1, 2, 3]') is True @pytest.mark.parametrize(*e_eval) def test_NotIn(e_eval): assert e_eval('4 not in [1, 2, 3]') is True
true
f0f20814b16f527cfba2c62345d56abe3a876546
Abhilasha06/News-virality
/NewsScraper.py
UTF-8
1,177
3.1875
3
[]
no_license
import requests from bs4 import BeautifulSoup from newspaper import Article import pandas as pd import numpy as np class ScrapeArticle(): def __init__(self): self.news = [] self.df = [] self.articles = [] def get_news_from_url(self, url): r = requests.get(url) ...
true
92f28b0f488017a3f0423c6a7eb221dfe828d349
rs19hack/EPI
/06/09_Primes.py
UTF-8
3,108
3.578125
4
[]
no_license
__author__ = 'Marie Hoffmann ozymandiaz147@googlemail.com' ''' Return all primes between 2 and n ''' import math import timeit # idea 1: construct set of multiples of [2,n/2] and intersect with [n] # runtime: O(n), space: O(n) def primes(n): m = int(math.ceil(n/2)) S1 = set([l*k for l in list(range(2,m+1...
true
49b2b61550eb0f6c36038e7e8b8200f0a89eb2c1
jared-paul/embera
/embera/preprocess/complete_bipartite_placer.py
UTF-8
20,666
3.1875
3
[ "MIT" ]
permissive
""" Systematic method to find the embedding of a complete biaprtite graph into the Chimera graph representing the D-Wave Ising Sampler. The method here finds an embedding such as in [1]. This method uses a naive window sliding approach to assign fewer unavailable qubits. [1] https://arxiv.org/abs/1510.06356 NOTE: Bec...
true