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 |
|---|---|---|---|---|---|---|---|---|---|---|
88d8b69e86b0f8b03b4b60efdf13b6782e63d2ee | muliCohen1/price-scraper | /server/input_output.py | UTF-8 | 462 | 3.46875 | 3 | [] | no_license | def read_file(title):
try:
read_value = open("records/"+ title +".txt", "r")
read_value = read_value.read()
except IOError:
# print("Creating new record")
read_value = ''
return read_value
def write_file(title, price):
try:
write_value = open("records/"+ title +"... | true |
4adb37ed81c4e68e4863568fda521c75ef882413 | aryabartar/learning | /interview/array/SentenceReversal.py | UTF-8 | 753 | 3.90625 | 4 | [] | no_license | from nose.tools import assert_equal
def rev_word(sentence):
sentence_split = sentence.split(" ")
new_sentence = ""
for word in reversed(sentence_split):
if word == "":
continue
if new_sentence != "":
new_sentence = new_sentence + " "
new_sentence = new_se... | true |
8e4feee79159990f13435f8e64626ef1bec35fad | qdree/Raspberry-Pi | /Moriarty_says/Demo1.py | UTF-8 | 3,963 | 2.578125 | 3 | [] | no_license | from morSaysInit import *
TRIG = 23
ECHO = 24
inArduino_1 = 20
inArduino_2 = 21
outArduino_1 = 26
outArduino_2 = 19
GPIO.setup(TRIG, GPIO.OUT)
GPIO.setup(ECHO, GPIO.IN)
GPIO.setup(inArduino_1, GPIO.IN)
GPIO.setup(inArduino_2, GPIO.IN)
GPIO.setup(outArduino_1, GPIO.OUT)
GPIO.setup(outArduino_2, GPIO.OUT)
morS_video... | true |
587cfc7ac164675e37d61e6edef0fc165843998d | TWEEDOriginal/Selenium-projects | /tester4.py | UTF-8 | 1,189 | 2.859375 | 3 | [] | no_license | from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.keys import Keys
import time
def main():
opts = Options()
opts.add_argument("--disable-extensions")
opts.add_argument("--headless")
driver = Firefox(options=opts,executa... | true |
f02aa74fff407391c0c10aad2a98df07e6876df6 | Gowtham-cit/Python | /Guvi/Given a sentence and string S, find how many times S occurs in the given sentence.py | UTF-8 | 140 | 3.640625 | 4 | [] | no_license | #Given a sentence and string S, find how many times S occurs in the given sentence.py
s = input().split()
a = input()
print(s.count(a))
| true |
ebd68b03a77f37461fd66aec96f45ba8ab35f063 | Kousi-ops/Data-Folkz-test | /test3.py | UTF-8 | 147 | 3.078125 | 3 | [] | no_license | print('Python', python_version())
i = 1
print('before: i =', i)
print('comprehension:', [i for i in range(5)])
print('after: i =', i)
| true |
62e3dc73d4760c9c116d5cb049b46a66726c1383 | way-pt/way-pt-web | /core/pathfinder.py | UTF-8 | 6,215 | 3.25 | 3 | [] | no_license | from PIL import Image, ImageDraw
from pathlib import Path
class Point:
"""
Represents a point of elevation data.
"""
def __init__(self, pt, val):
self.pt = pt
self.val = val
class Draw:
"""
Represents a path. Includes methods to take in elevation data, draw a map, and find ... | true |
be30a0ed52cfabd7ad7dfb742a703965603f3483 | xwalls/-RayTracingPy | /geom/Scene.py | UTF-8 | 4,414 | 2.984375 | 3 | [] | no_license | from obj import Light,Camera,Sphere
from geom.T3D import T3D
from surf import Surface
class Scene(object):
def __init__(self, option):
self.camera: Camera
self.lights = []
self.objects = []
self.bgColor = (0, 0, 0)
self.filename = ''
self.maxLevel = 0
... | true |
0d774ae64c7d5424ee2bb338fb1e94030106b18f | hwinther/lanot | /src/core/prometheus/nodedata.py | UTF-8 | 5,961 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | # coding=utf-8
"""
server - recv packet (buffer), parse and validate node to a-z, write to node/sensor/%yy.%mm.%dd/data.json:
record:
[
{
'timestamp': 'iso-timestamp',
data: [
{'sensor': value},
(..)
]
}
]
client - send list of packets
packet: node\tsensor\tvalue\r\n
function t... | true |
a8089fad349e2560df3063ad020471dc45e06969 | hansiu/modelo2-simpleMD | /vector.py | UTF-8 | 5,329 | 2.96875 | 3 | [] | no_license | #! /usr/bin/env/python
class Vector:
dim=1
def __init__(self,dm=None,coords=None,):
if coords is None:
if dm is None:
self.dim=Vector.dim
else:
self.dim=dm
self.coords=[float(0) for d in range(self.dim)]
elif isinstance(coords,... | true |
0481eaa12bd5a74135951655a993ef582f4ee914 | bharatchitara/DSA | /DSA/excer/ex18.py | UTF-8 | 654 | 4.03125 | 4 | [] | no_license | #DSA-Exer-18
def find_next_min(num_list,start_index):
#Remove pass and write the logic to find the minimum element in a sub-list and return the index of the identified element in the num_list.
#start_index indicates the start index of the sub-list
minimun=num_list[start_index]
index=start_index
for... | true |
d53861a000c851a725386af6f39f594c622efdeb | SukrutaPrakashMidigeshi/Music-to-picture-converter | /computer project.py | UTF-8 | 1,653 | 3.015625 | 3 | [] | no_license | from tkinter import *
from colour import Color
import sounddevice as sd
m = 6
fs = 44100 # frequency per second of the sound
time_seconds = m*m
# m*m is the time in seconds
print("please provide the audio input")
sound = sd.rec(int(time_seconds * fs), samplerate=fs, channels=2, dtype="int16")
# convert... | true |
e4e7539d7c3d75c08afd1317d8b1e7d693c70e10 | ianlai/Note-Python | /algo/dp/_0118_PascalsTriangle.py | UTF-8 | 1,015 | 3.265625 | 3 | [] | no_license | class Solution:
#2021.03.11
def generate(self, numRows: int) -> List[List[int]]:
#initialization
pas = []
for i in range(numRows):
row = []
for j in range(i+1):
row.append(0)
pas.append(row)
#traverse and set ... | true |
1e30779024b136086bfc21b5e5b3325cae4dfdd1 | OsmanAliDurna/pythonExamples | /py_09th.py | UTF-8 | 340 | 3.03125 | 3 | [] | no_license | isim = "Osman Ali"
soyisim = "Durna"
yas = 30
kisiselBilgiler = (isim + " " + soyisim + " " + str(yas))
print(kisiselBilgiler[-1],kisiselBilgiler[0],kisiselBilgiler[1])
print(kisiselBilgiler[2:7])
print(kisiselBilgiler[7:])
print(kisiselBilgiler[:5])
print(kisiselBilgiler[:])
print(kisiselBilgiler[2:15:3])
prin... | true |
6eec2d375dc58605d2a8d37d9d098f1b41327ac7 | AnonymousEngineer/opticontest | /pkgs/python/opticontest/problems/salesman_euclid/random_search.py | UTF-8 | 841 | 2.859375 | 3 | [
"MIT"
] | permissive | from opticontest.problems.salesman_euclid.common import Solution
class Config:
def __init__(self, **kwargs):
self.__set_max_iterations(kwargs[':max_iterations'])
def __set_max_iterations(self, value):
value = int(value)
if value < 1:
raise RuntimeError('invalid value')
... | true |
8bd0d0d55a2a2916ae30d642711d5fdc3b24ebb3 | dikshaa1702/ml | /day1/score_cal.py | UTF-8 | 255 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Tue May 7 12:11:09 2019
@author: DiPu
"""
A1=int(input())
A2=int(input())
A3=int(input())
E1=int(input())
E2=int(input())
weighted_score=((A1+A2+A3)*0.1)+((E1+E2)*0.35 )
print("weightrd score is",weighted_score)
| true |
7d97ad2c82e42d9c079025df00895aa264e3c60c | MahletH/IntroductionToCompetitiveProgramming | /Week7/CD5/UniquePaths.py | UTF-8 | 605 | 2.765625 | 3 | [] | no_license | class Solution:
def uniquePaths(self, m: int, n: int) -> int:
if(m==1 or n==1):
return 1
m-=1
n-=1
lst1=[]
lst=[]
for i in range(n):
for j in range(m):
if(not i):
lst1.append(2+j)
elif(not j):... | true |
74be08c6989e8a7f1d98b3299a57fac73e1e61ea | dnwjddl/ObjectDetection | /YOLOv3/data/transform.py | UTF-8 | 11,263 | 3.25 | 3 | [] | no_license | import torch
import torchvision.transforms.functional as FT
import random
def find_intersection(set_1, set_2):
"""
Find the intersection of every box combination between two sets of boxes that are in boundary coordinates.
:param set_1: set 1, a tensor of dimensions (n1, 4)
:param set_2: set 2, ... | true |
24c6170edad07997a97f60c771e8b6c79d9da512 | RandyRcw/Competitive-Programming | /Saint Anselm Programming Contest/2017_3.py | UTF-8 | 1,097 | 4.15625 | 4 | [] | no_license | # Write a program that accepts a word of length N (1 <= N <= 30) and draws concentric squares as borders in the
# following manner:for each character a border is made, from outside to inside and filled with the corresponding letter.
# Example1. INPUT: Enter string? JOE
# OUTPUT: JJJJJ
# JOOOJ
# ... | true |
9539188592cf1d0081cc1f0b1509d97317fcc8a1 | MeCBing/Algorithms | /hw4-sol/solutions/datastream.py | UTF-8 | 834 | 3.5 | 4 | [] | no_license | #!/usr/bin/python3
import random
random.seed(10)
import heapq
def ksmallest(k, l):
heap = []
for i, x in enumerate(l):
if i < k:
heapq.heappush(heap, -x)
elif -x > heap[0]:
heapq.heapreplace(heap, -x)
return sorted([-x for x in heap])
def ksmallest2(k, l):
l = i... | true |
7a560c30671633679b669680f9f65add83089278 | MartinMeyer1/cloudio-common-python | /src/cloudio/common/core/threaded.py | UTF-8 | 5,748 | 3.3125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import logging
import time
from threading import Condition
from threading import Thread
logging.getLogger(__name__).setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, CRITICAL
class Threaded(object):
"""Provides a _thread which executes the _run() method at regular intervals.
Fe... | true |
423bbfb7bf79a6c380c3b056ae05df0e0d72f2ba | osama-mohamed/python_projects | /algorithmes/graph_dijkstra_shortest_path_tree.py | UTF-8 | 672 | 3.65625 | 4 | [
"MIT"
] | permissive | def BFS_SP(graph, start, goal):
explored = []
queue = [[start]]
if start == goal:
print('Same Node')
return
while queue:
path = queue.pop(0)
node = path[-1]
if node not in explored:
neighbours = graph[node]
for neighbour in neighbours:
new_path = list(path)
new_path.append(neighbour)
que... | true |
b3072eab29f859ce9690776df2857db086451e08 | Roc-J/Crawler | /crawler_taobaoMM.py | UTF-8 | 1,754 | 2.90625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# Author: Roc-J
import urllib
import urllib2
import re
import os
class Spider:
def __init__(self):
self.siteURL = 'http://mm.taobao.com/json/request_top_list.htm'
def getPage(self, pageIndex):
url = self.siteURL + "?page=" + str(pageIndex)
print url
r... | true |
47b5f07b87d0a794eccec8711444dcbcaf0549ea | wang7211401/python-reptile | /4/2.py | UTF-8 | 839 | 3.3125 | 3 | [] | no_license | html = '''
<title>demo</title>
<div id="container">
<ul class="list">
<li class="item-0">first item</li>
<li class="item-1"><a href="link2.html">second item</a></li>
<li class="item-0 active"><a href="link3.html"><span class="bold">third item</span></a></li>
<li class="item-1 active"><a href="link4.html">fourth item</a... | true |
296188cfa7f5ad989d3bb271f343a155d26388e2 | iliachigogidze/Python | /Cormen/Chapter2/day2/take3/selection_sort.py | UTF-8 | 595 | 3.84375 | 4 | [] | no_license | def main(numbers:list) -> list:
print(f'Sort numbers {numbers}')
return selection_sort(numbers)
def selection_sort(numbers: list) -> list:
for i in range(len(numbers)-1):
min_position = i
for j in range(i, len(numbers)):
if numbers[j] < numbers[min_position]:
mi... | true |
fdcbc7c23d7b94ddccb0bac3c57b95d069475ecc | AlisonZXQ/leetcode | /Algorithms/165. Compare Version Numbers/Solution.py | UTF-8 | 521 | 2.90625 | 3 | [] | no_license | #coding=utf-8
__author__ = 'xuxuan'
class Solution(object):
def compareVersion(self, version1, version2):
"""
:type version1: str
:type version2: str
:rtype: int
"""
v1=version1.split('.')
v2=version2.split('.')
for i in range(max(len(v1),len(v2))):
... | true |
b939e872897712e763810032e61ba2ad169cde96 | RomikGood/data-structures-and-algorithms | /challenges/binary_tree_max_value/find_maximum_value_binary_tree.py | UTF-8 | 2,147 | 4.03125 | 4 | [
"MIT"
] | permissive | class Queue(object):
"""difining queue for traversal
"""
def __init__(self):
self.items = []
def enqueue(self, item):
self.items.insert(0, item)
def dequeue(self):
if not self.is_empty():
return self.items.pop()
def is_empty(self):
return len(self.i... | true |
9633ab96b136286bb731a23bc90b912a9b0e7cd9 | ravitejamallozala/DataStructures | /Problems/Linkedlists/Add_two_nums_2.py | UTF-8 | 1,466 | 4.09375 | 4 | [] | no_license | """
445. Add Two Numbers II
Medium
You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero,... | true |
76b20175b4747e472c55c4ff040ce58cae94d353 | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/224/users/3960/codes/1735_2518.py | UTF-8 | 113 | 3.859375 | 4 | [] | no_license | n = int(input("Numero natural: "))
while(n != 1):
if(n % 2 == 0):
n = n//2
else:
n = (n * 3) + 1
print(n) | true |
0cfe68b6bf7c246aacb0d9c27433e210c37c3dea | OOP-opg/Chess_test | /pychess/game_pool.py | UTF-8 | 739 | 3.03125 | 3 | [] | no_license | """
GamePool class
"""
from typing import Dict, Tuple
from ticket import Ticket
from game import Game, GameId
from history import History
class GamePool:
def __init__(self, history: History):
self._history = history
self._current_games: Dict[GameId, Game] = dict()
def start_game(self, ticket... | true |
5d3d72049fca6abef6abe8ddead44926c50f7d35 | leopd/kidpawn | /test_selfplay.py | UTF-8 | 524 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | import pytest
import kidpawn
from chess import Board
def test_score():
b = Board()
assert kidpawn.score_board(b) == 0
def _kp_sane(kp:kidpawn.Kidpawn):
svg = kp.svg()
assert isinstance(svg, str)
assert len(svg) > 100
fen = kp.fen()
assert isinstance(fen, str)
assert len(fen) > 10
... | true |
a070f4ade56c773a97e33b439211ea5ae3f51ba2 | jmarsil/pygempick | /pygempick/core.py | UTF-8 | 12,029 | 2.953125 | 3 | [
"MIT"
] | permissive | """
Created on Wed May 9 15:06:15 2018
@author: Joseph Marsilla
@email: joseph.marsilla@mail.utoronto.ca
"""
import numpy as np
import cv2
def file2compress(image):
'''
* Takes a image file location, reads the image and
compresses it 3.3 times in our case.
* Images are outputed originally as lar... | true |
b9bf3ee7ea02921da8041f6273890605458513ba | FjDhika/TestChallenges | /palindrom.py | UTF-8 | 146 | 3.375 | 3 | [] | no_license | def palindrome(sentence):
sentence = sentence.lower()
sentence = sentence.replace(' ','')
return sentence == sentence[::-1]
| true |
3b2ea300174478c61da76fb57436907c245e8f02 | DexterInd/GrovePi | /Projects/Catch_A_Lunch_Thief/send_email_pic.py | UTF-8 | 2,363 | 3.21875 | 3 | [
"MIT"
] | permissive | #! /usr/local/bin/python
# This example will show you how to send an email in python, with a picture
# attachment. This example uses outlook.com to send an e-mail.
SMTPserver = 'smtp.live.com'
sender = 'dexterexamples@outlook.com'
USERNAME = "dexterexamples@outlook.com"
PASSWORD = "password"
text_subtype = 'plai... | true |
e080bb8be7620d4f0285022233c9278e2ff1a9c4 | fruit-in/exercism-solution | /python/forth/forth.py | UTF-8 | 3,066 | 3.359375 | 3 | [
"MIT"
] | permissive | class Forth:
def __init__(self):
self._stack = []
self._definitions = {}
def stack(self):
return self._stack
def eval(self, data):
ops = data.lower().split()[::-1]
while ops != []:
op = ops.pop()
if op in self._definitions:
... | true |
cb824f6e03d6ed1087e38b084bff9eb06877f03f | IcyCC/vnpy | /vnpy/app/wh_strategy/wh_parser/util.py | UTF-8 | 1,753 | 3.171875 | 3 | [
"MIT"
] | permissive | import datetime
import dateparser
def get_int_date(date):
if isinstance(date, int):
return date
try:
return int(datetime.datetime.strptime(date, "%Y-%m-%d").strftime("%Y%m%d"))
except:
pass
try:
return int(datetime.datetime.strptime(date, "%Y%m%d").strftime("%Y%m%d"))... | true |
14e4ea5c6c4c466c525f02a0aac96dc7687736b0 | trueToastedCode/AptioBMPChanger | /rom_helper.py | UTF-8 | 1,440 | 2.71875 | 3 | [] | no_license | from bytes_helper import *
def find_magic_bytes(magic_bytes: bytes, data: bytes):
offsets = []
offset = 0
while offset <= len(data) - len(magic_bytes):
offset_res = data.find(magic_bytes, offset)
if offset_res == -1:
break
offsets.append(offset_res)
offset = offs... | true |
e4dd032b34a1aa2b819bd8251a1a551d641eb164 | manimaran89/python_script | /pract/word.py | UTF-8 | 130 | 3.3125 | 3 | [] | no_license | num = 0
with open("content.txt","r") as f:
for line in f:
words=line.split()
num += len(words)
print "Number of words:",num
| true |
ae8784513eaa237f1fc0994df436d3bbccc3d1c2 | iwinulose/eve | /etc/regionTranslate.py | UTF-8 | 338 | 2.75 | 3 | [
"BSD-2-Clause"
] | permissive | import sys
if __name__ == "__main__":
print "REGIONS = {"
for line in sys.stdin:
tokens = line.split()
regionId = int(tokens[0])
regionComponents = tokens[1:]
regionName = " ".join(regionComponents)
regionLower = regionName.lower()
print "\t\"%s\"\t:\tRegion(\"%s\", %d)," % (regionLower, regionName, regi... | true |
36e9cbbd22d14ccfa68be04fe3d67625330481da | kouhei-k/atcoder_submissions | /keyence2019/keyence2019_c/7459001.py | UTF-8 | 566 | 2.53125 | 3 | [] | no_license | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
diff=[[A[i]-B[i],i] for i in range(N)]
diff=sorted(diff,key=lambda x:x[0])
idx=-1
for i in range(N):
while(diff[i][0]<0):
if diff[idx][0]< 0:
print("-1")
exit(0)
if abs(diff[i][0]) >= diff[idx][0]:
diff[i][0]+... | true |
e67d05a88707609480a08a46f820faaa585d0779 | jamilredhat/python_files | /subprocess_module.py | UTF-8 | 1,724 | 2.75 | 3 | [] | no_license | import subprocess
# subprocess.Popen(['ls', '-lt', '/home']) # print output on screen. Output can not be saved in variable.
# Following will run command and redirect output and errors to subprocess.PIPE which can then be accessed using variable.communicate() method
test = subprocess.Popen(['ls', '-lt', '/hom... | true |
8f911d61166d909eb428420a368d11fb92acee83 | rishitc/Codechef_Hacktoberfest-2021 | /Codechef-2020/SEPT20B/COVID19B.py | UTF-8 | 1,374 | 2.5625 | 3 | [] | no_license | # link for solution https://www.codechef.com/viewsolution/37767864
#link f question https://www.codechef.com/SEPT20B/problems/COVID19B
for i in range(int(input())):
n=int(input())
l=[int(x) for x in input().split()]
p=[]
for j in range(0,n):
o=[]
for k in range (0,n):
if ... | true |
ceccd1478cd11a9d02b29a1f186ee595aeea8f20 | tauovir/Nielit | /Python/day30/day30.py | UTF-8 | 1,406 | 2.90625 | 3 | [] | no_license | import scipy.optimize as spo
import scipy as sp
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from pandas import DataFrame as f
from matplotlib import animation as anm
class Day30:
def __ini__(self):
print("Welcome to Scipy")
def createGraph(self):
x = [2,3,5,7,9]
... | true |
64ae50319c094b38d54f7dbab7c2e72f1f31042c | devdo-eu/macau | /tests/test_macau_cli.py | UTF-8 | 4,521 | 2.625 | 3 | [
"MIT"
] | permissive | from time import sleep
from rest_api_client import macau_cli as client
from tests.common import server, dumper_factory, address, helper_factory
import tests.common as common
def test_sanity_check():
assert server is not None
def test_start_server(server):
assert server is None
sleep(2)
def test_find_s... | true |
1852fd8a438ecc8df10b1bcafc07c78b620caabe | bryancsmith2424/Senior-Design-Final-Kamand | /kamandsite/scheduler/modules/FindAvailableTime.py | UTF-8 | 3,376 | 2.921875 | 3 | [] | no_license | from datetime import datetime, timedelta, time, timezone
def roundStartTo15(startTime):
return startTime - timedelta(minutes = startTime.minute % 15) - timedelta(seconds = startTime.second, microseconds = startTime.microsecond)
def roundEndTo15(endTime):
return endTime + timedelta(minutes = 15 - endTime.minute... | true |
daa7f791c3a1035078fdd711aee109af67faea24 | twitu/projecteuler | /prime_generator.py | UTF-8 | 424 | 3.125 | 3 | [] | no_license | def prime(x,type=0):
L=[i for i in range (x)]
L[1]=0
for j in L:
if j>x**0.5:
break
if j==0 :
continue
else :
m=j*j
while m<x:
L[m]=0
m+=j
if type==0:
return L
elif type==1:... | true |
3be744f0b82b574076937ad75ccd347bec1fd99a | cole3/python-tools | /check_html_change.py | UTF-8 | 868 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
import urllib
import time, re
import win_notify
html = "http://nicej.taobao.com/view_page-639877483.htm"
f = urllib.urlopen(html)
old = f.read()
f.close()
url = re.findall('<area href="(.*?)"', old)
pre = len(url)
#print url
print "cur url num is %d " % pre,
print "time:" + ti... | true |
5be2f3e2d25cf61d992d864c3ba2a81273810aac | da4089/simplefix | /simplefix/message.py | UTF-8 | 24,879 | 2.90625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
########################################################################
# SimpleFIX
# Copyright (C) 2016-2023, David Arnold.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the S... | true |
595a393cd7306a7cac8552215b70414ba7ea583c | edt-yxz-zzd/python3_src | /nn_ns/graph2/stack/convert_PseudoImmutable2MutableStackOps.py | UTF-8 | 10,920 | 2.859375 | 3 | [] | no_license |
r'''
see: "def - ops.txt"
1) def a bottom convertor # untyped
2) limit the power
export:
convert_PseudoImmutable2MutableStackOps
Wrapper
example:
>>> from .LeftBiasListAsStackOps import the_left_bias_list_as_stack_ops
>>> im_ops = the_left_bias_list_as_stack_ops
>>> ms_ops = the_left_bias_lis... | true |
d313af32f1304686dc72660bc238c3b6cb85646b | aaasen/rcc | /arcclean.py | UTF-8 | 325 | 2.796875 | 3 | [] | no_license | #RCC Utility Program
#for use in makefile command arcclean
#deletes all files in the given directory that do not contain 'svn'
import re
import sys
import os
svn_regex = re.compile("svn")
os.chdir(sys.argv[1])
entries = os.listdir(os.getcwd())
for entry in entries:
if(not svn_regex.search(entry)):
os.remove(entr... | true |
25ded8deb8004e0cad9499df31285e911a32cb80 | omidziaee/DataStructure | /InterviewCake/super_balanced_binary_tree.py | UTF-8 | 3,688 | 3.578125 | 4 | [] | no_license | '''
Created on Dec 19, 2018
@author: USOMZIA
'''
import unittest
def is_balanced(tree_node):
# the min and max depth of the leaves should not exceed one
# This is a stack to keep the nodes and their depths
# each element is a tuple indicating the node and its depth
if not tree_node.left a... | true |
6718c66e3cda316da4bf4d64902b4fe757ed5b83 | SandyHelly/catseg_v2 | /model_inference/inference.py | UTF-8 | 1,987 | 2.546875 | 3 | [] | no_license | import cv2
import numpy as np
def get_model():
"""
load model from onnx
"""
ONNX_PATH = 'model_inference/dlv3_cats.onnx'
model = cv2.dnn.readNetFromONNX(ONNX_PATH)
print('!!!MODEL LOADED!!!')
return model
def prepocessing():
"""
load, normalize and transform image to blob
"""... | true |
72f7e274d062fae121c7895ccb875f117ce9abbd | haomingsama/python | /tcp/tcp_server_thread.py | UTF-8 | 1,563 | 3.375 | 3 | [] | no_license | ###写一个服务端的监听程序和收发客户端发来的数据
###这个只能连一个客户端
###要连多个客户端,需要放到死循环里去,不断的接受客户端的连接--但这种方法只能接受最近客户端的信息,其他客户端的信息接收不到
###应该服务器和客户端的通信是相互不干扰,相互独立的。
###多线程和多进程 都可以解决这个问题
###系统提供的方法也可以
from socket import *
import threading #导入线程
import copy
def clientProcess(clientSocket):
while True:
#与客户端通信
recvData = clientSocket.recv(1024)... | true |
86bd682d576851b3f2382207fb375635d6e59dc6 | shaurya950/code_forces | /k_tree.py | UTF-8 | 421 | 2.703125 | 3 | [] | no_license | tree = list(map(int,input("").split(" ")))
n,k,d = tree[0],tree[1],tree[2]
dp = [[0 for i in range(2)] for j in range(n+1)]
dp[0][0] = 1
dp[0][1] = 0
mod = 1000000007
for i in range(1,n+1):
dp[i][0] = 0
dp[i][1] = 0
for j in range(1,k+1):
if i - j< 0:
break
if j >= d:
dp[i][1] += dp[i-j][0]
dp[... | true |
5a5d93c8cf9f74188cfbf1726b1fed32f99b2eba | Quintuplin/CSCI_320 | /practice/objectpractice2.py | UTF-8 | 2,056 | 4.0625 | 4 | [] | no_license | # more practice from programiz
# underscores
# '_' denotes convention of 'please treat this as if it were private'
# '__' makes the attribute not publicly visible, but is still accessible by calling '_Classname__variableName'
# Python does not have 'true' private objects
# using properties implicitly
class Celsius:
... | true |
871fd24919c37b42f1c4a4ea7661cef53ee4b430 | ryanbrown358/learning-python | /test.py | UTF-8 | 274 | 3.90625 | 4 | [] | no_license | print("Hello World")
"""
this is a multiline
comment
"""
#single line comment
#have to stay consistant with kind of quote you use
#Print substrings
print("Hello"[0:4])
#print numbers
print(2)
print(1,2,3,"Hello")
#print on a new line
print("Line1\nLine2\nLine3")
| true |
701113e9f6ca075273e58d5a129de460d3d919f5 | MARALOGON/modulo02_boot_0 | /subclaseObjetoGato.py | UTF-8 | 1,050 | 3.828125 | 4 | [] | no_license |
class Gato():
def __init__(self, n, e, p):
self.nombre = n
self.edad = e
self.peso = p
def maullar(self):
if self.peso >=5:
print("MIAU, MIAU")
else:
print("miau, miau")
def __str__(self):
return "Gato {}, e: {}, p: {}".f... | true |
cf440408eadf86a944e07e3e7f9b1a2015039c35 | fogmoon/RabbitMQLoadBalancer | /Queue.py | UTF-8 | 4,706 | 2.625 | 3 | [] | no_license | import pika
import pika.exceptions
import ErrorConstants as ErCon
from Configuration.ConfigurationManager import ConfigurationManager
class Operator(object):
def __init__(self, stop_event, delegate: callable, identifier):
"""
Create a new instance of the Operator and initialize the connections
... | true |
c53b059e79a5698096806261ab4a489573b9904c | amodm/ip-lookup | /scripts/dataupload.py | UTF-8 | 7,343 | 2.890625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import sys, gzip, json, ipaddress, re, pathlib
from typing import Dict, List, Any
"""
Number of most significant bits used to partition the lookup db. Each partition is stored as one key/value pair in
Cloudflare KV, with the key derived from these most significant bits, and the value being all t... | true |
d663bd55363ad3a140f11d5892a46932ddda9381 | bpindor/RTS_Python | /uvfits_qa/plot_all_rms_pointings.py | UTF-8 | 932 | 2.625 | 3 | [] | no_license | import sys,os
#import matplotlib
#matplotlib.use('Agg')
import matplotlib.pyplot as plt
from numpy import max, array
obslist = open(sys.argv[1])
colors = ['r','b','g','c','m']
labelled_pointings = []
for line in obslist:
obsid = line.split()[0]
pointing = int(line.split()[1])
rms_file = '%s_rms.txt' % o... | true |
dc2608c2f59232e435e226e2b1116a0c15b690c5 | mbroihier/hsm | /url_ip_utils.py | UTF-8 | 7,235 | 2.875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
'''
Domain Name Utilities - convert domain name to IP and IP to domain name
'''
import re
import pickle
import sqlite3
import subprocess
import sys
import threading
import time
class LookupUrlIp():
'''
Base class of URL / IP database
'''
def __init__(self):
'''
Co... | true |
77dd61436bad1e379102f069765dcd851010fbe9 | KevinBoxuGao/ICS3UI | /Unit 3/Lesson 6/Example 6 Bouncing Ball.py | UTF-8 | 2,065 | 3.625 | 4 | [
"MIT"
] | permissive | ########################################
# Purpose: To show how to incorporate gravity into your animations
# Programmer: Mr. Schattman
# Last modified: May 6, 2017
########################################
from tkinter import *
from time import *
from math import *
tk = Tk()
screen = Canvas(tk, width=1000,... | true |
b8f7b9ab0b33f496adaae069ebe76feb94088f9b | kosbarts/KB-Glyphs-Scripts | /Decompose Transformed Components and Add Braces.py | UTF-8 | 7,656 | 3.15625 | 3 | [] | no_license | #MenuTitle: Decompose Transformed Components (Including Brace/Bracket Layers) and add Brace Layers if needed
# -*- coding: utf-8 -*-
# by Kostas Bartsokas
from __future__ import division, print_function, unicode_literals
__doc__="""
TTFautohint doesn't like components which have been rotated, scaled or flipped. This sc... | true |
fa0d4ff68962a2f78ff1642a73685cb080ff37e7 | CommunityDeception/DissolvingSRS | /generator/network.py | UTF-8 | 4,546 | 2.921875 | 3 | [] | no_license | import networkx as nx
from utils.convert import networkx2igraph
from collections import defaultdict
def __gaussian_random_partition_graph(l, s, v, k, sigma):
k = k / 2
z_in = k * sigma
z_out = k - z_in
n = s * l
p_in = z_in / (s - 1)
p_out = z_out / (n - s)
if v:
v = s / (v ** 2... | true |
8e1cbcd1812085a41c3ed5271bb3a18644ebcf58 | AmoCat/tensorflow_learn | /lstm/data/path_pkl/calculate_path_num.py | UTF-8 | 625 | 2.609375 | 3 | [] | no_license | #coding:utf-8
import cPickle as pkl
def calculate(data_type = 'sdp',file_type = 'train'):
str_tail = "_all_path_to_root"
file_name = file_type + '_' + data_type + str_tail
paths = pkl.load(open(file_name,'r'))
count = dict()
for sen in paths:
for w in sen:
path_num = len(w)
... | true |
2941d49aee2c285745c984c2df1717129d6772ae | sstevens2/sstevens_scripts | /rm_badMediancorrGFM.py | UTF-8 | 910 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python
import sys, csv
"""rm_badMediancorrGFM.py - this program cuts out those contigs with a
low correlation(below cutoffcor) from the coverage file of a GFM.
must have GFM.tsv.corr.tsv to correspond with GFM.tsv that is the
coveragefile.tsv input. """
__author__ = "Sarah Stevens"
__email__ = "ssteve... | true |
cc6bd1d1db62890d1e683850e19e2a02b3fdde68 | misaka-10032/leetcode | /coding/00317-shortest-distance-from-all-buildings/test_py2.py | UTF-8 | 473 | 3.09375 | 3 | [] | no_license | # encoding: utf-8
"""
Created by misaka-10032 (longqic@andrew.cmu.edu).
TODO: purpose
"""
from solution import Solution
sol = Solution()
def test_0():
assert sol.shortestDistance([[]]) == -1
assert sol.shortestDistance([[1]]) == -1
assert sol.shortestDistance([[1, 0]]) == 1
assert sol.shortestDistan... | true |
844d72fe0b72e356755b65e68c5e776ac0499632 | cacktopus/cryptopals | /s2c12.py | UTF-8 | 2,096 | 2.6875 | 3 | [] | no_license | import codecs
import util
from s2c10 import ecb_encrypt
from s2c11 import random_AES_key
from pkcs7_padding import pkcs7_padding
from s6c42 import debug
KEY = random_AES_key()
UNKNOWN = b''.join(b'''
Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkg
aGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmlu... | true |
9e5f4cfc41ebb2d4cab9604ca0bc88948e831c53 | airenle/practice | /minst/minst_pytorch/CNNTrainedModelTest.py | UTF-8 | 2,640 | 2.875 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.utils.data import Dataset
from torch.utils.data import DataLoader
import cv2
import os
import warnings
# 忽略警告信息
warnings.filterwarnings("ignore", category=UserWarning)
torch.manual_seed(1)
class MyMnistDataset(Dataset):
def __init__(self, filePath):
self.myM... | true |
4d284280c1b8602d86f92785245af0fc26438260 | imleibao/web | /shanbay.py | UTF-8 | 7,653 | 2.734375 | 3 | [] | no_license | # -*- coding:utf-8
#TUDO LIST
#1.改掉opener
import gzip
import re
import cookielib
import urllib2
import urllib
import sys
import csv
ABC={'w':['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','Q','W','E','R','T','Y','U','I','O','P','A','S','D','F','G','H','J','K'... | true |
4e5af43bd7436ab9dc6ad94025f5be73233c4e63 | yy2lyx/ML_Mouse_Track_Detection_cluster | /isolationForest.py | UTF-8 | 3,499 | 2.515625 | 3 | [] | no_license | from sklearn.ensemble import IsolationForest
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix,classification_report
from sklearn.preprocessing import scale,Imputer
from hyperopt import fmin,tpe,hp,rand
def isolationForest_hp_all(... | true |
ebe6a89ceb1e0287c550507f9fda8156ff1c2996 | manuhg/agdial | /src/resources/scripts/add_listings.py | UTF-8 | 4,674 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
# pip install --upgrade firebase-admin algoliasearch country_list
import os
import time
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
from firebase_admin import storage
from algoliasearch import algoliasearch
from parse import parse, process_premium... | true |
2f10459b4b734122ea8a0bc4389eb0d917262475 | Rabbi50/PythonPracticeFromBook | /Book Problem/sameName2.py | UTF-8 | 267 | 2.59375 | 3 | [] | no_license | def spam():
global eggs #this is the global
eggs='spam'
print(vacon)
def bacon():
eggs='bacon' #this is the local
def ham():
print(vacon) #this is the global
vacon='global' #this is the global
eggs='eggs' #this is the global
spam()
print(eggs)
| true |
13b1c110f147d5622488bc598d1172999c1ff9d6 | ReactDev1337/PingSomeone | /bot.py | UTF-8 | 487 | 2.640625 | 3 | [
"MIT"
] | permissive | import random
import discord
client = discord.Client()
@client.event
async def on_ready():
print("Running as {}".format(client.user))
@client.event
async def on_message(message):
if "@someone" in str(message.content).lower():
members_array = []
async for member in message.guild.fetch_memb... | true |
37776bf4312ccf65efac45fcddd545b555e39faa | frhuerta/Syllabus | /Ayudantias/08 - Threads/ClassLock.py | UTF-8 | 1,112 | 3.5625 | 4 | [] | no_license | from threading import Thread, Lock
# Este ejemplo es del material de clases, es para cuando se debe bloquear
# un recurso utilizado por TODAS las instancias pertenecientes a una Clase.
# En este caso, se busca bloquear el acceso a un solo archivo
class FileWriter(Thread):
# Creamos el lock para bloquear el acc... | true |
7bceb6a67dc98f7fe98e2838ff206eb4672d1414 | yimejky/fiit-dp-thesis-code | /src/losses/calc_dsc.py | UTF-8 | 1,049 | 2.78125 | 3 | [] | no_license | import logging
def calc_dsc(y_true, y_pred, smooth=1e-6):
logging.debug(f'calc_dsc_helper1 y_true {y_true.shape}, y_pred {y_pred.shape}')
assert y_true.size() == y_pred.size()
y_true = y_true.contiguous().view(-1)
y_pred = y_pred.contiguous().view(-1)
intersection = (y_true * y_pred).sum()
u... | true |
76320d363140f697fee980c329c93e1424fb44fb | SuFizz/dsa-learning | /dijkstra.py | UTF-8 | 1,404 | 3.1875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import math
import heapq
class edge:
def __init__(self,a,b,w):
self.a = a
self.b = b
self.w = w
class vertex:
def __init__(self,index):
self.index = index
self.weights = {}
self.visi... | true |
a7d1eae8c131f97c2363f26f1532bb76a0098d3a | CallanMcNulty/plan-2 | /make-animation.py | UTF-8 | 1,871 | 3.25 | 3 | [] | no_license | """
The animation process:
- Make an animation in Krita and select File>Render_Animation and export as png image sequence to the 'frames' directory
- Run this script with two parameters as follows: python make-animation.py <name_of_animation> <length_in_seconds>
- It will output two files to the 'assets' directory
... | true |
4be67ac126297817cb41d5bcb9d99831efd561b5 | Prasant-Jillella/Python-practice | /sets.py | UTF-8 | 400 | 3.53125 | 4 | [] | no_license | __author__ = 'PrasantJillella'
def check(sets,a):
if a in sets:
print("you already have",a,"in the set")
else:
print(a,"has been added to the set")
sets.add(a)
'''Sets cannot be appended we can use add function in it though'''
sets={"prasant","Santosh","daya"}
check(sets,"prasan... | true |
bade49af3044efa008f6ad9ffdc0022fdebb8440 | chaglare/learning_python | /environments/codetest/findlargest.py | UTF-8 | 145 | 2.84375 | 3 | [] | no_license | def adjacentElementsProduct(inputArray):
for i in range(0, len(inputArray)-1):
lis=(inputArray[i]*inputArray[i+1])
print(lis) | true |
0fec58e2947d20345a932a412f9173c1a96ae4ea | feleHaile/gcpy | /examples/plotting/quickplot.py | UTF-8 | 3,866 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python
'''
quickplot.py: Can be used to generate a quick-look plot of a variable
in a netCDF file. The plotting is bare-bones, without a gridded-map
or choice of color scale. This is useful, for example, when you need to
make a "sanity-check" plot to make sure that a given model output
was generated p... | true |
cd6c7853d0873ca034f4bcf5024ee6e072aa25fd | nabsid1/ML-course | /Task3. assign 3.py | UTF-8 | 1,424 | 3.828125 | 4 | [] | no_license | '''
#Nabeel Siddiqui
#Assignment no.3
Question no.3
Data of global production of CO2 of a place is given between 1970s to 2010. Predict the CO2 production for the years 2011, 2012 and 2013 using the old data set.
'''
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pan... | true |
93a54823d0bd07e889117c99b663825756eab3dd | domantascibas/delta1-droneteam | /delta1-gsm.py | UTF-8 | 1,925 | 2.8125 | 3 | [] | no_license | import serial
port_name = '/dev/ttyAMA0'
port_baudrate = 115200
class GsmModule():
def __init__(self, port, baud):
self.port = port
self.baud = baud
self.serial = serial.Serial(self.port, self.baud)
self.serial.close()
print "GSM object created", port_name, port_baudrate
def openSerial(self)... | true |
c7719f2fd9c1c8eccc977956fa55a7799b3ad017 | JARVVVIS/ds_algo_practice | /recursion/num_dig.py | UTF-8 | 271 | 3.75 | 4 | [] | no_license | ## Find number of digits in a number
def count_dig(num):
if num==0:
return 0
ans = 1+count_dig(num//10)
return ans
def main():
num = int(input()) ## input the number
ans = count_dig(num)
print(ans)
if __name__ == '__main__':
main() | true |
fd532f3b435294f7bb4529c2bd818eb3b7b640b1 | flaviogf/courses | /geral/livro_automatize_tarefas_com_python/capitulo_5_dicionarios.py | UTF-8 | 2,040 | 3.546875 | 4 | [
"MIT"
] | permissive | from functools import reduce
from pprint import pprint
from typing import Dict, List
def main():
# lista_aniversario()
# contagem_de_letras()
# contagem_itens_piquinique()
inventario_de_jogo()
def lista_aniversario():
pessoas = {"Flavio": "13-06-1997", "Fernando": "30-09-1994"}
while True:
... | true |
3ee31454b515d210cdbcc20fdff3e71bb4164805 | emard/ulx3s-misc | /examples/collatz/proj/collatz.py | UTF-8 | 124 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python3
x = 15
while x > 1:
print("%08X" % x)
if (x & 1) != 0:
x = (x*3+1)//2
else:
x = x//2
| true |
a0618bd71cab88db65bb81e9a33b32b2c8cf4520 | quyixiao/python_lesson | /simple/LastMax.py | UTF-8 | 187 | 3.90625 | 4 | [] | no_license | m = int(input('input first number >>>'))
while True:
c = input('Input a number >>>>')
if c :
n = int(c)
if(n > m ):
m = n
print('Max is ', m)
| true |
f89fe94bdeeb66a104771be16b8d59089b58ec39 | ayushganguli1769/dsa_learning_series | /linear/stupid_machine.py | UTF-8 | 496 | 3.125 | 3 | [] | no_license | t= int(input())
for _ in range(t):
n = int(input())
arr = list(map(int,input().strip().split()))[:n]
if n == 0:
print(0)
continue
tot = 0
ceiling_limit = float('inf')
for i in range(n):
tot += min(arr[i],ceiling_limit)
left_condition = i-1 < 0 or arr[i] <= arr[i-1... | true |
50411aa943c56b247c381b57be2165d034e75b3b | rahulbaphana/python_examples | /src/cart/shopping_cart.py | UTF-8 | 374 | 3.15625 | 3 | [] | no_license | import functools
from src.cart.product import Product
class Cart:
products = []
def get_total_price(self):
add = lambda a,b : Product(f"adding ${a.name} ${b.name}", a.price + b.price)
return functools.reduce(add, self.products, Product("Total", 0)).price
def add(self, product, quantity=1)... | true |
a360bbe2ab5725d77bddd4035a3be10d9322cc1f | fyshelab/course-content | /tutorials/W07_Vision_TL/solutions/W7_Tutorial_Solution_Ex05.py | UTF-8 | 1,169 | 3.5 | 4 | [] | no_license | def calculate_pairwise_distances(embedding_tensor: torch.tensor):
"""
This function calculates the pairwise distance between each image embedding in a tensor
Parameters:
embedding_tensor: A num_images x embedding_dimension tensor
Returns:
distances: A num_images x num_images tensor con... | true |
98feb82bfaf67e7747b9298dbc7ccd325161be98 | cbalint13/xls | /xls/dslx/xls_type_error.py | UTF-8 | 3,379 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # Lint as: python3
#
# Copyright 2020 The XLS Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | true |
e9293f49a120d37c8703fcb3821f995301eda7af | critterjohnson/shiftregister | /shiftregister.py | UTF-8 | 2,072 | 2.78125 | 3 | [] | no_license | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
from time import sleep
class ShiftRegister:
def __init__(self, ser, oe, rclk, srclk, srclr):
self.ser = ser
self.oe = oe
self.rclk = rclk
self.srclk = srclk
self.srclr = srclr
GPIO.setup(self.ser, GPIO.OUT, initia... | true |
e3cc972cc12ad22bc977b9831aa8f88efed491dd | skazim/pyImageSearch | /nn.py | UTF-8 | 1,399 | 2.578125 | 3 | [] | no_license | import numpy as np
import os
import random
import cv2
from imutils import paths
import matplotlib.pyplot as plt
image_paths = list(paths.list_images('datasets/animals'))
random.seed(42)
random.shuffle(image_paths)
image = cv2.imread(image_paths[2500])
plt.figure(figsize=(10, 10))
rgb_image = cv2.cvtColor(image, cv2... | true |
af45bda88ca0877d5e53b81f3e39deda1febabb0 | slimaninasreddine/IoT_Attack | /utils.py | UTF-8 | 3,306 | 2.578125 | 3 | [] | no_license | import socket
import pyshark
import os
import numpy as np
valid_ip = ["192.168.1.2", "192.168.1.4", "192.168.1.6", "192.168.1.136"]
valid_mac = ["30:20:10:fb:7c:05", "50:c7:bf:24:c3:f0", "b0:c5:54:2d:c5:09"]
def get_host_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
... | true |
183b02b7110852350292fcad3578529a2eee437b | Aasthaengg/IBMdataset | /Python_codes/p04001/s813165466.py | UTF-8 | 350 | 3.109375 | 3 | [] | no_license | # coding: utf-8
# Your code here!
def insert_str(target, i, char):
return target[:i] + char + target[i:]
def calc(target, i):
global ans
if i >= len(target):
ans += eval(target)
return
calc(target, i+1)
calc(insert_str(target, i, "+"), i+2)
S = input()
N = len(S)
ans = ... | true |
19607ded72ea3c53e531fbd76179ab4512e0aece | AnandBenjamin/daily-pgms-juniors | /Yasar/PersonClass.py | UTF-8 | 327 | 3.90625 | 4 | [] | no_license | class Person:
def __init__(self,name,age):
self.name=name
self.age=age
def func(self):
return "hi iam "+self.name+str(self.age)
#creating an object
P1=Person("yasar",21)
p2=Person("Naveen",21)
#printing the object
print(P1.name)
print(P1.age)
print(P1.func())
print(p2.fu... | true |
8d0db290823ca28e68a006420d7cb68a73075c0a | serikov1/stydy | /общеинженерка/dicimal2binary.py | UTF-8 | 119 | 3.34375 | 3 | [] | no_license | def decimal2binary(value):
return [int (element) for element in bin(value)[2:].zfill(8)]
print(decimal2binary(10)) | true |
fc30ab3a296d3b56a2a760ffe405b746f58d53ce | neelotpal-d/Python_STL | /old_functions/slice_stl.py | UTF-8 | 8,397 | 2.796875 | 3 | [
"MIT"
] | permissive |
######################################################
# Code to create planar slices from a binarySTL file #
# #
# Written by: Neelotpal Dutta #
# [https://neelotpal-d.github.io/] #
##########################################... | true |
c0ef4762ee82b997a9cff452022c98aef1317e21 | daisycoder6/microvectors | /main.py | UTF-8 | 1,052 | 2.96875 | 3 | [] | no_license | from machine import Pin, SPI
import config as cfg
from vectors import vectors
import time
def configure_spi():
"""
Configure SPI
"""
hspi = SPI(1, baudrate=cfg.BAUDRATE, polarity=cfg.POLARITY, phase=cfg.PHASE)
return hspi
def run_vectors(spi):
"""
Writes all vectors over SPI
"""
... | true |
709985ff7b83116485d1fbb9ae04bc0b61f85b0e | olegtropinin/thenewboston-node | /thenewboston_node/core/utils/collections.py | UTF-8 | 756 | 3.234375 | 3 | [
"MIT"
] | permissive | from typing import Union
def deep_update(base_dict, update_with):
for key, value in update_with.items():
if isinstance(value, dict):
base_dict_value = base_dict.get(key)
if isinstance(base_dict_value, dict):
deep_update(base_dict_value, value)
else:
... | true |