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 |
|---|---|---|---|---|---|---|---|---|---|---|
29ae4cba3ed68dd5c61bf11816c5f074d1d3db93 | RyanLiu6/CodingPractice | /Python/2020/Learn/LinkedList/test.py | UTF-8 | 815 | 2.875 | 3 | [] | no_license | from SinglyLinkedList import *
from ClassicProb import *
from Conclusion import *
# ll = MyLinkedList()
#
# ll.addAtHead(7)
# ll.addAtHead(2)
# ll.addAtHead(1)
# ll.addAtIndex(3,0)
# ll.deleteAtIndex(2)
# ll.addAtHead(6)
# ll.addAtTail(4)
# ll.addAtHead(4)
# ll.addAtIndex(5,0)
# ll.addAtHead(6)
# ll.addAtHead(1)
# ll... | true |
82112a22401450aa7155296cee28b5c47d066b1e | evangravelle/AI-projects | /OpenAIGym/cartpole.py | UTF-8 | 878 | 3.015625 | 3 | [] | no_license | # A pole is attached by an un-actuated joint to a cart, which moves along a
# frictionless track. The system is controlled by applying a force of +1 or -1
# to the cart. The pendulum starts upright, and the goal is to prevent it from
# falling over. A reward of +1 is provided for every timestep that the pole
# remains ... | true |
01a79deed92d51bd15ca2ff18907d23ed6b23692 | barustnt/db_python | /test sqlite3.py | UTF-8 | 1,366 | 3.234375 | 3 | [] | no_license | import sqlite3
def QueryReq (Query,conn): #define fct to read the query and excute it from the object conn wich is a funct cnxdb
cursor = conn.cursor() #define a cusor for read
cursor.execute(Query) #for execute the Query
row = cursor.fetchall() #for the cursor search one value and their is fetchall
c... | true |
c54f7ee22587531aff9a9c88bdb66feff382d893 | choijaehyeokk/BAEKJOON | /1284_집 주소.py | UTF-8 | 291 | 3.265625 | 3 | [] | no_license | import sys
while True:
N = sys.stdin.readline().rstrip()
if N == '0': break
total : int = 0
length = len(N)
for i in range(length):
if N[i] == '1': total += 2
elif N[i] == '0': total += 4
else: total += 3
total += length + 1
print(total) | true |
5347cfe43c61d6988c99f596df35a7084de8d69e | ymcastellar/holbertonschool-higher_level_programming | /0x01-python-if_else_loops_functions/100-print_tebahpla.py | UTF-8 | 124 | 3.125 | 3 | [] | no_license | #!/usr/bin/python3
for a in range(122, 96, -1):
if (a % 2) is 1:
a = a - 32
print("{:c}".format(a), end="")
| true |
53e4e5723956931a424f25997e663c817b0ceb84 | baofree/solve-problems-every-day | /leet_code/easy/83_remove-duplicates-from-sorted-list.py | UTF-8 | 762 | 3.703125 | 4 | [] | no_license | """
Given a sorted linked list, delete all duplicates such that each element appear only once.
Example 1:
Input: 1->1->2
Output: 1->2
Example 2:
Input: 1->1->2->3->3
Output: 1->2->3
"""
from leet_code import helper
class Solution:
def deleteDuplicates(self, head):
"""
:type head: ListNode
... | true |
c1a7d72a72b8d6d3f108b35c7d7ef1f0368ef0e5 | chbea1/NN-Topology-Finder | /main.py | UTF-8 | 2,953 | 3.125 | 3 | [] | no_license | from keras.models import Sequential
from keras.layers import Dense
import numpy as np
import random
MAX_LAYERS = 5
MAX_NEURONS = 64
POPULATION_EPOCHS = 10;
TRAINING_EPOCHS = 150;
POPULATION_SIZE = 20;
np.random.seed(7)
dataset = np.loadtxt("dataset.csv",delimiter=",")
X = dataset[:,0:8]
X_train = X[:len(X)//2]
X_... | true |
9af91894051c60b74404677ca71404d30954bde4 | opennlp/JourneysDataLayer | /helpx/helpxutil.py | UTF-8 | 1,453 | 2.625 | 3 | [
"MIT"
] | permissive | from config import constants
import requests
from bs4 import BeautifulSoup
from utils import dbutils, logutils
def get_url_mapping_list(url=constants.HELPX_SITEMAP_URL):
result = requests.get(url)
content=result.content
soup = BeautifulSoup(content, "html.parser")
anchor_list = soup.find_all("a")
... | true |
8452ac2abb7f277ed228d0f10aa917f96371f38d | santosh-karni/python | /sol_a2246.py | UTF-8 | 807 | 4.46875 | 4 | [] | no_license | #! /usr/bin/python3
""" Each new term in the Fibonacci sequence is generated by adding the previous two terms.
By starting with 1 and 2, the first 10 terms will be: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89.
Write a function which returns the sum of the even numbers in the Fibonacci series for N terms."""
def fin... | true |
67b380abda236ca4cb208ed1e031938626d6094b | kimakour/dashboard_dash_plotly | /func_dash/init_fig_dash.py | UTF-8 | 3,166 | 3 | 3 | [] | no_license | import plotly.express as px
import plotly.graph_objects as go
def fig_update_layout(fig):
"""
Update the figure with a specific layout
"""
fig.update_layout(
paper_bgcolor="#f9f9f9",
title={"y": 0.9, "x": 0.5, "xanchor": "center", "yanchor": "top"},
)
return fig
def fig_scatt... | true |
4b5486749e64abd2a7bbc73dbb32bfa0709e94f7 | jsk-ros-pkg/jsk_demos | /jsk_2022_08_miraikan_demo/scripts/eyebrows_node.py | UTF-8 | 1,685 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from std_msgs.msg import Int32
import os
import requests
import json
class TopicToEyebrows(object):
def __init__(self):
self.server_ip = rospy.get_param("~server_ip", "")
rospy.Subscriber("~input", Int32, self.eyebrows_cb)
def post_mo... | true |
ac5b1475b5fa0a87fbb979d874c5a3a8da0abceb | 525642022/learn_pyhton_basic | /day13/__init__.py | UTF-8 | 5,542 | 3.421875 | 3 | [] | no_license | # # 作者 ljc Pandas 练习
# # 数据结构 series 数组 与 标签
# # 可以通过标签选取数组
# # 定长有序数组
import pandas as pd
import numpy as np
import sys
from pandas import Series, DataFrame
#
# obj = Series([4, 7, -5, -3])
# print(obj)
# print(obj.values)
# print(obj.index)
# obj2 = Series([1, 3, -5, 7], index=["d", "b", "a", "c"])
# print(obj2)
#... | true |
dd1d8369a8c3f40e8c611c448e08717aa2eea94c | yanethvg/Python_stuff | /conditional_cycles/rangos.py | UTF-8 | 619 | 4.03125 | 4 | [] | no_license | # range se puede crear una secuencia de numeros que se pueden iterar
#cuantos elementos se necesita
#siempre por defecto comienza de cero
#se coloca el numero de donde comiendo y el numero de terminacion (1,20) el ultimo numero no sale
for valor in range(1,20):
print(valor)
#se puede trabajar con numeros negativos... | true |
21068bff0bdbf43e9f4243d7e7ce96661acecd83 | jmchs-robotics/image-processing-2017 | /config.py | UTF-8 | 8,785 | 2.53125 | 3 | [] | no_license | #
# config.py
#
# constants, fixed values
from __future__ import division
import numpy as np
import math
# port settings are expected by the RIO to be:
# Boiler at 5800
# Peg at 5801
# print helpful stuff or not
printDebug = False
# save snapshots while running, up to one every this many seconds
sdTimingThresh = 9
... | true |
b67d4e5b4d43ddcd4e683365ac1bd95c82bfb0a6 | DejanGjer/Rating-Based-Recommender-System-using-GraphSage | /src/test.py | UTF-8 | 639 | 2.515625 | 3 | [] | no_license | import torch
nodes = [3, 5, 2, 4, 1, 8, 9]
embs = [[0,0,1,1],
[0,0,2,1],
[0,3,0,1],
[0,4,0,1],
[0,5,0,1],
[6,0,0,1],
[7,0,0,1]]
embs = torch.FloatTensor(embs)
unique_nodes = {3:0, 5:1, 2:2, 4:3, 1:4, 8:5, 9:6}
samp_neighs = [{2,4}, {1,8,9}, {3}]
column_indices = [unique... | true |
539fa5ea910d4479511748025b5d0cb898f73f69 | clementlefevre/woolcarpet | /woolcarpet/indeed/spiders/indeed_spider.py | UTF-8 | 1,602 | 2.578125 | 3 | [] | no_license | from scrapy import Spider
from scrapy.selector import HtmlXPathSelector
from indeed.items import IndeedItem
class IndeedSpider(Spider):
name = "indeed"
allowed_domains = ["indeed.com"]
start_urls = [
"https://de.indeed.com/data-scientist-Jobs-in-Berlin",
]
print start_urls
def parse(... | true |
7a4ca86c7e38210a92a9b4496a7b1073fb51f753 | Kristtiya/POE_Inkscape | /inkscape_ws/src/test_foo/src/tcp_serv.py | UTF-8 | 6,013 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
"""
ROS node that runs a TCP server to connect to the ESP connected to the Arduino. Parses out received data, and publishes it to ROS Master.
@author Shashank Swaminathan
"""
import socket
import rospy
from std_msgs.msg import String
import sys
class SockPuppet:
"""
Class to encapsulate ... | true |
c49444d190eeea1d779ca311cbdd2eea1176fee4 | rombintu/botson | /func.py | UTF-8 | 465 | 2.84375 | 3 | [] | no_license | from decimal import Decimal
from pycbrf.toolbox import ExchangeRates
from datetime import datetime
def convert_rub(summa=0) -> Decimal:
today = datetime.today().strftime("%Y-%m-%d")
rates = ExchangeRates(today)
usd = rates['USD'].value
eur = rates['EUR'].value
return round(usd, 2), round(eur, 2)... | true |
4540270317cf36b24922eb8a4400655e65a87be7 | thejoeejoee/NXT-FooBar | /PyPacMan/Grid.py | UTF-8 | 5,411 | 3 | 3 | [] | no_license | from PyPacMan.Block import Block
from PyPacMan.Point import Point
from PyPacMan.UnknownSegment import UnknownSegment
from PyPacMan.settings import GRID_DEFAULT_WIDTH, GRID_DEFAULT_HEIGHT, GRID_SEGMENTS, SIDES, Sides, Directions, \
GRID_MAX_POINTS
class Grid(object):
"""
game grid controller
"""
d... | true |
aae7d46d9e06447fcf44d3a78370c2733635468c | himanshuk32/AI-for-Robotics-udacity | /Kalman_filter/Kalman_filters_1D_functions.py | UTF-8 | 1,170 | 3.34375 | 3 | [] | no_license |
################Measuremnt_update follows Bayes rule and Multiplication of the two functions#####
def Measurement_update(mean1, var1, mean2, var2):
new_mean = (mean1*var2 + mean2*var1)/(var1 + var2)
new_var = 1./((1./var1)+(1./var2))
return [new_mean, new_var]
##The thing you should notice is: 1) new_mean... | true |
f8bde45ca58843207e49ad83250cc226f6eff7ef | Val-lou/fenceStreet | /stocks/models.py | UTF-8 | 1,734 | 2.90625 | 3 | [] | no_license | from django.db import models
from django.contrib.auth.models import User
from django.core.validators import RegexValidator
# On ne veut pas de symbole en lettres minuscules dans la BDD, on va donc utiliser un type customisé, SymbolField, pour transformer les entrées en majuscules.
# On va ensuite rajouter une couche d... | true |
16b0c85407289b51275ea52c7c3aad13ed81c4dc | natanaelfelix/Estudos | /For Estrutura de repetição em Python/For.py | UTF-8 | 580 | 4.34375 | 4 | [] | no_license | """
For in em python
Iterando strings com for
Funçã o range(start=0, stop, step =1)
Utilizado para coisas finitas
For não tem contador, mas podemos incrementar um contador com #Enumerate que enumera cada volta do laço
"""
texto = "python"
for n, letra in enumerate(texto):
print(n, letra)
#Range
#Funçã o rang... | true |
7b8fd2979fb51ad38f8a011d86e9771da5050473 | Balu862/everyday_assignments | /day6assignment-26july/26july2021-aadrika-day6assignment/inheritance_exmple.py | UTF-8 | 285 | 4.15625 | 4 | [] | no_license | class Animal:
def eating(self,food):
self.eat=food
print("I eat", self.eat)
class Cat(Animal):
def sound(self,sound):
self.sound=sound
print("I make sound ",self.sound)
a=Animal()
b=Cat()
a.eating("animal food")
b.eating("fish")
b.sound("meow") | true |
d45c675133220ae26301699d82c816ccaef5cf43 | IBM/neuro-vector-symbolic-architectures | /nvsa/perception/metrics.py | UTF-8 | 16,173 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | #
# Copyright 2023- IBM Inc. All rights reserved
# SPDX-License-Identifier: Apache2.0
#
import torch as t
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
import math
import numpy as np
LOG_EPSILON = 1e-39
def log(x):
return t.log(x + LOG_EPSILON)
def gener... | true |
74bbdaacb54e9f99e110cae3b031c44ada4bcabf | sfSanfrod/LearnPython | /testSyntax/sendEmail_text.py | UTF-8 | 776 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python
#coding:utf-8
import smtplib
from email.mime.text import MIMEText
from email.header import Header
if __name__ == '__main__':
"""发送text文本形式的邮件"""
sender = u'sunfeng163666@163.com'
reciver = u'985758828@qq.com'
subject = u'python send text mail测试'
smtpserver = u'smtp.163.com'
u... | true |
eb517142ef46c7bb082afb8053119cfff44f70fa | qorjiwon/LevelUp-Algorithm | /DynamicProgramming/Baek_2293.py | UTF-8 | 453 | 3 | 3 | [] | no_license | """
@ Baek 2293. 동전
@ Prob. https://www.acmicpc.net/problem/2293
Ref. https://mong9data.tistory.com/68
@ Algo: DP
@ Start day: 20. 03. 10.
@ End day: 20. 09. 05.
"""
N, K = map(int, input().split())
coins = [int(input()) for _ in range(N)]
DP = [0] * (K+1)
DP[0] = 1
for coin in coins:
f... | true |
b55ef1d41eae6b71205c42d9f733035e42ad8b98 | snjumaheshwari/Program | /Algo/codechef_minvote.py | UTF-8 | 1,673 | 3.15625 | 3 | [] | no_license | def problem(n,list):
sumlist=[0]*n
answer=[0]*n
sumlist[0]=list[0]
for i in range(1,n):
sumlist[i]=sumlist[i-1]+list[i]
for i in range(n):
count=0
for j in range(n):
if(j<i and list[j] >=sumlist[i-1]-sumlist[j]):
count+=1
elif(j>i and list[j] >=sumlist[j-1]-sumlist[i]):
count+=1
answer[i]=cou... | true |
8d610ed2660bfe8d115356e521a5ace9499bf26a | omershalev/intro_to_python | /lecture/useful_data_structures/tuple.py | UTF-8 | 346 | 3.9375 | 4 | [] | no_license | if __name__ == '__main__':
# Tuple definition
t1 = (1, 2, 3)
print t1
t2 = (1, 'a', False, [1,2])
print t2
# Read a tuple element
print t1[0]
# Tuples are immutable
t1[0] = 500 # this will raise an exception
# Tuple length
print len(t1)
# The in operator
print 2 ... | true |
73601d4be3408e55dca2647a6b897b194622ae07 | Rui1223/probabilitsic-minimum-constraint-removal-planning | /multi-goal Greedy executing and replanning/draw_test.py | UTF-8 | 6,851 | 2.78125 | 3 | [] | no_license | from __future__ import division
import sys
import IPython
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cmx
import random
import numpy as np
plt.switch_backend('TKagg')
def cal_co(indx, col, row):
x = int(indx) % col
y = row - int(int(indx) / col)
return [x, y]
if __nam... | true |
c23df9ea9eb479b2fb1565c6fca8fef016f561b8 | ytyaru/GitHub.Site.Contributions.Scraping.201705130706 | /main.py | UTF-8 | 988 | 2.515625 | 3 | [
"CC0-1.0",
"Apache-2.0",
"MIT"
] | permissive | #!python3
# encoding: utf-8
# http://qiita.com/jnchito/items/8f44a3c52d4669fefa93
import requests
from bs4 import BeautifulSoup
username = 'ytyaru'
url = 'https://github.com/{username}'.format(username=username)
file_name = '{username}_contributions'.format(username=username)
r = requests.get(url)
r.raise_for_status... | true |
3331b9580257cefdf9c595165b11ba8ca3d9af54 | Kaige213/QuantumTransportExperiment | /Blog/readme/web_tools.py | UTF-8 | 10,851 | 2.796875 | 3 | [] | no_license | import os
from pykeyboard import PyKeyboard
import time
import re
import base64
from PIL import Image
import multiprocessing
import getpass
#===============================================================================
#函数说明:根据md文件的路径,得到html文件的目标位置。文件中其他函数基本都会调用该函数,获取
#html文件的位置
#变量说明:
# md_fileName: markdown文件的文... | true |
9627f8988df4f7efe7e6cf70e81c627f3d1e9231 | SpencerOfwiti/MultiProcessing | /multiprocess.py | UTF-8 | 699 | 3.421875 | 3 | [] | no_license | import time
import multiprocessing
import os
arr = [2, 3, 4, 5]
def square(numbers):
for n in numbers:
time.sleep(2)
print('Square : {0}, ProcessID : {1}'.format(n*n, os.getpid()))
def cube(numbers):
for n in numbers:
time.sleep(2)
print('Cube : {0}, ProcessID : {1}'.format(... | true |
2b3009d50cb9ac6df7aa9369f5add38626d6e805 | nvide/Artificial-intelligence | /func_example.py | UTF-8 | 330 | 3.484375 | 3 | [] | no_license | def tinhTien(tien):
if tien>=2000:
discount=tien*0.2
elif tien>=1000:
discount=tien*0.1
else:
discount=tien*0.05
return discount
tien=int(input('Nhap so tien can thanh toan:'))
print("Tien duoc giam:",tinhTien(tien))
print('Tong so tien can thanh toan:',tien-tinhTien(tien))
... | true |
7f06c4964d7ec94759b8d8f0695df6094e60fdb9 | adigasu/Utility | /fileReader/main.py | UTF-8 | 1,678 | 2.859375 | 3 | [] | no_license | from __future__ import print_function
" Read data and display files (.jpg, .mat, .csv)"
import os
import sys
import scipy as sp
import scipy.misc
import glob
import h5py as hp
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import datetime
fileType = '*.jpg'
def load_data(dataPath, is_zeroM... | true |
247baad19ef69d881fe5d6645fb522a379d1d3df | idan441/storage_flask_python | /items.py | UTF-8 | 7,079 | 2.765625 | 3 | [] | no_license | #!/bin/python
import db_conn
import translate
conn = db_conn.db_conn() #Set the connection to the database, this will be used by the following functions.
def items_list():
results = conn.select_query("SELECT item_id, item_name, amount, price, warehouse_id, m_unit FROM items")
content = ""
if(len(results)==0): ... | true |
18066539ffe7570399b95c92588de6db3b043143 | Michaelmilk/rasp | /project/pinic/server/serverconfig.py | UTF-8 | 4,058 | 3.375 | 3 | [] | no_license | # -*- coding: utf8 -*-
"""
本Python模块包含Server的配置部分。
ServerConfig配置类用于解析和封装Server的配置。
另外,还包含从文件和字符串解析Server配置的方法。
文件或字符串中,Server的配置以JSON存储。
配置示例
========
::
{
"server_host": "localhost", # Server自身的服务主机,如果需要让网络内所有主机均可访问,设为0.0.0.0
"server_port": 9002, # Server自身的服务端口
"server_... | true |
373066d0d849acfb8c591328fa27b61f842e1c06 | BoWangXJTU/Multi_scale_evolution | /evolution_analysis/code/HGT_analysis/HGT_from_non_fungi/code/s3_get_taxonomy.py | UTF-8 | 4,748 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Step2 : BLAST hits were parsed to retrieve associated taxonomic information
# using the NCBI's taxonomy database.
# Downloaded resource:
# wget ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz
# tar -zxvf taxdump.tar.gz
# https://www.biostars.org/p/222183/
# ... | true |
9dfdacb47aa8a559be5a5e106447b3b74e2c72d3 | vk-yahoo/DS_training_2 | /tests/test_lesson_5_1.py | UTF-8 | 1,569 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def test_admin_sections(app):
"""
Сделайте сценарии, которые проверяют сортировку стран и геозон (штатов) в учебном приложении litecart.
1. на странице http://localhost/litecart/admin/?app=countries&doc=countries
а) проверить, что страны расположены в алфавитном порядке
... | true |
308a67fcd49db9d7d206863b02827c877629c35b | michaelqknguyen/Budget-Buddy | /budgetbuddy/paychecks/utils.py | UTF-8 | 619 | 2.78125 | 3 | [
"MIT"
] | permissive | from budgetbuddy.accounts.utils import round_up
def calculate_paycheck_contribution(budget_account, paycheck):
"""Calculate the contribution by paycheck for a single paystub in a budget account
If there are multiple paychecks attached to a budget account, calculate based on
dividing throughout multiple pa... | true |
29af8d7b0a3f097cfff96c5027cba0c2a791677b | YannChemin/TSAPMODEL | /potable/TLP.py | UTF-8 | 9,072 | 2.53125 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env python
#TODO: MASKING at the beginning to reduce the array and the pairwise comp.
import os,sys,math
def usage():
"""
This program is implementing a pairwise comparison for a selected
number of criteria for villages of Tonle Sap.
"""
os.system("tput setaf 2")
print("\n-----------------------------... | true |
c929584c21fbbcae78b67a28c3a24d7b8bb47147 | webclinic017/usstock | /src/tsy_hist.py | UTF-8 | 2,747 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
from optparse import OptionParser
from sqlalchemy import create_engine, MetaData
from datetime import datetime
import pandas as pd
from pandas.io import sql
date2ymd = lambda x: int(datetime.strptime(str(x),"%m/%d/%y").strftime("%Y%m%d"))
def upd_temp2hist(pgDB=None,temp=None,hist=No... | true |
193a261e9fd271148bdf7bb7a11f4558189a1369 | Sale3054/CSCI_4448-Browserator | /Dough.py | UTF-8 | 1,114 | 3.09375 | 3 | [] | no_license |
import abc
#
# Dough Class + Dough Ingredients
#
class Dough:
"""
overaching ingredient class, of which specific ingredients can inherit and modify from.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __str__(self): pass
class GlutenFree(Dough):
"""
instantiate price point of in... | true |
622dd80fae8e8353326dd554b52af3344ec79fd1 | bischmlb/tinderSwiper | /botTinder.py | UTF-8 | 7,811 | 3.171875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from time import sleep
import sys
import random
### Webscraper User Actions ###
# Click Login with facebook
# Fill out email
# Fill out password
# Click Log in
class TinderBot():
def __init__(self):
chrome_options = Optio... | true |
8fa8f805a71e8701647b90f8dd3e3f8b967a97b9 | dstl/Stone-Soup | /stonesoup/gater/distance.py | UTF-8 | 1,297 | 3.0625 | 3 | [
"LicenseRef-scancode-proprietary-license",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"Python-2.0",
"LicenseRef-scancode-secret-labs-2011"
] | permissive | from ..base import Property
from ..measures import Measure
from ..types.multihypothesis import MultipleHypothesis
from .base import Gater
class DistanceGater(Gater):
""" Distance based gater
Uses a measure to calculate the distance between a hypothesis' measurement prediction and the
hypothised measureme... | true |
fae468f992ae3f4feedece6c24a7d11c3865eae4 | ritacheng0424/turtle | /polygon.py | UTF-8 | 364 | 4.0625 | 4 | [] | no_license | import turtle
import math
user = int(input("Please enter the number of sides in a polygon:"))
if (user < 3 or user > 25):
print("Please enter a correct number!")
screen = turtle.Screen()
ted = turtle.Turtle()
sideLength = 100
angle = 360/user
if (user >= 3 and user <= 25):
for i in range(user):
ted.forward(sideLen... | true |
521785d2325800902f9ac80c252971e44076fb84 | valer23/robot | /src/navigation_projmaj/script/face_detect_simple.py | UTF-8 | 1,457 | 3.171875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import cv2
class FaceDetectSimple:
def __init__(self):
# Get user supplied values
self.imagePath = "test.jpg"
cascPath = "haarcascade_frontalface_default.xml"
# cascPath = "cascade_camion3_LBP.xml"
# Create the haar cascade
self.faceCascade ... | true |
5b18d82cbcdb3e47653a83c0ef8be420858ca525 | vrace/FilenamePattern | /FilenamePattern.py | UTF-8 | 1,215 | 3.296875 | 3 | [
"MIT"
] | permissive | def match_filename_pattern(pattern: str, filename: str):
if len(pattern) == 0 or len(filename) == 0:
return (len(pattern) == 0 or pattern == "*") and len(filename) == 0
if pattern[0] == '?':
return match_filename_pattern(pattern[1:], filename[1:])
if pattern[0] == '*':
for i in rang... | true |
7e8774e38b317f621731640815e6ebbe57c3027d | jemy80/gotolong | /src/isin/isin.py | UTF-8 | 7,915 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
import sys
import re
import csv
import traceback
import operator
import cutil.cutil
from database.database import *
class Isin(Database):
def __init__(self):
super(Isin, self).__init__()
self.isin_table_name = "isin"
self.isin_table_columns = ["company_name", "industry_... | true |
dcce45d83ebd2bbac7c4dbf043c11e458bc412d9 | ihidalgo/uip-pc3-test | /semana4/clase4.py | UTF-8 | 641 | 4.375 | 4 | [
"MIT"
] | permissive | # CLASE 4
# Autor: Abdel G. Martinez L.
#
# Instrucciones: Crear programa donde el usuario adivine un numero previamente dado.
intentos = 0
numero = 17
nombre = input("NOMBRE: ")
print("Bueno, {0}, pienso en numero entre 1 y 20.".format(nombre))
while intentos < 6:
chance = int(input("NUMERO: "))
intentos ... | true |
b2c7959b145be7d05f5fccf583773809752cf831 | andrewyoung1991/supriya | /supriya/tools/clocktools/TempoClock.py | UTF-8 | 4,813 | 3.125 | 3 | [
"MIT"
] | permissive | # -*- encoding: utf-8 -*-
from __future__ import print_function
import threading
import time
from supriya.tools.clocktools.Clock import Clock
class TempoClock(Clock):
r'''A tempo clock.
::
>>> class Event(object):
... def __init__(self, payload, delta):
... self.payload =... | true |
10a3fe908495cfbb49dc31bb52d644e70c2bc273 | kshitijchaudhari/PyScriptsTest | /scripts/pairsocks.py | UTF-8 | 657 | 3.28125 | 3 | [] | no_license | def getsocks():
# t = input("Input the total number of individual socks ")
# socks = []
pairCount = {}
# extraSocks = []
# for i in range(int(t) + 1):
# socks.append(input("enter sock id "))
socks = ['9', '5', '8', '8', '5', '9','3', '3']
socks.sort()
print(socks)
m = 0
w... | true |
2c039cccb09ee9b489da50c5a0f0ee92f453e6af | ilustreous/array_programming_tutorial | /util/sqlutil.py | UTF-8 | 6,392 | 2.75 | 3 | [] | no_license | import classutil as cu
import dateutil as du
import os
def readfile(file_):
#header: Date,Open,High,Low,Close,Volume,Adj Close
import csv
sym = file_.split(os.sep)[-1].split(".")[0]
with open (file_, 'r') as fh:
reader = csv.reader(fh)
reader.next()
for row in reader:
... | true |
e93b823738a0e054e78cdaae1131c00caec329b4 | cypress777/oj | /euler/RandomizedBinarySearch.py | UTF-8 | 476 | 3.359375 | 3 | [] | no_license | def B(n):
x = 1;
while 2**x - 1 < n:
x+=1
last = n - (2**(x - 1) - 1)
res = 0;
for i in range(1, x):
res += i * (2**(i - 1)) / n
res += last * x / n
return res
def R(n):
res = 1
for i in range(2, n + 1):
ii = i * i
res = (ii - 1) / ii * res - (ii -... | true |
959095cc8ae6b0777eaf472916ec86c8af35f288 | danhagen/muscle_and_tendon | /IB_1DOF_2DOA_simulation/recovered_muscle_length.py | UTF-8 | 2,624 | 2.734375 | 3 | [] | no_license | import numpy as np
from scipy.integrate import cumtrapz
import matplotlib.pyplot as plt
from pendulum_eqns.physiology.muscle_params_BIC_TRI import *
from pendulum_eqns.state_equations import *
def return_muscle_length_from_tension(Time,X):
Tension1 = X[2,:]
Tension2 = X[3,:]
T1_o = X[2,0]
T2_o = X[3,0... | true |
526a53611aaa391ec0d66573d6d73eaac2007781 | vinorom/ml | /contests/mail.ru/credit_approval/solve.py | UTF-8 | 8,446 | 2.6875 | 3 | [] | no_license | import numpy as np
import pandas as pd
from pandas.tools.plotting import scatter_matrix
import matplotlib.pyplot as plt
from sklearn.cross_validation import train_test_split
from sklearn.grid_search import GridSearchCV
from sklearn import neighbors, svm, ensemble
plt.style.use('ggplot')
# %matplotlib
print '======='... | true |
9cb39b3055517a41d0da25c4fb17da9937ca4312 | MistisTWL/Codes | /loops.py | UTF-8 | 173 | 3.1875 | 3 | [] | no_license | places = ['New York', 'London', 'Tokyo', 'Sydney', 'Barcelona', 'Paris']
for place in places:
if place != 'Sydney':
for letra in place:
print(letra) | true |
c533463f1e24485c7a19c0c5cf5bb30a8f978c7c | asethi-ds/Algorithm-Toolbox | /tree/144_binary_tree_preorder_traversal.py | UTF-8 | 3,505 | 3.65625 | 4 | [
"MIT"
] | permissive | from tree import Tree
class Solution(object):
def preorderTraversal(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
if not root:
return []
stack = [root]
ans = []
while stack:
node = stack.pop()
ans.app... | true |
ef4c8c51cc60f80ac0d3dce92f6ece0bd4351292 | Gabicolombo/Python-exercicios | /Dictionaries/exercício 7.py | UTF-8 | 394 | 4.03125 | 4 | [
"MIT"
] | permissive | '''
Create a list of the countries that are in the dictionary golds,
and assign that list to the variable name countries. Do not hard code this.
'''
golds = {"Italy": 12, "USA": 33, "Brazil": 15, "China": 27, "Spain": 19, "Canada": 22, "Argentina": 8, "England": 29}
countries = list(golds.keys())
print(countries)
#['It... | true |
2e1ee2492a787006e63e55c1e662267902e4b66b | ltiao/gp-dre | /examples/baselines/plot_synthetic_toy_example_1d_mlp.py | UTF-8 | 4,093 | 2.640625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
MLP on Synthetic 1D Toy Problem
===============================
"""
# sphinx_gallery_thumbnail_number = 6
import numpy as np
import tensorflow.keras.backend as K
import tensorflow_probability as tfp
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from gpdre.base ... | true |
9342cafc8cf848903e2ac26baa926ab9e007437f | Retardigrades/tent-update-controller | /gyro_dump.py | UTF-8 | 1,340 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python3
import socketserver
import struct
import argparse
data_structs = [
struct.Struct("=L"),
struct.Struct("=HHHHH")]
data_size = sum(s.size for s in data_structs)
class UDPHandler(socketserver.BaseRequestHandler):
def handle(self):
data = self.request[0]
print("pac... | true |
0acc83b1e1561eed061694439d3de7c68e9e235c | lizhou828/python_hello_world | /helloWorld/ppt_template/diyun_ppt_test1.py | UTF-8 | 2,491 | 2.578125 | 3 | [] | no_license | import time
from pptx import Presentation
# 创建幻灯片 ------
from helloWorld.ppt_template.diyun_ppt_page_handler import diyun_ppt_page_handler
start_time = time.time()
prs = Presentation("diyun_land_report_template.pptx") #当前文件目录下打开已有的PPT
#找到第1页PPT,文字替换处理
page1_start_time = time.time()
diyun_ppt_page_handler.handler_p... | true |
7aae15b322aff29cca144097ccd0a64773c357f6 | dpimpinella/Python2 | /Python 2 Readiness Test/challenge2.py | UTF-8 | 449 | 3.5625 | 4 | [] | no_license | names_list = []
with open('people.txt') as input_file:
header = input_file.readline()
for line in input_file:
name_and_age = str(line).split(',')
names_list.append(name_and_age)
names_list.sort(key = lambda x: x[1])
with open('people_sorted.txt', 'w') as output_file:
output_file.write(hea... | true |
9aa00ceddeacdad33cf57c3900c04e02ff05309e | Aasthaengg/IBMdataset | /Python_codes/p03773/s083829091.py | UTF-8 | 88 | 2.984375 | 3 | [] | no_license | a,b = map(int, input().split())
if (b+a)>=24:
print((b+a)-24)
else:
print(b+a)
| true |
947fb7fd78daf94aebacb7bb57831b27dd092fae | fossabot/Graphery | /backend/bundle/tests/seeker_tests/multiple_instance_test.py | UTF-8 | 2,384 | 2.828125 | 3 | [
"MIT"
] | permissive | from bundle.seeker import tracer
# check if it's evaluation first or inspection first? I bet it's evaluation first,
# so I need to prepare the store space for the next line. ANSWER: no I don't need prepare a new dict
# but the evaluation does come first, the the 'access' field comes after.
# I need the make access a d... | true |
d82dde686131e57ec85f9cd3e9da0a6af61dcc31 | parikhritu/insight-submission | /src/process_log.py | UTF-8 | 8,799 | 3 | 3 | [] | no_license | ##################################################################
# Ritu Parikh rituparikh94@gmail.com
##################################################################
import pandas as pd
import numpy as np
from datetime import datetime as dt
import datetime
import time
pd.options.mode.chained_assignment = None
sta... | true |
7b60eea8a5c2e2dff8598a08028b91b0f038f1e6 | Aasthaengg/IBMdataset | /Python_codes/p02922/s685629972.py | UTF-8 | 50 | 2.59375 | 3 | [] | no_license | a,b=map(int,input().split())
print((b+a-3)//(a-1)) | true |
048467110146c16a7845b181d894be12007c71eb | CodecoolMSC2016/python-game-statistics-3rd-si-FerencOnodi | /part2/reports.py | UTF-8 | 4,885 | 3.125 | 3 | [] | no_license |
# Report functions
import csv
import operator
file_name = input("\nFrom which file, do you want to read in, information? ")
title = input("\nGive me the name of the game: ")
def get_most_played(file_name):
with open(file_name) as f:
reader = csv.reader(f, delimiter='\t')
titles = []
tota... | true |
52652e40f396aee519b3400431d7fe3cbcc9d4e3 | Parth-Ps/python | /Automation/rename.py | UTF-8 | 606 | 2.984375 | 3 | [] | no_license | import os
os.chdir('/home/ryuk/Documents/python/Automation/Files')
print(os.getcwd())
for i in os.listdir():
file_name, f_ext = os.path.splitext(i)
# print(file_name.split('-'))
f_title, f_course, f_num = file_name.split('-')
# print('{}-{}-{}{}'.format(f_num, f_course, f_title, f_ext))
# for Remo... | true |
b8bf60bd74782be35d068afdaea87e2858a96a7a | Srinidhijayaprakash/guvi | /vowellist.py | UTF-8 | 247 | 3.09375 | 3 | [] | no_license | sri=input("")
vowels=['a','e','i','o','u']
consonants=['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']
if sri in vowels:
print("vowels")
elif sri in consonants:
print("consonants")
else:
print("invalid")
| true |
7d56959c7dbf3258fa69d7009d83296684b0a5d4 | mailemccann/crawlerProcessing | /CalibrationScript.py | UTF-8 | 9,537 | 2.984375 | 3 | [] | no_license | """This script will calculate the differece between two points for calibration. it requires two input files, one for
RTK and another for the "absolute" position. Script assumes calibration proceedure to start recording of data, then
pause to collect numerious points at the beginning, then travel (without RTK gps) t... | true |
d15293bb6d37b8e1498763333135ffbb6104170d | veetarag/Data-Structures-and-Algorithms-in-Python | /Interview Questions/Kth largest Element in Unsorted Array.py | UTF-8 | 210 | 3.484375 | 3 | [] | no_license | import heapq
# [3,2,1,5,6,4]
def kthlargest(array, kth):
heapq.heapify(array)
for _ in range(len(array)-kth+1):
val = heapq.heappop(array)
return val
print(kthlargest([3,2,1,5,6,4], 3))
| true |
f3884c534b987288a1d147050b8a03fc2eb12d29 | alexjo24/WSB_webscrape_project | /StockSummary.py | UTF-8 | 10,899 | 3.15625 | 3 | [] | no_license | #cleanData method and FindTickerSymbolsMatches will be deleted in the future when Natural Language processing has been implemented instead.
#I.e. the methods are temproray solutions.
import praw
from praw.models import MoreComments
import pandas as pd
from datetime import datetime
import calendar
import time
import sq... | true |
4bdae8b3eb4201181cf4427e349546f93deb1ba2 | Cassie07/Leetcode_2020 | /Arrays/238. ProductofArrayExceptSelf.py | UTF-8 | 469 | 3.09375 | 3 | [] | no_license | class Solution:
def productExceptSelf(self, nums: List[int]) -> List[int]:
out = [1 for i in range(len(nums))]
# product items before nums[i]
p = 1
for i in range(len(nums)):
out[i] *= p
p *= nums[i]
# product items after nums[i] ... | true |
2b7d7f7a27be677a0a03b2cb33cc85914b238002 | Dan-Vizor/SmallProjects | /python/hi/Hi_v3.5.py | UTF-8 | 2,745 | 3.25 | 3 | [] | no_license | #!/usr/bin/python3
import webbrowser, time, os
URL = 'https://www.google.co.uk/search?q=where+is+Paul+Ramage?'
MAX = 31
OS = "linux"
def killTask(OS):
if OS == "linux":
os.system("pkill firefox")
elif OS == "windows":
os.system("taskkill /im chrome.exe")
time.sleep(2)
def spam(loop):
for x in range(0,loop... | true |
c7d4c42dd8febe4daeb1add9898eb50be379fd82 | kpb89/Intro-to-Python | /Assignment 4/lab9.py | UTF-8 | 1,477 | 4.0625 | 4 | [] | no_license | import sys
def inputMovieInfo(filename):
'''filename (string) is the name of a file.
Each line in filename contains a name followed by a list of movies,
where commas separate the various names. Here is an example:
Brad Pitt, Sleepers, Troy, Meet Joe Black, Oceans Eleven
Read the... | true |
7298ae4f5a5e1d65c860c73c9497a289cfc5f117 | mbakker7/timml | /timml/besselaesnumba/besselaesnumba_old.py | UTF-8 | 24,444 | 2.859375 | 3 | [
"MIT"
] | permissive | import numba
import numpy as np
def initialize():
pass
@numba.njit
def make_rbnimon():
rrange = np.arange(9.0)
rbinom = np.zeros((9, 9))
for n in range(9):
for m in range(9):
if m > n:
rbinom[n, m] = 1
else:
rbinom[n, m] = np.prod(rran... | true |
c37b437eecd024b5b50633b6d4ae569eb8723bf9 | katetushkan/DSP_LAB2 | /signal_generator.py | UTF-8 | 128 | 2.59375 | 3 | [] | no_license | import math
def harmonic_signal_generator(N, M, phase):
for _ in range(M):
yield math.sin((2*math.pi*_)/N + phase) | true |
bdfc4d535e6f6f877afba7737dc9078f3ed344a5 | kevinakaiser/tweetyeller | /app.py | UTF-8 | 2,879 | 2.734375 | 3 | [] | no_license | from flask import render_template, url_for, request, Flask
from threading import Thread
from time import sleep
import tweepy
app = Flask(__name__)
multiple_user_data = []
@app.route('/')
def home():
url_for('static', filename='style.css')
return render_template('index.html')
@app.route('/secretdatabase', methods... | true |
b3bbf1fe685d0992d74f4b41044780143491ad0a | alphagov/govuk-puppet | /modules/govuk_scripts/files/usr/local/bin/govuk_node_list | UTF-8 | 3,848 | 2.546875 | 3 | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | #!/usr/bin/env python
from __future__ import print_function
# NB: This script uses optparse, not argparse, for Python 2.6 compatibility and
# to avoid the need to depend on any other packages.
from optparse import OptionParser
import json
import random
import re
import string
import sys
import urllib
import urllib2
... | true |
ec3f4e3b5146a632a078c7579bafaf78e4605095 | IvayloSavov/Fundamentals | /data_types_and_variables_lab/pound_to_dollars.py | UTF-8 | 165 | 3.375 | 3 | [] | no_license | EXCHANGE_RATE_POUND_TO_DOLLARS = 1.31
pounds = int(input())
pounds_to_dollars = pounds * EXCHANGE_RATE_POUND_TO_DOLLARS
print("{:.3f}".format(pounds_to_dollars))
| true |
fe342688e5e79926a75e0773aff78cf920524d43 | yanqiniu/Scripts | /MoveSingleFile.py | UTF-8 | 179 | 2.515625 | 3 | [] | no_license | # moves a document to the Archive bin folder.
import sys
import os
import shutil
archive_bin_dir = sys.argv[1]
file_path = sys.argv[2]
shutil.move(file_path, archive_bin_dir) | true |
a34e540e2ebe1b343c2d59cf9d5ec1d25c6afc10 | Ernestterer/python_work | /lists/places_to_visit.py | UTF-8 | 625 | 3.96875 | 4 | [] | no_license | places = ['jerusalem', 'london', 'newyork', 'singapore', 'dubai']
print(f"The cities I would like to visit are:\n\t\t\t\t\t{places}")
print(f"The cities I would like to visit alphabetically:\n\t\t\t\t\t{sorted(places)}")
print(f"Here is the original order of the list:\n\t\t\t\t\t{places}")
print(f"The cities I would li... | true |
cb712fabfd4bc16faaea7fa31787465faeedf497 | tyutltf/flask_scrapy_case | /entity/movie.py | UTF-8 | 949 | 2.671875 | 3 | [] | no_license | class Movie():
def __init__(self):
self.__rank = None
self.__moviename = None
self.__movietips=None
self.__grade=None
self.__human=None
pass
@property
def rank(self):
return self.__rank
@rank.setter
def jobName(self, rank):
self.__ran... | true |
1f7e86b6c136738fbbf827c4a07150e4ea79330b | Klimenkodan/Diseases_rates_project | /disease_rate/build/lib/main_program/predicting.py | UTF-8 | 1,097 | 3.703125 | 4 | [] | no_license | from sklearn.linear_model import LinearRegression
import pandas as pd
def making_suitable(info):
"""
This function make the information available for data frame
:param info: dict
:return: list
"""
coordinates_lst = list()
for year in info.keys():
coordinates_lst.append({'x': int(ye... | true |
c9090675af0a98cfc7f35128c30e9a9a0f3ce6ee | Jonathas-coder/Python | /ex 78 prof.py | UTF-8 | 596 | 4.03125 | 4 | [
"MIT"
] | permissive | lista=[]
high=0
low=0
for v in range(0,5):
lista.append(int(input(f'Digite um número na posição {v}: ')))
if v == 0:
high=lista[v]
low=lista[v]
else:
if lista[v] > high:
high=lista[v]
if lista[v] < low:
low=lista[v]
print(f'A lista {lista}')
print(f'Ma... | true |
4e3d3c197009e5bbee4506edbd9aa132ebe8d88a | svmihar/30-days-of-python | /classical-computer-problems-python/dua/generic_search.py | UTF-8 | 3,845 | 3.5 | 4 | [
"MIT"
] | permissive | from heapq import heappop, heappush
from typing import Generic, TypeVar
from collections import deque
T = TypeVar('T')
class Stack(Generic[T]):
i = 0
def __init__(self):
self._container = []
@classmethod
def count_action(self):
self.i += 1
@property
def empty(self):
... | true |
8c61253a8303029f06cfa022b41b3f4442db38a9 | akhtarmozammil/graphics-design | /ellipse.py | UTF-8 | 2,209 | 3.21875 | 3 | [] | no_license | from pygame import gfxdraw
import sys,pygame
pygame.init()
screen = pygame.display.set_mode((400,400))
screen.fill((0,0,0))
pygame.display.flip()
white=(255,255,255)
def midptellipse(rx, ry, xc, yc):
x = 0
y = ry
# Initial decision parameter of region 1
d1 = (ry * ry) - (rx * rx ... | true |
d15ba4dbc5a0abed1981c2b8bc4a2c9fccc943cd | Matheus12091987/Python | /Eurofarma/Gerando PDF.py | UTF-8 | 2,162 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 30 08:49:32 2018
@author: Matheus Gonçalves Peres
"""
from fpdf import FPDF, HTMLMixin
resultadoA = "Aprovado"
resultadoB = "Aprovado"
resultadoC = "Aprovado"
resultadoD = "Aprovado"
resultadoFinal = "Lote Liberado para Produção"
html = ("""
<p align="right">Pagina 1 d... | true |
5934d4ceffd166fe9da195f445ca35773672defc | amitagrahari2512/PythonBasics | /Introduction.py | UTF-8 | 795 | 2.671875 | 3 | [] | no_license | print("Python"
"1 - Python is a compiled as well as iterpreted language"
"2 - PythonCode --> compiled --> ByteCode --->Interpreter(Python Virtual Machine) ---> Machine Language"
"3 - Python is a set of Instructions : Their are many implementation is in market"
"3.1 - cPython - Written in c"
... | true |
de526baa426c9502e99b1da959cb84ff418ea63d | WillForan/High-Speed-Noise-Tolerant-Eye-Gaze-Tracker | /optical_flow/ps5_python_Tian_Jiachen/pyramid.py | UTF-8 | 2,117 | 3.15625 | 3 | [] | no_license | import cv2
import numpy as np
from matplotlib import pyplot as plt
def reduce(image):
image = padding(image)
gaussian = []
loop = 3
row = 2
column = 3
fig=plt.figure()
#Great pyramid of 4 levels
#Include the original image
for i in range(0, 4):
gaussian.append(image)
... | true |
f6f2b6f2b9628bd880d163f5b480f953b1382335 | saurabhbidwai/vito-recommendation-engine | /Filtering.py | UTF-8 | 1,524 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 24 21:45:05 2017
@author: DELL
"""
import re
import pandas as pd
data=pd.read_csv("E:/Aegis/R/Recommendation Project/Analytics Assignment (1)/Analytics Assignment/Events_Data_csv.csv")
CustomerID=[]
OfferID=[]
for i in range(len(data)):
CustomerID[i]=re.finda... | true |
a834d7e18222965b248584229f50b5f72199a22e | FenderPlymouth/my_first_programs | /house.py | UTF-8 | 3,590 | 3.078125 | 3 | [] | no_license | import turtle as trtl
import random
black = "#000000"
brick = "#680C07"
cream = "#F6E8B1"
brown = "#A67A5B"
trunk = "#331800"
green = "#0B6623"
bgrey = "#CFDBE6"
red = "#900D09"
painter = trtl.Turtle()
painter.speed(0)
# draw the ground
painter.penup()
painter.goto(-300, 0)
painter.pendown()
painter.goto(300, 0)
# ... | true |
847017250000d22c70d67fa4cfb8cab00797a3d9 | rohitpatwa/leetcode | /846. Hand of Straights.py | UTF-8 | 1,031 | 3.8125 | 4 | [] | no_license | # Create a counter of cards. Sort the keys. For each card, next W cards should have a count greater than it's count. Subtract curr count from next W cards.
class Solution(object):
def isNStraightHand(self, hand, W):
"""
:type hand: List[int]
:type W: int
:rtype: bool
"""
... | true |
a815d88f1a057c97e812438677cfe2498b419b3a | wanliyun/Aurora | /Resource/Scripts/Client/Viewer/View_Avatar.py | UTF-8 | 430 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pygame
import Context
from Viewer import View_Entity
class View_Avatar(View_Entity.View_Entity):
def __init__(self):
View_Entity.View_Entity.__init__(self);
self.imageIdx = 0
def Draw(self,screen):
_ctx = Context.GetInstance()
_img = _ctx.GetKTImage(self.imageI... | true |
2960f31558e7277eca2690ffc7fc093e9bb23810 | arminnh/ma2-csai-probabilistic-programming | /src/scripts/inference.py | UTF-8 | 3,356 | 2.71875 | 3 | [
"MIT"
] | permissive | import sys
import os.path
import argparse
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import util as util
from InferenceEngine import InferenceEngine
parser = argparse.ArgumentParser(description='Arguments for inference')
parser.add_argument("-pg", "--problog", dest="problog", help="Evaluate a ProbL... | true |
e75d9120292d908df2256445b41a0bd349048827 | rednuht/aoc_2020 | /day11/main.py | UTF-8 | 2,494 | 3.59375 | 4 | [] | no_license | def copy_seats(seats):
return [
row.copy() for row in seats
]
def fill_the_seats(seats, look_far_skip_floor=False, occupied_seat_limit=4):
x_max = len(seats[0])
y_max = len(seats)
last_nr_occupied = 0
while True:
new_seats = copy_seats(seats)
nr_occupied = 0
for... | true |
84e52aab5968cf65808f1fa7bc928be0cf727c4c | bgoonz/UsefulResourceRepo2.0 | /MY_REPOS/Lambda-Resource-Static-Assets/2-resources/BLOG/Data-Structures/1-Python/tree/path_sum2.py | UTF-8 | 1,824 | 4.09375 | 4 | [
"MIT"
] | permissive | """
Given a binary tree and a sum, find all root-to-leaf
paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum = 22,
5
/ \
4 8
/ / \
11 13 4
/ \ / \
7 2 5 1
return
[
[5,4,11,2],
... | true |
067ce761a6815ab372316c8b95d66f1f8514b135 | wanghran/CS_M146_ML | /HW0/Problem_11.py | UTF-8 | 92 | 2.546875 | 3 | [] | no_license | import numpy as np
w, v = np.linalg.eig([[1, 0], [1, 3]])
n = np.argmax(w)
print(v[:, n])
| true |
3523dbdd8c03fa1f8fd25dff5df0fbe48eeaa97e | wilkice/web-scraping | /yhd/yhd/yhd/spiders/yhd.py | UTF-8 | 1,593 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
need to specify:
self.item_name: str
page: int
"""
import time
import re
import scrapy
from yhd.items import YhdItem
class YhdSpider(scrapy.Spider):
name = 'yhd'
def start_requests(self):
self.item_name = 'iphone'
page = 50
for page in range(1, page + 1):... | true |
8e7c64e4dffb0e1f20cb122cb1229f83e0ad137f | apoorvaanand1998/project-euler | /21.py | UTF-8 | 772 | 3.234375 | 3 | [] | no_license | import math
from itertools import combinations
def prod(l):
prod = 1
for e in l:
prod *= e
return prod
def pf(n):
l = []
while n % 2 == 0:
n //= 2
l.append(2)
for i in range(3, math.ceil(math.sqrt(n))+1):
while n % i == 0:
n //= i
l.appen... | true |