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 |
|---|---|---|---|---|---|---|---|---|---|---|
e699aef18dd455ca9ba5e3653f4a6adfd02399c0 | tylerlm/fakesmtp | /fakesmtp.py | UTF-8 | 1,894 | 2.796875 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env python
import os
import smtpd
import asyncore
import time
import argparse
import socket
class FakeSMTPServer(smtpd.SMTPServer):
"""A simple SMTP server that saves mails to a directory instead of sending them"""
def __init__(self, address, port, maildir):
smtpd.SMTPServer.__init__... | true |
13f610ff9975ac520a04ce425b1080bd0303f117 | willisdc/PhysiCell_Studio | /PhysiCell-model-builder/bin/contour2.py | UTF-8 | 812 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable
import numpy as np
a = np.arange(10)
bb, cc = np.meshgrid(a, a)
u = np.random.randint(2, 4, (10, 10))
v = np.random.randint(2, 4, (10, 10))
fig = plt.figure(figsize=(6, 6))
ax = fig.add_subplot(111)
# create axes for... | true |
55ecb3aa4a9195152efed9422d7d056997a8b545 | abbasrazaali/Meta-Reinforcement-Learning | /src/datasets/tiny_imagenet.py | UTF-8 | 2,861 | 2.71875 | 3 | [] | no_license | """CIFAR10 small images classification dataset.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from PIL import Image
import numpy as np
import os
def load_data(path):
"""Loads tiny_imagenet dataset.
# Returns
Tuple of Numpy arrays: `(... | true |
ea336d6aaa24db801a3ab2496ee43a0520b513fe | fendou201398/code_interview | /依图/3.py | UTF-8 | 926 | 2.578125 | 3 | [
"MIT"
] | permissive | def fun(a0,M)->list:
m=len(M)
L=[l for l,r in M]
R=[r for l,r in M]
L.sort()
R.sort()
# a=a0.copy()
a=[a0[0]]
for aa in a0:
while aa!=a[-1]:
a.append(aa)
a.sort()
li,ri=0,0
da={}
h=0
for aa in a:
while li<m and L[li]<=aa:
li+=1
... | true |
856cf5f3876f982444728bf323796688a2168112 | infiniityr/circle-follower | /oldVersion.py | UTF-8 | 3,564 | 2.640625 | 3 | [] | no_license | import os
import matplotlib.pyplot as plt
import numpy as np
import cv2
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib import colors
from dotenv import load_dotenv
def getCirclesColor(img, color):
frame_gau_blur = cv2.GaussianBlur(frame, (21, 21), 0)
# converting BGR to HSV
... | true |
782d5789b2d3b40a81b0a45bc9aa794994e9136f | nledez/check_mail_server | /common.py | UTF-8 | 344 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
def show_ok(service):
# print('{} \033[32mOK\033[37m'.format(service))
print('✅ {}'.format(service))
def show_ko(service, hint, error=None):
# print('{} \033[31mKO\033[37m'.format(service))
print('🚨 {}'.format(service))
if error:
print(err... | true |
fa9306181b4ad584905d80fede9a9c11a643d7a1 | snpushpi/P_solving | /926.py | UTF-8 | 1,325 | 4.1875 | 4 | [] | no_license | '''
A string of '0's and '1's is monotone increasing if it consists of some number of '0's (possibly 0), followed by some number of '1's (also possibly 0.)
We are given a string S of '0's and '1's, and we may flip any '0' to a '1' or a '1' to a '0'.
Return the minimum number of flips to make S monotone increasing.
Ex... | true |
29ccb1d6a23d31d009b375973ee81d724c26e8af | sergioandyp/TC-TP4 | /FilterTool/src/ui/widgets/PlotWidget.py | UTF-8 | 4,923 | 2.890625 | 3 | [] | no_license | # ------------------------------------------------------
# -------------------- PlotWidget.py --------------------
# ------------------------------------------------------
import sys
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QFileDialog, QToolButton, QWidget, QVBoxLayout
from matplotlib.f... | true |
5eeba0e854207292a4ef896e69fc562de5ca0481 | AGiantSquid/advent_of_code | /python/2020/day_11/day_11_test.py | UTF-8 | 3,864 | 3.09375 | 3 | [] | no_license | '''
Demonstrates that code works for day 11.
'''
from aoc_utils import get_aoc_data_for_challenge
from day_11 import draw_new_map, part_1, part_2, check_for_occupied_in_sight, draw_new_map_2
PUZZLE_DATA = get_aoc_data_for_challenge(__file__, filter_nulls=False)
DATA = [
'L.LL.LL.LL',
'LLLLLLL.LL',
'L.L.L.... | true |
5269f58890790f2a8ed9e65bd02251220949cf16 | Aasthaengg/IBMdataset | /Python_codes/p02397/s833167108.py | UTF-8 | 176 | 3.515625 | 4 | [] | no_license | while 1:
x, y = map(int, raw_input().split())
if x == 0 and y == 0:
break
else:
if x > y:
temp = x
x = y
y = temp
print '{0} {1}'.format(x, y) | true |
4d0a62eed2bf94fd7696e31f0dfc1744c07f944d | bhargavi170498/18MCA158_18MCA159 | /ict_proj.py | UTF-8 | 1,455 | 2.90625 | 3 | [] | no_license | from tkinter import Tk , StringVar , ttk
from tkinter import *
import time
import datetime
val = Tk()
val.title("Real Time Currency Converter")
val.geometry('1000x300+0+0')
val.configure(background = 'black')
LeftMainFrame = Frame(val, width=660, height=400, bd=8, relief='raise')
LeftMainFrame.pack(side=LEFT)
RightMa... | true |
7b745029bfc454042e197d1bf2b4ab38a586ba96 | YosriGFX/holbertonschool-machine_learning | /supervised_learning/0x06-keras/13-predict.py | UTF-8 | 258 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
'''Predict File'''
import tensorflow.keras as K
def predict(network, data, verbose=False):
'''Function that makes a prediction
using a neural network'''
return network.predict(
data,
verbose=verbose
)
| true |
90a0aa235d08e104bc7e4e5fbb049d07e886bef4 | MihalachiBogdanMarian/servport | /datascience/clustering/evaluate_algs.py | UTF-8 | 3,300 | 2.765625 | 3 | [] | no_license | import numpy as np
from birch_library import *
from clustering_utils import *
from kmeans_library import *
from vectorized_kmeans import *
def find_best_k_elbow_method(
service_vectors,
algorithm,
min_k,
max_k,
similarity_measure="minkowski",
minkowski_r=2,
):
sse = []
for k in range(... | true |
c27e2b3641ba698135f9cc039400d784ac4c8f28 | mpses/AtCoder | /Contest/ABC181/b/main.py | UTF-8 | 193 | 3.125 | 3 | [
"CC0-1.0"
] | permissive | #!/usr/bin/env python3
(n,), *d = [[*map(int, o.split())] for o in open(0)]
c = 0
for a, b in d:
m = (b - a + 1)
c += (a + b) * (m // 2)
if m % 2:
c += (a + b) // 2
print(c) | true |
f86958101128b89140e0a166a96112c12f1e4418 | igor2286/python | /coax.py | UTF-8 | 2,028 | 3.65625 | 4 | [] | no_license | import pandas as pd
import os
class WorkWithFile:
def __init__(self):
self.FILENAME = input('write the name of file: ') + '.csv'
self.file = open(self.FILENAME, 'a')
def create_headers(self):
header = ['author_name', 'note', 'rating']
self.file.writelines(str(header) + os.line... | true |
8ffe1829a0e7718644ab21a3e5a7a6b401498756 | ivelinakaraivanova/SoftUniPythonAdvanced | /src/File_Handling_Lab/03_File_Writer.py | UTF-8 | 179 | 2.890625 | 3 | [] | no_license | file_path = 'D:/Iva/Python Advanced/Materials/Exercises/08-File-Handling-Lab-Resources/my_first_file.txt'
file = open(file_path, 'w')
file.write('I just created my first file!')
| true |
9034a25eebba83fe8bccf5fd109e0dcb442c37f3 | riyaddude/Mailbomber | /mailbomber.py | UTF-8 | 1,471 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python
### random subjects created automatically to show each mail as a differnt or unique conversatio ##
## mail bomber to send as much as mails to someone as you want to
## works only for gmail server i.e. senders mail should be of gmail and reciever could have any mail server
## made by shubham kumar... | true |
be6c934a143be27833fe935f6d9acacf5180b226 | project-mh/Realsense_camera-T265-D435i | /그 외 자료/test5_t265 position mapping.py | UTF-8 | 440 | 2.515625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pyrealsense2 as rs
import time
cfg = rs.config()
cfg.enable_stream(rs.stream.pose)
pipe = rs.pipeline()
pipe.start(cfg)
try:
while(1):
frames = pipe.wait_for_frames()
pose = frames.get_pose_frame()
if pose:
data = pose.ge... | true |
5c865ff658ff76721978ea11ff3c3c918fd39df7 | Ekco04/Mi_primer_programa_2 | /caculadora.py | UTF-8 | 1,176 | 4.1875 | 4 | [] | no_license | operación = input('!Hola¡ ¿Qué operacion quieres realizar? (Suma / Resta / Multipilicaión / División):')
while operación == 'Suma':
primer_numero = int(input('Dame el primer número: '))
segundo_numero = int(input('Dame el segundo número:'))
resultado = primer_numero + segundo_numero
print('El resultado... | true |
0461e738b25f6a91e0a0ae3d39b72c54eb8a2e59 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_143/930.py | UTF-8 | 368 | 3.34375 | 3 | [] | no_license | def process_input(A,B,K):
result = 0
for i in range(A):
for j in range(B):
if(i&j < K):
result += 1
return result
def main() :
T = int(input())
for i in range(T):
(A,B,K) = [int(e) for e in input().split()]
print( 'Case #'+str(i+1)+':',process_input(A,B,... | true |
b314c35621579186382c9d273b8430bbb9d5b365 | Ironhunter95/CodeForces-Solutions | /231A-Team.py | UTF-8 | 264 | 3.09375 | 3 | [] | no_license | numofLines = int(input())
c=0
c2=0
for x in range(numofLines):
n = input()
newn =''.join(n.split())
for x in newn:
x2=int(x)
if x2>0:
c=c+1
if c>1:
c2+=1
c=0
else:
c=0
print(c2) | true |
406b27eaa28287b25af809fb706eef015b55a5f6 | jeong-tae/ABCNN | /models/util.py | UTF-8 | 2,769 | 2.6875 | 3 | [] | no_license | import cPickle
import numpy as np
import os
import sys
import io
from tqdm import tqdm
import pdb
def gloveLoad(glove_fpath, vocab):
embed_path = glove_fpath + ".embed.pkl"
word2vec_path = glove_fpath + ".word2vec.pkl"
embed = None
word2vec = {}
flag = None
if os.path.exists(word2vec_path):
... | true |
369937794ff2fa76ccbd6663c200128f808af318 | git123hub121/Python-basickonwledge | /函数和控制流/while语句.py | UTF-8 | 289 | 3.953125 | 4 | [] | no_license | number = 23
running = True
while running:
guess = int(input('Enter a integer: '))
if guess == number:
print('yes')
running = False #这将导致while循环中断
elif guess < number:
print('g<n')
else:
print('g>n')
print('程序结束')
| true |
21b1b49ca95795eb77c8169a9b9dbb39acaf4563 | akshya672222/PycharmProjects | /untitled/SSW540_ASSIGNMENT/Assignment11_AkshaySunderwani_SSW540.py | UTF-8 | 864 | 3.296875 | 3 | [] | no_license | # SSW 540 - Assignment 11 - P11: Browsing the Web
# Akshay Sunderwani
try:
import urllib.request as urllib2
except ImportError:
import urllib2
import io
import re
url_input = input('Please enter the URL: ')
response = ''
try:
req = urllib2.Request(url_input, headers={'User-Agent': 'Mozilla/5.0'})
re... | true |
c175c5ac9d9f7a868b40e744ce0744d4fb9874cd | W0r5t/Python-Journey | /Basics/Python_-_Indentation.py | UTF-8 | 495 | 4.59375 | 5 | [] | no_license | Python = 5 #We have Declared The Value of Python as 5
if Python == 5: #The if Statement creates a condition when the "==" is used,
#We are using the == to say if the answer is equivalent to
#The Following value (5)
print("This line is indented by 4 Spaces when we use the If Func... | true |
35da990aaa29a5706fcbb4c5a51af0208b9d87b4 | BXYMartin/Python-IrradPy_Visualization | /china_irradiance_visualization.py | UTF-8 | 2,844 | 2.6875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import pickle
import pandas as pd
from matplotlib.colors import LinearSegmentedColormap
import os
import cartopy.feature as cfeat
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
from cartopy.io.shapereader i... | true |
75abd1c5ff84aac25817fcc4f7347e7d06f809f5 | nealebanagale/python-training | /02_Overview/function.py | UTF-8 | 246 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python3
# Copyright 2009-2017 BHG http://bw.org/
def function(n=1):
print(n)
return n * 2
function(47)
function()
x = function(42) # all functions returns a value
print(x)
# default value of none - absence of a value
| true |
fe8664f5d2855321934cba2d6da853c0698c3bf5 | junfang219/UnscrambleComputerScienceProblems | /Task4.py | UTF-8 | 1,726 | 4.21875 | 4 | [] | no_license | """
Read file into texts and calls.
It's ok if you don't understand how to read files.
"""
import csv
with open('texts.csv', 'r') as f:
reader = csv.reader(f)
texts = list(reader)
with open('calls.csv', 'r') as f:
reader = csv.reader(f)
calls = list(reader)
"""
TASK 4:
The telephone company want to i... | true |
ab798c2724bf1992470be846ce7c959aee1e7ce4 | wpuatua/2018-agu-workshop | /data_analysis.py | UTF-8 | 1,032 | 3.265625 | 3 | [
"MIT"
] | permissive | """
These are my data analysis functions ueed to download and process some temperature time series from Berkeley Earth.
"""
import numpy as np
import requests
def generate_url(location):
url = f'http://berkeleyearth.lbl.gov/auto/Regional/TAVG/Text/{location.lower()}-TAVG-Trend.txt'
return url
def download_d... | true |
5247ea7de386d2d12b74514ad3b822667f765ae9 | BlueLens/stylelens-object | /sample/update_objects.py | UTF-8 | 606 | 2.640625 | 3 | [] | no_license | from __future__ import print_function
from stylelens_object.objects import Objects
from pprint import pprint
# create an instance of the API class
api_instance = Objects()
objects = []
object = {}
object['name'] = 'a1'
object['index'] = 1
object2 = {}
object2['name'] = 'a2'
object2['index'] = 2
object3 = {}
object3[... | true |
a2af65016d46c6160874c6b04a820ff4ce7477f6 | GraceTeran/python-notes | /function_notes.py | UTF-8 | 2,435 | 4.34375 | 4 | [] | no_license | import pandas as pd #this imports pandas as pd
import seaborn as sns #seaborn is imported as sns as opposed to sb because the dude who develpoed it was/is Samuel Nicholas Seaborn
from matplotlib import pyplot as plt #imports something to do with plots
#functions
_________________________________________________... | true |
70992dfcac9c206e4509e5136a15917f29e69b67 | IrinaShcherbakova/Leetcode-Python | /leetcode/easy/check_sorted_rotated.py | UTF-8 | 628 | 3 | 3 | [] | no_license | class Solution:
def check(self, nums: List[int]) -> bool:
rotate_point = -1
for i in range(1, len(nums)):
if nums[i] < nums[i-1]:
rotate_point = i
break
if rotate_point < 0:
return True
cur = rotate_po... | true |
e94e8afbe771c1b487f330265bb7bf91491c2b5a | GOTOYT/firsttest | /scraping/get_hutaba.py | UTF-8 | 420 | 2.921875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
sach={'q':'Python', 'users':'1000'}
url = 'http://b.hatena.ne.jp/search/text'
req = requests.get(url, params = sach, timeout = 15)
print(req)
soup = BeautifulSoup(req.text, 'html.parser')
bookmarks = []
for b in soup.findAll('h3', {'class':''}):
title = b.find('a').... | true |
823cef4610f43a634277af46d62243d8f4d1e7aa | adhawkins/slimxmlcat | /SqueezeCenter/CLI/CLIComms.py | UTF-8 | 3,810 | 2.65625 | 3 | [] | no_license | import socket
import urllib
import sys
from SqueezeCenter.Database import Album
from SqueezeCenter.Database import Track
def tracksort(x,y):
if x.discnum()==y.discnum():
return x.tracknum()-y.tracknum()
else:
return x.discnum()-y.discnum()
class CLICommsException(Exception):
def __init__(self,message):
sel... | true |
dead9942ec5e94bf62272491310c6ddb412c14ec | PYHSUEH/python | /python_network_programming/print_machine_info.py | UTF-8 | 259 | 2.953125 | 3 | [] | no_license | import socket
def print_machine_info():
host_name=socket.gethostname()
ip_address=socket.gethostbyname(host_name)
print ("Host name: %s" % host_name)
print ("IP address: %s" % ip_address)
if __name__ == '__main__':
print_machine_info()
| true |
288aa58de3c0587a655330448388088aad90c03b | Fleshwounded/am-i-pwned | /source_code/am-i-pwned.py | UTF-8 | 2,269 | 3.09375 | 3 | [
"MIT"
] | permissive | #!/bin/env python
# Author : Stavros Grigoriou
# GitHub : https://github.com/unix121
# Date : 15 September 2017
# Last Update : 15 September 2017
# Description : Python script that uses the APIs of:
# https://haveibeenpwned.com
# https://hacked-e... | true |
845663fef62c71242d19a7960880d3fd9c8ccfa2 | GersonQuintana/201908686-P2-Backend | /Comentarios.py | UTF-8 | 699 | 3.515625 | 4 | [] | no_license | class Comentario:
def __init__(self,cancion,persona,comentario):
self.cancion = cancion
self.persona = persona
self.comentario = comentario
print("La persona es ", persona)
print("El comentario es ",comentario)
#METODOS - GET
def getCancion(self):
ret... | true |
00386ce676543389dc8be3d4928b0064aad36edc | chauhoagnhat/Hoc-Lap-Trinh | /oop_3.py | UTF-8 | 1,188 | 2.828125 | 3 | [] | no_license | class sieunhan:
suc_manh = 9595
def __init__(self, para_ten, para_vukhi, para_mau):
self .ten = "sieu nhan " + para_ten
self .vukhi = para_vukhi
self .mau = para_mau
@classmethod
def cap_nhat_suc_manh(cls,smanh):
cls.para_ten = smanh+smanh
sieu_nhan_A = sieunhan("do",'gao... | true |
1b1e9f56a24c3fc28c8361c993bc32cf8b1bb326 | jackmacattack/Fred | /shelvemod.py | UTF-8 | 1,465 | 2.921875 | 3 | [] | no_license | import shelve
class DataFile:
def __init__(self, filename):
self.data = shelve.open(filename)
def add_user(self, name, pword, q, a, file_count):
if (self.data.has_key(name) == False):
self.data[name] = {'password': pword, 'question': q, 'answer': a, 'file_count': file_count}
... | true |
31e0accf6e6435d496120bf06caa605dc49a6a60 | Gazorkazork/django_be | /util/room_layout.py | UTF-8 | 13,872 | 3.4375 | 3 | [] | no_license | import random
class Protoroom:
# When integrating this into the actual code, replace this
# class with the actual room class. Adjust as needed.
def __init__(self, coord, north=None, south=None, east=None, west=None):
self.coord = coord
self.north = north
self.south = south
s... | true |
b40eb89314adf57f00a19ee46d80d70ffed500e5 | matplotlib/mpl-bench | /benchmarks/dates.py | UTF-8 | 1,115 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import matplotlib.dates as mdates
import datetime
import numpy as np
class DatetimeSuite:
@staticmethod
def _datetime_range(startDate, endDate, deltaDate):
current = startDate
while c... | true |
6d987876ef9ad28dabf3a4941bbe5c628042749b | NickRuiz/lattice-align | /preprocess/nbest-fst.py | UTF-8 | 1,579 | 2.6875 | 3 | [] | no_license | '''
Created on Sep 10, 2014
@author: Nick
'''
import sys
def main(args):
"""
cat >text.fst <<EOF
0 1 a x .5
0 1 b y 1.5
1 2 c z 2.5
2 3.5
EOF
"""
nbest_file = sys.argv[1]
fst_file = sys.argv[2]
isyms_file = sys.argv[3]
osyms_file = sys.argv[4]
idx_count = 0
... | true |
3514f2e23ca4b6e2a5e5875ef1c0733aae0f88d1 | rizwan-ai/AI-AP | /UMLPyOOPProject/batch.py | UTF-8 | 701 | 2.765625 | 3 | [] | no_license | from course import Course
from teacher import Teacher
from student import Student
class Batch:
def __init__(self, b_id=None, b_name=None):
self.b_id = b_id
self.b_name = b_name
self.course = Course()
self.teacher = Teacher()
# self.student = Student() # for one studen... | true |
190c0e1927da7637a5b118456f72d5655964ea84 | vamshigunji183/pygame | /snakegame/snakegame.py | UTF-8 | 2,700 | 3.328125 | 3 | [] | no_license | import pygame
import time
import random
pygame.init()
display_width=800
display_height=600
black=(0,0,0)
white=(255,255,255)
red=(255,0,0)
block_size = 10
gameDisplay = pygame.display.set_mode((display_width, display_height))
pygame.display.set_caption('SnakeGame')
clock = pygame.time.Clock()
def food(foodx, foo... | true |
1478684de1e4edeac8afe7f175e3cad643740b99 | tominkoooo/advent_of_code_2019 | /adventofcode4/task1.py | UTF-8 | 970 | 3.359375 | 3 | [] | no_license | import numpy as np
def password_checker(number):
adjacent = same_adjacent_digits(number)
increase = increasing_numbers(number)
if adjacent and increase:
return 1
else:
return 0
def same_adjacent_digits(number):
number = str(number)
if number[0] == number[1]:
return Tr... | true |
57af1a233188efa0ef00cfe8f488481f064cec35 | cgoeke/python-crash-course | /exercises/chapter-10/common_words.py | UTF-8 | 837 | 4.28125 | 4 | [] | no_license | # 10-10. Common Words: Visit Project Gutenberg (http://gutenberg.org/ )
# and find a few texts you’d like to analyze. Download the text files for these
# works, or copy the raw text from your browser into a text file on your
# computer.
# You can use the count() method to find out how many times a word or
# phrase appe... | true |
bf52d1048cfe6450bd06219ed76911c46e34769c | bragon9/leetcode | /759EmployeeFreeTime.py | UTF-8 | 880 | 2.96875 | 3 | [] | no_license | class Solution:
def employeeFreeTime(self, schedule: '[[Interval]]') -> '[Interval]':
sorted_sched = []
for employee_sched in schedule:
for interval in employee_sched:
sorted_sched.append((interval.start, interval.end))
sorted_sched.sort(key=lambda x:(x[0], -x[1])... | true |
e81e5c9b2a9c522b429ee51b284564a8579be07a | gsomani/computational-physics | /HW6/GauravSomani_HW6/1/1.py | UTF-8 | 1,172 | 2.84375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 18})
plt.rcParams["figure.figsize"] = (16,16)
N=100
L=10
r=[2,8]
V=1
def set_region(reg,f,N,L,r,V):
g=[r[0]*N//L,r[1]*N//L]
for i in range(g[0],g[1]+1):
reg[i][g[0]]=1
f[i][g[0]]=V
reg[i][g[1]]=-1
... | true |
ac013f600c53bd060ff601fbb3fc723809132001 | daniel-reich/turbo-robot | /uojwbCn2yyqqk9Wpf_12.py | UTF-8 | 1,924 | 4.3125 | 4 | [] | no_license | """
A positive number greater than 1 can be defined untouchable when it's not
equal to the sum of the proper divisors (called also _aliquot sum_ ) of any
other positive number, in a range starting from 2 and ending with the square
of the given number (bounds included).
Given an integer `number`, implement a functio... | true |
3137d6e387351ac63b21ed828e62b07f887592e8 | yangao118/exercises | /CLRS/C7_quicksort/hoarse-quicksort.py | UTF-8 | 976 | 3.65625 | 4 | [] | no_license | #!/usr/bin/env python
import random
# Quick sort using hoarse partition is not stable sort either!
# Think about this array:
# 4 3 2 5 2 4 5 2 5
def hoare_partition(A, p, r):
x = A[p]
i = p - 1
j = r + 1
while True:
j -= 1
while A[j] > x:
j -= 1
i += 1
w... | true |
5043ed73092bf9a3f04982d57c7a4eff2d656a56 | openml-labs/gama | /gama/genetic_programming/components/individual.py | UTF-8 | 6,661 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | import uuid
from typing import List, Callable, Optional, Dict, Any
from sklearn.pipeline import Pipeline
from .fitness import Fitness
from .primitive_node import PrimitiveNode
from .terminal import Terminal
class Individual:
"""Collection of PrimitiveNodes which together specify a machine learning pipeline.
... | true |
39e1b55576f91b5c8ef571ab35ea0b00923539a2 | Varinder148/AttendanceWithFaceRecognition | /Project Face/prepdata.py | UTF-8 | 1,797 | 2.703125 | 3 | [] | no_license | import cv2
import mysql.connector
# setting up db connection and db cursor
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="shubh" # mysql password
)
mycursor = mydb.cursor()
mycursor.execute("use test;")
mycursor.execute("select max(id) from a... | true |
4a490d46578c0e350ab8e95ded32a5b76648eac3 | DennisHgj/pyela | /ela/classification.py | UTF-8 | 11,113 | 2.8125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from __future__ import print_function # anything else?
import pandas as pd
import numpy as np
from ela.textproc import PRIMARY_LITHO_COL, SECONDARY_LITHO_COL
from ela.spatial import *
def to_litho_class_num(lithology, kv):
"""Get a numeric code for a lithology, or NaN if not in the dictionary mapping lithologies... | true |
fccec8e678285b09db0e609efb47b0462438d94a | amanptl/LeetCode | /Easy/Valid Anagram_302477339.py | UTF-8 | 276 | 2.890625 | 3 | [] | no_license | class Solution:
def isAnagram(self, s: str, t: str) -> bool:
from collections import defaultdict
a = defaultdict(int)
b = defaultdict(int)
for i in s:
a[i]+=1
for i in t:
b[i]+=1
return a==b
| true |
f87d17f8a980f8f5f8646f6f7aafedf56a818ab0 | maxschau/IINI4014---Python-for-programmers | /Øving4/drawing.py | UTF-8 | 1,167 | 3.671875 | 4 | [] | no_license | import math
import turtle
def PointsInCircumList(r, n=150, multiplier=2): #Method which generates a list with the x and y positions of the dots on the perimeter
return [(math.cos(2*math.pi/n*x)*r, math.sin(2*math.pi/n*x)*r) for x in range(0, n+1)]
def PointsInCircum(r, n=150, multiplier=2):
for x in range(0,... | true |
bab91ad5854d415fbeebc79d7b713280d9402885 | ivanpauno/filter_design_examples | /filter_utils.py | UTF-8 | 4,435 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: ivanpauno
@description: A collection of functions for designing and plotting filters.
"""
import numpy as np
import scipy.signal as sig
import matplotlib.pyplot as plt
def butter(wp, ws, gpass, gstop):
n, wb = sig.buttord(wp, ws, gpass, gstop, analog=Tr... | true |
3b735fb2ff1735d9eb6ee9e3eb3bb033ae4e299f | ourway/Edge-Detection-on-Videos | /EdgeonVideo.py | UTF-8 | 762 | 2.703125 | 3 | [] | no_license | import cv2
cap = cv2.VideoCapture('<<< Give input Video File Name with the path in System >>>')
fourcc = cv2.VideoWriter_fourcc('X', 'V', 'I', 'D') # Try MPV4 for higher quality encoding
out = cv2.VideoWriter('output_vid.avi',fourcc, 30.0,(int(cap.get(3)),int(cap.get(4))),False)
while(cap.isOpened()):
ret, frame ... | true |
8743ccc9752803939e1ce2dbec76ace7ffb1bd5d | florekem/python_projekty | /zadanie3.py | UTF-8 | 133 | 2.6875 | 3 | [] | no_license | import re
zadanie = open('szyfr2.txt', 'r').read()
p = re.compile('[a-z][A-Z]{3}([a-z])[A-Z]{3}[a-z]')
print(p.findall(zadanie))
| true |
4f995e539c87fe41dc0b252a857be4f6e2dc0c0e | andrelmfarias/PySyft | /syft/frameworks/torch/crypto/beaver.py | UTF-8 | 1,206 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | import torch
from typing import Callable
from syft.workers.abstract import AbstractWorker
def request_triple(
crypto_provider: AbstractWorker,
cmd: Callable,
field: int,
a_size: tuple,
b_size: tuple,
locations: list,
):
"""Generates a multiplication triple and sends it to all locations.
... | true |
0753e9979f3617cd93a0a84515c6df68bbc15039 | manzeelaferdows/exercise16 | /bank_process.py | UTF-8 | 246 | 2.78125 | 3 | [] | no_license | from bank_account import Account
from saving_account import Saving_Account
joint_account = Account(9)
savings_account = Saving_Account(50)
print(joint_account.withdrawn(10))
print(savings_account.deposit(300))
print(joint_account.balance)
| true |
5419196a12251992d0d43bb4ccbcc4ffb59d3fbb | pathaniaVikas/chat_app | /reciever.py | UTF-8 | 929 | 3.03125 | 3 | [] | no_license | import socket
from utils import printl
from config_parser import config
user_name = socket.gethostname()
def receiver(ip, port):
if type(port) is str:
port = int(port)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_addr = (ip, port)
printl('starting server on %s po... | true |
1ce9e3677f7e37fda818dc4463b9402a0f7be7fd | Insper/design-de-software-exercicios | /challenges/soma-valores-da-lista/solution.py | UTF-8 | 93 | 2.9375 | 3 | [] | no_license | def soma_valores(lista = []):
sum = 0
for i in lista:
sum += i
return sum | true |
ab5724b3a92ce493865f3ae8eab1cf724aa53c03 | agerista/HR_30_Days | /phone_a_friend.py | UTF-8 | 512 | 3.734375 | 4 | [] | no_license | def phone_lookup():
n = int(raw_input())
i = 1
phone_numbers = {}
while i <= n:
numbers = raw_input().strip().split(" ")
phone_numbers[numbers[0]] = numbers[1]
i += 1
while True:
numbers = raw_input().strip()
if not numbers:
break
if... | true |
297d6ab0e7c80c28c94a222415f34e98a10fd7a0 | kznovo/atcoder | /abc173/python/C.py | UTF-8 | 775 | 2.65625 | 3 | [] | no_license | from copy import deepcopy
from itertools import combinations, product
H, W, K = map(int, input().split())
board = []
for _ in range(H):
row = input()
row = [r == "#" for r in row]
board.append(row)
all_h_comb = [()]
for r in range(1, H):
comb_obj = combinations(range(H), r)
all_h_comb += list(comb... | true |
02be24aa4cb900051bc09aaef57a96e34802d07e | zhaohang921/Python_Learn | /500_lines_or_less/A_Simple_Object_Model/Instance.py | UTF-8 | 965 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/3/12 18:58
# @Author : Zhaohang
'''
构造函数Instance将该类实例化并将其初始化fields dict为空字典。
'''
from Base import Base,MISSING
from Class import Class
from Map import Map,EMPTY_MAP
class Instance(Base):
"""Instance of a user-defined class. """
def __init__(se... | true |
d778a64269546144be7b58a8a916f6f626759904 | kamineedyou/pccip | /passage_decomp/pd/import_log.py | UTF-8 | 966 | 2.9375 | 3 | [] | no_license | from pm4py.objects.log.importer.xes import importer as xes_importer
from pm4py.objects.log.log import EventLog
from typing import Union
def import_log(xes: Union[EventLog, str]) -> EventLog:
"""Import event log from file or return EventLog object if it was used
as parameter.
Args:
xes (Union[Even... | true |
24608b67d497bbcdd079300591b18a607c112f49 | BlaiseMarvin/Machine-Learning-with-scikit-learn-series | /emucheck.py | UTF-8 | 408 | 2.84375 | 3 | [] | no_license | import numpy
from sklearn.datasets import load_breast_cancer
import pandas
cancer=load_breast_cancer()
def answer_one():
"""converts the sklearn 'cancer' bunch
Returns:
pandas.DataFrame: cancer data
"""
data = numpy.c_[cancer.data, cancer.target]
columns = numpy.append(cancer.feature_names, ["... | true |
b9131571f8454fb809ec04165ee2fbfce5960771 | Md-Monirul-Islam/Python-code | /Matplotlib/26-Setting The Label To The Axis-1.py | UTF-8 | 210 | 2.921875 | 3 | [] | no_license | import matplotlib.pyplot as plt
plt.plot([1,2,3,4],[10,20,30,40])
plt.xlabel("x label",{"size":15,"color":"cyan"},labelpad=10)
plt.ylabel("y label",{"color":"blue","size":15})
plt.title("first plot")
plt.show() | true |
e345e15f10f732f73bc9f7d0ff025702777d567b | melissa-rauch/oo-desserts | /desserts.py | UTF-8 | 578 | 2.640625 | 3 | [] | no_license | """Dessert classes."""
class Cupcake:
"""A cupcake."""
def __repr__(self):
"""Human-readable printout for debugging."""
return f'<Cupcake name="{self.name}" qty={self.qty}>'
if __name__ == '__main__':
import doctest
result = doctest.testfile('doctests.py',
... | true |
e4d9f7eeda90a156f109a961521498be3f487abb | Priyanshu-C/CodeForcesCodes | /1097A_GennadyAndACardGame.py | UTF-8 | 95 | 3.171875 | 3 | [] | no_license | a = str(input())
b = str(input())
if a[0] in b or a[1] in b:
print("YES")
else:
print("NO") | true |
f5e38763cfd3968f94c133bcb4130710de1f34b3 | udhayprakash/PythonMaterial | /python3/11_File_Operations/09_temp_files/a_temp_files.py | UTF-8 | 179 | 2.53125 | 3 | [] | no_license | import tempfile
print(f"{tempfile.gettempdir() =}")
print(f"{tempfile.gettempdirb() =}")
print()
print(f"{tempfile.gettempprefix() =}")
print(f"{tempfile.gettempprefixb() =}")
| true |
fce779bcdefc43f1de699334f10bb056a755db9f | hyraxbio/simulated-data | /seq2simulate/maf2sam.py | UTF-8 | 2,120 | 2.9375 | 3 | [] | no_license | from itertools import islice
import shutil
def parse_maf(ref, seq, ref_name="HXB2_pol"):
""" The MAF format is:
a
s ref START_POSITION LENGTH ORIENTATION TOTAL_LENGTH SEQUENCE
s READ_ID START_POSITION LENGTH ORIENTATION TOTAL_LENGTH SEQUENCE
This function takes the second two lines above and returns a single... | true |
f9b2f9d89e89171e3cabbfbd36cdf9a289acd645 | pacellyjcax/ProgrammingChallenge | /URI/1120 - Revisão de Contrato.py | UTF-8 | 284 | 2.796875 | 3 | [] | no_license | def calcula(lX):
lf = [v for v in lX[1].strip() if v!= lX[0]]
if len(lf) == 0:
return 0
return int("".join(lf))
it = []
while 1:
d = raw_input()
if d == "0 0":
break
it.append(calcula(d.split()))
for e in it:
print e
| true |
4478ce3011528a8012a623580023956d093cdcfc | ymwondimu/PracticeAlgos | /test_stack_from_queues.py | UTF-8 | 290 | 3.015625 | 3 | [] | no_license | from PracticeAlgos.stack_two_queues import StackQueues
def main():
stack = StackQueues()
stack.push(1)
stack.push(2)
stack.push(3)
stack.print()
stack.pop()
stack.print()
stack.pop()
stack.print()
stack.pop()
if __name__ == "__main__":
main() | true |
d39bb1cb05e03765e52ca3a4ffc5e3ac055e02f6 | woniuge/basicCode_Python | /liaoxuefeng/OOP/多线程/Lock_test.py | UTF-8 | 1,925 | 4.0625 | 4 | [] | no_license | #-*- coding:utf-8 -*-
'''
#我们定义了一个共享变量balance,初始值为0,并且启动两个线程,
# 先存后取,理论上结果应该为0,但是,由于线程的调度是由操作系
# 统决定的,当t1、t2交替执行时,只要循环次数足够多,balance的
# 结果就不一定是0了。
import time,threading
#假定这是你的银行存款:
balance = 0
def change_it(n):
#先存后取,结果应该为0:
global balance
balance = balance + n
balance = balance - n... | true |
10639669b55505e087e61b985aa0822b4142bfdb | MatP49/IXN_gosh_translation | /lib/assets/python/raspberry2.py | UTF-8 | 430 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python3
from urllib.request import urlopen
import re
from Crypto.Cipher import AES
import base64
html = urlopen("http://babelraspberry.ddns.net/")
scraping = html.read().decode('utf-8')
result = re.search('<p>(.*)</p>', scraping)
key = 'ASSWJDWHJ9748hJSJWK8983jJKJS990S'
data = result.group(1)
ciphe... | true |
c1fe7de13b73262170aefdd095d4ea3fce90dd3c | trojanosall/Python_Practice | /Basic_Part_1/Solved/Exercise_115.py | UTF-8 | 197 | 4.25 | 4 | [] | no_license | # Write a Python program to compute the product of a list of integers (without using for loop).
num_list = [1 , 2, 3, 4, 5, 6]
sum_of_list_of_integer = sum(num_list)
print(sum_of_list_of_integer) | true |
2d87c7cf38d37d68fbb872e43976bf052db4ddaa | zengzhaoyang/maskrcnn-benchmark | /maskrcnn_benchmark/layers/smooth_l1_loss.py | UTF-8 | 903 | 2.9375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
import numpy as np
# TODO maybe push this to nn?
def smooth_l1_loss(input, target, beta=1. / 9, size_average=True):
"""
very similar to the smooth_l1_loss from pytorch, but with
the extra beta parameter
"""
n = tor... | true |
0dad3dc128af47d2be5933328f53509542fbc7ce | OfekGr/git1 | /Maingame.py | UTF-8 | 1,006 | 3.5625 | 4 | [] | no_license | from game_cards.Card import Card
from game_cards.CardGame import CardGame
game=CardGame(input("Insert player1: "), input("Insert player2: "), 26)
game.new_game()
print("Player name: ", game.playerOne.name, "Player cards: ",game.playerOne.playerhand)
print("Player name: ", game.playerTwo.name, "Player cards: ",ga... | true |
c697e18b56513d12241929705df884a7c40ed9ce | friedlich/python | /19年9月/9.22/运算测试.py | UTF-8 | 351 | 3.859375 | 4 | [] | no_license | print(5 % 2)
print(5 // 2)
print(10 % 3)
# "%"就是求余 10除以3等于3,余数是1,于是 10%3=1
# 另外"/"是整除 10/3=3
print(10/3)
print(10//3)
import numpy as np
X = np.arange(24).reshape(12, 2)
print(X)
y = np.random.choice([1, 2], 12, p=[0.4, 0.6])
print(y)
a = np.array([1,2,3])
print(a)
b = np.array([[1, 2], [3, 4]])
print(b)
| true |
cd0446083849571d74ded93fdd9bf249b9dd8767 | lucasdiogomartins/curso-em-video | /python/ex112/utilidadescev/dado/__init__.py | UTF-8 | 271 | 3.296875 | 3 | [
"MIT"
] | permissive | def leia_dinheiro(msg):
while True:
preco = str(input(msg)).replace(',', '.').strip()
if preco.isalpha() or preco == "":
print(f'\33[31mERRO: "{preco}" é um preço inválido!\33[m')
else:
break
return float(preco)
| true |
ed96bc06ffff816040dbb1751260d20f3b1f929f | codeaudit/Content-Aware-Node2Vec | /train_node2vec.py | UTF-8 | 26,441 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import collections
from pprint import pprint
import torch
import re
from torch.autograd import Variable
import torch.optim as optim
import time
from utils import Utils
import models
from torch.utils.data import DataLoader
from dataloader import Node2VecDataset
import numpy as np
from tqdm import tqdm
import pickle
impo... | true |
876d0311e621384c8591813b4f6f9466c2058226 | Shivamshaiv/MLvolve | /RL_Part/q_agent.py | UTF-8 | 13,593 | 2.546875 | 3 | [
"MIT"
] | permissive | import copy
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import marl
from marl.tools import gymSpace2dim
from ..experience import ReplayMemory
from ..model import MultiQTable
from ..policy import QPolicy
from . import MATrainable, TrainableAgent
class QAgent(TrainableAgent):
... | true |
33ed923dffb9688b51c8ab9fd5c7f8b0aad8fb0d | dhruvjain22/oops_lab | /lab6_q1.py | UTF-8 | 857 | 3.65625 | 4 | [] | no_license | from threading import Thread
class calculate:
def __init__(self,csa,csb,arr):
self.csa=csa
self.csb=csb
self.arr=arr
def perfectDivisor(self,n):
Sum=0
for i in range(1,n):
if ((n%i) == 0):
Sum += i
self.arr.append(Sum)
... | true |
a81121283c688c1d749a8d7fa7f3ba72b761fadb | Indronil-Prince/Artificial-Intelligence-Project | /main.py | UTF-8 | 4,545 | 3.1875 | 3 | [] | no_license | from AlphaBeta import *
from BoardLogic import *
from heuristics import *
import time
alpha = float('-inf')
beta = float('inf')
depth = 3
ai_depth = 4
def boardOutput(board):
print(board[0]+"(00)----------------------"+board[1]+"(01)----------------------"+board[2]+"(02)");
print("| |... | true |
629cc7e39eefd0915d786948e379ab92d9113805 | Jacob1988/STM32_MicroPython | /萝卜城micropython 资料/传感器例程源码/火焰传感器adc/main.py | UTF-8 | 189 | 2.859375 | 3 | [] | no_license | # main.py -- put your code here!
import pyb
from pyb import Pin
heart=Pin('X1',Pin.IN)
adc = pyb.ADC(Pin('Y11'))
while 1:
print(heart.value())
print(adc.read())
pyb.delay(1000) | true |
ede489ffaa423292a5df751687d8705549d39684 | imon01/DataStructures | /graphs.py | UTF-8 | 2,881 | 3.203125 | 3 | [] | no_license | """
Graph algorithms
"""
import sys
def mht(n, l):
"""
" Minimum height tree solution
"
" list l: list of edges
" int n: vertex count
"""
def pop(S):
if not l:
return S.pop(len(S)-1)
def push(S, v):
S.append(v)
mht_table = {}
graph = {}
for edge in l:
u,v = edge
if u not in graph:
... | true |
81f9f8c7310c595c0065f8ace00e634d912ef133 | esrackmakli/AutomationRoadMapOdev8 | /PageClasses/product_page.py | UTF-8 | 1,355 | 2.671875 | 3 | [] | no_license | from selenium.webdriver.common.by import By
from BaseClass.base_class import BaseClass
from time import sleep
class ProductPage:
ADD_TO_LIST_BUTTON = (By.ID, 'wishlistButtonStack')
CREATE_BUTTON = (By.ID, "wl-redesigned-create-list")
ADDED_TO_LIST = (By.XPATH, "//span[contains(text(),'1 item added to Shop... | true |
c21d6af4dd4247908165f5ae7b1e96f8f239c5c1 | Elton86/ExerciciosPython | /EstrtuturaSequencial/Exe16.py | UTF-8 | 628 | 4 | 4 | [] | no_license | """Faça um programa para uma loja de tintas. O programa deverá pedir o tamanho em metros quadrados da área a ser
pintada. Considere que a cobertura da tinta é de 1 litro para cada 3 metros quadrados e que a tinta é vendida em
latas de 18 litros, que custam R$ 80,00. Informe ao usuário a quantidades de latas de tinta a ... | true |
7ee18543b578fc9cb73a093b7b3e31273284615c | Baurwow/amigipizza | /app.py | UTF-8 | 13,975 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import config, telebot, requests, firebase_admin
from firebase_admin import db
from telebot import types
from flask import Flask, request
bot = telebot.TeleBot(config.token, threaded=False)
server = Flask(__name__)
@bot.message_handler(commands=["start"])
def start(me... | true |
ea6011debd91b687edf18a03c22cc6c474f39584 | GMwang550146647/network | /3.爬虫/4.scrapy/1.demo/scrapydemo/scrapydemo/spiders/example.py | UTF-8 | 851 | 2.90625 | 3 | [] | no_license |
import scrapy
from ..items import ScrapydemoItem
class ExampleSpider(scrapy.Spider):
# 爬虫文件的唯一标识
name = 'example'
# 允许的域名
# allowed_domains = ['example.com']
# 起始的url列表:列表元素会被自动进行请求发送
start_urls = ['https://dig.chouti.com']
# 解析数据
def parse(self, response):
div_list = respons... | true |
f9a4185a32f93ef20d763daf77027fd9ba0971c8 | damf618/PSF_TF | /PSF_TP/psf_python_tp/py_mod2.py | UTF-8 | 16,074 | 2.765625 | 3 | [] | no_license | import numpy as np
import scipy.signal as sc
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
# Configuracion de las Seniales
#--------------------------------------
fs = 8000
N = 8000
M = 550
cutFrec = [200,400,800,1600,3200,fs]
f1 = 100
f2 =... | true |
7b13b588c29f12755c3472a7d5885b156596d955 | ChenYenDu/LeetCode_Challenge | /Problems/01_Easy/0100_Same_Tree.py | UTF-8 | 1,404 | 3.484375 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
from collections import deque
class IterationSolution:
def isSameTree(self, p: TreeNode, q: TreeNode) -> bool:
"""
come from the so... | true |
9d73db28775eaf13b4943bfc289d749e0886e607 | britannio/Python-experiments | /Sorting-Algorithms/bogo_sort.py | UTF-8 | 780 | 3.9375 | 4 | [] | no_license | # Bogosort, shuffles items in an array until they are sorted in ascending order
import random
'''
Copyright Brit 2018, don't modify or copy
'''
arrayLen = 11 # My laptop struggles at with an sorting 9 items
arrayRange = arrayLen + random.randint(1, 125)
shuffles = 0
iterations = 0
unsorted = random.sample(range(1, a... | true |
873f20bc630716cfc5d70d0784d2cc893e5b3386 | seba90/pracmln | /python3/pracmln/utils/multicore.py | UTF-8 | 2,707 | 2.53125 | 3 | [
"BSD-2-Clause"
] | permissive | import multiprocessing
from multiprocessing import pool
import traceback
import sys
import signal
import os
from ..mln.errors import OutOfMemoryError
import psutil
class CtrlCException(Exception): pass
class with_tracing(object):
"""
Wrapper class for functions intended to be executed in parallel
... | true |
750410cab4b345c2362b6bd106d356cda49fcfd9 | Yusuzhan/nand2tetris_solutions | /10/JackCompiler/JackTokenizer.py | UTF-8 | 7,616 | 3.03125 | 3 | [] | no_license | # token type
count = 0
class Token:
def __init__(self, token_type='', content='', line_num=0):
global count
self.token_type = token_type
self.content = content
self.line_num = line_num
self.id = count
self.class_name = ""
count += 1
def is_empty(self):... | true |
5b9cd916e397d31fa9a28e0ee9c00e318e2e6c85 | kikoxxxi/LeetCode | /DFS/q104_maximum_depth_of_binary_tree.py | UTF-8 | 1,893 | 4.15625 | 4 | [] | no_license | # Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x=None):
self.val = x
self.left = None
self.right = None
def insert_left_child(self, new_node_value):
# 当前节点没有左孩子时,直接添加新节点作为该节点的左孩子
if not self.left:
self.left = TreeNode(new_node... | true |
fde3acae9b945f05ddf7dcc4efd1c1141cdc87b4 | mitant127/Python_Algos | /Урок 1. Практическое задание/task_3.py | UTF-8 | 2,374 | 4.125 | 4 | [] | no_license | """
Задание 3. По введенным пользователем координатам двух
точек вывести уравнение прямой,
проходящей через эти точки.
Подсказка:
Запросите у пользователя значения координат X и Y для первой и второй точки
Найдите в учебнике по высшей математике формулы расчета:
k – угловой коэффициент (действительное число), b – своб... | true |
5d0d015c314acf296ce2029944d0e1c073fd6719 | ZenZeno/cryptobot | /poloniex.py | UTF-8 | 5,824 | 2.78125 | 3 | [] | no_license | import requests
import datetime
import pandas
import hmac
import hashlib
class Poloniex:
def __init__(self, key, secret):
self.key = bytes(key, 'utf8')
self.secret = bytes(secret, 'utf8')
def ticker(self, pair):
result = requests.get('http://poloniex.com/public', {'command': 'retu... | true |
2e362c5cc61faff2c66799f2b0bba9a1617ca7a0 | asdlei99/django-note | /django/views/generic/detail.py | UTF-8 | 6,355 | 2.625 | 3 | [] | no_license | """
Last-View:2019年8月9日07:29:28
View-Counter:1
"""
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.http import Http404
from django.utils.translation import gettext as _
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
class SingleObjectM... | true |