blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
4df40b1c4c502a81fff75481c25ef334b23d53aa | Python | tusharkmandal/General | /split.py | UTF-8 | 239 | 2.796875 | 3 | [] | no_license | def email_func(valstr):
if '@' in valstr:
for mail in valstr.split(" "):
if '@' in mail:
return mail
else:
return False
email_func("this is first abhinav@cloudxlab.com and this is second sandeep@cloudxlab.com")
| true |
52a566ccd01ad45059feed63a2c9706f7c5c8eb0 | Python | robinandeer/pyNoise | /src/playwmsa.py | UTF-8 | 2,544 | 2.890625 | 3 | [] | no_license | #! /usr/bin/env python
import sys
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio import AlignIO
def findIndels(seq):
# Find all occurences of indels
if seq.find('-') != -1:
return True
else:
return False
return pos
def checkAas(seq,rows):
""" Checks if the s... | true |
6ef96ec2b89200849c4bbab0fa58c7c9f93443ac | Python | MO105/DreamTeam | /Data_mining/Subcellular_location/Subcellular location mining.py | UTF-8 | 5,117 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 17:44:36 2020
@author: sheri
"""
#Import packages
import csv
import pandas as pd
import requests
import re
import numpy as np
#-----------------------------------------------------------------------------------------------------------------#
#Read th... | true |
d57dd2d2e36e279ece77b2c0e36587188107245f | Python | dhaval1212/Optical-Character-Recognition | /loadingModel.py | UTF-8 | 934 | 2.96875 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
from keras.preprocessing import image
import cv2
import matplotlib.pyplot as plt
CATEGORIES = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
test_image = cv2.imread('myTestImages/s65.jpg',cv2.IMREAD_GRAYSCALE)
test_im... | true |
ca0870ad779aeb3ee5e743b90f27134125c83d72 | Python | usnistgov/mosaic | /mosaic/trajio/binTrajIO.py | UTF-8 | 8,195 | 2.796875 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # -*- coding: utf-8 -*-
"""
Binary file implementation of metaTrajIO. Read raw binary files with specified record sizes
:Created: 4/22/2013
:Author: Arvind Balijepalli <arvind.balijepalli@nist.gov>
:License: See LICENSE.TXT
:ChangeLog:
.. line-block::
9/13/15 AB Updated logging to use mosaicLogFormat class
... | true |
34d92e937d32dfc948cc634f19be3bb06c7a3874 | Python | srikanth000/iLID | /preprocessing/test/test_resampling.py | UTF-8 | 1,153 | 2.625 | 3 | [
"MIT"
] | permissive | from audio import resample
import numpy as np
import unittest
import math
import scipy.io.wavfile as wav
class ResamplingTest(unittest.TestCase):
def test_downsampling(self):
samplerate = 22100
length = np.random.randint(0,5) + round(np.random.random(), 2)
num_samples = samplerate * length
signal =... | true |
ea157d24f746a6746b62bf42ed47c7aad66324b4 | Python | calizzim/technical-interview-practice | /odd-even-jump/test.py | UTF-8 | 294 | 3 | 3 | [] | no_license | import bisect
class NumI:
def __init__(self,val,index):
self.val = val
self.index = index
def __lt__(self, other):
return self.val < other.val
def __str__(self):
return str([self.val,self.index])
l = [1,2,3,4,5]
m = l[0:2]
print(m)
l[0] = 2
print(m) | true |
8a6667901a27a4d566a143cf7e70a1a8d0bbfe0a | Python | Teodorneishan/SoftUniLatest | /fishing_boat.py | UTF-8 | 649 | 3.890625 | 4 | [] | no_license | budget = int(input("Enter budget:"))
season = input("Season:")
fishermen = int(input("Fishermen:"))
if season == "Spring":
price=3000
elif season == "Summer":
price=4200
elif season == "Autumn":
price=4200
elif season == "Winter":
price=2600
if fishermen <=6:
price=price*0.9
elif 6 < fishermen <= ... | true |
a55fb8e55f4bcedb57707ca12a19e3ddbe4ad4cd | Python | moussaifi/Web-Developpement-App-Muimui | /code/src/model/person_detect.py | UTF-8 | 2,841 | 2.546875 | 3 | [] | no_license | from imutils.object_detection import non_max_suppression
import numpy as np
import imutils
import cv2
hog = cv2.HOGDescriptor()
hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
BLUR = 21
CANNY_THRESH_1 = 10
CANNY_THRESH_2 = 200
MASK_DILATE_ITER = 10
MASK_ERODE_ITER = 10
MASK_COLOR = (1.0,1.0,1.0) # In... | true |
20d9621706d65387abcd8232330cc731893f68a4 | Python | eianlee1124/daily-practice | /programmers/튜플.py | UTF-8 | 318 | 2.953125 | 3 | [] | no_license | import re
from collections import Counter
def solution(s):
s = Counter(re.findall('\d+', s))
return list(map(int, [k for k, _ in sorted(s.items(), key=lambda x: x[1], reverse=True)]))
if __name__ == "__main__":
print(solution("{{2},{2,1},{2,1,3},{2,1,3,4}}"))
print(solution("{{20,111},{111}}")) | true |
cbdfed5b9035488755ef106318849538d5794f0e | Python | YuriiPaziuk/leetcode | /string/242. Valid Anagram.py | UTF-8 | 1,680 | 3.984375 | 4 | [] | no_license | """
Given two strings s and t, write a function to determine if t is an anagram of s.
For example,
s = "anagram", t = "nagaram", return true.
s = "rat", t = "car", return false.
Note:
You may assume the string contains only lowercase alphabets.
Follow up:
What if the inputs contain unicode characters? How... | true |
01b84260b156c789cb2f9f86ea72dd382dc6e291 | Python | leoray317/CFNN | /hw3-mainprogram.py | UTF-8 | 3,653 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 19 12:00:51 2019
@author: steve
"""
#import the modules
import numpy as np
import math
import os
import matplotlib.pyplot as plt
#define the functions
# f2 is the function that generate forecasting data according to the variable that contain random numbers which is data... | true |
6d4b415399063b9984a210295d40e8d0a192a90f | Python | mindrobots/100_python_exercises | /38.py | UTF-8 | 169 | 2.890625 | 3 | [] | no_license | # mental exercise
# below line of code throws an error because a line is missing before it
# points 1
'''
math.sqrt(9)
'''
# should be
'''
import math
math.sqrt(9)
'''
| true |
da1efaa67f95062218f85c573d09ba8c86b5c3a3 | Python | two-first-names/advent-of-code-2020 | /day3/part2.py | UTF-8 | 774 | 3.578125 | 4 | [] | no_license | #!/usr/bin/env python3
import math
def main():
lines = []
with open('input') as f:
for l in f:
lines.append(list(l.strip()))
end = len(lines)
line_len = len(lines[0])
def get_trees_for_slope(right, down):
x = 0
y = 0
trees = 0
while y < end:
... | true |
7c96d14c2bb04038ff8ee53b01041faa4724f05f | Python | Curso-de-Python/Clase14 | /ejercicio2.py | UTF-8 | 553 | 3.875 | 4 | [] | no_license | '''
-----------------------------
EJERCICIO N°2
Variables de clase
-----------------------------
'''
class ClaseEjemplo:
contador = 0
def __init__(self, val = 1):
self.__primera = val
ClaseEjemplo.contador += 1
objetoEjemplo1 = ClaseEjemplo()
objetoEjemplo2 = ClaseEjemplo(2)
objetoEjemplo3 = ClaseEjemplo... | true |
7be714dbead64ccb15afaa6a8eaf7177bf403436 | Python | cduck/qutrits | /cirq/schedules/schedulers_test.py | UTF-8 | 10,378 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2018 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | true |
e17d4e47c81e9ca70b247a62f4af1235842e9a15 | Python | mattijn/pynotebook | /2015/2015-12-24 Time series forecast numpy lstsq svd.py | UTF-8 | 5,068 | 2.625 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
import matplotlib.pyplot as plt
get_ipython().magic(u'matplotlib inline')
# In[2]:
import numpy as np
# training data
X1=np.array([[-0.31994,-0.32648,-0.33264,-0.33844],[-0.32648,-0.33264,-0.33844,-0.34393],[-0.33264,-0.33844,-0.34393,-0.34913],[-0.33844,-0.34393,-0.34913,-0.35406],[-0.3... | true |
a20b372481485a8cb55071b89bfcc9d338ff12c0 | Python | spectraldoy/MusicTransformerTensorFlow | /transformerutil6.py | UTF-8 | 26,678 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | import mido
import tensorflow as tf
import numpy as np
import random
"""
Implementation of a converter of MIDI files to and from the event-based
vocabulary representation of MIDI files according to Oore et al., 2018
Also some heloer fuctions to be able to use the transformer model properly
Possible MIDI events being ... | true |
098841b46ae64b4fdf7167e794a022fd41da2a58 | Python | iyozh/PythonFinalTask | /rss_reader/rss_reader/converter.py | UTF-8 | 3,399 | 2.90625 | 3 | [] | no_license | import hashlib
import io
import logging
import os
import sys
from pathlib import Path
from jinja2 import Template
from xhtml2pdf import pisa
ROOT_DIR = Path(__file__).resolve().parent.parent
class Converter:
"""This class is implementation of converter to PDF and HTML format"""
def __init__(self, directory... | true |
e9694759e4e5e546238b3f33049ee80800299dba | Python | kateroskostas/apdd | /read_my_solutions.py | UTF-8 | 3,601 | 3.375 | 3 | [] | no_license | from networkx import Graph
# Καθε αρχείο περιέχει 2 στήλες η μια το ονομα του μαθήματος
# και η δευτερη ειναι ο κωδικός καθε περιόδου
def read_solution(path):
# Δημιουργώ ενα λεξικό το οποίο στην αρχή είναι κενό
solution = dict()
# oΑνοίγω το αρχείο μου με δηκαιώματα ανάγνωσης
file = open(path, "r")
... | true |
b274cd7473b828724952c37257a5a1e0ab313dd4 | Python | ati-ozgur/course-python | /2022/examples-in-class-2022-11-18/altair_example1.py | UTF-8 | 368 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # to be able to use following code
# I need to install the packages using pip
# pip install altair
# pip install altair_viewer
import pandas as pd
import altair as alt
df = pd.read_csv('seattle-weather.csv')
chart = alt.Chart(df)
alt.Chart(df).mark_circle().encode(
x=alt.X('temperature', bin=True),
y=alt.Y(... | true |
318cfd9ad440f88e4803efdff99c347ae5594cb8 | Python | iWonder118/atcoder | /python/ABC044/B.py | UTF-8 | 198 | 3.359375 | 3 | [] | no_license | import collections
w = list(input())
w_count = collections.Counter(w)
flag = True
for i in w_count.values():
if i % 2 != 0:
flag = False
if flag:
print("Yes")
else:
print("No")
| true |
9c946c11043a66cb35b0af4c3ecc751e07b89b1a | Python | erenes/vng-api-common | /vng_api_common/scopes.py | UTF-8 | 1,461 | 3.15625 | 3 | [] | no_license | from typing import List
OPERATOR_OR = "OR"
OPERATOR_AND = "AND"
SCOPE_REGISTRY = set()
class Scope:
def __init__(self, label: str, description: str = None):
self.label = label
self.description = description
# combined scopes
self.children = []
self.operator = None
... | true |
37bc6911d2241d0d7352262bfd2dd1e276551740 | Python | wwendler/collection | /r4game/abminimax.py | UTF-8 | 2,805 | 3.046875 | 3 | [
"ISC"
] | permissive | # abminimax.py
# An ai using minimax and alpha beta pruning
import r4server as r4
import random
def opponent(player):
return player%2+1
eval_max = 9999
eval_min = -9999
def eval(player, board):
count = 0
opp = opponent(player)
for y in range(len(board)):
for x in range(len(board[0])):
... | true |
697f2e0104ab28d98435e1dc82dcef022c7313f5 | Python | Hodaya1234/Project | /data_set.py | UTF-8 | 1,977 | 2.84375 | 3 | [] | no_license | import torch.utils.data as data_utils
import torch
class DataSet(data_utils.Dataset):
def __init__(self, x, y):
super(DataSet, self).__init__()
self.all_x = x
self.all_y = y
self.n_data = x.shape[0]
def __getitem__(self, index):
x = self.all_x[index]
y = self.a... | true |
8f6fe777e3bcfcee80c2725ac2dc33c9655dc3b3 | Python | senlau/Library_Management_System | /src/tables/Member.py | UTF-8 | 615 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | from sqlalchemy import Column, Integer, String, DateTime
from DbConfig import Base
class Member(Base):
__tablename__ = 'members'
id = Column(String(32), unique=True, nullable=False, primary_key=True)
name = Column(String(32))
email = Column(String(32), nullable=True)
password = Column(String(128), nullable=Fals... | true |
03057d7fc7e66e83402030c8352c48ee4c8ebefc | Python | honeywang991/test01 | /python9/class_0809_object/test.py | UTF-8 | 108 | 3.34375 | 3 | [] | no_license |
def add(*args):
sum = 0
for i in args:
sum+=i
print(sum)
add(1,2,3,4,5,6,7,8,9,10) | true |
712f404a9e58d03cc703ab4ecaa558548e843346 | Python | Mampfzwerg/Praktikum | /V.206/latex-template/content/dampfdruck.py | UTF-8 | 783 | 2.890625 | 3 | [] | no_license | import numpy as np
from uncertainties import ufloat
import matplotlib.pyplot as plt
a, b, c, d, e, f = np.genfromtxt('mess1.txt', unpack=True)
pa = (d + 1)
T2 = c + 273.15
#print(np.log(pa))
#print(1/T2)
params, covariance_matrix = np.polyfit(1/T2, np.log(pa), deg=1, cov=True)
errors = np.sqrt(np.diag(covariance_m... | true |
223e7ece52aa4df8cd51b029d05cb5338cfc60fd | Python | shambhand/pythontraining | /material/code/oop/inheritance/demo_progs/inheritance2.py | UTF-8 | 358 | 3.3125 | 3 | [] | no_license | # Replace demo
import sys
class BaseClass:
def method (self):
print ("BaseClass:This is a Base-place holder method")
class DerivedClass (BaseClass):
def method (self):
print ("DerivedClass:This is a Derived-place holder method")
def main ():
b1 = BaseClass ()
b1.method ()
d1 = DerivedClass ()
d... | true |
7d6a69aa570daaff9a852929dcdbe9209166e9ef | Python | ahatherly/PythonPlatformer | /PlatformGame/Levels.py | UTF-8 | 1,137 | 3.03125 | 3 | [] | no_license | from Enemies import Enemy
class Levels:
level_width = 0
level_height = 0
start_level_x_offset = -160
level_x_offset = -160
def __init__(self):
self.levelTiles = []
def loadLevel(self, filename, enemies):
file = open(filename, "r")
for line in file:
if len(line) < 2:
# Empty
pass
elif line[... | true |
1cdc70974807f1f468057448b90153bf53c07ebe | Python | annateuerle/LAI_thesis | /h5util.py | UTF-8 | 1,894 | 2.921875 | 3 | [] | no_license | """
Store/Access data in hdf5 file using some compression
Otherwise we have files which takes many gigabytes..
Saves hdf5 dataset in 'groupname/xxxx'
"""
import numpy as np
import logging
import h5py
import datetime
from settings import conf
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
log.addHand... | true |
479c31513e1c93a70c2450769ae2bf56034997b8 | Python | spgeise/Restaurant-Selector | /Files/Zipcodelist.py | UTF-8 | 353 | 2.5625 | 3 | [] | no_license | from csv import reader
zipcodes = []
latlist = []
longlist = []
def openconverstionfile():
file_name = 'Files\Zipcodelist.txt'
with open(file_name) as zipdata:
zipfile = reader(zipdata)
for row in zipfile:
zipcodes.append(row[0])
latlist.append(row[1])
... | true |
b82fad0633c3ff0bb60b2af08bccfdf60631fe45 | Python | naive9527/luffycity-1 | /luffycity后端/utils/response.py | UTF-8 | 596 | 2.671875 | 3 | [] | no_license | """
响应的数据格式
"""
class BaseResponse(object):
"""
数据类型
ret = {"code":1000, "data": None, "error": None,}
"""
def __init__(self):
self.code = 1000
self.data = None
self.error = None
@property
def dict(self): # 用于 Response时返回对象里面的值。
return self.__dict__
cla... | true |
b7bee159fb1a91c7ca15b3e3a1a26959b4df830f | Python | simsekonur/Python-exercises | /iteration/factorial.py | UTF-8 | 253 | 3.890625 | 4 | [] | no_license | print ("*****************")
print ("Factorial Computing Program")
print ("Please enter a number...")
print ("*****************")
number = int (raw_input ("Enter a number :"))
result=1
while (number > 0):
result*=number
number-=1
print (result)
| true |
a6c839a6223a508d2da07609a52236a1f77e244d | Python | mrzzy/Portfolio-I | /practicals/code/traffic_light.py | UTF-8 | 1,522 | 3.3125 | 3 | [
"MIT"
] | permissive | #
# traffic_light.py
# Portfolio I - Lab 1-2
# Similates a Traffic light system with the raspberry pi
#
import lcddriver
import time
from datetime import datetime, timedelta
from gpiozero import LED
# Pinout constants
# TODO: fill this up to work
PIN_RED_LED = 0
PIN_AMBER_LED = 0
PIN_GREEN_LED = 0
# Displays the g... | true |
aeadec61e79c71e19bb325ee4e5996ae776d7f0f | Python | bigdata2016/bigwork2016 | /week7/wen/ex7.2/euler_tour.py | UTF-8 | 794 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python
from mrjob.job import MRJob
from mrjob.step import MRStep
import re
import sys
import time
WORD_RE = re.compile(r"[\w']+")
class MR_euler_tour(MRJob):
#map each nodes and set each occurence as 1
def mapper(self, key, line):
for elem in line.split():
yield elem, 1
#count each nodes occure... | true |
a418ecb7a50141d8fa026750ea34aca2d9d21eae | Python | sih2020admin/NM402_Sambhav | /pickl.py | UTF-8 | 161 | 2.609375 | 3 | [] | no_license | import pickle
d = {1:"hi", 2: "there"}
msg = pickle.dumps(d)
# msg = bytes(f"{len(msg):<{HEADERSIZE}}", 'utf-8')+msg
print(msg)
print()
print(pickle.loads(msg))
| true |
0f20f55b45f553c1b0ed1a4d9822a70cb63d5b6a | Python | aanand01762/Self-Practice | /python/minimum_swap_2.py | UTF-8 | 914 | 3.875 | 4 | [] | no_license | # https://www.hackerrank.com/challenges/minimum-swaps-2/problem
def minimumSwaps(arr):
swap = 0
indexs = [0]*len(arr)
# Iterate index and value together
# store index of the value at the index which which is value
for i, value in enumerate(arr):
indexs[value-1] = i
for i in range(len(... | true |
58279633bc7ffe639f3f476bfc85b6b027927ddc | Python | elliottwarren/ClearFO_paper1 | /scripts/mod_obs_stats_plot.py | UTF-8 | 14,327 | 2.921875 | 3 | [] | no_license | """
Script to do all the stats to the FO output. Correlations first...
Created by Elliott Thur 27th Oct 2016
"""
import matplotlib.pyplot as plt
from matplotlib.dates import date2num
from matplotlib.dates import DateFormatter
import numpy as np
import datetime as dt
from scipy.stats import spearmanr
import ellUtils... | true |
51ec7b207a29d9ce2d1466c1833f2e9a4113fccb | Python | wangyu190810/python-skill | /thread_queue/sample_thread_fetch_url_lock.py | UTF-8 | 1,329 | 3.078125 | 3 | [] | no_license | # -*-coding:utf-8-*-
import threading
import urllib2
class FetchUrls(threading.Thread):
"""
"""
def __init__(self,urls,output,lock):
threading.Thread.__init__(self)
self.urls=urls
self.output = output
#self.name = None
self.lock = lock
def run(self):
""... | true |
421ef55a8e87f6fc48ceaa65c7fa012baabde5c6 | Python | RobotNo42/old_coed | /project/python_fullstack/day10/grep.py | UTF-8 | 230 | 2.515625 | 3 | [] | no_license | import os
def search():
while True:
dir_name = yield
g = os.walk(dir_name)
for i in g:
for x in i[-1]:
print("%s/%s" % (i[0], x))
g = search()
next(g)
g.send('d:/python') | true |
a12c25be22177d78e1bec0b264eb5281ea1653f0 | Python | Azhar1256/Parenthesis-Balancing-using-Stack | /Your program will determine whether the open brackets (the square brackets, curly braces and the parentheses) are closed in the correct order by using linked list based stack.py | UTF-8 | 2,138 | 3.671875 | 4 | [
"MIT"
] | permissive | Task02
class Node:
def __init__(self,value):
self.value=value
self.ref=None
class Stack:
head=None
s=0
def push(self,data):
self.s+=1
if self.head==None:
self.head=Node(data)
else:
n = Node(data)
n.ref=self.head
self... | true |
c92c863a699d5a75df9d4e4e1a6f5b5c06575ed5 | Python | ArinMangal12/Python-Random-Number-Guess-game | /Game.py | UTF-8 | 740 | 3.9375 | 4 | [] | no_license | import random
# --> random number guess game with storing high score every time you break high score
randNo = random.randint(0, 100)
userGuess = None
guesses = 0
while userGuess != randNo:
userGuess = int(input("Enter your number: \n"))
guesses += 1
if userGuess == randNo:
print("Yes, You guessed r... | true |
465640f030ea732e937feb34f1e11c0dd110c2bf | Python | awick1/apcsp | /files/advScrabbleCalc.py | UTF-8 | 2,156 | 4.625 | 5 | [] | no_license | #values sets a point value to each letter of the alphabet
values = {"a": 1, "b": 3, "c": 3, "d": 2, "e": 1, "f": 4, "g": 2, "h": 4, "i": 1,
"j": 8,"k": 5, "l": 1, "m": 3, "n": 1, "o": 1, "p": 3, "q": 10, "r": 1,
"s": 1, "t": 1, "u": 1, "v": 4, "w": 4, "x": 8, "y": 4, "z": 10,
"A": 1, "B":... | true |
d75703baa066e82dcd57f7f17e05590bdc7c7abb | Python | yongil1222/Python_Study | /PyGame/Ex1.Draw.py | UTF-8 | 940 | 3 | 3 | [] | no_license | import pygame
pygame.init()
BLACK = (0,0,0)
WHITE = (255,255,255)
BLUE = (0,0,255)
GREEN = (0,255,0)
RED = (255,0,0)
size = [400,300]
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Game Title")
done = False
clock = pygame.time.Clock()
while not done:
clock.tick(10)
for event in pygame... | true |
df38c3ac794e7edd46658c3f62cd1e4a8eaabbd1 | Python | XinchaoGou/MyLeetCode | /299. Bulls and Cows.py | UTF-8 | 503 | 2.96875 | 3 | [
"MIT"
] | permissive | class Solution:
def getHint(self, secret: str, guess: str) -> str:
res =""
cnt_A = 0
cnt_B = 0
array = [0] * 10
for i in range(len(secret)):
s = int(secret[i])
g = int(guess[i])
if s == g:
cnt_A += 1
else:
... | true |
ea6e2c997261137d85416efb606d6121159b9fca | Python | AnshulP10/Machine-Learning | /logisticRegression.py | UTF-8 | 1,750 | 2.78125 | 3 | [] | no_license | # Load libraries
import numpy as np
import pandas
from sklearn import model_selection
# Load dataset
url = "https://raw.githubusercontent.com/jbrownlee/Datasets/master/iris.csv"
names = ['sepal-length', 'sepal-width', 'petal-length', 'petal-width', 'class']
dataset = pandas.read_csv(url, names=names)
# Split-out vali... | true |
37476718745d56881560607f19dbb4adc74304df | Python | ravishankarramakrishnan/SDS_ML_PY_R | /Part 1 - Data Preprocessing/DataPreprocessing_Template.py | UTF-8 | 1,336 | 3.234375 | 3 | [] | no_license | # Data Preprocessing
# Importing the Libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the Dataset
dataset = pd.read_csv('Data.csv')
X = dataset.iloc[:,:-1].values
Y = dataset.iloc[:,3].values
np.set_printoptions(threshold = np.nan) # If you cant see full array l... | true |
163908515a383418b3a93d5be38d297e0751081d | Python | ewjoachim/colorsnip | /colorsnip.py | UTF-8 | 2,613 | 2.8125 | 3 | [
"MIT"
] | permissive | """
Colorsnip is provided under the MIT License:
Copyright (c) 2018, Joachim Jablon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to... | true |
03693c54385ee9a8730adcc9e0f8a11b347d537a | Python | abhi55555/dsPrograms | /remove_char.py | UTF-8 | 271 | 4.09375 | 4 | [] | no_license |
def removeChar(string, character):
counts = string.count(character)
string = list(string)
while counts:
string.remove(character)
counts -= 1
string = ''.join(string)
print(string)
s = "I am a disco dancer"
removeChar(s, 'd')
| true |
0fd036a740dbf39dfcd21caac237d48512785044 | Python | RidaATariq/ITMD_413 | /Assignment-9/02_Panda_Dataframe/main.py | UTF-8 | 2,327 | 3.515625 | 4 | [] | no_license | import numpy as np
import pandas as pd
# 1. load hard-coded data into a dataframe
df = pd.DataFrame([
['Jan', 58, 42, 74, 22, 2.95],
['Feb', 61, 45, 78, 26, 3.02],
['Mar', 65, 48, 84, 25, 2.34],
['Apr', 67, 50, 92, 28, 1.02],
['May', 71, 53, 98, 35, 0.48],
['Jun', 75, 56, 107, 41, 0.11],
['... | true |
aea2517c68ca2f6e49ccd8ff54547a0a9900fc5e | Python | cry999/AtCoder | /beginner/101/B.py | UTF-8 | 248 | 3.671875 | 4 | [] | no_license | def digit_sums(N: int) -> bool:
s = 0
temp = N
while temp > 0:
s += temp % 10
temp //= 10
return N % s == 0
if __name__ == "__main__":
N = int(input())
yes = digit_sums(N)
print('Yes' if yes else 'No')
| true |
40a5063cd6f6f8a8e45c60bb6ae67b3b75205b61 | Python | sydbermas/AutoMeasure | /Frame/frameObject.py | UTF-8 | 5,531 | 2.828125 | 3 | [] | no_license | import cv2
import numpy as np
class Frame_Object:
# ------------------------------
# User Instructions
# ------------------------------
# ------------------------------
# User Variables
# ------------------------------
# blur (must be positive and odd)
gaussian_blur = 15
# thresh... | true |
b1124e5ca8e0a68929a5afadca9adab02357e109 | Python | michael-grotelueschen/amicus | /code/model.py | UTF-8 | 4,326 | 2.75 | 3 | [] | no_license | import pandas as pd
import numpy as np
import cPickle
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from sklearn.cross_validation import cross_val_score
from sklearn.metrics import accuracy_score, \
p... | true |
0bc206d7170f32f0ad1ebd4ec8da3dd073725692 | Python | LTUC/amman-python-401d4 | /class-02/demo/factorial_recursion/factorial_recursion/factorial.py | UTF-8 | 246 | 3.859375 | 4 | [] | no_license | def fact(n):
if n==1:
return 1
return n * fact(n-1)
# Alternative solution using while loop
# def fact(n):
# result = 1
# temp = n
# while temp>1:
# result *= temp
# temp -= 1
# return result
| true |
c55f940692a75341e68f233e4b64d68662070c3b | Python | drumminhands/drumminhands_projector | /drumminhands_projector.py | UTF-8 | 6,875 | 2.90625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# created by chris@drumminhands.com
# see instructions at http://www.drumminhands.com/2016/09/02/raspberry-pi-photo-booth-projector/
# and the photo booth instruction at http://www.drumminhands.com/2014/06/15/raspberry-pi-photo-booth/
# slide show based on https://github.com/bradmontgomery/pgSlide... | true |
755145ae900e435133a603f5e592e596f24cccd0 | Python | aligerami/assignment2 | /chapter11-5.py | UTF-8 | 1,245 | 3.640625 | 4 | [] | no_license | def add_matrix(a, b):
result=len(a)*[0]
result= [[0 for x in range(len(a))] for y in range(len(a[1]))]
for i in range (0,len(a)):
for j in range (0,len(a[i])):
result[i][j]= a[i][j]+b[i][j]
return result
m1= [[1.0, 2.0, 3.0],
[4.0 ,5.0, 6.0],
[11.0, 8.0 ,11.0]]
m2= [[0... | true |
681fb2a6a2281cbaf09e29cbd2472065a9630606 | Python | markljwong/chatbot | /src/python/doc_classification.py | UTF-8 | 558 | 3.015625 | 3 | [] | no_license | # Doesn't work. Kept for reference
import nltk
from nltk.corpus import movie_reviews
all_words = nltk.FreqDist(w.lower() for w in movie_reviews.words())
word_features = list(all_words.keys())[:2000]
def document_features(document):
for word in word_features:
features['contains(%s)' % word] = (word in document_wo... | true |
1ffeaa3c45e98105b323788f81779c6336577011 | Python | dcg/LispInterpreter | /test/LISP/TestPrinter.py | UTF-8 | 1,523 | 3 | 3 | [] | no_license | '''
Created on 30.03.2012
@author: dominik
'''
import unittest
from LISP.LispClasses import *
from LISP.Printer import printLisp
class Test(unittest.TestCase):
def testPrint(self):
self.assertTrue(printLisp(new(LispInteger,5)) == "5",printLisp(new(LispInteger,5)))
self.assertTrue... | true |
ddb29a9508a460f003398978b76643ec904154e2 | Python | TheSagab/Foundation-of-Programming-1 | /Assignment3.py | UTF-8 | 9,293 | 3.203125 | 3 | [] | no_license | # ********************* Program Buku Penilaian *********************
# ********************* Nama : Anindito Bhagawanta *********************
# ********************* NPM : 1606879230 *********************
# ********************* Kelas : DDP 1 - B *********************
# **************... | true |
fdc94432476fa6394b2d61810a48a6e26eac441b | Python | JakeGads/Python-tests | /Prime(F) | UTF-8 | 427 | 4.21875 | 4 | [] | no_license | #!/usr/bin/env python
prime_numbers = 0
def is_prime_number(x):
if x >= 2:
for y in range(2, x):
if not (x % y):
return False
else:
return False
return True
for i in range(int(raw_input("How many numbers you wish to check: "))):
if is_prime_number(i):
... | true |
d2fe049361a38ad19cc3bec5d52fa967ed7727d2 | Python | hllj/drfi-webserver | /config/config_loader.py | UTF-8 | 373 | 2.78125 | 3 | [] | no_license | import yaml
class ConfigLoader:
def __init__(self, path):
self.path = path
def load(self, extension="yaml"):
if extension == "yaml":
return self.load_yaml()
else:
raise NotImplementedError()
def load_yaml(self):
artifacts = yaml.load(open(self.path... | true |
871dd99e3971fb87d25cc60df94fe3f527ab1848 | Python | Ayushchauhan009/Spiral-Star-using-python | /star.py | UTF-8 | 112 | 3.578125 | 4 | [] | no_license | import turtle
n=60
pen=turtle.Turtle()
for i in range(n):
pen.forward(i*12)
pen.right(144)
turtle.done() | true |
5010c64902b3512bdca1c9dc13d81c1d8435f8b2 | Python | RomanHal/python | /lab1/zad2.py | UTF-8 | 158 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
print("Podaj imie nazwisko i rok urodzenia")
imie,nazwisko,rok_urodzenia = input().split(',')
print (imie, nazwisko, rok_urodzenia)
| true |
e4d8552f3926fd660db8110bc187786eed5fa331 | Python | lauradang/pdf-table-parser | /pdfs/lib/python3.7/site-packages/test3.py | UTF-8 | 484 | 3.9375 | 4 | [] | no_license | #This is the "test3.py" module and it provides one function called print_list()
#which print the lists that may or may not include nested lists.
def print_list(list_name,indent=false,level=0):
for each_item in list_name:
if isinstance(each_item,list):
print_list(each_item,true,level+1)
else:
... | true |
37aca1c355bd99828722db26813cb25c64e5ae41 | Python | natal20-meet/meetyl1201819 | /lab3.py | UTF-8 | 634 | 3.515625 | 4 | [] | no_license | import turtle
#turtle.right(45)
#turtle.forward(60)
#turtle.left(150)
#turtle.forward(60)
angle = 144
length = 100
def draw_star(angle,length):
for i in range(5):
turtle.left(angle)
turtle.forward(length)
turtle.hideturtle()
#draw_star(angle,length)
angle_2 = 90
length_2 = 50
angle_3 = 55
length_3 = 50
angle_4 = ... | true |
d22f727393665589dbbffacf0d8cad8f77bb4757 | Python | orenovadia/euler | /solved/e211.py | UTF-8 | 2,085 | 2.84375 | 3 | [] | no_license | '''
Created on Mar 9, 2015
@author: oovadia
'''
from time import time as thistime
from math import log,sqrt
from eulertools import primes3,Dn,primeFactors
from itertools import groupby
def calcNum(l,prm):
s=1
for i,pows in enumerate(l):
s*= ( prm[i]**pows )
s%=500500507
re... | true |
e9d565c20dc295ffc6a3e2c780aa040b5c24d512 | Python | linqcan/odser2014 | /scripts/configmanager.py | UTF-8 | 753 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
"""
This module handles exposes a method for retrieving
configuration settings from 'config.json'.
"""
import json
CONFIG_FILE = "../config.json"
JSON_OBJ = None
def get(config_type, config_attr):
"""
Returns the value of attribute 'config_attr' for
configuration type 'config_type'.
"""
... | true |
83573daa98e8905c289c3057b3616a0b69eda1ce | Python | pomowunk/MarlinGcodeDocumentation | /octoprint_marlingcodedocumentation/updater.py | UTF-8 | 3,534 | 2.625 | 3 | [] | no_license | import importlib
import json
import os
class DocumentationUpdater(object):
"""Manage updating the documentation from all parsers"""
JS_PREFIX = "window.AllGcodes = "
PARSERS = {}
SOURCES = set()
PARSERS_IMPORTS = [
'octoprint_marlingcodedocumentation.parser',
]
@classmethod
... | true |
d0c241ba76725460fc2b01b824b4e3ea61ee70fb | Python | tiagoportelanelo/flying-dog-beers | /app.py | UTF-8 | 4,437 | 2.828125 | 3 | [] | no_license | # Import Supporting Libraries
import pandas as pd
# Import Dash Visualization Libraries
import dash_core_components as dcc
import dash_html_components as html
import dash_table as dt
import dash.dependencies
from dash.dependencies import Input, Output, State
import plotly.graph_objects as go
def genera... | true |
eb94c394bdf12ca9525e84c76404fa62853c9700 | Python | iindyk/my_GAN | /graphing/noise_vis.py | UTF-8 | 1,734 | 2.609375 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
noise_norms = [3., 13.]
im_dir = '/home/iindyk/PycharmProjects/my_GAN/images/for_graphs/'
(x_train_all, y_train_all), (x_test_all, y_test_all) = tf.keras.datasets.mnist.load_data()
x_train_all, x_test_all = x_train_all/255., x_test_all/255.
x... | true |
12e0ca2872ed11436056a9e54869969399c48085 | Python | bkganguneni/DASHING_CAR | /PYTH_CARGAME/game.py | UTF-8 | 4,673 | 3.046875 | 3 | [] | no_license | # cd OneDrive\Desktop\PYTH_CARGAME
import pygame
import time
import random
pygame.init()
display_width = 800
display_height = 600
gray = (120, 120, 120)
black = (0, 0, 0)
red = (255, 0, 0)
bright_red = (255, 40, 20)
green = (125, 235, 52)
bright_green = (132, 255, 0)
blue = (20, 118, 255)
bright_blue = ... | true |
24b4e27cdb6f4aec95a42c922b214629f575e0da | Python | yfchenggithub/PYTHON | /paramiko_exec_command.py | UTF-8 | 716 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python
import paramiko
import sys
import os
import string
def usage():
print('usage: %s netstat -pan | grep -w 80' % sys.argv[0])
#判断是否输入加入命令行
if len(sys.argv) < 2:
usage()
sys.exit(1)
#命令弄成字符串形式
input_cmd = ' '.join(sys.argv[1:])
#A high-level representation of a session with an SSH server
ssh = p... | true |
2b9d0cf189d0b0ff7e34f9dade9b920bd20d4cb4 | Python | amanshu-cloud/hackerrank | /maze.py | UTF-8 | 887 | 3.484375 | 3 | [] | no_license | #issafe function to check if we have reached the edge cases
def issafe(r,c,n,maze):
if r<0 or r>=n:
return False
if c<0 or c>=n:
return False
if maze[r][c]:
return True
return False
#solcemaze function
def solvemaze(maze,i,j,soln,n):
if i==n-1 and j==n-1:
soln[... | true |
5fc04cbadcf4b27ee368c238da35f13a69c3aebe | Python | efatmae/Does-BERT-pay-attention-to-cyberbullying- | /Does-BERT-pay-attention-to-cyberbullying-/Model_Training/Pytorch/pretrained_models_helpers.py | UTF-8 | 5,768 | 2.8125 | 3 | [] | no_license | import torch
import numpy as np
from torch.utils.data import TensorDataset, random_split
from torch.utils.data import DataLoader, RandomSampler, SequentialSampler
from sklearn.model_selection import train_test_split
def data_tokenization(sentences,labels,tokenizer, maxlen):
# Tokenize all of the sentences and map... | true |
cd11a3fc9ec64e0b31c6ba46ec9a841e069ae671 | Python | kraudust/byu_classes | /robotic_vision/hw5_object_tracking/kalman_tracking_hw5.py | UTF-8 | 12,912 | 2.578125 | 3 | [] | no_license | import cv2
import numpy as np
from copy import deepcopy
from pdb import set_trace as pause
from scipy.stats import mode
class klt_kalman():
def __init__(self, video_path):
# Open Camera or Video
self.cap = cv2.VideoCapture(video_path)
# Check if camera opened successfully
if (self... | true |
2d42ef18ac38791f9ea9c8fffbfabbc72039b966 | Python | TangYizhao/Python_202101 | /http_project.py | UTF-8 | 2,703 | 2.96875 | 3 | [] | no_license | import re
from socket import *
from select import select
class HTTPServer:
def __init__(self, host = "0.0.0.0",port = 8000, html=None):
self.host = host
self.port = port
self.html = html
self.creat_socket()
self.bind()
self.rlist = []
self.wlist = []
... | true |
f923b6cdb3ca660c24593eb7686a4dd1620fe380 | Python | rudik32/gitTest | /python/lab1_v6.py | UTF-8 | 1,649 | 3.9375 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
#Вариант VI.
#Скорость ветра задана в интервале [0;30] в м/с. С шагом 5 переведите эту скорость в км/ч.
#1. Выведите значения скорости в м/с и км/ч используя цикл while
#2. Задайте список значений скорости ветра в м/с и получите соответствующий список
#значений в км/ч использу... | true |
c355b5d839f01719dee308f817174e181877b645 | Python | Marcfeitosa/listadeexercicios | /ex108.py | UTF-8 | 879 | 4.125 | 4 | [] | no_license | """
Desafio 108
Adapte o código do desafio 107, criando uma função adicional chamada moeda() que consiga mostrar os valores como um valor monetário formatado.
O programa vai usar o módulo assim:
from aula22 import moeda
p = float(input('Digite o preço: R$ '))
print(f'A metade de {moeda.moeda(p)} é {moeda.moeda(moeda... | true |
2338ec896846388060e07def2c30433f41aa9636 | Python | solbol/python | /Lesson 5/Lesson 5.3.py | UTF-8 | 693 | 3.5625 | 4 | [] | no_license | with open('user_file.txt', 'w') as f:
f.write('Смирнов оклад 20000\n')
f.write('Васильев оклад 30000\n')
f.write('Иванов оклад 15000\n')
f.write('Петров оклад 18000\n')
f.write('Сидоров оклад 25000')
with open('user_file.txt') as f:
salary_sum = 0
salary_cnt = 0
for line in f:
... | true |
7baa0c9f5dd09383010aaff73fd904c9a68e4443 | Python | Raniac/NEURO-LEARN | /env/lib/python3.6/site-packages/dipy/reconst/benchmarks/bench_peaks.py | UTF-8 | 895 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | """ Benchmarks for peak finding
Run all benchmarks with::
import dipy.reconst as dire
dire.bench()
With Pytest, Run this benchmark with:
pytest -svv -c bench.ini /path/to/bench_peaks.py
"""
import numpy as np
from dipy.reconst.recspeed import local_maxima
from dipy.data import get_sphere
from dipy.core... | true |
bbaaf8d1e5a91fcec498e5df385dd7dc1af21776 | Python | M-RaquelCS/BreveHistoria | /quizz2.py | UTF-8 | 6,304 | 3.578125 | 4 | [] | no_license | import pygame
def musica_tema():
pygame.mixer.init()
pygame.mixer.music.load("musica_tema.mp3")
pygame.mixer.music.play()
def musica_acertou():
pygame.mixer.init()
pygame.mixer.music.load('musica_acertou.mp3')
pygame.mixer.music.play()
def musica_errou():
pygame.mixer.init()
pygame.mixer... | true |
46f57562173552d4c2aa5091c71aab4c043acab9 | Python | Saskia-vB/eng-57-oop | /monster_inc_university/course.py | UTF-8 | 700 | 3.484375 | 3 | [] | no_license |
class Course:
def __init__(self, module_name, start_date, list_of_students=[]):
self.module_name = module_name
self.list_of_students = list_of_students
self.start_date = start_date
def module_name(self):
self.module_name = module_name
def get_module_name(self):
ret... | true |
335ea8a03acdb794af5330239f9b0d2c64c9a596 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_201/1220.py | UTF-8 | 879 | 3.140625 | 3 | [] | no_license | import numpy as np
from math import floor
def make_answer(_n):
if _n%2 ==0:
return ' '.join([str(_n/2), str(_n/2-1)])
else:
return ' '.join([str(_n/2), str(_n/2)])
def solve(n, k):
if k==1:
return make_answer(n)
# else, calc d, where 2^d <= k < 2^(d+1)
d = int(floor(np.log2(k)))
n_left = n... | true |
a81a641c403208e37dfd40e088562800265cea81 | Python | Wesley-yang/curequests-1 | /tests/utils.py | UTF-8 | 266 | 2.578125 | 3 | [
"MIT"
] | permissive | import functools
import curio
def run_with_curio(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
try:
curio.run(f(*args, **kwargs))
except curio.TaskError as ex:
raise ex.__cause__ from None
return wrapper
| true |
1d64162eea932c88ed655e81fc9aa0708f109c20 | Python | SusannaWull/malt | /malt/detectionevent.py | UTF-8 | 1,533 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive |
import point
class DetectionEvent(object):
"""
Class which is used to house the detection event. It is a persistent class
which has variables x and y for position of the node when the event was
registered, a confidence of sound recognition, and the sound pressure
leve which can be used to determ... | true |
fa14c0bf6fcccaf1c23f30e5ce1774a49871f447 | Python | harryvu141043/vuhuyhoaison-fundamental-C4E26 | /lab_2/calc/game.py | UTF-8 | 451 | 3.21875 | 3 | [] | no_license | import random
while True:
x=random.randint(1,10)
y=random.randint(1,10)
erorr=random.randint(-1,1)
#s=f"{x}+{y}={r}""
t=x+y
k=x+y+erorr
print(x,"+",y,"=",k)
y=input("y/n:")
if (t==k) and y=="y":
print("yay")
elif t==k and y=="n":
print("no")
... | true |
fda40b629b034c233a2fff08a5e3ba47bb359b77 | Python | agnes-sharan/simpleRaft | /simpleRaft/boards/redis_board.py | UTF-8 | 1,659 | 3.03125 | 3 | [
"MIT"
] | permissive | import redis # importing packages, importing everything
# Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes w... | true |
91dc75de8de5a3abff6766e36c56a2d3a157c173 | Python | NeatNerdPrime/SecureTea-Project | /securetea/lib/web_deface/defacement_detector.py | UTF-8 | 4,053 | 2.53125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
u"""ML Based Defacement detection module for SecureTea Web Deface Detection.
Project:
╔═╗┌─┐┌─┐┬ ┬┬─┐┌─┐╔╦╗┌─┐┌─┐
╚═╗├┤ │ │ │├┬┘├┤ ║ ├┤ ├─┤
╚═╝└─┘└─┘└─┘┴└─└─┘ ╩ └─┘┴ ┴
Author: Aman Singh <dun930n.m45732@gmail.com> , July 25 2021
Version: 1.4
Module: SecureTea
"""
impo... | true |
2ef017d6140720a9ed0d1dbb31a501b35d8cc959 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_155/1625.py | UTF-8 | 551 | 2.859375 | 3 | [] | no_license | import string, sys
f = open("output.txt", "w+")
count = 0
N = 0
for line in sys.stdin:
if count > 0:
if (count > N + 1):
break
m, l = [item for item in line.split()]
res = 0
i = 0
total = 0
for c in l:
n = int (c)
if ( (i > total)... | true |
3b2f5b3ffb14f317ee84db6ab503c85e4c9efeb7 | Python | KareemAbdella/A.-Zoning-Restrictions-Again | /problem.py | UTF-8 | 344 | 3.109375 | 3 | [] | no_license | x = input().split()
n = int(x[0])
h = int(x[1])
m = int(x[2])
proff = int(0)
arr = [0] * n
for i in range(n):
arr[i] = h
for i in range(m):
a = input().split()
k = [int(s) for s in a]
s = k[0] - 1
while s < k[1]:
arr[s] = min(arr[s], k[2])
s += 1
for q in range(n):
proff += ar... | true |
5f6da81d3f708a914ad1511a992bcee7d0369fa8 | Python | thomasm1/app-tester | /dailytechMarsReader/PixelPet.py | UTF-8 | 1,654 | 2.984375 | 3 | [
"MIT"
] | permissive | from sense_hat import SenseHat
from time import sleep
sense = SenseHat()
my_data = ('Here','is','my','data')
red = (255,0,0)
edinburgh = (55.9533, 3.1883)
smarties = ('red', 'orange', 'blue', 'green', 'yellow', 'pink', 'violet', 'brown')
print(smarties)
print(smarties[0])
for color in smarties:
print(color)
r =... | true |
8f5888cc19d8e50dcb3c9832f4e3ccfa2b4c968c | Python | mhmoslemi2338/corresponding-point-harris-method | /main.py | UTF-8 | 6,679 | 2.53125 | 3 | [
"MIT"
] | permissive | import timeit
start = timeit.default_timer()
import cv2
import matplotlib.pyplot as plt
import numpy as np
from my_func import my_gradian, my_NMS , my_feature_arr , my_show , my_distance , my_min_distance
############# calc gradient and Ixx Iyy Ixy for im01 and im02 ########
print("progres (1 of 2)"... | true |
b9918f573d6c71c3fed9fb876ea067e1fa909a99 | Python | Shreyas3010/Imbalanced-Classes | /SMOTEregression.py | UTF-8 | 8,575 | 2.625 | 3 | [] | no_license | import pandas as pd
import sys
import xgboost
from sklearn.ensemble import RandomForestRegressor
import collections
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import numpy as np
import math
import random
def sortSecond(val):
return val[1]
# =============... | true |
f515392bda8cddcbfa21cf465d5695945fd62cab | Python | handaeho/lab_dl | /ch05_Back_Propagation/ex01_Basic_Layer.py | UTF-8 | 5,586 | 4 | 4 | [] | no_license | """
Back Propagation(역전파)
Computational Graph(계산 그래프) : 복수개의 노드와 엣지로 계산 과정을 자료구조 형태의 그래프로 표현한 것.
f(x)= x^n일 때, f'(x) = df/dx = nx^n-1이다. 이 미분 계산을 그래프 자료구조 형태로 나타내면,
'x-> [미분] -> df/dx'와 같다.
이때, 출발점부터 종착점까지 순서대로 진행되는 것을 'Forward Propagation(순전파)',
반대로 종착점부터 출발점으로 진행되는 것을 'Back Propagation(역전파)'라고 한다.
전체 계산이 아무리 복... | true |
6e491bb45296e710792dd4b86985b7b9840c0556 | Python | tk-sheldo/codeJam | /2019/crypto.py | UTF-8 | 817 | 3.375 | 3 | [] | no_license |
def GCF(a, b):
if a < b:
temp = b
b = a
a = temp
r = a%b
if r == 0:
return b
else:
return GCF(b, r)
t = int(input())
for case in range(t):
n, l = list(map(int, input().split(' ')))
code = list(map(int, input().split(' ')))
primes = ['X']
p... | true |
95396114c3a490fe4f4b9dc5bb31c6957fb84666 | Python | henryfw/cs-330 | /cs330_image_convert.py | UTF-8 | 1,676 | 2.875 | 3 | [] | no_license | import cv2 as cv
import os
import pickle
# save images as an array of tuples: [( [1024,1024], 0|1 ), ... ]
def resizeImagesAsFile(inputFolder, saveFile, width=1024, height=1024):
data = []
for label in ["0", "1"]:
with os.scandir(inputFolder + "/" + label) as entries:
for entry in entrie... | true |
6f030a097133ecb7c0277171ed58be597af7938f | Python | shenhaiyu0923/resful | /vova_project/vova_resful/sept/性能测试.py | GB18030 | 1,142 | 2.671875 | 3 | [] | no_license | from locust import HttpLocust, TaskSet, task
# HttpLocust http
# TaskSet ǶûΪģ൱loadrunnerhttpЭĽűjmeterhttpһҪȥ
# task taskһװһװγһҲָǵȺִ˳
class BestTest(TaskSet):
# Լ̳࣬TaskSetҲʵҪȥʲô
@task # taskװװγһҪִе
def index(self): # 涨ҪIJ
self.client.get('/') # urlĸ·ǽӿڵĻĸӿ
class BestTestIndexUser(HttpLocust):
... | true |
b6863fa906671e0236660e7858c397b0999c4070 | Python | palmergroup-tutorial/Python-force-field-parameterization-workflow | /IO/user_provided.py | UTF-8 | 5,693 | 2.578125 | 3 | [
"MIT"
] | permissive | import logging
import argparse
import numpy as np
import sys
import IO.check_type
class from_command_line():
@classmethod
def __init__(cls,jobID=None,
total_cores=None,
input_file=None,
mode=None,
ref_address=None,
prep... | true |
717b23c97a45a5e2aefc5020291d4a735b5d2d47 | Python | mikey-sb/python_logic_problems | /football_results/src/football_results.py | UTF-8 | 775 | 3.171875 | 3 | [] | no_license |
def get_result(final_score):
if final_score["home_score"] > final_score["away_score"]:
return "Home win"
if final_score["home_score"] < final_score["away_score"]:
return "Away win"
if final_score["home_score"] == final_score["away_score"]:
return "Draw"
def get_results(final_sco... | true |