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
62fef5873656879088b78fad186c4a6d4f0019b1
Python
Slugskickass/Teaching_python
/Introduction/7.) Text.py
UTF-8
148
3.453125
3
[]
no_license
my_input = input("Please give me a name ") print("Hello", my_input, "how are you") sv = len(my_input) - 1 print(my_input[0]) print(my_input[sv])
true
861a956960cf0357a5f0ac3f840b3809ac302578
Python
santokalayil/my_python_programs
/search_with_ext_then_copy_files_to_directory.py
UTF-8
772
3.53125
4
[]
no_license
print("Welcome to Santo's file utility python script".center(150,'*')) print() import glob import shutil import os ext = input('Please provide the file extension to searched and copied:\n') ipynb = glob.glob(f'**\\*.{ext}',recursive=True) for i in ipynb: print(i) destination_folder = input('Input the Destinatio...
true
3a2c1e4a596e2d649805a01836e7c8fbffa3adeb
Python
OwenDostie/adventofcode
/day08.py
UTF-8
829
2.828125
3
[]
no_license
import re import sys f = open('day08.txt').read().rstrip().split('\n') # print(len(f)) # print(f[611]) # sys.exit() cands = set() for l,_ in enumerate(f): if re.search('nop|jmp', _): cands.add(l) for swap in cands: print(swap) effs = set(); acc = 0; line = 0 while True: if line == len...
true
0c1901feb4d044f4c55bf3cd0301207c2602b50e
Python
rvdmtr/python
/Eric_Matthes/chapter_1/8/describe_pet.py
UTF-8
1,168
3.9375
4
[]
no_license
#Использование позиционных аргументов, строгий порядок передачи def describe_pet(animal_type,pet_name): """Выводит информацию о животном""" print('\nI have a ' + animal_type + '.') print('My ' + animal_type + '`s name is ' + pet_name.title() + '.') describe_pet('hamster','harry') describe_pet('dog','willie') pr...
true
78af3a839a7f5d37f42fc6cb19f10590c6103746
Python
Punsach/Coding-Interview-Questions
/CTCI-Chapter1/CTCI-Chapter1-Problem6.py
UTF-8
771
4.28125
4
[]
no_license
#Compress a string by using the frequency of each letter import sys from collections import OrderedDict def compress(someString): #Create a dictionary with each character in the string and its frequency characters = OrderedDict() for c in someString: if(c in characters): characters[c] += 1 else: charac...
true
c14b9932ce09fe5116db4508ec20e267ba8cddce
Python
Tiltmeka/RIP
/lab1/ku.py
UTF-8
1,087
3.25
3
[]
no_license
import sys from cmath import sqrt def vku(a, b, c): if a == 0: t_1 = -c / b x1 = x2 = sqrt(t_1) x3 = x4 = -sqrt(t_1) else: d = (b * b) - (4 * a * c) t1 = (-b + sqrt(d)) / (2 * a) t2 = (-b - sqrt(d)) / (2 * a) x1 = sqrt(t1) x2 = - ...
true
75a1faaf277d7c7ab62d9c8a6dd334da80285950
Python
TheNiska/DigitRecogn
/Digit_Recogn.py
UTF-8
2,964
2.578125
3
[]
no_license
import numpy as np import pandas as pd import math import matplotlib.pyplot as plt import time start = time.time() ALFA_ZERO = 0.009 BETA = 0.70 LAMBD = 0 EPSILON = 0.00000000001 K_ITER = 400 cost_func = [] x_iter = [] data = pd.read_csv('train.csv', delimiter=',') y = data[['label']] y = y.to_numpy() y = y.T ...
true
76f6aba276194d188944c4709d607d5ee1d26a5c
Python
AlyssaYelle/python_practice
/software_design/LinkedLists/TestDenseMatrix.py
UTF-8
1,695
3.765625
4
[]
no_license
class Matrix(object): def __init__(self, row = 0, col = 0): self.row = row self.col = col self.matrix = [] # perform matrix addition def __add__(self, other): if self.row != other.row or self.col != other.col: return None mat = Matrix(self.row, self.col) for i in range (self.row): new_row = [] ...
true
23dde8a3866517f3d8d675b86bd61130ecadf893
Python
mfpankau/python-euler
/projecteuler2.py
UTF-8
194
3.3125
3
[]
no_license
fib = [1, 2] i = 1 while fib[i] + fib[i - 1] < 4000000: fib.append(fib[i] + fib[i - 1]) i = i + 1 total = 0 for val in fib: if val % 2 == 0: total = total + val print(total)
true
3eff5781bf6f5dfd22b3122805f1c6583b29cb87
Python
TaplierShiru/ComputerNetworkUniversityCourse
/1/data.py
UTF-8
2,095
2.75
3
[]
no_license
x = 5 y = 8 z = 3 S = z / 5.0 + 0.5 M = 2 * x + y + z + 15 G = 2 * x + 4 * y - z + 10 print('S = ', S) print('M = ', M) print('Средне значение интенсиввности сообщ: ', G) print('-------------------------------------------------------') print('| ') print('| ...
true
a098f02c32df762a4c90637e6f481964bbd145c7
Python
gemchen/python
/chinese.py
UTF-8
153
2.609375
3
[]
no_license
#!/usr/bin/python2.7 # -*- coding: utf-8 -*- import re s="123中文xxx" print s s1 = unicode(s, "utf-8") m =re.sub(ur"[\u4e00-\u9fa5]",'',s1) print m
true
16b13ca5c9159d56b65373b98e8141551449acf3
Python
chromium/chromium
/tools/site_compare/drivers/win32/keyboard.py
UTF-8
6,910
3.171875
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python # Copyright 2011 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """SiteCompare module for simulating keyboard input. This module contains functions that can be used to simulate a user pressing keys on a keyboard. Support...
true
ea9be5217946f4a024528240b8642695f94f99d8
Python
DavidCarricondo/selenium-NLP
/src/scrapping.py
UTF-8
2,332
2.84375
3
[]
no_license
#SELENIUM TUTORIAL: from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.action_chains import Act...
true
52d56e20d1695c8e963f6353b647411f568d6277
Python
clivejan/python_fundamental
/exercises/ex_8_2_favourite_book.py
UTF-8
108
3.203125
3
[]
no_license
def favourite_book(title): print(f"One of my favourite books is {title}.") favourite_book("Found a Job.")
true
1132fe84fefc8b6ee3b544fe9be02ab6464a274a
Python
heeki/portfolio
/src/scriptlets/scriptlet_dynamodb.py
UTF-8
5,462
2.75
3
[]
no_license
import boto3 import botocore import pprint from boto3.dynamodb.conditions import Key from scriptlets.scriptlet_global import Global pp = pprint.PrettyPrinter(indent=4) class ScriptletDynamoDB: def __init__(self, app_name, profile=""): log_file = "{}.log".format(app_name) log_dir = "/tmp" ...
true
f7a68f07196f52701d5c3aa1e27767bb9ed0c0be
Python
wangyongfei0306/Data-structure-and-algorithm
/table/table2.py
UTF-8
2,802
3.96875
4
[]
no_license
class Node: def __init__(self, data=None): self.data = data self.next = None class MyLinkList: def __init__(self): self.head = Node() self.size = 0 self.rear = 0 """ 尾插法 """ def create(self, A): self.head = Node(-1) self.rear = self.head for i in range(len(A)): self.rear.next = Node(A[i...
true
ead501b60cabb4280cc8056d617c055f68364457
Python
lemon234071/TransformerBaselines
/tasks/catslu/dual.py
UTF-8
1,832
2.703125
3
[ "Apache-2.0" ]
permissive
import os import json import logging import collections logger = logging.getLogger(__file__) def get_datasets(dir_path): datasets = {} for file in os.listdir(dir_path): name = None for x in ["train", "valid", "dev", "test"]: if x in file: name = x if not na...
true
aa72e06607cab1ba131a649cbaa50dac2ac42b61
Python
dnjohnstone/orix
/orix/quaternion/quaternion.py
UTF-8
7,660
3.109375
3
[ "GPL-3.0-only" ]
permissive
# -*- coding: utf-8 -*- # Copyright 2018-2020 the orix developers # # This file is part of orix. # # orix is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) ...
true
0a432eabe6c6970a8338846ce8f1806a35c14bb4
Python
neetikakhurana/Intent-Mining-on-Amazon-Reviews
/product.py
UTF-8
1,908
2.953125
3
[]
no_license
import json import readdata import util product_file = 'meta_Cell_Phones_and_Accessories.json.gz' product_feature_file = 'product_features.txt' # extracts product features such as id, title, url, price and sales rank. def extractProductFeatures(product): # if the JSON data is valid there has to be a prod...
true
c7aca1a9ef9f31c22e1d77addeb50d26dc3d9184
Python
mispower/weather-spider
/tools/db_connector.py
UTF-8
2,246
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- from pymongo import MongoClient, IndexModel, HASHED, ASCENDING, GEOSPHERE from pymongo.database import Database from pymongo.collection import Collection from abc import abstractmethod HISTORY_COLLECTION_NAME = "weather_history" BASIC_COLLECTION_NAME = "weather_basic" class AutoBasicCollectio...
true
34ddb228caa5a77af67b9da50778c573129da3e5
Python
jmmshn/api
/mp_api/client/routes/alloys.py
UTF-8
2,428
2.578125
3
[ "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-hdf5", "BSD-2-Clause" ]
permissive
from typing import List, Optional, Union from collections import defaultdict from mp_api.client.core import BaseRester from mp_api.client.core.utils import validate_ids from emmet.core.alloys import AlloyPairDoc class AlloysRester(BaseRester[AlloyPairDoc]): suffix = "alloys" document_model = AlloyPairDoc #...
true
cff35eac511c23fe31cafdf8d9033cf821368675
Python
GuiRodriguero/pythonFIAP
/1 Semestre/Aula1 - exercicios/exer2.py
UTF-8
261
3.921875
4
[]
no_license
print ("Digite 3 Número e descubra o quadrado da soma deles!") n1 = int(input("Digite o primeiro número: ")) n2 = int(input("Digite o segundo número: ")) n3 = int(input("Digite o terceiro número: ")) res = (n1+n2+n3) * (n1+n2+3) print("Resultado: ", res)
true
a20eeb89c23dcaf2930342a46a04ceeb93107d8b
Python
adamoses/STN
/stn_parser.py
UTF-8
3,455
3.109375
3
[]
no_license
import numpy as np import sys from STN import * from algo import * from STNU import * #################################################################################### # - string_to_stn(input) : # # input - an standardized text input of an STN of the form: # # KIND OF NETWORK # ...
true
788ab75320bbef850c067887f4ebb939f4b9e4b7
Python
osmanemresener/Python-Studies
/If Elif Else/problem1.py
UTF-8
471
3.8125
4
[]
no_license
print(""" **************************************** Boy ve Kilo Endeksi Hesaplama Programı **************************************** """) boy= float(input("Boyunuzu Giriniz(metre):")) kilo= float (input("Kilonuzu giriniz(kg):")) endeks= kilo/(boy*boy) if endeks <= 18.5: print("Zayıf") elif endeks <= 25: ...
true
6b49d8e3a9e85d831e032bfcef909c5bf8e259b4
Python
xinqiaozhang/python-circuit-testability-measures
/src/calculate_observability.py
UTF-8
2,191
2.9375
3
[ "MIT" ]
permissive
def calculateObservability(levels, circuitDescription, testability): for level in reversed(levels): for lineInd in level: lineInfo = level[lineInd] observ = calculateLineObservability(lineInfo, lineInd, circuitDescription, testability) testability[lineInd]["obs"] = observ def calculateLineObservability(lin...
true
a2b76c33ea0b87a66063c6e2b2f8d5bd8f4c6710
Python
DaHuO/Supergraph
/codes/CodeJamCrawler/16_2_1/theed/problem_a.py
UTF-8
1,483
3.484375
3
[]
no_license
import sys from collections import OrderedDict def sheep(number): unique = OrderedDict() unique['Z'] ='0' unique['W'] ='2' unique['G'] ='8' unique['X'] ='6' unique['H'] ='3' unique['U'] ='4' unique['F'] ='5' unique['V'] ='7' unique['O'] ='1' unique['N'] ='9' nums = { ...
true
f8e3358b75b6c28a361adc29118c5914e995a0e3
Python
dnguyen0304/roomlistwatcher
/clare/clare/models/player_record.py
UTF-8
801
3.09375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import re from . import IRecord class PlayerRecord(IRecord): def __init__(self, position, name): self.record_id = 0 self.position = int(position) self.name = name @classmethod def from_message(cls, message): pattern = '\|player\|p(?P<position>\...
true
4d7a404df810008e8a452d875ea956c55fcdbc27
Python
in-tandem/algorithm
/hacker_rank/largest_rectangle.py
UTF-8
1,122
3.484375
3
[]
no_license
##https://www.hackerrank.com/challenges/largest-rectangle/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=stacks-queues&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen import itertools sequence = [1,2,3,4,5] # sequence = list(range(1000)) # def find_area() def produce_...
true
bd96b6108bb76445ceb52d06a26f31f1fe026fed
Python
webclinic017/fa-absa-py3
/Python modules/repair_dma_trades.py
UTF-8
6,352
2.53125
3
[]
no_license
import acm from at_ael_variables import AelVariableHandler ALLOCTEXT = "Allocation Process" class Instr: def __init__(self, name, trade): self.name = name self.trades = [trade] def add_trade(self, trade): self.trades.append(trade) def get_positive_trades(self): ...
true
11dc8e7b1d3a436bdb29b884bacd9409eb8a7aa7
Python
nehagarg/ada_teleoperation
/src/ada_teleoperation/RobotState.py
UTF-8
2,960
2.640625
3
[]
no_license
#RobotState.py #keeps track of the state of the robot import copy import numpy as np import rospy from Utils import * #TODO make this dynamic #NUM_FINGER_DOFS = rospy.get_param('/ada/num_finger_dofs', 2) class RobotState(object): def __init__(self, ee_trans, finger_dofs, mode=0, num_modes=2): self.ee_trans...
true
740536495b3161e41ddb5e8c6fdf0f0bdd99f71a
Python
michaelstrefeler/integer_sequences
/padovan.py
UTF-8
668
3.890625
4
[]
no_license
# a(n) = a(n-2) + a(n-3) with a(0)=1, a(1)=a(2)=0 def padovan(n=5, output=[], number=1): amount = input('Choose a number (at least 5): ') try: amount = int(amount) if amount < 5: n = 5 print('I chose 5 for you because you can\'t follow instructions') else: ...
true
780d56c6cde556e72d91a43c670d88a3822dfcba
Python
jaganswornkar/logical-questions
/practice.py
UTF-8
410
3.28125
3
[]
no_license
def divisorCounter(n): count = 0 for i in range(1,n//2+1): if n%i == 0: count += 1 # print(i) return count # print('count :',divisorCounter(28)) n = 1 tn = 1 while tn > 0: result = divisorCounter(tn) if result > 500: print(result) break else: ...
true
691a3ab67253eac4504bb9d93295c440eef90418
Python
LukasS91/maryTTS-project
/create_boundary_feats.py
UTF-8
187
2.625
3
[]
no_license
with open("dur.feats") as f: with open("bound.feats", "a") as g: for line in f: token = line.split() if token[1] == "_": g.write(line)
true
6462b802793b6b181e61b5d533f125fc582f5b75
Python
Raghu150999/algorithms
/scc/scripts/parse.py
UTF-8
259
2.859375
3
[]
no_license
import sys f = open(sys.argv[1], "r") mp = {} cnt = 0 while True: l = f.readline().split() if not l: break for node in l: if mp.get(node) == None: cnt += 1 mp[node] = cnt val = int(node) print(cnt)
true
204a02ee6c4590b3dfd81497ecc498f5f3604c73
Python
thirtywang/OpenPNM
/OpenPNM/Network/__DelaunayCubic__.py
UTF-8
5,124
3.1875
3
[ "MIT" ]
permissive
""" =============================================================================== DelaunayCubic: Generate semi-random networks based on Delaunay Tessellations and perturbed cubic lattices =============================================================================== """ import OpenPNM import scipy as sp import sys ...
true
bd471310d4803a44a5acbbb449c16f956f33812f
Python
mangalagb/Leetcode
/Medium/CloneGraph.py
UTF-8
1,430
3.953125
4
[]
no_license
# Given a reference of a node in a connected undirected graph. # # Return a deep copy (clone) of the graph. # # Each node in the graph contains a val (int) and a list (List[Node]) of its neighbors. # Definition for a Node. class Node(object): def __init__(self, val = 0, neighbors = None): self.val = val ...
true
d658cf858d0ce8830ba41f9f2ee1e5f57fc46dbe
Python
antodipar/learning-spark
/logistic_regression_a.py
UTF-8
1,142
3.265625
3
[]
no_license
from pyspark.sql import SparkSession from pyspark.ml.classification import LogisticRegression from pyspark.ml.evaluation import BinaryClassificationEvaluator, MulticlassClassificationEvaluator spark = SparkSession.builder.appName('log_regression').getOrCreate() # Load data my_data = spark.read.format('libsvm').load('d...
true
6e6652ffabf33a744c6cb37ce8eff57fd8f12730
Python
killshotrevival/qzzo
/qazzoo/Users/temp.py
UTF-8
1,193
2.65625
3
[]
no_license
from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_OAEP from Crypto import Random def new_keys(key_size): random_generator = Random.new().read key = RSA.generate(key_size, random_generator) private, public = key, key.publickey() return public, private def import_key(externKey): return RS...
true
d995e17aa249938e7f97b0daa7f2bfcaf2b8c9e1
Python
mchoopani/Image-To-Pdf-Telegram-Bot
/bot/views.py
UTF-8
6,105
2.546875
3
[]
no_license
import os from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt from json import loads import requests from urllib.request import urlretrieve as download import img2pdf from bot.ModelClasses import Message # constant string that is used to created urls TELEGRAM_URL = "https://api.t...
true
c0b9c2fbb9f7177502690bf9f6015430529ead1c
Python
webeautiful/ipy
/samples/func_args.py
UTF-8
609
3.5
4
[]
no_license
# -*- coding: utf-8 -*- # 必选参数>默认参数 def power(x, n=2): res =1; while n>0: res = res*x n = n-1 return res # 可变参数 def varargs(age, *args): return args # 关键字参数 def kwargs(age, sex='female', **kw): return kw # 参数组合 def func(required , default='默认', *args, **kw): print '组合参数:require...
true
9a0ec338ddd44b60a49f5196f8d7c42fd7ef609d
Python
kashifmin/foo_bar
/prepare_the_bunnies_escape.py
UTF-8
3,125
3.890625
4
[]
no_license
# Problem: Given a grid, find the shortest path distance from upper left corner to bottom right corner # Spaces with a 1 cannot be passed, spaces with a 0 can # Up to one wall can be removed # Basically uses Dijkstra's method to search for shortest path # Runtime complexity: O(h*w*n), where h is grid height, ...
true
8c57291f6154dbca8989b6c026f5c6bd4ec1fee0
Python
RafalO754/WizualizacjaDanych
/Pusto.py
UTF-8
885
3.703125
4
[]
no_license
class NaZakupy: def __init__(self, nazwaProduktu, ilosc, jednostkaMiary, cenaJed): self.nazwaProduktu = nazwaProduktu self.ilosc = ilosc self.jednostkaMiary = jednostkaMiary self.cenaJed = cenaJed def wyświetlProdukt(self): print('Nazwa produktu : ' + str(self.nazwaProduk...
true
e42174477f26ebda91d53deca61d38f26099afa2
Python
pmg102/pmg102.github.io
/py/loadmap.py
UTF-8
2,006
2.90625
3
[]
no_license
import png import string # Read in a png # Split into cells 8x8 # read 64 px in each cell # Put into a hash table # Report what cells and how many # output cells from hashtable into sprite sbeet # output map as grid of indices into sprite sheet # (2400, 288, <map object at 0x00C37B50>, { # 'gamma': 0.4545...
true
2f36027769efb490a7b5f4272507db0a9d4a4da1
Python
onlined/imdb-importer
/import_tsv.py
UTF-8
3,281
2.84375
3
[ "MIT" ]
permissive
""" Import imdb open .tsv data to PostgreSQL database. Files to import (name.basics.tsv, title.basics.tsv) should be in the same path as import_tsv.py script. """ import psycopg2 import csv import time import io st = time.time() connection = psycopg2.connect( host='', dbname='', port='', user='', ...
true
0b4b3a4e86b62ea0b2e881721f9be6322be8d00c
Python
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4138/codes/1675_1952.py
UTF-8
239
3.046875
3
[]
no_license
x = float(input("insira o salario bruto:")) #Aliquota no salário bruto a = 8/100 b = 9/100 c = 11/100 d = 608.44 #aliquota do imposto de renda a1 = 7,5/100 b1 = 15/100 c1 = 22.5/100 d1 = 27.5/100 A = x * a A1 = x - A print(A) print(A1)
true
b6b94e6b96a48743b2d9dfa8aba1e48c5b715135
Python
Ahuge/distant-vfx
/python/distant_vfx/sequences.py
UTF-8
1,067
3
3
[]
no_license
import os class ImageSequence: def __init__(self, frames, parent_path): self.parent_path = parent_path self.frames = frames self._split = frames[0].split('.') self._sorted = False def __repr__(self): return self.name @property def path(self): return o...
true
daca0c189df2944eafb5870a2db259be13cef6dc
Python
fajardomj/SocialNetworking
/SocialNetworking/NetworkSite/loginhelpers.py
UTF-8
416
2.734375
3
[]
no_license
from django.contrib.auth.models import User #gets the current user that is logged in def get_user_logged_in(request): id = request.session.get('logged_in_user') user ='' if id is not None: user = User.objects.get(pk=id) return user return None #gets the State of a user def getState(u...
true
f9add43db69da393b1199bd58119ab56de9aab4d
Python
DiegoSilvaHoffmann/Curso-de-Python
/Meus_dessafios/Exercicios2021/ex100.py
UTF-8
436
3.875
4
[ "MIT" ]
permissive
from random import randint from time import sleep def sorteio(lista): for cont in range(0, 5): n = randint(1, 22) lista.append(n) print(f'{n}', end=' ', flush=True) sleep(0.4) def somapar(lista): soma = 0 for valor in lista: if valor % 2 == 0: soma += ...
true
083acd4de919d259e1e5e92392bb404e88e49b35
Python
samtae13/pygame
/snake05.py
UTF-8
878
3.328125
3
[]
no_license
import pygame import time WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) SCREEN_WIDTH = 600 SCREEN_HEIGHT = 300 SCREEN_SIZE = (SCREEN_WIDTH, SCREEN_HEIGHT) BLOCK_SIZE = 10 def draw_block(screen, color, position): block_rect = pygame.Rect((position[0] * BLOCK_SIZE, position[1] * ...
true
30cde06e81148bdea7d110febd4926fbca5f94a9
Python
harryvu/pyalgo101
/ds/DoubleLinkedList.py
UTF-8
981
4.125
4
[]
no_license
class Node: """A singly linked list node.""" def __init__(self, data=None): self.data = data self.next = None self.prev = None class DoubleLinkedList: def __init__(self): self.head = Node() self.tail = Node() self.head.next = self.tail self.tail.prev ...
true
48811ab3ba7807a3b0b100d685e391aa53014a3b
Python
jmlb/Udacity-RoboticsND
/RoboND-Perception-Project/Exercises/Exercise-2/sensor_stick/scripts/segmentation.py
UTF-8
7,170
3.09375
3
[]
no_license
#!/usr/bin/env python # Import modules from pcl_helper import * # TODO: Define functions as required # Callback function for your Point Cloud Subscriber def pcl_callback(pcl_msg): # TODO: Convert ROS msg to PCL data cloud = ros_to_pcl(pcl_msg) # TODO: Voxel Grid Downsampling vox = cloud.make_voxel_g...
true
f5f6a6cbe7d481d79008dff4f4bfefdd8cc68f3b
Python
kelsi0/Game
/Game/excess_files/questions.py
UTF-8
9,217
3.484375
3
[]
no_license
from random import randint import random list_of_questions = [ [''' What body parts do northern leopard frogs use to help swallow their prey? A)Feet B)Eyes C)Ears D)Nostrils ''',''' Correct! Northern leopard frogs use their ears to help swallow ...
true
d7a96f80bf8dd833cee55eb7aef012e5a8bbdd21
Python
jamesandjim/wisdom_site
/commTools/toBASE64.py
UTF-8
1,187
3.125
3
[]
no_license
# 将图片用BASE64转换为字符串 # 将图片转化的字符串进行url编码 import base64 import os from urllib import parse BaseDIR = os.path.abspath(os.path.dirname(__file__)) # photofile = os.path.join(BaseDIR, 'photos', '1.jpg') # textfile = os.path.join(BaseDIR, 'outjpg', '1.txt') outjpg = os.path.join(BaseDIR, 'outjpg', 'out.jpg') # 图片转为BASE64码 def ...
true
d5e8011341642992895d9425cfbe329d0f0ac2b7
Python
ciepielajan/WarsztatPythonDataScience
/simple_script.py
UTF-8
126
2.671875
3
[]
no_license
import sys if __name__ == '__main__': rez = {} for x in sys.argv[1:]: rez[x] = rez.get(x,0)+1 print (rez)
true
02e4abf3bacc4b48cfc527a1de0f93e75a14671f
Python
eirikhoe/advent-of-code
/2020/02/sol.py
UTF-8
1,714
3.515625
4
[]
no_license
from pathlib import Path import re data_folder = Path(".").resolve() reg_password = re.compile(r"(\d+)-(\d+) ([a-z]): ([a-z]+)") def get_password_components(password_info): match = reg_password.match(password_info) components = match.groups() int_1 = int(components[0]) int_2 = int(components[1]) ...
true
39b7e652aa254cc91455b1c3ff11dbfcbb582db4
Python
kenny5he/docnet
/Services/BigData/Hadoop/mapreduce/practive/mr_compression/red.py
UTF-8
800
2.78125
3
[]
no_license
#!/usr/bin/python import sys def reduer_func(): current_word = None count_pool = [] sum = 0 for line in sys.stdin: word, val = line.strip().split('\t') if current_word == None: current_word = word if current_word != word: for count in count_pool: ...
true
2121c3f10a1d190335c9ab300b218f9e2ec0bbcf
Python
warrenm1/math4610
/homeworks/Homework3/Norms/frobenius.py
UTF-8
215
3.609375
4
[]
no_license
def frobenius(A): sum = 0 for i in range(len(A)): for j in range(len(A[i])): sum += abs(A[i][j]) return sum**(1/2) A = [[1,2,1,4],[2,4,7,8],[6,3,6,5],[9,8,7,6]] print(frobenius(A))
true
15a23d7762118b5f05d5151bd42e37b1442f2883
Python
mattbellis/matts-work-environment
/PyROOT/playRooKeysPdf_andPSF/trial_rpsf_2D.py
UTF-8
3,664
3.09375
3
[]
no_license
#!/usr/bin/env python from ROOT import * from array import * ############################################################### # RooParametricStepFunction ############################################################### # Here's a fake variable over which the data will be generated # and fit. x = RooRealVar("x","x vari...
true
0333a7a42a4a3664c446f1609e863535b2b47ab5
Python
v1ctorf/dsap
/1_python_primer/01_25_C.py
UTF-8
425
4.59375
5
[]
no_license
print(""" Write a short Python function that takes a string s, representing a sentence, and returns a copy of the string with all punctuation removed. For example, if given the string "Let's try, Mike.", this function would return "Lets try Mike". """) s = input('Type your sentence here: ') clean = ''.join([i for i i...
true
2680ba99824e82087492caaed68ee6cb7c15024a
Python
EmjayAhn/DailyAlgorithm
/01_baekjoon/53_problem_2908.py
UTF-8
230
3.09375
3
[]
no_license
# https://www.acmicpc.net/problem/2908 import sys input_numbers = sys.stdin.readline().rstrip('\n').split() input_number1 = input_numbers[0][::-1] input_number2 = input_numbers[1][::-1] print(max(input_number1, input_number2))
true
387b1519f9ad0bec84a4fec0f592212a62b1ebaf
Python
magnet-cl/py-excel-handler
/excel_handler/handler.py
UTF-8
13,383
2.734375
3
[]
no_license
""" This document defines the excel_handler module """ from __future__ import print_function, absolute_import from builtins import str, object import xlsxwriter import datetime from .fields import Field from collections import namedtuple from future.utils import with_metaclass from openpyxl.utils.datetime import from...
true
3083464d0c4fbfb1893f373077343cc6a40a6f45
Python
jayadams011/data-structures-and-algorithms
/challenges/quicksort/test_quicksort.py
UTF-8
419
2.875
3
[ "MIT" ]
permissive
"""Test and test imports.""" from .quicksort import quicksort import pytest def test_empty_quick_sort(): """Test empty quick sort.""" assert quicksort([]) == ([]) def test_small_quick_sort(): """Test small quick sort.""" assert quicksort([2, 3, 1]) == ([1, 2, 3]) def test_large_quick_sort(): "...
true
407acded353f07acd7904f710e57fe5a89e1737c
Python
legmartini/pythonPOO
/exPOO008.py
UTF-8
2,892
4.09375
4
[]
no_license
from time import sleep class SimOuNao(Exception): def __str__(self): return 'Digite somente "s" para SIM e "n" para NÃO.' class Jogo(object): def __init__(self): self.__cartoes = (''' 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 3...
true
132af53aaea86a2b49f400e328cac9e6d5813785
Python
bimri/programming_python
/chapter_11/textEditorNoConsole.pyw
UTF-8
611
2.765625
3
[ "MIT" ]
permissive
"Windows (and other) launch files" ''' gives the .pyw launching file used to suppress a DOS pop up on Windows when run in some modes (for instance, when double-clicked), but still allow for a console when the .py file is run directly. Clicking this directly is similar to the behavior when PyEdit is run from the PyDem...
true
a7087cb82db43a7aa5d4ae0d250517be862982ec
Python
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/python/meetup/f3aecf0d786e4466840d706004b641eb.py
UTF-8
1,934
3.4375
3
[]
no_license
import datetime from datetime import date from datetime import timedelta import re days = {0:'Monday', 1:'Tuesday', 2:'Wednesday', 3:'Thursday', 4:'Friday', 5:'Saturday', 6:'Sunday'} class MeetupDayException(Exception): pass def checkInputs(year, month, day, position): try: cYear = int(year) cMonth = int(mon...
true
541b49980e6597bf2b13395e529e9c81ad4b8071
Python
Gallop-w/powderbed_detec
/Tools/get_piexl_position.py
UTF-8
793
2.65625
3
[]
no_license
import cv2 # 采样图片 img = cv2.imread("../1_0_persp.jpg") # print img.shape def on_EVENT_LBUTTONDOWN(event, x, y, flags, param): if event == cv2.EVENT_LBUTTONDOWN: xy = "%d,%d" % (x, y) cv2.circle(img, (x, y), 1, (255, 0, 0), thickness=-1) cv2.putText(img, xy, (x, y), cv2.FONT_HERSHEY_PLAIN...
true
7c8ac2b67cd7403dfdf8c6bac6d310f7bc04a47d
Python
JakubSzwajka/geo-data-api
/app/test/test_ip_address_model_delete.py
UTF-8
2,084
2.5625
3
[]
no_license
from app.test.base import BaseTestCase from app.main.utils import get_ip_of_url import json from app.test.utils import * class Ip_address_delete_test_case(BaseTestCase): def test_delete_ip_address_obj(self): tested_with_ip = "123.123.123.113" with self.client: response_add = add_ne...
true
18e3e1f23ca32e7fd3b0ec4082ca1174764f1280
Python
gabriellaec/desoft-analise-exercicios
/backup/user_268/ch36_2020_03_28_15_36_20_562519.py
UTF-8
94
3.109375
3
[]
no_license
def fatorial (n): fat=1 while n>0: fat*=n n-=1 return fat
true
74d1647be22d5d9a53f1463d7845608e95501802
Python
PartIII-Student/GAN_essay_repo
/SALR.py
UTF-8
6,208
2.796875
3
[]
no_license
import tensorflow as tf import numpy as np import pandas as pd import os import seaborn as sns import matplotlib.pyplot as plt import time from tqdm import tqdm os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Structure: in each trial generate parameters, then for number_of_epochs # generate a batch of size 'batch_size' ea...
true
33086031c3fe45cf02d0a8f66b317616b07b3295
Python
aarongerig/python-leap
/leap.py
UTF-8
206
3.625
4
[]
no_license
def leap_year(year: int) -> bool: if not isinstance(year, int): raise Exception(f'The given year "{year}" is not an integer.') return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
true
8c4a9fc9ed2184d709cb7f762bbe3dfd33f02222
Python
Dhinessplayz/Python
/chess/chess_state.py
UTF-8
2,733
3.3125
3
[]
no_license
import chess import sys class ChessState(chess.Board): """ Chessboard subclass implementing the interface needed for minimax """ def __init__(self, evaluate=(lambda _: 0), memoize=False, fen=None): # evaluate is an heuristic function taking a board state # and returning an app...
true
3278fce51fb4233676caea0ea00bb8c435995209
Python
WIPACrepo/iceprod
/resources/call_graph.py
UTF-8
3,706
3.484375
3
[ "MIT" ]
permissive
""" Make a call graph for async functions. Does not catch regular function calls. """ import string from collections import OrderedDict # utils def is_func(line): line = line.strip(string.whitespace) return line.startswith('async def') or line.startswith('def') all_whitespace = lambda line: not line.strip(str...
true
514cf4213360f3644da51a65b96e6f245c08cd91
Python
toggame/Python_learn
/第二章/case_test.py
UTF-8
623
3.78125
4
[]
no_license
a = 'our domain is crazyit.org' # 每个单词的首字母大写 print(a.title()) # 每个字母小写 print(a.lower()) # 每个字母大写 print(a.upper()) s = ' this is a puppy ' # 删除左边的空白 print(s.lstrip()) # 删除右边的空白 print(s.rstrip()) # 删除两边的空白 print(s.strip()) s2 = 'i think it is a scarecrow' # 删除左边的i t o w字符 print(s2.lstrip('itow')) # 输出 think it is a...
true
6405c3378feec05213a913732fa614b2b000c522
Python
VB6Hobbyst7/Contour3D
/dataset/shapes.py
UTF-8
1,022
3.46875
3
[]
no_license
import numpy as np class SphericalCap: def __init__(self, a, x0, y0, r): if a > r: raise ValueError self.a = a self.x0 = x0 self.y0 = y0 self.r = r def __call__(self, x, y): t = self.r ** 2 - (x - self.x0) ** 2 - (y - self.y0) ** 2 t = np.cl...
true
dbb7e09bda996ede7be312e7a9b3fa5c6b0c0af8
Python
LewisT543/Notes
/Learning_Tkinter/6Building-a-GUI-from-scratch.py
UTF-8
2,191
3.875
4
[]
no_license
import tkinter as tk from tkinter import messagebox def Click(): replay = messagebox.askquestion('Quit?', 'Are, you sure?') if replay == 'yes': window.destroy() window = tk.Tk() # Label label = tk.Label(window, text = "Little label:") label.pack() # Frame frame = tk.Frame(window, height=30, width=1...
true
d837ab47eed989ab25af66c550fb3691d4c27972
Python
neer1304/CS-Reference
/Scripting/Python_Scripting/Python_Basics/operators/first.py
UTF-8
183
3.203125
3
[]
no_license
#!usr/bin/python '''A very simple program, showing how short a Python program can be! Authors: Sibu Cyriac ''' print 'Hello world!' #This is a stupid comment after the # mark
true
b59cb3042f801c7841329075e74ca5fcf8efed47
Python
s5suzuki/autd3-paper
/analyze/xy_field.py
UTF-8
4,032
2.546875
3
[ "MIT" ]
permissive
''' File: xy_field.py Project: analyze Created Date: 17/02/2021 Author: Shun Suzuki ----- Last Modified: 24/02/2021 Modified By: Shun Suzuki (suzuki@hapis.k.u-tokyo.ac.jp) ----- Copyright (c) 2021 Hapis Lab. All rights reserved. ''' from shared import setup_pyplot, get_40kHz_amp, print_progress import math import num...
true
1c03cf10099333cc68f8b4c86fe67e166fbe2267
Python
Ninlives/pam-remote-otp
/client/validate.py
UTF-8
964
2.5625
3
[]
no_license
from yubiotp.otp import decode_otp from binascii import unhexlify class Validator: def __init__(self, public_id, private_id, key, session, counter): self.public_id = public_id.encode('utf-8') self.private_id = unhexlify(private_id) self.key = unhexlify(key) self.session = session ...
true
68f508f036741223a5a94e79118b187c98112dac
Python
smanjil/Python-Crypto
/euclid.py
UTF-8
193
3.515625
4
[]
no_license
def numInput(): a , b = input("Enter a : ") , input("Enter b : ") print euclidGCD(a , b) def euclidGCD(a , b): while(b): a , b = b , a % b return a numInput()
true
82922ec053c90db584fe9b57c12146d16d7860a3
Python
Sumanshu-Nankana/DLG
/app.py
UTF-8
744
3.203125
3
[]
no_license
from flask import Flask from flask_restful import Resource, Api app = Flask(__name__) api = Api(app) class SumofNumbers(Resource): def get(self): numbers_to_add = list(range(10000001)) n = len(numbers_to_add) - 1 total = int(n*(n+1)/2) return {"total" : total} class SumofNumbers1...
true
f24f66f9d4511503ff298d9decf3420c5a62f3a7
Python
eisenhart-andrew/Ml-gateway
/src/main.py
UTF-8
573
2.515625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Fri Jul 9 20:21:17 2021 @author: Andrew """ from data_generator import generator_regression from data_loader_sorter import data_loader from data_loader_sorter import remove_missing from trainers import sk_regression_trainer from trainers import sk_classification_trainer genera...
true
6ba184d6f5891da0f0a539115fcdff7172337b79
Python
eter0000/learningnotes
/Leetcode/707_Design Linked List_06170210.py
UTF-8
2,989
3.71875
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: class MyLinkedList: def __init__(self): """ Initialize your data structure here. """ self.val = None self.next = None def get(self, index: int) -> int: """ Get the value of the index-th node in the linked...
true
6b8278db992f15dd635749058cc088761e74e9f9
Python
janiszewskibartlomiej/Python_Code_Me_Gda
/Python - advanced/zajecia14/funk/sorted01.py
UTF-8
398
3.234375
3
[]
no_license
ludzie = ['Jakub Malinowski', 'Jadwiga Brzezińska', 'Roman Sawicki', 'Marcin Szymczak', 'Joanna Baranowska', 'Maciej Szczepański', 'Czesław Wróbel', 'Grażyna Górska', 'Wanda Krawczyk', 'Renata Urbańska'] # sortowanie po nazwisku...
true
687ec7879dce9c8a076052a3d175839fa62a1c18
Python
HPI-MachineIntelligence-MetaLearning/Utilities
/plot_log.py
UTF-8
2,327
2.671875
3
[]
no_license
import json import string from collections import defaultdict import matplotlib.pyplot as plt from os import makedirs from os.path import exists import yaml LABELS = ['siegessaeule', 'fernsehturm', 'funkturm', 'berlinerdom', 'other', 'brandenburgertor', 'reic...
true
ff02953acfbe4201c5ae5c1eeb87369e095e7eb4
Python
gva-jjoyce/gva_data
/gva/flows/operators/split_text_operator.py
UTF-8
460
3.140625
3
[ "Apache-2.0" ]
permissive
""" Split Text Operator Splits a text payload into multiple messages but a given separator. """ from .internals.base_operator import BaseOperator class SplitTextOperator(BaseOperator): def __init__(self, separator='\n'): self.separator = separator super().__init__() def execut...
true
b5dd46829f724a9e0aad9666eb2d6a3e7b4b2e84
Python
sehrbaz/MITx6.00
/pset01/problem1.py
UTF-8
160
3.71875
4
[ "MIT" ]
permissive
# Paste your code into this box vowels = 0 for i in s: if i in ['a', 'e', 'i', 'o', 'u']: vowels +=1 print("Number of vowels:", vowels)
true
54de1b031d711236f3dc8ff9e31ee0daecf3e3f7
Python
defland/looncode
/serve/application/dev_tools.py
UTF-8
1,482
2.53125
3
[]
no_license
# coding:utf-8 from config.config import * import commands,re # 测试用的功能 # 开发环境下显示git版本号 def show_git_data(flag=config["default"].GIT_VERSION_DISPLAY): # git log --pretty=oneline -1 # return 451ecd160187ab7ea0c8bcef85a906967dd95d6a added: model add colmmn structure if flag == True: # 获取最新的版本、日...
true
63c2681558af280dd399bc1d73df21606aed5a55
Python
slowlightx/ad-peps
/adpeps/ipeps/ctm.py
UTF-8
18,319
2.8125
3
[ "MIT" ]
permissive
""" Main CTM code The individual site and boundary tensors come in a special list-type object (TList), which has extra indexing features, such as periodic boundary conditions and shift contexts All ncon contractions are defined in contractions.yaml """ import time from typing import Tuple ...
true
ab5e00fc194e29ac88ef3c29a258e5d877868e5d
Python
IspML/Euclidean-tsp-playground
/box.py
UTF-8
478
3.28125
3
[]
no_license
#!/usr/bin/env python3 import random class Box: def __init__(self, xy): x = [c[0] for c in xy] y = [c[1] for c in xy] self.xmin = min(x) self.xmax = max(x) self.ymin = min(y) self.ymax = max(y) self.dx = self.xmax - self.xmin self.dy = self.ymax - se...
true
f504e29c79ee47a02802c9b197722369afa27c07
Python
Hopw06/Python
/Python_Deep_Dive/Part 1/8.TuplesAsDataRecords/5.NamedTuples-Application_AlternativeToDictionaries.py
UTF-8
1,486
3.515625
4
[]
no_license
from collections import namedtuple data_dict = dict(key1=100, key2=200, key3=300) Data = namedtuple('Data', data_dict.keys()) print(Data._fields) # We could try the following (bad idea): d1 = Data(*data_dict.values()) print(d1) # it work, but try: data_dict_2 = dict(key1=100, key3=300, key2=200)...
true
0ef4edf6c3d1d0a00cd6945abcf9a724f04e7a54
Python
yushu-liu/GerogiaTech
/CS4803-MLT/assess_learners/DTLearner.py
UTF-8
1,963
2.953125
3
[]
no_license
import numpy as np import scipy.stats as stats class DTLearner(object): def __init__(self,leaf_size = 1, verbose = False): self.verbose = verbose self.leaf_size = leaf_size self.tree = {} def author(self): return 'nlerner3' def addEvidence(self, dataX, dataY): self...
true
dd3db1f0233dfd8ab84b527f5bcfffa90d543ab4
Python
niharika210400/practice.python
/Zero-sum-triplet.py
UTF-8
2,066
3.40625
3
[]
no_license
# Ques: https://practice.geeksforgeeks.org/problems/find-triplets-with-zero-sum/1 # Soln: ''' Your task is to returns 1 if there is triplet with sum equal to 0 present in arr[], else return 0''' def findTriplets(arr, n): sum = 0 for i in range(0, n-1): # Find pair in subarray A[i + 1..n-1] ...
true
b9664793447af2c55bd4353a37dbcd77664f244f
Python
axie66/QuantumCrypto
/quantum_protocols.py
UTF-8
6,755
3.40625
3
[]
no_license
######################################################################### # quantum_protocols.py # # 15-251 Project # Quantum Cryptography Protocols in IBM Qiskit # # Written by Alex Xie (alexx) ######################################################################### from qiskit import QuantumCircuit, execute, Aer im...
true
89014bb267cef9ca56b2280fb5560c2e0f01723d
Python
goldcerebrum/Getting_Started_with_Python
/ass3_1.py
UTF-8
191
3.15625
3
[]
no_license
hrs = input("Enter Hours:") h = float(hrs) rate = input("Enter Rate:") r = float(rate) if h > 40 : th = h-40 rh = 40 rr = r*1.5 print (rh*r+th*rr) else : print (h*r)
true
acfe7ed06c0d089c5445d8430e00d9e655e0f8cc
Python
GBoshnakov/SoftUni-Fund
/RegEx/Extract the Links.py
UTF-8
228
3.09375
3
[]
no_license
import re text = input() links = [] regex = r"www.[a-zA-Z0-9\-]+(\.[a-zA-Z]+)+" while text: result = [el.group() for el in re.finditer(regex, text)] links.extend(result) text = input() print(*links, sep="\n")
true
d9abfb7c8449fd650b3caa28f0d8a209ba8b0a4a
Python
Gaurav14cs17/Tracker
/people counting using sort/Direction.py
UTF-8
787
2.90625
3
[ "MIT" ]
permissive
def compute_drone_action((x1,y1), (x2,y2)): #define the possible turning and moving action as strings turning = "" moving = "" raise = "" area, center = compute_area_and_center((x1,y1), (x2, y2)) #obtain a x center between 0.0 and 1.0 normalized_center[x] = center[x] / image.width #obtain a y center bet...
true
8f2ab7a791743907315de597518af9062836bc29
Python
rajkiran485/machine-learning
/word2vec/utils.py
UTF-8
1,069
3.390625
3
[]
no_license
from bs4 import BeautifulSoup import re from nltk.corpus import stopwords def review_to_words(review): review_text = BeautifulSoup(review).get_text() letters_only = re.sub("[^a-zA-Z]"," ", review_text) words = letters_only.lower().split() stops = set(stopwords.words("english")) meaningful_words =...
true
8f4159927a99fd6b9afeef568547c6d3abc44b91
Python
Lyasinkovska/BeetRootPython
/lesson_34/task_2.py
UTF-8
1,540
3.40625
3
[]
no_license
""" Requests using concurrent and multiprocessing libraries Download all comments from a subreddit of your choice using URL: https://api.pushshift.io/reddit/comment/search/ . As a result, store all comments in chronological order in JSON and dump it to a file. For this task use concurrent and multiprocessing librarie...
true
63c1c44c0957a99adcc941fdb5b6ceed487b378d
Python
DemondLove/Python-Programming
/CodeFights/12. Sort by Height.py
UTF-8
1,146
4.0625
4
[]
no_license
''' Some people are standing in a row in a park. There are trees between them which cannot be moved. Your task is to rearrange the people by their heights in a non-descending order without moving the trees. People can be very tall! Example For a = [-1, 150, 190, 170, -1, -1, 160, 180], the output should be sortByHeig...
true
d1c62c198af8a985ffda96be2c783d7f1b4caef9
Python
peterheim1/robbie_ros
/robbie_test/nodes/patrol_smach.py
UTF-8
4,628
2.578125
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python """ patrol_smach.py - Version 1.0 2013-04-12 Control a robot to patrol a square area using SMACH Created for the Pi Robot Project: http://www.pirobot.org Copyright (c) 2013 Patrick Goebel. All rights reserved. This program is free software; you can redistribute it and/or modif...
true