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 |
|---|---|---|---|---|---|---|---|---|---|---|
2e4ab79993618ce865dcd1bc02f3f56d2fa60135 | roxaxis/editdistance | /MemoisedEditDistance.py | UTF-8 | 1,948 | 3.71875 | 4 | [] | no_license | import time
def memoizedDistance(x, y, memo=None):
if memo is None: memo = {}
if len(x) == 0: return len(y)
if len(y) == 0: return len(x)
if (len(x), len(y)) in memo:
return memo[(len(x), len(y))]
if x[-1] == y[-1]:
return memoizedDistance(x[:-1], y[:-1], memo)
substitution... | true |
5b7cae14f6604076f2d1d569309dd2802ca86882 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_97/1719.py | UTF-8 | 1,858 | 2.953125 | 3 | [] | no_license | #Google code jam
#Qualifiers
inputList = []
outputNums = []
def parseInput( filename ):
fd = open( filename )
for line in fd:
line = line.strip('\n')
numberRange = line.split(' ')
inputList.append( numberRange )
outputNums.append(0)
inputList.pop(0)
outp... | true |
dcba854220633196ca19d918cfe47319ee545558 | AminMortezaie/DataBase_Phase0 | /db_file.py | UTF-8 | 10,312 | 3.03125 | 3 | [] | no_license | import wx
class MyFrame(wx.Frame):
bookRecord = 1
publisherRecord = 1
def __init__(self, parent):
self.recordFinder(True)
self.recordFinder(False)
wx.Frame.__init__(self, parent)
box = wx.TextEntryDialog(None, "What do you want to do?")
answer = "nothing!"
... | true |
f85513c327069697253685d6577f9205cb25c346 | silvershine157/ML-Demos | /tutorials/pytorch/training/show_attend_tell/data_processing.py | UTF-8 | 7,662 | 2.859375 | 3 | [] | no_license | import numpy as np
import torchvision
import torch
import torch.nn as nn
from torch import optim
from PIL import Image
from torch.utils.data import Dataset, DataLoader
import random
import itertools
from constants import device, PAD_token, START_token, END_token
# Voc: Vocabulary mapping class inspired by pytorch cha... | true |
9853de729236eb4a044c5595653e031d3d54e99a | Sakib-Ar-Rahman/OCR_openCV3_KNearestNeighbour | /classify.py | UTF-8 | 1,968 | 2.921875 | 3 | [] | no_license | import numpy as np
import cv2 as cv2
import time
from matplotlib import pyplot as plt
import image_input_processing
# Training model with digits.png
def train_model_KNN(knn):
img = cv2.imread('digits.png')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
# Now we split the image to 5000 cells, each 20x20 size
cells =... | true |
566cc9489bef5b1f7cbb4b451f0305b1fed1a8ea | sumanes4u/Anaconda-Projects | /All-Classes_DotPY/Class-14-Getter-Setter-Property.py | UTF-8 | 4,491 | 3.84375 | 4 | [] | no_license |
# coding: utf-8
# In[1]:
class Celsius:
def __init__(self,temperature=0):
self.temperature = temperature
def to_fahrenheit(self):
return (self.temperature * 1.8) + 32
# In[2]:
man = Celsius()
# In[4]:
# Setting the temperature
man.temperature = 37
# In[5]:
# Get temperature
... | true |
c260dad61a1d45b69475f60c41823a7765497479 | bcongdon/github_contributions | /github_contributions/user.py | UTF-8 | 4,779 | 2.890625 | 3 | [
"MIT"
] | permissive | from datetime import timedelta, date
from bs4 import BeautifulSoup
from dateutil.parser import parse
import requests
from .contributions import GithubContributions
from .exceptions import GithubUserNotFoundException
BASE_URL = 'https://github.com'
CONTRIB_URL = BASE_URL + '/users/{0}/contributions'
class GithubUse... | true |
19ad8dc8b49b937b73427331e0d5600f6ae36022 | jesusalba9504/Automaz_Monocromador | /mono_ino_sketch/simple_control.py | UTF-8 | 370 | 3.140625 | 3 | [] | no_license | import time, serial
try:
fabkit = serial.Serial('COM5', 9600)
except:
print('Failed to connect')
exit()
print(fabkit.readline())
while 1:
var = input("Enter 1 for ON and 0 for OFF:")
if (var == '1' or var == '0'):
fabkit.write(var.encode())
time.sleep(1)
elif (var == 'q'):
print("Exiting...")
... | true |
2f393139c38a27b34244f909059e1ee2a8e7b7aa | corutopi/AtCorder_python | /AtCoderRegularContest/136/B.py | UTF-8 | 3,463 | 3.109375 | 3 | [] | no_license | # 解説AC
# import sys
# sys.setrecursionlimit(10 ** 6)
# # for pypy
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
# import bisect
from collections import deque
# import string
from math import ceil, floor
inf = float('inf')
mod = 10 ** 9 + 7
mod2 = 998244353
class BinaryIndexedTree:
"""
l = ... | true |
d76d8f7928f7f8098a4fe685abfbc0f3d5562abe | JasonObeid/Chart2Text | /utils/summarySanityTest.py | UTF-8 | 656 | 2.5625 | 3 | [] | no_license | labelPath = '../data/test/testSummaryLabel.txt'
goldPath = '../data/test/testOriginalSummary.txt'
summaryPath = '../data/test/testSummary.txt'
count = 0
with open(labelPath, 'r', encoding='utf-8') as labelFile, open(summaryPath, 'r', encoding='utf-8') as summaryFile, \
open(goldPath, 'r', encoding='utf-8') as... | true |
ae658e384fb98b29b12cb68cb4b0fccb2f0f6d06 | mehulchopradev/yannick-python-core | /collegeuser.py | UTF-8 | 208 | 3.015625 | 3 | [] | no_license | class CollegeUser:
def __init__(self, name, gender):
self.name = name
self.gender = gender
def getdetails(self):
return 'Name:{0}\nGender:{1}'.format(self.name, self.gender)
| true |
1b495a0e2eedd9c2e4a219c017c480447875dcdb | Sunqg52/pythonwork1 | /Data_vis/_04.py | UTF-8 | 1,394 | 3.34375 | 3 | [] | no_license | from random import randint
from plotly.graph_objs import Bar, Layout
from plotly import offline
class Die:
def __init__(self,num_sides=6):
self.num_sides = num_sides
def roll(self):
return randint(1, self.num_sides)
die = Die() # 6面骰子
die_1 = Die(10) # 10面骰子
# 掷几次骰子并将结果存储在同一个列表中
results = []
for roll_num in ... | true |
7cf8652ca9f51e2d8c78f1336365cf0c0e6597f4 | trekvartista/Tupper-s-formula | /src/view.py | UTF-8 | 1,869 | 3.3125 | 3 | [] | no_license | from tkinter import *
from tkinter import filedialog
from PIL import Image, ImageTk
root = Tk()
# Set Title as Image Loader
root.title("Image Loader")
# Set the resolution of window
root.geometry("600x400")
# Allow Window to be resizable
root.resizable(width = True, height = False)
file_name = 'Фа... | true |
099e5f61a9a147af591297978a11e3521f0f1113 | markus2013/AT | /src/MdiFrame.py | UTF-8 | 980 | 2.546875 | 3 | [] | no_license | import wx
from KFrame import KFrame
class MdiFrame(wx.MDIParentFrame):
def __init__(self):
wx.MDIParentFrame.__init__(self, None, -1, "MDI Parent", size=(600, 400))
self.create_menu()
self.create_toolbar()
def create_menu(self):
self.menu = wx.Menu()... | true |
2c9d67dc2d8e10d4197d1df7646283c9235b63cc | gurjinderrana78/Assessment-of-grain-of-production | /Mainfile.py | UTF-8 | 4,364 | 2.78125 | 3 | [] | no_license | import numpy as np
import pandas as pd
from random import shuffle
data = pd.read_csv("Data.csv")
print(data.head())
clay1=np.repeat('clay',1200)
clay1=clay1.reshape(1200,1)
clay1
print(type(clay1))
sandy1=np.repeat('sandy',1300)
sandy1=sandy1.reshape(1300,1)
print(type(sandy1))
good1=np.repeat('good_bio_con... | true |
6961e86d1443acc5eaa808bd52b0749019590aee | tomgonzo/Learning-PY | /17-Regular Expressions/dutch.py | UTF-8 | 184 | 3.203125 | 3 | [] | no_license | #Challenge 1! Looking for Dutch in Zen.
import os
import re
with open("zen.txt", "r") as zen:
scribe = zen.read()
scout = re.findall("Dutch", scribe, re.IGNORECASE)
print(scout)
| true |
687b58769db45371df5f2c129a3d99453dd85116 | alexwohletz/scrapy_test | /spiders/item_spider.py | UTF-8 | 1,632 | 2.84375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
from scrapy.loader import ItemLoader
from test_scraper.items import MyItems
from birdseye import eye
class ItemSpiderSpider(CrawlSpider):
name = 'item_spider'
start_urls = [
... | true |
184157f46a36d6305102ec2b3d3b1e67d97b9bb2 | DanSGraham/code | /Centre_College/CSC_117/CSC_117_Python_Files/owlRacing2 (previous).py | UTF-8 | 13,570 | 3.375 | 3 | [] | no_license | #Obstacles: Different kinds of trees? Castles/houses?
#New features: Portals? Rogue Bludgers? Wizards on brooms in the background
#Around Christmas, the trees become christmas trees.
#The game changes with seasons? Shadows for time of day?
# Story?
# Way to subtly incorporate Slytherin
#Add music
from g... | true |
976537f6d300664a74aaf525eb49a687ddeaa9ab | Kisu95/python-course | /5-1.py | UTF-8 | 944 | 3.625 | 4 | [] | no_license | # Find another public API with cryptocurrency and compare prices. As an output print:
# "Currently the XXX exchange market is better for buying whilst YYY is better for selling" (3p)
import requests
response1 = requests.get("https://bitbay.net/API/Public/BTCUSD/ticker.json")
data1 = response1.json()
sell1 = data... | true |
8e20f52c6c84d260e9bfbb1f9f06dceab8e2b82b | ENCODE-DCC/hic-pipeline | /tests/python/test_normalize_assembly_name.py | UTF-8 | 1,021 | 2.5625 | 3 | [
"MIT"
] | permissive | import pytest
from hic_pipeline.normalize_assembly_name import (
get_wdl_boolean_string,
normalize_assembly_name,
normalize_grch_name,
)
@pytest.mark.parametrize(
"assembly_name,expected",
[
("GRCh38", ("hg38", True)),
("hg19", ("hg19", True)),
("GRCh37", ("hg19", True)),
... | true |
4f713dff4c634d6a0a594f1fec04b9e1252df1ea | lxngoddess5321/python3crawler | /解析库的使用/beautifulSoup/1.初识beautifulSoup.py | UTF-8 | 367 | 3.328125 | 3 | [
"MIT"
] | permissive | from bs4 import BeautifulSoup
# 初始化成html对象 并且自动补全缺失标签
soup = BeautifulSoup('<p>Hello</p>', 'lxml')
# 整个beautifulSoup对象
print(type(soup), soup)
# <html><body><p>Hello</p></body></html>
# 元素标签对象
print(type(soup.p), soup.p)
# <p>Hello</p>
# 元素导航字符串
print(type(soup.p.string), soup.p.string)
# Hello
| true |
e8a587f892f49edeaf6927e57113a7eeec0f3495 | prasadhegde001/Turtle_Race_Python | /main.py | UTF-8 | 1,115 | 3.90625 | 4 | [] | no_license | from turtle import Turtle,Screen
import random
is_race_on = False
screen = Screen()
screen.setup(width=500, height=400)
user_input = screen.textinput(title="Please Make Your Bet", prompt="Which Turtle Will win the Race? Enter a color")
colors = ["red", "orange", "yellow", "green", "blue", "purple"]
y_positio... | true |
20b9d9679eb7df3c479f79c4e08ec564bb517e54 | CollinErickson/LeetCode | /Python/31_NextPermutation.py | UTF-8 | 1,949 | 3.125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 16 22:08:12 2018
@author: cbe117
"""
class Solution(object):
def nextPermutation(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
lennums = len(nums)
if lennu... | true |
50a1273462307a834a33884a8bd75f819016e291 | developer-Wonjun/python-newbie | /숫자맞추기 놀이.py | UTF-8 | 366 | 4.03125 | 4 | [] | no_license | import random
print("1부터 10000사이의 숫자를 맞추시오")
a = random.randint(1, 10000)
n = 0
b = 0
while a != b:
b = int(input("숫자를 입력하시오 :"))
if a > b:
print("높음!")
elif a < b:
print("낮음!")
else:
print("정답")
n = n + 1
print("축하합니다. 시도횟수 : {0}".format(n))
| true |
a43bb4e7c288b12d57440505b1f182c5faafa8ae | hissohathair/puzzle-solvers | /tests/test_tester.py | UTF-8 | 5,286 | 3.234375 | 3 | [
"MIT"
] | permissive | """Unit tests for puzzle.tester classes and functions."""
import unittest
import puzzle.latinsquare as ls
import puzzle.sudoku as su
import puzzle.tester as pt
TEST_PUZZLE_STRINGS = [
"89.4...5614.35..9.......8..9.....2...8.965.4...1.....5..8.......3..21.7842...6.13",
"..75.....1....98...6..1.43.8.5..2.1..... | true |
73cd25ffae6056217be6c1e5c35a4e80ef0a7690 | itsmihhhhhh/blog | /tests.py | UTF-8 | 2,761 | 2.609375 | 3 | [] | no_license | from datetime import datetime
import unittest
from flask import request
from app import app, db, bcrypt
from app.models import User, Blog
from flask_login import current_user
class UserModelCase(unittest.TestCase):
def setUp(self):
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://'
self.app = app... | true |
7e3475e0ee318809b935222db07e10248a043601 | prashadr2/RPI-CS1 | /HW4/hw4_part1.py | UTF-8 | 1,953 | 2.75 | 3 | [] | no_license | '''
Ryan Prashad
10/15/18
The lifeguard optimal angle problem
'''
import lifeguard
def get_optimal(case, values):
'''
this function returns the optimal angle of a lifeguard running
'''
chkangles = []
lookmax = []
if values[2] > 2:
mystp = (values[1] - va... | true |
427c86c7ca4ba42667e6d085c870caa6c764770e | nbhatia8/weatherbot | /LuisBotGit/python3/luis_sdk/luis_action.py | UTF-8 | 1,069 | 3.203125 | 3 | [] | no_license |
from .luis_parameter import LUISParameter
class LUISAction:
'''
LUIS Action Class.
Describes the LUIS Action structure.
'''
def __init__(self, action):
'''
A constructor for the LUISAction class.
:param action: A dictionary containing the action data.
'''
s... | true |
6a2e38db9e4173c33f36bf4678b82a122e316dd8 | victoiris/test | /working_4.py | UTF-8 | 195 | 3.21875 | 3 | [] | no_license | mam_age = 89
if mam_age > 50 :
print ("wow!")
_list = [1, 2, 3, 8, 4, 5]
_list.append(6)
print (_list)
_tuple = (1, 2, 3, 8, 4, 5)
print (_tuple)
_dict = {5: 1, 6: 2, 7: 3}
print (_dict) | true |
fa2b17e140742f015a50dcfed1d0bd9378203167 | lame/Broadcast | /app/mod_sms/adapters.py | UTF-8 | 4,201 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import re
from flask import request, current_app
from flask_restful import reqparse
from urllib.parse import urlparse
FIRST_CAP_RE = re.compile('(.)([A-Z][a-z]+)')
ALL_CAP_RE = re.compile('([a-z0-9])([A-Z])')
class MessageRequest(object):
def __init__(self):
kwargs = self.parse_request()
self.s... | true |
c2af548712f516d79fbc5db68397442eaa915214 | sourav22899/6.006_Codes | /mit05.py | UTF-8 | 3,687 | 3.65625 | 4 | [] | no_license | """
The AVL Part doesnot work properly because once the root rotates during a "rotate" operation
the root changes.So, you have to define a class "AVLTree" and all the operations like insert,
delete etc. should be under class "Node".For more details, see bst.py from MIT.
"""
class Node:
def __init__(self,key... | true |
39b624c6389da8995374d2a18c1f1b8e6e49f178 | wajid-shaikh/Python-Examples | /20 csv files/1_work_with_csv.py | UTF-8 | 306 | 3.3125 | 3 | [] | no_license | # csv - comma separated values
# to store data in tabular formats
from csv import reader
with open('file.csv','r') as f: # f - treated as object
csv_reader = reader(formats)
# csv_reader is an iterator
# print(type(csv_reader))
next(csv_reader)
for row in csv_reader:
print(row) | true |
240bf5e4803796924642767694682836ea05977a | kujaku11/mth5 | /mth5/groups/experiment.py | UTF-8 | 3,441 | 2.734375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 23 16:59:45 2020
:copyright:
Jared Peacock (jpeacock@usgs.gov)
:license:
MIT
"""
# =============================================================================
# Imports
# =============================================================================
from mth5.... | true |
5cd14eec71db12aead8a712cb79fa3cafa8f25bf | brandonfire/DGA_machinelearning | /pre.py | UTF-8 | 3,283 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
import glob
import statistics
import numpy as np
g_s_search_string = "Cryptolocker"
g_s_path = "./*.txt" # Location of log files
g_i_cache_threshold = 100 # Number of Domain to Conduct Averages
g_i_detection_threshold = 1.0 # Sensitivty of Match
g_sz_files = glob.glob(g_s_path)
g_i_dga_count... | true |
1504f479ed8813f5b1814f4890e85fe78e30fc1c | vasudha-padala/first-step | /start.py | UTF-8 | 347 | 2.859375 | 3 | [] | no_license | import random
def started(dice1):
if dice1==6:
print('you are about to play')
print('press enter')
p=input()
print('i am in start block')
dice2=random.randint(1,6)
print('cmpltd dicing')
dice1=dice2
print('score is',dice1)
if dice2==6:
started(dice1)
else:
print('score is:',dic... | true |
16a54078d3bddcf2ccb307f2882cca7a62f9e3c5 | rafaelperazzo/programacao-web | /moodledata/vpl_data/173/usersdata/268/77276/submittedfiles/moedas.py | UTF-8 | 550 | 3.75 | 4 | [] | no_license | # -*- coding: utf-8 -*-
a=int(input('Digite o valor de a: '))
b=int(input('Digite o valor de b: '))
c=int(input(' Digite o valor da cédula: '))
if (a>b):
troca_a = n//a
n=n//a
troca_b = n//b
if ((troca_a) == int(troca_a)) and ((troca_b) == int(troca_b)):
print(troca_a)
print(troca_b)
... | true |
9aa66b46d97d68dfd2cdde8cefdb996d29552641 | lewis-s660/learn_maze_RL | /agent_dynamic_programing.py | UTF-8 | 10,261 | 2.71875 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
from agent_base import AgentBase
class AgentDynamicPrograming(AgentBase):
def __init__(self, environment, epsilon=0.1, decay=0.9, eta=0.1, gradient_minimum=0.001, mode_table=True, size=(8, 8)):
"""
コンストラクタ
:param epsilon: ε-Greedy方策で使用するεの値
... | true |
44bf409d627a6029ab4c4f1fff99f102b8d57279 | tejpk/APS_CodeLib | /CC_CARSELL.py | UTF-8 | 242 | 2.8125 | 3 | [] | no_license | # cook your dish here
t=int(input())
while t:
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
s=0
for i in range(n):
k=a[i]-i
if k>=0:
s+=k
print(s%1000000007)
t-=1
| true |
de6275b9df55e681c7d9c9563898a1ff56d775cb | MyoungHaSong/coding_study | /파이썬알고리즘강의/동전분배하기.py | UTF-8 | 650 | 3.171875 | 3 | [] | no_license | import sys
sys.stdin = open('input.txt','rt')
def DFS(L):
global res
if L ==n:
dif = max(money) - min(money)
if dif < res:
tmp = set() # 값이 다 다른걸 판별해야함
for x in money :
tmp.add(x)
if len(tmp) ==3:
res = dif
els... | true |
8a22305f9fc0dce6d174fdd7eb4a5c8a774c6031 | mileswwatkins/opencivicdata.org | /resources/dedup_jurisdictions.py | UTF-8 | 1,053 | 3.015625 | 3 | [] | no_license | import csv
unique = []
dup = []
fields = ['division', 'jurisdiction', 'name']
with open('active-jurisdictions.csv') as csvfile:
reader = csv.DictReader(csvfile)
seen = set()
rows = [x for x in reader]
for row in rows[::-1]:
key = row['jurisdiction']
if key not in seen:
se... | true |
0cbb0a217c6b6b6415db82a9f60b931bfd5ef159 | hitarthk/MCTS-ChainReaction | /utils/buffer.py | UTF-8 | 1,502 | 2.65625 | 3 | [] | no_license | from algo.MCTS import TreeNode
import numpy as np
class Buffer(object):
def __init__(self, totalRows = 5, totalCols = 5, numPlayers = 2):
self.totalRows = totalRows
self.totalCols = totalCols
self.numPlayers = numPlayers
self.states = np.empty((0, totalRows, totalCols, numPlayers), d... | true |
c75aff44315e06735ecab6424773cdff481f56f0 | aptend/leetcode-rua | /Python/1185 - Day of the Week/1185_day-of-the-week.py | UTF-8 | 838 | 3.21875 | 3 | [] | no_license | from leezy import Solution, solution
class Q1185(Solution):
@solution
def dayOfTheWeek(self, day, month, year):
# 36ms 69.10%
def is_leap(y):
return (y % 4 == 0 and y % 100 != 0) or (y % 400 == 0)
week = ["Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Th... | true |
0ed5bf5c2df1ead37db5c7a7e51df29b12aff4dc | csvoss/onelinerizer | /tests/closure_mutate.py | UTF-8 | 411 | 3.265625 | 3 | [
"MIT"
] | permissive | def f():
x = 1
a = lambda: x
b = (lambda: lambda: x)()
c = (lambda: lambda: lambda: x)()()
x = 2
print a(), b(), c()
f()
def g():
print [f() for f in [lambda: x for x in range(5)]]
print [f() for f in [(lambda: lambda: x)() for x in range(5)]]
print [f() for f in [(lambda x: lambda:... | true |
f0b5fa58426976fb845aa083574c20d072fa66e9 | GMU-vision-robotics/View-Invariant-Visual-Servoing-for-Navigation | /vs_controller/model_vs.py | UTF-8 | 33,690 | 2.53125 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
device = torch.device('cuda:0')
class Perception(nn.Module):
def __init__(self, input_channels, h=256, w=256):
super(Perception, self).__ini... | true |
2bfaaf37a7297c4525a32998422d805bd4a8b05b | BereniceAlexiaJocteur/Euler | /pb745.py | UTF-8 | 1,840 | 3.296875 | 3 | [] | no_license | import time
import sys
import math
import numpy as np
class Problem():
def __init__(self):
self.n = 10**14
self.res = 0
self.mod = 1000000007
self.sqrt = int(math.sqrt(self.n))
self.mu = np.array([1 for i in range(self.sqrt + 1)], dtype="int64")
self.sqrt_sqrt = in... | true |
5fecd8c529a6719b765e2404d847e8671fd3243c | manjunathsivan/cm | /deprecated/resource.py | UTF-8 | 1,304 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 11 23:57:04 2018
@author: yuluo
"""
from deprecated.ResourceABC import ResourceABC
import oyaml as yaml
import os
class Resource(ResourceABC):
def __init__(self):
# TODO:
self.yamlFile = os.path.expanduser("~/.cloudmesh/cloud... | true |
e7569841e2f0d38ef5537df83eab1283a9691545 | TIG-KI/ShiXun | /505day4/02循环.py | UTF-8 | 1,176 | 4.3125 | 4 | [] | no_license | '''
循环: for while
写法:
for x in 序列:
循环体
x表示:每一次循环都会把序列的值一次赋给x
循环里面常用2个关键字:
break:终止当前循环(最里面的循环)
continue:结束本次循环,继续下一次循环
while:
写法:
while 布尔表达式:
循环体(满足条件执行循环体,不满足条件就跳出循环)
'''
#计算1+2+3+...+100
sum = 0
for x in range(101):
sum += x
print(sum)
#优化 加到50就不加了
sum = 0
count = 0
for x in range(100000):
... | true |
f7a8f1d2660037ca5d09e0aa2eb68cb32bc64cc4 | bli-bli/first.py | /main.py | UTF-8 | 880 | 4.09375 | 4 | [] | no_license |
animal = "강아지"
name = "연탄이"
age = 4
hobby = "산책"
is_adult = age >= 3
# 정수형 과 boolean 자료형은 str 로 감싸주어야 한다
# 다만 , 로 문장을 이어줄 때는 str 로 감싸줄 필요가 없다. 그러나 , 가 들어가게 되면 무조건 , 가 하나씩 포함이된다.
print('우리집' + animal +'의 이름은' + name + '에요')
print(name + '는'+ str(age) +'살이며,'+ hobby +'을 아주 좋아해요')
# print(name+ '는 어른일까요?'+ str(is_adult)... | true |
5912ff4dfc48202c8ca8c20fdb2a8e70e507d28a | harrisonhardin/predicting-default-payment-next-month- | /preproc_n_eval.py | UTF-8 | 6,762 | 2.71875 | 3 | [] | no_license | print("loading libraries...", end="", flush=True)
import pandas as pd
import numpy as np
from numba import njit, jit
import json
import re
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import KFold
from sklearn.metrics import f1_score, precision_score, recall_score, accuracy_score
fro... | true |
e73fa575377c6a493c3cc7ee17d5ed2ae010286c | jsachs/diet_analysis | /interface.py | UTF-8 | 4,143 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python3
import curses
import time
import visualize
import logging
def display_data_menu(screen):
screen.clear()
screen.border(0)
x = get_date(screen, 2, 2, "Enter start date <MM/DD/YYYY>:")
y = get_date(screen, 3, 2, "Enter end date <MM/DD/YYYY>:")
curses.endwin()
visualize.... | true |
8c53bda312a3ca5e6143add28ad4e506b15ba3db | abdullahf454/abd | /quotes_spider.py | UTF-8 | 741 | 2.890625 | 3 | [] | no_license | # importing scrapy module
import scrapy
class ExtractUrls(scrapy.Spider):
# Name of the spider
crawled = set()
# Set to avoiding duplicate url
name = "extract"
def start_requests(self):
# Starting url mentioned
urls = ['http://www.geeksforgeeks.org', ]
for url in urls:
yield scrapy.Reque... | true |
9088081f5b13ab8a852986cab74c78a7290f6906 | ai-kmu/etc | /algorithm/2021/1007_15_3Sum/jungmin.py | UTF-8 | 1,455 | 3.265625 | 3 | [] | no_license | class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
ans = []
nums.sort() # nums 정렬
for i in range(len(nums)-2): # num안 요소를 마지막에서 3번째까지 for문 반복
# 2개 더할 왼쪽과 오른쪽 설정
right = len(nums)-1
left = i+1
if i>0 a... | true |
861d6c51989435744fc1ab8fba869d376708c572 | apple/swift-lldb | /packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py | UTF-8 | 3,405 | 2.671875 | 3 | [
"NCSA",
"Apache-2.0",
"LLVM-exception"
] | permissive | """
Test thread stepping features in combination with frame select.
"""
from __future__ import print_function
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
class ThreadSteppingTestCase(TestBase):
mydir = TestBase.compute... | true |
7257b4abb4b903981bbeec0f2c1e7400d917919c | ngeorgj/text-rpg-engine | /game/classes/effects/debuffs.py | UTF-8 | 868 | 2.75 | 3 | [] | no_license | from game.classes.effects.buffs import MassBuff
from game.classes.effects.effect import Effect
class Debuff(Effect):
def activate(self):
self.on_cast()
setattr(self, self.attribute, getattr(self, self.attribute) - self.effect_value)
def deactivate(self):
setattr(self, self.attribute,... | true |
dc05b6bde1ea7915fc915997fba399872d077ad9 | SeraphWedd/Pygame-Default-Build | /gameloop.py | UTF-8 | 4,540 | 2.890625 | 3 | [] | no_license | '''
Game Loop
Handles the main game's loop including screen updates and events.
This is a linear loop that handles each event one at a time.
Multithreading not yet supported.
'''
#Main imports
import pygame as pg
import os, sys, time
#Local scripts
from Scripts import engine
from Scripts import metho... | true |
be5fb58e6720e11b30cd0ca885703322be6cd19a | cookie-yang/DataMining | /cluster/Clustering.py | UTF-8 | 1,107 | 3.28125 | 3 | [] | no_license | import numpy as np
from sklearn import cluster
points = [] # stores features of the animals
labels = [] # stores the animal names
file = open('zoo.txt')
for line in file:
# example line: aardvark,1,0,0,1,0,0,1,1,1,1,0,0,4,0,0,1
data = line.strip().split(',')
point = (int(data[1]), int(data[2]),int(d... | true |
ea9ba3ce4851e4d5eca53e8425bcfb9e4435b785 | AviSoomirtee/Linux_python | /gps_read_data.py | UTF-8 | 889 | 2.921875 | 3 | [] | no_license | #This code is written by Diresh Soomirtee!
import serial
gps = serial.Serial("/dev/ttyACM0", baudrate = 9600)
while True:
line = gps.readline()
data = line.split(",")
if data[0] == "$GPRMC":
if data[2] =="A":
raw_lat = data[3]
ra... | true |
db729257c5df3dc262b1a6461e7c404ccefb5f99 | Bala93/Life_science | /clamp_status.py | UTF-8 | 2,544 | 2.9375 | 3 | [] | no_license | # Importing torch, numpy, image and machine learning packages
import torch
import torch.nn as nn
import torchvision
from torchvision import datasets,models,transforms
import numpy as np
from PIL import Image
import glob
from tqdm import tqdm
import os
from sklearn.metrics import confusion_matrix,classification_report... | true |
5d584609fa3fed20ed0713952287719a5b3db82a | abinjosephjosegiri/KtuCseLab | /Computer Science Workshop/exp13.py | UTF-8 | 156 | 3.5 | 4 | [] | no_license | 13. Check wethwe prime or not
num= input("no:")
if num>1:
for i in range(2,num):
if (num%i)==0:
print "not prime"
break
else:
print "prime"
| true |
463e0cf77dea0ff6a545954d1299882ce363d427 | skibold/ml-class | /3class/threeclass.py | UTF-8 | 1,607 | 2.578125 | 3 | [] | no_license | import numpy as np
from sys import argv
from svm import train as svm_train
from svm import test as svm_test
from gnb import train as gnb_train
from gnb import test as gnb_test
from Proj1Boosted import train as ada_train
from Proj1Boosted import test as ada_test
def transform_labels(labels):
return np.array(... | true |
2bd19fca53373b32b6f5c63598960cfa413637e0 | khanmazhar/Python-for-Everybody-Specialization | /using_python_to_access_web_data/week5.py | UTF-8 | 1,369 | 2.96875 | 3 | [] | no_license | # import xml.etree.ElementTree as ET
# data = '''
# <person>
# <name>Chuck</name>
# <phone type='intl'>+92 315 9813580</phone>
# <email hide='yes' />
# </person>
# '''
# tree = ET.fromstring(data)
# print("Name:", tree.find('name').text)
# print("Phone:", tree.find('phone')... | true |
a1384dbec17a4267d85905b12dbe559b0da7d27f | VidyaPuri/RoboCam | /simple_gui.py | UTF-8 | 4,235 | 3.09375 | 3 | [] | no_license | from tkinter import *
from tkinter import font
from numpy import interp
import Adafruit_PCA9685
import time
#PCA9685_pwm = Adafruit_PCA9685.PCA9685()
#PCA9685_pwm.set_pwm_freq(60)
servo_min = [130,170,165,135,340,0]
servo_max = [570,550,480,540,800,0]
root = Tk()
var0 = DoubleVar()
var1 = DoubleVar()
var2 = DoubleVar... | true |
2eff28812903287747aaa2c4e60902ee9366f1e0 | qphm/ur-data | /Hawaii-Analysis/app.py | UTF-8 | 3,503 | 2.53125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import datetime as dt
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from flask import Flask, jsonify
engine = create_engine("sqlite:///Resources/hawaii.sqlite", connect_args={'check_... | true |
ea6e810e75cf661721a2102e1c7455f9531a5716 | nastymajestic/python | /lab2/zad1.py | UTF-8 | 269 | 2.859375 | 3 | [] | no_license | import serial
import time
import re
print('Serial script started');
ser = serial.Serial('/dev/ttyACM0', 9600);
while True:
ser.write("echo");
out = ser.readline().decode("utf-8")
#num = re.findall(r"[-+]?\d*\.\d+|\d+", out);
print('Arduino ' + out);
| true |
3edfe5be92e25bb56245858e51a5f014a7d0c844 | mzoz/6.00.1x | /exercise/closure.py | UTF-8 | 144 | 2.953125 | 3 | [] | no_license | def outer(msg):
def inner():
print(msg)
return inner
# local variable detained after function call
fun = outer("hello")
fun()
| true |
6910a7cbec27a11755197cc662cc2b1e2c965c31 | daisuke24-mac/build_python | /arithope.py | UTF-8 | 205 | 3.453125 | 3 | [] | no_license | def add(a,b):
return a+b
def sun(a,b):
return a-b
def add_to_sub(a,b,c):
added = add(a,b)
suned = sun(added,c)
return suned
if __name__ == "__main__":
print(add(1,2))
print(add_to_sub(10,2,4))
| true |
6d200ef8536aa2cca2094bd06225c3cd9e794b77 | TwilioDevEd/account-verification-flask | /account_verification_flask/models/models.py | UTF-8 | 1,191 | 2.59375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | # from flask.ext.login import UserMixin
from account_verification_flask import db, bcrypt
class User(db.Model):
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
email = db.Column(db.String, nullable=False)
password = db.Column(db.St... | true |
5fe600e3b449af179e431591c4059a034731a0e4 | GabyPopolin/Estrutura_de_Decisao | /Estrutura_Decisao_exe_06.py | UTF-8 | 509 | 4.5625 | 5 | [] | no_license | '''Faça um Programa que leia três números e mostre o maior deles.'''
n1 = int(input('Digite o primeiro número: '))
n2 = int(input('Digite o segundo número: '))
n3 = int(input('Digite o terceiro número: '))
print('')
if n1 > n2 and n1 > n3:
print('O número {}, foi o maior número informado.' .format(n1))
elif n2 > ... | true |
08f06b904b3e67b99605003727b9596ed4813090 | PSI-Data-Acquisition/CVT-rpm-and-gear-ratio | /interrupt_rpm.py | UTF-8 | 573 | 2.78125 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
pri = 11 # G17
sec = 12 # G18
GPIO.setup([pri, sec], GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
# can't add separate callbacks for both rising and falling
#GPIO.add_event_detect(BTN_B, GPIO.RISING, lambda pin: GPIO.output(LED_B, False))
#GPIO.add_event_detect(B... | true |
62cef3a8556710c045edfd969069461ef4ce9af7 | ahicks92/collision_tutorial | /benchmark.py | UTF-8 | 2,303 | 3.109375 | 3 | [
"Unlicense"
] | permissive | import timeit
from collision_tutorial import (
test_helpers,
box,
base_algorithms,
partitioner,
box_manager,
)
def gen_boxes(n, stationary_probability=0.0):
# Generate some boxes with a reasonable chance of overlapping.
return test_helpers.generate_random_boxes(
n=n,
seed=... | true |
916168d24fcd316f62a55c4d1b170b7b6e1c7331 | Abhi31jeet/My-Python-codes | /loop_characteristics.py | UTF-8 | 103 | 3 | 3 | [] | no_license | l=[1,2,3]
while(l):
c = len(l)
if l[0]==3:
l.append(4)
l.append(5)
print(l,c)
l.pop(0)
| true |
4c835eb54cc0fed077f066fe3e78e44c2162112f | yimolasa/Commic | /archive/reference sample/threading01.py | UTF-8 | 1,038 | 3.640625 | 4 | [] | no_license |
import queue
import threading
import time
queue = queue.Queue()
class ThreadNum(threading.Thread):
def __init__(self, queue):
threading.Thread.__init__(self)
self.queue = queue
def run(self):
while True:
#消费者端,从队列中获取num
num = self.queue.get()
... | true |
6aa341d2c58b5b6e3fc996747463ec9bbe73b8e4 | univ-of-utah-marriott-library-apple/radmind_auto_image_creator | /scripts/radmind_auto_image_creator.py | UTF-8 | 23,781 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import automagic_imaging
import datetime
import os
import resource
import subprocess
import sys
import time
def main():
set_globals()
automagic_imaging.scripts.parse_options.parse(options)
if os.geteuid() != 0:
print("You must be root to execute this script!")
sys.exi... | true |
9f8f8b431b655ae61e4e93158e4fa193d21a9cd9 | nglazyrin/djturk-back | /src/python/util.py | UTF-8 | 305 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 21 04:42:09 2013
@author: Nikolay
"""
import re
def clean(s):
return re.sub('[^0-9a-zA-Z_]', '', s.lower())
def toUtf8(text):
return text.encode('UTF-8', errors='replace')
def toName(artist, track):
return artist + ' - ' + track
| true |
b1a956fa383c25f9ef137dbb896c179a4d84c465 | kingslayer2357/python-basics | /even_odd_string.py | UTF-8 | 183 | 3.390625 | 3 | [] | no_license | n=str(input('enter a string:'))
li=list(n)
even=''
odd=''
for k in range(len(li)):
if (k+1)%2==0:
even+=li[k]
else:
odd+=li[k]
print("even:",even ,"odd:",odd)
| true |
7732a512bdcb445725adae874b543c587bca9a9e | Dipeshpal/Jarvis | /Assistant/openurl.py | UTF-8 | 335 | 2.703125 | 3 | [] | no_license | import re, webbrowser
from text_to_voice import tts
def openReddit(command):
reg_ex = re.search('open reddit (.*)', command)
url = 'https://www.reddit.com/'
if reg_ex:
subreddit = reg_ex.group(1)
url = url + 'r/' + subreddit
print("Opening Reddit")
tts("Opening Reddit")
webbro... | true |
9fd76204a039ce71973f23aa0539a271d948b830 | diegonoceli/Image-Classifier | /train and classifier.py | UTF-8 | 1,928 | 3.125 | 3 | [] | no_license | # Importing the Keras libraries and packages
from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense
# Initialising the CNN
classifier = Sequential()
# Step 1 - Convolution
classifier.add(Conv2D(32, (3, 3)... | true |
a5c519ef87b7465d618f24591a42070223a0ebc6 | MaxPowerWasTaken/project_euler | /p6.py | UTF-8 | 674 | 4.125 | 4 | [] | no_license | """
https://projecteuler.net/problem=6
...
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is
3025 - 385 = 2640
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
"""
def sum_of_squares(... | true |
5738778912c81b30ce1baa72088c2b0a6732ec0d | Pabitha-1/python | /p10.py | UTF-8 | 34 | 2.65625 | 3 | [] | no_license | N=int(input("N="))
print(len(N))
| true |
ff91ca31a20b52229c978bb6a558bbdd9b06cfa6 | luke-zhou/tensorflow-practice | /lottery/word2vec.py | UTF-8 | 2,866 | 2.703125 | 3 | [] | no_license | from gensim.models import Word2Vec
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
import time
from oz_verify import verify_ticket
from statistics import mean, pstdev
def main():
train_features, test_features = load_data(50)
train_features_str =[[str(num) for num in ... | true |
aa2f900436c7e69abf807016dd8c610e3f461b1d | neeraj-satyaki/Data-Structures-1 | /LIsts/DoublyLinkedLists.py | UTF-8 | 3,135 | 3.5 | 4 | [] | no_license | import sys
class Node:
def __init__(self, data):
self.data = data
self.prev = None
self.next = None
class Lists():
def __init__(self):
self.head = None
def is_empty(self):
if not self.head:
return True
def insertAtLast(self, newdata):
newno... | true |
eb8fa3e0a29915bf97d2be392a833532d420a62c | PavelAltynnikov/http-server | /server.py | UTF-8 | 3,255 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
import socket
HOST = 'localhost'
# HOST = "172.28.0.1"
# HOST = "0.0.0.0"
# HOST = "25.74.64.44"
PORT = 8000
server_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1024)
server_sock.bind((HOST, PORT))
server_soc... | true |
2ad9eecf79b8a1119812d2a10a25174cd1b1701f | Partha177/python | /pillow_paste.py | UTF-8 | 175 | 2.90625 | 3 | [] | no_license | from PIL import Image
img1=Image.open("paul.jpg")
img2=Image.open("cocal.jpg")
print(img1.size)
print(img2.size)
area=(100,100,222,308)
img1.paste(img2, area)
img1.show()
| true |
b8e03f785eac973ffc1d255073c0cba0fd3a083f | ijlassi/codility_training_tasks | /max_product_of_three/max_product_tiplet.py | UTF-8 | 422 | 2.796875 | 3 | [] | no_license | def solution(A):
A = sorted(A)
for i in range (0,len(A)):
if A[0] * A[1] < 0 :
return A[len(A) - 1] * A[len(A) - 2] * A[len(A) - 3]
if A[0]*A[1] >= 0 :
if A[0] * A[1] * A[len(A) - 1] > A[len(A) - 1] * A[len(A) - 2] * A[len(A) - 3]:
return A[0] * A[1] * A[len(A) ... | true |
40a563d20015afb4431f906ead7b7a786a79d834 | bonifacius/stepik_selenium_course | /lesson_12.py | UTF-8 | 2,090 | 3.609375 | 4 | [] | no_license | # В этом задании после нажатия кнопки страница откроется в новой вкладке, нужно переключить WebDriver на новую вкладку и решить в ней задачу.
# Сценарий для реализации выглядит так:
# Открыть страницу http://suninjuly.github.io/redirect_accept.html
# Нажать на кнопку
# Переключиться на новую вкладку
# Пройти капчу дл... | true |
2c446f0f2e121c1355279d34161ac4d1c3356f5f | linkinpark213/leetcode-practice | /pysrc/lcof/62.py | UTF-8 | 381 | 3.359375 | 3 | [] | no_license | class Solution:
def lastRemaining(self, n: int, m: int) -> int:
nums = list(range(n))
ptr = 0
while len(nums) > 1:
ptr = (ptr - 1 + m) % len(nums)
nums.pop(ptr)
return nums[0]
if __name__ == '__main__':
solution = Solution()
print(solution.lastRemain... | true |
acb40160e0261033160e0fc4b928779670a99c80 | yutori-telepath/algorithm | /union-find/union_find.py | UTF-8 | 1,129 | 3.484375 | 3 | [] | no_license | from collections import deque
class UnionFind:
def __init__(self, size):
self.table = [-1 for _ in [0]*size]
def find(self, x):
stack = deque()
while not self.table[x] in [-1, -2]:
stack.append(x)
x = self.table[x]
for node in stack:
se... | true |
f28d79e527c941ac3fabc00370214ca88171a4c4 | China-ChallengeHub/PyechartsExamples | /scatter_with_value_xaxis.py | UTF-8 | 866 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : AwesomeTang
# @File : scatter_with_value_xaxis.py
# @Version : Python 3.7
# @Time : 2020-11-14 23:59
from pyecharts.charts import *
from pyecharts import options as opts
import random
x_data = [random.randint(0, 20) for _ in range(100)]
y_data = [rando... | true |
e6a64b5df12b192aebc04410575e676b4b8bff8e | tankpit-analytics/tankpit-analytics.github.io | /scripts/get_active.py | UTF-8 | 1,348 | 2.71875 | 3 | [] | no_license | from helper import *
#---- helpers
def get_active_df(active_dict):
for i in active_dict:
if i['name'].find('World') != -1:
world_map = i['map']
world_playing = i['playing_tanks']
world_waiting = i['waiting_tanks']
if i['name'].find('Practice') != -1:
... | true |
5efda5fc4b17b685295870ec4eb64588bf2839fb | dpacevedo/F | /Principal.py | UTF-8 | 512 | 2.796875 | 3 | [] | no_license | import MenuInicio as MI
#Código principal
nombre_usuario= str(input("¡Bienvenide al juego! Ingrese su nombre de usuario:"))
partida= MI.MenuInicio(nombre_usuario)
#Comienza el juego
opcion = partida.imprimir_menu()
if opcion == 1:
info = partida.nueva_partida()
cant_legos = info[0]
ancho = info[1]
l... | true |
9402c0c2c706f1409e1c7ece3298ee761fe54450 | JLMengsk/leetCode | /Queue and Stack/Queue/_Number_of_Islands.py | UTF-8 | 2,028 | 3.8125 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# @Time : 6/21/2020 8:47 PM
# @Author : Jupiter
# @Site :
# @File : Number_of_Islands.py
# @Software : PyCharm
# Given a 2d grid map of '1's (land) and '0's (water), count the number of islands.
# An island is surrounded by water and is formed by connecting adjacent lands horizont... | true |
715e89bf3a985e5035c5d29f8b449db60155ff51 | ikoral/cocuklar-icin-python | /guess_number/guess_number.py | UTF-8 | 1,702 | 3.84375 | 4 | [] | no_license | player1_turn = False
player2_turn = False
player2_guess = False
player1_number = input('Please keep a number between 1-100: ')
while player1_turn == False:
try:
player1_number = int(player1_number)
if (player1_number >= 1 and player1_number <=100):
player1_turn = True
else:
... | true |
6f57db8e819e2a7acc24f8f597285301e9ffbebf | das-jishu/data-structures-basics-leetcode | /Leetcode/medium/lowest-common-ancestor-of-a-binary-tree.py | UTF-8 | 2,275 | 4.03125 | 4 | [
"MIT"
] | permissive | """
# LOWEST COMMON ANCESTOR OF A BINARY TREE
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as descendants (wher... | true |
e3de1154310e26c2edd3b54f83576552dd4aa91f | courtneyahndesign/cs114 | /practice/advancedmadlib.py | UTF-8 | 1,985 | 4.21875 | 4 | [] | no_license | #advanced version about pizza
print("Let's make a mad lib about pizza! First, give me an adjective!")
adj1 = input()
print("Alright, that's good, how about a nationality?")
nat = input()
print("Good one! Let's do a name!")
name = input()
print("That's lame, but whatever...noun, please?")
noun = input()
print("You're g... | true |
95cae1809426ade1e33f0e9a4e3eced068f51796 | Emilio66/StockPredict | /model/rnn_check.py | UTF-8 | 2,439 | 2.84375 | 3 | [] | no_license | ''' Unit Test Whether RNN Works As Expected '''
import tensorflow as tf
from tensorflow.contrib.layers import fully_connected
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import time
import sys
import os
sys.path.append("..")
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
from data.dataset.BatchGen... | true |
7b16e377d250b008fea113194c7c971011943749 | raczandras/szkriptnyelvek | /HF/2/ezer.py | UTF-8 | 208 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python3
def main():
lista = []
for i in range(1, 1001):
if i % 3 == 0 or i % 5 == 0:
lista.append(i)
print(sum(lista))
if __name__ == "__main__":
main() | true |
e1dc011f9e933f53e130496d1e2af1dd4d8f3bc1 | dantrim/limitplotter | /utils/limit_plot_tools.py | UTF-8 | 11,185 | 2.71875 | 3 | [] | no_license | #
# graphs, legends, and bands, oh my!
#
# daniel.joseph.antrim@cern.ch
# July 2016
#
import ROOT as r
import sys
import array
r.TH1F.__init__._creates = False
r.TH2F.__init__._creates = False
r.TCanvas.__init__._creates = False
r.TGraph.__init__._creates = False
r.TPad.__init__._creates ... | true |
c8ef3f9abdfd7238906753479726e87da48f5c78 | RedHatInsights/insights-core | /insights/parsers/containers_inspect.py | UTF-8 | 1,553 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | """
ContainersInspect - commands ``docker|podman inspect``
======================================================
This parser reads the output of commands: "/usr/bin/docker|podman inspect <containers ID>"
which are used to show the metadata information of containers.
"""
from insights import parser, JSONParser
from in... | true |
d62522bca31e3178d743dbd56b93ef5ccea22f74 | SineObama/pylib | /sine/app/MultiAlarmClock/entity.py | UTF-8 | 5,518 | 2.75 | 3 | [] | no_license | # coding=utf-8
import datetime
from sine.sync import synchronized
import mydatetime
from mydatetime import getNow, getNextFromWeekday, everyday
from parsing import zero
from data import data
from exception import ClockException
# 闹钟实体
class AlarmClock(dict):
'''
time: 闹钟时间
expired: 提醒过
remindTime: 提醒时... | true |
ef63ac3c27f05f2d3d5ca4d48e9d4b82b26389f2 | ibra0203/Tamias2D | /Tamias2D/body.py | UTF-8 | 3,205 | 2.84375 | 3 | [] | no_license | from Tamias2D.vec2 import *
from Tamias2D.shapes import *
class Body:
STATIC = 0
DYNAMIC = 1
MAX_V_VELOCITY = 1000
MAX_ANG_VEL = 200
MAX_TORQUE = 10000
def __init__(self, position_, mass_, shape_, angle=0, bodyType_= DYNAMIC, restitution_ = 1):
self.position = position_
self.mas... | true |