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 |
|---|---|---|---|---|---|---|---|---|---|---|
f7a89114994f69e7653130aef63cc7a1b550ba0d | Arun-45102/Web_scraping | /book_scrap.py | UTF-8 | 1,032 | 2.6875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup
driver = webdriver.Chrome("chromedriver/chromedriver")
driver.get("https://webscraper.... | true |
e57d0d185641c3c13d6c32b77a11ed7c2849ae1d | Eric-Oll/TIPE_Yoann | /road_objects/vehicule.py | UTF-8 | 5,714 | 3.34375 | 3 | [] | no_license | """
Module name : `road_item.py`
----------------------------
*Created on* 13/02/2021 *by* Eric Ollivier
*Versionning :*
* 0.1 : Initial version
> Vehicule.index : cast la valeur en 'int'
"""
import logging
from road_objects.road_item import RoadItem, DISTANCE
from parameters import MAX_SPEED, MAX_SPEED_UP, MAX_SPE... | true |
c5a6ed4ab3e974fbb0cd175c35220418fb5c6e8d | VishnuChebolu/Mini-Shell | /calc.py | UTF-8 | 72 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python3
a=input("Enter expression : ")
print(a,'=',eval(a))
| true |
cd5e7ef62466e8dd7db8f8d3a2c138b4c34d40ac | kyamaguchi/nlp100 | /python/q47.py | UTF-8 | 1,415 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python
def question():
print("47. 機能動詞構文のマイニング")
print("動詞のヲ格にサ変接続名詞が入っている場合のみに着目したい.46のプログラムを以下の仕様を満たすように改変せよ.")
print("「サ変接続名詞+を(助詞)」で構成される文節が動詞に係る場合のみを対象とする, 述語は「サ変接続名詞+を+動詞の基本形」とし,文節中に複数の動詞があるときは,最左の動詞を用いる, 述語に係る助詞(文節)が複数あるときは,すべての助詞をスペース区切りで辞書順に並べる, 述語に係る文節が複数ある場合は,すべての項をスペース区切りで並べる(助詞の... | true |
e876a82332aa08c327b569683248b714645c9d13 | lewieug/code-for-implementation | /Confusion.py | UTF-8 | 1,813 | 2.625 | 3 | [] | no_license | RELATIONZ = {'causes1-causes2(e1,e2)': '1 causes1 causes2 1',
'causes2-causes1(e2,e1)': '2 causes2 causes1 2',
'contraindicates1-contraindicates2(e1,e2)': '3 contraindicates1 contraindicates2 1',
'contraindicates2-contraindicates1(e2,e1)': '4 contraindic... | true |
b3e897c7825026273ddc2b09d3287dc80ceb979c | etrigger/se2-curve-matching | /tools/draw_curves.py | UTF-8 | 4,694 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
from Tkinter import *
import tkFileDialog
import scipy.io as sio
# Width and height of image canvas
WIDTH = 300
HEIGHT = 300
def _tk_coords(points):
"""Helper function to flatten list of (x, y) pairs into
a 1D list (this is what Tk expects)."""
return [c for pt in points for c i... | true |
20d0bdbcee13a29e3391b9c070445fa24aa0e053 | veshhij/prexpro | /cs101/homework/2/2.7.py | UTF-8 | 632 | 4.25 | 4 | [] | no_license | #2 GOLD STARS
#Define a procedure,
#print_multiplication_table,
#that takes as input a positive whole
#number, and prints out a multiplication,
#table showing all the whole number
#multiplications up to and including the
#input number. The order in which the
#equations are printed must match exactly.
#prin... | true |
d9278910644649102f4e4453e2e079be5be92cc1 | IdoRafael/ML_HW4 | /FeatureImportanceGenerative.py | UTF-8 | 3,721 | 2.984375 | 3 | [] | no_license | # I have no idea what I'm doing
# ~~ Proverbs 4:20
from FeatureImportance import load_prepared_data
from DataPreparation import split_label
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.model_selection import Gri... | true |
7e9526cba69494120a6494674da07344d47b9f8c | brukidm/AoC2019 | /Day 4/4b.py | UTF-8 | 735 | 3.234375 | 3 | [] | no_license | import re
counter = 0
for password in range(109165, 576723):
appearances = {
"0": [],
"1": [],
"2": [],
"3": [],
"4": [],
"5": [],
"6": [],
"7": [],
"8": [],
"9": [],
}
adjacent = False
decreasing = False
stringified = ... | true |
35cbb241cb792de0c60d3bc27eede34f3dcbd9f1 | clarewu1106/MSITM6341 | /homework assignment/homework_assignment_1/hello_world.py | UTF-8 | 200 | 3.21875 | 3 | [] | no_license | Name: Dongying Wu
Student ID: 729678
Due day: 09.01.19
Class: MSITM 6341
print ("Hello World!")
print ("My name is: Dongying Wu")
print ("This is my first Python Program!")
print ("Have a nice day.")
| true |
7f3e87a9d090954f57f6e63aca371ada1b6fd431 | jisuwudou/Python_learn | /xiaoshuo/__init__.py | UTF-8 | 3,590 | 2.53125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import os
#下载总排行 https://www.80txt.com/sort/1.html 总推荐榜 https://www.80txt.com/top/allvisit/1.html
# headers = {'User-Agent':"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1"}##浏览器请求头(大部分网站没有这个请求头会报错、请务必加上哦)
headers... | true |
a518174daec22386e05962cef38d792f2e867e15 | joelarmstrong/Comparative-Annotation-Toolkit | /CAT/classify.py | UTF-8 | 18,529 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | """
A series of classifiers that evaluate transMap, AugustusTMR and AugustusCGP output.
These classifiers are broken down into 2 groups, which will each end up as a table in the database:
<alnMode>_<txMode>_Metrics:
These classifiers are per-transcript evaluations based on both the transcript alignment and the genom... | true |
80d1d0d38713e00d41f18150a519d3a61eed2d26 | mariasintea/AI-labs | /lab3-evoalg-comunities/old/GA.py | UTF-8 | 2,732 | 3.078125 | 3 | [] | no_license | from random import randint
from old.Chromosome import Chromosome
class GA:
def __init__(self, param=None, problem_param=None):
self.__param = param
self.__problem_param = problem_param
self.__population = []
@property
def population(self):
return self.__population
de... | true |
641d628d3f6a03d36c70d3b7ece9c0300c9342e1 | HamidL/AMMM_Project | /GreedyGRASP/Main.py | UTF-8 | 2,390 | 2.578125 | 3 | [
"MIT"
] | permissive | import sys
from GreedyGRASP.DATParser import DATParser
from GreedyGRASP.ValidateInputData import ValidateInputData
from GreedyGRASP.ValidateConfig import ValidateConfig
from GreedyGRASP.Solver_Greedy import Solver_Greedy
from GreedyGRASP.Solver_GRASP import Solver_GRASP
from GreedyGRASP.Problem import Problem
def ru... | true |
86bfb607633d53bd7c78aa7f18d214fbfbb3bdc0 | aheadley/pynemap | /testing/composite.py | UTF-8 | 1,977 | 3.3125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import numpy
class Color(object):
lower_bound = 0
upper_bound = 255
def __init__(self, r, g, b, a):
self.r = r
self.g = g
self.b = b
self.a = a
def __str__(self):
return '(%s, %s, %s, %s)' % (self.r, self.g, self.b, self.a)
def composite_pixels(src, dest):
new_color = Color(0,0,0,0)... | true |
a60723e61fff0fc8b5258d3ca94a61c9fffd2c8f | TeoRojas/Curso_Aprende_Python_con_DBZ | /Variables/VAR_segmentado_00.py | UTF-8 | 75 | 2.90625 | 3 | [] | no_license | cadena_dbz = "Dragon Ball Z"
print(cadena_dbz[0:5])
print(cadena_dbz[0:6]) | true |
e2fe8a171a129796b7c41f4774d8a9b1744e8f73 | pietermarsman/alpha-connect-four | /connect-four/tree.py | UTF-8 | 10,708 | 3.03125 | 3 | [
"MIT"
] | permissive | import math
import random
from operator import itemgetter
from typing import Dict, Union, List
import numpy as np
from analyzer import player_value
from state import Action, State, Color
from util import winner_value
class MiniMaxNode(object):
def __init__(self, state, player_color, state_color=None, parent=Non... | true |
51788aa603e7fbd06dc4b782a6c116b844c215d7 | github-pengge/Robotic-car | /localization/histogram_filter.py | UTF-8 | 3,434 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
__author__ = 'Jiapeng Hong'
'''
Actually, this is the homework assignment of Unit 1 of cs373.
Here, we implement a 2-D histogram filter, which is much similar
to the real world.
'''
def move(p, motion, p_move):
'''
Update probabilities of each place after one movement (for cyclic movem... | true |
c7df92ee41b34aad7b61a9d7a6eb351dcd1e72fd | rock-feller/Python_Challenge_DSI_Program | /Python_Challenge_DSI_Program/Solutions/challenge6.py | UTF-8 | 781 | 3.703125 | 4 | [] | no_license | """author = Rockefeller""""
#1 ) $ 103.68 B
#2) A company X growing exponentially for the last 10 years means
R2017 = R2016 * exp(alpha) , R2016 = R2015 * exp(alpha) where alpha is a coefficient to determinate.
Moving 10 years back, the initial revenue was R2008 = R0 , This means we can rephrase R2018 to R10... | true |
63de01f24523f3653e32462ef2c8435a3816cf21 | bibaev/python | /examples/gens.py | UTF-8 | 612 | 3.640625 | 4 | [] | no_license | #! /usr/bin/env python3
class node:
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
def __iter__(self):
return inorder(self)
def inorder(t):
if t:
yield from inorder(t.left)
yield t.value
yiel... | true |
2db668ad262f5ad2383cae5d4a4bd87a94b756c8 | fzadra/VanDerPolContact | /integrators/lagrangian.py | UTF-8 | 800 | 2.96875 | 3 | [] | no_license | import numpy as np
from scipy.optimize import fsolve
def forced_lagrangian(system, tspan, p0, q0):
"""
Integrate [system] with initial conditions [p0], [q0]
using a second order forced lagrangian integrator.
[tspan] is usually [np.linspace(t0, tfinal, num=steps)]
"""
dt = tspan[1] - tspan[0]
... | true |
6af683c2b2e888e38e2aff9b70fbd27f650f6757 | Raquel-Araujo/gap_dynamics_BCI50ha | /Meteorology/Scripts/funcmeteo.py | UTF-8 | 19,351 | 3.0625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import datetime as dt
# from matplotlib.cm import ScalarMappable
# import statsmodels.api as sm
import sys
###Function to produce plots of meteorological data
def functionrainfall (raws, ax=None):
###Create weekly dates
###Example: Ro... | true |
494399ab14c41c8408af460c6226c53979860bdc | cakesterman/NU-Hackathon-Twitter-Bot | /parsing.py | UTF-8 | 469 | 2.953125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
def get_current_bitcoin_price():
page = requests.get("https://finance.yahoo.com/quote/BTC-USD?p=BTC-USD")
if page.status_code == 200:
print("Successfully retrieved web page")
else:
print("Error")
soup = BeautifulSoup(page.content, 'htm... | true |
53bf01c41e2520824aa02f746cd25a61256604be | rajkn1212/Practice-Python | /File Handling/q22.py | UTF-8 | 1,275 | 4.53125 | 5 | [] | no_license | # Write a menu drivenPython program to implement a Stack of integers,floating point
# numbers and strings using a list data-structure.(Push ,Pop n Display)
stack = []
def push(item):
stack.append(item)
def top():
if len(stack) != 0 :
print(stack[-1])
else:
print("Stack is empty")
def pop... | true |
80a33da4ee170b226e2defeb1b17a88045d06fd8 | bajpaiNikhil/Leetcode | /leetcode_143.py | UTF-8 | 280 | 3.140625 | 3 | [] | no_license |
A=[3,2,4,1]
solution = []
a=len(A)
for i in range(len(A)):
current=max(A[0:a-i])
#print(current)
j=0
while A[j]!=current:
j+=1
A[:j+1]=reversed(A[:j+1])
solution.append(j+1)
A[:a-i]=reversed(A[:a-i])
solution.append(a-i)
print(solution) | true |
77c27400dab81d30b58de4b6be18c694b530084c | crazicoco/Computer-Network-Knowledge-Graph | /entity process/KNN_predict/text_fasttext.py | UTF-8 | 239 | 2.703125 | 3 | [] | no_license | # coding: utf-8
from pyfasttext import FastText
def text():
model = FastText('wiki.zh.bin')
print('load over..')
s1 = '启航'
s2 = '董启航'
s3 = ' 董启文'
print(model.nearest_neighbors('桃', k=5))
text()
| true |
4010e1667cfeb1313efd7be88c659b200cf59194 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_55/117.py | UTF-8 | 2,338 | 2.8125 | 3 | [] | no_license | '''
Created on May 8, 2010
@author: AliJ
'''
def parse_num():
return map(int, raw_input().split())
def process_case():
(R,k,N)=parse_num()
groupSizes = parse_num()
endGroups=[0]*N
rideSizes=[0]*N
currentGroupSize=0
currentGroup=0
while currentGroup < N and currentGroupSize+groupS... | true |
1a7cc10cbfa3d180869014622f00f0f6261f55ba | integerbasic/rn487x-demo | /scripts/bluetooth_scan.py | UTF-8 | 1,036 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
"""
Bluetooth device scanning/discovery
http://blog.kevindoran.co/bluetooth-programming-with-python-3/
https://github.com/pybluez/pybluez
"""
import bluetooth as bt
from bluetooth.ble import DiscoveryService
def bluetooth_classic_scan(timeout=10):
"""
This scan finds ONLY Bluetooth (non... | true |
e74dded1efc0269093580954d094e7ee3ed4449c | Marat-github/python_training_1 | /model/contact.py | UTF-8 | 1,880 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | from sys import maxsize
class Contact:
def __init__(self, first_name=None, middle_name=None, last_name=None, nick_name=None, title=None, company=None, address=None, home_phone=None,
mobile_phone=None, work_phone=None, fax=None, email=None, email2=None, email3=None, home_page=None, bday=None, bmon... | true |
249ec40148e8e13b5ea6bc5f0aca3c53f13bdc9d | fras2560/gensim-math-search | /scripts/create_models.py | UTF-8 | 3,756 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | '''
Name: Dallas Fraser
Email: d6fraser@uwaterloo.ca
Date: 2017-07-27
Project: Tangent GT
Purpose: To create the models to be used for indexing
'''
import sys
sys.path.append("..") # Adds higher directory to python modules path.
from tangent.math_corpus import MathCorpus
from gensim import models, corpora
import os
imp... | true |
794c94ab57f4cc06b282d40810fc572fa2c21bf4 | maicool06/IntroCompGrafica | /practico.py | UTF-8 | 9,166 | 2.671875 | 3 | [] | no_license | import numpy
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GL.shaders import *
from obj import *
from events_obj import *
def main():
#---------------------------------------------------------------------------------------
# Instrucciones para levan... | true |
2b3dd3211d78242787bc32c67f02a2bf9553dcea | LennyDuan/Tool | /script/file/demo/readFile.py | UTF-8 | 491 | 3.578125 | 4 | [] | no_license | import os
dir = os.getcwd()
print('Current folder: ' + dir)
print('------------------')
name = input('Please input a full file name: \n')
print('Your input file is: [' + name + ']');
print('------------------')
path = dir + '/' + name;
print('Your selected file path is: ' + path)
print('------------------')
print('-... | true |
83866a19c6463e84544f9db133138cee77d08598 | bolunli11/JXPerf | /script/pylib/writer.py | UTF-8 | 696 | 3.046875 | 3 | [
"MIT"
] | permissive | import csv
class CSVWriter:
def __init__(self, file_name, field_list):
assert(isinstance(field_list, list))
if file_name.endswith(".csv"):
self._file_name = file_name
else:
self._file_name = file_name + ".csv"
self._field_list = field_list
self._row_list = []
def writeRow(self, row_dict):
assert(i... | true |
00a32ec6eeeab13b42cf61655ad0eb9e6ee805a5 | eblade/radiant | /radiant/grid/adapter/local.py | UTF-8 | 2,539 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import os
from ..backend import GridBackend, DatabaseError
from ..backend.definition import Feed,\
ViewDefinition, VariableDefinition, DataDefinition
class LocalAdapter(object):
def __init__(self, directory):
self.backend = GridBackend(directory)
self.workspace = None
... | true |
390f3fc0edae52d09863d220721f55b357fce394 | XHMY/2020-OnlineCampAssignmentCode | /第二阶段/8_sort_temp.py | UTF-8 | 1,364 | 3.453125 | 3 | [] | no_license | import urllib.request as r
from pypinyin import pinyin, Style
import json
import time
def get_sorted_weather(city):
url = "http://api.openweathermap.org/data/2.5/forecast?q=" + city + \
"&mode=json&lang=zh_cn&&APPID=6a67ed641c0fda8b69715c43518b6996&units=metric"
data = r.urlopen(url).read().decode('ut... | true |
9bc1ff1330fa9eeaef7a82fca4b19c0c1341762b | ZR-Huang/AlgorithmsPractices | /Leetcode/Intermediate/Tree and graph/94_Binary_Tree_Inorder_Traversal.py | UTF-8 | 2,156 | 4.09375 | 4 | [
"BSD-3-Clause"
] | permissive | '''
Given a binary tree, return the inorder traversal of its nodes' values.
Example:
Input: [1,null,2,3]
1
\
2
/
3
Output: [1,3,2]
Follow up: Recursive solution is trivial, could you do it iteratively?
'''
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# ... | true |
d10919195b53a645b54019e3a07c19e17b539615 | dculp40/adventOfCode2019 | /8-1.py | UTF-8 | 1,313 | 3.125 | 3 | [] | no_license |
with open('photoInput.txt', 'r') as open_file:
encodedPhoto = []
for line in open_file:
encodedPhoto.append(line)
#ncodedPhoto = "0222112222120000"
encodedPhoto = encodedPhoto[0]
layeredPhoto = []
height = 6
width = 25
while len(encodedPhoto) > 0:
layer = []
for i in range(height):
... | true |
3479ccada5dbe5ea9303ed1b272389fad85d2621 | csehydrogen/battlecats | /VerifySaveData.py | UTF-8 | 848 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
# Author: Beeven Yip
# Created on 2015-6-26
import io
import os.path
import hashlib
import xml.etree.ElementTree as ET
def verifyIOS():
with open("SAVE_DATA","rb") as f:
data = f.read()
print "------ iOS SAVE_DATA ------"
verify(data)
def verifyAndroid... | true |
4d0b933022cc7c465ea58f9738e073405f13f460 | tomoino/Multi-Task-Learning-PyTorch | /models/optimizers/__init__.py | UTF-8 | 849 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""Optimizer"""
import torch.optim as optim
from configs.supported_info import SUPPORTED_OPTIMIZER
def get_optimizer(cfg: object, network: object) -> object:
"""Get optimizer function
This is function to get optimizer.
Args:
cfg: Config of optimizer.
network: Ne... | true |
6880e49ab33a4a4e44a6845ff6ee0dab8b0c68d2 | rosolczolgmakaron/1st-projekt | /cpp/n_wyraz_ciagu.py | UTF-8 | 417 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def wynik(n, tb):
# n-wyraz ciągu
# tb- tablica
n = tb[0]
while n > 0:
if n == 1:
return tb[0]
return wynik(n - 1, tb) * tb[n - 1]
def main(args):
tb = []
n = int(input("Podaj wartośc n: "))
print("Wynik: ", wynik... | true |
80a101b5c2c5d53a1752d76e8183fe8d63c45743 | MrHamdulay/csc3-capstone | /examples/data/Assignment_6/pckbra002/question3.py | UTF-8 | 1,247 | 4.0625 | 4 | [] | no_license | """program to count the number of votes for a each political party in an election"""
#Bandon Pickup (PCKBRA002)
#2014/04/21
#Assignment 6 Question 3
print("Independent Electoral Commission")
print("--------------------------------")
party = input("Enter the names of parties (terminated by DONE):\n")
parties=[]#l... | true |
500d8e90327803ee3836edde75effd48583c6d6b | nhanduong288/HomePractice | /Algorithms/sortTheArray.py | UTF-8 | 872 | 4.3125 | 4 | [] | no_license | '''
A programmer likes arrays a lot.
You are given an array a consisting of n DISTINCT integers.
The size of a is too small and you want a bigger array.
You will be given one only if you can answer one question:
Is it possible to sort the array a (in increasing order) by reversing
EXACTLY ONE segment of a?
''... | true |
4e08188a7434dfa787603a49fa6877aa339b49c1 | sareeves96/simple_rl | /cartpole.py | UTF-8 | 5,973 | 3.109375 | 3 | [] | no_license | import tensorflow as tf
import gym
import numpy as np
# discount rewards so that actions close to the end of the game have a larger weight
# a larger gamma makes early actions matter more
def discount(rw, gamma=0.9):
# weight individual rewards with an exponential decay function
# since the magnitude should b... | true |
feca3bd38c0153b0c1600617f5ec39e73f7eaa4b | qq961112/qbb2019-answers | /day4-lunch/day4-lunch-exercise#2.py | UTF-8 | 1,837 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
import pandas as pd
import os
name1 = sys.argv[1].split(os.sep)[-1]
ctab1 = pd.read_csv(sys.argv[1], sep="\t",index_col="t_name")
name2 = sys.argv[2].split(os.sep)[-1]
ctab2 = pd.read_csv(sys.argv[2], s... | true |
1b17b6328cd70ff875f9ba21ecb58e55abd810d3 | dioph/periodicity | /src/periodicity/phase.py | UTF-8 | 6,452 | 3.09375 | 3 | [
"MIT"
] | permissive | from multiprocessing import Pool, cpu_count
import numpy as np
from .core import FSeries, TSeries
MAX_CORES = cpu_count()
__all__ = ["StringLength", "PDM"]
# TODO: Analysis of Variance (Schwarzenberg-Czerny 1989)
# TODO: Gregory-Loredo method (Gregory & Loredo 1992)
# TODO: conditional entropy method (Graham et ... | true |
0cb516c9bbe19ee160f5125133dc94f70ba648db | Isitar/think-maths-puzzle-one | /main.py | UTF-8 | 2,324 | 2.953125 | 3 | [] | no_license | from mip import Model, BINARY, xsum, OptimizationStatus
# terminal colors
black = lambda text: '\033[0;30m' + text + '\033[0m'
red = lambda text: '\033[0;31m' + text + '\033[0m'
green = lambda text: '\033[0;32m' + text + '\033[0m'
yellow = lambda text: '\033[0;33m' + text + '\033[0m'
blue = lambda text: '\033[0;34m' +... | true |
ee0a645a8ea827fe8ab68e43aab7cbb6bc0370fa | napix/NapixServer | /napixd/managers/managed_classes.py | UTF-8 | 1,788 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class ManagedClass(object):
"""
A managed class of a :class:`napixd.managers.base.Manager`.
It contains a Promise to a Manager object by its Python path. The promise
will be resolved with the final class by calling :meth:`resolve`
"""
def __init... | true |
43cd553fb9fc9d90c7cf6b506dd9c0ae75d341b0 | dedekinds/learnpy | /方法论/[一般操作]KMP算法.py | UTF-8 | 994 | 3.390625 | 3 | [] | no_license | kmp算法
http://blog.csdn.net/chinwuforwork/article/details/51939826
#取出set中最长的元素
def getlongestelement(temp):
length=0
if not temp:#空集
return length
else:
for x in temp:
if len(x)>length:
length=len(x)
return length
#部分匹配表
#partial_table("AB... | true |
b8f8986f90ef319abe0c8724b8d951b9ffdfde1d | gabobaxx/gappi | /bot.py | UTF-8 | 1,542 | 2.71875 | 3 | [] | no_license | ''' PYTHON-TELEGRAM_BOT '''
# for debugging
import logging
# Bot Commands
from telegram.ext import CommandHandler
# To establish the connection
from telegram.ext import Updater
# To receive messages
from telegram.ext import MessageHandler, Filters
# Bot Token
BOT_TOKEN = "1105791347:AAG2x9MfHW5JwJc... | true |
e772186d48599b194ae8b80ab713b1e19c5329d1 | thiagosouzalink/my_codes-exercices-book-curso_intensivo_de_python | /Capitulo_04/exercise4_12.py | UTF-8 | 568 | 3.984375 | 4 | [
"MIT"
] | permissive | """
4.12 – Mais laços: Todas as versões de foods.py nesta seção evitaram usar laços for para fazer exibições a fim de economizar espaço. Escolha uma versão de foods.py e escreva dois laços for para exibir cada lista de comidas
"""
my_foods = ['pizza', 'falafel', 'carrot cake']
friend_foods = my_foods[:]
my_foods.app... | true |
40b21c5de1cf5490ef71f4be17d5b2728deb52f9 | oliviercros75/OrthoIn3D | /OrthoIn3D/build/lib/OrthoIn3D/segmentation/cut.py | UTF-8 | 4,641 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
Created on 29 oct. 2018
@author: Théo Moutakanni
'''
import vtk
import vtk.util.numpy_support as nps
from vtk.numpy_interface import dataset_adapter as dsa
import numpy as np
from scipy.linalg import svd
def prepare_polydata(polydata):
"""
Add some arrays to compu... | true |
8176fd1eefb8f7b608704ec6f931f4cc60628b9c | yeshan333/Python-Cryptography-Coding | /modinverse.py | UTF-8 | 757 | 3.734375 | 4 | [
"Apache-2.0"
] | permissive | #欧几里得算法求最大公约数
def get_gcd(a, b):
k = a // b
remainder = a % b
while remainder != 0:
a = b
b = remainder
k = a // b
remainder = a % b
return b
#改进欧几里得算法求线性方程的x与y
def get_(a, b):
if b == 0:
return 1, 0
else:
k = a // b
remainder = a % b
x1, y1 = get_(b, remainder)
x, y = y1, x1 - k * y1
r... | true |
b28f1aedeb4c50a59ba357d38bcf08eca3562699 | Park-Kwanwoo/Python | /Python01/com.test03/mtest01.py | UTF-8 | 370 | 3.6875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# python 에서의 인코딩 방법
def func01():
print('함수01')
def func02():
return '함수02'
def func03():
return {1:"qclass", 2:"화이팅"}
# main : 프로그램의 주 진입점
if __name__ == '__main__':
print('프로그램 시작 시 가장 먼저 호출')
func01()
print(func02())
print(func03()[1])
| true |
c32d8f83176879ac9d501e7668d007c5aec72578 | Tasty-Programmer/Python_2021_start | /Gong_Bro_Python/Python_Standard_Lib/Comparison.py | UTF-8 | 200 | 3.1875 | 3 | [] | no_license | print(1 < 3)
print(3 <= 3)
print(1 > 3)
print(3 >= 3)
print(1 == 1)
print(2 == 2)
print(1 == 2)
print(1 != 1)
print(1!=2)
print(3 is 1)
print(3.1 is 3.1)
type(3.1) is type(3)
type(3.1) is not type(3)
| true |
990805ab26c1c014f737bc4967da995e6df2f6c9 | hugo-paiva/curso_Python_em_Video | /Exercícios Resolvidos/Desafio045.py | UTF-8 | 937 | 3.265625 | 3 | [
"MIT"
] | permissive | from random import randint
from time import sleep
n = int(randint(1, 3))
player = int(input('''FAÇA SUA ESCOLHA
[ 1 ] Pedra
[ 2 ] Papel
[ 3 ] Tesoura
Insira o número:'''))
sleep(1)
print('JO')
sleep(1)
print('KEN')
sleep(1)
print('PO!!!')
if player == 1 and n ==1:
print('EMPATE! Os dois escolheram pedra.')
if playe... | true |
a09f745951f24d9617469923e0e2c7e8cb33e789 | TmsRC/RubioTomas_Ejercicio14 | /.ipynb_checkpoints/predict-checkpoint.py | UTF-8 | 2,326 | 2.59375 | 3 | [
"MIT"
] | permissive | import glob
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import image
from PIL import Image
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn import metrics
files_train = glob.glob('train/*.jpg')
files_... | true |
b986dae352e67fec31373882d3f52a748b266aa4 | marx1992620/cnn_keras_filtercars | /CnnModel_identifyCar_pred.py | UTF-8 | 1,350 | 2.8125 | 3 | [
"MIT"
] | permissive | # --coding:utf-8--
from keras.preprocessing.image import ImageDataGenerator
from keras.preprocessing import image
from keras.models import load_model
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
train_dir = r'E:\car_pic\training_in_out'
validation_dir = r'E:\car_pic\validation_in_out'
test... | true |
84bd0a3487f77c978918b2a1ee46f6d51028c420 | haretokidoki/Python-Projects-Protek | /chapter_07/latihan/latihan03.py | UTF-8 | 837 | 3.609375 | 4 | [] | no_license | #deklarasi variabel
repeatx = 'y'
sum = 0
n = 0
print('-----------------------------')
print('PROGRAM HITUNG RATA-RATA')
print('-----------------------------')
#masukkan bilangan
def inputNilai():
global sum
global n
global avg
while(repeatx == 'y'):
try:
print()
nilai = int(input("Masukkan b... | true |
314856ee33cf5cbd744bb8128a19967c0aabe07a | nguyenhvili/inteview-exam | /TASK15_pythagorean_triplets/solution/app.py | UTF-8 | 376 | 3.4375 | 3 | [] | no_license | # Task 15 finished at 8.7.2020 1:19
def findPythagoreanTriplets(nums):
nums.sort()
while len(nums) > 2:
target = nums.pop()
for b in nums:
for c in nums[nums.index(b) + 1: len(nums)]:
if b ** 2 + c ** 2 == target ** 2:
return True
return False
... | true |
5303d71ef05791a3f9a1608b812f7a26d9118e40 | jrodguez/musical-robot | /musicalrobot/tests/test_DES.py | UTF-8 | 2,565 | 3.046875 | 3 | [
"MIT"
] | permissive | from musicalrobot import DES
from sklearn.cluster import KMeans
import random
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.optimize import fsolve
# Function: General Des generator - any number of components will work
# Step: Generate a large amount of possibilities, narrow down wi... | true |
c37e6a71a0fdbaa40fe675b09c1ae43e674567b2 | liujiantong/detect_track_qrcode | /py/toyapp.py | UTF-8 | 904 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import cv2
from tracker import ToyTracker
from camera import SimpleCamera
def tracking_callback():
# frame = tracker.get_frame()
debug_frame = tracker.get_debug_image()
# toy_center = tracker.get_last_toy_center()
toy_colors = tracker.get_toy_colors()
# cv2... | true |
5501c5d0d27cfe64c5c766c8cf65d7ad9e9fff91 | Shubhangi-Priya2497/Data-Visualization-with-Python | /task1.py | UTF-8 | 285 | 3.328125 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
#create the dataframes using the csv file.
df = pd.read_csv(r'./rain.csv')
print(df)
print("df statistics: \n", df.describe())
df.plot(x='Month', y= 'Temperature')
df.plot(x='Month', y= 'Rainfall')
plt.show() | true |
dca127a4199f7ecc01fd05e5e4e47ec4d0146df6 | ferasodh/semvec | /featureextractionmodules/SentiWordNet.py | UTF-8 | 3,776 | 2.546875 | 3 | [] | no_license | import string
from collections import Counter
import nltk
import pandas as pd
from TwitterCleanuper import TwitterCleanuper
from data_helpers import clean_str, clean_tweet, load_semeval_and_y_labels
import re as regex
import csv
from collections import OrderedDict, defaultdict, Counter
import numpy
from featureextract... | true |
fba7beed2d936452abd283ffaf373e9c48e42048 | shaynababe/gpfit | /docs/source/examples/ex2.py | UTF-8 | 535 | 2.703125 | 3 | [
"MIT"
] | permissive | """Example 6.3 from Hoburg et al."""
import numpy as np
from gpfit.fit import MaxAffine, SoftmaxAffine, ImplicitSoftmaxAffine
SEED = 33404
rng = np.random.RandomState(SEED)
Vdd = rng.random_sample(1000) + 1
Vth = 0.2*rng.random_sample(1000) + 0.2
P = Vdd**2 + 30*Vdd*np.exp(-(Vth - 0.06*Vdd)/0.039)
u = np.vstack((Vdd... | true |
6390d3378780d365af55b96238ff6c2292eb9961 | jiaopi404/python_demos | /my_test_002/03_cal_sign.py | UTF-8 | 104 | 3.484375 | 3 | [] | no_license | # test calculate sign
a = 2
print(a * 20)
print("-" * 50)
a = 20
print(a % 3)
a = 40
print(a ** 2)
| true |
5b4fceafdf09e911fda6518976158e729124c1dd | booo/gid | /src/api/forms/login.py | UTF-8 | 341 | 2.578125 | 3 | [] | no_license | from flaskext.wtf import Form, TextField, PasswordField, validators
class LoginForm(Form):
username = TextField('Username', [validators.Length(min=2, max=25)])
password = PasswordField('Password')
def toDict(self):
return {
'username' : self.username.data,
'password' : self.passw... | true |
edcc2a07a9f9659ce312f6060a8b587f92460193 | daniel-reich/ubiquitous-fiesta | /kmruefq3dhdqxtLeM_21.py | UTF-8 | 169 | 3.53125 | 4 | [] | no_license |
def sum_digits(a, b):
def digit_sum(number):
return sum([int(digit) for digit in str(abs(number))])
return sum([digit_sum(number) for number in range(a,b+1)])
| true |
88d57807ce81a6a479c0bce416fad7897461946a | Nifled/tap-universiada | /tap_universiada/apps/comidas/barcodes.py | UTF-8 | 2,001 | 3.03125 | 3 | [] | no_license | # TODO : Move somewhere else. e.g. in comidas/ dir
from django.conf import settings
import barcode
from barcode.writer import ImageWriter
from imgurpython import ImgurClient
client_id = 'acb081bb45da3bd'
client_secret = '663520e343564e95bffca50633c421711df9de0c'
Imgur = ImgurClient(client_id, client_secret)
def ge... | true |
b4919913ab3876c081c5b9e3ae301079b991b17a | lucianojunnior17/Python | /Curso_Guanabara/aula58.py | UTF-8 | 700 | 4.40625 | 4 | [
"MIT"
] | permissive | from random import randint
pc = randint(0, 10)
print('='*200)
print('='*200)
print('Olá sou seu computador vamos jogar?? ')
print('Vou pensar em um número de 0 a 10 ')
print('Tente acertar qual número eu escolhi ')
acertou = False
palpites = 0
while not acertou:
jogador = int(input('Qual é o seu palpite ?... | true |
afd10f20b47a1101eda56982f4919665dab06c57 | praveen-ky/python_tutorial | /ex_06.py | UTF-8 | 168 | 3.28125 | 3 | [] | no_license | # Read from the str 'X-DSPAM-Confidence: 0.8475' and extract the number.
sent = 'X-DSPAM-Confidence: 0.8475'
pos = sent.find(':')
num = float(sent[pos+1:])
print(num)
| true |
700d3e0a5f4444bfae2b715c91f28b4bec4b6e1c | YakiYaki/questionnaire | /quiz/views.py | UTF-8 | 14,042 | 2.65625 | 3 | [] | no_license | from django.shortcuts import render
# Create your views here.
quiz_html = "quiz.html"
licenses = {'1': 'Business license',
'2': 'Food handling and safety license',
'3': 'Building license', '4': 'Liquor license',
'5': 'Trademark license', '6': 'HAACP regulations',
'7': ... | true |
e80925fe0ada81b20ffb669956dced70baa23517 | susag3/Masters-project-in-Systems-biology-Transcriptomic-study-of-Alzheimer-s-disease | /preprocess.py | UTF-8 | 5,427 | 2.9375 | 3 | [] | no_license | #This script preprocesses the orginal Alzheimer's microarray data (E-GEOD-48350), and extracts chosen samples to a new file.
#This new file includes all unique gene names and their average expression values for each sample (column) in either case or control set.
import sys
import os
import statistics
with o... | true |
1739fc0519555fc22ddd818fa4b0997c62074c7c | TommyChord/catalog | /lotsofcategories.py | UTF-8 | 23,585 | 2.71875 | 3 | [] | no_license | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from models import Base, Category, Item, User
engine = create_engine('sqlite:///catalog.db')
# Bind the engine to the metadata of the Base class so that the
# declaratives can be accessed through a DBSession instance
Base.metadata.bind = eng... | true |
202496dd2fa2d465cb98ff6031711ddd8fb1bbbf | Aasthaengg/IBMdataset | /Python_codes/p03632/s972446950.py | UTF-8 | 268 | 3.34375 | 3 | [] | no_license | a,b,c,d=map(int,input().split())
if a<=c and b<=d:
if b-c>0:
print(b-c)
else:
print(0)
elif a>=c and b>=d:
if d-a>0:
print(d-a)
else:
print(0)
elif a<=c and b>=d:
print(d-c)
elif a>=c and b<=d:
print (b-a)
| true |
5c67ba84352412f9c46c821440b0fa3d88b2c440 | elyerandio/python-web | /boc.py | UTF-8 | 1,358 | 3.25 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
BASE_URL = "http://www.chicagoreader.com"
def get_category_links(section_url):
page = requests.get(section_url)
soup = BeautifulSoup(page.text)
boccat = soup.find('dl', attrs={'class','boccat'})
category_links = [BASE_URL + dd.a['href'] for dd in boccat.f... | true |
a796f1cfda1ab787975456ec30f65802aed3a090 | sgrade/pytest | /codeforces/1270A.py | UTF-8 | 358 | 3.171875 | 3 | [
"MIT"
] | permissive | # A. Card Game
for _ in range(int(input())):
n, k1, k2 = map(int, input().split())
max1 = 0
tmp = map(int, input().split())
for _ in tmp:
if _ > max1:
max1 = _
max2 = 0
tmp = map(int, input().split())
for _ in tmp:
if _ > max2:
max2 = _
print('... | true |
75c20f30b6199a9bf9427a6b488470d171612d8d | bzzitsme/webdev2019 | /week10/CodingBat/Logic-1/in1to10.py | UTF-8 | 119 | 3.3125 | 3 | [] | no_license | def in1to10(n, outside_mode):
if outside_mode:
return n <= 1 or n >= 10
else:
return n >= 1 and n <= 10 | true |
f8cdc427d0109a577cde73f465f17eda2f1bce56 | Arrahglen1/Azure_Time_series | /Jokes_python.py | UTF-8 | 1,874 | 4.3125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[3]:
from random import randint
jokes = ["I'm so pretty", "Nice game", "OMG", "LOL", "White Elephant", "Check this sequence",
"Safe journey", "holala", "I'm so cute", "All star game","Hey Baldy","Not so fuuny"]
for i in range(10):
print(jokes[randint(0,11)]... | true |
a97e01280840fe14a3570cc5f7986ddd829fbb56 | Sagarmk079/Python-programs | /untitled12.py | UTF-8 | 564 | 3.34375 | 3 | [] | no_license | name1=list(input("enter 1st name"))
name2=list(input("enter 2nd name"))
count=0
c=0
for i in range(len(name1)):
for j in range(len(name2)):
if(name1[i]==name2[j]):
name1[i]="-";
name2[j]="-";
c=c+1
break;
count=len(name1)+len(name2)-2*c
print("count=",co... | true |
4359c5a551add21256fe4dd9ec143506e8cebe5e | mihneagiurgea/pysandbox | /talentbuddy/typeahead.py | UTF-8 | 1,325 | 3.625 | 4 | [] | no_license | class TrieNode(object):
def __init__(self):
self.value = -1
self.min_char = None
self.children = {}
def insert(self, word, value):
node = self
for char in word:
if char not in node.children:
node.children[char] = TrieNode()
if... | true |
fabfc5beb8ee19d29f8c426a95fe7378830672a9 | alexandraback/datacollection | /solutions_1485490_0/Python/fantastication/boxes.py | UTF-8 | 1,490 | 2.828125 | 3 | [] | no_license | def test(boxes, toys, i, j):
if boxes[j + 1] == toys[i + 1]:
return max([boxes[j], toys[i]])
def choose(boxes, toys, i, j, shipped):
if i >= n or j >= m:
return shipped
if toys[i + 1] == boxes[j + 1]:
if toys[i] >= boxes[j]:
shipped += boxes[j]
toys... | true |
d2455ce5da6fce671ee1ba18ed1091a6f80404db | ShaneDrury/roguelike | /roguelike/core/fov.py | UTF-8 | 1,084 | 2.71875 | 3 | [] | no_license | import libtcod
class FOV(object):
def __init__(self, tiles):
self.t = libtcod
self.fov_map = self.init_map(tiles)
self.algo_dict = {
'BASIC': self.t.FOV_BASIC,
'DIAMOND': self.t.FOV_DIAMOND,
'SHADOW': self.t.FOV_SHADOW
}
self.algorithm = ... | true |
c296717793b81121bfc7e5b297e21b23d9581b06 | OlofHarrysson/UdacityWebApp | /hw/cookie.py | UTF-8 | 410 | 2.828125 | 3 | [] | no_license | import string
import hashlib
import random
def make_salt():
return ''.join(random.choice(string.letters) for x in xrange(5))
def make_pw_hash(name, pw, salt = None):
if not salt:
salt = make_salt()
hash_pw = hashlib.sha256(name + pw + salt).hexdigest()
return '%s|%s' % (hash_pw, salt)
def valid_pwd(name, pw, ... | true |
9ab8ed85f933f0e995b7318c1b13382a0f25a504 | niolabs/nio | /nio/properties/util/tests/test_property_value.py | UTF-8 | 2,718 | 2.640625 | 3 | [] | no_license | from unittest.mock import MagicMock
from nio.properties.exceptions import AllowNoneViolation
from nio.properties.base import BaseProperty
from nio.properties.holder import PropertyHolder
from nio.properties.util.property_value import PropertyValue
from nio.signal.base import Signal
from nio.types.base import Type
from ... | true |
f955ec92805c6d46fa2ee1c4e915f2da19b60c85 | bikram-nepal/TO-DO-LIST | /file.py | UTF-8 | 195 | 3.046875 | 3 | [] | no_license | array = ['one','two','three']
string = '\n'.join(array)
data = open('data.txt','w')
data.write(string)
data.close()
f = open('data.txt','r')
print(f.read().split('\n'))
f.close()
| true |
3beb51552d022018860197050c911587bc457a2f | vijaynchakole/Automation-using-Python | /Web_Scrapping_Wikipedia.py | UTF-8 | 633 | 3.296875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 20 01:18:32 2020
@author: hp
Automation script which fetch title and
content headers of wikipedia page using Beautiful Soup.
"""
import bs4
import requests
res = requests.get("https://en.wikipedia.org/wiki/Python_(programming_language)")
type(res)
... | true |
1d4c50d4402bb320b6c72610d3b7327fdb6a4fee | JoelHaubold/NzmLabeling | /pickle_plotting_v2.py | UTF-8 | 19,124 | 2.5625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
from pathlib import Path
import pandas as pd
import os
import numpy as np
def get_file_paths(file_directory):
file_paths = os.listdir(file_directory)
file_paths = list(filter(lambda f_path: os.path.isdir(file_directory / f_path), file_paths))
return file_paths
def plot_da... | true |
8235eef5742fb1f37fd9e178a1d2be3105f2e780 | NemesisHaven/PTPDocs | /PTP_Docs.py | UTF-8 | 850 | 2.90625 | 3 | [] | no_license | #! python3
# Wrappers to unify interactions with the different kinds of docs to be found in PTP
def openPTPDoc(filename):
if filename.endswith(".doc"):
pass
elif filename.endswith(".docx"):
pass
elif filename.endswith(".pdf"):
pass
else:
raise TypeError("File is not a .d... | true |
36c7c081b76bfb4bd6b307bfe372398c2cf754b5 | calior/selenium | /back_forward.py | UTF-8 | 592 | 3.140625 | 3 | [] | no_license | #coding utf-8
from selenium import webdriver
import time
#访问百度首页
driver = webdriver.Chrome()
first_url = 'http://www.baidu.com'
driver.get(first_url)
print('现在url是百度首页%s',first_url)
time.sleep(3)
#访问百度新闻首页
second_url = 'http://news.baidu.com'
driver.get(second_url)
print('现在url是新闻首页%s',second_url)
time.sleep(3)
#返回到百度首... | true |
33399845e2a9e9847ba4a73460b868c346f1a9d1 | CICATA/TensorflowCertificationStudy | /_51_SaveLoadModel.py | UTF-8 | 1,378 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | import os
import tensorflow as tf
from tensorflow import keras
print(tf.version.VERSION)
(train_images, train_labels), (test_images, test_labels) = tf.keras.datasets.mnist.load_data()
train_labels = train_labels[:1000]
test_labels = test_labels[:1000]
train_images = train_images[:1000].reshape(-1, 28 * 28) / 255.0
... | true |
22a6856a7ed284c6b70dab07a8dfc8598d29d4cc | kimjieun6307/itwill | /itwill/PYthon_2/chap07_TextMining/lecture01_Crawling/step03_newsQueryCrawling.py | UTF-8 | 2,343 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
방법2) url query 이용 : 년도별 뉴스 자료 수집
예) 2015.01.01 ~ 2020.01.01
page : 1~5
"""
import urllib.request as req # url 가져오기
from bs4 import BeautifulSoup # html 파싱
import pandas as pd # 시계열 date
# 1. 수집 년도 생성 : 시계열 date 이용
date = pd.date_range("2015-01-01", "2020-01-01") # 시작일, 마감일
l... | true |
b91d89b78aadb44630cbd4588ec897af857aea37 | azukov/py-orbit | /py/orbit/utils/fitting/general_minimization/GoldenSectionSearch1D.py | UTF-8 | 4,120 | 2.8125 | 3 | [
"MIT"
] | permissive | #====================================================================
# Class GoldenSectionSearchAlgorithm - 1D search
#====================================================================
import os
import math
import sys
import time
from Solver import SearchAgorithm
# import the finalization function
from orb... | true |
9a04c0365dc90c8b59a4a51e1a52698d281307f4 | QIAOZHIBAO0104/My-Leetcode-Records | /1580. Put Boxes Into the Warehouse II.py | UTF-8 | 846 | 3.5 | 4 | [] | no_license | '''
https://leetcode.com/problems/put-boxes-into-the-warehouse-ii/
You are given two arrays of positive integers, boxes and warehouse,
representing the heights of some boxes of unit width and the heights of n rooms in a warehouse respectively.
The warehouse's rooms are labeled from 0 to n - 1 from left to right where... | true |
eefd61ad82f1089e96b57610b19c175430ed5266 | zaghlol94/Computer-Vision-Open-CV-play-ground | /Contours/Contours.py | UTF-8 | 8,690 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 13 22:52:35 2018
@author: zaghlollight
"""
import cv2
import numpy as np
# Let's load a simple image with 3 black squares
image = cv2.imread('shapes.jpg')
cv2.imshow('Input Image', image)
cv2.waitKey(0)
cv2.destroyAllWindows()
# Grayscale
gray = cv2.cvtC... | true |
f8b1023a4984749e04479099632eebc2d245792e | g2606340915/rg201--2018 | /机试/老王开枪/f.py | UTF-8 | 339 | 3.4375 | 3 | [] | no_license | menu = ['苹果汁','蓝莓汁','香蕉汁','黄瓜汁','番茄汁']
for i in menu:
print(i)
menu[0] = '土豆汁'
menu[1] = '葡萄汁'
print('*'*30)
print('本店替换了两种饮料,现在提供:%s'%menu)
a = {'土豆汁':'2','葡萄汁':'3','香蕉汁':'4','黄瓜汁':'1','番茄汁':'0.5'}
print('本店饮料价格:%s'%a)
| true |
ac8679fd819b538eb9ac9b61faad3ab403c847c1 | AllenBiju/Winter-19-20-NLP | /11 Dec 2019/chinese_word_segment.py | UTF-8 | 364 | 3.1875 | 3 | [] | no_license | # module for chinese text segmentation
import jieba
ch_text = "当前,世界面临食品、气候变化以及金融等多重危机,而正是这些危机更加突出了农业在发展中国家至关重要的地位"
word_list = jieba.cut(ch_text, cut_all=False)
# for i in word_list:
# print(i)
segmented_text = " ".join(word_list)
print(segmented_text) | true |
244996d6c688cfb0a9655d7bf7b5f180c6391a51 | jeff-lund/CS199 | /Python/ExamPractice/Final/first_let_dict.py | UTF-8 | 927 | 4.5 | 4 | [] | no_license | '''
Same idea as first_letter.py but using a dictionary
instead of a freqency table.
'''
phrase = input("Enter a phrase: ")
phrase = phrase.lower().split(' ')
# keys will be first letters of each word
# values will be the count of appearences
letters = {}
for word in phrase:
if word:
letter = word[0]
... | true |
9be055b9bd9568d8078d86960584c78d149cd34d | jordiprats/micropython-remainigdays | /main.py | UTF-8 | 3,782 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | import gc
debug = False
from config import wifi_config
from config import utelegram_config
import tm1637
from machine import Pin
tm = tm1637.TM1637(clk=Pin(5), dio=Pin(4))
tm.brightness(1)
tm.write([0, 0, 0, 0])
tm.write([127, 255, 127, 127])
if debug: print('leds init')
import network
sta_if = network.WLAN(netwo... | true |
336dc985e42272da6a7b7e5709c25893198462f1 | coreyjadams/IC | /invisible_cities/icaro/hst_functions_test.py | UTF-8 | 854 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from numpy.testing import assert_equal, assert_allclose
from hypothesis import given
from hypothesis.strategies import floats
from hypothesis.extra.numpy import arrays
from . import hst_functions as hst
@given(arrays(float, 10, floats(min_value=-1e5, max_value=1e5)))
def test_shift... | true |
61933e7c13a50557b84894609c67b861f56fdf57 | Infinidrix/competitive-programming | /Squidgame/d2q4.py | UTF-8 | 1,133 | 3.390625 | 3 | [] | no_license | class Solution:
def numberToWords(self, num: int) -> str:
low = "Zero One Two Three Four Five Six Seven Eight Nine Ten Eleven Twelve Thirteen Fourteen Fifteen Sixteen Seventeen Eighteen Nineteen"
mid = "Zero Ten Twenty Thirty Forty Fifty Sixty Seventy Eighty Ninety Hundred"
high = "Zero Thou... | true |