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 |
|---|---|---|---|---|---|---|---|---|---|---|
91cc53bb1c15e79a593cbf4829ae02787b7e9763 | konread/inteligentne_przetwarzanie_danych | /Zadanie2/Neuron.py | UTF-8 | 1,011 | 3.09375 | 3 | [] | no_license | import random
import numpy as np
import math
class Neuron(object):
def __init__(self):
self.weights = []
# desired output
def train(self, inputs):
self.weights = self.normalize(inputs)
return self
def computeSum(self, inputs):
normalizedInputs = self.normalize(inputs)
... | true |
ff2d4a925d1d55d60250ef46d8ac53a77d29d62b | uzzielperez/CERN_ROOT_tutorials | /color_demos/_02_built_in_color.py | UTF-8 | 1,467 | 3.140625 | 3 | [] | no_license | import ROOT
# TColor Reference
# https://root.cern.ch/doc/master/classTColor.html
if( 0 ):
# to show the color_index for built-in 50 colors
canvas_1 = ROOT.TCanvas("canvas_1","50 basic colors");
canvas_1.DrawColorTable();
# usage: xxx.SetLineColor( color_index )
if( 0 ):
# ther... | true |
d4084496f36f694802d6af12b77b40a0c0822657 | davideschiavone/BioLearn | /src/Demo/minist_dataset_test.py | UTF-8 | 3,049 | 2.703125 | 3 | [] | no_license | import numpy as np
from sklearn import datasets
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
from brian2 import *
import random
digits = datasets.load_digits()
NData = len(digits.images)
data = {'x': digits.images.reshape((NData, -1)), 'y': digits.target}
testFraction = 0.6
T, ... | true |
06bc411ba31066a825db168611d67bc3f98f8d54 | LogicPy/Python | /Projects/Renderosity Cracker/script.py | UTF-8 | 5,476 | 2.53125 | 3 | [] | no_license |
# Renderosity Cracker Experiment - Pythogen 2018
# Refined output handling / Invalid / Valid login + Rate Limit Detection with VPN switching
# Code for cracker configuration reference
# NordVPN Required for VPN auto-switching
# Developed and Tested on Linux
# Code isn't polished. Just for reference purposes
# Discl... | true |
dd14cfb39fa39965f55a5a8de0b5a6e3294bb6cd | feleaman/nico | /mytext2html.py | UTF-8 | 961 | 3.53125 | 4 | [] | no_license | # Program opens file mytext.txt and generates mytext.html considering german characters.
#Open txt
mytext = open('mytext.txt', 'r')
texto = mytext.read()
#German and other characters
texto = texto.replace('&', '&')
texto = texto.replace('Ö', 'Ö')
texto = texto.replace('ö', 'ö')
texto = texto.replace('Ä'... | true |
bfe6aedc2b21b55018a379efdfdae8339657f344 | dent424/clustering_project | /Data Cleaning Tools/graphics.py | UTF-8 | 901 | 3.65625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 19 17:33:44 2015
@author: Alex
"""
import matplotlib.pyplot as plt
from dictionary_conversion import create_NaN_list
#Creates a chart with questions on the y-axis, respondent on the x-axis to show NaN vs. Non-NaN values
#Each question, respondent combination would be a... | true |
eb904dd2054bae57825e5565e5126085d6f073e1 | KeithCissell/CSC790-Advanced-Robotics | /in_class/2018-03-05_histograms/histograms.py | UTF-8 | 1,793 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function
from __future__ import division
import argparse
import cv2
from matplotlib import pyplot as plt
def open_image(image_filename, display_seconds):
# Load Image
print('Opening:', image_filename)
img = cv2.imread(image_filename)
if img is None:
p... | true |
b6246ce2480a806e31641c569aa620ff24a0fb39 | andriihrypa/CodeWars | /02. Easy Python Katas/10. 21 Sticks.py | UTF-8 | 226 | 3.359375 | 3 | [] | no_license | # https://www.codewars.com/kata/21-sticks/train/python
def makeMove(sticks):
if sticks < 4:
return sticks
else:
if sticks % 4 == 0:
return 1
return sticks % 4
print(makeMove(21)) | true |
e15dc0e61b999a515528b3dbde0d2ffb7666ff06 | RZaga09/small_python_projs | /mind_the_gap.py | UTF-8 | 916 | 3.96875 | 4 | [] | no_license | '''
Mind The Gap (by Donnamae on edabit.com)
A number is gapful if it is at least 3 digits long and is divisible by the number formed by stringing the first and last numbers together.
The smallest number that fits this description is 100. First digit is 1, last digit is 0, forming 10, which is a factor of 100. Th... | true |
9653acc078ee97b4a1a136a0dbadc65a63ad7934 | A-Yu-Protodyakonov/LibOn | /WebSite/Book.py | UTF-8 | 723 | 2.828125 | 3 | [] | no_license | #from interface import Interface, implements
from LibraryElement import LibraryElement
class Book(LibraryElement):
id, Author, publish_year,rentalTime, type = None, None, None, None, None
def __init__(self, id_book, name, rubric, author, publish_year, rentalTime, type_t):
super(Book, self).__init__(n... | true |
13243e23e5a4598e67defc0c38436c285b47108a | kristoffertt/scattering | /scatterer.py | UTF-8 | 11,626 | 3.0625 | 3 | [] | no_license |
import space
import draw
import numpy as np
import pygame
def get_particle_set(pos, radius, dir, perp_dir):
num_detec = 15
U = np.array([dir, perp_dir])
particle_set = set([np.dot(U, radius*np.array([np.cos(k*np.pi/(num_detec-1)), np.sin(k*np.pi/(num_detec-1))])) + pos
for k in... | true |
73048733f0d5f0c58c31b8d172156575ea1a3eec | SandeepPadhi/Algorithmic_Database | /icpc.py | UTF-8 | 634 | 2.8125 | 3 | [] | no_license | T=int(input())
import math
def bfs(node,result,Adj):
visited=[0 for _ in range(0,N+1)]
queue=[node]
n1=node
while(len(queue)):
node=queue.pop(0)
for i in adj[node]:
if math.gcd(i,n1)==1:
result[n1]=i
return
queue.append(i)
def check():
N=int(input())
S=[0]+list(map(int,input().sp... | true |
27041352a14623e95e7894a4f5948817cb4db606 | adriangrepo/my_fastai | /dl1/scripts/keras_lesson1.py | UTF-8 | 2,490 | 2.59375 | 3 | [] | no_license |
# coding: utf-8
# ## Introduction to our first task: 'Dogs vs Cats'
# In[1]:
get_ipython().run_line_magic('reload_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
get_ipython().run_line_magic('matplotlib', 'inline')
# In[2]:
PATH = "data/dogscats/"
sz=224
batch_size=64
# In[3]:
import nu... | true |
885ace8371e80bb8cb79b1d6167aff19d30502cf | summerwxy/business.com.tw | /grab.py | UTF-8 | 9,385 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from urllib.request import urlopen
import urllib.request
import os.path
import json
from lxml import etree, cssselect
import codecs
import sqlite3
import sys, os, re
import urllib.parse
import chardet
import time
HOME_PAGE = 'http://business.com.tw/prod/productc1.htm'
SQ... | true |
9859d43b18bbad0d6db69dc8589bdc6ed050df9d | ruiwangus/AdjectiveIntensityOrdering | /matrix_creation.py | UTF-8 | 6,304 | 3.578125 | 4 | [] | no_license | #!/usr/bin/env python3
import csv
from collections import deque
import sys
import argparse
import numpy as np
def get_connected_equations(word_equations_dict):
"""
Uses a bfs method to find the connected variables in the dictionary.
:param word_equations_dict: A dictionary mapping each word to a diction... | true |
ab94e8d35ce95bfca4907020b5edc5bbe98534df | Souruzi/Assignment02 | /LeapYear$.py | UTF-8 | 1,319 | 4.15625 | 4 | [] | no_license | # Programmer: [Adam Guerrero]
# Course: CS151, Prof. Mehri
# Date: [October 11th]
# Programming Assignment: 2
# Program Inputs: [Enter Month(1-12) and year]
# Program Outputs: [Days in the month of that year and weather if its a leap year]
# User enters date and year
def is_leap_year(year):
return (year % 4 - 0) a... | true |
cd100e5dab1773cfd57c5e9c3ae49ed549bd4655 | MemoNano/Webinar | /CodingBat/ListHas23.py | UTF-8 | 1,347 | 4.21875 | 4 | [] | no_license | """
Given an int array length 2 , return True if it contains a 2 or a 3.
has23([2, 5]) → True
has23([4, 3]) → True
has23([4, 5]) → False
"""
nums = [2, 5]
def has23(nums):
for i in nums:
if i == 2 or i == 3:
return True
else:
return False
print(has23(nums))
print("*****... | true |
bfafd7443a9641b48840d52e31474b8331ea7cf1 | s0fiateixeira/FEUP_FPRO | /RE - Away Assignments/RE13/compatible.py | UTF-8 | 623 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 9 11:44:02 2019
@author: Sofia
"""
def compatible(A, B):
colunas_A = 0
linhas_B = 0
for i in range(len(A[0])):
colunas_A += 1
for i in range(len(B)):
linhas_B += 1
try:
assert colunas_A == linhas_B, "A and B cannot be multipli... | true |
4d36ea641c40eba64f184ff10b982feb04483608 | ravisheth/mapsseq | /processing/maps_process.py | UTF-8 | 7,288 | 2.53125 | 3 | [] | no_license | # MaP-seq data processing script
# Modified 1/19/16 for new MaP-seq setup
import ConfigParser
import sys
import os
#open configuration file
dir_path = os.path.dirname(os.path.realpath(__file__))
config = ConfigParser.ConfigParser()
config.read(dir_path+'/param') #read config file
anchor1 = config.get('default','anchor... | true |
49f41aa017b806f94ae41a345466d97984b9d359 | stefanieliu/UCASthesis | /zhfonts.py | UTF-8 | 5,411 | 3.0625 | 3 | [
"LPPL-1.3c"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This script provide you with the Chinese fonts found by fc-list,
# let you choose which to use with ucasthesis.
# The script prefers the font name in ASCII to the one containing Unicode
# character, thus trying to avoid the problem with 'Adobe 宋体 Std L'.
# The script s... | true |
f1cdadabe3218eab69afd9ad78597814be3da934 | wwyywg/Py3 | /02_python核心编程/02_系统编程/01_fork/ww_03_fork.py | UTF-8 | 373 | 3.03125 | 3 | [] | no_license | # coding=utf-8
import os
import time
"""
多进程中,每个进城所有数据(包括全局变量)都各拥有一份,互不影响
"""
num = 0
pid = os.fork()
if __name__ == '__main__':
if pid == 0: # 子进程执行
num+=1
print("哈哈1---num=%d"%num)
else:
time.sleep(1)
num+=1
print("哈哈2---num=%d"%num)
| true |
07198d8cad345b36ada443819a08c7a200eb9b6a | samandalib/Coding-Challenges | /String Justification/unjustifying text.py | UTF-8 | 1,249 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 12 23:36:56 2019
@author: Hesam
"""
'''making the text variable unjustified'''
import re
text = '''Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
Vestibulum sagittis dolor
mauris, at elementum ligula
tempor eget. In quis rhoncus
nun... | true |
10b40b681b2e0dfc293439715178dce16b9f16af | BitPhalanx/eve-bot | /main/BotConfig.py | UTF-8 | 895 | 2.875 | 3 | [] | no_license | import json
filename="botconfig.json";
def read_as_json():
with open(filename) as json_file:
data=json.load(json_file);
return data;
def get_bots():
bot_configurations=[];
data=read_as_json();
for botname in data:
bot_configuration=BotConfiguration();
bot_configuration.username=botname;
bot_configuratio... | true |
50e83f0e256cf258a273e113fff4761e37d3c616 | jrclayton/RosalindProblems | /Bioinformatics Stronghold/004_FIB/FIB.py | UTF-8 | 433 | 3.359375 | 3 | [] | no_license | #!/usr/bin/python
def fib_rabbits(n, k):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib_rabbits(n-1, k) + k * fib_rabbits(n-2, k)
infile = open("rosalind_fib.txt", "r")
outfile = open("output.txt", "w")
params = infile.read().strip()
infile.close()
n = int(params.split()[0])
k = int(params.spli... | true |
d0662debb5fde5ddfe3460744a724b4f66680851 | dheinzelman/python-labs | /labs/02_basic_datatypes/2_strings/02_11_slicing.py | UTF-8 | 591 | 4.875 | 5 | [] | no_license | '''
Using string slicing, take in the user's name and print out their name translated to pig latin.
For the purpose of this program, we will say that any word or name can be
translated to pig latin by moving the first letter to the end, followed by "ay".
For example: ryan -> yanray, caden -> adencay
'''
user_word = ... | true |
f0298246485f38767e83dffe54de105fef2d8301 | abc56163/180PythonScript | /进程和线程/GIL.py | UTF-8 | 372 | 3.078125 | 3 | [] | no_license | from threading import Thread,Lock
import os,time
def work():
global n
lock.acquire()
temp=n
time.sleep(0.1)
n=temp-1
lock.release()
if __name__ == '__main__':
lock=Lock()
n=100
l=[]
for i in range(100):
p=Thread(target=work)
l.append(p)
p.start()
for... | true |
2f2785080045396b4ef1fb70efefa4d6012a54ec | yibter/ectropy | /inputs/Simple.py | UTF-8 | 1,724 | 2.734375 | 3 | [] | no_license | class Simple:
def __init__(self):
from datetime import datetime
from objects import Asset, Skill, Manpower
from objects.Schedule import Schedule
from objects.Task import Task
from objects.DateRange import DateRange
self.name = "Simple"
schedule = Schedule(self.name, DateRange(datetime(2010, 1, 1... | true |
78d8e96b6ffc5821a74950e17102be362214dbe5 | smesays/poker | /table/powertable.py | UTF-8 | 5,369 | 2.921875 | 3 | [] | no_license | # Code : powertable.py
# Written by: TANG, Chit Long (Steven)
# Purpose : Calculate winning probabilities for 2 hole cards and 5-card poker hand
from functools import reduce
from itertools import groupby
from itertools import combinations
import random
import pickle
class PowerTable:
def __init__(self):
... | true |
4ea0cec0c72c8fecd16960374f5221d34c16e022 | KevinKnott/Coding-Review | /Month 03/Week 04/Day 04/a.py | UTF-8 | 2,272 | 4.09375 | 4 | [
"MIT"
] | permissive | # Trapping Rain Water: https://leetcode.com/problems/trapping-rain-water/
# Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.
from types import List
# For this problem we need to traverse across the array and keep track of... | true |
a3a590f152055697f73d36073388ebf48c3d7a68 | cyb70289/kaggle | /statoil/models/simplenet.py | UTF-8 | 2,973 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | import torch
import torch.nn as nn
import torch.nn.functional as F
class _ConvLayer(nn.Sequential):
def __init__(self, conv_lst, n_channels, dropout):
super(_ConvLayer, self).__init__()
# conv layers
for i, channels_lst in enumerate(conv_lst, 1):
# conv + relu + pool
... | true |
d5437b58792b1d352ee71f88d2c37bc551186645 | haalo/learning-Python3 | /day01/import_test01.py | UTF-8 | 1,417 | 3.625 | 4 | [] | no_license | '''
绝对导入:需要指明这个模块,函数的完整路径,或希望导入的路径
相对导入: 找出一个类,函数或者模块,它的定位相对与当前模块, ps:想想相对路径
'''
# 绝对导入 导入helloworld模块
# import day01.helloworld
# resutl = day01.helloworld.first_py_program()
# 或者
# from day01.helloworld import first_py_program
# result = first_py_program()
# print(result)
'''相对导入 helloworld模块的Hello类, 用一个点代表当前包, 更多点... | true |
33522b896790ee8e8e89c9ba90b296e88e99826f | matteocorea/rpi-gpio | /08_rgb_pwm.py | UTF-8 | 818 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python
import RPi.GPIO as GPIO
import time
color = '#7300ff'
Red = 17
Green = 22
Blue = 5
pwm_pins = {}
def setup():
GPIO.setmode(GPIO.BCM)
# Configure pin IN or OUT
for pin in (Red, Green, Blue):
GPIO.setup(pin, GPIO.OUT)
pwm_pins[pin] = GPIO.PWM(pin, 100)
pwm_pins... | true |
1730d3a1a558000f21e5c7474fc7cf36353db7d0 | joshakeman/Sprint-Challenge--Data-Structures-Python | /ring_buffer/ring_buffer.py | UTF-8 | 1,842 | 3.75 | 4 | [] | no_license | class RingBuffer:
def __init__(self, capacity):
self.capacity = capacity
self.current = 0
self.storage = [None]*capacity
def append(self, item):
# print(self.storage)
temp = self.get()
# temp = self.storage
if len(temp) < 5:
temp.append(item)
self.storage = temp + [Non... | true |
ac5c886ba3fa55c1e825867cc2b9ab2441eed2a1 | bentarnoff/nyt-headlines | /nyt-headlines.py | UTF-8 | 2,371 | 3.5625 | 4 | [] | no_license | import os, requests, json, sys
#nobody can be told what the matrix is...
def intro():
os.system("clear")
print "Yolo, stranger!"
print "Here's how this works:"
print "You tell me what section of The New York Times you're interested in,"
print "and I'll give you the most recent headlines from that section."
whil... | true |
4528261cf0652cddfefe8d4be3385bc542799458 | KoeusIss/holbertonschool-machine_learning | /supervised_learning/0x12-transformer_apps/0-dataset.py | UTF-8 | 1,187 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
"""Transformer Application"""
import tensorflow.compat.v2 as tf
import tensorflow_datasets as tfds
class Dataset:
"""Dataset class loads and prepares a dataset for MT
"""
def __init__(self) -> None:
"""Initializer
"""
self.data_train, self.data_valid = tfds.l... | true |
9af9204abe96fb6f0cdee047681a0c4e06f99669 | huggingface/simulate | /src/simulate/scene.py | UTF-8 | 16,142 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2022 The HuggingFace 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 or agreed to... | true |
c4ed4422886ca4a809d5e670325e358125dd685f | vsinh14/graphMyDegree | /uq_grapher/_generate_excel.py | UTF-8 | 922 | 2.75 | 3 | [
"MIT"
] | permissive | import os
import glob
import csv
import json
def generate_course_list(folder_path) -> list:
# data = []
# for f in glob.iglob(folder_path):
# with open(f) as file:
# c_data = json.load(file)
# data.append(c_data)
# print(f)
# with open('course_data.json', 'w') as ... | true |
862f81599c80325434026a832357cff846b9e16c | hsulab/BEPy | /untitled1.py | UTF-8 | 1,238 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 8 18:21:29 2017
@author: Alexander
"""
import xlwt;
import xlrd;
#import xlutils;
from xlutils.copy import copy;
#init xls file
#styleBlueBkg= xlwt.easyxf('pattern: pattern solid, fore_colour sky_blue;');
#styleBold = xlwt.easyxf('font: bold on');
sty... | true |
fb08c59c72a51a37f03bdfd90caf30cc98ba766b | ivanmilevtues/python101 | /lesson_6/bank_acc.py | UTF-8 | 2,299 | 3.59375 | 4 | [] | no_license | class Bill:
def __init__(self, amount):
self.amount = amount
if amount < 0:
raise ValueError
elif type(amount) != int:
raise TypeError
def __str__(self):
return "A {0}$ bill".format(self.amount)
def __repr__(self):
return self.__str__()
... | true |
6370f2510d0f8964e43cd9f8dd3a53d74fef4f58 | pasbi/package-fs-info | /package-fs-info.py | UTF-8 | 3,282 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import json
import subprocess
def increment(the_map, key, zero=0, increment=1):
the_map[key] = the_map.get(key, zero) + increment
def find_installed_packages():
pc = subprocess.run(['pacman', '-Q'], capture_output=True)
return [l.split()[0].decode('utf-8') for l in... | true |
5dbdfffa4b25dea5137714662ce0fc3bb9305f20 | pisomnia/LeetCode | /Algorithms/Array/45_Jump Game II.py | UTF-8 | 396 | 2.53125 | 3 | [] | no_license | class Solution(object):
def jump(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums)<2:
return 0
maxNext=0
curMax=0
res=0
for i in range(len(nums)-1):
maxNext=max(maxNext,i+nums[i])
if i==curM... | true |
4289b69b088a714651affda8ba1f07211bd7373b | xcyi2017/exercise | /2018826_2.py | UTF-8 | 348 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 26 10:57:06 2018
@author: xcy
"""
import sklearn.linear_model as lm
import matplotlib.pyplot as plt
import numpy as np
import time
x = np.random.rand(100,2)
y=0.2*x[:,0]+x[:,1]*0.1 +1
t0 = time.time()
F1 = lm.RidgeCV()
F1.fit(x,y)
y1 = F1.predict(x)
t1 =time.time()
... | true |
c0db98da516012175f830dae76642c3eff153992 | huynhkGW/POTD | /Python/warmup-1/monkey_trouble.py | UTF-8 | 1,196 | 4.125 | 4 | [] | no_license | '''
CodingBat Python Activity "monkey_trouble" from warmup-1.
codingbat.com
'''
failures = 0
def monkey_trouble(a_smile, b_smile):
'''
We have two monkeys, a and b, and the parameters a_smile and b_smile indicate if each is smiling.
We are in trouble if they are both smiling or if neither of them is smiling.
Ret... | true |
2fc3f52c53d3df7b821c8453578ac06b68f33142 | Oizys18/Algo | /programmers/prepare_kakao/ConnectingIsland.py | UTF-8 | 1,086 | 3.359375 | 3 | [] | no_license | from collections import defaultdict
from heapq import *
def solution(n, costs):
answer = 0
costs.sort()
nodes = defaultdict(list)
for n1,n2,cost in costs:
nodes[str(n1)].append((cost,str(n1),str(n2)))
nodes[str(n2)].append((cost,str(n2),str(n1)))
start = str(costs[0][0])
connect... | true |
a04dce958417bd9ad91e0aea32fe0a34b265b53a | tommykirk/adventOfCode2020 | /tommy/day3.py | UTF-8 | 260 | 3.234375 | 3 | [] | no_license |
currCol = 0
trees = 0
with open('day3.txt', 'r') as file:
skiMap = [[c for c in line[:-1]] for line in file]
rowLen = len(skiMap[0])
for line in skiMap[1:]:
currCol += 3
currCol = currCol % rowLen
if line[currCol] == '#':
trees += 1
print(trees) | true |
6c64d491c72d7a8499a41a6f0bd0453ccb1acb60 | ismarthawk/DSA-MyLearing- | /Stack/6 Reverse a stack.py | UTF-8 | 665 | 3.21875 | 3 | [] | no_license | def reverse(li : list) :
s = li
def push(i):
s.append(i)
def isEmpty():
return not len(s)
def peek():
if not isEmpty():
return s[-1]
return None
def pop():
a = peek()
if a:
del s[-1]
return a
return None
... | true |
2e25cda6cd1c1e053660245cca59ce1369549bf1 | rybaprm/python | /dz_1_2_circle_with_leaves.py | UTF-8 | 721 | 3.46875 | 3 | [] | no_license | import turtle
import math
if __name__ == "__main__":
what_input_settings = (
'введите радиус центральной окружности: ',
'введите количество лепестков: '
)
tl = turtle.Turtle()
tl.ht()
def draw_leaves(radiusius,quantity_of_leaves):
angle = 360/quantity_of_leaves
radius_lep = math.sin(mat... | true |
63ba39f7fbdd53f6bb3af712b9e72786fa814ee4 | justinwlin/Python-Data-Structure | /Homework/HW4/jwl488_hw4_q4.py | UTF-8 | 280 | 3.359375 | 3 | [] | no_license | def find_duplicates(lst):
result = []
for i in lst:
index = abs(i) - 1
if(lst[index] < 0):
result.append(abs(i))
else:
lst[index] = lst[index] * -1
return result
# print(find_duplicates([1, 3, 1, 2, 5, 2, 3, 4, 5, 6])) | true |
9530929efa3824f490748760ffcd218753adddf1 | Eajay/Pima-with-knn | /pima_pca_plot.py | UTF-8 | 1,508 | 3.015625 | 3 | [] | no_license | import numpy as np
import csv
from sklearn import preprocessing
from sklearn import decomposition
import matplotlib.pyplot as plt
training_size = 668 # 768
testing_size = 100
k_neighbors = 27
def read_data():
file = "diabetes.csv"
c = open(file, "r")
lines = csv.reader(c)
header = next(... | true |
f0d0b8cd4246efd91c3d259111386b476970a598 | raghav36/python | /scorecard.py | UTF-8 | 1,636 | 4.28125 | 4 | [] | no_license | import operator
# input student details
def get_student_details():
student_details = {}
total_students = int(input('Enter the total number of students'))
if total_students <3:
print('Total number of students cannot be less than 3')
else:
for i in range(0,total_students):
stu... | true |
9a40ac9843657dad6dab1a0e230701de7daa62fb | kitbitsks/ib_Solutions | /ib_linkedList_removeDuplicatesFromListII.py | UTF-8 | 1,309 | 3.34375 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param A : head node of linked list
# @return the head node in the linked list
def deleteDuplicates(self, A):
if A.next is None:
return A
... | true |
d01c304091a49598e8f596b9f54f72f4e598a211 | arshad408/test | /py/koops.py | UTF-8 | 71 | 2.578125 | 3 | [] | no_license | data = map(int,raw_input().split(" "))
print (data[0]*data[1])%data[2]
| true |
1cadfc7ba342bb1e2dfb74a9d052133f08d85c12 | LILEnrique/Cells | /DetectColores.py | UTF-8 | 1,687 | 2.984375 | 3 | [] | no_license | import cv2
import numpy as np
import time
circless,circuloA,circuloR = 0,0,0
image = cv2.imread('seq/Img001212.jpg')
start=time.perf_counter()
imagen_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
mask = np.zeros((imagen_gray.shape), np.uint8)
contour = np.array([[0,185],[640,175],[640,70],[0,80]])
cv2.fil... | true |
0fa945beaf7a36cb885bd8c465f3f6fba4773e94 | JulianTrufero/Geo-Spatial-Company-localization | /scr/data_functions.py | UTF-8 | 5,119 | 3.21875 | 3 | [] | no_license | import json
from dotenv import load_dotenv
from functools import reduce
import numpy as np
import operator
import os
import pandas as pd
import requests
load_dotenv()
def getdata_fsq(url, city, venue, client_id, client_secret):
"""
Toma como argumentos la url de la API, un par de coordenadas, una cateogoría y ... | true |
35c46356bffc1655074522f259b7ecb19f8a2106 | dsimpson1980/project_euler | /problem72.py | UTF-8 | 1,234 | 4.1875 | 4 | [] | no_license | """Counting fractions
Problem 72
Consider the fraction, n/d, where n and d are positive integers. If n<d and
HCF(n,d)=1, it is called a reduced proper fraction.
If we list the set of reduced proper fractions for d <= 8 in ascending order of
size, we get:
1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 1/2, 4/7, 3/5... | true |
707dfcdd25e234f60a641341fac2bd24f5325522 | Zhou-Shu/5001HW2 | /ring.py | UTF-8 | 1,167 | 2.796875 | 3 | [] | no_license | # mpiexec -n 5 python MSDM5001\ring.py
from mpi4py import MPI
import numpy as np
Np = 5 # number of nodes, must smeller than the np within mpiexec command
num_of_loop = 50 # number of iterations
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
# create a 1-dim ring topology
dims = [Np]
periods = [True]
ring_comm = c... | true |
3f8cf161514931db69e2665aa35cd5deb9ecf7ab | deRemo/stats-microservice | /stats/models.py | UTF-8 | 832 | 2.796875 | 3 | [] | no_license | from flask_sqlalchemy import SQLAlchemy
from stats.extensions import db
class Stats(db.Model):
'''
Models the statistics retrieved from the whole infrastructure
'''
__tablename__ = 'stats'
author_id = db.Column(db.Integer, primary_key=True)
likes = db.Column(db.Integer, default=0, nullable=Fal... | true |
0d15f7f81e84c4ee696efa78d73a5af4af24db1c | duanxian158/aotocode | /python9/class_0728_function/class_0728_1.py | UTF-8 | 1,822 | 4.1875 | 4 | [] | no_license |
#今天的主题:讲函数 做拓展题
#1:return 关键字
#2:内置函数、函数之间的调用(先定义了才可以调用,参数的传递)
#3:变量的作用域
#4:编写函数的三个步骤
#def 函数名(参数)
#函数体
#调用:函数名(对应个数的参数)
# def greet_user():
# print('你好呀!')
# def greet_user(text,time='星期五晚上',name='铁硬'):
# def greet_user(text,name):
# print(name)
# # print(time)
# print(text)
# # greet_user('jul... | true |
4d66354f65a09dfeadc30bb261828a35f053b146 | tyutltf/Leecode | /401-500/415-字符串相加.py | UTF-8 | 1,104 | 3.71875 | 4 | [] | no_license | # -*- encoding: utf-8 -*-
"""
@File : 415-字符串相加.py
@Time : 2021/06/22 23:00:38
@Author : TYUT ltf
@Version : v1.0
@Contact : 18235121656@163.com
@License : (C)Copyright 2020-2030, GNU General Public License
"""
# here put the import lib
"""
给定两个字符串形式的非负整数 num1 和num2 ,计算它们的和。
提示:
num1 和num2 的长度都... | true |
4eff15e2c1e798a01e24bc7a84cb5bf31a63e47f | mohgeis/Groups | /FileHandler.py | UTF-8 | 879 | 3.09375 | 3 | [] | no_license | from Groups import Groups
from Group import Group
import json
def read_file(file_path):
with open(file_path, 'r') as myfile:
groups_list = Groups()
try:
group_str_lst = myfile.read().split(sep="#")
except:
myfile = open(file_path, 'r')
group_str_lst = myf... | true |
d0d961d3d75b02b64149816bccc1b129a53213d5 | nithinkashyapn/bts-resumes | /formuploads/io_utils.py | UTF-8 | 639 | 2.65625 | 3 | [] | no_license | import os
from .doc_utils import doc_to_text
from .docx_utils import docx_to_text
from .pdf_utils import pdf_to_text
from .rtf_utils import rtf_to_text
def read_pdf_and_docx(dir_path):
txt = None
f = dir_path
if f.lower().endswith('.docx'):
txt = docx_to_text(f)
elif f.lower().en... | true |
c2db64a600598190bb7997745eff8b0e917eb543 | wsjswy/webApp | /crawler/URL.py | UTF-8 | 2,570 | 3.03125 | 3 | [] | no_license |
import urlparse
DEFAULT_ENCODING = "utf-8"
class URL:
def __init__(self, url, encoding = DEFAULT_ENCODING):
self._unicode_url = None
self._change = False
self._encoding = encoding
if not url.startswith("https://") and not url.startswith("http://"):
url = "http://" + ... | true |
ddf6185449f5c83dcb90bf5c0dc2f510a7474046 | taehwakkwon/SpaceNet_ImageSegmentation | /utils.py | UTF-8 | 1,642 | 2.703125 | 3 | [] | no_license | import torch
import torchvision
from dataset import SpaceNetDataset
def save_checkpoint(state, filename='my_checkpoint.pth.tar'):
print("=> Saving checkpoint")
torch.save(state, filename)
def load_checkpoint(checkpoint, model):
print("=> Loading checkpoint")
model.load_state_dict(checkpoinmt["state_d... | true |
7c36e880ff1db2038ec4c66b88f4663ab2833e08 | dqtuan99/information-security | /modular/modularInverse2.py | UTF-8 | 444 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue May 19 16:48:36 2020
@author: Do Quang Tuan
"""
from prime.primeFactorization import primeFactorization
from prime.isPrime import isPrime
def phi(n):
p_arr = list(set(primeFactorization(n)))
product = n
for p in p_arr:
product *= (1 - 1/p)
r... | true |
eefb7d00ef4c90e270244ed609fb47288eb2972f | Berti-code/Python | /Fundamentals_of_Programming/QuizMaster/tests.py | UTF-8 | 1,740 | 2.5625 | 3 | [] | no_license | from ui import Ui
from controller import Controller
from repo import Repo
test_repository=Repo()
test_controller=Controller(test_repository)
test_ui=Ui(test_controller)
class Test:
def __init__(self):
pass
def run_tests(self):
self.test_validator_add_InvalidDifficulty_RaiseException()
... | true |
6f0605a7b2d48c07d42d141f30620818e13c425f | colemccaulley/MIS407 | /c26-gui_desktop_1/sample_code/tkinter02.py | UTF-8 | 231 | 3.21875 | 3 | [] | no_license | import tkinter as tk
window = tk.Tk()
# insert widgets here
button = tk.Button(window, text="It's Wednesday afternoon and I'm in a programming class!", width=100, height=2, command=window.destroy)
button.pack()
window.mainloop()
| true |
cb1a3ac3a1401f2b4377fe4bce6eec5d568c20b4 | perpen/py-shell | /test/test_command.py | UTF-8 | 4,258 | 3 | 3 | [] | no_license | import unittest
from py_shell.command import Command, UsageParser, Option
class TestUsageParser(unittest.TestCase):
def test_normal_usage_is_parsed_correctly(self):
usage = """Blah
-o, --output=OUTPUT Specifies output
-v
blah
"""
actual_options = UsageParse... | true |
b99fbddb39a8a41ecd7a22de6b98c5f9e4053b6c | youssef-emad/codeforces | /810B_summer_sell_off.py | UTF-8 | 888 | 2.953125 | 3 | [] | no_license | n, f = map(int, raw_input().split())
products = [0] * n
customers = [0] * n
difference = [0] * n
difference_after = [0] * n
gain = [0] * n
output = 0
for i in range(n):
products[i], customers[i] = map(int, raw_input().split())
difference[i] = max(0, customers[i] - products[i])
difference_after[i] = max(0, c... | true |
366205c35ec7d6b9544e090231ad24e45166d0f9 | SangYuhiter/Knowledge-Map-and-Question-Answer | /SimilarityCalculate/SentenceSimilartity.py | UTF-8 | 808 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@File : SentenceSimilartity.py
@Author: SangYu
@Date : 2019/3/30 12:10
@Desc :
"""
import distance
def edit_distance(sen1: str, sen2s: list)->list:
"""
使用编辑距离衡量句子相似度
:param sen1: 查询句
:param sen2s: 备选句子组
:return: 最相似的句子
"""
result = []
for i_sen in range(... | true |
f018999ff8815573a0e48b1d3d35eb7d2e56e950 | henosBot/henos-bot | /cogs/rank.py | UTF-8 | 1,169 | 2.53125 | 3 | [] | no_license | import discord
from discord.ext import commands
from tools.database import database as db
from discord_slash import cog_ext
from discord_slash.utils import manage_commands
import typing
class Rank(commands.Cog):
def __init__(self, bot):
self.bot = bot
def cog_unload(self):
self.bot.slash.remo... | true |
46c04630b53abfe38a226b1d3032bd48174e8538 | talebilling/hackerrank | /python/list_comprehension2.py | UTF-8 | 515 | 3.03125 | 3 | [] | no_license | '''
Let's learn about list comprehensions! You are given three integers and representing the
dimensions of a cuboid along with an integer . You have to print a list of all possible
coordinates given by on a 3D grid where the sum of is not equal to .
Input Format
Four integers and each on four separate lines, res... | true |
f0573a4e581abb9000822befc20d74af59d11087 | code1990/bootPython | /python/01base/chapter26.py | UTF-8 | 1,726 | 4.5625 | 5 | [] | no_license | # Python3 命名空间和作用域
# 命名空间(Namespace)是从名称到对象的映射,大部分的命名空间都是通过 Python 字典来实现的。
# Python 的查找顺序为:局部的命名空间去 -> 全局命名空间 -> 内置命名空间。
# var1是全局名称
var1 = 5
def some_func():
# var2是局部名称
var2 =6
def some_inner_func():
# var3是内部嵌套的局部名称
var3=7
# 作用域就是一个 Python 程序可以直接访问命名空间的正文区域。
# 规则顺序: L –> E ... | true |
cabdb9b172ded1d16475bc16b9981cf8c1de3777 | fjacob21/weatherstation | /lighting.py | UTF-8 | 954 | 2.875 | 3 | [] | no_license | import time
class Lighting(object):
RED = 0x880000
GREEN = 0x008800
BLUE = 0x000088
YELLOW = 0x884400
CYAN = 0x0088BB
MAGENTA = 0x9900BB
WHITE = 0x888888
def __init__(self, magtag):
self._magtag = magtag
self._blink_start = 0.0
self._blink_duration = 0.0
... | true |
8095929c2afbb15d20c51b61830f8fd27df729b7 | Fafa87/EP | /examples/ep/evalplatform/compatibility.py | UTF-8 | 2,017 | 2.703125 | 3 | [
"MIT"
] | permissive | from attrdict import AttrDict
def plot_comparison_legacy_parse(args, input_type):
"""
Parse args and return AttrDict with parameters:
- output_summary_stdout: if OutputStd is specified or not existent
- input_directory: directory with input image data or not existent
- input_file_part: substring p... | true |
ccdb63bd624ff95517fa8fa1adc37fb78c1be367 | jrsavage29/Software-Design | /Commandline calculator/integration_test.py | UTF-8 | 1,235 | 2.640625 | 3 | [] | no_license | # ECE 3574, Project 2 integration testing - short example
import pexpect
import pexpect.replwrap as replwrap
import unittest
import os
# the vtcalc executable
cmd = './vtcalc'
class TestExecuteFromCommandLine(unittest.TestCase):
def test_addition(self):
args = ' -e ' + ' "3 4 +" '
(output, retco... | true |
5020c3fa0e0f5af7e520b450ac2e13823176b35c | undo-nothing/swttaro | /swttaro/crypto_utils.py | UTF-8 | 2,015 | 2.921875 | 3 | [
"MIT"
] | permissive | import base64
from binascii import b2a_hex, a2b_hex
from Crypto import Random
from Crypto.Cipher import PKCS1_v1_5, AES
from Crypto.PublicKey import RSA
AES_PASSWORD = b'test#aespassword'
AES_IV = b'1111111111#aesiv'
random_generator = Random.new().read
def get_keys():
rsa = RSA.generate(1024, random_generator... | true |
770b510fdf48f324b93602658ca9bc7f0a8a4fad | reproto/reproto | /it/structures/python3/code-default/test.py | UTF-8 | 1,952 | 2.875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | import enum
class Entry:
def __init__(self):
pass
@staticmethod
def decode(data):
return Entry()
def encode(self):
data = dict()
return data
def __repr__(self):
return "<Entry>"
class Type:
def __init__(self):
pass
@staticmethod
def decode(data):
return Type()
def e... | true |
87ba093badbd8e563c05a452af0b5a83d008c5b3 | Tarun-Karthik/ieee-ctf-summerproject | /number_system_conversions/hextobi.py | UTF-8 | 492 | 3.078125 | 3 | [] | no_license | hex = raw_input("enter an octal number with commas between each digit :")
x = hex.split(',')
l = len(x)
a = 0
Z = []
print "binary :",
while a!=l:
b = []
c =[]
if x[a]=='A':
r=10
elif x[a]=='B':
r=11
elif x[a]=='C':
r=12
elif x[a]=='D':
r=13
elif x[a]=='E':
r=14
elif x[a]=='F':
r=15
else:
r = x[a... | true |
a75c254a910cd01a63ce9c2dab00d9f9cec124ad | awdonahue/proto | /models/protocols.py | UTF-8 | 3,551 | 2.578125 | 3 | [] | no_license | import pathlib
import importlib
import logging
import struct
from abc import ABC, abstractmethod
from typing import List
__all__ = ['Mps7']
class Mps7:
"""
Decode binary data
"""
SIG = (77, 80, 83, 55) # MPS7
HBYTES = (4, 1, 4) # magic, version, num_records (uint32)
RBYTES = (1, 4, 8, 8) # t... | true |
9ef66ec9bc8a068b32051a58dc48a0e68dd304ff | seoket1/BootCamp2017 | /Homeworks/Computation/Week5/Problem2/serial/econ.py | UTF-8 | 1,287 | 2.90625 | 3 | [] | no_license | #======================================================================
#
# sets the economic functions for the "Growth Model", i.e.,
# the production function, the utility function
#
#
# Simon Scheidegger, 11/16 ; 07/17
#======================================================================
from p... | true |
ebb1cef770019c6c3f921f343ffb93605068e191 | drcpcg/codebase | /_leet/medium1/balanced_paranthesis_generate_backtrack.py | UTF-8 | 963 | 4.03125 | 4 | [] | no_license | # https://leetcode.com/problems/generate-parentheses
# backtrack
'''
keep track of open and close ( )
add ( if there is char left place
add ) if there is openeing bracket
backtrack
'''
class Solution(object):
def generateParenthesis(self, N):
ans = []
def backtrack(S = '', left = 0, right = 0... | true |
262dbdcff55df6797ae3254891c8158dd1d44609 | cryptovoting/shuffle-sum | /tests/test_protocols.py | UTF-8 | 15,273 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
test.py
Boucher, Govedič, Saowakon, Swanson 2019
Unit tests for protocols.
"""
import unittest
from damgard_jurik import keygen
from shuffle_sum.ballots import CandidateOrderBallot, FirstPreferenceBallot
from shuffle_sum.protocols import compute_first_preference_tallies, eliminate_candida... | true |
a4a1637283967f3e7f2d08017a8458c3b8c2ea2c | pasinimariano/masterUNSAM | /clase07/costo_camion.py | UTF-8 | 490 | 3.28125 | 3 | [] | no_license | # Ejercicio 7.2: Función main()
# costo_camion.py
import informe
import sys
def main(argv):
"""
Computa el precio total del camion
"""
if len(sys.argv) != 2:
raise SystemExit(f'Uso adecuado: {sys.argv[0]} ' 'path:archivo_camion')
camion = informe.leer_camion(open(argv[1], encoding='utf8')... | true |
5aabaa5e1fbadcd24f82192362c31c20d829a11f | gyang274/leetcode | /src/0900-0999/0996.num.squareful.array.py | UTF-8 | 1,696 | 3.421875 | 3 | [] | no_license | from typing import List
from collections import defaultdict, Counter
from functools import lru_cache
from math import factorial
class Solution:
def numSquarefulPerms(self, A: List[int]) -> int:
"""dynamic programming, O(N^2 2^N), num of hamilton path on undirect graph.
"""
# graph, nodes are connected if... | true |
85a15a72176b220ffe0f119906d7288105597841 | andrewaibinder/arepositoryoficeandfire | /sql.py | UTF-8 | 3,993 | 2.671875 | 3 | [] | no_license | import MySQLdb
import pandas as pd
from config import get_main_configurations, get_db_configurations
from log import log
from sqlalchemy import create_engine
def get_connect():
credentials = get_db_configurations()
host = credentials['host']
db = credentials['database']
user = credentials['user']
p... | true |
df0630ecfcfd3b765327aac46c4ff0861c471ee8 | Sindorman/Homework | /python/cpts315/PA1/cross-selling.py | UTF-8 | 3,349 | 3.53125 | 4 | [] | no_license | #!/usr/bin/python3
'''
Programmer: Mykhailo Bykhovtsev
Class: CptS 315
Programming Project #1
Description: This is program that runs A-priori algorithm on given data and outputs 5 pairs and triples with most confidence.
'''
import sys
import timeit
from apyori import apriori
def main():
# Handling... | true |
657c18cd45a048017681c2241a2e369c2cdfe5b8 | kyeeh/holbertonschool-machine_learning | /supervised_learning/0x03-optimization/4-moving_average.py | UTF-8 | 510 | 3.328125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
Optimization Module
"""
import numpy as np
def moving_average(data, beta):
"""
Calculates the WMA using bias correction
data is the list of data to calculate the moving average of
beta is the weight used for the moving average
Returns: a list containing the moving aver... | true |
e2ef0726b818809ff99d229ef43f79acbfe2e44d | AdamZhouSE/pythonHomework | /Code/CodeRecords/2325/60620/261663.py | UTF-8 | 271 | 2.9375 | 3 | [] | no_license | import collections
s=list(map(int,input().split(',')))
count = collections.Counter(s)
n= len(s)
judge=0
for x in range(2, n+1):
if n % x == 0:
if all(v % x == 0 for v in count.values()):
judge=1
if(judge==0):
print(False)
else:
print(True) | true |
55b6f0140980a37e06babe69659e7bb1d5894528 | luyasi/python_study | /python-4-20180907/test.py | UTF-8 | 4,522 | 3.953125 | 4 | [] | no_license | """sed 转换"""
"""
1.int、float、complex、bool 都不能转换。
2.str、list可以转换
3.dict 只能转换键
"""
# var = 1
# val = set(var)
# print(val,type(val))
# var = 0.1
# val = set(var)
# print(val,type(val))
# var = 1+0j
# val = set(var)
# print(val,type(val))
# var = True
# val = set(var)
# print(val,type(val))
# var = "hello world"
# val = s... | true |
428542700f78ad80836693c9957cac0ea7f1c7e5 | S-Ping/FlaskBaseTemplate | /libs/date.py | UTF-8 | 500 | 3.25 | 3 | [] | no_license | __author__ = 'SPing'
import datetime
class DateTime:
@staticmethod
def is_datetime(time_obj):
assert isinstance(time_obj, datetime.datetime)
def make_strftime(self, time_obj):
"""
make to str
:param time_obj:
:return:
"""
self.is_datetime(time_obj... | true |
4c3b30dc4e28662b5ed2df8295c96613f97652cd | jammers-ach/pywolf3d | /pywolf3d/sprites.py | UTF-8 | 2,163 | 3.046875 | 3 | [
"MIT"
] | permissive | import logging
from pywolf3d import util
from ursina import Entity, scene, Plane, color, load_texture
logger = logging.getLogger(__name__)
class Sprite(Entity):
def __init__(self, texture, position, parent=scene):
x, y, z = position
txt = load_texture(texture, path="wolfdata/extracted/")
... | true |
453ba8c503b518c26fa68c7851b77704c8fd4f3d | Aplex2723/Introduccion-en-Python | /Funcionalidades avanzadas/comprencion-de-lista.py | UTF-8 | 1,352 | 3.71875 | 4 | [] | no_license | # Metodo tradicional
lista = []
for letra in 'casa':
lista.append(letra)
print(lista)
# Metodo con comprecion de listas
lista = [letra for letra in 'casa']
print(lista)
# Metodo tradicional
lista = []
for numero in range(0,11):
lista.append(numero**2)
print(lista)
# Metodo con comprenci... | true |
29b3d4868198f3a9add8b2389304eab39755b425 | DougallPercival/ws-gnn-patentnet | /SGConv_training.py | UTF-8 | 3,787 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 8 19:17:27 2020
@author: Paul Rev Oh
"""
import os
from utils import construct_graph_data
path = os.getcwd()
code_dir = os.path.join(path, 'src/')
data_dir = os.path.join(path, 'data/')
import torch
from torch_geometric.nn import SGConv
import torch.nn... | true |
2a8854761525a0ce70519b15e77739ae4a82cd8f | betty29/code-1 | /recipes/Python/286245_fast_prime_number_list_creator/recipe-286245.py | UTF-8 | 313 | 3.265625 | 3 | [
"Python-2.0",
"MIT"
] | permissive | def prime_numbers_less_than(N):
if N <= 3:
return range(2,N)
primes = [2] + range(3,N,2)
index = 1
max = N ** 0.5
while 1:
i = primes[index]
if i>max:
break
index += 1
primes = [x for x in primes if (x % i) or (x == i)]
return primes
| true |
38a2155eee1cee17ca017c0396c4a41ee1f4cfce | Nikolai-veb/Algoritms | /Recipes/date_num_range_for_current_month.py | UTF-8 | 1,670 | 3.59375 | 4 | [] | no_license | Вот функция, которая принимает любой объект datetime и возвращает кортеж,
содержащий первую дату месяца и начальную дату следующего месяца:
from datetime import datetime, date, timedelta
import calendar
def get_month_range(start_date=None):
if start_date is None:
start_date = date.today().replace(day=1)
_, days_i... | true |
68ffb5f12bfdd174c7af64f5b6fff65eadc6e772 | ihayton7358/projects | /Minecraft/Space_invader/space_invader_4.py | UTF-8 | 996 | 2.765625 | 3 | [] | no_license | import mcpi.minecraft as minecraft #importing mcpi.minecraft and giving it the alius of minecraft
mc = minecraft.Minecraft.create()
def spaceinvader(xcorner,ycorner,zcorner,colour,background):
wool = 35 #wool is defined
mc.setBlocks(xcorner,ycorner,zcorner,xcorner+12,ycorner-9,zcorner,wool,background)
y ... | true |
c3eb5b437e69d05185eff4e5218221438ca270bd | open-pythons/lottedfs | /com/ConnectSqlite.py | UTF-8 | 2,344 | 2.640625 | 3 | [] | no_license | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
import sqlite3
class ConnectSqlite:
def __init__(self, dbName="./.Proxies.db"):
self._conn = sqlite3.connect(
dbName, timeout=3, isolation_level=None, check_same_thread=False)
self._conn.execute('PRAGMA synchronous = OFF')
self._c... | true |
53d939d894f72ac76e7b535790d12f0455e5cd00 | estevamgalvao/IPI-Assignment1 | /Questão1.py | UTF-8 | 2,442 | 3.15625 | 3 | [] | no_license | import numpy as np
import cv2
import copy
from rgb2gray import rgb2grey
from calc_distancia import calc_distancia
from equalize import equalize
num_pixels = 0
esforco_pixels = 0
imgMars = cv2.imread("Mars.bmp") # Leio a imagem alvo
imgMars_aux = copy.copy(imgMars) # Aqui copio uma nova imagem para conseguir alterar ... | true |
03b17b6d88e78643009d6f9c4d9d96d3e2adb2e6 | JokerZhouHao/KnowledgeBase | /python_draw_graph/test/tt.py | UTF-8 | 890 | 2.671875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import copy
from matplotlib.transforms import Bbox
fig = plt.figure()
ax1 = fig.add_subplot(111)
xs = [1, 2, 3]
box = Bbox([[0,0], [1, 1]])
# ax1.fill([0, 1, 1, 0], [0, 0, 1, 1], hatch='x')
ax1.fill([0, 1, 1, 0], [0, 0, 1, 1], hatch=None)
ax1.tick_params(direction='... | true |
4fdcc7fdc2c1db7d445e5615660f1f38699004bb | baiyigali/Plate-Recognition | /image/create_plate.py | UTF-8 | 5,703 | 2.640625 | 3 | [] | no_license | # encoding=utf-8
import cv2, os
import numpy as np
from PIL import Image
import concurrent.futures
CLASS_DICT = {"京": 0, "沪": 1, "津": 2, "渝": 3, "冀": 4,
"晋": 5, "蒙": 6, "辽": 7, "吉": 8, "黑": 9,
"苏": 10, "浙": 11, "皖": 12, "闽": 13, "赣": 14,
"鲁": 15, "豫": 16, "鄂": 17, "湘"... | true |