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 |
|---|---|---|---|---|---|---|---|---|---|---|
8f17a87296f3879a5f504d2394ad9794d64f6c79 | shrutidas/interact | /map-publisher-actual.py | UTF-8 | 2,252 | 2.671875 | 3 | [] | no_license | import paho.mqtt.client as mqtt
import MPR121
from gpiozero import RGBLED
import subprocess
import pygame
from pygame.mixer import Sound
from glob import glob
from time import sleep
# This is the Publisher
client = mqtt.Client()
client.connect("adapi",1883,60)
client.publish("topic/test", "Hello world!");
#client.disc... | true |
9af777c388235e8d719386bbc0300c00177b0771 | saararbel/DM2OKG | /DMFileParser.py | UTF-8 | 2,092 | 3.046875 | 3 | [] | no_license |
COLUMNS_TEST = "id, form, lemma, pos".split(", ")
COLUMNS_TRAIN = COLUMNS_TEST + "top, pred, frame,".split(", ")
def token_line_to_data(line_str):
"""
:param line_str: a line for a token
:return: SdpToken: a dict representation for the data of the token.
"arg1", "arg2" and so on are the keys for colum... | true |
afffeee3b255e0a1dc73b31b83855884311afd17 | SGaoNut/image_segmentation | /deeplabv3+-cityscapes/inference_demo_video.py | UTF-8 | 2,739 | 2.671875 | 3 | [] | no_license | """
推理MP4视频
"""
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(BASE_DIR, '..'))
import matplotlib.pyplot as plt
from tensorflow.python.keras.preprocessing.image import load_img, img_to_array
from models.deeplab import DeepLabV3Plus
from tensorflow.keras.applicati... | true |
e8a733685dc1561152700774c2f66172402af885 | iyyuan/leetcode-practice | /roman-to-integer.py | UTF-8 | 817 | 3.796875 | 4 | [] | no_license | class Solution:
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
n = dict()
n["M"] = 1000
n["D"] = 500
n["C"] = 100
n["L"] = 50
n["X"] = 10
n["V"] = 5
n["I"] = 1
num = 0
i = 0
... | true |
35146deb6a789372f42afb4170dcdc008d863786 | smnbnt/MIT6.00.1x | /Lecture4/Problem8.py | UTF-8 | 128 | 3.203125 | 3 | [] | no_license | def fourthPower(x):
'''
x: int or float.
'''
# Your code here
a = square(x)
b = square(x)
return a*b | true |
1290d9de6dd5a558f0d4008fe3be049d867d14b0 | charlewn/python-learning | /algo-1/modifyCode.py | UTF-8 | 2,771 | 3.4375 | 3 | [] | no_license | # -----------------
# User Instructions
#
# Modify the bridge_problem(here) function so that it
# tests for goal later: after pulling a state off the
# frontier, not when we are about to put it on the
# frontier.
import time
def timeit(method):
#need to understand a decorator function
def timed(*args, **kw):
... | true |
db3d933285fa8bfcd5e08cc89c7bb146dab339ba | brianwells/autopkg-recipes | /Signiant/SigniantAppURLProvider.py | UTF-8 | 4,691 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
#
# Copyright 2016 Brian D. Wells
#
# 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 applicable law o... | true |
758eae2fa033f85bd1618b0a5e21bad751db59e1 | 0lidaxiang/detection-car-pedestrian | /python-socket/server_ai.py | UTF-8 | 524 | 3.125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# 文件名:server.py
import socket # 导入 socket 模块
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) # 创建 socket 对象
s.bind(('', 12345)) # 绑定端口
s.listen(1) # 等待客户端连接
print('The server is ready to receive')
while True:
c, addr = s.ac... | true |
2fc2ddc1b8e4abbe67ac3df5be0b1c2e9b864af4 | YeungRepo/darpa-sd2 | /SILL_learning/Test/learning_lyapunov_theory.py | UTF-8 | 1,560 | 3.53125 | 4 | [] | no_license | import numpy as np
import control
# The purpose of this is to create a codebase for pedagogical purposes
# I want to have ready systems for learning about and testing control theory concepts.
# global variables for defining a 2 state nonlinear system
# 4.1
a = 1
def h(x):
return np.sin(x)
def d_x1(x):
"""... | true |
3fee1da8db134d37c224b6187e1f5fb06d141afb | Rahul-Choudhary-3614/Robotic-Car-Path-Planning- | /Error_Function.py | UTF-8 | 3,109 | 2.75 | 3 | [] | no_license | from Robot import my_robot
from Astar_planner_with_smoothing import get_path
from Particle_filter import particles
import numpy as np
from math import *
class error_function:
def __init__(self,grid, init, goal,steering_noise,measurement_noise,distance_noise):
self.grid = grid
self.init = init
self.goal =... | true |
814a36039121bb4804b432de5ef8d1fa6a924c3a | nok/sklearn-porter | /sklearn_porter/cli/command/save.py | UTF-8 | 2,705 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | from argparse import RawTextHelpFormatter
from logging import DEBUG
from pathlib import Path
from textwrap import dedent
from typing import Dict
# sklearn-porter
from sklearn_porter import Estimator, options
from sklearn_porter.cli.common import arg_debug, arg_help, arg_skip_warnings
from sklearn_porter.cli.utils impo... | true |
8a24ca509642dd52e6c71ebdffd34ebf7447f28c | salonipdesai-asu/CSE-575 | /CSE575_KMeansStrategy2.py | UTF-8 | 5,222 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 27 18:32:49 2019
@author: salonidesai
"""
#KMEANS ALGORITHM - Strategy 2
import scipy.io
from scipy.spatial import distance
import numpy as np
import matplotlib.pyplot as plt
Numpyfile= scipy.io.loadmat('/Users/salonidesai/Downloads/AllSamples.mat... | true |
0136a42cd15aad0249a0c9f93c7dc8fa4fb39bef | FernandoDurier/apa-dijkstra | /demo.py | UTF-8 | 4,575 | 2.53125 | 3 | [] | no_license | from ordered_linked_list.ordered_linked_list import *
from logger.timer import *
from graph_handler.edge import *
from graph_handler.vertrix import *
from graph_handler.graph import *
from dijkstra.closest_path import *
from dijkstra.closest_path_using_array import *
from data_loader.data_loader import *
import json
im... | true |
ad8a17d759852d92e01c9c59fba41749d2d10ed2 | TerrisGO/PADify | /spoopy/refactored/preprocessing/handler/datahandler.py | UTF-8 | 5,624 | 2.984375 | 3 | [
"MIT"
] | permissive | from typing import Tuple
import os
from abc import ABC, abstractmethod
from refactored.preprocessing import Video
from tools.file_utils.file_helper import copy_file_rename
class DataHandler(ABC):
"""
This is the base class for fetching data to load into our Preprocessor. You can choose
to load from disk... | true |
d910b28bf42fb045ae2e4aa14f36bfbaa456815d | parsnip42/open-alarm-clock-project | /src/alarm_widgets/time_entry_24_widget.py | UTF-8 | 928 | 2.703125 | 3 | [] | no_license | from ui_framework import WidgetSet
from ui_framework import LabelWidget
from ui_framework import SpinnerWidget
class TimeEntry24Widget(WidgetSet):
def __init__(self, alarm):
super(TimeEntry24Widget, self).__init__()
self._hour_widget = SpinnerWidget(0, 0, 23, "%02d")
self._minute_widget = S... | true |
38f0fd0048505a7730df66a6ed0273b3817355bc | dstigler/django | /order_project/orders/models.py | UTF-8 | 3,683 | 2.546875 | 3 | [] | no_license | import sys
import datetime
import pandas as pd
from pandas.tseries.offsets import CustomBusinessDay, BDay,BusinessDay, CustomBusinessHour
from pandas.tseries.holiday import AbstractHolidayCalendar, Holiday, DateOffset, EasterMonday, Easter, MO, Day, next_monday, previous_friday
from enum import Enum
from django.db imp... | true |
3230616ab3aa2b3a5707aca6f68c38884d237bd1 | Lorddu/submarine_landslide | /1kmeans_new.py | UTF-8 | 1,322 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 12 17:08:30 2020
@author: admin
"""
import numpy as np
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
X = np.loadtxt('data.txt',dtype=np.float32)
from sklearn.metrics import calinski_harabasz_score,\
davies_bouldin_score,silhouette_score
cal_sco... | true |
60d7c49b82cab8abedb3c8b6da936f2f59a285af | baptistechev/licence-info-montpellier | /HLIN303_OS/TPpython1/capitale.py | UTF-8 | 1,132 | 3.359375 | 3 | [] | no_license | import sys
from random import *
fichier="capitales.csv"
pays=[]
capitales=[]
fd = open(fichier,"r")
for l in fd.readlines():
data=l.split(",")
if len(data)==2:
d=data[0].split("(")
pays.append(d[0].rstrip())
capitales.append(data[1].rstrip())
fd.close()
def game(question,reponse):
... | true |
e8b8bd2066aa692dadbcde4ccfcfe2e03b49c4a8 | daniel-reich/ubiquitous-fiesta | /iqaQLvS7yfGR2wJyL_13.py | UTF-8 | 93 | 3.171875 | 3 | [] | no_license |
import math
def num_of_digits(num):
return 1 if num ==0 else int(math.log10(abs(num)))+1
| true |
b40934fa655e020e25a7b16bf1b47fc232d27e1c | joshavenue/python_notebook | /list_trick_1.py | UTF-8 | 83 | 2.765625 | 3 | [
"Unlicense"
] | permissive | x = ['car','boat','cat','motor']
x[-2:] = 'ferrari'
x[-7:] = [''.join(x[-7:])]
| true |
a6f1f36d9b2b40be7dcebef30a41f748d219d56c | nulipinbobuyanqi/APITestFramework | /Utils/operation_dir.py | UTF-8 | 1,113 | 3.1875 | 3 | [] | no_license | # coding:utf-8
# @Author: wang_cong
# @File: operation_dir.py
# @Project: AutoCreateCaseTool
# @Time: 2021/5/26 17:19
import os
def create_every_path_dirs(base_path, path):
"""
使用"/"对传入的每个目录结构,进行切片,然后创建各个层级的目录名称
:param base_path: 待创建的所有目录,其根目录
:param path: 具体的每个含有层级关系的目录结构,例如:
1. 只有一层目录结构时,写法为:目录A... | true |
c02f29451a571a32ae0f80ecfb47d40d39b1e9e4 | mrcarlosrendon/turbo-carnival | /website/upload_local_replays.py | UTF-8 | 1,280 | 2.609375 | 3 | [
"MIT"
] | permissive | """ Pull replay from rocketleaguereplays and post turbo-carnival """
import StringIO
import os
import sys
import traceback
import requests
import boto3
# To setup your keys
# aws configure
DYNAMO = boto3.resource("dynamodb")
TABLE = DYNAMO.Table('turbo-carnival')
REPLAY_DIR = os.path.expanduser("~") + "\Documents\My ... | true |
d73197002255db35409f121d147e408460463807 | JenZhen/LC | /lc_ladder/company/gg/Count_Square_Submatrices_With_All_Ones.py | UTF-8 | 1,675 | 3.59375 | 4 | [] | no_license | #! /usr/local/bin/python3
# https://leetcode.com/problems/count-square-submatrices-with-all-ones/submissions/
# Example
# Given a m * n matrix of ones and zeros, return how many square submatrices have all ones.
# Example 1:
#
# Input: matrix =
# [
# [0,1,1,1],
# [1,1,1,1],
# [0,1,1,1]
# ]
# Output: 15
# Explana... | true |
ec666647b6972c47737e9ea4493104e173001893 | almonds0166/finneasj | /squeak/whereis.py | UTF-8 | 2,375 | 2.8125 | 3 | [
"MIT"
] | permissive |
import asyncio
from urllib.parse import urlencode, quote
import json
import discord
import aiohttp
from .util import cap_at_n, SearchResults
HEADERS = {"User-Agent": "finneasj/1.0"}
# Returns content string, embed object, and whether there was one result
async def search(query, debug=False):
q = urlencode({"q":... | true |
6d377032dd18810afc001fb4f4209a7afb927e1f | AswinBarath/python-dev-scripts | /I Basics/1 First Python Program.py | UTF-8 | 109 | 3.125 | 3 | [] | no_license | print('Aswin Barath')
name = input('What is your name? Your Answer:')
print(name)
print('Helllloooo ' + name)
| true |
132b855888027094aafc4282e72d1e299fadf943 | JasonGiedymin/elk-butler | /tests/seed.py | UTF-8 | 1,170 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | #
# Integration Testing Tools
#
# DO NOT USE THE BUTLER LIBRARY USE, RAW CLIENT CODE HERE
#
from butler import clients
from datetime import datetime
TEST_INDEX = 'data-2016.04.01'
def load_data():
"""
Load test data for integration tests.
"""
doc_type = 'testdata'
doc = {
'author': 'T... | true |
1e3c0067abc4106b90a5960b5d7980cef74e6876 | sysboy/aoc | /2020/day14/part02.py | UTF-8 | 1,738 | 2.703125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
""" AOC day 14 """
import sys
import itertools
from collections import defaultdict
import re
ins = []
mask_re = re.compile(r'mask = (?P<mask>\w+)')
mem_re = re.compile(r'mem\[(?P<location>\d+)\]\s=\s(?P<value>\d+)')
f = 0
vals = []
mask = ""
with open(sys.argv[1]) as fd:
#first line
lin... | true |
b34272e29cc46a5304c495344713517594c9129d | Albert13-Cao/AMT | /8.rain_tank/main.py | UTF-8 | 548 | 3.171875 | 3 | [] | no_license | with open("rainin.txt") as rainin:
lines = [line.rstrip() for line in rainin]
info = lines[0].split(" ")
days_of_rain = int(info[0])
tank_liters = int(info[1])
# print(lines, tank_liters, days_of_rain)
lines.remove(lines[0])
# print(lines)
days = 0
water = 0
for i in range(days_... | true |
48fa7c8ea00496f0912ab1be7c8db1700f3ba0a0 | sudo-prime/nuix-hack | /game.py | UTF-8 | 20,620 | 3.234375 | 3 | [] | no_license | import pygame # Module used for all graphics.
from Hue import Hue
from Level import Level # Custom level class, used for tracking tiles and drawing level elements to screen.
from Button import Button # Custom button class. For clicking!
from ButtonController import ButtonController # Button Controller class handles dra... | true |
f49000c83264d867954d13996d0e4000038a196d | Bhavaz/Python | /ML/ICP4/svm.py | UTF-8 | 771 | 3.078125 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
from sklearn.svm import SVC, LinearSVC
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import train_test_split
df = pd.read_csv('./glass.csv')
y = df["Type"]
df1 = df.drop("Type",axis=1).copy()
# create training and testing
X... | true |
956a6f11592097ff9051492319fd94fade6930d3 | alexandr-gnrk/human_passwords | /recovering/adapter.py | UTF-8 | 217 | 2.640625 | 3 | [] | no_license | with open('generated-sha1.csv') as f1:
with open('generated-sha1-reverse.csv', 'w') as f2:
for line in f1:
hash_, salt = line.split(':')
f2.write(salt.strip() + ':' + hash_ + '\n')
| true |
06e66463d30b791139072b5cb24b9ccdb77cc4ae | GitMark0/wow-auction-tool | /generate_token_export_ah_data_CSV.py | UTF-8 | 3,203 | 2.640625 | 3 | [] | no_license | import requests
from requests.auth import HTTPBasicAuth
import re
import csv
# https://wow-query.dev/
CLIENT_ID = '4765849c9d3a4ae7a1132515105cba14'
CLIENT_SECRET = 'WZrsyckvjFLXVyNxEnGKCuS3is8I5Spw'
def get_ah_data(server_id, access_token, save_as_csv=False):
# Request for AH data of specific server_id
ah_... | true |
df73bd0ee95c5535617023d3ee1d87873ca8e745 | jwh5566/learn_python3 | /chapter2/encoding.py | UTF-8 | 351 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
__title__ = ''
__author__ = 'JWH5566'
__mtime__ = '2016/3/24'
s = 'my name is 蒋文华'
print(type(s))
encoded_s = s.encode('utf-8') # 编码
print(encoded_s)
print(type(encoded_s)) # 编码之后是字节类型
orgin_s = encoded_s.decode('utf-8') # 解码
print(orgin_s)
print(type(orgin_s))
| true |
c949ee041a084f197e03207af4dfc72fc70166ba | mn113/adventofcode2016 | /day01.py | UTF-8 | 2,679 | 3.359375 | 3 | [] | no_license | #! /usr/bin/env python
# Find grid location from a list of turns and steps
import sys
input = "R4, R1, L2, R1, L1, L1, R1, L5, R1, R5, L2, R3, L3, L4, R4, R4, R3, L5, L1, R5, R3, L4, R1, R5, L1, R3, L2, R3, R1, L4, L1, R1, L1, L5, R1, L2, R2, L3, L5, R1, R5, L1, R188, L3, R2, R52, R5, L3, R79, L1, R5, R186, R2, R1, L3... | true |
5a88cfcfc5cc6514e091c699315dbe67b1b62eb2 | Rosert2019/NordHealth | /shops/views.py | UTF-8 | 2,309 | 2.578125 | 3 | [] | no_license | from django.shortcuts import render, get_object_or_404
from .forms import searchForm, addForm
from .models import Product
from django.utils.text import slugify
from cart.forms import CartAddProductForm
#To render searched products
def productView(request):
#we wearch inside available products
products = Prod... | true |
2ff81825db2f312e8deb95c9833c8b778573b390 | ghyhoiu/learn-python | /2.oop/01.py | UTF-8 | 610 | 4.125 | 4 | [] | no_license |
'''
定义一个学生类,用来形容学生
'''
# 定义一个空的类
class Student():
# 一个空壳;pass代表直接略过
pass
# 定义一个对象
xiaoming = Student()
# 定义一个类, 用来描述听课的学生
class ListenStudent():
name = None
age = 18
crouse = "python"
def DoHomework(self):
print ("正在学习")
# 推荐在函数末尾使用return
return None
# 实例化一个叫xiaohong 的学... | true |
1170b57d709eaf146decec74d3c5b7111e9404c8 | ice871117/python_all | /tensorflow/train_audio_category/doLearning.py | UTF-8 | 6,404 | 2.8125 | 3 | [] | no_license | '''
Using CNN to mark audio piece tags among given ones.
'''
import tensorflow as tf
import numpy as np
from datasource import DataSource
import time
import os
# Parameters
WORKING_PATH = "/Users/wiizhang/Documents/python_scripts/tensorflow/train_audio_category/downloaded_programs"
TEST_PATH = "/Users/wiizhang/Docume... | true |
5b8e79bede44bca2614548d3658f0c8696fe6b7a | hkLolgast/SVV1-A32 | /forces_x.py | UTF-8 | 2,230 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 22 14:22:48 2016
@author: Marc CB
"""
import numpy as np
import matplotlib.pyplot as plt
import main as mn
#import structuralAnalysis as sa
if __name__=="__main__":
# input data
fh = 1.8
R = 2.0
ts = 0.003
tf = 0.02
hst = 0.015
wst = 0.02
... | true |
b0e8e77d26ee7c20f61334d68128ab246b3a40a1 | MarineLasbleis/Magnetic_Field | /Observations/MF_Observations.py | UTF-8 | 12,085 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 22 18:47:35 2018
@author: irenebonati
"""
import matplotlib.pyplot as plt
import numpy as np
from numpy.polynomial.polynomial import polyfit
from matplotlib import colors
font = {'family' : 'normal',
'weight' : 'normal',
'color' ... | true |
c2fc65ed8251f0eed5e0c9d451042d4cfb442387 | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_1/Rambro/one.py | UTF-8 | 421 | 3.40625 | 3 | [] | no_license | def doIt(n) :
if n == 0 :
return "INSOMNIA"
numbers = [0,1,2,3,4,5,6,7,8,9]
i = 1
while len(numbers) > 0 :
x = i * n
remv = list(str(x))
for r in remv :
r = int(r)
if r in numbers :
numbers.remove(r)
i+=1
i-=1
return str(n*i)
numOfCases = int(input())
cases = []
for i in range(numOfCases) :
c... | true |
b1688bf755d8a555b119a78cee5ca15b07269b84 | bobvo23/Federated-Learning-PyTorch | /src/models.py | UTF-8 | 4,891 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python version: 3.6
from torch import nn
import torch.nn.functional as F
import configs.config as cf
class MLP(nn.Module):
#Modeling after the FedAvg Model to compare the performance
#2 hidden layers with 200 hidden units each
def __init__(self, dim_in, dim... | true |
499f04335923f94544430eeddf818d27f19c7cf6 | hmunduri/MyPython | /dict/ex12.py | UTF-8 | 167 | 3.6875 | 4 | [] | no_license | #Python program to remove a key from a dictionary
import sys
myDict = {'a':1, 'b':2, 'c':3, 'd':4}
print(myDict)
if 'a' in myDict:
del myDict['b']
print(myDict)
| true |
b3ba8de5615cf34381c2456e6624879e951fd6ac | LeapTruTime/ScriptsAndCommands | /bufferOverflow/pop3.py | UTF-8 | 509 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python
import socket
# Create an array of buffers, from 1 to 5900, with increments of 200.
buff = ["A"]
counter = 100
while len(buff) <= 30:
buff.append("A"*counter)
counter=counter+200
for string in buff:
print "Fuzzing PASS with %s bytes" % len(string)
s=socket.socket(socket.AF_INET, socke... | true |
f15bc2fa0a1ebff59f850f7fd7f03e955736f1cd | ashurellsworth/cse210-tc06 | /mastermind/game/guess.py | UTF-8 | 216 | 3.09375 | 3 | [] | no_license | class Guess:
"""Keep track of the guesses"""
def __init__(self, guess):
"""Comment"""
self._guess = guess
def get_guess(self):
"""Returns the guess"""
return self._guess
| true |
2c5bb39a55693e36edd4e4b167d61a100cdb333d | JATIN-RATHI/howSEARCHengineWORKS | /search engine working.py | UTF-8 | 1,297 | 4.125 | 4 | [] | no_license | def counter(string1, string2):
#here words1 = search and words2 = doc . Both are split word by word and compared word by word using nested for loop and counts the matches found.
words1 = string1.split(" ")
words2 = string2.split(" ")
count = 0
for word1 in words1:
for word2 in words2:
... | true |
0a7a7dcddfe96d44c8bf3165f1a6835744e78312 | jao11/curso-em-video | /mundo01/aula010/des035.py | UTF-8 | 441 | 4.375 | 4 | [] | no_license | '''
Desenvolva um programa que leia o comprimento de três retas e diga ao usuário se elas
podem ou não formar um triângulo.
'''
print('Digite o tamanho das suas retas abaixo:')
r1 = float(input('reta 1:'))
r2 = float(input('reta 2:'))
r3 = float(input('reta 3:'))
g = r1 + r2
p = r1 - r2
if g > r3 > abs(p):
... | true |
b0ae5cbfa2af00fcd0a5ef058cbc4e98614b3aa8 | morganabbitt/Regression-Analysis | /modeling/modeling.py | UTF-8 | 3,458 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 17 09:10:12 2020
@author: walke
"""
import scipy.stats as stats
import matplotlib.pyplot as plt
import matplotlib.style as style
import numpy as np
import pandas as pd
import seaborn as sns
import math
style.use('seaborn')
sns.set_style(style='darkgrid')
import statsmod... | true |
3d4ee1acdcbfd412b1064796728381a2c2ea57d6 | dch2333/millionhero | /millionhero.py | UTF-8 | 1,917 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python3
#coding=utf-8
import os
from PIL import Image
from aip import AipOcr
def get_screenshot() :
os.system('adb shell screencap -p /sdcard/herodch.png')
os.system('adb pull /sdcard/herodch.png')
def crop_img(img_name = 'herodch.png', crop_name = 'cropdch.png') :
img = Image.open(img_name)
... | true |
a85435a4ce6715047a3ab97805e064aee3e11219 | andysai/python | /黑马程序员-python/python从0开始学编程/day09/01-了解函数.py | UTF-8 | 361 | 2.671875 | 3 | [] | no_license | """
目标
函数的作用
函数的使用步骤
函数的参数作用
函数的返回值作用
函数的说明文档
函数嵌套
"""
def name():
print(' 请选择服务项目 ')
print(' 查询明细 查询')
print(' 更改密码 取款')
print(' 存款 转账')
name() | true |
7b63bec58c7a826b1ddad7870df67598868bd355 | smsxgz/dailyprogrammer | /LYNE/solver_v6.py | UTF-8 | 5,893 | 3.4375 | 3 | [] | no_license | """
S for square
T for triangle
D for diamond
"""
from collections import defaultdict
DIRECTIONS = {
(1, 1): '↘',
(1, 0): '↓',
(1, -1): '↙',
(0, 1): '→',
(0, -1): '←',
(-1, 1): '↗',
(-1, 0): '↑',
(-1, -1): '↖'
}
class Node:
def __init__(self, ch):
if ch.isupper():
... | true |
97fd41444edd1b568a09a47dd8121a3dd674bd34 | mozilla/spiderflunky | /spiderflunky/parser.py | UTF-8 | 5,051 | 2.75 | 3 | [] | no_license | import codecs
import os
import re
import subprocess
import tempfile
from functools import partial
import simplejson as json
class JsReflectException(Exception):
"""Raised when something goes wrong with parsing using Reflect.parse"""
def __init__(self, value, line=None):
self.value = value
se... | true |
1eb314e985d235f95ffc933a038358f75fe5e91e | ikaros274556330/my_code | /python_1000phone/语言基础-老师代码/day10-函数进阶1/code/02-homework.py | UTF-8 | 2,547 | 4.4375 | 4 | [] | no_license | """__author__=余婷"""
# 3.输入用户名,判断用户名是否合法(用户名中只能由数字和字母组成)
user_name = 'Abc=123'
for char in user_name:
if not (char.isalpha() or char.isdigit()):
print('%s不是合法用户名' % user_name)
break
else:
print('%s是合法用户名' % user_name)
# 4.输入用户名,判断用户名是否合法(用户名必须包含且只能包含数字和字母,并且第一个字符必须是大写字母)
user_name = 'Gabc123'
... | true |
beca5755a5844c8aa7ed28e68b52fde6d8b006cc | bigbes/world | /data.py | UTF-8 | 3,982 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
#
# Generate Tarantool database to contain feed/filter/limit/cap data
# for a randomized workload.
#
import os
import sys
import time
import random
import datetime
output_fname_db = 'db.lua'
output_fname_wl = 'wl.lua'
request = "box.insert('lists', '{0}', '{1}', {2});\n"
def init_filters():
... | true |
fcb2e86dca6e5fdc9dd0e085014ce8d7288418f8 | tsui-david/tzu-chi-cs-class | /class13-2d-drills/drills.py | UTF-8 | 1,001 | 4.28125 | 4 | [] | no_license | def example():
return 'wow!'
def ex1(twoDArray):
"""
given a 2-d array, return the first row of the 2-d array
"""
def ex2(twoDArray, n):
"""
given a 2-d array, return the n-th row of the 2-d array
"""
def ex3(a, i, j):
"""
given a 2d array return the jth element of the ith array
... | true |
84de36b3d1594bdccb5c62b170e0f0b1f16cc12b | kayleesg/GuessTheNumberPython | /guess.py | UTF-8 | 1,458 | 4.84375 | 5 | [] | no_license | #This is a guess the number game for Python3
import random
print('\nWelcome to Guess the Number\nA Simple Python3 Game made by:\nKaylee SG\nSee more stuff she\'s made on her github or visit her blog at\nkayleesg.github.io/kayleesgblog\n\n')
pName = input('Let\'s begin! What is your name?\n') #Player's Name
guesses... | true |
5ad25236d4b9d8e74d808d5e1d86c8690cd8893a | swooton/Network-Automation | /1_final.py | UTF-8 | 1,457 | 4.75 | 5 | [] | no_license | #This is your first Python Subscription
# After each step save your script as "1.py" and run it in a virtual environment
# 1. Write code to print your name to the screen
# 2. Make a variable with your full name and print the variable
# 3. Make another variable with called "age" with your age and print it
# 4. Make anot... | true |
c091c6efca47346e59a9dbc27a639f6e2299925c | emonansar/URI-Solution-in-Python | /1080.py | UTF-8 | 132 | 3.09375 | 3 | [] | no_license | #1080
n=int(input())
s=0
for i in range(1,100):
n=int(input())
if(n>s):
s=n
c=i
print(s)
print(c+1) | true |
5935107fcd6257903734ed096334e7406c171d29 | sabay-digital/org.ssn.doc.public | /examples/python/signature.py | UTF-8 | 689 | 2.609375 | 3 | [] | no_license | from stellar_base.keypair import Keypair
import hashlib
def hash():
mesg = "Some message"
# Hash
h = hashlib.sha256()
h.update(mesg.encode())
print(h.hexdigest())
def sign(hash):
# GDMG5Z4XL3CNGHK2GJD5TFIDRWRCBFVFV3WAFWFSBONWB6AKDODILHFZ
kp = Keypair.from_secret("SDWMABEXMM... | true |
099bd85d6513ee0149680150689fee0207d62083 | dslvkbot/waterbot | /GUIClasses/Order.py | UTF-8 | 490 | 2.765625 | 3 | [] | no_license | class Order:
def __init__(self, room=None, time=None, count=None, type_of_payment=None):
self.room = room
self.time = time
self.count = count
self.type_of_payment = type_of_payment
def change_room(self, room):
self.room = room
def change_time(self, time):
se... | true |
af9a69166b2dc466e75bdede170e1430fd86f934 | Retrosol/PokemonPrismPikasav | /rssav.py | UTF-8 | 30,164 | 2.53125 | 3 | [] | no_license | """
Created on 26/06/2011
@author: Ritchie
"""
class RSSav:
def __init__(self, file, repair = False):
self.firsttime = True
self.version = 'Ruby/Sapphire'
self.ok = repair
self.repair = repair
self.maps = []
table = [''] * 256
etable = [''] * 256
ta... | true |
3c3557354ef9fb74645b40580fcf792097f48bb3 | leonardoaraujosantos/Variational_AutoEncoder | /src/notebooks/tensorflow/handle_data.py | UTF-8 | 8,536 | 2.8125 | 3 | [] | no_license | import scipy.misc
import random
import h5py
import lmdb
import numpy as np
import tensorflow as tf
from augment_batch import AugmentBatch
class HandleData:
__xs = []
__ys = []
__file = []
__file_val = []
__dataset_imgs = []
__dataset_label = []
__dataset_imgs_val = []
__dataset_label_va... | true |
56bfd4db6d5e867fded15130cef1b39f7d292fd3 | mihalw28/library_books | /tests.py | UTF-8 | 2,643 | 2.875 | 3 | [
"MIT"
] | permissive | import unittest
from flask_testing import TestCase
from app import db
from flask import current_app, url_for, Flask, request
from app.models import Book, Author, Category
from config import Config
from flask_sqlalchemy import SQLAlchemy
class TestConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = "sqlit... | true |
c861e4bdb6e64baf3b814473be23fd53a43bca3e | SunmoonSan/Robots | /maple/mooc/week2/university_sort.py | UTF-8 | 1,324 | 3.359375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import bs4
def get_html_text(url):
"""
获取url对应的html文本
:param url:
:return: html文本
"""
try:
r = requests.get(url)
r.raise_for_status()
r.encoding = r.apparent_encoding
return r.text
except:
return ""
def... | true |
04a97002ec11b0dfc5dfa27b281ef9eee0269821 | ojhaanshu87/LeetCode | /541_reverse_string_after_k.py | UTF-8 | 1,071 | 3.96875 | 4 | [
"Unlicense"
] | permissive | '''
Given a string s and an integer k, reverse the first k characters for every 2k characters counting from the start of the string.
If there are fewer than k characters left, reverse all of them. If there are less than 2k but greater than or equal to k characters,
then reverse the first k characters and left the oth... | true |
c5efb7dd5c2b28c20f910924bd3ccab3b27c7234 | s444427/Algorithms---Tasks-from-sites | /Colored graph.py | UTF-8 | 609 | 2.96875 | 3 | [] | no_license | n, m = input(). split(' ')
n, m = int(n), int(m)
Graph = []
Cost = []
# Macierz incydencji
for i in range(0, n+1):
sub = []
for j in range(0, n+1):
sub.append(int(0))
Graph.append(sub)
# uzupełnianie macierzy danymi
for i in range(0, m):
x, y, c = input().split()
x, y = int(x), int(y)
... | true |
da9b315ec3e5c1cba77a37482d66bba9b6090fe7 | sattosan/hello_fastapi_graphql | /api/main.py | UTF-8 | 662 | 2.59375 | 3 | [] | no_license | import graphene
from fastapi import FastAPI
from starlette.graphql import GraphQLApp
# Grapheneを利用したGraphQLスキーマを作成する
class Query(graphene.ObjectType):
# 引数nameを持つフィールドhelloを作成
hello = graphene.String(name=graphene.String(default_value="stranger"))
# フィールドhelloに対するユーザへ返すクエリレスポンスを定義
def resolve_hello(s... | true |
df6f8183b58e35781271edf39bdd43c5805aed0b | MelodyChu/Juni-Python-Practice | /linear_sort.py | UTF-8 | 599 | 3.671875 | 4 | [] | no_license | """a = [4,3,5,1,2]
def linsort(a):
newlist = []
while len(a) > 0:
result = a[0]
for i in a:
if i < result:
result = i
print(a)
print(result)
a.remove(result)
newlist.append(result)
return newlist
print (linsort(a))
"""
a = [4,5,3,8... | true |
d50377040e6276b79e5296f6c334789c90918620 | SuanFaRuoJi/coding_exercises | /leetcode/315_count_of_smaller_numbers_after_self/zkj_python.py | UTF-8 | 1,132 | 3.09375 | 3 | [] | no_license | class Solution:
def countSmaller(self, nums: List[int]) -> List[int]:
self.ans = [0] * len(nums)
nums = list(enumerate(nums))
from collections import deque
def merge(nums):
nums = list(nums)
if len(nums) <= 1:
return deque(nums)
ar... | true |
4f23b885c0436033db149d4191f901737f01758b | guardiaocl/python-serialport-guardiao | /main.py | UTF-8 | 705 | 2.78125 | 3 | [] | no_license | import serial
import urllib2
__author__ = 'Guardiao Cloud'
apiKey = "xxxxxxxx-yyyy-zzzz-wwww-kkkkkkkkkkkk" #@todo Alterar Numero da API Key
serialKey = "GUC0001" #@todo Alterar numero de serie do dispositivo de Coleta
serialPort = '/dev/ttyS0' #@todo Alterar caminho da porta Serial do Arduino
if __name__ == '__main_... | true |
bd41fb98b858e08b8eb71475420179587c5ead75 | niemitee/mooc-ohjelmointi-21 | /osa07-06_salasanan_arpoja_2/src/salasanan_arpoja2.py | UTF-8 | 716 | 3.40625 | 3 | [] | no_license | # tee ratkaisu tänne
from string import ascii_lowercase, digits
from random import choice, shuffle
def luo_hyva_salasana(pituus: int, numerot_mukaan: bool, merkit_mukaan: bool):
salasana = []
erikoismerkit = '!?=+-()#'
arvontajoukko = ascii_lowercase
if numerot_mukaan:
salasana.append(choice(... | true |
3796321c760d9c8dd0d0dee55dc3d767b00d1e2a | xwang322/Coding-Interview | /asml/LC200NumberOfIslands.py | UTF-8 | 1,044 | 2.984375 | 3 | [] | no_license | class Solution(object):
def numIslands(self, grid):
if not grid or not grid[0]:
return 0
answer = 0
stack = []
m = len(grid)
n = len(grid[0])
for i in range(m):
for j in range(n):
if grid[i][j] == '1':
... | true |
9523b0cff6dc00d3f6280187237c66e6f919fc0d | c0rpse/leetcode | /quickSort.py | UTF-8 | 664 | 3.59375 | 4 | [] | no_license | import random
def swap(nums, x, y):
tmp = nums[x]
nums[x] = nums[y]
nums[y] = tmp
def partition(nums, start, end):
pivot_loc = start
pivot_val = nums[pivot_loc]
for index in range(start, end+1):
if nums[index] < pivot_val:
pivot_loc += 1
swap(nums, index, piv... | true |
17e834f38ca7d2fcf71a35127a8d0f163e165dff | zanbeel/my_previous_learnings | /timetable.py | UTF-8 | 474 | 3.671875 | 4 | [] | no_license | # for i in range(1,13):
# for j in range(1,13):
# print("{0} times {1} is {2}" .format(j,i, i*j))
# print('___________________________')
# shopping_list = ['milk' , 'eggs' , 'spam' ,'bread' ,'rice']
# for item in shopping_list:
# if item == "spam":
# continue
# print("Buy " + item )
... | true |
86cf97aba2703db83300be421d264b1f6edec175 | mleanh/tick-tac-toe | /tic tac toe.py | UTF-8 | 3,413 | 3.671875 | 4 | [] | no_license | # write your code her
counter = 0
user = ' '
all_coordinate = ['11', '12', '13', '21', '22', '23', '31', '32', '33']
def showcase():
print("---------")
print("| " + user[0] + " " + user[1] + " " + user[2] + " |")
print("| " + user[3] + " " + user[4] + " " + user[5] + " |")
print("| "... | true |
2118f2d26451f507e54286a4d6e55811f7e9c39e | NaiveteYaYa/data-structrue | /dp动态规划/股票问题/309. 最佳买卖股票时机含冷冻期.py | UTF-8 | 1,799 | 4.15625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/3/9 16:57
# @Author : WuxieYaYa
"""
给定一个整数数组,其中第 i 个元素代表了第 i 天的股票价格 。
设计一个算法计算出最大利润。在满足以下约束条件下,你可以尽可能地完成更多的交易(多次买卖一支股票):
你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。
卖出股票后,你无法在第二天买入股票 (即冷冻期为 1 天)。
示例:
输入: [1,2,3,0,2]
输出: 3
解释: 对应的交易状态为: [买入, 卖出, 冷冻期, 买入, 卖出]
链接:https://leetcode-cn.com... | true |
45d6879cfd5590a833aab5192b600329cb0efc25 | iSeaSoul/bc-problems | /BC_ProblemSet_2/PD/knn2_gen_test.py | UTF-8 | 645 | 2.828125 | 3 | [] | no_license | f = open('knn2_gen.in', 'w+')
def my_print(s):
try:
f.write(s + '\n')
except:
print s
import random
def get_random(L, R):
return int(random.random() * (R - L + 1)) + L
def gen():
n, m = 100000, 100000
my_print(str(n) + ' ' + str(m))
hash = {}
get_random(1, 100)
for i in xrange(n):
xi = get_random(1, 1... | true |
1b5c061c0fc4d1500465133dfda450bd26e290e2 | salvador-dali/algorithms_general | /__competitions/2015/06_20_epicCode/_06.py | UTF-8 | 313 | 2.8125 | 3 | [] | no_license | N, Q = map(int, raw_input().split())
mod = 10**9 + 7
arr = [0] * N
for _ in xrange(Q):
t, x, y = map(int, raw_input().split())
x -= 1
y -= 1
if t == 1:
for i in xrange(x, y + 1):
arr[i] = (arr[i] + (i - x + 1) * (i - x + 2)) % mod
else:
print sum(arr[x:y+1]) % mod
| true |
c6944487b9bcec9078a50165063956486dfbd2d0 | johndpope/GeLaTo | /tests/glt/test_1d.py | UTF-8 | 6,021 | 2.796875 | 3 | [
"MIT"
] | permissive | # coding: utf-8
import numpy as np
from numpy import linspace, zeros, pi
from sympy.core.containers import Tuple
from sympy import symbols
from sympy import Symbol
from sympy import Lambda
from sympy import Function
from gelato.glt import glt_symbol
from gelato.calculus import (Dot, Cross, Grad, Curl, Rot, Div, dx... | true |
c0b3b51a3fd1281be803b35936620fc7111938e5 | Drawiin/algoritmos-basicos | /Recursão/pares.py | UTF-8 | 275 | 3.21875 | 3 | [
"MIT"
] | permissive | def pares(lista):
if len(lista) == 1:
return 1 if lista[0] % 2 == 0 else 0
else:
n = pares(lista[1:])
return n+1 if lista[0] % 2 == 0 else n
if __name__ == "__main__":
lista = [int(i) for i in input().split()]
print(pares(lista))
| true |
ca777ace9990a7808dc9ea4415ec65c734a4dfcc | manolopajaro/DataCamp | /DeepLearning/keras.py | UTF-8 | 841 | 2.671875 | 3 | [] | no_license | # todo install keras
from keras.callbacks import EarlyStopping
from keras.optimizers import SGD
import keras
from keras.layers import Dense
from keras.models import Sequential
# Create the model: model
model = Sequential()
# Add the first hidden layer
model.add(Dense(50, activation='relu', input_shape=(784,)))
# Ad... | true |
a291f927d6f127b091b491d21dd4bbfc4efdbd49 | mohammadasim/rest_api_python | /passing_functions_decorator.py | UTF-8 | 1,950 | 4.59375 | 5 | [] | no_license | '''
Decorators is an advance python topic. Decorators allow you to decotate a function. Suppose we have a function and we want to add
extra functionality to it. There are two options first is to add extra code to the existing function, the problem is that as we have
modified the old function its functionality has cha... | true |
395784752811e40458d0c74da01fc5ddabd4c5cd | LuckKAnn/Visualization-based-on-Weibo | /Test/TestGetSex.py | UTF-8 | 1,851 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#导入需要使用的包
import re
import time
import xlrd #读取Excel文件的包
import xlsxwriter #将文件写入Excel的包
#打开一个excel文件
def open_xls(file):
f = xlrd.open_workbook(file)
return f
#获取excel中所有的sheet表
def getsheet(f):
return f.sheets()
#获取sheet表的行数
def get_Allrows(f,sheet):
table=f.sheet... | true |
d82e794a21ed08c918e5529691940d4b49e116a2 | KATO-Hiro/AtCoder | /Others/code_festival/CODE_THANKS_FESTIVAL_2017_A/ProblemB.py | UTF-8 | 314 | 2.8125 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | # -*- coding: utf-8 -*-
# CODE THANKS FESTIVAL 2017(Parallel)
# Problem B
if __name__ == '__main__':
s = input()
i = 0
count = 0
while len(s) > 0:
if s[i:] == s[i:][::-1]:
print(count)
exit()
else:
i += 1
count += 1
| true |
5e695a555c01aecafe5e9e007edf0cddc7c06000 | dmurraylaing/PythonLab | /SpriteViewer/SpriteViewer.py | UTF-8 | 1,134 | 3.65625 | 4 | [] | no_license | import os
from sprite import Sprite
# Support function definitions
def list_sprite_files(directory):
"""Get the list of sprite files from the current directory"""
files = os.listdir(directory)
sprite_files = []
for file in files:
if file.endswith(".sprite"):
sprite_files.append(dir... | true |
272bb8764f830766ff0e881cdef5a264ae50a3fb | AdamZhouSE/pythonHomework | /Code/CodeRecords/2820/60768/235409.py | UTF-8 | 206 | 3.4375 | 3 | [] | no_license | customers = int(input())
time = []
visit = []
for i in range(customers):
time.append(input().split(' '))
for e in time:
if e not in visit:
visit.append(e)
print(len(time) - len(visit) + 1) | true |
382ce0337cbdbdc650168fc3c5553193f093da2a | EdinburghGenomics/clarity_scripts | /tests/test_check_container_name.py | UTF-8 | 1,732 | 2.5625 | 3 | [
"MIT"
] | permissive | import pytest
from EPPs.common import InvalidStepError
from scripts.check_container_name import CheckContainerName
from tests.test_common import TestEPP, FakeEntitiesMaker
class TestCheckContainerName(TestEPP):
def setUp(self):
self.epp = CheckContainerName(self.default_argv + ['-x', 'ABC'])
self... | true |
5b70ed6ecff590c47c78d6773c5eb0387c5750a6 | ZHAOZHAOLIU/Leetcode | /Stack/Q21.py | UTF-8 | 1,137 | 4 | 4 | [] | no_license | #---Author: ZHAOZHAO LIU
#---Version:1.0
#---Date:27-09-2020
#考点:
#1.用Stack来进行查找,stack的特性是后进先出。push()/pop()/get_top()
#2.Stack可以直接使用Python中list的特性,list.append(),list.pop()
#implement:
#1.如果是左侧符号就压入list中,如果是右侧符号,就去list中比较最后一个元素与符号是否成对
#2.如果list为空,而符号还有,那就说明不匹配
#3.如果最后list不为空,也说明不匹配
#注意事项:
#1.时刻注意list为空的情况,可能只输入一个字符。
... | true |
0b4e38b0ea5bd84ca0fac776b5b94106ae229f0c | soumikopensource/miniprojects | /main.py | UTF-8 | 1,435 | 3.015625 | 3 | [] | no_license | #library and modules used
import requests
import configparser
from flask import Flask,render_template,request
# make the appp
app=Flask(__name__)
#landing page
@app.route('/')
#function for index page
def weather_dashboard():
return render_template('index.html')
'''
now we have to make a post request to get the z... | true |
c133628c84894ba053af65937fc4e0e559f673f2 | AlinGeorgescu/Problem-Solving | /Python/704_binary_search.py | UTF-8 | 475 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python3
import ast
def main() -> None:
nums = ast.literal_eval(input("Enter nums: "))
target = int(input("Enter target: "))
start = 0
end = len(nums) - 1
while start <= end:
mid = (start + end) // 2
if target == nums[mid]:
print(mid)
return... | true |
3a787b7523599bb496e2690441f77058712efc82 | nikolata/HBtasks | /week02/l2/sort/sort.py | UTF-8 | 2,071 | 3.75 | 4 | [] | no_license | #sort.py
def validate_entry(iterr,key = None):
if iterr== None:
raise TypeError('We need iterable')
if isinstance(iterr,tuple) == False and isinstance(iterr,list)== False:
raise TypeError('Iterable should be tuple or list')
if isinstance(iterr[0],dict) == False:
if key != None:
raise TypeError('Key can ... | true |
0589ab6797b28edaa6834f078959dcf36fca5e0c | Pavlmir/python-basics-geekbr | /Lesson_2_types_and_operations/les_2_task1.py | UTF-8 | 1,058 | 4.21875 | 4 | [] | no_license | # 1. Создать список и заполнить его элементами различных типов данных.
# Реализовать скрипт проверки типа данных каждого элемента. Использовать функцию type() для проверки типа.
# Элементы списка можно не запрашивать у пользователя, а указать явно, в программе.
array = ["Строка", 45, (1, 2), {"Молоко": "Молочный продук... | true |
4f7acb690b38d78daa98db9b5778728d86f9259f | VMBoehm/Revealing-Ferroelectric-Switching-Character-Using-Deep-Recurrent-Neural-Networks | /codes/analysis/rnn.py | UTF-8 | 11,749 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | """
Created on Tue Oct 09 16:39:00 2018
@author: Joshua C. Agar
"""
import keras
from keras.models import Sequential, Input, Model
from keras.layers import (Dense, Conv1D, Convolution2D, GRU, LSTM, Bidirectional, TimeDistributed,
Dropout, Flatten, RepeatVector, Reshape, MaxPooling1D, UpSampli... | true |
90749fc558efd449cb14d6522f3517fc05f1cfc4 | albahmed23/plastic_bottles_sorting_ai | /tensorflow_hub_object_detector_sample/general_obj_detection_sample.py | UTF-8 | 7,327 | 2.875 | 3 | [] | no_license | #@title Imports and function definitions
# For running inference on the TF-Hub module.
import tensorflow as tf
import tensorflow_hub as hub
# For downloading the image.
import matplotlib.pyplot as plt
import tempfile
from six.moves.urllib.request import urlopen
from six import BytesIO
# For drawing onto the image.
... | true |
1f27bb9d28b64729c31574083457f96d7c1bdd62 | shmunb/DES | /des_lib.py | UTF-8 | 5,945 | 2.59375 | 3 | [] | no_license | import read_lib as r
import conversion_lib as con
import os.path
import random
def encrypt_func(R, k):
ERn = con.E_expansion(R) ^ k
ER = f'{ERn:048b}'
Bend = ''
for t in range(8):
B = (ER[6*t:6*(t+1)])
a = int(B[0] + B[5], 2)
b = int(B[1:5], 2)
s = f'{con.... | true |
dfeec5adbbf6d19615b278518f9b72903559c1c9 | GoodaPenguinz/Coursera | /exercise_2.py | UTF-8 | 537 | 4.03125 | 4 | [] | no_license | # Printing "Goodbye" with a global message variable
###################################################
# Student should enter function on the next lines.
def set_goodbye():
global message
message = "Goodbye"
print message
###################################################
# Tests
message = "Hello... | true |
ee823e9321c6c3b02b8b5405604eba2a246ce83b | jkms/ProjectEuler | /problem2.py | UTF-8 | 259 | 3.671875 | 4 | [] | no_license | #!/usr/bin/env python
fib = [1,2]
count = 0
while (fib[-1]+fib[-2])<4000000:
fib.append(fib[-1] + fib[-2])
print fib
for i in range(0,len(fib)):
if fib[i-1] % 2 == 0:
print "%d is even" % fib[i-1]
count += fib[i-1]
print "The answer is %d" % count
| true |
859561e433a68e12281c608a9930505db06653a7 | gerglion/ProjectEuler | /Problem_3/problem3.py | UTF-8 | 1,013 | 4.1875 | 4 | [] | no_license | #!/usr/bin/python3.4
# Project Euler:
# Problem #3: Largest Prime Factor
# The prime factors of 13195 are 5,7,13, and 29.
#
# What is the largest prime factor of the number 600851475143
#
# Answer: 6857
import math
def generate_primes(max):
primes = [2]
for i in range(2,max+1):
is_prime = True
... | true |
8b0544e14298a185383289a732abd57e55603f32 | wildtangent/raspi-reaction-game | /reaction-step7.py | UTF-8 | 2,136 | 3.921875 | 4 | [] | no_license | #!/usr/bin/python
import RPi.GPIO as GPIO
import time
import random
# Basic GPIO setup
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# Set pin assignments
led = 4
buzzer = 18
rightButton = 14
leftButton = 15
leftScoreLeds = [10,9,11]
rightScoreLeds = [18,22,23]
# Set up game variables
leftScore = 0
rightScore = 0
... | true |
7d6488ee91d2f46df9fb050aea5d8552c9dc1498 | ThomasEA/MachineLearning_2 | /Metaheuristic/genetic_algorithm_and_mlp.py | UTF-8 | 2,106 | 3.65625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 3 21:37:03 2018
@author: alu2015111446
Algoritmo genético para ajustar hiperparâmetros de MLP
Número de camadas ocultas. Mínimo 1 e máx 3
Representação binária. Tamanho máximo 2, pois é o valor máximo (11)
Número de neurônios. Mínimo 1 e máx 1000
Representação binári... | true |
90a7fd4d7939a5ebfdc9dd35fac3f04595a9e448 | metheoryt/itstep-python | /4_flow_functions/a_control_flow.py | UTF-8 | 1,271 | 3.8125 | 4 | [] | no_license | """
Управление потоком выполнения
Условия и циклы - подробнее
"""
users = {'fred': 'active', 'josh': 'inactive'}
# Изменение словаря в процессе итерации по нему
# вариант: итерироваться по копии словаря
for user, status in users.copy().items():
if status == 'inactive':
del users[user]
# вариант: создать ... | true |