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
e167968c2eb36290e5d3ea1e6a563291b67d5584
prasanthduvvur/hw9
/app.py
UTF-8
4,512
2.78125
3
[]
no_license
import datetime as dt import numpy as np import pandas as pd import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from sqlalchemy.ext.serializer import loads, dumps from flask import Flask, jsonify ##########################...
true
649a1090b991896e5ebf8bc01921c4e93dd52033
jojo0086/TIPE
/Documents/Cours/TIPE/Simulations/code/tests_natural_selection.py
UTF-8
3,261
3.703125
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Improved speed implementation of natural selection module. @author: Tregoat Johanne """ import numpy as np def cost(choices_1, choices_2, costs=[1, 20, 10]): """ Calculates the overall time spent in prison over a set of simulations. Choices is a vector of boolea...
true
2ad2e886a1c5d8345b5177bcb1268d5b9c325c88
deboj/war-card-game
/card.py
UTF-8
665
3.28125
3
[]
no_license
class card : def __init__(self, rank, suit): self.rank = rank self.suit = suit def __str__ (self) : result = "" if (self.rank < 11) : result += str(self.rank) else : face_cards = ['J', 'Q', 'K', 'A'] result += face_cards[self.rank - 11...
true
0d4b1b462ba91eb602a87b8fe37f567ce78bab64
kevinms/latchstudios
/missile.py
UTF-8
825
2.875
3
[]
no_license
import pygame import unit import math import weakref class Missile(unit.Unit): def __init__(self, positionX, positionY, colorVal): unit.Unit.__init__(self, positionX, positionY) self.normalSprite = pygame.image.load("images/missile.png").convert() self.selectedSprite = pygame.image.load("images/missile.png")...
true
b3a3154ce10c3e52120ca67294c8bdbcba0d0a6f
jodyanna/mal_scraper
/scrape.py
UTF-8
2,845
3.109375
3
[]
no_license
"""This module scrapes the top 200 ranked entries from MyAnimeList.net's 'Top Anime' pages.""" import os import requests import csv import time from bs4 import BeautifulSoup from datetime import datetime from random import shuffle # Global Constants NUM_TITLES_PER_PAGE = 50 LINK_0_50 = "https://myanimelist.net/topani...
true
df63b6d116c4318bf3a0dcc1f11eedb3429800f7
jdelong248/Starter
/Time_Of_Day.py
UTF-8
527
3.921875
4
[]
no_license
#This is my First code on my own. I figured I would start out with something simple. time=input("What time of day is it? ") if len(time)==4: if int(time[0:2])>12: print("Good Afternoon") else: print("Good Morning") elif len(time)<=5: morn_after=input("Is this in the am or pm? "...
true
76a57a216365f774a9bcfe3bc6c07fae33a70b48
Joyer0099/Leetcode
/Medium/Python/DynamicProgramming/JumpGame.py
UTF-8
407
2.765625
3
[]
no_license
class Solution(object): def canJump(self, nums): """ :type nums: List[int] :rtype: bool """ stepLeft = nums[0] if stepLeft == 0 and len(nums) > 1: return False for num in nums[1: -1]: stepLeft = max(stepLeft - 1, nu...
true
757d0ebea6330a25a04ccefaa07a1d08ee771706
lancerdancer/leetcode_practice
/code/stack/84_largest_rectangle_in_histogram.py
UTF-8
980
3.84375
4
[ "MIT" ]
permissive
""" https://leetcode.com/problems/largest-rectangle-in-histogram/ Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram. Above is a histogram where width of each bar is 1, given height = [2,1,5,6,2,3]. The largest re...
true
5121c2d9adafcd31c044a8f99f42070f8b3de3d9
Freedom-Chen/chen-project
/demo0/web_spider/07(post_payload)/tesseracttest_02_识别有背景图片的文本.py
UTF-8
681
3.203125
3
[]
no_license
import pytesseract from PIL import Image # img =Image.open('./images/recaptcha.png') # img.show() # print(pytesseract.image_to_string(img)) img =Image.open('./images/recaptcha.png') img.show() #可以看出,验证码文本一般都是黑色的,背景则会更加明亮,所以我们可以通过检查像素是否为黑色将文本分离出来,该处理过程又被称为阈值化。通过 Pillow 可以很容易地实现该处理过程。 gray = img.convert('L') #灰度化,图片转...
true
d018837328a063db3388a4fa4875ed806a621540
roiei/algo
/data_structure/bst.py
UTF-8
6,534
3.453125
3
[]
no_license
import queue import collections class Node: def __init__(self, value): self.root = None self.value = value pass class Tree: def __init__(self): self.root = None self.num = 0 def __deinit__(self): pass def find(self, key): ...
true
4eab2acd99f78afe88af470344bb30b9ff6615b8
zhouweixin/text-process
/utils.py
UTF-8
24,760
2.765625
3
[]
no_license
import os import re import pandas as pd import shutil import sys import mysql.connector as mysql def extract_info_by_filename(in_path='txt', out_path='target_txt', out_file='fileinfo.xlsx', fun=1): """ 根据文件名提取信息(编号):【序号】,【证...
true
b4215ae3146baceacfe0b56956935ab7ba1b14d8
taehyungz/Algorithm
/acmicpc.net/02908.py
UTF-8
86
3.0625
3
[]
no_license
a, b = input().split() a = int(a[2]+a[1]+a[0]) b = int(b[2]+b[1]+b[0]) print(max(a,b))
true
c85f65bbe37259a1b4fb6d1296ea8f24857c4035
Aliraza3997/fb_sleep_patterns
/util/saver/active_buddies_saver.py
UTF-8
2,211
3.296875
3
[]
no_license
import os import glob import pendulum import json class ActiveBuddiesSaver: """Dumps active buddies information to JSON in disk. """ def __init__(self, output_dir): """ Parameters ---------- output_dir : str Path to output directory for dumping the crawled d...
true
d82628a399d41fdd146949d19dfa3a01a4e7702b
jtlai0921/AEL019100
/AEL019100_samples/AEL0191-範例檔/31-3/main02.py
UTF-8
693
2.90625
3
[]
no_license
import tkinter as tk tk_win = tk.Tk() tk_win.title('Grid排列方式') # 建立GUI物件1 text1 = tk.StringVar(value='GUI物件1') ent1 = tk.Entry(tk_win, textvariable=text1, justify=tk.CENTER) ent1.grid(row=0, column=0, padx=5, pady=5, ipady=10) # 建立GUI物件2 text2 = tk.StringVar(value='GUI物件2') ent2 = tk.Entry(...
true
6ae5f0e3d6da06d8d79e8cfedb1e9bfcbb8825ab
jinniahn/book_python_example
/ch10/13_getsize.py
UTF-8
550
3.515625
4
[]
no_license
import os import os.path def get_all_files(target_dir): '주어진 디렉토리의 모든 파일 목록과 파일 사이즈를 반환한다.' ret = [] for root, dirs, files in os.walk(target_dir): for f in files: # 파일명 cur_file = os.path.join(root, f) # 파일 사이즈 file_size = os.path.getsize(cur_file) ...
true
a2a11e44308445613fde9d5cac08e11a652f498d
cualquiercosa327/Atari-2600-Deep-Learning-Agent
/UnitTests.py
UTF-8
9,943
2.8125
3
[ "MIT" ]
permissive
import unittest import tensorflow as tf import numpy as np from DeepQNetwork import DeepQnetwork from ExperienceReplay import ExperienceReplay from PreProcessor import PreProcessor from ResultsRecorder import ResultsRecorder # Test the functionality of the Deep Q Network class TestDQN(unittest.TestCase): # Ensur...
true
1ed354887bca2f98332f65361b4bdb1f24bb44cb
OlgaPaw/python_design_patterns
/python_design_patterns/singleton/settings.py
UTF-8
478
3.515625
4
[]
no_license
from python_design_patterns.singleton.singleton import SingletonMeta class Font(metaclass=SingletonMeta): def __init__(self) -> None: self._color = 'black' self._size = 12 @property def size(self) -> int: return self._size @property def color(self) -> str: return ...
true
4b611c5df16726fc9288df56f38ef74877ab61d6
zkbt/mosasaurus
/temp.py
UTF-8
11,903
2.59375
3
[ "MIT" ]
permissive
def interpolate(self, remake=False, shift=False): '''Interpolate the spectra onto a common (uniform) wavelength scale.''' # these are things where we care about the sum matching extracted to supersampled self.additivekeys = ['raw_counts', 'sky'] # these are things where we want the i...
true
b41f36074a2d9cd54a8171821e62d1fecb82ba5c
avivaisman/AoC
/AoC5.py
UTF-8
808
3
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[79]: import pandas as pd # In[80]: df=pd.read_csv("C:/Users/user/Desktop/matlab_work/advent of code/aoc5.txt", delimiter='\n',names=['Seats']) df.head() # In[86]: SeatID=[] for ticket in range(len(df)): TotSeats=128 seat_0=1 seat_f=TotSeats TotCol=8...
true
a0ea65d2b71ca35e2ec3a96e9ba3455c49a4b7a9
lhannest/neuralnetwork
/experiments/vanishinggradient.py
UTF-8
1,782
2.859375
3
[]
no_license
from src import neuralnetwork from src import printer from data import mnist import numpy as np import pudb path = '/home/lance/git/neuralnetwork/data' def mux(number): result = np.zeros(10) result[number] = 1 return result def demux(numbers): highest_index = 0 for i, number in enumerate(numbers): if number ...
true
c13cb2f32ed7892aaa61513c2e90c52136a969bd
summelon/DLP_Lab
/lab2/train.py
UTF-8
4,659
2.6875
3
[]
no_license
import sys import torch import dataloader import EEGNet import DeepConvNet import numpy as np import matplotlib.pyplot as plt from argparse import ArgumentParser def inference(m, inps, lbls): otpts = m(inps) preds = torch.argmax(otpts, dim=1) acc = torch.sum(preds == lbls).item() / len(inps) return o...
true
4b6c555dd53de80392267edb4c4c298ff40f4c59
pitybea/AlphaEggZero
/game_node.py
UTF-8
2,877
2.53125
3
[]
no_license
#CopyRight no@none.not import numpy as np def format_dict(d): return '{' + ', '.join('%d: %f' % (a, d[a]) for a in d) + '}' class AlphaEggGameNode(): def __init__(self, egg_leftover, player_label, parent = None): self.parent = parent self.player_label = player_label self.avg_gain ...
true
31e4ee76c1aafcb6411b4b8354525838e0be5610
adrbed/python_poczatek
/mod_2/lesson_4/ex_2/main.py
UTF-8
200
2.5625
3
[]
no_license
from estudent.school import create_school_with_students def run_example(): school = create_school_with_students("Hogwart") school.print_self() if __name__ == '__main__': run_example()
true
604b3221f7bfd66e754afac62be3b534585741e0
NathanBuul/CSE
/Inheritance.py
UTF-8
704
3.59375
4
[]
no_license
class Vehicle(object): def ___init__(self, name): self.name = name class Car(Vehicle): def __init__(self, name): super(Car, self).__init__(name) self.engine_status = False self.fuel = 100 def start_engine(self): self.engine_status = True print("You turn th...
true
8ea465d0e7b6241f993099def580a8adc8722ca2
rubiyadav18/list_questions
/pal_.py
UTF-8
393
3.78125
4
[]
no_license
name=input("enter a name") rev=len(name)-1 index=[ ] while rev>=0: name=append(name) print(name[rev]) rev=rev-1 if index==rev: print("it is not") else: print("it is not") name=["n", "i", "t", "i", "n",] i=len(name)-1 list=[] while i<len(name): list.append(name) i=i-1 print[list] if n...
true
4209a702814268191239890e38ab071a33ef000a
hardenmvp13/Python_code
/笔记/pandas/pandas 基本语法.py
UTF-8
1,391
4.03125
4
[]
no_license
''' 1,Series ''' import numpy as np import pandas as pd #下面是创建Series的三种方法 #方法1: s1 = pd.Series([1,2,3,4]) #方法2: s2 = pd.Series(np.arange(10)) # 通过numpy.arange创建 #方法3: s3 = pd.Series({'1':1,'2':2,'3':3}) # 通过字典创建 s1.values # 查看值 s1.index # 查看索引 s4 = pd.Series([1,2,3,4],index=['A','B','C','D']) # 设置索引 s4.to_dict() # 转化成字...
true
74ed493085fa8f510d573a9a17ea5f1f7fcda7cb
padejski/serbian_contracts_-_clean_version_1
/scraper.py
UTF-8
11,199
2.71875
3
[]
no_license
#!/usr/bin/env python import scraperwiki import lxml.html import requests def get_number_of_pages(starturl): """For a given starturl, get the number of pages that is possible to scrape""" s = requests.session() r1 = s.get(starturl) html = r1.text #process page one root = lxml.html.fromstrin...
true
30e7236f5fb1d89e0b3884ccc415303661cfb055
mohammadfaidi/Sockets_python
/client.py
UTF-8
359
2.9375
3
[]
no_license
#!/usr/bin/python import socket sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) sock.connect(("127.0.0.1",54321)) print("connection Establishd to server") while True: message = sock.recv(1024) print(message) if message == "q": break else: message_back = raw_input("type Message To send To Server: ") ...
true
7c7ed60efde0803f68506f76a791123d46f82f94
argriffing/xgcode
/test.py
UTF-8
3,859
3.328125
3
[]
no_license
""" Test all of the python library files. Nose will not work directly, because it requires modules with tests to be named appropriately, for example by having 'test' in their name or by being in a directory called 'test'. """ import unittest import os import Progress def get_module_names(): """ Yield names ...
true
75b122b96a95ca269143cc82c99e8ee4f5684986
eduardolimabra/Computer-Vision---Object-Detection-with-OpenCV-and-Python
/02_eyes_detection.py
UTF-8
787
3.25
3
[]
no_license
#Import Libraries import cv2 import numpy as np import matplotlib.pyplot as plt %matplotlib inline #Open Image img = cv2.imread('Images/eye_face.jpg') #Show Image plt.imshow(img) #Fix Image fix_img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) #Show Image plt.imshow(fix_img) #Create Classifier eye_cl...
true
94da07b83e62311ec42db23aac6f2b50f3fd4549
nreavell/Pracs
/PRAC_02/random_examples.py
UTF-8
138
3.28125
3
[]
no_license
import random print(random.randint(5, 20)) # line 1 print(random.randrange(3, 10, 2)) # line 2 print(random.uniform(2.5, 5.5)) # line 3
true
d799ac76d332d5aecedea2802c4dece8d7dd12e1
Saida-Song/3522_A01088305
/Assignments/Assignment2/enums/colour.py
UTF-8
358
3.375
3
[]
no_license
from enum import Enum class Colour(Enum): """ All the available colors. """ ORANGE = "Orange" BLUE = "Blue" PINK = "Pink" WHITE = "White" GREY = "Grey" RED = "Red" GREEN = "Green" def __str__(self): """ String method of the class. :return: str ...
true
3765227c87a34fbd6cde11b49ab1eefe22b260a7
nz0001na/handson-ml
/Neural_network/d_softmax.py
UTF-8
2,948
3.640625
4
[]
no_license
''' Softmax Regression and in Neural Networks when solving Multiclass Classification problems. Notes: SparseCategorialCrossentropy or CategoricalCrossEntropy Tensorflow has two potential formats for target values and the selection of the loss defines which is expected. (1) SparseCategorialCrossentropy: ...
true
f6282a1588011fbece821ab1fba64e3f8a5c9845
kings1990/PlaneWar
/bullet_supply.py
UTF-8
1,236
3.453125
3
[]
no_license
"""子弹补给""" import pygame import random from pygame.sprite import Sprite import constants as consts class BulletSupply(Sprite): # 子弹补给每次移动时的偏移量 offset = 5 def __init__(self, window): """初始化我方子弹补给""" # 调用父类的特殊方法init super().__init__() # 加载子弹补给图片 self.image = pygame....
true
25c4f242815efad5535785a41b4ad74733eb05c9
stuartroland/MicroTune
/Collections/Collection.py
UTF-8
8,005
3.359375
3
[]
no_license
# -*- coding: utf-8 -*- """ Interval Collection @author: Stuart Roland Base class for a collection of musical intervals, stored as Ratios, Scalars, or Cents objects. """ import Intervals.Interval as Interval import Intervals.Ratio as Ratio import Intervals.Cents as Cents import Intervals.Scalar as Scalar from math im...
true
36e04e25eb0b16da94e77c767a555416d8a68283
thevasudevgupta/attention-nmts
/callbacks.py
UTF-8
1,517
2.6875
3
[]
no_license
"""Callbacks for model @author: vasudevgupta """ import numpy as np import tensorflow as tf import time import wandb import logging logger= logging.getLogger(__name__) class CustomCallback(object): def __init__(self): self.step = 0 def on_epoch_begin(self, epoch): ...
true
0cd328320a820cfe0d73e9dad04e2a3a41f82a01
qmnguyenw/python_py4e
/geeksforgeeks/python/python_all/153_11.py
UTF-8
741
4.28125
4
[]
no_license
Python | Numpy ndarray.T With the help of **Numpy ndarray.T** object, we can make a **Transpose** of an array having dimension greater than or equal to 2. > Syntax : **ndarray.T** > > Return : Transpose of an array **Example #1 :** In this example we can see that with the help of ndarray.T object, w...
true
0afd7c45568bebb38299554245453ff50f09ea5c
Aasthaengg/IBMdataset
/Python_codes/p03029/s909309259.py
UTF-8
126
2.796875
3
[]
no_license
a,p = map(int,input().split()) if 3*a+p < 2: print(0) elif (3*a+p) % 2 == 0: print((3*a+p)//2) else: print((3*a+p-1)//2)
true
66357147265e3c9b5f224037aae53ffba6c6abf6
YoungGaLee/2020_Python_coding-study
/오후반/Basic-Data-Types/5_Lists/5_KJH.py
UTF-8
594
3.28125
3
[]
no_license
if __name__ == '__main__': N = int(input()) blank=[] for _ in range(N): x = input().split(" ") cmd = x[0] if cmd == 'insert': blank.insert(int(x[1]), int(x[2])) elif cmd == 'print': print(blank) elif cmd == 'remove': blank....
true
686442d2fc0186104d7766b159cf231ac491b9fb
cfisher5/daily-ncaa-boxscores
/main.py
UTF-8
553
2.84375
3
[]
no_license
from scraper import scrape_box_scores, get_links year = input('Please enter the year in this format: xxxx\n') month = input('Please enter the month in this format: x\n') day = input('Please enter the day in this format: x\n') # Or if you want to run this as a daily script to get previous night's boxscores: # yesterda...
true
a91c1f194a25c484038ddcc9a255653871d0a79c
marcfeather/asset-managment
/insemi/asset_tracking/asset_managment/views.py
UTF-8
2,911
2.59375
3
[]
no_license
from django.http import HttpResponse from django.shortcuts import render import sqlite3 def index(request): en = "" er = "" p = {'e_n': en, 'e_r': er} #return render(request,'index.html',p) return render(request,'index.html',p) def coordinates(rr1,rr2,rr3): # RSSI TO DISTANCE a...
true
f53475e471aeb71bf78b0dad7180c3cacb0a1443
marianoo-andres/IntelligentEnergySaver
/ScreenSaverApp.py
UTF-8
1,029
2.59375
3
[]
no_license
import json from Logger import Logger from MonitorEvents import MonitorEvents from ScreenSaver import ScreenSaver from SystemTrayIcon import SystemTrayIcon systemTrayIcon = SystemTrayIcon(title='Intelligent Energy Saver') class ScreenSaverApp(): def __init__(self): with open('config.json') as file: ...
true
198f7f6bade973c9629766716471c602d62f2ddf
aka5hChandra/cv_sandbox
/main.py
UTF-8
937
2.703125
3
[]
no_license
import cv2 img = cv2.imread('./savedImages/temp.jpg') def vedioStream(): cap = cv2.VideoCapture(0) while(True): ret,frame = cap.read() #gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) cv2.imshow('frame',frame) if cv2.waitKey(1) & 0xFF == ord('q') : break if c...
true
ad12955723ef16d8895c1828658615b01ef519ad
weak-head/leetcode
/tests/test_p1007_minimum_domino_rotations_for_equal_row.py
UTF-8
463
3.125
3
[]
no_license
import pytest from leetcode.p1007_minimum_domino_rotations_for_equal_row import minDominoRotations @pytest.mark.parametrize( ("a", "b", "rotations"), ( ([2, 1, 2, 4, 2, 2], [5, 2, 6, 2, 3, 2], 2), ([3, 5, 1, 2, 3], [3, 6, 3, 3, 4], -1), ([3, 3, 3, 3, 3], [0, 0, 0, 2, 0], 0), ([...
true
797a6ab9a0f65f937d6800af9ff86b28d3d33645
4plus39/PttAutoLoginPost
/PttAutoComment.py
UTF-8
759
2.78125
3
[ "MIT" ]
permissive
from PttAuto import Ptt from getpass import getpass import time class PttComment(Ptt): def enter_board(self, board): self._telnet.write(b's') self._telnet.write(board.encode('big5') + b'\r\n') time.sleep(1) self._telnet.write(b'\r\n') time.sleep(2) self._content = se...
true
f0d76b5a4ac79deac503d757d8fdfb76d9f3bee2
IIC2115/Syllabus-2020-2
/Pautas/Laboratorios/ScriptL02/pauta.py
UTF-8
17,399
3.125
3
[]
no_license
## pauta.py ### Este archivo es parte del Corrector automatico ### de entregas de laboratorio desarrollado para el ### curso IIC2115. Este archivo debe contener: ##### - Soluciones a cada uno de los problemas ##### - Funciones generadores de inputs ##### - Funciones de verificacion de respuesta correcta ### Francisco...
true
ae0ee80c8b2c0f01f1a1be83fcd970085ee23e06
Jaush-M/automate-the-boring-stuff-projects
/Chapter 12/blank_row_inserter.py
UTF-8
573
3.25
3
[]
no_license
#! /usr/bin/env python # Usage: py.exe blank_row_inserter.py <index row> <number of rows> <.xlsx file> import openpyxl import sys if len(sys.argv) == 4: file = sys.argv[3] index_row = int(sys.argv[1]) num_rows = int(sys.argv[2]) print('Loading file...') wb = openpyxl.load_workbook(file) ws =...
true
aac1dc3b026c22f49ca86f6bd61b8847b85bad7a
F4r4m4rz/MyPython
/ItteratorDemo/cpuTemperature.py
UTF-8
1,067
2.796875
3
[]
no_license
import random import sys import datetime import itertools import time class MySensor: def __iter__(self): return self def __next__(self): return random.random() sensor = MySensor() dt = iter(datetime.datetime.now, None) for s,d in itertools.islice(zip(dt, sensor), 10): print(d,s) ...
true
6e95e61dc9ebfb1c95cf8b48e33e542ac38e7606
oliverdozsa/scrapy-patterns
/tests/test_site_pager.py
UTF-8
5,760
2.65625
3
[ "MIT" ]
permissive
"""Contains site pager tests""" from unittest.mock import Mock, ANY, call import pytest from scrapy.exceptions import DontCloseSpider from scrapy_patterns.spiderlings.site_pager import SitePager, SitePageParsers def test_create(): """Tests the creation of site_pager.""" mock_spider = Mock() mock_spider.na...
true
673501bcee084e179ecdc2f27b26effa0150df96
fatimazeino/myWork
/week05/students.py
UTF-8
1,989
4.0625
4
[]
no_license
# students.py # This program allows a user to create new students and to view students # Author: Fatima Zeino import json filename = "studentData.json" def displayMenu(): print("What would you like to do?") print("\t(a) Add new student") print("\t(v) View students") print("\t(s) Save students") pr...
true
5f9515fe1bcb36f08089acc2dfcccf3450a8ddb6
BHUVANESHWARI12/py
/arms 1.py
UTF-8
277
3.21875
3
[]
no_license
print("display a armstrong number between two intervals") b=int(input("begin=")) e=int(input("end=")) for x in range(b+1,e): s=0 a=0 t=x while x>0: re=x%10 a=re**3 s=s+a x=x//10 if(t==s): print(s)
true
1fddc46126bc304c3b77c13f9f900ccc7cc31776
BartyPitt/RoboticsProject
/Models/loadmodel.py
UTF-8
2,290
2.609375
3
[]
no_license
""" Load and delete models on Gazebo Modified from Baxter SDK example (https://sdk.rethinkrobotics.com/wiki/Home) Last modified by : R Saputra 2020 Modified on 2 March 2020 by Medad Newman """ import rospy import os from gazebo_msgs.srv import (SpawnModel, DeleteModel,) from geometry_msgs.msg import (PoseStamped, Pos...
true
6846b4cd89f418c0e86ddd82e1c58f32f2df8e8e
babyfingers/python_scripts
/offsite_backup.py
UTF-8
8,744
2.734375
3
[]
no_license
#!/usr/local/bin/python2.7 # offsite_backup.py # Go into each user's home directory and look for a file called # backup_please. It should contain a list of directories. After # checking that each directory is legit and the total size does # not exceed some designated amount. vers = 0.2 import re import os import sys...
true
f6ef027bdf85348940773627e63c22cd3e99a905
samigamer1999/2d_autonomous_car
/src/GA.py
UTF-8
930
3.03125
3
[]
no_license
import random def calculate_fitness(voitures_sauve): somme = 0 for car in voitures_sauve: somme += car.fitness for car in voitures_sauve: car.fitness = car.fitness / somme def nouvelle_gen(voitures_sauves): calculate_fitness(voitures_sauves) return generate(voitures_sauves) def...
true
cefbcc5832213ddac41a2215476411f4a5675bb6
VasaKiDD/end-to-end-drug-discovery
/deep_likeliness/dataloader.py
UTF-8
2,368
2.578125
3
[ "Apache-2.0" ]
permissive
import numpy as np import pandas as pd import torch from torch.utils.data import Dataset class MolecularDataset(Dataset): def __init__(self, sources=[], props=["logIC50", "BFL", "pipeline"], with_missings=False): self.num_sources = len(sources) self.source_smiles = [] self.source_props = ...
true
8797f4e9feff0a041b1b5145ccd457d1f73a181b
tehs0ap/Project-Euler-Python
/Solutions/Problems_1-9/Problem_5.py
UTF-8
1,218
3.921875
4
[]
no_license
''' Created on 2012-12-06 @author: Marty ''' ''' 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? ''' import time startTime = time.time() number =...
true
1c86ad42928549e6101cf8baf4f786829095e1e9
mmhkhan/hackerrank_codes
/birthday_chocolate.py
UTF-8
280
2.9375
3
[]
no_license
s = list(map(int, input().rstrip().split())) dm = input().rstrip().split() d = int(dm[0]) m = int(dm[1]) count = 0 for j in range(len(s)-m+1): sum=0 for i in range(j,j+m,1): sum+=s[i] if sum==d: # print(s[i]) count+=1 print(count)
true
b8bc251f86d78e34790225721ff51a75f6f3ebd1
MysteriousSonOfGod/py
/quiz.py
UTF-8
853
3.953125
4
[]
no_license
# Quiz Program import random questionBank = {'Mammal':'Which type of animal has warm blood?', 'Egg':'What does the chicken lay?', 'Rupees':'What is the currency if Nepal?'} """ questions = list(questionBank.values()) rnd = random.randint(0,len(questionBank)-1) print(questions[rnd]) """...
true
c2154aacac11e0b72054334e17fad7bb7b52a1e2
HanseamChung/practice
/합짝 홀그.py
UTF-8
495
3.484375
3
[]
no_license
a= int(input("첫번째 양의 정수를 입력하시오")) b= int(input("두번째 양의 정수를 입력하시오")) c= int(input("세번째 양의 정수를 입력하시오")) if (a+b+c)%2 == 0 : if a>=b : max=a if a>=c : print(max) else : max=c print(max) else : max=b if b>=c : pr...
true
db9f119613d0376445522a3dfd759948b07bb6bc
patrickjennings/pysymreplace
/tests/test_symlink_collection.py
UTF-8
752
2.8125
3
[]
no_license
from pysymreplace import SymlinkCollection def test_symlink_collection_finds_symlink(tmp_path): symlink = tmp_path / 'symlink' symlink.symlink_to('target') symlinks = SymlinkCollection(tmp_path) assert symlinks == set([symlink]) def test_symlink_collection_finds_symlinks_from_many_paths(tmp_path):...
true
ce1557ea46c4abcd1965a00ecdbf59f4c480fab9
jvieira42/SPLN-TP
/TP2/presentation/soup.py
UTF-8
678
2.78125
3
[]
no_license
from bs4 import BeautifulSoup import urllib3 http = urllib3.PoolManager() r = http.request("GET", "https://steamdb.info/") soup = BeautifulSoup(r.data, "lxml") for div in soup.body.find_all("div", "span6"): if div.table.thead.tr.th.text == "Most Played Games": game_names = div.table.tbody.select("tr") ...
true
d60b8848647073fb6debacd86e0751ebbc55838b
LuoJiaji/LeetCode-Demo
/Python/899_orderly-queue.py
UTF-8
561
3.171875
3
[]
no_license
class Solution(object): def orderlyQueue(self, S, K): """ :type S: str :type K: int :rtype: str """ if K >= 2: s = sorted(S) s = ''.join(s) # print(s) return s else: s_min = S for _ in ran...
true
96f8c708c28bea558d04bf6e6b3c5fbc1b2ad73e
FRAndrade/Python
/python/listadeexercicio/Ex1.py
UTF-8
526
3.640625
4
[]
no_license
def pergunto(mensagem, tentativas = 3, lembrete = "Tente novamente"): while True: resp=input(mensagem) if resp in ("sim","s"): return True elif resp in ("nao","n"): return False else: tentativas = tentativas - 1 if tentativas <=0: ...
true
50ea2cfafaa34c67b9a97452fc822001d1f619fa
reharmony/cloudpython
/python09/모듈테스트/회원가입.py
UTF-8
1,269
2.765625
3
[]
no_license
''' Created on 2019. 4. 9. @author: user ''' import 회원db처리 if __name__ == '__main__': choose = int(input("이용할 서비스를 입력하세요(1=C / 2=R / 3=U / 4=D)>> ")) if choose == 1: # create print("### 회원 가입 ###") id = input("id를 입력하세요>> ") pw = input("pw를 입력하세...
true
8c41b3c3d982dc9e35baa49bc9cc3669dade3e3f
winterwolf32/JWT-
/tests/test_utils.py
UTF-8
2,135
2.640625
3
[ "MIT" ]
permissive
"""Test""" import os import pytest as pytest from myjwt.Exception import InvalidJWT from myjwt.Exception import InvalidJwtJson from myjwt.utils import create_crt from myjwt.utils import encode_jwt from myjwt.utils import encoded_to_json from myjwt.utils import HEADER from myjwt.utils import is_valid_jwt f...
true
c015fa43bd26fcb839de021727ef6e210ed909c5
Hamiedamr/videorestapiflask
/main.py
UTF-8
2,567
2.609375
3
[]
no_license
from flask import Flask from flask_restful import Api, Resource,reqparse,abort,fields,marshal_with from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) api = Api(app) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db' db = SQLAlchemy(app) class VideoModel(db.Model): id = db.Column(db.Integer,...
true
d721b1b002fa2addccb7d2da2fd5e32d4adb9f4d
shants/LeetCodePy
/148.py
UTF-8
2,229
3.546875
4
[]
no_license
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def printNone(self, head): while(head is not None): print(head.val) head=head.next def merge(self, l1, l2): if ...
true
476bc6a780bcf38a07c5a6be6530b77f83f6ef1b
max1mka1/Ski_forecast
/ski_forecast.py
UTF-8
6,751
3.375
3
[ "MIT" ]
permissive
# ski_forecast.py ''' ===================== Author: Tingaev M.I. ============================================================================== Task Description: 1.Описание ситуации Вы помогаете организаторам школьных соревнований по лыжной гонке. Одна из задач организаторов - обеспечить всех одинаковой смазкой для...
true
ec238f290547ba44bf3d63a406f8d08588314259
chenshanghao/Interview_preparation
/Company/Amazon/Leetcode_21/my_solution_ recursive.py
UTF-8
662
3.84375
4
[]
no_license
""" Definition of ListNode class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next """ class Solution: """ @param l1: ListNode l1 is the head of the linked list @param l2: ListNode l2 is the head of the linked list @return: ListNode head of linked...
true
2faba4286d22c41bf40c54f824222c94958f43a9
Windancer94/data-mining-project-3
/pagerank.py
UTF-8
3,227
3.15625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Dec 22 16:31:29 2018 @author: top """ import numpy as np from scipy.sparse import csc_matrix from scipy.linalg import norm #determine the size of adj def File_max(path): A=list() fp = open(path, "r") for line in iter(fp): line1=li...
true
5a0295edc3abc93cc7551d858419733f9a36d9a0
nadavshalev/AnvanSight
/proccessing_func.py
UTF-8
2,910
2.734375
3
[]
no_license
import numpy as np import cv2 as cv import matplotlib.pyplot as plt from scipy import signal def pre_proccess(im_path): imcv = cv.imread(im_path) tmp_img = np.array(cv.resize(imcv, (512, 536))) tmp_img = tmp_img[:, 12:-12, :] tmp_img = np.rot90(tmp_img) # switch channels to make RGB img = n...
true
66605dec9346b8eee6223b4c6223fba52d227f76
qyz-thu/gnn_vae
/tests/distributions/test_bernoulli.py
UTF-8
5,599
2.578125
3
[ "MIT" ]
permissive
import unittest from itertools import product import mock import numpy as np import pytest from tensorkit import tensor as T from tensorkit import * from tensorkit.distributions import * from tensorkit.distributions.utils import copy_distribution from tests.helper import * def sigmoid(x): return np.where(x >= 0...
true
15554c67119078d0d47dba8fe03742eddfba3588
buratina/Python-Data-Visualization-Solutions
/Section 02/sec02-imgshow-lena1.py
UTF-8
188
2.59375
3
[ "MIT" ]
permissive
import scipy.misc import matplotlib.pyplot as plt lena = scipy.misc.ascent() plt.gray() plt.imshow(lena) plt.colorbar() plt.show() print (lena.shape) print (lena.max()) print (lena.dtype)
true
244c705088c6e963d2f5b19bb79e5399bd852176
haruyasu/PySide
/42_qt_designer_test.py
UTF-8
2,045
2.640625
3
[]
no_license
import os, sys from PySide import QtCore, QtGui from PySide.QtUiTools import QUiLoader import functools as fnt uiFile = 'ui/test.ui' class Example(QtGui.QMainWindow): def __init__(self): super(Example, self).__init__() self.initUI() def initUI(self): loader = QUiLoader() self....
true
165b0095e9ca0ad11b3d135acbe84494b9aab3ed
Mizu-cmd/turbo-octo
/errors.py
UTF-8
374
2.53125
3
[]
no_license
import discord def make_error(error:str, exemple:str): embed=discord.Embed(title="Error", description=error, color=0xf32b2b) embed.add_field(name="exemple", value=exemple, inline=False) embed.set_footer(text="Turbo Octo - Error message", icon_url="https://cdn.discordapp.com/avatars/825696493037944882/db7f3...
true
62e4ccf50907e67a4c9a949960624857b0ba39c5
nikonoff16/learn2code
/KGU - Basic Python/funf_5.py
UTF-8
469
3.578125
4
[]
no_license
from math import sin, cos a = float(input("Введите первую перменную: ")) b = float(input("Введите вторую переменную: ")) def f_func(u_arg, t_arg): if u_arg > 0: return u_arg + sin(t_arg) else: return u_arg + t_arg # print(f_func(a, b)) z_res = f_func(sin(b), a) + f_func(cos(b), a) + f_func(s...
true
ede5fb027cf4ba20576dbc255e24ca3f0eb55a48
TimCatCai/geketime
/test_file.py
UTF-8
533
3.546875
4
[]
no_license
# file = open("name.txt", 'w') # file.write(u"刘备") # file.close() # # file1 = open("name.txt") # print(file1.read()) # file1.close() # # file2 = open("name.txt", 'a') # file2.write(u"诸葛亮") # file2.close() file3 = open("name.txt") for line in file3.readlines(): print(line, end="") print(file3.tell()) # 跳转到固定位置,相对于...
true
aaf6ae41b0209749a08a8e4ceb05ef9e78dd298f
xiang-daode/Python3_codes
/示例if-else语句_各类型的真假约定.py
UTF-8
1,247
4.0625
4
[]
no_license
# 在这里写上你的代码 :-) #布尔类型,也叫逻辑类型: 大多视表达式,成立为真,不成立为假: #常配合: &(and) ,|(or) ,~(not), b = False if b: print('b是True') else: print('b是False') b2 = (3<5)&(3+6==9)and(1+1==2) if b2: print('b2是True') else: print('b2是False') b3 = (144%51==0)|(144%6==0)or(144%5==0) if b3: print('b3是True') else: print('b3是Fa...
true
53847e6e69c05b38e4b1f7963a0405b4c42fb477
Somaimo/raspi-files
/project-senseHat/senseDweet.py
UTF-8
724
2.8125
3
[]
no_license
#!/usr/bin/env python3 from sense_hat import SenseHat from datetime import datetime from time import sleep from csv import writer as csvwriter import requests sense = SenseHat() dweetio_thing_name = "mytesting20" def get_sense_data(): sense_data = [] sense_data.append(sense.get_temperature()) sense...
true
c49d222bd80b4ad6756291643105c9968a64261a
mkhndrsn/cv_final_project
/process_video.py
UTF-8
1,697
2.9375
3
[]
no_license
import cv2 import os from processor import process_image def video_frame_generator(filename): """A generator function that returns a frame on each 'next()' call. Will return 'None' when there are no frames left. Args: filename (string): Filename. Returns: None. """ video =...
true
cb24b6a1209883a8ae2d947253ee04626b38d5d6
Darkeran/Python3
/Exercicios/Produto.py
UTF-8
734
4.25
4
[]
no_license
# Faça um programa que pergunte o preço de três produtos e informe qual produto você deve comprar, sabendo que a decisão é sempre pelo mais barato produto1 = float(input("Digite o preço em R$ do primeiro produto:", )) produto2 = float(input("Digite o preço em R$ do segundo produto:", )) produto3 = float(input("Digite ...
true
4541366c4470a75c5d0046ea548682daf3f3afb6
Hornet004/alx-higher_level_programming
/0x04-python-more_data_structures/5-number_keys.py
UTF-8
127
2.671875
3
[]
no_license
#!/usr/bin/python3 def number_keys(a_dictionary): if a_dictionary is None: return 0 return (len(a_dictionary))
true
c5bc73f16e38e06c97b1d62223d2defde0ee5f31
eanopolsky/advent-of-code-2019
/14/nanofactory2.py
UTF-8
2,769
2.921875
3
[]
no_license
#!/usr/bin/python3 from math import ceil reactions = [] with open("input.txt") as f: for line in f: reaction = {"Rs": [], "P": {}} reagents, product = line.split("=>") reagents = reagents.strip().split(", ") product = product.strip() #print("'{}'".format(reagents)) ...
true
31adb6da05c3153a7fd945f484f00468deaf54b8
bingqiw2018/WordTutorial
/test/JiebaTest.py
UTF-8
1,037
2.546875
3
[]
no_license
#coding=utf-8 ''' Created on Dec 28, 2018 @author: g802622 ''' from word.DictionTool import DictionTools from word.ClassTool import ClassTools def jieba_for_word(): dt = DictionTools() dt.add_dic_temp_words(['保健茶饮']) list_title = dt.getDataSource("D:\eclipse4.8\workspace_nlp\WordTutorial\data\DOC_00...
true
c5054ae10e2ca3f2de7fb5d0069fc9e2958fcfd4
genadyp/leetcode
/130_Surrounded_Regions/solution1.py
UTF-8
2,436
3.65625
4
[]
no_license
""" Runtime: 132 ms, faster than 92.60% of Python3 online submissions for Surrounded Regions. Memory Usage: 15.5 MB, less than 91.42% of Python3 online submissions for Surrounded Regions.""" from typing import List class Solution: def color_region(self, board: List[List[str]], x_start: int, y_start: int, color: ...
true
ab47f1eac3a797a66f667b570bd038f74219dea4
FabriceScoupe/CodeKatas
/004/DRYFusion.py
UTF-8
772
3.03125
3
[]
no_license
#!/usr/bin/python # Code Kata Four - Data Munging - DRY Fusion # ========================================== # DRYFusion module provides common functionality. import re # ========== SHARED FUNCTIONALITY ========== # Generator returning groups in each matched line # Can work on big files. def next_line(filename, compi...
true
b6fa59ece2bb85d014eb8a21dbdfae64c27fb669
danvk/git-helpers
/util/piece.py
UTF-8
5,591
2.640625
3
[]
no_license
from __future__ import print_function """Helpers for "pieces" of formatted output linked to certain format specifiers.""" from .color import color as C, color_symbol, clen, cstr from datetime import datetime from dateutil.parser import parse as parse_datetime import re from .regexs import refname_or_tag_regex from .r...
true
2546fc458d87f324727214c1c7fa763768b5ff1d
abhisek08/python-collections
/extend deque.py
UTF-8
178
3.65625
4
[]
no_license
''' Write a Python program to add more number of elements to a deque object from an iterable object. ''' from collections import deque s=[1,2,3] c=deque('a') c.extend(s) print(c)
true
f3150e169c9fb2689b6fb331aad92d7437a6b6c7
shivamayvazri/PBO_5
/lat1.py
UTF-8
555
3.640625
4
[]
no_license
class kucing: def __init__(self, nama, umur): self.nama = nama self.umur = umur def bersuara(self): print("Meow, perkenalkan nama saya", self.nama, "umur saya", self.umur, "tahun") class dog: def __init__(self, nama, umur): self.nama = nama self.umur = um...
true
434f0f87fbb8d7e537058e447a762266174df174
HARIDARUKUMALLI/devops-freshers
/Bhaskar_Folder/python scripting/dictionary.py
UTF-8
149
3.0625
3
[]
no_license
dic={} dic={"name":"bhaskar","age":22,"mobile":123456789} print(dic) print(dic["name"]) del dic["mobile"] print(dic) for i in dic.values(): print(i)
true
4dbd8673ec85caca7b6142948b939328a68dcb34
altazur/ImageGenerator
/image_generator_MB.py
UTF-8
900
3.28125
3
[]
no_license
from PIL import Image input_mb = int(input("Enter generated MB: ")) #Because 1mpx of RGBA white image without compression is 4 MB file size #Method GetImageSize check whether the input is the exponent of 4 # if it is the method returnes the tuple of 1000px*exponent X 1000px*exponent #If no method returnes image which...
true
f9c5bf4b3a426ac0e0a30650ff9733bc25ac28f6
laipiel/conbarcoder
/main.py
UTF-8
935
2.765625
3
[]
no_license
#! /usr/bin/python # -*- coding: utf-8 -*- import Tkinter import initdb import price import logging current_frame = None def FrameLoader(frame, root): def closure(): global current_frame if current_frame: current_frame.pack_forget() current_frame = frame current_frame.pack() return closu...
true
23545e8cae222c0cddb564dca9f6153b48541b6c
SatoshiDE/Class
/python04.func2.py
UTF-8
196
3.484375
3
[]
no_license
#!/usr/bin/env python def fact1(n): """ 'n!' を求める """ ans = 1 i = 1 for i in range(1, n+1): ans = ans * i i = i + 1 return(ans) c = fact1(4) print(c)
true
3ed63469f8bfd85b0179625d32809cdf2871686a
milesbagwell/ud036_StarterCode
/entertainment_center.py
UTF-8
988
3.078125
3
[]
no_license
import media import fresh_tomatoes toy_story = media.Movie("Toy Story", "A story of a boy and his toys that come to life", "https://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg", "https://www.youtube.com/watch?v=KYz2wyBy3kc") toy_...
true
549a20e4b56e9de84a6a1b87159d56d187530e89
Kartavya-verma/Competitive-Pratice
/Assignment/swapcase.py
UTF-8
283
3.25
3
[]
no_license
def count(string, substring): count = 0 start = 0 while start<len(string): flag = string.find(substring, start) if flag != -1: start = flag + 1 count += 1 else: return count a=input() b=input() print(count(a,b))
true
1218e1199b21f6a91b85dae8db542e3249260760
lsDantas/mcmc
/cadeia_finita.py
UTF-8
808
3.265625
3
[]
no_license
# Código Auxiliar: CadeiaFinita # # Grupo: Atílio, Fredson, Giovani e Leonardo # Descrição: Encapsula distribuição de proposta # baseada em cadeia de Markov finita. import numpy as np class CadeiaFinita: def __init__(self, pi, matriz): self.pi = np.array(pi) self.matriz = np.array(matriz) ...
true
dc630e8abe5a96284e4d232b3ddeb838910c5a9d
brevadiaz/01Tarea
/integracion.py
UTF-8
574
3.03125
3
[ "MIT" ]
permissive
import numpy as np from astropy import units as u #PARTE 2: INTEGRACION DEL ESPECTRO datos=np.loadtxt('sun_AM0.dat') x_values=datos[:,0]*u.nm; y_values=datos[:,1]*u.W/(u.m**2*u.nm); x_new=x_values.to('um'); y_new=y_values.to('erg/(s cm2 um)'); n=len(x_new); suma=0; for i in range(0,n-1): #en unidades cgs base=x_n...
true
2c20e75387b24304321ec24e93b6748913d4448b
xaero195/learn
/exercises/19_ssh_telnet/task_19_3.py
UTF-8
5,027
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- ''' Задание 19.3 Создать функцию send_commands (для подключения по SSH используется netmiko). Параметры функции: * device - словарь с параметрами подключения к устройству, которому надо передать команды * show - одна команда show (строка) * config - список с командами, которые надо выполнить в...
true
09f653badb21bea45df263f02809e9e594672558
mastercodeballer/ifaw-Data-Team
/Web Scrape.py
UTF-8
839
3.53125
4
[]
no_license
from bs4 import BeautifulSoup import requests animal_list = [] for i in range (1,55): #looping through each page of the animal for sale listings html_text = requests.get('https://www.exoticanimalsforsale.net/animalsforsale.asp?page=' + str(i)).text #getting to the right url depending on which page so...
true
a23f16a30e3d91fd39f5db7383daa2ed8ccf3cc6
ornichola/learning-new
/stepik/python575/01_06_07.py
UTF-8
554
2.671875
3
[ "Unlicense" ]
permissive
from selenium import webdriver import time try: browser = webdriver.Chrome() browser.get("http://suninjuly.github.io/huge_form.html") elements = browser.find_elements_by_xpath('//input') for element in elements: element.send_keys("Мой ответ") button = browser.find_element_by_css_selector("...
true