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 |
|---|---|---|---|---|---|---|---|---|---|---|
05731486f8e562392e8cd4c2a4053d409828d7bb | prositen/advent-of-code | /python/src/y2016/dec08.py | UTF-8 | 1,819 | 3.71875 | 4 | [] | no_license | import re
class Screen(object):
def __init__(self, width, height):
self.width = width
self.height = height
self.rows = [['.'] * self.width for _ in range(self.height)]
def rect(self, x, y):
for _y in range(y):
self.rows[_y][:x] = ['#'] * x
def rotate_column(... | true |
54629248ae718e1fdd6b39dce3888434392b9c1e | Aurametrix/HDFS | /calling_linear_pig.py | UTF-8 | 3,661 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import os
import sys
import shutil
import random
import tempfile
import Queue
from org.apache.pig.scripting import Pig
from org.codehaus.jackson.map import ObjectMapper
EPS = 10e-6 # maximum distance between consective weights for convergence
pig_script = sys.argv[1] # pig scr... | true |
e2956d5ac8110b1574c8ea962dc4ed474080338b | AdityaGujrati/AIJarvis | /test.py | UTF-8 | 3,321 | 2.671875 | 3 | [] | no_license | import speech_recognition as sr
import pyttsx3
import datetime
import wikipedia
import webbrowser
import os;
import smtplib
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
def speak(audio):
engine.say(audio)
engine.runAndWait()
de... | true |
7259fb6b8a828ad5a8b9f65d6e3dfcf8e3279fcb | stevelimyh/Lidar_Backpack_ISAAC_SDK | /packages/rl/py_components/soft_actor_critic.py | UTF-8 | 12,291 | 2.5625 | 3 | [] | no_license | '''
Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related docu... | true |
85a4bcf46d59378dbf1a7e9c8258f384af4ec4e9 | reubentg/545finalProject | /extras/colourfilter.py | UTF-8 | 3,815 | 2.765625 | 3 | [
"MIT"
] | permissive | import numpy as np
import cv2
from matplotlib import pyplot as plt
# Initialize plot line object(s). Turn on interactive plotting and show plot.
lw = 3
alpha = 0.5
bins = 256
resizeWidth = 50
cap = cv2.VideoCapture(1)
# Initialize plot.
# fig, ax = plt.subplots()
# ax.set_xlabel('Bin')
# ax.set_ylabel('Frequency')
... | true |
7ca1f3b8a82c981ff0f4cf37ef0dee2cdb2aad74 | FoxRobotLab/catkin_ws | /src/qr_seeker/scripts/turtleQR.py | UTF-8 | 17,257 | 2.84375 | 3 | [] | no_license | # !/usr/bin/env python
""" ========================================================================
turtleControl.py
Created on: June 2016
The turtleControl.py file borrows code from TurtleBot.py in speedy_nav.
Four classes: one for the TurtleBot object, and then three thread classes -
MovementControlThr... | true |
3a69886b36be1542c01882152b8275af3ffe7b86 | brakdag/cursoBasicopython | /src/conversion.py | UTF-8 | 137 | 3.890625 | 4 | [
"MIT"
] | permissive | valor = input("ingrese la medida en cm: ")
valor_pulgadas = int(valor) / 2.54
print(valor + "cm = " + str(valor_pulgadas) + " pulgadas")
| true |
33bc86e0c3187123f9d06754d90b169f1b7a3721 | kekkaishi1/algorithm | /graph.py | UTF-8 | 2,339 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
__Author__ = 'Lin Xin'
class Vertex:
def __init__(self, key):
self.id = key
self.connectedTo = {}
self.color='white'
def addNeighbor(self, nbr, weight=0):
self.connectedTo[nbr] = weight
def __str__(self):
return str(se... | true |
f8c33c43db8bb924496bd0a033c4cb5f27d974c9 | fpem123/programmers_challenges | /Level 2/숫자의_표현.py | UTF-8 | 344 | 3.390625 | 3 | [] | no_license | def solution(n):
answer = 0
cur = n
while cur != 0:
tmp = 0
for num in range(cur, 0, -1):
tmp += num
if tmp == n:
answer += 1
break
elif tmp > n:
break
cur -= 1
... | true |
fe831d92ba76d57dbf29446d77788ae8de768df6 | nimra/module_gen | /nodes/Geron17Hands/B_PartI/C_Chapter3/C_PerformanceMeasures/E_TheROC/index.py | UTF-8 | 7,191 | 3.5 | 4 | [] | no_license | # Lawrence McAfee
# ~~~~~~~~ import ~~~~~~~~
from modules.node.HierNode import HierNode
from modules.node.LeafNode import LeafNode
from modules.node.Stage import Stage
from modules.node.block.CodeBlock import CodeBlock as cbk
from modules.node.block.HierBlock import HierBlock as hbk
from modules.node.block.ImageBlock ... | true |
85f4ebc9663204377a533be4a89ebe04b44cafc7 | dmonisankar/pythonworks | /DataScienceWithPython/sample_python_code/statistic/stat6.py | UTF-8 | 569 | 3.1875 | 3 | [] | no_license |
import numpy as np
versicolor_petal_length = [ 4.7, 4.5, 4.9, 4. , 4.6, 4.5, 4.7, 3.3, 4.6, 3.9, 3.5, 4.2, 4. , 4.7, 3.6, 4.4, 4.5, 4.1, 4.5, 3.9, 4.8, 4. ,4.9, 4.7, 4.3, 4.4, 4.8, 5. , 4.5, 3.5, 3.8, 3.7, 3.9,5.1, 4.5, 4.5, 4.7, 4.4, 4.1, 4. , 4.4, 4.6, 4. , 3.3,4.2, 4.2, 4.... | true |
88a2e7d7456d3838812c16716ea07976fac57d6c | tushara21/evolutionary_algorithm_task | /Source/init_challenge.py | UTF-8 | 5,787 | 3.28125 | 3 | [] | no_license | import numpy as np
from numpy import exp, linspace, random
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
import itertools
def data_generator(n, data, al, be, ga, de):
# This function is used to generate ground
# truth data based on the given function
# First subplot is f(x) against... | true |
772ba506c1d2e92cd97a5688dd170e2661448d83 | SimonClo/Projet-Artefact-actualit- | /data_access/article_filtering.py | UTF-8 | 1,655 | 2.53125 | 3 | [] | no_license | import logging
import pickle as pkl
import os
import sys
import argparse
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from utils.models import RawArticle
from data_access.db_access import Client
logger = logging.getLogger(__name__)
def main(inpath, outpath, host, port, user, pas... | true |
e0b4c02c09d34a6bdb0afffc12116780fc6a0ec3 | sazad44/holbertonschool-higher_level_programming | /0x0A-python-inheritance/100-my_int.py | UTF-8 | 245 | 3.203125 | 3 | [] | no_license | #!/usr/bin/python3
"""100-my_int module"""
class MyInt(int):
"""MyInt Class"""
def __eq__(self, other):
"""eq magic method"""
return False
def __ne__(self, other):
"""ne magic method"""
return True
| true |
deadbe7151a2cefba7b0084d3ec584a12b46a153 | TonyPeng2003/chapter2 | /w4/upper.py | UTF-8 | 35 | 2.859375 | 3 | [] | no_license | name = "Tony peng"
print(name.upper()) | true |
1d85c9ff7db506c7e6960a3d520b134504f0ec9b | foolishmortalbuilders/magicband_ears | /code.py | UTF-8 | 3,603 | 2.859375 | 3 | [] | no_license | # MagicBand Mickey Ears
# ---------------------
#
# For Gemma M0 : https://www.adafruit.com/product/3501?gclid=Cj0KCQjwpZT5BRCdARIsAGEX0zl4OEKc4IAJXweQIeZnpAiHyY5jYQUWC_LiUFC0w9iMBu3qW6IjqlUaAp9-EALw_wcB
# YouTube Build Video:
#
# Code is loosely based on our previous MagicBand reader code
# Contact us with any questi... | true |
6037a546b13453c74f78242a73faeee425aed23b | nnay13/PyqT-Repo | /caesar.py | UTF-8 | 1,651 | 4.375 | 4 | [] | no_license | """Implements the simple CAESAR Cipher
"""
# list of characters available for the message
SYMBOLS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 !?."
def main():
"""Main loop"""
my_message = input("Message à Cypter: \n")
my_key = int(input("Clef de Cryptage : \n"))
print("Message ... | true |
50a297f16fe661239993571e5728ff49b2c58479 | catalys1/tiger-identification | /identify/visualization/viewtokenchanges.py | UTF-8 | 769 | 2.6875 | 3 | [] | no_license | import torch
import argparse
import matplotlib.pyplot as plt
def diff_image(tokens, model):
tok = torch.load(tokens)
w = torch.load(model, map_location='cpu')
w = w['ssd.weight']
diff = torch.abs(w - tok).squeeze_().view(8, 8, 19, 19).permute(0,2,1,3)
diff = diff.contiguous().view(8 * 19, 8 * 19)
... | true |
aad8f527a8a8550cb9d95467a25d0b57f77e8189 | jongwoo-ha/tensorflow-lecture | /reference/04-neural_network_basic/01-xor_logistic_regression.py | UTF-8 | 1,149 | 2.796875 | 3 | [] | no_license | import tensorflow as tf
tf.set_random_seed(0)
x_data = [[0, 0],
[0, 1],
[1, 0],
[1, 1]]
y_data = [[0],
[1],
[1],
[1]]
steps = 2000 # 10000
learning_rate = 0.1
X = tf.placeholder(tf.float32, shape=[None, 2])
Y = tf.placeholder(tf.float32, s... | true |
88243b14117390a0cd1ff88381c30dba8957c8a2 | dlittleton/aoc2020 | /13/13-2.py | UTF-8 | 574 | 3.15625 | 3 | [] | no_license | _ = input()
schedule = input().strip().split(',')
bus_gaps = []
gap = 0
for s in schedule:
if s != 'x':
bus_gaps.append((int(s), gap))
gap += 1
def find_first_match(bus, start, step):
while (start + bus[1]) % bus[0] != 0:
start += step
return start
def get_period(bus, start, ste... | true |
dacc2c61b603fe20036716cf7bba5a081050f977 | ifmelchor/volcano_ML-UNSAM | /utils/wavelet/read_dataset2.py | UTF-8 | 3,036 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Transformada de wavelet de una señal LP
@author: Ivan Melchor (ifmelchor@unrn.edu.ar)
"""
import pandas as pd
from scipy import signal
import numpy as np
import matplotlib.pyplot as plt
import pywt
json_file = '../dataset/MicSigV1_v1_1.json'
df = pd.read_json(json_f... | true |
1b9b9b067f0ed3f487e5eac6ca1a884cba3c9b1a | Fclem/isbio2_old | /isbio/breeze/utils.py | UTF-8 | 5,469 | 2.53125 | 3 | [] | no_license | """
This module contains a set of utilities functions related to Breeze and Django
and also some general utilities functions
This modules imports :
drmaa (if available, set to None otherwise), job_stat_class as an alias to drmaa.JobState or
a replacement class if drmaa is not available
from django :
_ settin... | true |
275e37e35a6dbeaab3a0dc4eb9b33ff1cff157f4 | apurvaumredkar/Object-Oriented-Programming-Lab | /expt 14- matplotlib.py | UTF-8 | 318 | 3.15625 | 3 | [] | no_license | from matplotlib import pyplot as plt
import numpy as np
#question 1
x = np.linspace(0,10,100)
c1 = np.cos(x)
c2 = np.cos(x+1)
c3 = np.cos(x+2)
fig,ax = plt.subplots(nrows = 3)
ax[0].plot(x,c1)
ax[1].plot(x,c2)
ax[2].plot(x,c3)
plt.show()
#question 2
fig2,ax2 = plt.subplots(ncols = 3)
d1 = np.random.random((10,10))
| true |
cab6f849a4a89150c4bbe238587e1cdc0314dd1d | VikasChhapola/SandySearch | /final_draft_search.py | UTF-8 | 7,139 | 2.875 | 3 | [] | no_license |
import xlrd
import textract
import PyPDF2
from pptx import Presentation
import glob
import csv
import os
import shutil
def Search_xlsx(value_,filename):
#FOR OPENING THE WORKBOOK
loc=('path of file')
wb=xlrd.open_workbook(filename)
sheet=wb.sheet_by_index(0)
sheet.cell_value(0,0)
#print(sheet.nrows)
#prin... | true |
9c5d0c6407983b6a8ad9b65995840ffb01dd9444 | andrewpickett/puzzle | /puzzle-api-python/puzzle_api/services.py | UTF-8 | 3,157 | 2.5625 | 3 | [] | no_license | import datetime
import re
import bcrypt
import puzzle_api.database
from puzzle_api.jwt_utils import generate_jwt_token
from puzzle_api.models import AnswerGuess
def perform_login(name, password):
user = puzzle_api.database.find_user_by_name(name)
if not user or not bcrypt.checkpw(password, user.password.enc... | true |
409f192125dc4a3f6853ea08da8d403f9181cb69 | ds4g15/INT_EXT_PRED | /4_DIAGNOSE_REALISTIC_COVARIANCE_MATRICES/5_calc_lambda_int.py | UTF-8 | 4,268 | 2.84375 | 3 | [] | no_license | import sys
import numpy as np
import netCDF4 as nc
import scipy.signal as sig
'''
Calculate e-folding decorrelation times of subgrid buoyancy fluxes.
DESCRIPTION:
-----------
This script takes the time series of subgrid heat and salt fluxes created by
3_calc_ORCA2_subgrid_buoy_fluxes.py
and combined into single f... | true |
f2fe8f94a36afa259ecf214935a3c7dedac3eadb | CortanaAnalyticsGallery-Int/distributed-tuning | /singleVMsmall.py | UTF-8 | 804 | 2.640625 | 3 | [] | no_license | import feature_engineering as fe
from load_data import load_data
if __name__ == "__main__":
load_data()
#################################################################
# Feature engineering
#################################################################
# Create one-hot encoding... | true |
9e727382868936a7f8a3f05646be7e423aa4e308 | gdiepen/dvc_titanic | /src/train_test_split/train_test_split.py | UTF-8 | 772 | 3.375 | 3 | [] | no_license | """Module for the train/test split stage functions"""
import argparse
import os
import pandas as pd
import sys
from sklearn.model_selection import train_test_split
def split_input_into_train_test(df, random_state, test_size):
"""Splitting the raw data in the data/raw/raw_input.pkl file into a separate
train a... | true |
c36e1f336db8ea374b19a18233b6e83bb1c57e4c | lidannili/IIPP-Part1 | /pong.py | UTF-8 | 5,283 | 3.25 | 3 | [] | no_license | # Implementation of classic arcade game Pong
import simplegui
import random
# initialize globals - pos and vel encode vertical info for paddles
WIDTH = 600
HEIGHT = 400
BALL_RADIUS = 20
PAD_WIDTH = 8
PAD_HEIGHT = 80
HALF_PAD_WIDTH = PAD_WIDTH / 2
HALF_PAD_HEIGHT = PAD_HEIGHT / 2
LEFT = False
RIGHT ... | true |
0fe8230681829c5afcc74b0e8a9ffae9d2042078 | eleldar/bookmarks | /account/views.py | UTF-8 | 8,110 | 2.53125 | 3 | [] | no_license | from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from django.contrib.auth import authenticate, login
from .forms import LoginForm, UserRegistrationForm, UserEditForm, ProfileEditForm
from django.contrib.auth.decorators import login_required
from .models import Profile
from dja... | true |
44bc8be22fe3aec634b81e6c0d5a4ff376ed0349 | android156/python_basics | /Les1/task4.py | UTF-8 | 416 | 4.0625 | 4 | [] | no_license | user_number = input('Введите число: ')
print(f'Если Вы ввели число без опечаток, то в нем {len(user_number)} цифр')
max_digit = 0
count = 0
while count < len(user_number):
if int(user_number[count]) > max_digit:
max_digit = int(user_number[count])
count += 1
print(f'{max_digit} - максимальная цифра в ве... | true |
6fa1323091464f46b88451ccf8eeae6b64ae8104 | darkLord19/dbtest | /py/main.py | UTF-8 | 428 | 3 | 3 | [] | no_license | import psycopg2
conn_str = "postgresql://postgres:postgres@localhost:5432/postgres"
conn = psycopg2.connect(conn_str)
with conn:
with conn.cursor() as curs:
query = "INSERT INTO test(col1, col2, col3) VALUES ('hello', 1, 1111)"
curs.execute(query)
query = "SELECT * FROM test"
curs.... | true |
c855e528cebb3d5e0d68011cf8f17afb145c95da | jalondono/holbertonschool-higher_level_programming | /0x11-python-network_1/9-starwars.py | UTF-8 | 381 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python3
import requests
from sys import argv
if __name__ == "__main__":
name = argv[1]
url = 'https://swapi.co/api/people/?search=' + name
r = requests.get(url)
output = r.json()
count = output.get('count')
print("Number of results: {:d}".format(count))
results = output.get('resu... | true |
8179d54a7cdc58884478cee7bd39e6ca71c67a7c | 1547015/Python-Jun-2019 | /More programs/JsonRead.py | UTF-8 | 347 | 2.765625 | 3 | [] | no_license | import json
people_string = [
{
"name":"suresh",
"phone":"99000",
"emails":["suresh.d@gmail.com","abcd@gmail.com"]
},
{
"name":"uj",
"phone":"9963",
"emails":["uj.d@gmail.com","abcde@gmail.com"]
}
]
rows = []
for each in people_string:
# print(each)
for email in each["emails"]:
print(email)
rows... | true |
6fdf206f3bdea7899e3be30c15c730a44eecf471 | gddickinson/python_code | /randomXY_Scatter.py | UTF-8 | 671 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 11 15:40:58 2016
@author: George
"""
from __future__ import (absolute_import, division,print_function, unicode_literals)
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
import math
#### random data ######################
N=34358
#np.random.se... | true |
196ea4275ac35e96bf967efe684ef7a2bd348db8 | jurgyy/thesis | /main.py | UTF-8 | 5,013 | 2.625 | 3 | [] | no_license | import datetime
import pickle
from breakdown import *
from csv_reader.diagnose_csv import get_diagnoses
from csv_reader.medication_csv import get_medications
from csv_reader.mergers import *
from csv_reader.patients_csv import get_patients
from practioner_analysis.practitioner import analyze_practitioners
from simulat... | true |
818c8fff994c8a189a6bc0700b75f14ac2d0dee1 | devGuerra/atividades-faculdade | /Fase 2 - cap 2/RM85029_EX03.py | UTF-8 | 710 | 3.859375 | 4 | [] | no_license | print('Digite os votos por dia.')
segunda = int(input("Segunda-feira: "))
terca = int(input("Terca-feira: "))
quarta = int(input("Quarta-feira: "))
quinta = int(input("Quinta-feira: "))
sexta = int(input("Sexta-feira: "))
total_votos = segunda
resultado = "Segunda-feira"
if terca > 12:
total_votos = te... | true |
6d2017bf39831c1a5dd16de1d7a846b97fdd46e1 | dvir3211/MyProjects | /ChessProject/deep_learning.py | UTF-8 | 1,520 | 3.34375 | 3 | [] | no_license | from board import Board
def evaluate_pos(board):
sum = 0.0
for x in range(8):
for y in range(8):
res = 0.0
if board.board[x][y].get_type == "rook":
res = 5 + 0.05 * board.count_threts(x,y)
elif board.board[x][y].type == "knight":
... | true |
08e56ebf953cb5db3e2c0caee76f352e2de5399e | Ranjit007ai/InterviewBit-BinarySearch | /binary_search_based_problems/binary_search/binary_search.py | UTF-8 | 532 | 4.0625 | 4 | [] | no_license | def binary_search(arr,key):
# the array will be sorted in ascending order
n = len(arr)
left = 0 #starting index
right = n - 1 # last index
while left <= right :
mid = left + (right-left)//2
if arr[mid] == key :
return mid
elif arr[mid] < key :
... | true |
5383f3b397a9dd5ae1c6797f28a38bfbcf837032 | yk-hts/AtCoder | /a_42.py | UTF-8 | 228 | 3.171875 | 3 | [] | no_license | A,B,C = map(int,input().split())
count7 = 0
count5 = 0
ans = [A,B,C]
for i in ans:
if i == 7:
count7 += 1
elif i == 5:
count5 += 1
if count7 == 1 and count5 == 2:
print('YES')
else:
print('NO') | true |
7d513df7db70ef4efc98769442b4a4b8c618fb3e | mbylstra/compony | /test.py | UTF-8 | 8,916 | 2.84375 | 3 | [
"MIT"
] | permissive | import unittest
from compony.core import to_html, Component, to_element_tree, AttrsRequired, \
UnexpectedRegions
from compony.elements import div, p, h1, h2, hr
class TestComponentMixin:
def assertComponentEqualToETree(self, component, etree):
component_etree = to_element_tree(component)
sel... | true |
2fb37dbbd2073aedf2dafe1dce980da5cacd4197 | interactivetech/Stanford_CS234_RL_2021 | /assignment_4/starter_code/starter_code/main.py | UTF-8 | 16,167 | 3.125 | 3 | [
"MIT"
] | permissive | from abc import ABC, abstractmethod
import numpy as np
import csv
import os
import matplotlib
# matplotlib.use('Cairo')
import matplotlib.pyplot as plt
from data import load_data, LABEL_KEY
import pdb
def dose_class(weekly_dose):
if weekly_dose < 21:
return 'low'
elif 21 <= weekly_dose and weekly_dose <= 49:
... | true |
f4280af29997047ca593bd2af171a5a0796efa30 | KateYeon/Business-Anlaytics | /01 Dimensionality Reduction/Tutorial 02 - Unsupervised linear embedding/MDS.py | UTF-8 | 1,692 | 2.8125 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
class MDS_jay:
def __init__(self, X, y=0, k=2, category=False):
self.X = X
self.k = k
self.label = y
self.category = category
def distance_mat(self):
self.dists = np.zeros((len(self.X),len(... | true |
c0be9029f4e61fa986a6657606bbc081b329fcf5 | jordanrsteele/CTCL | /chapter_2/loop_detection.py | UTF-8 | 752 | 3.78125 | 4 | [] | no_license | from singleLinkedList import singleLinkedList
# Floyds Cycle detection algorithm d = x + y, loop = y + z
def is_loop(lst):
curr1 = lst.head
curr2 = lst.head
if not curr1:
return None
while curr2 and curr2.next:
curr1 = curr1.next
curr2 = curr2.next.next
if curr1 == cu... | true |
d5205b64b2f447d58c3acf1881a354db59cca0ff | Beichen365/Python | /Syntax/chap7/chap7b.py | UTF-8 | 389 | 4.1875 | 4 | [] | no_license | print("This program tells you if you are allowed to join the soccer team .")
age = float(input("What is your age ?"))
if 10 <= age <= 12:
gen = input("What is your gender ?(M or F)")
if gen == "F":
print("You are allowed to join !")
elif gen == "M":
print("You are not allowed to join .")
eli... | true |
a3d3bd34dd229402ad7b0e13b527c2fba0f28e1f | jakecoffman/euler-solutions | /41.py | UTF-8 | 498 | 3.625 | 4 | [] | no_license | def yrange(start, end, step=1):
n = start
while n < end:
yield n
n += step
def is_prime(num):
for x in yrange(2, num):
if num%x != 0:
return False
return True
from itertools import permutations
digits = list('123456789')
shortlist = []
for x in xr... | true |
422ed439d6cd3fa32bc7b7b30dcfab4aeb976286 | wllmnc/hackerRank | /contest/w29/day-of-the-programmer.py | UTF-8 | 362 | 3.0625 | 3 | [] | no_license | #https://www.hackerrank.com/contests/w29/challenges/day-of-the-programmer
#!/bin/python
import sys
y = int(raw_input().strip())
# your code goes here
day='0'
month='09'
if y<1918:
day=('12' if y%4==0 else '13')
elif y==1918:
day='31'
mont='08'
else:
day=('12' if ((y%4==0 and y%100!=0) or y%400==0) el... | true |
166e1a7010adf18315f239df5a7c4a81667e32df | methane/sigprofiler | /example.py | UTF-8 | 245 | 3.09375 | 3 | [] | no_license | def test1():
sum(x for x in xrange(1000))
def test2():
sum(x for x in xrange(10000))
def sleeper():
import time
time.sleep(0.01)
def main():
for i in xrange(1000):
test1()
test2()
sleeper()
main()
| true |
736252482bec2a15380741c2faaeeb142fe36699 | Ask-Archer/intro_to_flask | /main.py | UTF-8 | 548 | 3.609375 | 4 | [] | no_license | from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return "<h1 style='text-align: center'>Hello world.</h1>"
#Diffeent routes using the app.route decorator
@app.route("/bye")
def bye():
return "Bye!"
#Creating variable paths and
# converting the path to a specific data type
@ap... | true |
5cbf37bc0d896dee2920949a365c86a393222964 | TTurn/Hohi | /hiho-project/pinduoudo/4.py | UTF-8 | 2,164 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/8/2 15:42
# @Author : Tuhailong
# @Site :
# @File : 4.py
# @Software: PyCharm Community Edition
"""
假设一个探险家被困在了地底的迷宫之中,要从当前位置开始找到一条通往迷宫出口的路径。迷宫可以用一个二维矩阵组成,有的部分是墙,有的
部分是路。迷宫之中有的路上还有门,每扇门都在迷宫的某个地方有与之匹配的钥匙,只有先拿到钥匙才能打开门,请设计一个算法,帮助探险家
找到脱困的最短路径。如前所述,迷宫... | true |
e56058d2099654fd9b71fb10e55f784616cb9dfb | 4g/pose_estimation | /src/merge_datasets.py | UTF-8 | 2,124 | 2.734375 | 3 | [] | no_license | from .datasets import datasets, get_dataset
import cv2
import json
import os
from tqdm import tqdm
import numpy as np
def merge(dsnames, outdir, size):
total = 0
size = int(size)
for dsname in dsnames:
ds = get_dataset(dsname)
print(dsname)
os.mkdir(outdir + dsname)
data_dic... | true |
5383e0475009bdf32465970b71691a7fe98881e1 | mattbellis/matts-work-environment | /python/CMSDAS/Statistics/sample_figs.py | UTF-8 | 7,599 | 2.8125 | 3 | [] | no_license | import matplotlib.pylab as plt
import numpy as np
import scipy.stats as stats
import lichen as lch
################################################################################
# Basic example with histograms
################################################################################
'''
x = np.linspace(100,... | true |
94189d3d982efddb98e74b7ce43ac7084633dd9c | jstacoder/flask-basehead | /flask_basehead/pagination.py | UTF-8 | 385 | 2.890625 | 3 | [
"BSD-3-Clause"
] | permissive | # coding: utf-8
def get_page(obj_list,per_page,page_num):
s = ((per_page*page_num)-per_page)
res = []
total = 0
while total != per_page:
for i in range(per_page):
try:
res.append(obj_list[s])
except:
break
finally:
... | true |
6d02416ddc3ae5edb2fe0fdfbb648c6cd48f34c5 | cheesechoi/certfuzz | /src/linux/test/tools/test_tools_misc.py | UTF-8 | 1,180 | 2.734375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | '''
Created on Oct 24, 2012
@organization: cert.org
'''
import unittest
import os
import stat
def is_executable(f):
executable = stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH
st = os.stat(f)
mode = st.st_mode
return mode & executable
class Test(unittest.TestCase):
def setUp(self):
pass
... | true |
4613bf817611df259f77f98b052c382a1e4e9363 | bldaj/Knights | /enemies.py | UTF-8 | 3,609 | 2.796875 | 3 | [] | no_license | from levels import LEVELS
from character import Character
from items.armor import *
class Enemy(Character):
def check_level(self):
for level, exp in enumerate(LEVELS):
if self.exp > exp:
continue
elif self.exp <= exp:
self.level = level
... | true |
3b59768ec885cc199acc8c16661d0b0383bc022a | pgm-n117/SSIIP2 | /Algorithms/qlearning.py | UTF-8 | 5,325 | 3.40625 | 3 | [] | no_license | from time import time
import math
from Environment.qTableClass import *
from random import *
from Environment.blackboxenvironment import *
from Algorithms.auxMethods import *
#ProbSize: Tamaño del problema n*n
#Seed: Semilla para generación de aleatorios
#correctProb: Probabilidad de elección correcta ... | true |
85b58b769fe25ae5342a18a0498e9a769e1d7002 | yonglinZ/Remote-sensing-image-semantic-segmentation | /create_train_val_label.py | UTF-8 | 1,329 | 2.78125 | 3 | [] | no_license | import json,os
import numpy as np
import tifffile as tiff
from PIL import Image
def get_label_from_palette(label_img, palette_file='Palette.json'):
with open(palette_file, 'r') as fp:
text = json.load(fp)
label = np.zeros((label_img.shape[0], label_img.shape[1]), dtype=np.uint8)
... | true |
6b976378e9146adb2cecccaedf8041d3bb4b2c6f | shivamsinghal212/smart-price | /data_collection/scrapers/flipkart.py | UTF-8 | 3,283 | 2.609375 | 3 | [] | no_license | import logging
import re
import requests
from bs4 import BeautifulSoup as Bs
from data_collection.scrapers.flipkart_classes import product_details_classes
logging.basicConfig(filename='logs', level=logging.DEBUG)
URL = [
'https://www.flipkart.com/apple-iphone-se-black-64-gb/p/itm832dd5963a08d?pid=MOBFRFXHCKWDAC4... | true |
6a4b4e421f0be96812f5b2555c4ca524153285c6 | ikawaljeet/gitAsset | /src/gitRestApi.py | UTF-8 | 2,421 | 2.921875 | 3 | [] | no_license | import requests
import re
from config.config import Config
class GitRestApi:
def __init__(self):
self.config = Config()
def download_asset(self, org, repo, asset_id, file_directory):
# Download Asset
try:
url = "https://api.github.com/repos/{}/{}/releases/assets/{}".format(... | true |
529f3152b3cdf8d200b33e2b988ad5b02fdf20b1 | metal3d/drone-plugin-rancher | /update.py | UTF-8 | 4,465 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
""" Update Rancher app answers using API """
import os
import requests
class RancherAPI: # pylint: disable=too-few-public-methods
""" Make calls to Rancher API """
_CALLER = {
'GET': requests.get,
'PUT': requests.put,
'POST': requests.post,
}
def __ini... | true |
3ac3ce4abc379b7f553b0be74b24a9ab3bbf89c2 | WuHanDuanTao/Python-Exercise | /ex15.py | UTF-8 | 433 | 3.5625 | 4 | [] | no_license | from sys import argv
script, filename = argv
txt = open (filename) # open txt
print "Here's your file %r:" % filename
print txt.read() # 执行read 命令 然后打印出来
print "Type the filename again:"
file_again = raw_input ("> ") # 将文件名赋值给file_again变量
txt_again = open (file_again) # 再次打开这个文件 并且赋值给txt_again变量
print txt_again.r... | true |
ba31cf1c018b2115dcb4f151117e368233abc851 | justinvos/COMPSCI340 | /Assignments/A1/test1.py | UTF-8 | 3,173 | 2.984375 | 3 | [] | no_license | import atexit, json, os, sys, time, threading
def get_path(pid):
return "/tmp/" + str(pid)
class Message:
def __init__(self, label, action=lambda: None, guard=lambda: True):
self.label = label
self.action = action
self.guard = guard
class MessageProc:
def __init__(self):
s... | true |
73658bebb23bde83e609fba4b7726ebde1b3bc3d | charlies12/discord_bot | /responding_to_messages.py | UTF-8 | 479 | 2.609375 | 3 | [] | no_license | import discord
import os
import random
Token = os.environ.get('DISCORD_TOKEN')
client = discord.Client()
@client.event
async def on_message(message):
if message.author == client.user:
return
some_words = [
"Azur Lane",
"FGO",
"Arknights"
]
if message.content == "gach... | true |
03359c7f4600604e52ffe52b556f3082cbffec7d | itischrisd/PythonforSecurity | /Web Scraping/ex2b_post_login.py | UTF-8 | 300 | 2.765625 | 3 | [] | no_license | import requests
url = "https://hack-yourself-first.com/Account/Login"
session = requests.session()
payload = {"Email": "wnerw.mail@gmail.com", "Password": "Zaq123wsxc"}
conn = session.post(url, data=payload)
print("Odpowiedź strony to: {}".format(conn.status_code))
if "Log off" in conn.text:
print("True")
| true |
d4f9cdf2c91ff351c9225d293c18549468101c57 | jggrimesdc-zz/MachineLearningExercises | /17_Deep_Learning_Time_Series_Forecasting/10/06_histogram_all_variables.py | UTF-8 | 707 | 2.953125 | 3 | [] | no_license | # histogram plots for power usage dataset
from matplotlib import pyplot
from pandas import read_csv
# load the new file
dataset = read_csv('household_power_consumption.csv', header=0, infer_datetime_format=True, parse_dates=['datetime'],
index_col=['datetime'])
# histogram plot for each variable
pyp... | true |
fc7898f3dc08e3aa7b8f1c612541b66faba32bde | D4r7h-V4d3R/Ornekler | /@property Decorators, getter, setter, deletter, (Kapsülleme).py | UTF-8 | 1,101 | 3.375 | 3 | [] | no_license | class worke():
zamoranı = 1.05
def __init__(self,ad,soyad,):
self.ad = ad
self.soyad = soyad
@property
def mail(self):
self.email = self.ad + self.soyad + "@corp.com"
return self.email
def fullname(self):
return "Ad :{}, Soyad :{}".format(self.a... | true |
5f1a0b462f0d2f83c9528f323f4d8d54d394a789 | kloudd/leetcode | /check_if_n_and_its_double_exists.py | UTF-8 | 278 | 3.015625 | 3 | [] | no_license | class Solution:
def checkIfExist(self, arr: List[int]) -> bool:
for i in range(0,len(arr)):
for j in range(i+1,len(arr)):
if ((arr[i] == arr[j] * 2) or (arr[i] == arr[j] * 0.5)):
return True
return False
| true |
a8104ebdeb404df2aedf1bc24fca4bf2d5d2b821 | Thanhha456/US_volcanoes_map | /volcanoes_location_usa.py | UTF-8 | 1,440 | 3.09375 | 3 | [] | no_license | """
"""
import pandas
import folium
data = pandas.read_csv("volcanoes.txt")
lat = list(data["LAT"])
lon = list(data["LON"])
elev = list(data["ELEV"])
# base map
map = folium.Map(location=[38.58, -99.09], zoom_start=6, tiles="Stamen Terrain")
def color_changer(elevation):
if elevation <= 1000:
return "gr... | true |
d14c7c4a127b8245d3c56c767e1d5e30a8d5a6c3 | tlechien/PythonCrash | /Chapter 9/9.13.py | UTF-8 | 793 | 4.90625 | 5 | [] | no_license | """
9-13. Dice: Make a class Die with one attribute called sides, which has a default
value of 6. Write a method called roll_die() that prints a random number
between 1 and the number of sides the die has. Make a 6-sided die and roll it
10 times.
Make a 10-sided die and a 20-sided die. Roll each die 10 times.
"""
from ... | true |
255f51ee207a299022bc56aee9648e7faac64c19 | rajdipa/Sentiment-Analysis | /extras/deprecated_predict.py | UTF-8 | 1,519 | 2.671875 | 3 | [] | no_license | # Make predictions on testing data using our LR model.
import training
import cleaning
import pandas as pd
import numpy as np
import pickle as rick
import os.path
from sklearn.model_selection import GridSearchCV
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.linear_model import LogisticRegres... | true |
030d617603d2e9522bef4059d756b61c2d053ad3 | LyceeClosMaire/projet-final-pipopipette | /Nouveau dossier/Début projet.py | UTF-8 | 217 | 3.546875 | 4 | [] | no_license | import pygame
menu="Dessine le plus de carré que ton adversaire pour gagner"
print(menu)
nomjoueur1=input("Entrer prénom joueur 1")
nomjoueur2=input("Entrer prénom joueur 2")
print(nomjoueur1,"VS",nomjoueur2)
| true |
807c9adcb30ba0d45e2c53670669f4897cb1be4c | gistable/gistable | /dockerized-gists/2206339/snippet.py | UTF-8 | 248 | 2.515625 | 3 | [
"MIT"
] | permissive | def buildPAMS(mun, blk, lot, qua=None):
"""Returns a PAMS Pin from three or four cadastre fields."""
if (qua == None) or (qua == ''):
return "%s_%s_%s" % (mun, blk, lot)
else:
return "%s_%s_%s_%s" % (mun, blk, lot, qua)
| true |
a8e8f1e3bfa0f6abdbd6969182e0d1980e77d096 | lwei5152/SVR-Optimizing-TCMs | /cross validation_Github.py | UTF-8 | 3,115 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 28 20:34:38 2018
@author: LW
"""
# Basic packages
import numpy as np
import pandas as pd
from sklearn import preprocessing # module used for normalization
from sklearn.learning_curve import validation_curve
import matplotlib.pyplot as plt
# The machine l... | true |
ca01b4ab691c97dec335988368e62f54c1ed24a7 | IsuraNimalasri/bse | /src/add_book_task.py | UTF-8 | 373 | 2.671875 | 3 | [
"MIT"
] | permissive | from es import add_book
from utils import delete_file
def do_task(task_data):
"""
Add book to index task. Delete file after adding.
:param task_data: contain path to file
:type task_data: dict
:return: result of book addition
:rtype: dict
"""
path = task_data['path']
result = add... | true |
5a63e42bd93da21cbbff7ab8b2e93549383353f8 | Art17/btp | /lab1/main/main.py | UTF-8 | 298 | 2.984375 | 3 | [] | no_license | import re
if __name__ == '__main__':
print('task 1a')
reg = re.compile('(\[(\+|-)([0-9]+|[A-Z]+)\])')
for r in re.findall(reg, open('1.txt','r').read()):
print(r[0])
print('task 1b')
for m in reg.finditer(open('2.txt', 'r').read()):
print(m.start(), m.group())
| true |
88f7ac67a2596f6cfb03be475b38397ed6627584 | Ziems/CapsNet-Keras | /train.py | UTF-8 | 7,559 | 2.703125 | 3 | [
"MIT"
] | permissive | from keras import backend as K
from keras import layers
from keras import models
import tensorflow as tf
from tensorflow import initializers
def margin_los(y_true, y_pred):
"""
:param y_true: [None, n_classes]
:param y_pred: [None, num_capsule]
:return: a scalar loss value
"""
L = y_true * K.s... | true |
9c8778381250b200d0cb2ff0bfcb4343dad30cdd | greenfox-zerda-lasers/szuri92 | /week-03/day-1/29.py | UTF-8 | 416 | 3.515625 | 4 | [] | no_license | ab = 123
credits = 100
is_bonus = False
# if credits are at least 50,
# and is_bonus is False decrement ab by 2
# if credits are smaller than 50,
# and is_bonus is False decrement ab by 1
# if is_bonus is True ab should remain the same
if credits >= 50 and is_bonus == False:
ab -= 2
print(ab)
elif credits < 50... | true |
d1cf6df9627802b6af3c6845e8040aa7069cca05 | Tahsinmullick/python_client_server | /client.py | UTF-8 | 285 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 6 15:49:19 2017
@author: TahsinVT
"""
import socket
def Main():
host = '127.0.0.1'
port = 5000
mysocket = socket.socket()
mysocket.connect((host,port))
message = input(" -> ")
while message !='q' | true |
4d7cc003fbdcf015faa9525655967e2c0bbd427a | MullerAC/ln-calendar-scraper | /scrape/sol_press.py | UTF-8 | 4,366 | 3.25 | 3 | [] | no_license | """
To Do:
- test with old dates
"""
from bs4 import BeautifulSoup
from datetime import date
from dateutil.parser import parse
import requests
from time import perf_counter
from urllib.parse import urljoin
def scrape(start_date=date.min, verbose=0):
'''
Sol Press only lists digital releases on their calendar.... | true |
d0a6b47882726fadfd619d2af76b9bf4fab43f97 | afcarl/radical.utils | /src/radical/utils/misc.py | UTF-8 | 17,141 | 2.671875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive |
import os
import sys
import time
import regex
import shlex
import socket
import importlib
import netifaces
import subprocess as sp
import url as ruu
# ------------------------------------------------------------------------------
#
def split_dburl(dburl, default_dburl=None):
"""
we split the url into the ba... | true |
43b6b9bbd74f0e5334d8ee105da19904f66c02f9 | arthursimas1/ssms | /networking.py | UTF-8 | 7,343 | 3.359375 | 3 | [] | no_license | import typing
import socket
from sys import stdin
import protocol
Address = typing.Tuple[str, int]
class Connection:
"""
Both methods are static, that way we do not need to initialize any variable into our class.
With Static Methods both functions become linked to the class, not the object.
"""
... | true |
4b71f185055fc05521c305a5beb2e89ad3e9c4b3 | Markus-Ende/adventofcode2019 | /src/day3/test_solution_part2.py | UTF-8 | 1,356 | 3.109375 | 3 | [] | no_license | import pytest
import day3.solution_part2
@pytest.mark.parametrize("coords,intersection,expected", [
([(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(8,1),(8,2),(8,3),(8,4),(8,5),(7,5),(6,5),(5,5),(4,5),(3,5),(3,4),(3,3),(3,2)], (3, 3), 20)
])
def test_count_steps(coords, intersection, expected):
assert day3... | true |
af0f00894dc765acf96327967defb2a35029c320 | dalogax/pricestockbot | /tools/put_ids.py | UTF-8 | 250 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import json
id = 1
with open('./source.json', 'r') as jsonFile:
data = json.load(jsonFile)
for item in data:
item['id']=str(id)
id = id + 1
with open('./source.json', 'w') as jsonFile:
json.dump(data, jsonFile, indent=4) | true |
c0da906c002ecf33e4f80dc90c2b8ea3d8f4138d | lilsweetcaligula/sandbox-codewars | /solutions/python/319.py | UTF-8 | 342 | 3.03125 | 3 | [] | no_license | def initializeNames(name):
names = name.split()
names[1:-1] = map(lambda x: "".join(x[:1]) + '.', names[1:-1])
return ' '.join(names)def initializeNames(name):
names = name.split()
return (' '.join(
name if index == 0 or index == len(names) - 1
else name.strip()[0] + '.'
for index, name in... | true |
ac3d3cb44593ea44af42753f30fe135916bebfd6 | jpiercefield/CattleTracker | /sql.py | UTF-8 | 544 | 2.59375 | 3 | [
"MIT"
] | permissive | from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
engine = create_engine('mysql://root:Cattle@localhost/cattletrax')
Base = declarative_base(engine)
class animal(Base):
__tablename__ = 'animal'
__table_args__ = {'autoload':True}
def... | true |
d906f09c78e0f8ce285b49b0fc1c95ffc202bf1d | dasbindus/LearnPython | /1_Python_Based/test.py | UTF-8 | 106 | 2.875 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding:utf-8 -*-
L = []
n = 1
while n <= 99:
L.append(n)
n = n + 2
print L | true |
824020902291672a6da17bb8111025915fd176f6 | kwangseok90/PYTHON_PolytechKorea | /PYTHON/Python_CLASS/12-05.py | UTF-8 | 457 | 3.875 | 4 | [] | no_license | class Car:
name = ""
speed = 0
def __init__(self, name, speed):
self.name = name
self.speed = speed
def getName(self):
return self.name
def getSpeed(self):
return self.speed
car1, car2 = None, None
car1 = Car("Audi", 0)
car2 = Car("Kia", 30)
print("%s의 현재 속도는 %d... | true |
c8bdf8bdc3027429e28157c1b01ce1c2a0615804 | miyoo2/cs425 | /mp1/serializer.py | UTF-8 | 596 | 2.5625 | 3 | [] | no_license | from threading import Thread
from functools import wraps
# function wrapper
def thread(daemon):
def decorator(f):
@wraps(f)
def wrapper(*args, **kwargs):
worker = Thread(target=f,args=args,kwargs=kwargs)
worker.daemon = daemon
worker.start()
return worker
return wrapper
return decorator
# seriali... | true |
eebb555bb3e6c2fac71d45e9fc72b83172af2d53 | caglar/picklable_itertools | /picklable_itertools/extras.py | UTF-8 | 2,072 | 3.203125 | 3 | [
"MIT"
] | permissive | """Related things that aren't part of the standard library's `itertools`.
Currently home to picklable reimplementations of a few of the generators
from Matthew Rocklin's Toolz package.
Docstrings for `partition` and `partition_all` are lifted wholesale
from the Toolz documentation <http://toolz.readthedocs.org/en/lat... | true |
9eecfb52f0865e1b57397c5dcf21b53c898465b3 | K-rangeR/Advent-of-Code | /2020/day_01.py | UTF-8 | 1,989 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python3
def main():
with open("./input_01.txt", "r") as f:
expense_report = []
for line in f:
expense_report.append(int(line.strip()))
p1_answer = part_1(expense_report)
print(p1_answer)
better_1 = part_1_better(expense_report)
print(better_1)
other = part_1_better... | true |
a3e45a7ac0c6e26f8d91c708d08bac2e0e95694d | Olgaroeva24/-LearnQA_Python_API- | /Test_cookies.py | UTF-8 | 337 | 2.796875 | 3 | [] | no_license | import requests
class TestCookies:
def test_cookies(self):
response = requests.get("https://playground.learnqa.ru/api/homework_cookie")
print(dict(response.cookies))
cookie_value = {'HomeWork': 'hw_value'}
assert response.cookies == cookie_value, f"there is not response.cookies = ... | true |
2b27cb9029f6b89d1936470e7af54a0fcf7c99b4 | eschnett/parthenon | /scripts/python/phdf.py | UTF-8 | 15,742 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | #=========================================================================================
# (C) (or copyright) 2020. Triad National Security, LLC. All rights reserved.
#
# This program was produced under U.S. Government contract 89233218CNA000001 for Los
# Alamos National Laboratory (LANL), which is operated by Triad ... | true |
a243f3c8189502e6e49d75a28a8bfb4542d29c8e | Lexa07/Lesson | /lesson4/zd4_5.py | UTF-8 | 1,020 | 4.21875 | 4 | [] | no_license | """5. Реализовать формирование списка, используя функцию range() и возможности генератора. В список
должны войти чётные числа от 100 до 1000 (включая границы). Нужно получить результат вычисления
произведения всех элементов списка.
Подсказка: использовать функцию reduce()."""
from random import randint
fr... | true |
e8fb1cf0e933d5c1146daed47e76c27f8587ae7f | temp3rr0r/neupy | /neupy/utils.py | UTF-8 | 7,717 | 3.140625 | 3 | [
"MIT"
] | permissive | import inspect
from functools import wraps
import numpy as np
from scipy.sparse import issparse
import tensorflow as tf
__all__ = ('format_data', 'asfloat', 'AttributeKeyDict', 'preformat_value',
'as_tuple', 'number_type', 'all_equal', 'class_method_name_scope',
'tensorflow_session', 'tensorflo... | true |
ddf28f85a125303312445236a02c55529391cd20 | bui1/Python-Mistakes | /Eisha/WorkPlace/texttojson.py | UTF-8 | 2,546 | 3.296875 | 3 | [] | no_license | from sys import argv
import json
answer = raw_input("WARNING! THIS WILL DELETE THE CONTENTS OF THE JSONTEST.JSON FILE! IF YOU DO NOT WANT THIS TO HAPPEN, PLEASE PRESS ^C TO STOP THE PROGRAM!")
# Run the program with the name of the file to open after the script name (in this case test.txt)
script, open_file = argv
... | true |
b803a9dca7c6f748088b449c2782c405c453600d | chauncey2016/UebungenOC2SS2019 | /ExtendedCS/ga.py | UTF-8 | 2,824 | 2.875 | 3 | [] | no_license | import random
import numpy as np
class GA():
def __init__(self, population_size=10):
self.population_size = population_size
def start_ga(self, M_set):
if len(M_set) < 2: return
p1, p2, avg_val = self.parent_selection(M_set)
child1, child2 = self.crossover(p1, p2)
... | true |
40f9a0f30d6edb4d0f075e5b91a97ac12c9404c4 | WillyChen123/2015Summer | /function.py | UTF-8 | 119 | 3.46875 | 3 | [] | no_license | def eat(food):
print "I eat "+food
print "Morning"
eat("bread")
print "Noon"
eat("rice")
print "Night"
eat("hot pot") | true |
416caba0271bb652eae4f92f8f7a214450e0f180 | josetomas/FabAcademy | /GUI/button2.py | UTF-8 | 751 | 3.109375 | 3 | [] | no_license | import serial
import tkinter as tk
s = serial.Serial('/dev/ttyACM1', 9600)
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
def create_widgets(self):
self.on = tk.Button(self)
... | true |
444a8c4fb4aef1462af70837fd66d690abf4712b | Ali-Parandeh/Data_Science_Playground | /pyimagesearch gurus/Module 1/lesson_1_7/blurring.py | UTF-8 | 6,293 | 3.796875 | 4 | [
"MIT"
] | permissive | # import the necessary packages
import argparse
import cv2
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True, help="Path to the image")
args = vars(ap.parse_args())
# load the image, display it and initialise the list of kernel sizes
... | true |
9805ec616495fd2b24e8de2590e8a5858849aede | dimpledoshi/PYTHON | /10.py | UTF-8 | 701 | 3.828125 | 4 | [] | no_license | """Read the marks for three subjects from the command line.
If the CIE marks is less than 20, the exception ‘MarksNotElligible’ is thrown .
If the given marks is not a valid integer then exception must be handled"""
import sys
class MarksNotEligible(Exception):
def __init__(self):
print("fail")
... | true |