blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
ff332087983e813cef12d7a5b5119a7604b4f2d8 | Python | sadhanaauti93/End_To_End-testing | /PutUsres.py | UTF-8 | 520 | 2.59375 | 3 | [] | no_license | import requests
import json
import jsonpath
#API URL
url = "https://reqres.in/api/users/2"
# Read Input Json File
file = open('F:\\CreateUser.Json', 'r')
json_input = file.read()
request_json = json.loads(json_input)
# Make Put request with json input body
response = requests.put(url, request_json)
# validating re... | true |
b658a383fce3b41638e13383741c86b5c3398118 | Python | tnoumar/esp32-libraries | /esp32_si1145.py | UTF-8 | 2,553 | 2.546875 | 3 | [
"MIT"
] | permissive | """
MicroPython driver for SI1145 light I2C sensor, low memory version :
https://github.com/neliogodoi/MicroPython-SI1145
Version: 0.3.0 @ 2018/04/02
"""
import time
from ustruct import unpack
class SI1145(object):
def __init__(self, i2c=None, addr=0x60):
if i2c is None:
raise ValueError('An I2C objec... | true |
fe63fa2d776386903d17a3d4232859c2f03c5571 | Python | 7jdope8/Bitcoin_Bruters_Toolkit | /SEEDPRIV/Fullkit.py | UTF-8 | 1,184 | 3.09375 | 3 | [
"MIT"
] | permissive | # This program takes a word file of mnemomics and calculates a new priv key and address from each line of the .txt file
# Work in Progress ... do we even need the (uncompressed) public key, just check the address? quicker
# > python fullkit.py # defaults to seedlist.txt for input
# Printing to screen is time consum... | true |
0700a5d0077add75fabaecf1d682b403577393ec | Python | dadinux/elia_teaching | /python/compito_info/Compito_201215/esercizio1.py | UTF-8 | 985 | 3.890625 | 4 | [] | no_license | #!/usr/bin/env python3
#
#
def ciclo_while_somma():
i = 0 # i assumerà la funzione del numero da elevare al quadrato
# dunque sarà i = 0, i = 1, i = 2, ... fino a che sarà UGUALE a num
# ad ogni ciclo, il valore sarà incrementato di uno
isomma = 0
while (i <= 10 ):
... | true |
cbf724de29769efc7f00235430174aa81adaa756 | Python | HybridRbt/RoboND-Perception-Ex2 | /RANSAC.py | UTF-8 | 2,305 | 2.921875 | 3 | [] | no_license | # Import PCL module
import pcl
# Load Point Cloud file
#cloud = pcl.load_XYZRGB('tabletop.pcd')
def voxel_downsampling(pcl_data):
# Voxel Grid filtering
# Create a VoxelGrid filter object for out input point cloud
vox = pcl_data.make_voxel_grid_filter()
# choose a voxel (leaf) size
LEAF_SIZE = 0.... | true |
d9145e5868cc60975d24b7d226a8ebeba2926c70 | Python | Mcvriez/small_projects | /fxcmSwaps/src/fxcmconnector.py | UTF-8 | 1,752 | 2.609375 | 3 | [] | no_license | import fxcmpy
class FXCMConnector:
def __init__(self, token, log_level='', log_file='', verbose=False):
self.token = token
self.log_level = log_level
self.log_file = log_file
self.connect = fxcmpy.fxcmpy(token, log_level=log_level, log_file=log_file)
self.instruments = self... | true |
332a69c282238caa370409fbeb92641d060da2a7 | Python | kmpatzke/theGoatProblem | /Manuell/door.py | UTF-8 | 373 | 3.4375 | 3 | [] | no_license |
class door:
def __init__(self, number, price ):
self.__number = number
self.__price = price
def getNumber(self):
return self.__number
def getPrice(self):
return self.__price
def openDoor(self):
print("Door #{} opened. It is ..... a {}.".format(self.__... | true |
d6d6bce9310f5e26b9240e9649af8ca0f3d62ad6 | Python | karist7/Python-study | /1장/1장9번.py | UTF-8 | 274 | 3.609375 | 4 | [] | no_license | import turtle
t=turtle.Turtle()
t.shape("turtle")
t.up()
t.goto(-90,0)
t.down()
t.circle(100)
t.up()
t.goto(90,0)
t.down()
t.circle(100)
t.up()
t.goto(270,0)
t.down()
t.circle(100)
t.up()
t.goto(0,-150)
t.down()
t.circle(100)
t.up()
t.goto(200,-150)
t.down()
t.circle(100)
| true |
4902215e80dbdfa2bfe9a49d3a2e3d291736f06e | Python | wickywaka/stereo | /cm3stereo/calib_rect/rectify_preview.py | UTF-8 | 1,362 | 2.71875 | 3 | [] | no_license | # This program undistort and rectify two images
import numpy
import cv2
import io
import picamera
undistortion_map_left = numpy.load('maps/undistortion_map_left.npy')
rectification_map_left = numpy.load('maps/rectification_map_left.npy')
undistortion_map_right = numpy.load('maps/undistortion_map_right.npy')
rectific... | true |
d209ab8760b935fec05f315e91221a14751f8afb | Python | konman2/Calcmass | /calcmass/mass.py | UTF-8 | 4,063 | 2.84375 | 3 | [
"MIT"
] | permissive | from calcmass.pt_data import masses
val = ""
multiples = {}
def add_commas(orig):
with_Commas = ""
for i in range(len(orig) - 1):
with_Commas += orig[i]
if orig[i + 1].isupper():
with_Commas += ","
with_Commas += orig[-1]
with_Commas += ','
return with_Commas
# returns... | true |
ceeffc11545f3127b8eeb553846c23bec891d81d | Python | GGreenfield/maze_ai | /Cell.py | UTF-8 | 748 | 3.625 | 4 | [] | no_license | import numpy as np
class Cell:
"""A Cell object represents a 1x1px space on a maze which is not a wall,
i.e. a valid space to be considered in the solution"""
wall_dic = {"N": "S", "S": "N", "W": "E", "E": "W"}
def __init__(self, x, y):
self.x = x
self.y = y
self.visited = Fals... | true |
4300fb19708d69837bd418655c445baee02f0edd | Python | gva-jjoyce/gva_data | /tests/test_display.py | UTF-8 | 1,555 | 3.171875 | 3 | [
"Apache-2.0"
] | permissive | """
Tests for paths to ensure the split and join methods
of paths return the expected values for various
stimulus.
"""
import datetime
import sys
import os
sys.path.insert(1, os.path.join(sys.path[0], '..'))
from gva.data.formats import display
try:
from rich import traceback
traceback.install()
ex... | true |
8310f36219a5b9eff3962e5e00b3f22039d449d9 | Python | franciscoalbear/proyecto_productos | /productos.py | UTF-8 | 3,348 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from Tkinter import *
import CRUD
def ventana_principal():
root = Tk()
root.title("Abarrotes")
root.geometry("400x400")
frame = Frame(root)
frame.pack(padx = 30,pady = 30)
label = Label(frame, text="Tienda de Abarrotes",fg = "blue",font=("Arial",18))
label.pack(... | true |
ec59d053b66b75451460b36f0ab5b34da4a1ab40 | Python | CarlosGiovannyG/Curso_Python | /Modulos/modulos.py | UTF-8 | 1,304 | 4.09375 | 4 | [] | no_license | """
MODULO: es un archivo con extención .py o .pyc (PYTHON COMPILADO), es un modulo que posee
su propio espácio de nombres osea que contiene su propio contexto; el
cual puede contener variables, funciones,clases o incluso otros modulos
PARA QUE SIRVEN?: sirven para organizar mejor el código y poder reu... | true |
60d5bc8588bd494bb05f8bb58516a10c8c160e41 | Python | Dressro/PythonStudy | /Python02/crawling/instargram/image.py | UTF-8 | 271 | 2.671875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from bs4 import BeautifulSoup
import requests
tag = input("search tag : ")
url = 'http://www.instagram.com/explore/tags/' + tag
resp = requests.get(url)
soup = BeautifulSoup(resp.text,'html.parser')
print(soup.find('div',{'class','KL4Bh'}))
| true |
f6cea77996c3e727fd796874c7e6e99a4b7c4445 | Python | ReardenMetals/csc-manager | /ui/update_widget.py | UTF-8 | 1,384 | 3.0625 | 3 | [] | no_license | import tkinter
from tkinter import messagebox
from tkinter.ttk import Progressbar
from controller.update_controller import UpdateController
class UpdateWidget:
def __init__(self, root):
last_coin_frame = tkinter.Frame(root, pady=15)
tkinter.Label(last_coin_frame, text="Enter the last good coin id... | true |
7773c82b02c10be14848faa6780c17f16aba2c44 | Python | neil444/nd | /weight.py | UTF-8 | 282 | 2.625 | 3 | [
"MIT"
] | permissive | import plotly.figure_factory as ff
import pandas as pd
import csv
df = pd.read_csv("c:/Users/ADI/Downloads/Normal-Distribution-master (1)/Normal-Distribution-master/data.csv")
fig = ff.create_distplot([df["Weight(Pounds)"].tolist()], ["Weight"], show_hist=False)
fig.show()
| true |
0061246a333c2205778381614fb1e041e9081200 | Python | MauroVA98/DAPOS | /src/atmos/nrlmsise00/IndexFindr/solarflux_process/data_extract.py | UTF-8 | 1,525 | 3 | 3 | [] | no_license | import pandas as pd
import os
import datetime as dt
class DataImport(object):
def __init__(self, datafile: str = r'\\'.join(os.getcwd().split('\\')[:-4]) + '\\data\\nrlmsise00_data\\SolarFlux_Indices\\nlrmsise00_f107data.txt'):
self.__datafile = datafile
self.__data = None
s... | true |
112f68e92dcd1d577b2b2fa0faea80cff5c6c6e5 | Python | hmarmal/Ch.07_Graphics | /7.2_Picasso.py | UTF-8 | 3,078 | 3.390625 | 3 | [] | no_license | '''
PICASSO PROJECT
---------------
Your job is to make a cool picture.
You must use multiple colors.
You must have a coherent picture. No abstract art with random shapes.
You must use multiple types of graphic functions (e.g. circles, rectangles, lines, etc.)
Somewhere you must include a WHILE or FOR loop to create a ... | true |
b70b13dc2142b72a482c5a5bc80234950c3c5eda | Python | dhatuker/for-pkl | /db/NewsparserDatabaseHandler.py | UTF-8 | 4,854 | 2.546875 | 3 | [] | no_license | import configparser
import logging
import records
class NewsparserDatabaseHandler(object):
_instance = None
_db = None
_host = None
_port = None
_user = None
_pass = None
_dbname = None
logger = None
def getInstance(_host, _port, _user, _pass, _dbname):
return NewsparserDa... | true |
31fdda66962d9e3566ee666667ab724ccef2ef1d | Python | yasinshaw/leetcode | /src/n71.py | UTF-8 | 429 | 2.96875 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=71 lang=python3
#
# [71] 简化路径
#
# @lc code=start
class Solution:
def simplifyPath(self, path: str) -> str:
arr = path.split("/")
stack = []
for s in arr:
if s == "..":
if stack:
stack.pop()
elif s and s !... | true |
d2bdfac1780205874bc6d30cace6983ee9b0f8ad | Python | zakf/cython_talk | /ex3.py | UTF-8 | 2,202 | 3.203125 | 3 | [
"MIT"
] | permissive | # File ex3.py
#
# Author: Zak Fallows (zakf@mit.edu)
# Copyright 2013
# Released for free use under the terms of the MIT License, see license.txt
#
# Demonstrates the speed of Cython.
import time
import ex3_u
import ex3_t
#============================= Interpreted Python =============================#
def inner_i... | true |
016d350e0129d434b188f62701dcb35300f1ca32 | Python | Dan-Teles/URI_JUDGE | /1873 - Pedra-papel-tesoura-lagarto-Spock.py | UTF-8 | 1,494 | 3.0625 | 3 | [] | no_license | n = int(input())
for i in range(n):
a, b = map(str, input().split())
if a == 'papel' and b == 'pedra':
print('rajesh')
elif a == 'pedra' and b == 'papel':
print('sheldon')
elif a == 'tesoura' and b == 'papel':
print('rajesh')
elif a == 'papel' and b == 'tesoura':... | true |
3968326009ad6d6735b646a47428b87628cda79b | Python | trinhgliedt/Algo_Practice | /2021_01_15_HackerRank_Roblox_assessment.py | UTF-8 | 2,388 | 2.984375 | 3 | [] | no_license | from collections import deque
import itertools
import collections
# https://www.hackerrank.com/challenges/climbing-the-leaderboard/problem
def numPlayers(k, scores):
l = len(scores)
if len(scores) > 0:
lowest = scores[0]
else:
lowest = -1
rank = []
numOfPlayers = 0
if len(rank... | true |
ba30e461d4ce515b9dae212c13b32d43816456f6 | Python | alvas-education-foundation/anagha_iyengar | /coding_solutions/23rd may solution.py | UTF-8 | 282 | 3.359375 | 3 | [] | no_license | PROGRAM 1
/* WriteaCProgram toDisplayfirstNTriangularNumbers(WhereNisreadfrom the
Keyboard)*
#include<stdio.h>
voidtriangular_series(intn)
{
for(inti=1;i<=n;i++)
printf("%d",i*(i+1)/2);
}
intmain()
{
intn;
printf("Entervalueforn");
scanf("%d",&n);
triangular_series(n);
return0;
} | true |
a479130b9dec2472bceefe0a114f7d6d5430375e | Python | songzy12/LeetCode | /python/42.trapping-rain-water.py | UTF-8 | 692 | 3.265625 | 3 | [] | no_license | class Solution(object):
def trap(self, height):
"""
:type height: List[int]
:rtype: int
"""
if not height:
return 0
l, r = 0, len(height)-1
ans = lower = 0
level = min(height[l], height[r])
while l < r:
# count from lowe... | true |
0c71b2f7bd7161c0d2748139e99774010b579cea | Python | kruthikakalmali/Solving-Scene-Understanding-for-Autonomous-Navigation-in-Unstructured-Environments-FY-PROJECT-2021 | /UTILITY/domain_adaptation/source/core/bdds.py | UTF-8 | 1,918 | 2.53125 | 3 | [] | no_license | from pathlib import Path
import pandas as pd
import argparse
from tqdm import tqdm
import shutil
import os
#print("here")
parser = argparse.ArgumentParser()
parser.add_argument("datadir",help="path to dataset")
parser.add_argument("savedir",help="path to save directory")
#print(parser.parse_args())
### test ###
#dd = ... | true |
375f977f3f6e6fdf57750b2ea96185024b1dd34c | Python | hanlin16/spider_service | /com/unif/pedily/ObtainPeDailyInfo.py | UTF-8 | 4,581 | 2.546875 | 3 | [] | no_license | # coding:utf-8
import re # 正则表达式
from bs4 import BeautifulSoup
from com.unif.util.LogUtil import LogUtil
logger = LogUtil.get_logger('ObtainPeDailyInfo')
class ObtainPeDailyInfo:
def __init__(self):
logger.info("初始化:ObtainPeDailyInfo")
# 获取标题
def find_title(self, data):
soup = Beautif... | true |
37074f951b5adb2197a4818f0b505336ae465ad5 | Python | rulkens/EosPython | /eos/server/tcp.py | UTF-8 | 1,998 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python
# ===========================================================================
# default TCP socket server for communicating with the EOS from outside
# call this file directly or import main()
# ===========================================================================
import os
import logging
impo... | true |
8b299142e7ead51cfab93f1bd0c76e0bc1852f83 | Python | zzelman/i3-projects | /i3-projects | UTF-8 | 7,888 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
import subprocess
from pprint import pprint
import json
import time
import sys
"""Project Creation and Management for i3-wm.
Terminology
- project :: a collection of workspaces
- workspace :: a collection of applications on a single monitor
- move :: make an application go ... | true |
5c6e350d335669944b4e4bed9f8ec116b5b2d2cd | Python | lguerdan/Al-Gore-Rhythm | /DynamicRogramming/dynamic-stairs.py | UTF-8 | 292 | 3.90625 | 4 | [] | no_license |
memo = [-1] * 50
def num_ways(stairs):
if stairs == 0:
return 0
elif stairs == 1:
return 1
elif stairs == 2:
return 2
if memo[stairs] == -1:
memo[stairs] = num_ways(stairs - 3) + num_ways(stairs - 2) + num_ways(stairs - 1)
return memo[stairs]
print num_ways(10) | true |
4540d0d17a339060d434dd3a014f1007d76375c7 | Python | tribe01/Rosenthal | /plot.py | UTF-8 | 407 | 2.640625 | 3 | [] | no_license | import sys
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
data = np.genfromtxt('output_2D.csv', delimiter=',')
x = data[:,0]
y = data[:,1]
z = data[:,2]
x=np.unique(x)
y=np.unique(y)
X,Y=np.meshgrid(x,y)
Z=z.reshape(len(y),len(x))
HM=plt.pcolormesh(X,Y,Z)
HM.set_clim(vmin=1000, vmax=2000)
plt.tit... | true |
d7a46bfc822ee5a8e5f1665b4d8e22cb04d39e30 | Python | coderZsq/coderZsq.practice.data | /study-notes/py-collection/02_turtle/04_凹.py | UTF-8 | 254 | 2.984375 | 3 | [
"MIT"
] | permissive | import turtle as t
t.forward(50)
t.right(90)
t.forward(50)
t.left(90)
t.forward(50)
t.left(90)
t.forward(50)
t.right(90)
t.forward(50)
t.right(90)
t.forward(100)
t.right(90)
t.forward(150)
t.right(90)
t.forward(100)
t.mainloop() | true |
34a3d063afe840eb6d33429ef0eba3c04fa4338e | Python | lucasw/timer_test | /scripts/timer_test.py | UTF-8 | 1,086 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# Copyright 2020 Lucas Walter
import rospy
from std_msgs.msg import Float32
class TimerTest:
def __init__(self):
self.update_time_pub = rospy.Publisher("update_time", Float32, queue_size=10)
self.update_dt_pub = rospy.Publisher("update_dt", Float32, queue_size=10)
s... | true |
227566fe30675886fe80f48e9820da82e9069220 | Python | BenThienngern/WebbComscience | /problem10.py | UTF-8 | 627 | 3.625 | 4 | [] | no_license | # Euler Project problem 10,
# https://projecteuler.net/problem=10
# Find the sum of all the primes below two million.
# This is the find prime function I create in problem 7
def findPrime(start, end):
start = start + 3
theCount = 0
prime = [2]
for num in range(start, end):
# Can only do up to 1... | true |
acf2b5841b8f9f2f44e5fe39fbf9492834fc3bc7 | Python | audoreven/IntroToPython | /main.py | UTF-8 | 810 | 3.875 | 4 | [] | no_license | # This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name} ') # Press... | true |
18a34fbd839ee51907f6d1176d9db1e77ee545f2 | Python | djgroen/FabCovid19 | /validation/validation_data_parser.py | UTF-8 | 2,479 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | import pandas as pd
import os
def get_region_names():
path = '../config_files'
return os.listdir(path)
def get_validation_names():
path = 'raw_data'
d = os.listdir(path)
d = list(set(['_'.join(x.split('_')[:-1]) for x in d]))
return d
def update_validation_data(regions='all', force=False):
... | true |
e7de244ae9aa5ce7bda7d1f6407bf17c1f4a5967 | Python | jongjunpark/TIL | /Public/problem/D1/2025.N줄덧셈.py | UTF-8 | 98 | 3.359375 | 3 | [] | no_license | inputs = int(input())
result = 0
for i in range(inputs):
result += (inputs - i)
print(result) | true |
1c2b63d68401c9b58439ae9227e43cbfda13922c | Python | davidrhmiller/zakim | /leads/highest_card_lead.py | UTF-8 | 667 | 3.078125 | 3 | [] | no_license | from cards import Card
from leads.lead_rule import LeadRule
class HighestCardLead(LeadRule):
'''West always leads their highest card, suit is tie-breaker.'''
def get_lead(cls, deal):
# This implementation relies on the cards in West's hand being reverse
# sorted by card id.
card_ids = deal.west.card_i... | true |
7ed638ffb63ede1c00efb61f6ba4e6aee73cfc24 | Python | bramgrooten/Hanabi | /unittests/test_hanabi_player.py | UTF-8 | 1,879 | 3 | 3 | [] | no_license | import unittest
from environment import HanabiPlayer, HanabiDeck, HanabiCard
from environment.utils.constants import Rank, Colors
class TestHanabiPlayer(unittest.TestCase):
def setUp(self) -> None:
self.deck = HanabiDeck(ranks=[Rank.ONE])
self.cards = self.deck.provide_hand(hand_size=6)
def... | true |
bcc3cbd889a1ed0d9be21014366362e441e72bdb | Python | voidabhi/flask | /SQLAlchemy/SQLAlchemy-Basic/SQLAlchemy-SQLITE.py | UTF-8 | 1,614 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | from flask import Flask, jsonify, g, request
from sqlite3 import dbapi2 as sqlite3
DATABASE = './db/test.db'
app = Flask(__name__)
def get_db():
db = getattr(g, '_database', None)
if db is None:
db = g._database = sqlite3.connect(DATABASE)
db.row_factory = sqlite3.Row
return db
@app.teardown_appcontext
def clo... | true |
eb47348b0799aa0efbc69c40d90ff35e26c93d21 | Python | acharp/IoT-kafka-spark | /consumer/server.py | UTF-8 | 4,543 | 2.71875 | 3 | [] | no_license | from datetime import datetime
import json
import statistics
from flask import Flask, request, Response
from kafka import KafkaConsumer, TopicPartition
METRICS = ('count', 'min', 'max', 'average')
SENSORS = ('temperature', 'humidity', 'pressure')
TIMESTAMP_FORMAT = '%Y-%m-%d %H:%M:%S'
KAFKA_SOCKET = 'localhost:9092'
... | true |
2c05e6636a7a00b04a370ed216cbf6362089f48e | Python | Rinqt/stock | /machine_learning/regression_algorithms/decision_tree_model.py | UTF-8 | 1,186 | 2.53125 | 3 | [
"MIT"
] | permissive | from sklearn.tree import DecisionTreeRegressor
from regression_algorithms.regression_model import Model
class DecisionTreeModel(Model):
def create_model(self):
self.MODEL = DecisionTreeRegressor(criterion=self.parameters['criterion'],
splitter=self.parameters['s... | true |
f65cdc9bfb0fae0b24bb0b20a1859bb6a152f3e1 | Python | bartoszgorka/studia-wi-put-poznan | /semestr_6_metody_kompresji_danych/Exercise_1/Exercise_1.py | UTF-8 | 7,288 | 3.5625 | 4 | [
"MIT"
] | permissive | import numpy as np
import operator
import random
# Exercise 1 - Generate words and calculate average length.
def exercise_1(size):
alphabet = list("qazxswedcvfrtgbnhyujmkilop ")
total_length = 0
for _ in range(size):
total_length += len(exercise_1_single_word(alphabet))
return tot... | true |
9942ab25c56f208052f64a5d86e1d3d0bbd8f7b0 | Python | patchav0/Search-and-Rescue-Algorithm-Design | /code/examples/harris-corner-detection.py | UTF-8 | 386 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 17 10:56:19 2021
@author: Bryan Van Scoy
"""
import cv2 as cv
import numpy as np
filename = 'chessboard.png'
img = cv.imread(filename)
gray = cv.cvtColor(img,cv.COLOR_BGR2GRAY)
gray = np.float32(gray)
dst = cv.cornerHarris(gray,2,3,0.04)
# threshold
img[dst>0.01*dst.m... | true |
878d25ee5d784bcfc5650a1dce53a62abec1db16 | Python | buuav/precision-landing | /video_streaming_with_flask_example/camera.py | UTF-8 | 2,308 | 2.671875 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
def draw_keypoints(vis, keypoints, color = (0, 255, 255)):
for kp in keypoints:
x, y = kp.pt
d = kp.size
cv2.circle(vis, (int(x), int(y)), int(d), color)
class VideoCamera(object):
def __init__(self):
# Using OpenCV to capture from device 0. If you ... | true |
4dadfad11875564915ec033932a331b280a7ff04 | Python | ko-taro/atcoder | /notebooks/202101/abc174_d.py | UTF-8 | 1,025 | 2.828125 | 3 | [] | no_license | # %%
# WRが無くなるよう操作する
# WRRRRのようにWの右隣にRが連続する場合は、非効率なことがある?
# WRR...Rが非効率な場合はどのような時だろうか?
# WRWWRRWRR
# RRWWRRWRW
#
# WRWWRWRR
# RRWWRWRW
# RRWWRWRW
# WRRRRWWR -> 1
# WWRRRRWWR -> 2
# WWRRRRWWRR
# WWWRR
# WRRRRWWRR
# %%
# N = int(input())
# C = input()
C = 'RWRWRWRR'
ret = 0
if C.count('WR') != 0:
C = C.lstrip('R'... | true |
c2454dd3434dd5e00ed86444406253a3d6e31174 | Python | joshcampbell/tic-tac-toe | /t3/board.py | UTF-8 | 1,434 | 3.40625 | 3 | [] | no_license | import itertools
class Board:
def __init__(self,game):
self.game = game
def get_size(self):
return self.game.state["board"]["size"]
def get_valid_indices(self):
return range(1,self.get_size()+1)
def positions(self):
"""
Enumerate all of the Board's positions as a list of lists
(f... | true |
86a09bd4df60c0de4b875404cc48f1eee8236fe8 | Python | jgomezdans/modis_opendap | /parallel_leech.py | UTF-8 | 11,984 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
"""
SYNOPSIS
DESCRIPTION
A MODIS daily surface reflectance download tool. Uses the
recently made available OpenDAP server to download daily
MODIS reflectance data for a particular location. This
script is designed to only fetch a single pixel, but
annual time series of both TERRA and AQUA data.... | true |
5fe750a66c5bdc3ff41c6664d3b7313dc1424671 | Python | jcockbain/ctci-solutions | /chapter-17/Q10_majority_element.py | UTF-8 | 714 | 3.46875 | 3 | [] | no_license | import unittest
def majority_element(arr):
num_elements = len(arr)
count = 0
element = 0
for i in arr:
if count == 0:
element = i
if i == element:
count += 1
else:
count -= 1
validate_count = 0
for i in arr:
if i == element:... | true |
c35c1b8cf36cb5fce6f5684d8247a862a5ec2070 | Python | phil-shin/Python-Practice-Projects | /SizeFilter.py | UTF-8 | 538 | 3.078125 | 3 | [] | no_license | #! python
# Sizefilter.py
# Filter through folder tree and lists out large files
import os, shutil
# Set working directory
cwd = os.path.join('c:', os.sep, 'Users', 'Phil', 'Documents', 'python')
# Loop to walk through folder tree
for folderName, subfolders, filenames in os.walk(cwd):
#print(folderName)
#pri... | true |
765a883100a39bcf26c16a54c3a27f5eed5ea85a | Python | MPIBGC-TEE/CompartmentalSystems | /prototypes/ABC/ModelRun.py | UTF-8 | 1,531 | 3.21875 | 3 | [
"MIT"
] | permissive | import unittest
from numpy import NaN
from abc import ABCMeta, abstractmethod
class ModelRun(metaclass=ABCMeta):
# abstractmehtods HAVE to be overloaded in the subclasses
# the decorator should only be used inside a class definition
@abstractmethod
def solve(self):
return NaN
# n... | true |
199eeab6d51316b3766c2b1acad9dfed1afcc5d9 | Python | tonydavidx/Python-Crash-Course | /Chapter10/10_9_Silent_cats_and_dogs.py | UTF-8 | 386 | 3.28125 | 3 | [] | no_license | def read_files(filenames):
""" read files and give errors if found any """
try:
with open(filenames) as text_object:
contents = text_object.read()
print(contents)
except FileNotFoundError:
# print(f"the file {filenames} does not exist")
pass
names = ['cats.tx... | true |
97ce30bdf496f17c4d9f98d2faed9d9123bc33e4 | Python | andres0191/AirBnB_clone_v2 | /models/place.py | UTF-8 | 2,243 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python3
"""This is the place class"""
import models
from models.review import Review
from models.base_model import BaseModel, Base
from sqlalchemy import Column, Integer, Float, String, ForeignKey
from sqlalchemy.orm import relationship
from os import getenv
class Place(BaseModel, Base):
"""This is the... | true |
ad8ceae9d608912ca4a10debd99bf6b306022314 | Python | HassanSherwani/Model_Deployment | /Books_rest_api/app.py | UTF-8 | 1,193 | 2.9375 | 3 | [] | no_license | from flask import Flask,jsonify,make_response,abort
import json
from flask_restful import Api, Resource
# init app
app = Flask(__name__)
# create small datasets
books = [{"id": 1,"title":"whatever1",},{"id":2,"tietle":"whatever2",}]
# Using External Local Data
with open("books.json") as f:
books_json = json.load(f)... | true |
aaf417461414daab4c277f0ffa69106ba8a435d7 | Python | Madrich-routes/routes_laboratory | /solvers/madrich/api_module/osrm_module.py | UTF-8 | 3,732 | 2.625 | 3 | [] | no_license | from itertools import chain
from typing import List, Union, Tuple
from urllib.parse import quote
import numpy as np
import requests
import ujson
from polyline import encode as polyline_encode
from solvers.madrich.utils import to_array
array = np.ndarray
Point = Tuple[float, float]
osrm_host = 'http://dimitrius.keen... | true |
133079b200289bcdde0fe01a1fd874e81c10d7f2 | Python | francoislievens/ELEN0062-ML-Pass-Predictor | /Main_forest.py | UTF-8 | 1,284 | 2.578125 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from Dataset import Dataset
from Forest import Forest
import pickle
if __name__ == '__main__':
# Create the dataset structure:
dataset = Dataset()
# Import original training set
#dataset.import_original_traini... | true |
976f3bd8827029ca02273c1914ef58516af150fd | Python | hansimglueck/homeVisit | /hardware/ws.py | UTF-8 | 1,633 | 2.796875 | 3 | [] | no_license | import websocket
import thread
import time
import json
class Client(object):
def __init__(self, role, cb, name=None):
print "Client:init"
self.connected = False
self.cb = cb
self.role = role
if name is None:
self.name = "NN"
else:
self.name = name
websocket.enableTrace(True)
self.open_websocket... | true |
81e96814a2b8806097e15e64431fec66f3f7ee94 | Python | xtymichael/Leetcode_python | /Solutions/048_Rotate_Image.py | UTF-8 | 380 | 3.296875 | 3 | [] | no_license | class Solution:
# @param {integer[][]} matrix
# @return {void} Do not return anything, modify matrix in-place instead.
def rotate(self, matrix):
dim = len(matrix)
copy = [x[:] for x in matrix] ### copy = matrix is wrong since they point to the same thing
for i in range(dim):
... | true |
62f7a8213b8a229979a0fbe2db9cecdb4d236f07 | Python | iBurnApp/iBurn-Data | /scripts/archive/2013/scraper.py | UTF-8 | 5,247 | 2.921875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# Scrapes data from the burningman website, and serializes it into json
import lxml.html
import lxml.html.soupparser
import urllib
import sys
import re
import urllib2
import json
import re
def _clean_string(str):
if str:
str = re.sub(r'^[\n\t\s]+', '', str)
str = re.sub(r'[\n\t\... | true |
df1cd93749c93540e57b857440ad93ea2a028d71 | Python | l3shen/PredictingMolecularPropertiesCHAMPS | /visualization.py | UTF-8 | 1,444 | 2.96875 | 3 | [] | no_license | import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import matplotlib.pyplot as plt
train = pd.read_csv("C:\\Users\\lawre\\Downloads\\train.csv (1)\\train.csv")
structures = pd.read_csv("C:\\Users\\lawre\\Downloads\\train.csv (1)\\structures.csv")
structures.head... | true |
d023edde504e76cf9a059b194cf15c4e7458cec7 | Python | tonyallard/CEIScripts | /problem-analysis/ExtractEHCHistogram.py | UTF-8 | 1,592 | 3.109375 | 3 | [] | no_license | #! /usr/bin/python
#Author: Tony Allard
#Date: 30 March 2016
#Description: A Python script for extracting the EHC Guidance Histogram from log files.
#Extracts data to CSV file, including averages.
#NOTE: It omits problems with no solution from CSV file.
import sys
import os
import re
import collections
EHC_DELIM = "#... | true |
d0a8633e13db5b0a8baaa03a3178d7c26d7ac71d | Python | hujianli94/Python-code | /2.程序流程语句/循环语句/while循环/test.py | UTF-8 | 375 | 4.4375 | 4 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf8 -*-
num = 100
count = 0
print("今有一个数,在100以内,三三数之剩余2,五五数之剩余4,七七数之剩余3,请问这个数是什么?")
while count <= num:
if count %3==2 and count %5 ==4 and count%7 ==3:
print("这个数是:"+ str(count))
count +=1
print("循环结束!!".center(100, "-")) | true |
fa0f7ff57a25816f8641233216e9e5da5956f177 | Python | BearHeathen/MadRamblings | /static_class_methods.py | UTF-8 | 136 | 3.1875 | 3 | [
"MIT"
] | permissive | # Static and Class methods
class Person(object):
population = 50
def __init__(self, name, age):
self.name = name
self.age = age
| true |
a5eff38156577a1abc13f82974a2bf008b31247e | Python | andres-fm/ProblemSolving | /lcm_division_algorithm.py | UTF-8 | 893 | 4.0625 | 4 | [] | no_license | # computes the greates common divisor from two numbers
def gcd(a, b) :
dividend = max(a,b)
divisor = min(a,b)
r = -1
while r != 0 :
r = divmod(dividend, divisor)[1]
dividend = divisor
divisor = r
return dividend
# computes the least common multiple from two numbers given the fact that gcd(a,b)*lcm(a,b) = a*... | true |
73e9bc4b501cf83d2cfee58c7a7a5db6826cbc15 | Python | bipinmsit/mycode | /scripts/python/bin/angle_from_coordinates.py | UTF-8 | 2,119 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
import pandas as pd
import os.path as path
import sys
import raster_processing.raster_translate as rt
import numpy as np
from numpy.linalg import norm
from subprocess import call
def help():
print("Usage:- angle_from_coordinates.py <input-csv> <row-id-1> <row-id-2> \n")
def main(argv=None):... | true |
eac335c569b6873c24514fc1451218fb21761eaa | Python | bslate/tess | /tess.py | UTF-8 | 11,109 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""Converts 2D polygon point geometry into triangles.
Usage:
tess.py [input] [output]
The input file should be formatted like this:
10.34 10.234
10 50
60 50
60 10
20 30
25 40
30 30
40 30
45 20
50 30
Each line represents X and Y data for a point. Empty lines signify a
new path. Therefore t... | true |
09d90c03fecad72156716d87765a80ca9b30652b | Python | perolz/TIF155 | /Problem set 2/Hopf Bifurcation.py | UTF-8 | 1,858 | 2.734375 | 3 | [] | no_license | import sympy as sy
import scipy
from scipy.integrate import odeint
import numpy as np
import matplotlib.pyplot as plt
# def model1(X,t):
# dxdt=-X[0]**3+4*X[0]-3*X[1]
# dydt=3*X[0]+2*X[1]**3+4*X[1]
# return [dxdt,dydt]
#
# ts = np.linspace(0, 12, 100)
# P0 = [1, 1]
# Ps = odeint(model1, P0, ts)
# plt.plot(... | true |
9c77804fd3508b2e5d4b9eb2c3446a7eb8707671 | Python | littlesearch/python-study | /05_functional_programming/05_partial_function.py | UTF-8 | 673 | 4.125 | 4 | [] | no_license | #coding=utf-8
import functools
# 偏函数
# 假设要转换大量的二进制字符串,每次都传入int(x, base=2)非常麻烦,于是,我们想到,可以定义一个int2()的函数,默认把base=2传进去:
def int2(x, base=2):
return int(x, base)
# functools.partial就是帮助我们创建一个偏函数的,不需要我们自己定义int2(),可以直接使用下面的代码创建一个新的函数int2:
int3 = functools.partial(int,base=2)
print int3("1111")
# functools.partial的作... | true |
c9a0c57a60b905ce42f4434aa25488193bc0e1e4 | Python | kingno21/auto_compile | /compile.py | UTF-8 | 1,395 | 2.625 | 3 | [] | no_license | #!/usr/bin/python
import os, glob, sys
import subprocess
import re
import read_json as rj
def find_class_name(contents):
pattern = "(?<=class )\w+"
for index, line in enumerate(contents):
if "class" in line:
contents[index] = line.replace('public', '')
return re.search(pattern,... | true |
c59704fd17a63135d3e1d34f60c69cbf9a8b70ff | Python | pkhadka56/ip2host | /domain2servername.py | UTF-8 | 320 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import socket
host = {
'servername1': ('127.0.0.1','127.0.0.2'),
'servername2': ('127.0.0.3')
}
ipaddr = socket.gethostbyname(sys.argv[1])
for server,ip in host.iteritems():
if ipaddr in ip:
print sys.argv[1],"got ip address",ipaddr,".It is in",server,"server."
| true |
66ed173072c0dfe4a693a9b4aa9d0ec0b28e0176 | Python | Hank-Liao-Yu-Chih/document | /OpenCV讀者資源/讀者資源/程式實例/ch4/ch4_10.py | UTF-8 | 368 | 3.1875 | 3 | [] | no_license | # ch4_10.py
import cv2
image = cv2.imread('street.jpg')
blue, green, red = cv2.split(image)
bgr_image = cv2.merge([blue, green, red]) # 依據 B G R 順序合併
cv2.imshow("B -> G -> R ", bgr_image)
rgb_image = cv2.merge([red, green, blue]) # 依據 R G B 順序合併
cv2.imshow("R -> G -> B ", rgb_image)
cv2.waitKey(0)
cv2.destroy... | true |
141b5ce383d1c313bf1068a32cf822850ef97f24 | Python | LeonLH/Study-note | /learn_python_the_hard_way/mystuff/test.py | UTF-8 | 1,614 | 3.5625 | 4 | [] | no_license | # from math import pi
# Flo = pi
# print "%03g %.9f %G %E" % (Flo, Flo, Flo, Flo)
# R = round(4.33333)
# print "R = %r" % R
# print "%r" % pi
##################################################
# #!/usr/bin/python
#
# # Open a file
# fo = open("foo.txt", "ra+")
# print "Name of the file: ", fo.name
#
# # Assuming fil... | true |
f555a04111b913245a610fa3731b6297cbc7b97c | Python | pm0n3s/Python | /python1/python/dictionaries.py | UTF-8 | 1,000 | 4.59375 | 5 | [] | no_license | '''Create a dictionary containing some information about yourself.
The keys should include name, age, country of birth, favorite language.'''
me = {
"name": "Patrick",
"age": 26,
"country": "USA",
"favorite language": "Python"
}
'''Write a function that will print something like the following as it e... | true |
72c0dd4e317826af46a3ae2199198709695e9f81 | Python | yuweiDu/divide_NinaPro_database_5 | /ninaweb_sEMG_envelop_divide_by_subject.py | UTF-8 | 3,712 | 2.515625 | 3 | [] | no_license | # coding: utf-8
from __future__ import division, print_function
import numpy as np
import os
import pdb
import matplotlib.pyplot as plt
import get_max_min
import utilities
import get_envelop
PLOT_ENVELOP = False
def str_in_str(list_of_str, str):
results = []
for s in list_of_str:
results.append(s in s... | true |
fdf29076fe9195b3b0c5614ed6fcd9b5b22bd0e8 | Python | SachinPitale/Python | /ex5.py | UTF-8 | 417 | 3.5625 | 4 | [] | no_license |
my_name = "Sachin Pitale"
my_age = "27" #Not a lie
my_hight = 165
my_weight = 75
my_eys = "blue"
my_teeth = "white"
my_hair = "brwon"
print "Let's talk about %s." %my_name
print "He's %d inches tall." %my_weight
print "He's %d punds heavy." %my_hight
print "That is not a too actully heavy"
print "He 's got %s eyes ... | true |
02df0626d5f794cb48f0332e790acf32db795f5f | Python | jkeung/Hackerrank_Problems | /algorithms/warmup/simple_array_sum.py | UTF-8 | 158 | 2.890625 | 3 | [] | no_license | #!/bin/python
import sys
n = int(raw_input())
arr = map(int,raw_input().strip().split(' '))
summation = reduce(lambda x,y: x + y, arr, 0)
print summation
| true |
4072292eaf248a68e578223878bf976481f49f6c | Python | jonathanmann/leetcode | /python2/plusOne.py | UTF-8 | 544 | 3.203125 | 3 | [] | no_license | class Solution:
def plusOne(self,digits):
if digits == [9]: return [1,0]
if digits[-1] != 9:
digits[-1] += 1
return digits
digits.reverse()
digits[0] = 0
for i,digit in enumerate(digits[1:]):
print i, digit
if digit + 1 < 10:
digits[i+1] = digit + 1
digits.reverse()
return digits
... | true |
6cf833d3444256c994707e3a72cffcb46dd9ddd5 | Python | ilkerc/ObjDetector | /helpers/DiscOP.py | UTF-8 | 3,458 | 2.8125 | 3 | [] | no_license | import theano
import theano.tensor as T
import numpy as np
class DiscOP(theano.Op):
"""
This creates an Op that takes x to a*x+b.
"""
__props__ = ("mins", "maxs", "ranges")
itypes = [theano.tensor.fmatrix]
otypes = [theano.tensor.fmatrix]
def __init__(self, mins, maxs, ranges):
s... | true |
e29ac7c302cef8aa8ffb8f8b72f57425fdc36629 | Python | Satwik95/Coding-101 | /Competative Concepts/DP/ladder.py | UTF-8 | 231 | 2.921875 | 3 | [] | no_license | def ladder(n):
if n==0:
return 1
elif dp[n]!=0:
return dp[n]
else:
for i in [1,2,3]:
if n-i>=0:
dp[n] += ladder(n-i)
return dp[n]
n=4
dp = [0]*(n+1)
ladder(n)
| true |
1247ca91aafe749dc4e3db6372f8329c77f99f4c | Python | Gry1005/PytorchLearning1 | /src/CnnCuda.py | UTF-8 | 3,535 | 2.96875 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.utils.data as Data
import torchvision
import matplotlib.pyplot as plt
EPOCH = 1 #数据集训练几遍
BATCH_SIZE = 50 #一批数据的个数
LR = 0.001
DOWNLOAD_MNIST = False
#加载数据集
train_data = torchvision.datasets.MNIST(
root='./mnist',
train=True,... | true |
5195b2f0239997a23bfb3c414c94de424e153723 | Python | atlasmao/Python-book-code | /book_14_Python_cook_book/chapter_05_文件与IO/code_08_创建临时文件和文件夹.py | UTF-8 | 559 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from tempfile import TemporaryFile
with TemporaryFile('w+') as f:
# Read/write to the file
f.write('Hello World\n')
f.write('Testing\n')
# Seek back to beginning and read the data
f.seek(0)
data = f.read()
print(data)
from tempfile import Tem... | true |
de7cb19955e00895cf2551a3f85abca7550aa202 | Python | CaptainJackZhang/LeetCode-easy | /LeetCode-easy-Python/fizzBuzz.py | UTF-8 | 656 | 3.4375 | 3 | [] | no_license | #!usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author: CaptainJack
@datetime: 2018/9/27 13:05
@E-mail: zhangxianlei117@gmail.com
"""
class Solution(object):
def fizzBuzz(self, n):
"""
:type n: int
:rtype: List[str]
"""
lis = []
i=1
while(i<=n):
... | true |
10478fb0034a6e8e1d1c5b0b591f5be4d76fd022 | Python | damax1995/Python101 | /conditionals.py | UTF-8 | 750 | 4.5 | 4 | [] | no_license | if 2 > 1:
print("This is a True statement\n")
var1 = 1
var2 = 3
if var1 > var2:
print("That is also True\n");
else:
print("That was False!\n")
value = input("How old are you?: ")
value = int(value)
if value < 10:
print("You are under 10\n")
elif 10 <= value <= 30:
print("You a... | true |
e8d25daf28c5daf0cf056f0d174d4ef5a8570ef2 | Python | PerceptumNL/KhanLatest | /gae_mini_profiler/unformatter/__init__.py | UTF-8 | 5,018 | 3.453125 | 3 | [] | no_license | import sys
class UnformatStream(object):
"Outputs tokens to a text stream"
def __init__(self, out=sys.stdout, indent=u' '):
self.out = out
self.indent = indent
def emit_token(self, token, level=0):
try:
t = unicode(token)
except UnicodeDecodeError:
... | true |
89ae37fc0c6b7856d81709a413da2f9186c780f8 | Python | CreativePenguin/stuy-cs | /intro-comp-sci2/python/Classwork(5-15-2018).py | UTF-8 | 465 | 3.28125 | 3 | [
"MIT"
] | permissive | def makeDictFromCSV(s):
li = s.split('\n')
fin = []
val = {}
for i in li:
fin += [i.split(',')]
for a in fin:
val[a[0]] = a[1]
return val
def tally(l):
val = {}
for i in l:
if i in val:
val[i] += 1
else:
val[i] = 1
return val
'''
print makeDictFromCSV("""a,3
b,4
c,6
d,10
f,9
a,99
b,0""")
'''
p... | true |
b59c7cf6c09761c1fd673056ad18bd28fa76577b | Python | Caiel3/PIM | /pim/material/helpers/TxtControlador.py | UTF-8 | 1,020 | 2.734375 | 3 | [] | no_license | from django.conf import settings
import os.path as path
class Txt():
def __str__(self):
return
def __unicode__(self):
return
def __init__(self,hash,texto,fecha_ini,fecha_fin):
self.hash=hash
self.fecha_ini=fecha_ini.strftime('%d/%m/%Y %H:%M.%S')
... | true |
c89b6fd8f32392b9bc9be87b16bd3c5ac741577b | Python | ynigoreyes/SudokuSolver | /src/io.py | UTF-8 | 738 | 3.421875 | 3 | [] | no_license | from os import path, listdir, mkdir
"""
Writes and Reads the Sudoku Board
"""
# Does this make a working directory no matter where it is?
DATA_DIR = "../data/"
def ensure_data_dir():
# Checks to see if there is a directory made
data_dir = path.normpath(DATA_DIR)
if not path.isdir(data_dir):
mkdir(data_dir)
... | true |
3f4b3a37c6240e05fa8249ec716035c11e3170c1 | Python | zzygyx9119/Whole_pipelines | /aft_pipelines_analysis/visualize_mut_heatmap.py | UTF-8 | 3,293 | 2.640625 | 3 | [] | no_license | import plotly
import plotly.graph_objs as go
import plotly.figure_factory as ff
import pandas as pd
import numpy as np
from scipy.spatial.distance import pdist, squareform
# get data
proteins_df = pd.read_csv('/home/liaoth/project/brca_171208/output/mut_counts.csv',index_col=0)
# data_array = data.values
# labels = p... | true |
d3506c5edaa24430233bfc16021b2dcb300e44ea | Python | UtopiaBeam/2110101-ComProg | /06/06_V.py | UTF-8 | 1,060 | 3.265625 | 3 | [] | no_license | # 06_V1
print(['x', 'k', 'tu', 'c', 'h'][int(input())-1])
# 06_V2 (Adv: zip + next())
ans = []
for ls in [l.strip().split(';') for l in open(input().strip())] :
grd = next(gr for gr, sc in zip('ABCDF', [80, 70, 60, 50, 0]) if sum(map(float, ls[3:])) >= sc)
ans.append([ls[0], '{} {}'.format(*ls[1:3]), grd])
pri... | true |
89afe282152d9e778cf2f9ec8edd4a5e195ad16c | Python | lllyee/AirlineCompany | /data_explore.py | UTF-8 | 398 | 2.75 | 3 | [] | no_license | import pandas as pd
datafile='/Users/yiliu/lllyeeData/air_data.csv'
resultfile='/Users/yiliu/lllyeeData/explore.xls'
data=pd.read_csv(datafile,encoding='utf-8')
explore = data.describe(percentiles = [], include = 'all').T
explore['null'] = len(data)-explore['count']
explore = explore[['null', 'max', 'min']]
explore.col... | true |
74097dfedacc303d9f7924fa7ce2b1a409fdadab | Python | Stanford-PERTS/triton | /app/model/cycle.py | UTF-8 | 9,198 | 2.828125 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | """
Cycle
===========
Cycles of users running a single survey together with their students.
# Note on dates
Cycles have user-set start and end dates to help them schedule their
activities. These are always the dates use for display.
The extended end date is derived from the whole set of a team's cycles in order
to ... | true |
40d977b1fef3b49e7f9abd6ec3c794387984547c | Python | cgtyyldrm/PythonKamp | /workshop4.py | UTF-8 | 368 | 4.0625 | 4 | [] | no_license | #kullanıcı 3 sayı girsin bunlardan en büyüğünü versin
sayi1 = int(input ("sayi 1:"))
sayi2 = int(input ("sayi 2:"))
sayi3 = int(input ("sayi 3:"))
if sayi1>sayi2 and sayi1>sayi3:
print ("en büyük sayi1")
elif sayi2>sayi1 and sayi2>sayi3:
print ("en büyük sayi2")
elif sayi3>sayi1 and sayi3>sayi2:
print ("en... | true |
4656e510e9945d8f137895283cae4cc517a3d38d | Python | mcuntz/jams_python | /jams/argsort.py | UTF-8 | 10,995 | 3.5 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
argsort : argmax, argmin and argsort for array_like and Python iterables.
This module was written by Matthias Cuntz while at Department of
Computational Hydrosystems, Helmholtz Centre for Environmental
Research - UFZ, Leipzig, Germany, and continued while at Institut
National de Recherche pou... | true |
c8f0868e20746c3a45303cf35cb82c295cd15ea6 | Python | suscaria/python3 | /leetcode/5_implement_strstr.py | UTF-8 | 2,719 | 4.4375 | 4 | [] | no_license | # Question:
# Implement strstr(). Returns the index of the first occurrence of needle in haystack, or –1
# if needle is not part of haystack.
# O(nm) runtime, O(1) space – Brute force:
# There are known efficient algorithms such as Rabin-Karp algorithm, KMP algorithm, or
# the Boyer-Moore algorithm. Since these algorit... | true |
116f39477f16be3e25ee0c498ac43c85384cc7c5 | Python | hamma95/patrol_robot | /src/shapes2.py | UTF-8 | 1,368 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function
import rospy
from smach import State,StateMachine
from time import sleep
class Drive(State):
"""docstring for Drive"""
def __init__(self, distance):
State.__init__(self,outcomes=['success'])
self.distance = distance
def execute(self,userdata):
pr... | true |
9673b2e6bc11427ae433abc018bb16b5085c3f21 | Python | meiordac/Interview | /Code Fights!/distancesum.py | UTF-8 | 186 | 3.265625 | 3 | [] | no_license | def distancesum(n, xcor):
dist=0
for i in range(n):
for j in range(i+1,n):
dist+=((xcor[i]-xcor[j])**2)**0.5
print dist
return dist
print(distancesum(3,[-3,4,-3])) | true |
19682a07f6b970b9aece2ea595a0633590a3e6ee | Python | 2020-A-Python-GR1/py-reina-gamboa-miguel-esteban | /03 - Pandas/d_lectura_csv.py | UTF-8 | 839 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jul 25 10:18:45 2020
@author: migue
"""
import pandas as pd
import os
path = "C:/Users/migue/OneDrive/Documentos/EPN/Sexto Semestre/Desarrollo web con python/Github/py-reina-gamboa-miguel-esteban/04 - Pandas/data/artwork_data.csv"
df1 = pd.read_csv(
path,
nrows = 1... | true |
faa04072f43a64fd93e1e977b809553343115938 | Python | AbstractThinks/python-tutorial | /selenium/demo/demo.py | UTF-8 | 223 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from selenium import webdriver
import time
browser = webdriver.Firefox()
# browser.get("http://www.baidu.com")
time.sleep(5)
print("Browser will be closed")
browser.quit()
print("Browser is close") | true |
9d298f6c20f5c834f12e3511dc05a38d564262d4 | Python | mafei0728/python | /12.内置函数/18_filter_map_reduce.py | UTF-8 | 1,176 | 4.28125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf8 -*-
# author:mafei0728
"""
map(func, *iterables) --> map object
Make an iterator that computes the function using arguments from
each of the iterables. Stops when the shortest iterable is exhausted.
"""
### map
a=[1,2,3,4,5,6]
c=map(lambda x:x**2,a)
print(list(c))
"""
reduc... | true |