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 |
|---|---|---|---|---|---|---|---|---|---|---|
c8211ef6d4eebddfb63184bb928825affafdeaf2 | bbrooks870/GoogleColab-KeepAlive | /random_qoute.py | UTF-8 | 262 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | import requests
import json
import random
def random_qoute()-> str:
'''gets a random qoute'''
random_num = random.randint(0,30)
res = requests.get('https://type.fit/api/quotes')
res = json.loads(res.text)
return res[random_num]['text']
| true |
e9367dc50fe4907807130908e45f4d839d79fb37 | SunbyMoon/bioinfo | /CSCIE-58/src/code_pack2/palindrome.py | UTF-8 | 2,317 | 3.8125 | 4 | [] | no_license | # Ashkan Bigdeli
# Assignment 3
# findPalindrome.py
#
#
#
import string
import sys
import cs58FileUtil
# I found this method of creating a complimentary strand
# in a biopython thread. Uses A dictionary to find and
# replace values in sequence. I tried if, elses and replace
# for replacement and even foun... | true |
b5b08c5391c8ec3a34dd0cb37bb4dfe6817ab8a8 | webbcam/tiflash | /tests/core/test_api_memory.py | UTF-8 | 2,981 | 2.78125 | 3 | [
"MIT"
] | permissive | import pytest
import tiflash
class TestMemoryApi():
def test_basic_memory_read_single_byte(self, tdev):
"""Tests simple memory read"""
result = tiflash.memory_read(tdev['read-address'], 1,
serno=tdev['serno'],
connection=tdev['connection'],
... | true |
cc6dc817e9e5d7fcdd3674a707f6ad4b471b4730 | HamDatNoob/pblevelnamer9001 | /functions.py | UTF-8 | 4,187 | 2.703125 | 3 | [] | no_license | from typing import *
import json
import csv
import re
import difflib
from collections import Counter
import math
from fuzzywuzzy import fuzz, process
class ShortName:
def __init__(self, short_name: str):
self.world = 0
self.level = 0
self.is_challenge_level = False
self.valid = Fals... | true |
f744ea58b4341f02b423ae564d22fe66d11393a9 | douqianqing/muqing | /第1章/listing_1-1.py | UTF-8 | 128 | 2.671875 | 3 | [] | no_license | print "pizza " * 20
print "yum " * 40
print "I'm full."
+
+
+ #这里主要就使用了一个print函数来显示字符串内容 | true |
55b5bf512aef858e69d118fab0a5fb4f883aa5b8 | edward035358370/Leetcode | /leetcode/Maximum Subarray/version1.py | UTF-8 | 1,065 | 2.859375 | 3 | [] | no_license | class Solution(object):
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
def puls(cut,nums):
if nums == []:
return []
elif len(nums) == 1:
return nums
a = nums[:cut]
... | true |
4b64d460793d2431b90d17f3d61d07915264de2d | martinvidal/T01 | /T01/main.py | UTF-8 | 1,776 | 2.96875 | 3 | [] | no_license |
from My_library import queries, menu_functions
import os.path
data_size = "small"
path = "data/{}/".format(data_size)
file = queries.load_database(path, "Flights")
file2 = queries.load_database(path, "Airports")
file3 = queries.load_database(path, "Travels")
file4 = queries.load_database(path, "Passengers")
print(que... | true |
365364cdaa25e97db06ee1cd0c375aad898fff34 | Esther-Yin-cloud/CS-CN | /blackjack/submission.py | UTF-8 | 14,520 | 3.6875 | 4 | [] | no_license | import util, math, random
from collections import defaultdict
from util import ValueIteration
############################################################
# Problem 2a
# If you decide 2a is true, prove it in blackjack.pdf and put "return None" for
# the code blocks below. If you decide that 2a is false, construct a ... | true |
6b9d8ee605d5251c4e540869dfad9e1c86cf7f59 | Shunderpooch/AdventOfCode2016 | /Day 5/how_about_a_nice_game_of_chess_2.py | UTF-8 | 895 | 3.140625 | 3 | [
"MIT"
] | permissive | """
Arthur Dooner
Advent of Code Day 5
Challenge 2
"""
import sys
import hashlib
def md5_func(string):
md5result = hashlib.md5()
md5result.update(string.encode('utf-8'))
return md5result.hexdigest()
INTEGER_ID = 0
PASSWORD = ""
DICT_OF_SOLUTIONS = {}
if len(sys.argv) < 2:
print("Please pass the puzz... | true |
49e68e6b37d62b62d259203d98d70044dd7dd0a1 | testgurus/python | /learnpythoncode/Factors.py | UTF-8 | 216 | 4.28125 | 4 | [] | no_license | def print_factors(x):
for i in range(1, x + 1):
if x % i == 0:
print(i);
# Input from the user
num = int(input("Enter a number: "))
print("Factors of given number are: ")
print_factors(num) | true |
33f018bf26f47c4d12ed5d7d1591e03ccef66892 | PhotoIImprov/genesis | /dbsetup.py | UTF-8 | 10,223 | 2.515625 | 3 | [] | no_license | """This contains miscellaneous setup, particularly related to the database"""
import os
from enum import Enum
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import exc
from sqlalchemy import event
from sqlalc... | true |
b968c9f27c4baeeb0e7ad81a9508726c495fb338 | amitmaurya7374/python-stock-trade-news-app | /main.py | UTF-8 | 2,140 | 2.546875 | 3 | [] | no_license | import requests
from twilio.rest import Client
from api_keys import ApiKeys
STOCK_NAME = "TSLA"
COMPANY_NAME = "Tesla Inc"
STOCK_ENDPOINT = "https://www.alphavantage.co/query"
NEWS_ENDPOINT = "https://newsapi.org/v2/everything"
keys = ApiKeys()
## STEP 1: Use https://www.alphavantage.co/documentation/#daily
# When... | true |
640a8a8a7c820ca1ee8bd50430b1102fdd8493dd | RownH/MyPy | /py_fluent/leetCode/268.py | UTF-8 | 673 | 3.46875 | 3 | [] | no_license | '''
268. 缺失数字
New
给定一个包含 0, 1, 2, ..., n 中 n 个数的序列,找出 0 .. n 中没有出现在序列中的那个数。
示例 1:
输入: [3,0,1]
输出: 2
示例 2:
输入: [9,6,4,2,3,5,7,0,1]
输出: 8
说明:
你的算法应具有线性时间复杂度。你能否仅使用额外常数空间来实现?
'''
class Solution(object):
def missingNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
... | true |
7ab8ea5af859e580fc65ee0530a883e3e1b45056 | shreshta2000/If-else_questions_ | /if_else/salary_boncs.py | UTF-8 | 180 | 2.984375 | 3 | [] | no_license | salary=int(input("entre your salary"))
year_of_service=int(input("entre your work exprince"))
if year_of_service>=5:
print("your boncs is",salary+salary*0.05)
else:
print(salary) | true |
a0a2b5da7903286651280fa5987a0780b6b05dea | patrickjwolf/web-app-twitoff | /app.py | UTF-8 | 378 | 2.96875 | 3 | [] | no_license | from flask import Flask
app = Flask(__name__)
@app.route("/")
def index():
x = 2 + 2
return "Hello World! {x}"
@app.route("/about")
def hello():
return "About me"
@app.route("/books")
def list_books():
books = [
{"id": 1, "title": "Book 1"},
{"id": 2, "title": "Book 2"},
{"i... | true |
49547af8d6902ed7d501d164f03b9d20000f544f | yoonddang/python_multi_processing | /classifyUser.py | UTF-8 | 3,426 | 2.671875 | 3 | [] | no_license | import csv
import errno
import os
import multiprocessing as mp
from functools import partial
def regex_check_file_name(file_name):
return str(file_name)
def get_data_list_for_csv(file_name):
csv_file = open(file_name, encoding='utf-8')
file_reader = csv.reader(csv_file, delimiter='\t')
data_list = l... | true |
1569718f0d869fcd679948b35f6c115f6fdb62b6 | lgaylord18/6.834_cognitive_robotics | /pso_lqr_rrt*/trajectory_pso_test_dubins.py | UTF-8 | 722 | 2.53125 | 3 | [] | no_license | import matplotlib
import matplotlib.pyplot as plt
from trajectory_pso import Trajectory_PSO
from dubins import *
pso = Trajectory_PSO(num_coordinates, num_waypoints, num_trajectories, traj_cost_fn, start, end)
cost, traj = pso.run(100)
# plot
fig = plt.figure()
ax = fig.gca()
# trajectory
x = [p[0] for p in traj]
y ... | true |
a74364304be69068e9bd55470963bb546c0cb0e7 | GunesOzgur/Tetris_with_Python | /TetrisMain.py | UTF-8 | 7,483 | 3.5625 | 4 | [] | no_license | '''
TetrisMain.py
This module contains the class "TetrisApp"
TetrisApp is a subclass of tkinter.Tk()
TetrisApp is the main module that controls the
running of the these modules:
- Board
- Tetromino
- ScoreTable
- GameOver
- MainMenu
last modified: August 19, 2021
by: Freeman Sun... | true |
a196b986671686704928a644b6e735fe382b4aa2 | JuanC-Fandino/Flask-IoT-Dashboard | /test2.py | UTF-8 | 934 | 3.75 | 4 | [] | no_license | import json
import base64
#decoding and encoding data is possible via base64 library so we are going to use this method to update values
def convert(data):
return json.dumps(data)
def deconvert(data):
return json.loads(data)
mydict = {"name": "Aman Singh", "Age":18}
# mydict = ["Aman", "singh", 18]
def base_... | true |
2e2732331edf62ee2b58b0963a8ebc6bb13abf01 | algobroker2020/FiatBroker2020 | /traderoom.py | UTF-8 | 3,360 | 2.59375 | 3 | [] | no_license | # @Author: Benjamin Gates
# @Creation: @date
# @Description: This file is the mainwindow of the application
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QPushButton, QLabel, QVBoxLayout, QToolButton, \
QToolBar, QTabWidget, QLineEdit
from assetdialog ... | true |
facf62cf807d2614830f47c9c2b700566256ba59 | mrozowski/TaskTimer | /presenter.py | UTF-8 | 3,398 | 2.796875 | 3 | [
"MIT"
] | permissive | import sys
import threading
import time
from datetime import datetime, timedelta
from PyQt5 import QtWidgets, QtCore, QtGui
import view
import timer
class Presenter:
def __init__(self, view_: view.View):
self.view = view_
self.update_time = None
self.timer = 0
sel... | true |
e53f36e1749015627ad3d2f34c8f03b1b0eb1e4c | kelvinsusanto94/Kattis | /Python/Last Factorial Digit.py | UTF-8 | 314 | 3.265625 | 3 | [] | no_license | # .-"-.
# /|6 6|\
# {/(_0_)\}
# _/ ^ \_
# (/ /^\ \)-'
# ""' '"" 하늘
# written by
# @author Wolverine 왕경민
# File Name : Last Factorial Digit
# Date Created : 14/12/2019
import math
T = int(input())
for i in range (T):
N = int(input())
fac = math.factorial(N)
print (fac % 10) | true |
6c887d9ef858842a88fc4ffdeaaceb204e330978 | RevanthR/AI_Assignments | /Assignment3.py | UTF-8 | 647 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 1 12:59:59 2019
@author: dpraveen
"""
import numpy as np
x=np.array([1,2,3,4])
y=np.array([5.5,6.5,7.5,8.5])
z=np.add(x,y)
print(z)
v=np.subtract(x,y)
print(v)
d=np.multiply(x,y)
print(d)
k=np.divide(x,y)
print(k)
a=np.array([[1,2],[3,4]])
b=np.sqrt... | true |
4d19ce9073d28e00ed2e6e70c315e03d649e0785 | MarekSuchanek/pypgqueue | /pypgqueue/database.py | UTF-8 | 1,511 | 2.59375 | 3 | [
"MIT"
] | permissive | import dataclasses
import datetime
import uuid
@dataclasses.dataclass
class DatabaseConfig:
hostname: str
port: int
username: str
password: str
database: str
@property
def connection_string(self):
return f'postgresql://{self.username}:{self.password}@{self.hostname}:{self.port}/{s... | true |
ffac44cfde4c2e67e9c93d6b86b2832b73b9b4fd | YoyinZyc/Leetcode_Python | /Facebook/Pro161. One Edit Distance.py | UTF-8 | 709 | 2.9375 | 3 | [] | no_license | '''
Facebook_Medium
11.11 6:58pm
'''
class Solution:
def isOneEditDistance(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
if s == t:
return False
if abs(len(s) - len(t)) >= 2:
return False
i = 0
j = 0
... | true |
040142c90a0ae92a6cd481d1f2f5ad5ea30d1c71 | johngunderman/catan | /catan/hexes.py | UTF-8 | 524 | 2.984375 | 3 | [] | no_license | import operator
import vertices as v
preboard_hexes = [1,3,5,8,10,12,14,17,21,23,25,29,31,33,35,40,42,44]
valid_hexes = preboard_hexes + [19]
__adjacency = [(0, 0, -1), (0, 0, 0), (0, 1, 0), (1, 1, -1), (1, 1, 0), (1, 0, -1)]
"""
Takes a 3-tuple p and returns 3-tuples for all adjacent hexes
"""
def adjacent(p):
r... | true |
bfc0b51fc93f28a850a594418a20def4f4409d65 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_97/1472.py | UTF-8 | 1,286 | 3.171875 | 3 | [] | no_license | import sys
def recycle(a,b):
integers = [i for i in xrange(a,b+1)]
numbs = dict()
for i in integers:
numbs[i] = cycle(str(i))
count = 0
# print numbs
for x in xrange(0,len(integers)):
for y in xrange(x+1, len(integers)):
if integers[y] in numbs[intege... | true |
2d9bc47952207f8fede652ca670eebbabbcfb490 | Anla2z/hilda | /tests/test_symbols/test_objective_c_symbol.py | UTF-8 | 5,975 | 2.609375 | 3 | [] | no_license | import pytest
from hilda.exceptions import *
from hilda.objective_c_symbol import ObjectiveCSymbol
@pytest.mark.parametrize('literal, result', [
('@{@"one": @1}', '{\n one = 1;\n}'),
('@{}', '{\n}'),
])
def test_create_objective_c_symbol(hilda_client, literal: str, result: str):
"""
:param hilda.h... | true |
f6da62d550c880c9fc6e1d965cdc888d0252b32b | mitchell-johnstone/PythonWork | /PE/P009.py | UTF-8 | 392 | 3.0625 | 3 | [] | no_license | # A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
# a2 + b2 = c2
# For example, 32 + 42 = 9 + 16 = 25 = 52.
# There exists exactly one Pythagorean triplet for which a + b + c = 1000.Find the product abc.
from decorators import *
import numpy as np
import math
def v1():
print(... | true |
5eeaf300766311ed88ed337798ea77138e0753af | Achimaple/eso_zh_ui | /scripts/utils.py | UTF-8 | 2,530 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# File : utils.py
# Author : bssthu
# Project : eso_zh_ui
# Description : 将 .txt 文件转换为 .str 文件。其中 .txt 文件是翻译过的 .lua 文件。
#
def read_lua(file_path, name_values):
with open(file_path, 'rt', encoding='utf-8') as fp:
for line in fp.readlines... | true |
eb8805979c8e52bc454f1c1eefe10e84df2b92ca | C00reNUT/gpt2-horoscopes | /generate_from_hub.py | UTF-8 | 1,416 | 2.546875 | 3 | [] | no_license | import os
import torch
import warnings
from transformers import AutoTokenizer, AutoModelWithLMHead
warnings.filterwarnings("ignore")
def make_prompt(category):
return f"<|category|> {category} <|horoscope|>"
def generate(prompt, model, tokenizer, temperature, num_outputs, top_k):
# https://huggingface.c... | true |
c8be9e04a1c080c96a106c2730e9bc8b9fce1c74 | sprkrd/UPC-MAI-CIR | /irl/Environment.py | UTF-8 | 3,061 | 3.171875 | 3 | [
"MIT"
] | permissive | import numpy as np
from tqdm import tqdm
# state variable indices:
c1, c2, c3, arm, last_l, last_r = list(range(0, 6))
# state variable values:
empty, red, blue, green = list(range(0, 4))
# actions:
actions = ["pickL", "pickM", "pickR", "putL", "putR"]
initial_state = [1, 2, 3, 0, 0, 0]
class Environment:
def __... | true |
901cfc67693b499db2e1bf0ba025903d91f03292 | FortranVBA/DAP11 | /test_functional/test_server_function.py | UTF-8 | 5,000 | 2.578125 | 3 | [] | no_license | import pytest
from flask import Flask, render_template, request
import server
@pytest.fixture
def client(monkeypatch):
def mock_loadClubs():
return [
{
"name":"Simply Lift",
"email":"john@simplylift.co",
"points":"80"
},
{... | true |
b47990485d0dc5f88f0a420366f5d3d6abc77d26 | mr-d-self-driving/narwhalroboticsquad | /Quad/misc/ser.py | UTF-8 | 320 | 2.734375 | 3 | [] | no_license | from visual import *
import string
import math
import socket
import struct
import serial
ser = serial.Serial(port='com7', baudrate=115200, timeout=1)
while 1:
line = ser.readline()
words = line.split(' ')
print(words[0])
print(words[1])
print(words[2])
print(words[3])
ser.close
| true |
5bb57fac8989ae2606e725f2804a81ba8d6f3ac7 | ieee-saocarlos/ia-2019 | /exercicios-membros/Raul/IA/Flappy Bird/objeto.py | UTF-8 | 404 | 2.703125 | 3 | [] | no_license | import pyglet
class Objeto:
def __init__(self, image, xc, yc, gene = None):
self.sprite = pyglet.sprite.Sprite(image, x=xc, y=yc)
self.vel = 0
self.morto = False
self.pontuacao = 0
self.pontuado = False
self.vel_tubo = 120
self.gene = []
if gene != ... | true |
431ad8814247a3720fc1b76f5d3b9b734b91e292 | ainterr/rsa_optimizations | /timing_models/keygen.py | UTF-8 | 231 | 3.5 | 4 | [] | no_license | #!/usr/bin/python
def keys(p, q):
n = p * q
t = n - (p + q - 1)
e = 17
d = 1
while 1:
print(d)
d += t
if d % e == 0:
d /= e
break
print("Public: {},{}".format(e,n))
print("Private: {}".format(d))
keys(67, 53)
| true |
4d593dff107e091c2ae24c4c3fb845501a05ab7d | yufang2802/CS1010E | /palindrome.py | UTF-8 | 365 | 4.375 | 4 | [] | no_license | def isPalindrome(word):
if len(word) < 2:
return 1
elif word[0] != word[-1]:
return 0
else:
return isPalindrome(word[1:-1])
word = (input("Enter word: ")).lower()
if isPalindrome(word) == 1:
print("'" + word + "' is a palindrome.")
elif isPalindrome(word) == 0:
... | true |
64faea07429c71b5076a4aeaef3a50e18170d661 | tanjakatariina/Python-Viope-Course | /Exercise_12.1.py | UTF-8 | 785 | 3.609375 | 4 | [] | no_license | # Tämän luvun tehtävissä keskitytään Pythonin tehokkaimpaan sarjalliseen tietomuotoon, eli listaan. Ensimmäinen
# tehtävä onkin lyhyt perehdytys listan käyttämiseen. Muodosta lista, jossa on neljä alkioita, joilla on arvot
# "Sininen", "Punainen", "Keltainen" ja "Vihreä". Tämän jälkeen ota listasta leikkaus jossa on 1.... | true |
d771fba68438630e2e3aa674eef4615b34884971 | karpov78/rosalind-algo | /python/algo/par3.py | UTF-8 | 744 | 2.6875 | 3 | [] | no_license | from util import test_data, swap
def par3(_a, _pivot = 0):
_last = len(_a) - 1
_i = 1
_q = -1
while _i <= _last:
if _a[_i] == _a[_i - 1]:
if _q == -1:
_q = _i - 1
_i += 1
elif _a[_i] < _a[_i - 1]:
if _q == -1:
swap(_a, ... | true |
29f230e2352d5e9d48b7dc2e4878e7abee6892d4 | ferraopam/Day-2 | /pgm3.py | UTF-8 | 519 | 4.125 | 4 | [] | no_license | """3. Write a program to determine the work hours of the day entered based on the timetable provided below.
Mon Tue Wed Thu Fri Sat Sun
3 3 3 3 3 3 0
2 2 2 2 2 1 0
2 2 2 1 1 0 0
Example:
Input: Thu
Output: [3,2,1]
Input: Sat
Output: [3,1,0]"""
li = ["mon","tue","wed","thur","fri","sat","sun"]
week1 = [3,3,3,3,3... | true |
2abea76034804feced96fc3c3fbc39cbbb04b50b | spencer-p/dotman | /src/config.py | UTF-8 | 1,890 | 2.53125 | 3 | [] | no_license | from pathlib import Path
import configparser
# Name of program
# TODO think of a good one
NAME = 'dotman'
config = None
def initialize(custom_config_file = None):
global config
config_file = None
config_dir = None
# Use custom config file if passed
if custom_config_file:
config_file = P... | true |
3e04f15532635260930d3388244dcc20dc420415 | gnoliyil/fuchsia | /src/virtualization/lib/qcow/scripts/gen-sparse-image.py | UTF-8 | 3,546 | 3.046875 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python3
#
# Copyright 2022 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A helper script to generate sparse files that contain some written sectors. These raw disk images
will be converted to qcow images... | true |
8fc891d66bc94ef991ecc41ed18818e7f59b1e7b | blinduck/expenses-server | /api/cron.py | UTF-8 | 2,328 | 2.65625 | 3 | [] | no_license | import time
from datetime import datetime
from pprint import pprint
import arrow
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.wait import... | true |
4bc4d7cf544825a16e2e152522fe3580546ee79c | psiii/Creeps | /creeps -new.py | UTF-8 | 3,807 | 3.046875 | 3 | [] | no_license | #import creeps
from creeplib import *
import os, sys
from random import randint, choice
from math import sin, cos, radians
import pygame
from pygame.sprite import Sprite
from vec2d import vec2d
def run_game():
# Game parameters
SCREEN_WIDTH, SCREEN_HEIGHT = 1280,1024
BG_COLOR = 150, 150, 80
N_EATERS ... | true |
6be3133ce7d89aa552f8751f3650538abd6ea5f4 | wuchangcong/alien_invasion | /settings.py | UTF-8 | 720 | 2.9375 | 3 | [] | no_license | class Settings():
"""存储所有设置的类"""
def __init__(self):
"""初始化设置"""
#屏幕设置
self.screen_width = 1200 #宽
self.screen_height = 600 #高
self.bg_color = (230,230,230) #背景颜色
#飞船设置
self.ship_speed_factor = 1.5
#子弹设置
... | true |
8e82babe88fb9e91042df808ad80bb9cb4ed5154 | zhang-yd/pyNN | /test_lr.py | UTF-8 | 1,574 | 2.859375 | 3 | [] | no_license |
import sys, os
import numpy as np
from src.net import net
from src.utils import *
def fun(train_file, test_file):
train_x, train_y = Read_Data(train_file)
### Define the network structrue
input_dim = train_x.shape[1]
out_dim = 1
struct = [
['fc1', 'fc_layer', input_dim, out_dim, 'guass', 1e-4 ],... | true |
5317443080dc2b83843378bea4b27bde2f055b7e | shen-huang/selfteaching-python-camp | /exercises/1901090043/1001S02E05_array.py | UTF-8 | 771 | 3.984375 | 4 | [] | no_license |
num_array = [0,1,2,3,4,5,6,7,8,9]
new_array = sorted(num_array,reverse = True)
for i in new_array:
new_array[9-i] = str(i)
str_array = ''.join(new_array)
#切片
str_array = str_array[2:8]
str_array = sorted(str_array)
#转整形
for i in str_array:
str_array[int(i) - 2] = int(i)
#转2进制
for i in range(0,6):
str_... | true |
b2809d783d6d9e895b9deecbe260444d93f81669 | 8n8/realbikenav | /old_main_loop.py | UTF-8 | 20,526 | 2.71875 | 3 | [] | no_license | """
It constantly records the camera images and the corresponding microbit
readings, gps readings, and target direction from the routing algorithm.
"""
import enum
import json
import math
import os
import random
import time
from typing import Dict, Tuple
import cv2 # type: ignore
from mypy_extensions import TypedDic... | true |
1e7afc4f31347aec3352227e9d900894ae1478b9 | ztplant/GSPython | /odpssc/tableDDLMapping.py | UTF-8 | 1,111 | 2.671875 | 3 | [] | no_license | # coding=utf-8
__author__ = 'zhangteng'
'''
odps 建表语句转mysql
'''
for line in open('ddl.txt'):
line = line.strip()
if line.find("CREATE TABLE") >= 0 :
# 首行
print(line.replace("tran_","o_"))
elif line == ")":
print(") ENGINE=InnoDB DEFAULT CHARSET=utf8;")
else :
'''
... | true |
6d5aed8c7743865714b1fa1a9efa4a864e915729 | fanhk/search_engine | /lesson2/2.1_print_all_links.py | UTF-8 | 1,290 | 2.9375 | 3 | [] | no_license | __author__ = 'fhk'
# page = contents of a web page
page = '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Udacity</title></head><body><h1>Udacity</h1><p><b>Udacity</b> is a private institution of<a href="http://www.wikipedia.org/wiki/Higher_education">higher education founded by</a> <a href="http://www.wikipe... | true |
cea1ff7787d7338dcc6eae488d3c933be4cfabf0 | jrsmroz/algo_practice | /codility/lessons/4_counting_elements/max_counters.py | UTF-8 | 1,004 | 3.75 | 4 | [] | no_license | # https://app.codility.com/programmers/lessons/4-counting_elements/max_counters/
class CounterBank:
def __init__(self, bank_size):
self.counters = [0] * bank_size
self.min_value = 0
self.max_value = 0
def increase(self, x):
x -= 1
value = max(self.min_value, self.counte... | true |
3d290f697b0dd189a7069c4c84c51f8d3028eb5c | remithiebaut/Coinche | /Hand.py | UTF-8 | 9,073 | 3.359375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 24 14:40:42 2019
@author: rthie
"""
import coinche_constant as const
import generical_function as generic
from Card import Card
class Hand():
"""
Hand of Game Cards
"""
def __init__(self, name="Cards", cards=[], sort=True): #cards nest pas vide
... | true |
be0fd50f7e2e3c45164072e9b184fd8639e8109e | AddisonG/codewars | /python/who-likes-it/who-likes-it.py | UTF-8 | 403 | 3.90625 | 4 | [] | no_license | def likes(names):
if len(names) == 0:
return "no one likes this"
if len(names) == 1:
return names[0] + " likes this"
if len(names) == 2:
return " and ".join(names[:2]) + " like this"
start = ", ".join(names[:2])
if len(names) == 3:
end = " and " + names[2]
else:
... | true |
75233c4160c96f13cec4b551d8e7388e7964036c | ivanwhaf/wechat_robot | /rename.py | UTF-8 | 871 | 2.640625 | 3 | [] | no_license | import os
path = 'f:\\wxPic\\'
def rename():
i = 1000
for pics in os.listdir(path):
fileName = os.path.splitext(pics)[0]
fileType = os.path.splitext(pics)[1]
os.rename(os.path.join(path, pics),
os.path.join(path, str(i)+fileType))
i = i+1
i = 1
for p... | true |
4471aad3e201473f82f9c62c7bd22dd0a1579a20 | simonzhang0428/python_practice | /priority_queue_heapq.py | UTF-8 | 790 | 3.765625 | 4 | [
"Apache-2.0"
] | permissive | from heapq import heappush, heappop, heapify
# heap[0] is smallest
# heapq.heappush(heap, item)
# heapq.heappop(heap) # return smallest
# heapq.heappushpop(heap, item) # == push + pop
# heap[0] # peek smallest
# heapq.heapify(list())
# heap.heapreplace(heap, item) # == pop + push
# heapq.merge(*iterables, key=None, re... | true |
b5114fffb3bae18f11eeb0dbb215bdacb9a4cc9d | materialsvirtuallab/nano281 | /lectures/slides_tex/example_sklearn_adaboost.py | UTF-8 | 425 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | from sklearn.ensemble import AdaBoostClassifier
x_train, x_test, y_train, y_test = train_test_split(x, y_class, test_size=0.2)
decision_tree = AdaBoostClassifier(
DecisionTreeClassifier(criterion="entropy", random_state=0, max_depth=3),
n_estimators=20,
)
decision_tree = decision_tree.fit(x_train, y_train)
tr... | true |
9c502ec3f7e9219fdc12659382bcf04de30821a0 | bdmarius/reinforcement-learning-tic-tac-toe | /random_strategy.py | UTF-8 | 314 | 2.703125 | 3 | [] | no_license | from strategy import Strategy
import random
import constants
class RandomStrategy(Strategy):
def __init__(self):
Strategy.__init__(self, constants.Strategies.RANDOM)
def selectMove(self, availableMoves, board, playerValue):
return availableMoves[random.randrange(0, len(availableMoves))] | true |
0083e74393dd13cf510014ae8c1e60cde5533964 | Bewvnv/CP3-Nuttha-Vanavit | /Lecture99_Nuttha_V.py | UTF-8 | 1,376 | 2.9375 | 3 | [] | no_license | from tkinter import *
import math
def leftClickButton(event):
BMI = (float(textBoxWeight.get())/math.pow(float(textBoxHight.get())/100,2))
labelResult.configure(text=BMI)
if BMI > 30:
labelResultThai.configure(text="อ้วนมาก")
elif BMI > 25:
labelResultThai.configure(text="อ้วน")
eli... | true |
0fc337de688752bfa93b44d42c5e7fcbbc274c9f | chaseguy15/Bootcamp | /basics/python_basics.py | UTF-8 | 4,266 | 4.5625 | 5 | [] | no_license | """
Python is a must-know language, used for a wide array of applications because
of how dynamic it is. The language is also user friendly so we will be starting
with it.
"""
### COMMENTS ###
# an single-line comment, can be used following statements
"""
A multi-line comment.
These are best used for impo... | true |
809a3c63445ff39f0b6d3922a47fd412753845f9 | shriharan18/movies_collection_program_using_python | /app.py | UTF-8 | 1,567 | 4.125 | 4 | [] | no_license | #This code was written by Shreeharan for the YouTube Channel Stark Intelligence
MENU_PROMPT = "\nEnter 'a' to add a movie, 'l' to see your movies, 'f' to find a movie by title, or 'q' to quit: "
movies = [] #movies dictionary
#add movie function
def add_movie():
title = input("Enter the movie title: ")
... | true |
a91fb498c452dbda0e1c126a6c5e08a62136ce5d | arnabs542/DataStructures_Algorithms | /hashing/Replicating_Substring.py | UTF-8 | 1,161 | 4 | 4 | [] | no_license | '''
Replicating Substring
Given a string B, find if it is possible to re-order the characters of the string B so that it can be represented as a concatenation of A similar strings.
Eg: B = aabb and A = 2, then it is possible to re-arrange the string as "abab" which is a concatenation of 2 similar strings "ab".
If it i... | true |
023e259e805a42e0ea060fb86d144199debef6ce | Sha78/python_projects | /Ch05/pe06.py | UTF-8 | 2,287 | 4.28125 | 4 | [] | no_license | #Ch 5 pe06
#Description: Calories from Fat and Carbohydrates. This code displays the colories from fat and calories from carbs.
#cals from fat = fat grams*9
#cals from carbs = carb grams*4
# def fatCals():
# return float(input("Enter the amount of grams of fat you consume in a day: " ))
# def carbCals():
# re... | true |
511800a1a0702c280df921e2feeb9a29dd47df23 | seth814/Autonomous-Pi | /computer/pc_main.py | UTF-8 | 8,438 | 2.671875 | 3 | [
"MIT"
] | permissive | import numpy as np
import cv2
import pygame
import threading
import socketserver
import socket
from queue import Queue
import time
import pandas as pd
from keras.models import model_from_yaml
import os
RUN = True
COLLECT = False
q = Queue(100)
class Control(object):
'keeps track of steering durin... | true |
9628d758a2a669109b959bcc258b8e8becbd8144 | pufface/codility-lessons | /L06 Sorting/Distinct.py | UTF-8 | 1,359 | 4.03125 | 4 | [] | no_license | # coding=utf-8
'''
Write a function
int solution(int A[], int N);
that, given a zero-indexed array A consisting of N integers, returns the number of distinct values in array A.
Assume that:
N is an integer within the range [0..100,000];
each element of array A is an integer within the range [−1,000,000..... | true |
952b7c26d7c14fd0f9fdda4a5455678cf975e2b4 | StorjOld/cloud-manager | /cloudmanager/transfer_meter.py | UTF-8 | 3,842 | 2.9375 | 3 | [
"MIT"
] | permissive | from . import database
import datetime
class TransferMeter(object):
"""Register transfer statistics.
Stores the total number of bytes that
were downloaded and uploaded. One must
specify a path to the database where
this information is to be stored.
This database must have a table called
t... | true |
77533069416a930f73c6ea0ab4aa5371fc12cff8 | oussamaRakye/OpenCV | /course/20_ChallengeEyeDetection.py | UTF-8 | 494 | 2.671875 | 3 | [] | no_license | import numpy as np
import cv2 as cv
img = cv.imread("faces.jpeg", 1)
img = cv.resize(img, (0,0), fx=0.3, fy=0.3)
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
path = 'haarcascade_eye.xml'
eye_cascade = cv.CascadeClassifier(path)
eyes = eye_cascade.detectMultiScale(gray, scaleFactor=1.02, minNeighbors=20, minSize=(10,10)... | true |
00f2a922f4533abc69784f64c0600244799fe22c | ak7954/risksense_api_examples | /examples/python/single client/export_hostfindings.py | UTF-8 | 7,449 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | """********************************************************************************************************************
|
| Name : export_hostfindings.py
| Description : Exports and downloads a csv file containing hostfindings from the RiskSense platform via the REST API.
| Copyright : (c) RiskSense, Inc... | true |
6e032b55d6f590c598fd31c2203fbc1b6c7a13a8 | vnagaraj/design_algorithms_stanford | /Graphs/djikstra.py | UTF-8 | 9,093 | 3.5 | 4 | [] | no_license | __author__ = 'VGN'
import sys
import time
import unittest
from graph import DirectedGraph
from Heaps.heap import MinHeap
class Key:
""" key class to be used by Djikstra's to place this object in heap,
keys are compared based on distance attribute(distance of the vertex from source vertex)
"""
d... | true |
d9145ccb2105628683c33aee93d0199e840a1343 | collaborative-robotics/adaptive-b3 | /bt_icra_sim.py | UTF-8 | 8,349 | 2.734375 | 3 | [
"MIT"
] | permissive | #
# Basic humanoid robot with three terrains
# includes the Greedy selector
#
# Based on the fire extinguisher scenario from Periera and Engel 2015
#
import sys
import b3
import numpy as np
import random
import itertools
import uuid
import matplotlib
import matplotlib.pyplot as plt
import smart_nodes as sn
imp... | true |
811bde575f17d0eda34d363a77ce6ee9a024e755 | winterash2/algorithm_study_2021_1 | /210403/이동재)데브매칭/3.py | UTF-8 | 1,053 | 3.15625 | 3 | [] | no_license | def distribute(parent_dict, money_dict, person, money):
not_my = money // 10
my = money - not_my
my = my + money_dict[person]
money_dict[person] = my
if parent_dict[person] != '-' and not_my != 0:
distribute(parent_dict, money_dict, parent_dict[person], not_my)
def solution(enroll, referra... | true |
5eb0b06773c7a26bae7c9aeaba60a6c833a7ce63 | OliverSimonGH/PythonBasics | /lists.py | UTF-8 | 376 | 4.25 | 4 | [] | no_license | movie_list = ["The Godfather", "Jaws", "Troy", "Midnight Special", "Casper"]
movie_list[2] = "Scream" #Changes the 3rd element of the list
movie_list[len(movie_list)-1] #Gets the length of the list, -1 because lists start from 0.
movie_list[-1] #This will print the last element of the list, quicker than the previous me... | true |
dfa5f3c457817d69a83b84ae79c22be00a5abfa8 | monkeylyf/interviewjam | /sort/hackerrank_Counting_Sort_3.py | UTF-8 | 402 | 2.90625 | 3 | [] | no_license | """hackerrank_Counting_Sort_3
https://www.hackerrank.com/challenges/countingsort3
"""
from collections import defaultdict
def main():
T = int(raw_input())
d = defaultdict(int)
for _ in xrange(T):
i = int(raw_input().split()[0])
d[i] += 1
acc = 0
for i in xrange(100):
ac... | true |
451e56dc0466125c7f298d51addcd3077d2a3013 | sangm1n/problem-solving | /CodingTest/Q-14.py | UTF-8 | 2,585 | 3.328125 | 3 | [] | no_license | """
author : Lee Sang Min
github : https://github.com/sangm1n
e-mail : dltkd96als@naver.com
title : 외벽 점검
description : 레스토랑을 운영하고 있는 스카피는 레스토랑 내부가 너무 낡아 친구들과 함께 직접 리모델링 하기로 했습니다.
레스토랑이 있는 곳은 스노우타운으로 매우 추운 지역이어서 내부 공사를 하는 도중에 주기적으로 외벽의 상태를 점검해야 할 필요가 있습니다.
레스토랑의 구조는 완전히 동그란 모양이고 외벽의 총 둘레는 n미터이며, 외벽의 몇몇 지점은 추위가 심할 경우 ... | true |
fde3e462a355a9a0df3261229b6c806bcf2faf53 | python-cookbook/PythonStudy | /p02_personal_summary/p13_lee_yung_seong/p03_week/p01_tuesday/C4.16.py | UTF-8 | 1,683 | 3.640625 | 4 | [] | no_license | #무한 while문을 이터레이터로 치환
#문제
#함수나 일반적이지 않은 조건 테스트로 인해 무한 while 순환문으로 데이터에 접근하는 코드를 만들었다.
#해결
#입출력과 관련 있는 프로그램에 일반적으로 다음과 같은 코드를 사용한다.
CHUNKSIZE = 8192
def reader(s):
while True:
data = s.recv(CHUNKSIZE)
if data ==b'':
break
process_data(data)
#앞의 코드는 iter()를 사용해 다음과 같이 수정할 수 있다.
de... | true |
d87354ae8426d02b175b58e5db76c41f441ce0e0 | RTyy/aiocomments | /source/aiocomments/views/comments_rest.py | UTF-8 | 5,541 | 2.5625 | 3 | [] | no_license | """AIOComments REST API."""
import trafaret as t
from aiohttp import web
from core.exceptions import CoreException
from core.db import acquire_connection
from core.request import json_request_required
from ..models import Comment, EventLog
class CommentAPIView(web.View):
"""AIOComments REST API."""
@acqui... | true |
5cde9d13e8ca795b6902f8c01cbde88945b29a94 | craggy1244/python-scripts | /text-adventures/temple-raiders.py | UTF-8 | 9,217 | 3.21875 | 3 | [] | no_license | import os
from colorama import Fore, Back, Style
NL_1 = "\n"
NL_2 = "\n\n"
game_over = False
hint_count = 0
def printText(text, color=Fore.WHITE, end=NL_2):
print(color, end="")
print(text, end=end)
print(Style.RESET_ALL, end="")
def inputChoice(prompt, options, includeHint=False):
printText(prompt... | true |
1c084b28db99a1332a58eee0e9a6fd2e472790ce | nagatea/NLP100knock | /chapter04/common04.py | UTF-8 | 455 | 2.578125 | 3 | [] | no_license | def get_neko_mecab():
res = []
with open('neko.txt.mecab') as f:
for line in f:
tmp = line.split('\t')
if tmp[0] == 'EOS\n':
continue
surface = tmp[0]
word = tmp[1].split(',')
if word[6] == '*\n':
base = surface
else:
base = word[6]
dic = {
... | true |
5e554e275f08ed9c73c0aabe951804b94c61a0bd | GiaLacTRAN/convolutional_deep_gp_random_features | /code/data/pre_process_data.py | UTF-8 | 5,175 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | ## Copyright 2019 Gia-Lac TRAN, Edwin V. Bonilla, John P. Cunningham, Pietro Michiardi, and Maurizio Filippone
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache... | true |
9039f3963fcfac70dad61d79629c81d6fefffdc7 | mohiandipta/Data-collection-and-processing-with-python | /Map.py | UTF-8 | 653 | 4.4375 | 4 | [] | no_license | #####----for Double-----####
def doubleStuff(a_list):
new_list = []
for value in a_list:
new_elem = 2 * value
new_list.append(new_elem)
return new_list
things = [2, 5, 9]
print(things)
things = doubleStuff(things)
print(things)
#####----for Triple-----####
def triple(valu... | true |
20077756da4ea6b4e46e953f85a7495eaf1eaa53 | void-memories/pyScripts | /csub.py | UTF-8 | 156 | 3.296875 | 3 | [] | no_license | t=int(input())
while t:
cnt=0
t-=1
n=int(input())
s=input()
for i in s:
if i=='1':
cnt+=1
print(cnt*(cnt+1)//2)
| true |
2c8cc43193538a4dbe4bd53093d274d5d05949cf | sumeilan/tools | /format/format_csv.py | UTF-8 | 1,440 | 2.9375 | 3 | [] | no_license | import pandas as pd
import csv, os, sys
# 删除所有行
def del_all_row(file):
datas = pd.read_csv(file)
data = datas.drop(range(len(datas))) # 删除前10行
data.to_csv(file, index=0)
# 删除前N行
def del_some_row(file, num):
data = pd.read_csv(file)
data = data.drop(range(num)) # 删除前10行
data.to_csv(file, in... | true |
293c8d9431ce8d0940e4ad27dcb76e18ba4d8fea | LuyiRen/RenLearnsPython-Again- | /Battleship.py | UTF-8 | 2,635 | 3.65625 | 4 | [] | no_license | from random import randint
board = []
boardx = []
for x in range(5):
board.append(["O"] * 5)
boardx.append(["O"]*5)
def print_board(board):
print("---board---")
for row in board:
print (" ".join(row))
print_board(board)
def random_row(board):
return randint(0, len(board) - 1)... | true |
2e2455c334779254e3fc4e711159a947a74ac14f | ansumanmishra/python-tuts | /3-variables.py | UTF-8 | 257 | 3.90625 | 4 | [] | no_license | import sys
import os
name = "Ansuman"
print(name)
# Strings
str = "This is a string"
print(str)
# Strings with quotes
str1 = "\"This is a string with quote inside"
print(str1)
# Multi line string
str3 = ''' This
is a multi
line string '''
print(str3) | true |
57d5dae3a241ba6f6f3bf77441842adde37f7a3b | AlexZettler/NewLife | /Node.py | UTF-8 | 29,173 | 3.078125 | 3 | [] | no_license | import math
import random
import copy
import IDtrack
import graphics as gfx
#import matplotlib.pyplot as pplot
#import numpy
class NodeWrangler(object):
""""
Generates, tracks and alters all points and links in the graph
"""
def __init__(self):
self.nodes = IDtrack.IDTracker()
self... | true |
dd01c1ff6c77b2bc4199178e9225a687a90caaea | adler-sudo/oregon_wildfire_dashboard | /radius_fire.py | UTF-8 | 4,591 | 2.703125 | 3 | [] | no_license | # import dash packages
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
# import plotly
import plotly.express as px
import plotly
# import data handling packages
import pandas as pd
from sqlalchemy import (create_engine,
selec... | true |
08c61ab03926c874cc4c13e6b64d39617d7179d7 | ioda-net/geo-api3 | /chsdi/tests/functional/test_encoders.py | UTF-8 | 9,187 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
import unittest
class Test_EsriGeoJSON(unittest.TestCase):
def _callFUT(self, **kwargs):
from chsdi.esrigeojsonencoder import EsriGeoJSONEncoder
return EsriGeoJSONEncoder(**kwargs)
def test_json(self):
encoder = self._callFUT()
result = encoder.defaul... | true |
fb30794f1075d94644a26018d3a0bdf6619ddd0f | zappospizza/touchpoint-python | /tests/test_touchpoint.py | UTF-8 | 1,991 | 2.828125 | 3 | [
"MIT"
] | permissive | import os
from touchpoint import Touchpoint
API_KEY=os.environ['TP_API_KEY']
TEST_STORE_ID=os.environ['TP_TEST_STORE_ID']
TEST_EMPLOYEE_ID=os.environ['TP_TEST_EMPLOYEE_ID']
TEST_ITEM_ID=os.environ['TP_TEST_ITEM_ID']
def test_ping():
"""Tests an API call to API's endpoint"""
t = Touchpoint(api_key=API_KEY)
... | true |
55be03573731b09ebcb81ed9c8bbb64e56b6e713 | xieduo7/pecan | /bp/common/maths/MathsTest.py | UTF-8 | 1,180 | 2.90625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
#Copyright (C) 2006-2011 by Benedict Paten (benedictpaten@gmail.com)
#
#Released under the MIT license, see LICENSE.txt
import unittest
import random as r
import Maths
import math
class TestCase(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
def tear... | true |
6d34816c7c579982234a20ee5dc3be9e9a95705b | gannon345/CLSearchAssist | /CLSearchAssist.py | UTF-8 | 5,634 | 3.0625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import urllib2
import re
import time
import os
def get_listings(soup):
"""Pulls all html links for apartment listings from the Craigslist RSS, then returns them as a list"""
url_list = soup.items
list_string = str(url_list)
listings = re.findall('http://' + '\w+.\w+.\w+.\... | true |
02881ac3e524c01eb7ea42d2aa8c8562953c1c28 | Qwyrp/raspberrypi-examples | /actor-linksprite-buzzer/buzzer.py | UTF-8 | 705 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import RPi.GPIO as GPIO
import time
pd = 27 #DATA PIN
# freq in Hz
def buzz(duration, freq):
GPIO.output(pd, 0)
for i in range(1,duration):
GPIO.output(pd, 1)
time.sleep(0.001)
GPIO.output(pd, 0)
time.sleep(1.0/freq)
GPIO.output(pd, 0)
d... | true |
cde6cecc780ffbf209e251e6e90f5b8810933c04 | shubhang21/SecureWei | /CORE/printers/inheritance/inheritance.py | UTF-8 | 5,306 | 2.9375 | 3 | [] | no_license | """
Module printing the inheritance graph
The inheritance graph shows the relation between the contracts
and their functions/modifiers/public variables.
The output is a dot file named filename.dot
"""
from securewei.core.declarations.contract import Contract
from securewei.detectors.shadowing.shadowin... | true |
3f515696a68e077fd8566cc135e77162dfbb56b4 | fonkouTala/mawe | /e_learing_suite.py | UTF-8 | 16,814 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from Tkinter import*
from tkMessageBox import*
root= Tk()
root.title('Appplication Gestion Structure')
def callback():
if askyesno('Titre 1', 'Etes-vous sur de vouloir faire ça?'):
root.destroy()
else:
showerror("Titre 2", "Revenons donc a l'acueil")
def back_to_home... | true |
eacfa68a97c197b8199a2bad86989c2bf888f10e | mktshhr/tensorflow-theta | /tensorflow/python/data/ops/optional_ops.py | UTF-8 | 7,828 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | true |
a34700cf22b1daab2c3068d62e6f858ecdfb76ae | FilipTrocin/Uniprot_Parser | /uniplot/analysis.py | UTF-8 | 486 | 3.1875 | 3 | [] | no_license | def average_len(records):
"""Returns the average length of the proteins"""
average = sum(len(record) for record in records) / len(records)
return average
def average_len_taxa(records):
"""Returns the average length of top-level taxas"""
record_by_taxa = {}
for r in records:
taxa = r... | true |
c0c95003f8db4f1acdc231aab2f0dec216a45195 | yuhewa/facial-landmarks-detection | /read_landmarks.py | UTF-8 | 4,514 | 2.625 | 3 | [] | no_license | import numpy as np
import cv2
import os
img_root_dir = "/home/gavin/face_alignment/datasets/WFLW/WFLW_images"
anno_path = "/home/gavin/face_alignment/datasets/WFLW/WFLW_annotations/list_98pt_rect_attr_train_test/list_98pt_rect_attr_train.txt"
img_landmarks = {}
### reading annotation ###
with open(anno_path) as f:
... | true |
dc51f2c63f3cda8857b5a58edd64bb5cce79181a | touyou/CompetitiveProgramming | /euler/p26.py | UTF-8 | 324 | 3.125 | 3 | [] | no_license | #! python
m = [0] * 1000
res = 0
l = 0
def calc(d):
m[0] = 1 % d
for i in range(1, d):
m[i] = m[i - 1] * 10 % d
for j in range(0, i):
if m[i] == m[j]:
return i - j
for d in range(1, 1000):
temp = calc(d)
if temp > l:
res = d
l = temp
print ... | true |
15a539d440af90aef223ee3a3aee8b0896a41235 | Sparksx/SIO1 | /codePhrase.py | UTF-8 | 568 | 3.421875 | 3 | [] | no_license | rang = 0
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
position = 0
phraseCodee = ""
phraseACoder = input("Saisissez une phrase a coder")
phraseACoder = phraseACoder.upper()
rang = int(input("Saisissez la clé de codage"))
rang = rang % 26
for lettre in phraseACoder :
if lettre == " " :
phraseCodee += " "
... | true |
1517ec424ea608139f6b055b8f46faa62f7d7cb5 | AndreaCarollo/ARC | /Course_Proj/Assignment_3/Old_version/ARC_trj/01_actuators/dc_motor.py | UTF-8 | 6,433 | 2.96875 | 3 | [] | no_license | from __future__ import print_function
import sys
import numpy as np
import numpy.linalg as la
from scipy.linalg import expm
from math import sqrt
class Empty:
def __init__(self):
pass
def get_motor_parameters(name):
param = Empty()
if(name=='Paine2017'):
param.I_m = 0.225 # mot... | true |
ec6449ae0d8d96e67fb641b8f70837079e6abdbb | shinmao/Pyspark-Movie-Recommender-System | /src/als_recommender.py | UTF-8 | 2,690 | 2.625 | 3 | [] | no_license | from __future__ import print_function
from pyspark.sql import SparkSession
from pyspark.ml.evaluation import RegressionEvaluator
from pyspark.ml.recommendation import ALS, ALSModel
from pyspark.ml.tuning import TrainValidationSplit, ParamGridBuilder
from pyspark.mllib.evaluation import RegressionMetrics, RankingMetric... | true |
094452dc2b7c00eda54c725417d41dabc8bf699b | nishantbalaji/stratified-random-sampling-system | /sampler.py | UTF-8 | 4,932 | 3.09375 | 3 | [
"MIT"
] | permissive | import pandas
import numpy
import random
# Read the .csv file and parse it into a DataFrame
df = pandas.read_csv('Peru_2019_AudioMoth_Data_Full.csv')
# Get an array of the AudioMoth device names found in the .csv file
AudioMothName = df.drop_duplicates(subset=['AudioMothCode']).loc[:,'AudioMothCode'].values
# Devices... | true |