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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ada45bc5b28377e3d3ba37c3ccc87ec1c3732417 | Python | staryp/DeepLearningZeroToAll | /titanic/titanic.py | UTF-8 | 2,990 | 3.109375 | 3 | [] | no_license | # Lab 10 MNIST and NN
import tensorflow as tf
import pandas as pd
import numpy as np
import random
tf.set_random_seed(777) # reproducibility
train = pd.read_csv("train.csv")
test = pd.read_csv("test.csv")
train['Age'].fillna(train['Age'].median(), inplace=True )
train["Sex"][train["Sex"] == "male"] = 0
train["Sex"]... | true |
96194a3b96ed1ca5ac163c81f2e09aea75f0f4d0 | Python | mitanshubhavsar/MP-Police-Crime-Scene-App-Internship | /Grid and Object_Detection.py | UTF-8 | 2,050 | 2.96875 | 3 | [] | no_license | import os
import image_slicer
from imageai.Detection import ObjectDetection
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.image import Image
class MainApp(App):
def build(self):
layout = BoxLayout(orientation='vertical', spacing... | true |
ddb1dc13497098f4e9e98cab2c8858e7e432e39d | Python | Dave-Patsy/space-Invader | /game_over_screen.py | UTF-8 | 1,434 | 3.078125 | 3 | [] | no_license | from pygame import *
from button import Button
from Text import Text
from settings import settings
class game_over_screen:
def __init__(self, setting: settings, surface: display):
self.rect = Rect(setting.screen_width/8, setting.screen_height/8, setting.screen_width * 3/4, setting.screen_height * 3/... | true |
877dfc7fbf21db36713afde73629c6aa1496a3ee | Python | aisha2006/c108 | /Weight.py | UTF-8 | 211 | 2.609375 | 3 | [] | no_license | import pandas as pd
import plotly.figure_factory as ff
import csv
df = pd.read_csv("data.csv")
fig = ff.create_distplot(
[df["Weight(Pounds)"].tolist()], ["Weight"], show_hist = False
)
fig.show() | true |
5b5833643f4363d386791c6c8bc795916d22e480 | Python | wpilibsuite/frc-docs | /source/docs/software/advanced-controls/state-space/latency.py | UTF-8 | 3,783 | 3.140625 | 3 | [
"BSD-3-Clause",
"CC-BY-4.0"
] | permissive | #!/usr/bin/env python3
import frccontrol as fct
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import StateSpace
class Flywheel:
"""An frccontrol system representing a flywheel with a time delay."""
def __init__(self, dt, delay=0.0):
"""Flywheel subsystem.
Keyword argu... | true |
72b31a21afacb9e1b8b80b964add5c58c377185b | Python | pauleclifton/GP_Python210B_Winter_2019 | /students/douglas_klos/session9/mailroom/donordb.py | UTF-8 | 4,225 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python3
#pylint: disable=R1710
""" Mailroom OO DonorDB class """
# Douglas Klos
# March 17th, 2019
# Python 210, Session 9, Mailroom OO
# donordb.py
import pickle
from donor import Donor
class DonorDB():
"""
DonorDB class
Attributes:
database: Data structure containing donors
... | true |
abe18fc69a1471eedbce29fc68fa31491df3b85f | Python | shimstar/editor | /shimstar/world/faction.py | UTF-8 | 2,030 | 2.53125 | 3 | [] | no_license | from dbconnector import *
import xml.dom.minidom
from constantes import *
class Faction:
def __init__(self,id):
self.id=id
self.name=""
if self.id>0:
self.loadFromBdd()
def getId(self):
return self.id
def getName(self):
return self.name
def setName(self,name):
self.name=name
@staticmeth... | true |
2fc5606e309bbdb107219083d73b96f0bb4848f3 | Python | ExSidius/PDF-Filler | /pdftools/tools.py | UTF-8 | 1,724 | 2.65625 | 3 | [] | no_license | import os
import pdfrw
import csv
# Needed constants for working with pdfrw
ANNOT_KEY = '/Annots'
ANNOT_FIELD_KEY = '/T'
ANNOT_VAL_KEY = '/V'
ANNOT_RECT_KEY = '/Rect'
SUBTYPE_KEY = '/Subtype'
WIDGET_SUBTYPE_KEY = '/Widget'
# Writing to pdf using pdfrw
def write_fillable_pdf(input_pdf_path, output_pdf_path, data_dict)... | true |
419f22fe69da033845944565a91dfae5dd3eb1b1 | Python | DSKaarthick/Python | /DecisionTree_ML_Intro.py | UTF-8 | 1,302 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 9 22:33:59 2020
@author: kartdh
"""
import pandas as pd
from sklearn import tree
import io #input output operations
import pydotplus #if we need to use any external .exe files....
import os
os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Grap... | true |
8319253231cd64defc09ceda5a19e3ecebd78c5a | Python | dimitritsampiras/chemical-equation-balancer | /src/CompoundT.py | UTF-8 | 1,326 | 3.15625 | 3 | [] | no_license | ## @file CompoundT.py
# @author Dimitri Tsampiras
# @brief Defines a template module for Compounds
# @date Februrary 6, 2020
from ChemEntity import ChemEntity
from Equality import Equality
from ElmSet import ElmSet
## @breif Compound Template class
# @details Inherits ChemEntity and Equality Modules
class Compo... | true |
0d46981cdbf7b65673a02e1b3c001a183a7a4400 | Python | bartaelterman/retrieve-CoL | /src/fetch_taxonomy.py | UTF-8 | 945 | 2.734375 | 3 | [] | no_license | import requests
from lxml import etree
class TaxonomyFetcher:
def __init__(self):
pass
def parse_classification(self, full_response_xml_input):
doc = etree.fromstring(full_response_xml_input)
outdict = {}
for result in doc.iterfind("result"):
name_status = result.find("name_status")
if name_stat... | true |
69bd47b129521fdec078a6508e5d7041206a46d3 | Python | NerveCoordinator/Transparent-Overlay | /mouse_follower.py | UTF-8 | 4,068 | 2.9375 | 3 | [] | no_license | import sys
from PyQt5.QtWidgets import QWidget, QApplication
from PyQt5.QtGui import QPainter, QPen, QColor, QFont, QPixmap
from PyQt5.QtCore import Qt, QPoint, pyqtSignal, QRect
from pynput import mouse
'''
Minimal example of a transparent click through window
also shows off mouse recording behavior.
make sure co... | true |
ab3e4c9e327c2edd92bcfe97996f2b86dd896b64 | Python | PatMartin7/python-challenge | /PyPoll/main.py | UTF-8 | 1,242 | 3.15625 | 3 | [] | no_license | import csv
import os
file_to_load = os.path.join('Resources','PyPoll_Resources_election_data.csv')
with open(file_to_load) as election_data:
reader = csv.reader(election_data)
header = next(reader)
total_votes = 0
#votes = {
# "Khan": 0,
# "Correy": 0,
# "O'Tooley": 0
# }
votes = {}
for row in reader... | true |
0827d9a9509ad3d70b9cdb2722cdd368dea76504 | Python | CallMeMaaaybe/LeetCode | /最长回文子串.py | UTF-8 | 1,410 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 13 19:44:15 2019
@author: M_Y
给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。
"""
def longestPalindrome(s):
if len(s) == 0:
return ""
list11 = []
list12 = []
list21 = []
list22 = []
for i in range(len(s)):
tempstr1 = s[i]
tem... | true |
a7606e55510e52d9ebdce4d40cadf5398541f205 | Python | SandervanNoort/mconvert | /mconvert/newtools/combine_lists.py | UTF-8 | 273 | 3.25 | 3 | [] | no_license | def combine_lists(lists):
"""All lists with at position 0, one element of lists[0], etc"""
if len(lists) == 1:
return lists[0]
else:
return combine_lists([[i + j for i in lists[0]
for j in lists[1]]] + lists[2:])
| true |
02031bb91c3e9f23804c00ef79b80cf57a3c1a78 | Python | jriordan22849/FYP-Backend | /mySite/serverside/views.py | UTF-8 | 3,752 | 2.53125 | 3 | [] | no_license | from django.shortcuts import render
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.utils import timezone
import posts.models
from posts.models import Question
from posts.models import Answers
from posts.models import Post
import json
from django.http import HttpResponse
fr... | true |
b6eb7909cd0c84a6b6ced752777230a04d906864 | Python | edisonzapata20/A6 | /src/CS.py | UTF-8 | 1,447 | 2.9375 | 3 | [] | no_license | from _thread import *
import socket, time
import random
class CS(object):
def __init__(self, msg):
self.msg = msg
self.possibleAnswers = [
'It is certain.',
'It is decidedly so.',
'Without a doubt.',
'Yes - definitely.',
'You may rely on... | true |
8fa26cfdf6293c9c303c78089dca7cc84db2bef2 | Python | cairoas99/Projetos | /PythonGuanabara/exers/listaEx/Mundo2/ex040.py | UTF-8 | 295 | 4.0625 | 4 | [] | no_license | n1 = float(input('Insira a 1ª nota: '))
n2 = float(input('Insira a 2ª nota: '))
m = (n1 + n2) / 2
if m < 5:
print('Reprovado com media: {:.1f}'.format(m))
elif m >= 5 and m < 7:
print('Recuperação com media: {:.1f}'.format(m))
else:
print('Aprovado com media: {:.1f}'.format(m)) | true |
9a32968c4a5356331e0e238ab348ef9c028d6a40 | Python | oscarli/hogwardsProject | /test_web_wechat_04/data/get_data.py | UTF-8 | 217 | 2.515625 | 3 | [] | no_license | import yaml
def get_yaml_data(file):
with open(file, encoding="UTF-8") as f:
yaml_data = yaml.safe_load(f)
return yaml_data
if __name__ == "__main__":
print(get_yaml_data('./department.yaml'))
| true |
832d50059412176caf236924e63a554d50822529 | Python | vinayby/nac_v0 | /main/plyplus/converter/converter.py | UTF-8 | 1,569 | 3.0625 | 3 | [
"MIT"
] | permissive | """Author: Piotr Ociepka
Copyright (C) 2015 Piotr Ociepka
This software is released under the MIT license.
Converts .l and .y files into simple PlyPlus parser.
"""
import sys
def read_file(name, ext, part=1):
with open(name + "." + ext) as grammar_file:
return grammar_file.read().split("%%")[part]
def re... | true |
2debb38113888d30151b455985c728c5583945d6 | Python | LiteracyBridge/acm | /acmCheckOut/status.py | UTF-8 | 4,337 | 3.171875 | 3 | [] | no_license | #!/usr/local/bin/python
"""
status.py
A CLI script that allows a user to query the status of ACMs in the database.
To run, in the command line type: 'python status.py -a ACM_NAME --out --pretty'
optional arguments: ACM_NAME retrieve info on only this one ACM
--out retrieve info on only c... | true |
693ca8a5483201dca5fb752e79806cc15722fb0a | Python | PPovoa/Random-Coding | /Advent-of-Code/2019/Day 4/day4_part1.py | UTF-8 | 921 | 3.703125 | 4 | [] | no_license | #===============================
# Avent of Code 2019 - Day 4
#
# Made by: Pedro Póvoa
# Date: 03/07/2020
#===============================
# === CODE ===
fich= open('input.txt', 'r') # open 'input.txt' file
[min,max]= fich.read().split('-')
fich.close()
code=[] # list of possible codes
for i in ran... | true |
a01f86d18be5630dbfa0c4c919db2d23220feca3 | Python | wecode12/News-Highlight | /app/requests.py | UTF-8 | 3,866 | 2.671875 | 3 | [
"MIT"
] | permissive |
import urllib.request
import json
# from .models import Source
from .models import Source,Article
# Source = source.Source
# Article = article.Article
# Getting api key
api_key = None
# api_key='3f7ad7ad6ae546a28feead545feea3c4'
# Getting the sources base url
base_url = None
# Getting the article url
articles_url =... | true |
c43a88b4718385fdfcdc1719fb1396880e506c75 | Python | yanshugang/study_python | /S05_iterator/sentence_1.py | UTF-8 | 591 | 3.890625 | 4 | [] | no_license | """
定义一个sentence类,通过索引从文本中提取单词
"""
import re
import reprlib
# todo: 这个正则是怎么用的???
RE_WORD = re.compile("\w+")
class Sentence:
def __init__(self, text):
self.text = text
self.words = RE_WORD.findall(text)
def __getitem__(self, index):
return self.words[index]
def __len__(self):
... | true |
68418e6e4f44db01b3628088bf9eb5e2bd3f524b | Python | Eric-Wonbin-Sang/CS110Manager | /2020F_hw6_submissions/joneszachary/ZacharyJonesCH7P2.py | UTF-8 | 457 | 3.515625 | 4 | [] | no_license | #I pledge my honor that I have abided by the Stevens Honor System.
#Zachary Jones
#HW6 Problem 2
import datetime
def get_date():
date = str(input('Enter date M/D/YYYY: '))
return date
def validate_date(date):
format = '%m/%d/%Y'
try:
datetime.datetime.strptime(date, format)
print('{... | true |
f8bfb72946560641f97e19f065490bfd9f595613 | Python | supr84/RNA | /test/simulator/stringNodeVectorizer.py | UTF-8 | 1,390 | 2.65625 | 3 | [] | no_license | '''
Created on Aug 5, 2014
@author: sush
'''
from src.store.stringStore import StringStore
from src.store.dbConnection import DBConnection
from bson.objectid import ObjectId
import os
DIR = '/TalenticaWorkspace/TLabs/graphite-python/RNA/test/simulator/data/englishwords'
class StringNodeVectorizer(object):
'''
... | true |
297321c97d7be9a5b0fb6ce58c22e2baab2f4b2b | Python | brouhardlab/anamic | /anamic/imaging/features.py | UTF-8 | 413 | 3.09375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import numpy as np
def compute_snr(signal_mean, signal_std, bg_mean, bg_std):
"""Compute the SNR of a given object in an image.
Args:
signal_mean: float, mean signal value.
signal_std: float, std signal value.
bg_mean: float, mean background value.
bg_std: float, std backgroun... | true |
4362665e5baaf34b0abc4aaacea623b98af425d3 | Python | SaketSrivastav/epi-py | /linked_list/overlapping_list.py | UTF-8 | 2,207 | 3.78125 | 4 | [] | no_license | #! /usr/bin/python
import sys
import list_util
def is_overlapping_list(head1, head2):
"""
Input: list1 and list2
Output: Overlapping node or None
Description: If 2 list overlap then they will have common tail node. Let x
be length of list1 and y be length of list2. x-y gives you the difference
... | true |
58504f4d19c13f89f425b9de4cfa65e6a7d025ef | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2747/60586/315215.py | UTF-8 | 120 | 2.890625 | 3 | [] | no_license | x=input()
y=input()
z=input()
if x=="hit"and y=="cog"and z=="":
print()
else:
print(x)
print(y)
print(z) | true |
2d671822df3a16e53e048959d9181cf466878a71 | Python | ebu/ebu_adm_renderer | /ear/core/select_items/utils.py | UTF-8 | 4,954 | 2.859375 | 3 | [
"BSD-3-Clause-Clear"
] | permissive | from ...fileio.adm.exceptions import AdmError
def in_by_id(element, collection):
"""Check if element is in collection, by comparing identity rather than equality."""
return any(element is item for item in collection)
def _paths_from(start_node, get_children):
"""All paths through a tree structure starti... | true |
8781bfee92209bd3b7382346ecc8642e3efecff0 | Python | MckennaCisler/robo-projmap | /full_model/camera_calibration.py | UTF-8 | 3,281 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
sys.path.append("..")
import numpy as np
import cv2
from kinect import *
from os.path import join
import matplotlib.pyplot as plt
import calibration
NUM_IMAGES = 40
IMAGE_DIR = "calibration_images/"
GRID_X_NUM = 7
GRID_Y_NUM = 5
def collect_calib_data(images):
# termination crite... | true |
4cf4392afaa15d64f3640c4ab89e6ed8561be7ed | Python | andrey-tereshchenko/Machine-Learning-labs | /lab2/task1.py | UTF-8 | 1,660 | 3.1875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv('data/1.csv')
x, y = df['x'].values, df['y'].values
N = len(x)
def get_features(x):
return np.stack([np.ones_like(x), x], axis=1)
def predict(theta, x):
return h(theta, x) > 0.5
def accuracy(y_pred, y_true):
retur... | true |
a8f3b18c5e0211308e2aa82873ff2ea11c1d3684 | Python | honguyenvantan/honguyenvantan.github.io | /_posts/script.py | UTF-8 | 526 | 2.84375 | 3 | [
"MIT"
] | permissive | import os
import datetime
# Get the current date
now = datetime.datetime.now()
# Generate the file name
filename = '{:%Y-%m-%d}-hello.md'.format(now)
# Create the file in the current directory
with open(filename, 'w') as f:
# Write the lines to the file
f.write('---\n')
f.write('layout: page\n')
f.wr... | true |
15859f7222fc5a9491b652a682c3ee70c6be0cfa | Python | demetoir/ps-solved-code | /boj/2474.py | UTF-8 | 144 | 3.078125 | 3 | [] | no_license | m={0:0,1:1}
import sys
def f(n):
if not n in m:m[n]=f(n-1)+f(n-2)
return m[n]
a=int(sys.stdin.readline())
sys.stdout.write(str(f(a))) | true |
815d80298a835dc5874c7ea5f9885fbee1031a15 | Python | tuh8888/hpl-util | /src/python/jupyter/viewers/file_viewers.py | UTF-8 | 1,904 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | import os
from IPython.display import *
from ipywidgets import interactive, widgets
class FileViewer:
def __init__(self, files, extension=None):
if type(files) is str and extension is not None:
self.extension = extension
parent_dir = files if files.endswith('/') else... | true |
deb00926f8ca0ca9db7286e9cbaf18ff43ef0f91 | Python | aknavj/cinema4d-scripts | /python/splines_script.py | UTF-8 | 2,473 | 2.625 | 3 | [] | no_license | import c4d, random
import c4d.utils
from c4d import Vector as v
""" ---------------------------- Basics --------------------------- """
basetime = doc.GetTime()
Fps = doc.GetFps()
cF = doc.GetTime() .GetFrame(doc.GetFps())
""" ---------------------------- Vars --------------------------- """
global tV
... | true |
3126fd35c7da79dc19ab4f57fbb5902240f422a0 | Python | AsafCohen89/Matala3 | /Simulation.py | UTF-8 | 2,449 | 2.671875 | 3 | [] | no_license | from code.Global_Parameters import *
from code.Robot import Robot
from code.Arena import Arena
from code.Message import Message
from code.Point import Point
from code.Air import Air
from code.Log import Log
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
class Simulation:
... | true |
40790659e7e21552428ffa57d79fa8b894000220 | Python | maximkolodnikov/json-ls | /src/dir_builder/model.py | UTF-8 | 1,566 | 2.546875 | 3 | [] | no_license | import os
import json
import logging
from ..utils.helpers import (
get_file_size,
get_file_extension
)
from ..utils.renders import (
render_default,
render_bin,
render_txt,
)
from .classes import AbstractDirBuilder
logger = logging.getLogger()
class DirBuilder(AbstractDirBuilder):
def __ini... | true |
dcaf9649f5891f3008deedabf0c75a82bd0631b2 | Python | jhe226/Python | /study_with/210730/07.for문03.py | UTF-8 | 613 | 4.15625 | 4 | [] | no_license | # 참고) 리스트 내포(리스트 컴프리헨션)
#append() 사용
num = []
for n in [1, 2, 3] :
num.append(n*2)
print('append 사용 : ', num)
print()
# 리스트 내포 사용
num2 = [n*2 for n in [1, 2, 3]]
print('리스트 내포 사용 : ', num2)
print()
# append, if 사용
num3 = []
for n in [1, 2, 3, 4, 5] :
if n % 2 == 1: # 홀수만
num3.app... | true |
587c793963fa05957a4fd597bf7cc091dabafe11 | Python | luxuriaz/csc521 | /lexer.py | UTF-8 | 2,334 | 3.34375 | 3 | [] | no_license | import sys
import re
#for the lexer
lexemes = []
tokens = {"var":"VAR",
"function":"FUNCTION",
"return":"RETRUN",
"print":"PRINT",
"=":"ASSIGN",
"+":"ADD",
"-":"SUB",
"*":"MULT",
"/":"DIV",
"^":"EXP",
... | true |
e9f8699aaa2a8b2eee7b8167d4bfacb8b99ea536 | Python | olivertd/repo | /Tillämpad Programmering 1/kursolleA.py | UTF-8 | 565 | 4.46875 | 4 | [] | no_license | #Skapar inputs för användaren
s1 = int(input("Ange Sida 1: "))
s2 = int(input("Ange Sida 2: "))
#Här beräknar jag arean med korrekt matematik
arean = s1 * s2
print(arean)
#Här gör jag en IF sats för att kolla om sida 1 är = sida 2 för att enligt korrekt matematik är det då en kvadrat
if s1 == s2:
print("Det är en... | true |
da476d0c95d7be5a4779b04fbe0fe8e0d31f9376 | Python | javiroza/TICQ-Tasca-1 | /ticq1.py | UTF-8 | 1,418 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Progamat amb Python (versió 3)
import random
""" C.1 """
alfabet = {"-":0.17,"E":0.13,"A":0.12,"I":0.07,"S":0.06,"O":0.06,"R":0.05,"L":0.05,"N":0.05,"T":0.04,"U":0.04,"D":0.03,"C":0.03,"M":0.02,"P":0.02,"V":0.01,"Q":0.01,"B":0.009,"G":0.009,"F":0.007,"H":0.005,"X":0.003,"Y":0.003,"J":0.002,"... | true |
a382bee6db9ee59d30a208adad97d63af8781b2d | Python | willsunnn/FinanceManager | /ColorManager.py | UTF-8 | 6,162 | 2.78125 | 3 | [] | no_license | class ColorManager:
def __init__(self, col_dict: {}):
self.col_dict = col_dict
def get_file_display_colors(self):
return self.col_dict['FileDisplay']
def get_table_visualizer_colors(self):
return self.col_dict['TableVisualizer']
def get_data_visualizer_colors(self):
re... | true |
8fd75b975f6ad823fec77cd3f4a8af1ad0be4191 | Python | smitsgit/100-days-python-cookbook | /itrngen/flatten.py | UTF-8 | 605 | 3.75 | 4 | [] | no_license | '''
Flattening a nested sequence.
yield from statement is a nice shortcut if you want to write generators
that call other generators or coroutines.
'''
from collections.abc import Iterable
def flatten(items, ignore_types=(str, bytes)):
for item in items:
if isinstance(item, Iterable) and not isinstance(i... | true |
ccc46e646c7e60fe84e5ac44c06cb7690db18558 | Python | HypoChloremic/calculus | /calculus/limits/ex3.py | UTF-8 | 235 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | import matplotlib.pyplot as plt
a = [t for t in range(-10, 10)]
b = [4.9*t**2 for t in a]
bDelta= [9.8*t for t in a]
fig = plt.figure()
axes = fig.add_subplot(111)
axes.plot(a,b, "r")
axes.plot(a,bDelta, "b")
plt.show() | true |
c85a4a90a11802bde391d435b0b649d17ff62a81 | Python | FenderFalcon/RPI | /servoCtrl.py | UTF-8 | 700 | 2.9375 | 3 | [] | no_license | # Servo Control
import time
import wiringpi
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN)
GPIO.setup(24, GPIO.IN)
# use 'GPIO naming'
wiringpi.wiringPiSetupGpio()
# set #18 to be a PWM output
wiringpi.pinMode(18, wiringpi.GPIO.PWM_OUTPUT)
# set the PWM mode to milliseconds s... | true |
6c93a9d7e81753f7a84a233b33742060e318e6da | Python | Aasthaengg/IBMdataset | /Python_codes/p02887/s559083643.py | UTF-8 | 210 | 2.703125 | 3 | [] | no_license | #https://atcoder.jp/contests/abc143/tasks/abc143_c
N =int(input())
S =str(input())
cnt = 1
moji = S[0]
for i in range(1,N):
if S[i] != moji:
cnt += 1
moji = S[i]
print(cnt)
| true |
72945a42c7efdeff9890ef519f87969dcf9087ec | Python | radical-cybertools/radical.benchmark | /gromacs-benchmark/openmpi/data-ntl9/extract_time.py | UTF-8 | 583 | 2.65625 | 3 | [
"MIT"
] | permissive | import os
from glob import glob
if __name__ == '__main__':
logs = glob('threads_*/gromacs-*')
prof = open('profile.txt','w')
prof.write('Threads/Cores Walltime\n')
for log in logs:
threads = log.split('/')[0].strip().split('_')[1].strip()
with open(log,'r') as fp:
line = f... | true |
73421dadea72927b460c82d17c80922a7725c96d | Python | simonsobs/sotodlib | /tests/test_detdb.py | UTF-8 | 3,422 | 2.671875 | 3 | [
"MIT"
] | permissive | import unittest
from sotodlib.core import metadata
import os
import time
import numpy as np
from ._helpers import mpi_multi
# Global Announcement: I know, but I hate slow tests.
example = None
@unittest.skipIf(mpi_multi(), "Running with multiple MPI processes")
class TestDetDb(unittest.TestCase):
def setUp(sel... | true |
5f4efb51404b13dbf214af51b4f2b0215c2418bb | Python | tleesentons/Python3 | /scripts/if-statement.py | UTF-8 | 609 | 4.15625 | 4 | [] | no_license | # If Statement with comparison == != > < >= <= or and if elif else
a,b = 0,1
if a == b:
print(True)
elif a < 1:
print('a is less than b')
else:
print(False)
if a != b:
print(True)
if a < b or a != b:
print('Both or True')
if a >= b:
print(True)
if a < b and a != b:
print('Both and True')
... | true |
d5e453dea16665b39cd162d7a8446cc780c733e5 | Python | michaelpautov/leetcode | /middle/grid-island.py | UTF-8 | 1,456 | 2.890625 | 3 | [] | no_license | class Solution(object):
def numIslands(self, grid):
"""
:type grid: List[List[str]]
:rtype: int
"""
if grid is None or len(grid) == 0:
return 0
nr = len(grid)
nc = len(grid[0])
num_islands = 0
for r in range(nr):
for c ... | true |
2ac1b01f429f523e5453ca38e020a01596abee60 | Python | romaingd/Dev | /OpenClassrooms/021-Distributed_computing_for_Big_Data/activity_1/activity_1-review_4/Mission_2_PageRank/G_to_PMapper.py | UTF-8 | 867 | 3.296875 | 3 | [] | no_license | #! /usr/bin/env python2
from __future__ import division
import sys
s = 0.15
n = 7967.0
for line in sys.stdin:
# Supprimer les espaces
line = line.strip().replace('-1', '')
# recuperer les sites avec leurs liens sortants
id_site, sites_sortant = line.split(':')
# Compter les liens sortants
... | true |
6ca577055ca55066bca1aec5e37c2807169ad5a7 | Python | patbecich/pythonSandbox | /illiad.py | UTF-8 | 602 | 3.75 | 4 | [] | no_license |
f = open("/Users/patrick/python/illiad.txt", "r")
print f
ll = f.readlines()
#print range(10)
#for num in range(10):
# print "num: "+`num`
again = True
while(again):
counted = raw_input("Character or string to be counted in The Illiad: ")
periodCount = 0
for l in ll:
periodCount = perio... | true |
4f091278b0890011405906076f89989597ef85fb | Python | aditi1403/Bulk-Mailer | /email_utils/email_helper.py | UTF-8 | 1,229 | 2.71875 | 3 | [
"MIT",
"GPL-1.0-or-later",
"GPL-3.0-only"
] | permissive | from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
import json
def mail_handler(recepient_email=None, subject=None, content=None):
"""
Uses Sendgrid Api to send a mail to the receipients.\n
Keyword Arguments\n
recepient_email -- The email address of the receipient... | true |
0b5c8bb6ce53116f0911b09d8e483da2257589a3 | Python | JaavierR/SudokuSolver | /sudoku.py | UTF-8 | 2,859 | 3.640625 | 4 | [] | no_license | def solve(bo):
find = find_empty(bo)
if not find:
return True
else:
row, col = find
for i in range(1, 10):
if valid(bo, i, (row, col)):
bo[row][col] = i
if solve(bo):
return True
bo[row][col] = 0
return... | true |
8ff80fd63c914fad86dba5998d8b6648ea0a5034 | Python | hitochan777/kata | /atcoder/arc064/A.py | UTF-8 | 225 | 2.59375 | 3 | [] | no_license | N, x = (int(x) for x in input().split())
A = list(int(x) for x in input().split())
newA = [min(x, A[0])]
for i in range(1, N):
newA.append(min(A[i], max(x-newA[-1], 0)))
print(sum(max(a - b, 0) for a, b in zip(A, newA)))
| true |
c1b2211c93f733aee2fbe3f211e040705a6c8ef0 | Python | freddydavis15/myDjanoWorks | /Freddy_Davis/task/sample_panda.py | UTF-8 | 1,945 | 2.875 | 3 | [] | no_license | import pandas as pd
from StyleFrame import StyleFrame, Styler, utils
#defing data frames
df = pd.DataFrame({
'NO:':[1,2,3,4,5,6,7,8,9,10],
'Country':['France','Germany','Argentina','Belgium','Brazil','Portugal','Poland','Switzerland','Spain','England'],
'Goals:':[25,12,90,14,56,46,37,81,69,10]
... | true |
55f71593b80c2f0c27df72bc123d9fd5143a8d90 | Python | CCLIKEY/pythonProject | /phoneNumArray.py | UTF-8 | 194 | 3.09375 | 3 | [] | no_license | phoneNumArray = ['','','abc','def','ghi','jkl','mno','pqrs','tuv','wxyz']
chose = [9,9]
for i in phoneNumArray[chose[0]]:
for j in phoneNumArray[chose[1]]:
print(i+j,end=" ")
| true |
d4795e201dc3000a34bd115777c05c9f5f4e46ac | Python | ekspertas/Python | /Task-5_2.py | UTF-8 | 613 | 4.09375 | 4 | [] | no_license | """
Создать текстовый файл (не программно), сохранить в нем несколько строк,
выполнить подсчет количества строк, количества слов в каждой строке.
"""
with open("my_file.txt") as f_1:
counter = 0
for line in f_1:
counter += 1
print(f'Строка файла: {line.strip()}')
temp_list = lin... | true |
ab7fa9e91a0bbb9452558bddc55fac71dc349185 | Python | snehilk1312/AppliedStatistics | /Python/statistics_with_Python/04_Exploring_Data_with_Graphs/Script_Files/04_boxplot.py | UTF-8 | 796 | 3.1875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
data = pd.read_csv('/home/atrides/Desktop/R/statistics_with_Python/04_Exploring_Data_with_Graphs/Data_Files/DownloadFestival.dat', sep='\s+')
print(data.head())
# boxplot using seaborn
_ = sns.boxplot(x=data['gender'],y=data['day1'])
plt.sh... | true |
25ce1548f7b973e8786411907d59d520b29d8083 | Python | tree9990/learning-pieces | /perfect_number.py | UTF-8 | 146 | 3.296875 | 3 | [] | no_license |
for i in range (10000):
sum=0
for j in range (1,i):
if i%j==0:
sum+=j
if sum == i:
print(sum)
| true |
8c9d1b949d83316a50366af4b8324775fcb85e22 | Python | mapto/4oBe4e | /src/engine.py | UTF-8 | 5,574 | 3.125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# coding: utf-8
from state import Piece, Board, GameMove, GameState, ROLL_DICE, MOVE_PIECE, PIECE_OUT
from util import roll as roll_dice
from typing import List, Sequence
class Dice:
def roll(self) -> int:
return roll_dice()
class GameEngine:
def __init__(self, board: Board, ... | true |
982fe6a6db83c28fe6b5c8ef4e2946454f28e605 | Python | patrickschu/textgrid-convert | /textgrid_convert/sbvParser.py | UTF-8 | 5,139 | 2.96875 | 3 | [] | no_license | # read the sbv stuff in; assign timestamp to text
# {id : "chunk", "start", "end"
# expected out: 26 Carrie: [78.28] (pause 5.83) [84.10]
import re
import logging
from textgrid_convert.ParserABC import ParserABC
log = logging.getLogger(__name__)
log.addHandler(logging.StreamHandler())
#log.setLevel(logging.DEBU... | true |
a928b11dd1e98a7b5aaa3d9216d16a2f4bc3adef | Python | jdigiac2/Connected-Cells | /connectedcells.py | UTF-8 | 6,488 | 2.859375 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the connectedCell function below.
def connectedCell(matrix):
#---variables---
rowLoc=[]
columnLoc=[]
rowReg={}
regionCount=[]
markDel=[]
rowRegIndex=[]
finalSize=[]
columnReg={}
... | true |
aebd9c2d0a8f47b32ac598732c34c7764e41f10c | Python | wendyrvllr/Dicom-To-CNN | /dicom_to_cnn/model/petctviewer/RoiNifti.py | UTF-8 | 1,043 | 2.703125 | 3 | [
"MIT"
] | permissive | from dicom_to_cnn.model.petctviewer.Roi import Roi
class RoiNifti(Roi):
"""Derivated Class for automatic Nifti ROI of PetCtViewer.org
Returns:
[RoiNifti] -- Nifti ROI
"""
def __init__(self, roi_number:int, list_point:list, volume_dimension:tuple):
"""constructor
Args:
... | true |
a23049153b7c84b15fa7a50ee2c965b29bd84464 | Python | feiline/storyteller-dialogue-system | /NLU_test/nlu_test.py | UTF-8 | 6,041 | 2.953125 | 3 | [] | no_license | import random
import time
from rasa.nlu.model import Interpreter
def get_model():
model = "/home/sabrina/PycharmProjects/storyteller_DS/rasa_folder/models/nlu"
interpreter = Interpreter.load(model)
return interpreter
def get_intent(interpreter, utterance):
"""
retrieves intent from user utteran... | true |
82ad9c46a393612267bf521421c9f6118202658f | Python | kaiyaprovost/algobio_scripts_python | /prob23_inversions.py | UTF-8 | 4,020 | 3.109375 | 3 | [] | no_license | ##def inversionCount(array):
## inv = 0
## for i in range(0,len(array)-1):
## #print "i",i
## j = i+1
## while j < len(array):
## if array[i] > array[j]:
## inv += 1
## j += 1
## return inv
##def mergeSort(array,inv):
## """
## Takes... | true |
e152cf2f1cec665e69956d04848a868e30607182 | Python | jajenQin/Mask_RCNN_On_Pathology | /Data_Pre_Processing/partition_test.py | UTF-8 | 624 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 12 13:57:41 2018
@author: wenyuan
"""
import os
from xlrd import open_workbook
held_out_set = 4
excel_path = os.path.join(os.getcwd(), 'cedars-224/5_fold_partition.xlsx')
wb = open_workbook(excel_path)
table = wb.sheet_by_index(0)
train_list =... | true |
f1789be3d6ed5a0c306a3bea3ffff6b0c0343b82 | Python | Guilhem74/STI_Robotic_Competition_Software | /Architecture/beacon.py | UTF-8 | 7,331 | 2.53125 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
import math
from picamera import PiCamera
import time
center_cone_x = 978#978 #974
center_cone_y = 655#655 #654
RedLed = (0,8040)
GreenLed = (8040,8040)
BlueLed = (8040,0)
YellowLed = (0,0)
g_low = (32, 110, 90)
g_high = (43, 255,255)
b_low = (10, 200, 75)
b_high = (15, 255,255)
r_low = ... | true |
c6ba0bccbe67461ca3140d65ed42c79ac6e9748b | Python | eagle-deep-blue/omni_robo_platform | /cmd_vel_smooth_omni_robo/scripts/cmd_vel_joystick.py | UTF-8 | 2,483 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
#Author: Solomon Jingchun YIN
#Contact Address: jingchun.yin@live.com
#Completed on 25th Apr., 2015
import rospy
import sensor_msgs.msg
from geometry_msgs.msg import Twist
from numpy import *
limit_linear_speed = 0.15
limit_angular_speed = pi/6
tolerance_drift = 1e-3
class cmd_vel_publisher_j... | true |
93710e90cfea424c03494eb346c33cdd6f821a51 | Python | codocedo/mincovmin | /ae_libs/boolean_tree.py | UTF-8 | 4,902 | 4 | 4 | [] | no_license | from __future__ import print_function
class BooleanTree(object):
'''
BooleanTree that maintains a list of boolean array lists
The leaf can be either None, False or True.
None, means that no element has been stored in that position.
False and True indicates whether the element stored in that positio... | true |
6696495b8e087846c3d1f86b698d62cbecd26b13 | Python | snajder-r/benchmark_meth5 | /benchmark_pycometh/segmentation/segmentation_comparer.py | UTF-8 | 7,412 | 2.8125 | 3 | [
"MIT"
] | permissive | import random
from collections import namedtuple
import tqdm
import numpy as np
import pandas as pd
class SegmentsComparer:
def __init__(self, gt_segments, predicted_segments):
self.gt_segments = gt_segments
self.predicted_segments = predicted_segments
def compute_dist_from_a_to_b(s... | true |
574cc4d02e96e99377de59456d8649a0716df096 | Python | dufufeisdu/AI_Trading_Learn_Packages | /learn/Leecode_py/array/remove_duplacate_sorted_array_in_place.py | UTF-8 | 1,911 | 3.65625 | 4 | [] | no_license | import unittest
def remove_duplicate(sorted_arr):
length = len(sorted_arr)
if length <= 1:
return sorted_arr
j = 1
for i in range(1, length):
if sorted_arr[i] != sorted_arr[j - 1]:
sorted_arr[j] = sorted_arr[i]
j += 1
return sorted_arr[:j]
def remove_dupli... | true |
d00a70e3a7b20760b7992ed926fb0ecdacb415ca | Python | adamadair/PyEuler | /solutions/euler/number.py | UTF-8 | 1,413 | 3.578125 | 4 | [] | no_license | import math
def is_prime(n):
"""returns True if n is prime"""
if n % 1 > 0 or n < 2:
return False
if n == least_factor(n):
return True
return False
def largest_prime_factor(n):
"""
returns the largest prime factor of n
The prime factors of 13195 are 5, 7, 13 and 29
th... | true |
864640dff4f09115b6b6bc095efb922d11f7d0fa | Python | vincent51689453/COVID19-Tester | /single_sample_classifier.py | UTF-8 | 3,771 | 3.03125 | 3 | [] | no_license | """
@@@ Name: Samples classifier (Single sample)
@@@ Author: VincentChan
@@@ Date: 12/21/2020
"""
import sensor, image, time
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # S... | true |
0b8a6212078e317c274da4bcd8f37b571b33e06a | Python | preisach/animations | /samples/samplesPY/arch/make_combos/2015_12_30_make_combos_working.py | UTF-8 | 919 | 2.765625 | 3 | [
"MIT"
] | permissive |
import matplotlib.pyplot as plt
import numpy as np
####30/12/2015, it works, it fucking works!!!!!!
def rr(size, corners):
global arr
global count
global totalSize
if(size>1):
rr(size-1, corners)
tmpCorners = corners[:]
tmpCorners.append(size)
# print "corners:\t"+str(tmpCorners)
rr(size-1, tmpC... | true |
b58ea3f8718083f0a44c913e979b1b4613a1e15a | Python | KamyarGh/rl_swiss | /neural_processes/test_scripts/test.py | UTF-8 | 2,692 | 2.515625 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.optim import Adam
from neural_processes.generic_map import make_mlp, GenericMap
from neural_processes.neural_process import compute_diag_log_prob
use_gpu = False
def test_make_mlp(use_bn=False):
# si... | true |
c2c57f16ea11cd53dd5d47bfa819d5f454644e0d | Python | mathaou/showcase | /core/diatonic.py | UTF-8 | 4,703 | 3.171875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
================================================================================
Music theory Python package, diatonic module.
Copyright (C) 2008-2009, Bart Spaans
This program is free software: you can redistribute it and/or modify
it under the terms of ... | true |
b3a1b67ef466caa19654d6b153f532da75179e40 | Python | kaareltonisson/prog-kursused | /prototüübi näiteid/csvgraafik/csvgraafik.py | UTF-8 | 4,322 | 2.640625 | 3 | [] | no_license | import tkinter as tk
from tkinter import filedialog
from tkinter import messagebox
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
import csv
####
# Graafika algatamine
####
root = tk.Tk() # Loome graafika juurakna
root.title("Graafikud")
####
# Sisend... | true |
15abe58379e1a41f549f0e1ee7f5048631e2aadd | Python | SlientMe/teaching | /郑继涵/中级/day08正式版.py | UTF-8 | 2,489 | 3.46875 | 3 | [] | no_license | import pygame
import sys
import random
# 这节课主要内容是将屏幕上自己画的内容替换为图片。 添加背景图片
pygame.init()
screen = pygame.display.set_mode((640,700))
pygame.display.set_caption("BAll")
ball = pygame.image.load('./img/ball.png') # 加载小球图片图片
sport = pygame.image.load('./img/sport.png') # 添加挡板图片
bg = pygame.image.load('./img... | true |
921168be686afc364be4915d00203e862d3b22ec | Python | vNugget/Nutanix | /AHV/ApiTools.py | UTF-8 | 987 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python3
import json
def jsonScan(jsonLoad, target,found):
"""Take a json object and scan it to look for specific key and get it's value.
- target (str): is the key that we are looking for.
- return: if found the func will append the result to the found (list) var, this var
... | true |
56040f130a35c2966e2cd5a641ee305d45fcac16 | Python | jadenpadua/Foundation | /DynamicProgramming/longest-increasing-subsequence.py | UTF-8 | 503 | 3.046875 | 3 | [] | no_license | class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
# [-1,3,4,5,2,2,2,2]
n = len(nums)
if n <= 1: return n
memo = [1] * n
LIS = 1
for i in range(1, n):
curr_LIS = 0
for j in range(i):
if nums[j] < ... | true |
9df7eb39fedaf600b9f8df07066c1ac012703308 | Python | BrandonBench/Real-Space-Battle | /spaceship.py | UTF-8 | 2,726 | 3.640625 | 4 | [] | no_license | import pygame
from bullet import Bullet
class Spaceship():
def __init__(self,width,height,x,y,color):
self.imager = pygame.image.load("playerShipRight.png")
self.imagel = pygame.image.load("playerShipLeft.png")
self.imageu = pygame.image.load("playerShipUp.png")
self.imaged = pyga... | true |
ffefffb064f706779dc92ff8df6cb0c1db681099 | Python | gariciodaro/MLDiagnosisTool | /Classes/OFHandlers.py | UTF-8 | 881 | 3.078125 | 3 | [
"MIT"
] | permissive | # For exporting and importing binary files between python enviroments.
import pickle
class OFHandlers:
def __init__(self):
pass
@staticmethod
def save_object(path,object):
"""Saves a python object to path (in filesytem).
Parameters:
object: python obj... | true |
7dc87a3c7f17ba7f2bd04acd849b05992706edd3 | Python | mmahacek/reports | /scripts/create_vm.py | UTF-8 | 4,025 | 2.53125 | 3 | [
"MIT"
] | permissive | """
This script allows you to create a VM, an interface and primary IP address
all in one screen.
Workaround for issues:
https://github.com/netbox-community/netbox/issues/1492
https://github.com/netbox-community/netbox/issues/648
"""
from dcim.choices import InterfaceTypeChoices
from dcim.models import DeviceRole, Pl... | true |
1833e82449afdededf22b7d81f16d6221c5453ff | Python | ashish-rane/Hadoop | /Spark/Pyspark/wordcount.py | UTF-8 | 494 | 2.828125 | 3 | [] | no_license | from pyspark import SparkContext
from pyspark import SparkConf
conf = SparkConf()
conf.setAppName("WordCount")
#sc = SparkContext("local", "Wordcount")
sc = SparkContext(conf=conf)
book = sc.textFile("/user/cloudera/datafiles/common/book.txt").cache()
wordcount = book.flatMap(lambda line: line.split(" ")).map(lambda ... | true |
9754e69f9b3f9c11f5e0f4d2a78f9437205d244e | Python | waldohf/Safety-in-TX | /proj_naive_bayes.py | UTF-8 | 8,281 | 3.140625 | 3 | [] | no_license | from __future__ import division
import re
import json
import math
import random
import operator
from stemming import porter2
def tokenize(text):
"""
Take a string and split it into tokens on word boundaries.
A token is defined to be one or more alphanumeric characters,
underscores, or apostrophes. Re... | true |
263577afe201c787a7f0e264e21e0fb73effe748 | Python | SethGreenbaum/pythonTest | /eolserver.py | UTF-8 | 2,293 | 2.796875 | 3 | [] | no_license | import asyncio
import traceback
from dbconnector import DBConnector
from orderdata import OrderData
class EOLServer:
def __init__(self):
self.address = '10.51.50.1'
self.port = 8089
self.loop = asyncio.get_event_loop()
self.db_connector = DBConnector()
async def handle_connec... | true |
1fe1d656b968bf6ef4253a34ad4734b3ba9f39d7 | Python | jiaojinda/Python | /exceptions/exceptions_raise.py | UTF-8 | 700 | 3.546875 | 4 | [] | no_license | # encoding=UTF- 8
class ShortInputException( Exception) :
''' 一个由 用 户 定义的异常类'''
def __init__( self, length, atleast) :
Exception. __init__( self)
self. length = length
self. atleast = atleast
try:
text = input( ' Enter something - - > ' )
if len( text) < 3:
raise ShortInp... | true |
4569ef7f569dcc2874086cd883e42bf5cf202405 | Python | h920032/TWDC_workshop | /utils/data_cube_utilities/plotter_utils.py | UTF-8 | 9,626 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | import matplotlib.pyplot as plt
from datetime import datetime
import numpy as np
import pandas as pd
import datacube as dc
import xarray as xr
import utils.data_cube_utilities.data_access_api as dc_api
from utils.data_cube_utilities.dc_utilities import perform_timeseries_analysis
from utils.data_cube_utilities.dc_mosa... | true |
1f6198970f8f8b0d34aca661e13bda6cfe6ac08a | Python | Surazthakur/LetsUpgradePythonAssignment | /Day5Assignment1.py | UTF-8 | 232 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # DAY 5 Assignment 1
# In[1]:
newList = [1,5,6,4,1,2,4,3,5]
subList = [1,1,5]
if subList in newList :
print('It\'s a match' )
else :
print('It\'s not a match')
# In[ ]:
| true |
7ee981c1584f6576e0e01b21d012bbbf481c760c | Python | eishk/Udacity-Data-Structures-and-Algorithms-Course | /P2/problem_1.py | UTF-8 | 1,071 | 4.25 | 4 | [] | no_license | def sqrt(number):
"""
Calculate the floored square root of a number
Args:
number(int): Number to find the floored squared root
Returns:
int: Floored Square Root
"""
if number is None:
return None
low = 0
high = number
found = False
if number == 1 or number ... | true |
aea2808dd57fd56904f3619c70c83fd0148a13b9 | Python | ethanl2014/CSE-331-Projects | /CSE-331-Projects/Project5/project5/QuickSort.py | UTF-8 | 3,385 | 3.71875 | 4 | [] | no_license | from Queue import LinkedQueue, Node
def insertion_sort(queue):
"""
precondition: queue to be sorted
postcondition: sorts the nodes in a queue in ascending order using the insertion sort algorithm
"""
after = queue.left() #make node designated for after current
queue.enqueue(after.val) #enqueue... | true |
cd56816b5d08c2a157b25dfa7c2194a5ae5010c0 | Python | aequanimitas/justmath | /probability/AIPTA/sets.py | UTF-8 | 1,536 | 3.25 | 3 | [] | no_license | import unittest
class TestingSets(unittest.TestCase):
def setUp(self):
self.bisayaSpeakingStudents = set(list(range(15,31,1)))
self.waraySpeakingStudents = set(list(range(1,22,1)))
self.totalStudents = set(list(range(1,31,1)))
self.dualDialect = set(list(range(15,22,1)))
sel... | true |
0e4ee37b2d80ed94c3f25509cb86167fe551d214 | Python | zeeshan1414/AlgoExpert-Solutions | /0011. find-three-largest-numbers.py | UTF-8 | 475 | 3.390625 | 3 | [] | no_license | def threeLargestNumber(arr):
first = float('-inf')
second = float('-inf')
third = float('-inf')
for ele in arr:
if ele > first:
third = second
second = first
first = ele
elif ele > second:
third = second
second = ele
eli... | true |
9b41470463f9b7e97bbfc5dcb585690297b4a7b4 | Python | AlissonGRN/atividade1-AED | /modelos/venda/daoVenda.py | UTF-8 | 458 | 2.9375 | 3 | [] | no_license | class DaoVenda():
def __init__(self):
self.vendas = []
def buscarVenda(self, codigo):
for venda in self.vendas:
if venda.codigo == codigo:
return venda
return None
def salvarVenda(self, venda):
if self.buscarVenda(venda.codigo) is None:
... | true |
2346d06b8506406c14e6eb4d1e6418f7a3243645 | Python | rngel5514/python-rnlib | /robbers-package.py | UTF-8 | 988 | 3.375 | 3 | [] | no_license | #encoding:UTF-8
'''
在一个圆环上,有n个房屋,每个房屋中有数量不等的财报,一个盗贼希望从房屋中盗取财宝,
由于房屋中有报警器,如果同时从相邻的两个房屋中盗取财宝就会触发报警器。问在不触发报
警器的前提下且只能偷取m个房间,最多能获取多少财宝
input m
input[1.2.3.4]
output:4
'''
'''
数据关系
n1m1+n2m2+n3m3+...nnmn= Max n=0/1
限制方程:mi-1mimi+1 不能相连
且为m个
状态转移方程:
对第i个物品 Max( 若选:1 2 3 ...i-2 i的最大值,若不选:1 2 3 .... | true |
92f338531ab8fe07e36a0a6f3280a183d90bc6a7 | Python | gpuente/ps5-scraper | /src/scraper/scraper.py | UTF-8 | 1,102 | 2.671875 | 3 | [] | no_license | import asyncio
import requests
from aiohttp import ClientSession
from bs4 import BeautifulSoup
class SimpleScraper:
NOT_EMPTY = 'not_empty'
def __init__(self, url, selector, test, session: ClientSession, method="GET"):
self.url = url
self.test = test
self.method = method
self.s... | true |
11f7dba878cc58ad5b72557d8989565117a54d20 | Python | murtekbey/python-libraries | /4-selenium-twitter-bot/twitter.py | UTF-8 | 4,721 | 2.828125 | 3 | [] | no_license | from twitterUserInfo import username, password
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
class Twitter:
def __init__(self, username, password):
self.browserProfile = webdriver.ChromeOptions()
self.browserProfile.add_experimental_option('prefs', {'int... | true |
dfb9058abfce3facfc760866a8ddd9f45617017c | Python | dukelaw/repository_metrics | /src/load_downloads.py | UTF-8 | 3,683 | 2.78125 | 3 | [] | no_license | import argparse
import requests
import xlrd
import repository_metrics
from repository_metrics.model import (Article, Creator, Subject,
Download, Discipline)
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
from datetime import datetime
def excel_row_count(file_c... | true |