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 |
|---|---|---|---|---|---|---|---|---|---|---|
7114575445ed554b59c11c3f5808dd0bc1150880 | NitinDwivedi1/social_site_project | /models/Posts.py | UTF-8 | 626 | 2.640625 | 3 | [] | no_license | import pymongo
from pymongo import MongoClient
import bcrypt
class Posts:
def __init__(self):
self.client=MongoClient()
self.db=self.client.codewizard
self.users=self.db.users
self.Posts=self.db.posts
def insert_post(self,data):
inserted=self.Posts.insert({"username":dat... | true |
c1954ac0948c6acd9a017d52a31541568e629694 | ohms064/TeruSistema | /Sistema/Clientes.py | UTF-8 | 5,566 | 2.828125 | 3 | [] | no_license | import sqlite3
import datetime
from Sistema.ObjectDB import *
class ClienteTeru:
def __init__(self, sql):
"""
Recibe los datos de una consulta de ClienteDB y sólo ClienteDB a menos que los datos se envíen
en una tupla como sigue: id, nombre, consumo, visitas, ultimaVisita, correo, nick
"""
try:
self.id =... | true |
b323e641f1f1993229d2a86e6f02e18474f06bdc | nekapoor7/Python-and-Django | /GEEKS/String/Reverse Each Word.py | UTF-8 | 191 | 4.15625 | 4 | [] | no_license | """Python | Reverse each word in a sentence"""
def ReverseEachWord(string1):
return ' '.join(word[::-1] for word in string1.split(" "))
string1 = input()
print(ReverseEachWord(string1)) | true |
bcca4ef6b304b67d7cdaa522fb8b8169c9bee41b | Cooops/Coding-Challenges | /CodeWars/unique_number.py | UTF-8 | 733 | 4.21875 | 4 | [] | no_license | # http://www.codewars.com/kata/find-the-unique-number-1/train/python
"""
There is an array with some numbers. All numbers are equal except for one. Try to find it!
findUniq([ 1, 1, 1, 2, 1, 1 ]) === 2
findUniq([ 0, 0, 0.55, 0, 0 ]) === 0.55
It’s guaranteed that array contains more than 3 numbers.
The tests contain s... | true |
b744a7c1890feac521fb12ed506db332010258d9 | LearningSteps/Learn-Python-The-Hard-Way-Test-Driven-Learning | /PyAutomation/Chapter01.py | UTF-8 | 314 | 3.0625 | 3 | [] | no_license | #Let us begin our automation journey
result = template.format(*parameters)
#strings can be sliced like any other list.
'[word]'[0:2] # will return 'wo'
.splitlines() #can be used to seperate lines by newline characters
.upper() .lower() #can be used to manipulate captalization
.replace() # for easy replacement | true |
8df98abb2387708d8bb77948a65768ad598f1863 | doubledherin/datastructs_algorithms_exercises | /Chapter02_Benchmarking/anagramSolution.py | UTF-8 | 621 | 3.78125 | 4 | [] | no_license | def anagramSolution1(s1, s2):
"""
Takes two strings and returns True if they are anagrams; False if not.
Assumes strings are of equal length and contain lowercase ascii letters.
"""
listy = list(s2)
pos1 = 0
stillOK = True
while pos1 < len(listy) and stillOK:
pos2 = 0
... | true |
d14ad0bcd7c083d36ab5abe1b08650d505d1fdf4 | samlcharreyron/AoC | /2020/21/main.py | UTF-8 | 1,199 | 3.171875 | 3 | [] | no_license | from collections import defaultdict
def p1(all_ingreds, d):
some_als = set()
for v in d.values():
some_als |= v
no_als = all_ingreds.keys() - some_als
return sum(all_ingreds[ingred] for ingred in no_als)
if __name__ == '__main__':
with open('input.txt', 'r') as f:
data = f.read().... | true |
74be967b679acd38c3dd217cb17442528334471d | Ashfaq97/college-notes-web-app | /app.py | UTF-8 | 2,343 | 2.546875 | 3 | [] | no_license | import os
from flask import Flask, render_template, url_for, redirect
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
app = Flask(__name__)
app.config['SECRET_KEY'] = 'hello321'
############## DATABASE CONNECTION ################
basedir = os.path.abspath(os.path.dirname(__fil... | true |
7a5e46054c2f21be2798eff53c002478f8ff071f | shubham409/CodeSubmits | /codeforces/1516/B.py | UTF-8 | 1,008 | 2.984375 | 3 | [] | no_license | def fun(ls,n):
if(n==2):
if(ls[0]==ls[1]):
print('YES')
else:
print('NO')
else:
prefix_xor=[]
for i in ls:
if(prefix_xor==[]):
prefix_xor.append(i)
else:
prefix_xor.append(i^prefix_xor[-1])
ar... | true |
379dfdc286d6b1c517c73937069ad30ca9f6b6b9 | TijnGeelen/Anno4ml | /transform.py | UTF-8 | 4,293 | 3.359375 | 3 | [] | no_license | import os
import random
def process_data():
"""This function accesses the files in the directory and processes them to a seperate line for each file."""
# Create a list of all paths
paths = ['./adju-1-2', './adju-3-4', './adju-5-6','./adju-7-8']
dataset = []
for path in paths:
fo... | true |
8b83b2783377bb142224c6f1547f8f6610b62f96 | wykthor-btracker/site-willy | /feeder.py | UTF-8 | 3,314 | 2.59375 | 3 | [] | no_license | #imports
from unicodedata import normalize
from requests import get
from imdb import IMDb as imdb
from HTMLParser import HTMLParser
import json
#imports
#variables
#variables
#classes
class Picture_Parser(HTMLParser):
def init(self):
self.div = 0
self.att = 0
self.found = 0
self.data = ''
self.attrs = []
... | true |
279b7a879e660716a460cdfb7771969bf87b03b3 | jasonashton/ORCA-Home-Automation | /control/main.py | UTF-8 | 1,297 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python3
'''
ORCA Home Automation Controller
Jason Ashton, 2015
'''
import sys
if sys.version_info < ( 3, 0):
sys.exit('ERROR: Run with Python 3')
import argparse
import program
import control
import telnet
import esp
complete = False
parser = argparse.ArgumentParser()
parser.add_argument("-r", "--room",... | true |
1718a32c16c87b28ad941d227654c2ea58dfb8d4 | amaljithev/Malayalam-Text-Recognizer | /pickedrectangularselectorimgfrompil.py | UTF-8 | 5,420 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
from PIL import Image
import matplotlib.patches
import matplotlib.widgets as widgets
from matplotlib.widgets import RectangleSelector
import sys
from matplotlib.patches import Rectangle
import matplotlib
myendcord... | true |
9b27cbe772aa85310d5fb101371c0f8eac763999 | SATAY-LL/Transposonmapper | /transposonmapper/utils.py | UTF-8 | 834 | 4.0625 | 4 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | def chromosomename_roman_to_arabic():
"""
Creates two dictionaries for translating the chromosome names from roman to arabic numerals or vice versa.
Syntax: arabic_to_roman, roman_to_arabic = chromosomename_roman_to_arabic()
Returns
-------
arabic_to_roman : dict
roman_to_arabic : dic... | true |
2fb025997f21d14b18f71edbaca0f21a5ed78343 | gwakkk/Algorithm_py | /greedy_sol/greedy_string_reverse.py | UTF-8 | 237 | 3.578125 | 4 | [] | no_license | data = input("문자열 입력 : ")
count0 = 0
count1 = 0
for i in range(len(data)-1):
if(data[i] != data[i + 1]):
if(data[i+1]=='1'):
count0 += 1
else:
count1 += 1
print(min(count0,count1))
| true |
8bcb0d432d139d3eef6afa8d6195ed41caa9b903 | hfan6206/image_processing | /green_screen/green_screen.py | UTF-8 | 2,665 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#Created on Mon Aug 26 12:39:30 2019
import numpy as np
import cv2
import os
import sys
import random
from matplotlib import pyplot as plt
BLUE = 120
if not os.path.isdir(os.path.join(os.getcwd(), 'background')):
os.mkdir("background")
else:
print('background... | true |
6ddf999b97a6207b29e222813d41eee5991fa8bb | gescoba5/form_prueba | /sst/forms.py | UTF-8 | 586 | 2.5625 | 3 | [] | no_license | # coding=utf-8
# Se añade esta linea para poner tildes
from django import forms
from .models import Post
class PostForm(forms.ModelForm):
# Nombre del label del imput. La variable es la misma que se definio en el modelo
#title = forms.CharField(label='Título')
''' Esto se hace para dar atributos a los campos d... | true |
bae2a123ed162a52d7335f64101a9ed7841d2c5a | vrd1243/regimeshift | /datasets/lorenz.py | UTF-8 | 940 | 2.765625 | 3 | [] | no_license | import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# Lorenz paramters and initial conditions
sigma, beta, rho = 10, 8/3, 28
u0, v0, w0 = 0, 1, 1.05
def lorenz(X, t, sigma, beta, rho):
"""The Lorenz equations."""
u, v, w = X
up = -s... | true |
a88f973c686b8ea167d5cb79e077e956d2d65f82 | LiYang-cv/structuredlight | /structuredlight/util.py | UTF-8 | 1,080 | 3.046875 | 3 | [
"MIT"
] | permissive | import numpy as np
def transpose(imlist):
"""
Replacing the x-axis and y-axis of an image in the list of images
"""
return [ img.T for img in imlist]
def invert(imlist):
"""
Invert the color of an image in the list of images
"""
return [ 255-img for img in imlist]
def getCorrespondenc... | true |
9f1dd2d2b987128a07d71e8cada09573502379ad | zeroviral/leetcode_stuff | /minimum-window-substring/minimum-window-substring.py | UTF-8 | 801 | 3.109375 | 3 | [] | no_license | class Solution:
def minWindow(self, s: str, t: str) -> str:
if len(t) > len(s):
return ""
l = 0
count = 0
minLength = float('inf')
lookup = Counter(t)
result = ""
for r in range(len(s)):
if s[r] in lookup:
if lo... | true |
c708a7a4f0ea96b3b6a3279fa86dd2e02749202d | FelixTheC/python_morsels | /passphrase.py | UTF-8 | 1,652 | 3.25 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@created: 09.01.21
@author: felix
"""
import argparse
import math
import sys
from secrets import choice
parser = argparse.ArgumentParser(description='generates {x}-word passphrases')
parser.add_argument('file',
type=argparse.FileType('rt'),
... | true |
4be9642e36188f6c8e72c868019d054e2bb8c420 | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/arc058/B/2444808.py | UTF-8 | 1,250 | 3.078125 | 3 | [] | no_license | H, W, A, B = map(int, input().split())
P = 10 ** 9 + 7
N = H + W
# nCr mod P (P ???) ? 1 <= r <= n <= N ????????????????
# fact ? n! mod P (n=0,...,N) ???????
# inv_fact ? n!^(-1) mod P (n=0,...,N) ???????
def fact(N, P):
ret = [1] * (N + 1)
for n in range(2, N+1):
ret[n] = (ret[n-1] * n) % P... | true |
1e49ae754bf284f29180bf980658f5e8bb3f7342 | nakashi120/PythonLectureKame | /generator_iterator/custom_generator.py | UTF-8 | 334 | 3.765625 | 4 | [] | no_license | # range(10)
def myrange(stop):
start = 0
while start < stop:
yield start
start += 1
mr = myrange(10)
print(type(mr))
for i in mr:
print(i)
def even(num):
while num != 0:
if num % 2 == 0:
yield num
num -= 1
print('===================')
for i in even(10):... | true |
82cc79ced97b1149509c68c939b03153b481a0da | QLGQ/learning-python | /calculator.py | UTF-8 | 1,767 | 4.65625 | 5 | [] | no_license | #Implementation of basic operations
# -*- coding: UTF-8 -*-
def add(x, y):
return x + y
def subtract(x, y):
return x - y
def multiply(x, y):
return x * y
def divide(x, y):
return x / y
def power(x,n):
# s = 1
# while n > 0:
# n -= 1
# s = s*x
# return s
return x ** n
def fac... | true |
4ab5d198e93dd031bf2fa518d7bb1e07adc939b7 | pankaj1181998/video_filter | /python_learning/pandas_learning1.py | UTF-8 | 767 | 3.984375 | 4 | [] | no_license | '''
Data Frames
Data Frames is list of series in pandas
'''
import numpy as np
import pandas as pd
from numpy.random import randn
np.random.seed(101)
df = pd.DataFrame( randn(5,4),['A','B','C','D','E'],['W','X','Y','Z'])
print(df)
# printing and selecting columns
print(df['W'])
print(type(df))
print(df.W )
print(... | true |
4e5a7975acadf639a67a4d46e201598edb7987a8 | lost-person/Leetcode | /113.路径总和-ii.py | UTF-8 | 891 | 3.234375 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=113 lang=python3
#
# [113] 路径总和 II
#
# @lc code=start
# Definition for a binary tree node.
from typing import List
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def pathSum(self, r... | true |
c85eba1e0d74b4aaaadbe1d6a924ae102977e903 | LeelaPakanati/ECE434 | /hw02/etch_a_sketch.py | UTF-8 | 2,983 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import curses
import Adafruit_BBIO.GPIO as GPIO
from time import sleep
UP_PIN = "P9_21"
DOWN_PIN = "P9_13"
LEFT_PIN = "P9_11"
RIGHT_PIN = "P9_17"
CLEAR_PIN = "P9_19"
GPIO.setup(UP_PIN, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(DOWN_PIN, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)... | true |
04a443d7cccd123bea03d1b0993ef2b13694ab0b | jonojace/mscproject | /scripts/plot_binary_file_python3.py | UTF-8 | 3,997 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Oliver Watts
# owatts@inf.ed.ac.uk
# April 2016
import sys, os
import struct
import numpy as np
from argparse import ArgumentParser
try:
from pylab import subplot, plot, show, imshow, gray, ylim
except:
print('Trouble importing matplotlib functions -- will not ... | true |
56dd1720f90139e10b2f467df458000f34e9416c | shashilsravan/Py1K | /30-60/program - 56.py | UTF-8 | 185 | 3.671875 | 4 | [] | no_license | lis = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]
for i in range(len(lis)):
if i % 2 == 0:
print(*lis[i])
else:
print(*reversed(lis[i])) | true |
4266625354da262bdb585c3f1a7c4cd8f87aa279 | anks1245/PyTranslator | /PyTranslator.py | UTF-8 | 1,133 | 2.90625 | 3 | [] | no_license | from googletrans import *
import tkinter as tk
import pyttsx3
def trans():
global speak
x=txt.get()
if x=="":
print("nothing")
translator=Translator()
try:
t=translator.translate(x)
speak=t.text
print(speak)
tk.Label(root, text=speak,font="arial 16",bg='ghost... | true |
a0a0cd5b3593cf1469e1033f6c662c15a37a614c | specialOne-coder/pythonGames | /venv/lib/python3.8/site-packages/pygame/examples/pydub_overlay.py | UTF-8 | 391 | 2.546875 | 3 | [] | no_license | from pydub import AudioSegment
# from pydub.playback import play
sound1 = AudioSegment.from_wav("data/boom.wav")
sound2 = AudioSegment.from_wav("data/punch.wav")
# mix sound2 with sound1, starting at 5000ms into sound1)
# output = sound1.overlay(sound2, position=5000)
output = sound1.overlay(sound2)
# play(output)
... | true |
38eebea20276eaedb58b7e3746e933cfda6a16b9 | IsaacDulin/CS97-Final-Project | /Graphs.py | UTF-8 | 6,091 | 3.21875 | 3 | [] | no_license | from heapq import heappush, heappop
class PathError(Exception):
def __init__(self):
Exception.__init__(self, 'origin and destination are disconnected')
class Graph:
def __init__(self, nodes=[], edges=[]):
self.nodes = set()
self.edges = dict()
for node in nodes:
sel... | true |
affdf37bdf03894605d1133370c0235cbb17938c | Daniel-cr7/Ejercicios_python2 | /DMF_area_del_circulo.py | UTF-8 | 181 | 2.75 | 3 | [] | no_license | def resultadocir(resultado):
print(resultado)
b=float(input("Ingresa el radio de tu circulo"))
resultado= float((3.1416*b)*(3.1416*b))
resultadocir(resultado)
input()
| true |
e50176d0c1033ec8d74efa06a141196b76b5a204 | cameronaaron/wikidetox | /wikiconv/conversation_reconstruction/construct_utils/utils/insert_utils.py | UTF-8 | 5,057 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Copyright 2017 Google Inc.
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 or agreed to ... | true |
86434ac2b9eaa5b6b664f8b7129578a532061898 | LouisYZK/Dvorak | /python/mock_request.py | UTF-8 | 4,031 | 2.609375 | 3 | [] | no_license | """
mock passengers' request
"""
# from .data_loader import *
from itertools import product
from os import sep
from numpy.core.defchararray import lower
import pandas as pd
import numpy as np
import random
from datetime import datetime, time, timedelta
from .data_loader import STOP_PAIR_MAP
class Order:
def __init... | true |
aa4d120d5c12428fca0cd5fea3169f5b02e42d16 | Lewis-Trowbridge/Go-To-Sleep-Revengeance | /source/gotosleep/setup.py | UTF-8 | 2,805 | 2.53125 | 3 | [
"MIT"
] | permissive | import argparse
import pathlib
import os
import sys
import mysql.connector as mysql
from .tracing import setup_tracer
GTS_BOT_TOKEN = "GTS_BOT_TOKEN"
GTS_MAPS_TOKEN = "GTS_MAPS_TOKEN"
GTS_SUPPORT_SERVER = "GTS_SUPPORT_SERVER"
GTS_DB_PATH = "GTS_DB_PATH"
GTS_DB_USER = "GTS_DB_USER"
GTS_DB_PASS = "GTS_DB_PASS"
GTS_DB_DA... | true |
a4fc8e5feb2aa98754ea13bda12a6f42ed553a39 | adrianlow97/O1-Speed-Random-Data-Generator | /voseRunner.py | UTF-8 | 2,007 | 3.0625 | 3 | [] | no_license | from AliasMethod import VoseAlias
import os, random, re, sys, time, csv
def main():
#get the number of data sets needed to be generated
numInputs = int(input("Please enter the number of data sets to generate: "))
#initialize empty arrays to store the generated data
labelArray = []
dataArray =[]
#get the la... | true |
340764b983dfc682ce2c45bf2b334dd55ffc9e10 | StellaireXy/BDAlgo | /5.2.pagerank/reducer_sort.py | UTF-8 | 258 | 2.796875 | 3 | [] | no_license | #PageRank
#Reducer_sort
#IN: 500-PageRank \t NodeId
#OUT: NodeId \t PageRank
import sys
for line in sys.stdin:
PR, node = line.strip().split('\t', 1)
pagerank = 500 - float(PR)
pr = '%.5f' %pagerank
print("%s\t%s" % (node, pr))
| true |
086bc33243ab730ef311cb667b237cccac11bf69 | lucasalexandre-cc/Programming-Challenges | /Uri-Online-Judge/Python-Resolutions/URI_1244.py | UTF-8 | 196 | 3.640625 | 4 | [] | no_license | def por_tamanho(x):
return (len(x))
N = int(input())
for i in range (N):
x = input().split(" ")
x.reverse ()
x = sorted (x,key=por_tamanho)
x.reverse ()
print (*x,sep=" ")
| true |
74b1054013321e4a95da352a7be1d209660d45b9 | daniel-reich/ubiquitous-fiesta | /zp64GNJQpZyGpYWL8_9.py | UTF-8 | 229 | 3.1875 | 3 | [] | no_license |
import re
def score_it(s):
lst = re.findall('\d+|\(+|\)+', s)
res = 0
d = 0
for i in lst:
if i.isdigit():
res += int(i)*d
elif '(' in i:
d += len(i)
elif ')' in i:
d -= len(i)
return res
| true |
1f278a96e70d21c27f09aea018dba6de1f74c311 | Adasumizox/ProgrammingChallenges | /codewars/Python/7 kyu/SquareEveryDigit/square_digits.py | UTF-8 | 109 | 3.390625 | 3 | [] | no_license | def square_digits(num):
ret = ""
for x in str(num):
ret += str(int(x)**2)
return int(ret) | true |
8868dd4f3f21c64dbcf0182a23fe3b433f3e832d | IvanLetteri/MLfeaturesExtractor | /venv/lib/python3.6/site-packages/dictdumper/html.py | UTF-8 | 2,930 | 3.1875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""dumper a JavaScript file (DEPRECATED)
Note that this file is deprecated.
``dictdumper.html`` contains ``HTML`` only, which dumpers a
JavaScript file according to ``Vue.js`` framework. However,
due to errors in grammar, the output file won't work, thus
it is now deprecated. Usage sample ... | true |
0d454108a8d02f63617d46b93c78709ecd04a1d8 | CodeLagos/Batch-Five | /Ikorodu Center 1/Python/akinsehinde akintoye project.py | UTF-8 | 196 | 3.34375 | 3 | [] | no_license | print("project of Akinsehinde Akintoye")
print ("how to convert speed from km/h to m/h")
kmh = float(input("enter the speed in km/h: "))
mph = 0.6214 * kmh
print("The speed in mph is ", mph)
| true |
486956a30b41a21354e684550fc6e2da2a6e7b25 | f1amingo/leetcode-python | /前缀和/560. 和为K的子数组.py | UTF-8 | 482 | 3.203125 | 3 | [] | no_license | from typing import List
class Solution:
def subarraySum(self, nums: List[int], k: int) -> int:
lookup = {0: 1}
pre_sum = 0
total = 0
for num in nums:
pre_sum += num
# k可能等于0
total += lookup.get(pre_sum - k, 0)
lookup[pre_s... | true |
e8a35028b91cc20e95e84717b971fb0b509f1e09 | LJGladic/EECS-337-Project-2 | /ingredients.py | UTF-8 | 4,898 | 2.71875 | 3 | [] | no_license | import numpy as np
import re
import nltk
# to do
# 73634
# good testers 7000, 139236(weird with blue cheese, comma problem and stems),14140(alt and pepper)
# problems temp of water and decimals possibly
# remove anything with parentheses around it maybe
# remove optional in 6969
# set up functionality for bigram and t... | true |
86705e3b7464b511c4e6b405f91e3512f9669818 | DaltonSounanthanam/football | /punt_model.py | UTF-8 | 899 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 9 18:48:12 2021
@author: dalton
"""
from matplotlib import pyplot as plt
import numpy as np
### build the model ###
def position_x(t, V0, theta):
return V0*np.cos(theta)*t
def position_y(t, V0, theta):
return -0.5*9.81*t**2 + V0*np.si... | true |
63dceb136e56b3dfa41d6994c77ab8709ca26386 | AhmedHathout/German-University-in-Cairo-BSc | /Semesters/Semester 10/Compiler Lab/Labs/Lab 2/Assignment/34_9785_lab_2/task_2_1.py | UTF-8 | 2,668 | 2.671875 | 3 | [] | no_license | import argparse
from antlr4 import *
from task_2_1Lexer import task_2_1Lexer
from task_2_1Listener import task_2_1Listener
from task_2_1Parser import task_2_1Parser
from antlr4.tree.Trees import Trees
from pathlib import Path
def get_token_type(token):
if token.type == task_2_1Lexer.COMMAND:
return "COMMAN... | true |
327ad6642689aba61d5510155236c2de6ccaf902 | PiontykLilia/HomeworksPy | /task2.py | UTF-8 | 738 | 3.421875 | 3 | [] | no_license | Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> #Задано чотирицифрове натуральне число.
#Знайти добуток цифр цього числа.
#Записати число в реверсному порядку.
#Посортувати цифри, що вход... | true |
4fb93a7bbab7d2d3a2304780f874a8ff1b328bde | debsir/Learning | /python/think_python/is_anagram.py | UTF-8 | 283 | 3.671875 | 4 | [] | no_license | #!/usr/bin/python
def is_anagram(word1, word2):
if (word1 == word2 or
len(word1) != len(word2)):
return False
elif sorted(list(word1)) == sorted(list(word2)):
return True
else:
return False
print is_anagram("bear", "bare")
| true |
3e19f95322b96be2ae5e0986297cae82ab1f381b | paaatcha/fuzzy | /Python/IntuitionisticFuzzyNumber.py | UTF-8 | 6,084 | 3.421875 | 3 | [] | no_license | '''
Fuzzy Numbers
Author: Andre Pacheco (pacheco.comp@gmail.com)
This file implements the class IntuitionisticFuzzyNumber, which is possible calculate the arithmetic operators with intuitionistic fuzzy number, as well as, measure the
hamming distance between 2 intuitionistic fuzzy numbers and ra... | true |
f35796cca3490cc863ca62134e145af2dcf0db0b | pierpaolofiore/A001026 | /12-Cloud_Computing-Using_Computing_as_a_Service/reboot.py | UTF-8 | 915 | 2.828125 | 3 | [
"CC0-1.0"
] | permissive | # Code to reboot an EC2 instance (configured with 'aws configure')
import boto3
from botocore.exceptions import ClientError
def getFirstInstanceID(ec2):
# Get all EC2 instances
all_instances = ec2.describe_instances()
# Select the first
first = all_instances['Reservations'][0]['Instances'][0]
# Re... | true |
b21be8ce66a629181ad1b602375870188e0c004a | syed-cbot/Fast_Segmentation | /history/debug5.py | UTF-8 | 178 | 3.78125 | 4 | [
"MIT"
] | permissive | presidents = ["Washington", "Adams", "Jefferson", "Madison", "Monroe", "Adams", "Jackson"]
for num, name in enumerate(presidents):
print("President {}: {}".format(num, name)) | true |
f4ed2dcbd2e32965940c3ede9ee1caea6cba7d1b | MaartenAmbergen/TICT-V1PROG-15-Maarten-Ambergen- | /Les04/Oefening4_1.py | UTF-8 | 136 | 3.609375 | 4 | [] | no_license | def hello(naam):
line = 'Welcome, ' + naam + ', to the world of python.'
print(line)
naam=input('Wat is je naam? ')
hello(naam) | true |
3f6f3db02c2ac0e54f098f6593439863d218e5aa | DomHin/DriftChamber-Team-A | /driftchamber/modules/ParticlePropagatorModule.py | UTF-8 | 2,572 | 3.109375 | 3 | [] | no_license | __author__ = 'Patrick Schreiber'
from driftchamber.core.module import Module
class ParticlePropagator(Module):
def begin(self, datastore):
self._detector = datastore.get('Detector')
def event(self, datastore):
"""
Propagate a particle through the detector
:param datastore: ... | true |
0a043d261c39e84635ece9e0b4788fc98476ff43 | vsseixaso/competitive-programming | /URIOnlineJudge/1009.py | UTF-8 | 150 | 3.1875 | 3 | [] | no_license | nome = raw_input()
s_fixo = float(raw_input())
mont = float(raw_input())
bonus = mont*15/100
s_total = s_fixo + bonus
print "TOTAL = R$ %.2f" %s_total | true |
02fcb8f6bf8f3148f421a734c2a546beb9259dcc | levinkoshy/Python | /Python-snippets.py | UTF-8 | 7,161 | 3.6875 | 4 | [] | no_license | #Python
and operator - 'and'
l=[]
print ','.join(l)
#gives the elements of the list separated by ','
#to find the factorial of a given number
def fact(x):
if x == 0:
return 1
return x * fact(x - 1)
n=int(raw_input())
d=dict()
for i in range(1,n+1):
d[i]=i*i
#io-34,67,55,33,12,98
#Then, the o... | true |
4cab9dc322c8c4b638faeec75cc2c410c5b9a14c | mgonzalez12/python-practicas | /clases.py | UTF-8 | 397 | 3.03125 | 3 | [] | no_license | class Lapiz:
def __init__(self,color,contiene_borrador,usa_grafito, *args, **kwargs):
self.__color = color
self.contiene_borrador = contiene_borrador
self.usa_grafito = usa_grafito
def dibujar(self):
print("el lapiz esta dibujado")
def borrar(self):
print("Borrando"... | true |
8ccce6e424a59caee279703b4a94c3f27175baa5 | NearJiang/PythonReview | /常用内建模块/itertools/count.py | UTF-8 | 156 | 3.328125 | 3 | [] | no_license | import itertools
natuals = itertools.count(2)#从几开始,count()会创建一个无限的迭代器,只能ctrl+c
for n in natuals:
print(n)
| true |
965d1428864e93c4c1c0ca39a15031a7ef1f7385 | kd0kfo/utils | /python/abspath.py | UTF-8 | 394 | 3.71875 | 4 | [] | no_license | #!/usr/bin/env python
#
# Displays the full path to a file or directory.
# If the file does not exist, or if the link is broken, and error message is
# displayed and the script exits with error code 1
import os.path
from sys import argv
filename = argv[1]
path = os.path.abspath(filename)
if not os.path.lexists(path):... | true |
110cff3788ae29f604feaf43814059e5d35b80f2 | sunshinelu/PythonDiary | /Spark/RDD/WordCountDemo2.py | UTF-8 | 1,825 | 2.796875 | 3 | [] | no_license | #-*- coding: UTF-8 -*-
from pyspark import SparkContext
from pyspark import SparkConf
import pyspark
import pyspark.sql
from pyspark.sql import SparkSession
import sys
reload(sys)
# print sys.getdefaultencoding()
sys.setdefaultencoding('utf8')
# print sys.getdefaultencoding()
master= "local"
spark = SparkSession.bui... | true |
d045dcbea9d041055e77160f40d9d7682fbf2dbb | brandonmorren/python | /C7 text Files/oefTextFiles/oef 4.py | UTF-8 | 454 | 3.609375 | 4 | [] | no_license | with open("./Files/irish_song.txt") as file:
line = file.readline().rstrip()
shortest_line_length = len(line)
shortest_line = line
while line:
if line != "\n":
if len(line) < shortest_line_length:
shortest_line_length = len(line)
shortest_line = line
... | true |
3d10f5201ba595461f8a35bfa398808d44b7478b | AchyuthReddy001/TeluguActorClassification | /classifier.py | UTF-8 | 3,176 | 3.03125 | 3 | [] | no_license | import numpy as np
import keras
from keras.layers import Dense
from keras.layers import Flatten
from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.preprocessing import image
from keras.preprocessing.image import ImageDataGenerator
#Building sequential o... | true |
b31a94de208ade30c93cc61bee08c983802a74ca | BobsunPower/python_basics | /first_steps_in_coding/lab/09. Yard Greening.py | UTF-8 | 202 | 3.59375 | 4 | [] | no_license | square_meters = float(input())
expenses = square_meters * 7.61
discount = expenses * 0.18
total = expenses - discount
print(f"The final price is: {total} lv.")
print(f"The discount is: {discount} lv.")
| true |
8b9643f87ffd5c8cc5ca07f5870a6f21e5091dfc | allegravia/programming-for-bioinformatics | /scripts/score_seq_from_fasta_file.py | UTF-8 | 694 | 3.609375 | 4 | [
"MIT"
] | permissive | #Input: two strings of text of equal length from fasta file
#Output: similarity score s based on a +1/scoring scheme
def scoring(seq1, seq2):
s = 0
for i in range(len(seq1)):
if seq1[i] == seq2[i]:
s += 1
else:
s += -1
return s
def read_input(fasta_file):
seqs ... | true |
bfd0662fc7925d2245e132ba4d0bf4257858b28c | Tendrid/Madcat | /battalion/models/firesystem.py | UTF-8 | 5,074 | 2.515625 | 3 | [] | no_license | """
The fire system has an ID, and takes in a config which maps each tube to
a relay. The config comes from the Battlefield, and is requested by ID.
"""
from battalion.models.fuse import Fuse
from zmq import REP, POLLIN
from zmq.asyncio import Context, Poller
import hashlib
import urllib3
import time
import asyncio
i... | true |
3a6e4828eee0495748aa074acb70dccf19ba52d3 | oshou/design-pattern | /GoF/Creational/AbstractFactory/ex1/diagram1.py | UTF-8 | 3,281 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python
import os
import sys
import tempfile
def main():
txtDiagram = create_diagram(DiagramFactory())
txtDiagram.save(textFilename)
svgDiagram = create_diagram(SvgDiagramFactory())
svgDiagram.save(svgFilename)
def create_diagram(factory):
diagram = factory.make_diagram(30, 7)
... | true |
ca768e4749bcd068c877a36aed21cf4a39be0c5e | JeanXL/MFCC-Speech-Commands-Recognize- | /compare_model.py | UTF-8 | 3,108 | 2.515625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import sys
sys.path.append("..")
from config import cfg
from data_prepare import _parse_example
from data_prepare import gen_data_batch
def gen_test_data(file_pattern, num_samples):
files = tf.data.Dataset.list_files(file_pattern)
dataset = files.flat_map(tf.data.TFRecor... | true |
0cf82af96c13f44fb7ad093b475cc8984ae47087 | montse139/kilometers_to_miles | /conv.py | UTF-8 | 334 | 3.90625 | 4 | [] | no_license | print "Convert kilometers to miles!"
while True:
kilometers = int(raw_input("Number of kilometers to convert: "))
print (kilometers * 0.621371)
convert = raw_input("Do you want to convert something else? (answer Y or N): ")
if convert != "Y":
print "Thanks for using me!"
break
#kilome... | true |
3a7e391087f4efa845b87bdb80fba79aa2084cc8 | MHatmaker/BSCatcher | /BSurv.py | UTF-8 | 4,087 | 2.75 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
import sys
import datetime
import argparse
import pdb
class PodcastDBChecker(object):
def __init__(self, startover=False):
self.existingCatches = []
self.con = lite.connect('bbsurv.db')
self.cur = self.con.cursor()
w... | true |
b6bcea7ae94269ab2a7cfe9e46e59cc1e89eadfc | nCheck/weather-predictor-for-heroku | /app.py | UTF-8 | 3,384 | 2.765625 | 3 | [] | no_license | import flask
import os
from flask import jsonify, request
from flask import flash, redirect, url_for, session
from joblib import load
from flask_cors import CORS, cross_origin
import requests, json
import pandas as pd
import requests
model = load('random_forest.joblib')
app = flask.Flask(__name__)
app.config["... | true |
7e2f48e349bfe0b863191b387569ba598325fc82 | sscswapnil/Machine-Learning | /!Book and Paper/Machine_learning_mastery_with_Python_mini_course/Machine Learning with Python/mini_course.py | UTF-8 | 3,223 | 3.421875 | 3 | [] | no_license | # coding:utf8
## == Lesson 1: Download and Install Python and SciPy Ecosystem ==
# Python version
# import sys
# print('Python: {}'.format(sys.version))
# # scipy
# import scipy
# print('scipy: {}'.format(scipy.__version__))
# # numpy
# import numpy
# print('numpy: {}'.format(numpy.__version__))
# # matplotlib
# impo... | true |
e14545c9a9215f72690c389d78d70ccc0d229a5b | aaguy-hue/CyberToolsBot | /cogs/hashes.py | UTF-8 | 3,253 | 2.90625 | 3 | [] | no_license | import discord
from discord.ext import commands
import hashlib
import io
import requests
import inspect
class Hashes(commands.Cog):
def __init__(self, bot):
self.bot = bot
self._last_member = None
def hashing(self, kind: str, text: str):
if kind == "sha256":
the_hash = hash... | true |
bd54916483b4f949491ff34d7dde4c51005a86d5 | vinay631/behavioral_cloning | /model.py | UTF-8 | 4,258 | 2.65625 | 3 | [] | no_license | import pandas as pd
import seaborn as sns
import numpy as np
import cv2
import keras
import matplotlib.pyplot as plt
import glob
import os
from sklearn.utils import shuffle
from utils import augment, preprocess_img
from sklearn.model_selection import train_test_split
from keras.models import Sequential, Model
from ker... | true |
7c290c4f8aa4c1942fa3b62019d690232d4c6db3 | jannikisakoolprogrammer/Szavak | /Szavak/code/Button.py | UTF-8 | 662 | 2.65625 | 3 | [] | no_license | from code.Label import Label
class Button(Label):
def __init__(
self,
_config = dict()):
super(
Button,
self).__init__(_config)
self.fg_colour_hover = self.config["fg_colour_hover"] if "fg_colour_hover" in self.config else (200, 150, 100)
self.bg_colour_hover = self.config["bg_colour_hover"] i... | true |
f3ab2fa92244a156619a7d14d6ae6c2be110a926 | Torxed/Scripts | /python/2d.py | UTF-8 | 2,024 | 3.796875 | 4 | [] | no_license | import math
class Pos:
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return f'Pos(x: {self.x}, y: {self.y})'
class Tangent:
def __init__(self, delta):
self.delta = delta
def __repr__(self):
return f'tan(rad: {self.radiance}, deg: {self.angle})'
@property
def radiance(self):
... | true |
3d3304ddecdc1813c8ae93255660052f85128acd | ShuffleBox/Ercot2Influx | /ercot2influx.py | UTF-8 | 1,965 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
'''
ercot current grid status importer
'''
import argparse
from datetime import datetime
import pytz
import requests
from influxdb import InfluxDBClient
from bs4 import BeautifulSoup
def main(args):
'''
* Get Ercot status page
* parse table contents to build payload
* initialize I... | true |
a5b5b58e93ab4b0348f4a4d743b9341b8a504cfb | duncanwp/emtpy | /src/emtpy/tests/test_engine.py | UTF-8 | 5,593 | 2.734375 | 3 | [] | no_license | __author__ = 'pard'
from emtpy.tests.semi_analytic_solution import finite_square_box_energies, infinite_square_box_energy
from nose.tools import istest, nottest, eq_
from emtpy.utils import assert_almost_equal
from emtpy.potential_energy import Harmonic, OneDWell, ThreeDOneDWell
class MockMaterialDistribution(object)... | true |
9536a68c64a511f3d350cb6009efdc3b7380d415 | alk2018/Python | /akodua_218_L7.py | UTF-8 | 2,134 | 3.734375 | 4 | [] | no_license | # Albert Kodua
# G01139458
# CS 112
def rank3(x,y,z, ascending = True):
#A new list is created.
new_list = [x,y,z]
#The list is then sorted based on ascending
#or descending order, if the optional parameter
#was included
new_list.sort(reverse = not ascending)
#the list is then converted into a tup... | true |
0590bdebbabe247e29dce3760585aaffaa56cf97 | AjitTramp/Face-Classification | /AgeDetection.py | UTF-8 | 2,346 | 2.609375 | 3 | [] | no_license | data_dir='/home/ajit/Desktop/AgeDetection'
% pylab inline
import os
import random
import pandas as pd
from scipy.misc import imread
root_dir = os.path.abspath('.')
train = pd.read_csv(os.path.join(data_dir, 'train.csv'))
test = pd.read_csv(os.path.join(data_dir, 'test.csv'))
import cv2
temp = []
for img_name in t... | true |
2afb91db066af1827e4e554982f3a00970252113 | jaeyoung-kang/career_recommendation | /src/utils/label_encoder.py | UTF-8 | 5,483 | 2.984375 | 3 | [] | no_license | import bisect
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
class FeatureLabelEncoder:
def fit_transform(self, *args, **kwargs):
self.fit(*args, **kwargs)
return self.transform(*args, **kwargs)
def fit(self, *args, **kwargs):
pass
def ... | true |
f826088e356b756065810ef04e10fd2b4e7888ee | AnTi-anti/Python_Demo | /YangMao.py | UTF-8 | 3,237 | 2.578125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import pandas as pd
import schedule
import time
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import smtplib
"""
https://zhuanlan.zhihu.com/p/397792864
"""
def get_content():
url = 'https://ym.today/yangmao'
r... | true |
523df1ad4f814438950bd5aa611e7970cbb318a4 | nelgau/rental_scraper | /update_google_sheet.py | UTF-8 | 3,014 | 2.5625 | 3 | [] | no_license | #!/usr/local/bin/python3
# -*- coding: utf-8 -*-
from __future__ import print_function
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from pprint import pprint
from datetime import timezon... | true |
6a8bdfe3d8f14e752aef553fc6ce32ea7a680975 | made-ml-in-prod-2021/zingykizz | /airflow_ml_dags/images/airflow-train-model/train_model.py | UTF-8 | 645 | 2.828125 | 3 | [] | no_license | import os
import pandas as pd
import click
from sklearn.linear_model import LogisticRegression
import pickle
from typing import NoReturn
@click.command()
@click.option("--input-dir", required=True)
@click.option("--model-dir", required=True)
def train_model(input_dir: str, model_dir: str) -> NoReturn:
X_train = p... | true |
112a42b960a6013e4f32e97e2317ddbe8cdad125 | chirathr/CodeForces | /team.py | UTF-8 | 179 | 2.921875 | 3 | [] | no_license | # http://codeforces.com/problemset/problem/231/A
n = input()
count = 0
for case in range(n):
if sum(map(int, raw_input().split(' '))) > 1:
count += 1
print (count)
| true |
1895b5d52ce3bf2324f64d8b31528722b98eb932 | Matthiti/Advent-of-Code-2019 | /tests/test_day_16.py | UTF-8 | 645 | 2.6875 | 3 | [] | no_license | import unittest
import sys
sys.path.append('../')
import day_16
class TestDay16(unittest.TestCase):
def test_example_1(self):
input = "80871224585914546619083218645595"
res = day_16.main(input)
self.assertEqual(res, 24176176)
def test_example_2(self):
input = "19617804207202209144916044189917"
res = ... | true |
b0b5794dc7963da9d6cfa28ad152b91028803fc0 | dtsbourg/scikit-exp | /knn.py | UTF-8 | 2,552 | 3.46875 | 3 | [] | no_license | # An example using k-NN for classification
# based on * http://scikit-learn.org/stable/tutorial/statistical_inference/supervised_learning.html#k-nearest-neighbors-classifier
# * http://www.scipy-lectures.org/packages/scikit-learn/index.html#k-nearest-neighbors-classifier
import numpy as np
from sklearn import... | true |
0c4264bb3868091549def2b2657f4fc149c2de73 | DRCART03/CodeCombat | /Mountain/BoneDance/BoneDance.py | UTF-8 | 531 | 3.671875 | 4 | [] | no_license | # https://codecombat.com/play/level/bone-dance
# Just don't angry skeletons for 60 seconds.
# This function is useful to compare float numbers.
def almostEqual(a, b):
return Math.abs(a - b) < 1
while True:
skeleton = hero.findNearestEnemy()
# Find the radius of the skeleton circle.
radius = hero.dista... | true |
5780e9e40217004ab0fae0b1da86ab82d583a71c | Gttz/Python-03-Curso-em-Video | /Curso de Python 3 - Guanabara/Mundo 03 - Estruturas Compostas/Aula 21 - Funções (Parte 2)/101 - Função_Votação.py | UTF-8 | 768 | 4.375 | 4 | [] | no_license | # Exercício Python 101: Crie um programa que tenha uma função chamada voto() que vai receber como parâmetro o ano de
# nascimento de uma pessoa, retornando um valor literal indicando se uma pessoa tem voto NEGADO, OPCIONAL e
# OBRIGATÓRIO nas eleições.
def voto(ano):
# é melhor importamos dentro da função p... | true |
840c0d1840059b063078030bcc2e7b4278c5924e | kshade88/Fyyer-FSND | /app/models.py | UTF-8 | 2,471 | 2.640625 | 3 | [] | no_license | from app import db
# Genres
venue_genres = db.Table('venue_genres',
db.Column('venue_id', db.Integer, db.ForeignKey('venue.id')),
db.Column('genre_id', db.Integer, db.ForeignKey('genre.id'))
)
artist_genres = db.Table('artist_genres',
... | true |
a65ed3d85be1166ed0c549d26a98b7a2358e2593 | append-knowledge/pythondjango | /1/EXAM 2/double string.py | UTF-8 | 279 | 3.4375 | 3 | [] | no_license | class Student():
def deta(self,name,age,place):
self.name=name
self.age=age
self.place=place
print(self.name,self.age,self.place)
def __str__(self):
return self.name+str(self.age)
oop=Student()
oop.deta('lijo jose',26,'pzb')
print(oop) | true |
66c85666642e4e4d8999d873b5b5293d7d42b6bf | yongqis/trilinear_se_net | /util/checkpoint_util.py | UTF-8 | 6,069 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import logging
import re
import tensorflow as tf
def get_variables_available_in_checkpoint(variables, checkpoint_path, include_global_step=True):
"""Returns the subset of variables available in the checkpoint.
Inspects given checkpoint and returns the subset of va... | true |
f74b32537bb1d1a875e35d2f98fd3b75d48a8eab | Boberkraft/Data-Structures-and-Algorithms-in-Python | /chapter5/C-5.17.py | UTF-8 | 807 | 3.65625 | 4 | [] | no_license | """Prove that when using a dynamic array that grows and shrinks as in the
previous exercise, the following series of 2n operations takes O(n) time:
n append operations on an initially empty array, followed by n pop operations.
n append operation takes O(n) time (book proven it before)
Shrinking the array with pop hav... | true |
ea2626a26f02bd0abbd4a05cec6f530788eb516c | ddmbr/Extendible-Hashing | /src/maketestinput.py | UTF-8 | 221 | 2.890625 | 3 | [] | no_license | import re
keys = []
with open('lineitemcut.tbl', 'r') as f:
n = 0
for line in f:
key = int(line[:line.find('|')])
n += 1
keys.append(key)
print n
for key in keys:
print key
| true |
9540d525307d2704d0b497c2275f1fc6f209d2e2 | all-of-us/raw-data-repository | /rdr_service/lib_fhir/fhirclient_4_0_0/models/practitioner.py | UTF-8 | 6,737 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Practitioner) on 2019-05-07.
# 2019, SMART Health IT.
from . import domainresource
class Practitioner(domainresource.DomainResource):
""" A person with a formal responsibility in the... | true |
5a885c420f004aba4811059194328edb79f3b755 | jianghc724/DataCleaningForHomework | /reader.py | UTF-8 | 494 | 3.140625 | 3 | [] | no_license | import csv
class FileReader():
def readFile(self, fileName):
result = []
if fileName.endswith(".csv"):
csvFile = open(fileName, "r")
reader = csv.reader(csvFile)
for item in reader:
if reader.line_num == 1:
continue
... | true |
a61ab41a5f35c8c7f410cb0395bf0bd35afa29f2 | shaynenguyen/DSme | /Pro3/pythons/cross_validation.py | UTF-8 | 1,788 | 3.078125 | 3 | [] | no_license | from sklearn.model_selection import train_test_split, cross_val_score, cross_val_predict
from sklearn import metrics
import numpy as np
import matplotlib.pyplot as plt
def cross_validation(linear, X,y):
# RETURN value
result = dict()
# Global Variable
CV = 10
#-----------------------------------... | true |
a9b6b5baf272c5dd9d0d71bf3593bc05ed41d4ec | Freshield/LEARN_TENSORFLOW | /20_Project/17_otto_new_reshape/test2.py | UTF-8 | 1,061 | 3.03125 | 3 | [] | no_license | import numpy as np
#set num to one hot array
#ver 1.0
def num_to_one_hot(dataset, category_num):
lines = dataset.shape[0]
one_hot_dataset = np.zeros([lines, category_num], dtype=np.float32)
one_hot_dataset[np.arange(lines), dataset] = 1
return one_hot_dataset
def reshape_dataset(dataset):
#100,9... | true |
baa2d4edb61acbbddbbec7973169d3a3137f4c01 | arifhossain94/SimplePythonProjects | /RestaurantReservationSystem.py | UTF-8 | 2,753 | 4.375 | 4 | [] | no_license | # Simple Restaurant Reservation System with reporting
class RestaurantReservationSystem:
# initialize table of size 20 -- default value 'AVAILABLE'
table = ["AVAILABLE"] * 20
# get table number from input
@staticmethod
def __get_table_number():
while True:
try:
t... | true |
c65f33bec6987121305b039a93b748138e9299a1 | yonghumingzi/cryptography | /Question3/challenge6.py | UTF-8 | 2,020 | 3.171875 | 3 | [] | no_license | #coding=utf-8
from __future__ import division
from struct import unpack
from challenge3 import find_key, str_dec
from challenge5 import xor_key_enc
def str_xor(str1, str2):#异或字符串
result = []
for i in xrange(len(str1)):
(a,), (b,) = unpack('B', str1[i]), unpack('B', str2[i])
result.append(bin(a ^ b))
return resu... | true |
6126258f072be71ddc9bde8c372a61a6cb627bb1 | muatik/sitemapper | /sitemapper/link_repository.py | UTF-8 | 1,167 | 3.203125 | 3 | [] | no_license | from collections import deque
class LinkNotFound(Exception):
def __init__(self, link, cause=""):
self.message = "link '{}' not found. {}".format(link, cause)
class EmptyList(Exception):
def __init__(self, message):
self.message = message
class LinkRepository(object):
STATUS_WAITING = "... | true |