blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bfc449afac945454eec512f803501c963c9ea1de | Python | aidanhayter/spike_train_analysis | /histogram_data.py | UTF-8 | 1,587 | 3.109375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from spike_train import create_spikes
"""histogram_data calls the function from spike_train to create random data,
as a Poisson model or MMPP model.
This code then creates statistical histograms from the data."""
plt.switch_backend('Qt5Agg')
model = 'MMPP'
spike_trai... | true |
407743641565f7e79bd71ac24e0dd744941f39b2 | Python | huub8/tol-revolve | /tol/manage/robot.py | UTF-8 | 5,092 | 2.90625 | 3 | [] | no_license | import random
from sdfbuilder.math import Vector3
from revolve.util import Time
from revolve.angle import Robot as RvRobot
class Robot(RvRobot):
"""
Class to manage a single robot
"""
def __init__(self, conf, name, tree, robot, position, time, battery_level=0.0, parents=None):
"""
:p... | true |
77e517b8db446f966a27a6b94e4e66a693c7b7be | Python | falcone-gk/Battery | /decorators.py | UTF-8 | 633 | 3.1875 | 3 | [] | no_license | """
Decoradores para los scripts del archivo battery.py
"""
def is_allowed(func):
def wrapper(*args, **kwargs):
param = args[0]
if param == 0:
print('Se desactivará el modo de conservación de bateria')
elif param == 1:
print('Se activará el modo de conservación de ... | true |
cd6e415f93f06a8070057820434dd42b11f1ff14 | Python | jedrzejkozal/AdventOfCode | /2017/day12/GraphParsing_test.py | UTF-8 | 2,808 | 2.609375 | 3 | [] | no_license | import pytest
from GraphTestBase import *
class TestGraphParsing(GraphTestBase):
def test_parse_graph_with_no_node_graph_is_empty(self):
arg = [""]
self.sut.parseGraph(arg)
assert self.sut.empty() == True
def test_parse_graph_with_one_node_graph_is_not_empty(self, one_node_graph):
... | true |
582f6842db3b3fb3457c152c6054f6272763652c | Python | bgruening/galaxytools | /tools/text_processing/column_arrange_by_header/column_arrange.py | UTF-8 | 996 | 2.875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="Tabular Input File Name")
parser.add_argument("-o", "--output", help="Tabular Output File")
parser.add_argument("-c", "--columns", nargs="+", help="Column Headers to Sort By")
parser.add_argument(
"... | true |
760a088888488732b17ebf3a310a7a7d5ce4226b | Python | rinkeigun/linux_module | /python_source/windowscontrol.py | UTF-8 | 1,133 | 2.609375 | 3 | [] | no_license | # coding: utf-8
from datetime import datetime
from pywinauto import application
app = application.Application(backend="uia").start("notepad.exe")
dlg_spec = app['無題 - メモ帳']
dlg_spec.draw_outline()
# Notepad クラス (Notepad のウィンドウ) を探して日時を入力
#dlg_spec.Edit1.SetText(datetime.now())
#dlg_spec.Edit1.SetText("test")
#dialog... | true |
2f3cfe3728aefadd286a8e3bd37783fe9e5714cc | Python | BusraOzer/InternetofThingsExamples | /PythonBolumu/regexEx.py | UTF-8 | 710 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
import re
mail = "tolgabuyuktanir@.com";
#regular expression
searchObj = re.search( r'(.*)@(.*\.)(.*)', mail)
if searchObj:
print "searchObj.group() : ", searchObj.group()
print "searchObj.group(1) : ", searchObj.group(1)
print "searchObj.group(2) : ", searchObj.group(2)
print "searchO... | true |
a38d7094d40552433881942568be32d743359f71 | Python | vijayaramanp/Guvi-pack1 | /coun_spaces.py | UTF-8 | 73 | 3.171875 | 3 | [] | no_license | # count spaces
x=input()
arr=x.split()
spaces=(len(arr)-1)
print(spaces)
| true |
16cd61901876435beb788106e8f06c02ae0e83db | Python | 1reddymallik1/ETrade-Trading | /Tests/test_EntryMoneyMaker_CalculateStockItemOrders.py | UTF-8 | 4,358 | 2.734375 | 3 | [] | no_license | import os
import sys
import unittest
from pathlib import Path
from typing import List
sys.path.append(str(Path(os.getcwd()).parent))
from BusinessModels.ActiveStockItem import ActiveStockItem
from BusinessModels.OrderInfo import OrderInfo
from BusinessModels.PortfolioResponse import PortfolioPosition
from BusinessMod... | true |
6a4556cf51d831e43cc1a2dd41892922170a5210 | Python | guoyu07/pynotes | /tools/douban.py | UTF-8 | 1,903 | 3.421875 | 3 | [] | no_license | import urllib.request
import re
import time
def movie(movieTag):
tagUrl=urllib.request.urlopen(url)
tagUrl_read = tagUrl.read().decode('utf-8')
return tagUrl_read
def subject(tagUrl_read):
'''
这里还存在问题:
①这只针对单独的一页进行排序,而没有对全部页面的电影进行排序
②下次更新添加电影链接,考虑添加电影海报
... | true |
396023c24a469d9c323197b3c26d3dd29153b81a | Python | disha111/Python_Beginners | /Assignment 1.2/A1.2.py | UTF-8 | 341 | 3.890625 | 4 | [] | no_license | def fizz_buzz(no1):
if(no1%3 == 0 or no1%5 == 0):
op1 = " "
op2 = " "
if(no1%3 == 0):
op1 = "Fizz"
if(no1%5 == 0):
op2 = "Buzz"
result = op1+op2
return result
else:
return no1
no1 = int(input("Enter The Number : "))
result = fizz_bu... | true |
0444631b4625cd8aaae4a9fc7aefac009400f6d1 | Python | kutsevol/technorely_etl | /etl/encounter.py | UTF-8 | 1,073 | 2.734375 | 3 | [] | no_license | import pandas as pd
from schemas import encounter_schema
from utils.stats import get_stats_of_popular_days_of_week
from etl.base import BaseETL
class EncounterETL(BaseETL):
name = "Encounter"
def __init__(self, url, session):
super().__init__(url, session)
self.schema = encounter_schema
... | true |
98d02f9aaae3fd251511340d5f14fad4acc2fd0e | Python | santi1991/tic-python | /semana1/clase1/HolaMundo.py | UTF-8 | 127 | 3.296875 | 3 | [] | no_license |
hola = 'hola'
print(hola)
# print(“Hello, I’m “, 21, “ years old”)
True + False == 0
print(f'{True + False == 0}')
| true |
696ec36152825ee0bbdc6fabfee85e806940d5ff | Python | nakaken0629/atcoder | /abc157/bingo.py | UTF-8 | 600 | 3.15625 | 3 | [] | no_license | A = []
for _ in range(3):
A.append(list(map(int, input().split())))
N = int(input())
b = []
for _ in range(N):
b.append(int(input()))
for num in b:
for x in range(3):
for y in range(3):
if A[x][y] == num:
A[x][y] = -1
amount = 0
for x in range(3):
if max(A[x]) == -1... | true |
ea600784265d557c13059ac44dc20dbc96942eb6 | Python | setazer/aoc | /aoc2020/d5/solve.py | UTF-8 | 1,304 | 3.203125 | 3 | [] | no_license | from itertools import product
from aocframework import AoCFramework
def decipher(board_pass):
row, seat = board_pass[:-3], board_pass[-3:]
row = int(row.translate({ord('B'):'1',ord('F'):'0'}), 2)
seat = int(seat.translate({ord('R'):'1',ord('L'):'0'}), 2)
return row, seat
def next_and_prev(seat):
... | true |
1a0d8de36e4c816b0d98031803369b6e042e8ea8 | Python | tcouch/platform-logs-query | /statsGUI.py | UTF-8 | 9,231 | 2.734375 | 3 | [] | no_license | from tkinter import *
import datetime as dt
import statsFactory as sf
class MainMenu(Tk):
def __init__(self,parent):
Tk.__init__(self,parent)
self.parent = parent
self.initialize()
def initialize(self):
self.grid()
self.initializePlatformSelector()
self.initia... | true |
e4ee9509253b00cbd90d5fcf8fc4051d8ee2e5fb | Python | YouEbr/nginx_loadbalancer | /app-scalable/app.py | UTF-8 | 432 | 2.75 | 3 | [] | no_license | import flask
import socket
app1 = flask.Flask(__name__)
@app1.route('/')
def hello_world():
hostname, ip = get_hostname_and_ip()
return 'This web application is running on host:\"{}\" with ip:\"{}\"'.format(hostname, ip)
def get_hostname_and_ip():
hostname = socket.gethostname()
ip = socket.gethos... | true |
d16fe61b8e703b2ebf748ca86bec7010d8d21f31 | Python | SandhyaDotel/spiral | /spiral/homework.py | UTF-8 | 338 | 3.53125 | 4 | [] | no_license | def spiralize(number):
n = 1
step = 2
total_value = 0
matrix_row = 0
while (n <= (number ** 2)):
total_value += n
n += step
matrix_row += 1
if matrix_row == 4:
step += 2
matrix_row = 0
return total_value
if __name__ == "__main__":
prin... | true |
400c63daf19c164aea1deec9b50778b12ca2c0c5 | Python | freddycervantes/projectZ | /update_database.py | UTF-8 | 1,678 | 2.8125 | 3 | [] | no_license | """
"""
class Update:
def __init__(self):
self.__F = self.__fetch()
self.__W = self.__write()
self.__intra_dates = self.__valid_dates_intra()
self.__stock_list = self.__valid_stocks()
def __fetch(self):
import fetch_data
return fetch_data.Fetch()
def __wr... | true |
1eff8ed58fb2b57b02b72f3c2a265119567a95e2 | Python | pyy1988/pyy_test1 | /pyy1/.pycharm_helpers/python_stubs/-1550516950/_dbus_bindings/Dictionary.py | UTF-8 | 2,836 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | # encoding: utf-8
# module _dbus_bindings
# from /usr/lib/python3/dist-packages/_dbus_bindings.cpython-35m-x86_64-linux-gnu.so
# by generator 1.145
"""
Low-level Python bindings for libdbus. Don't use this module directly -
the public API is provided by the `dbus`, `dbus.service`, `dbus.mainloop`
and `dbus.mainloop.gli... | true |
afe888690d11a9b3712e14b730e9fecc18175131 | Python | pzengseu/leetcode | /3Sum.py | UTF-8 | 672 | 2.78125 | 3 | [] | no_license | class Solution(object):
def threeSum(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
if not nums: return []
nums = sorted(nums)
res = []
for i in xrange(len(nums)-2):
j = i+1
k = len(nums) - 1
whil... | true |
ec7dca5a02323e36316101f48e95b8e99bd74f76 | Python | PinmanHuang/CVDL_2020 | /Hw2/hw2.py | UTF-8 | 14,434 | 2.578125 | 3 | [] | no_license | """
Author : Joyce
Date : 2020-12-15
"""
from UI.hw2_ui import Ui_MainWindow
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow
import sys
import cv2
import numpy as np
# Q3
import cv2.aruco as aruco
from matplotlib import pyplot as plt
# Q4
from sklearn.decomposition import PCA
from ... | true |
0b5e283f629bdcf2a174a465bf8b04c87524976f | Python | Erniess/pythontutor | /Занятие 4 - Цикл for /Практика/Сумма десяти чисел.py | UTF-8 | 308 | 3.390625 | 3 | [] | no_license | # Задача «Сумма десяти чисел»
# Условие
# Дано 10 целых чисел. Вычислите их сумму. Напишите программу, использующую
# наименьшее число переменных.
print(sum([int(input()) for _ in range(10)])) | true |
f0aaaf75c316fd0cc8cfbac06dbeba2f31df5f42 | Python | Cougar/pyxy | /test/test_xy.py | UTF-8 | 2,834 | 2.921875 | 3 | [] | no_license | import unittest
from xy import Area, XY
class AreaTests(unittest.TestCase):
def test_area(self):
a1 = Area(-1, -2, 1, 2, 'name1')
self.assertEqual(a1.xmin, -1)
self.assertEqual(a1.ymin, -2)
self.assertEqual(a1.xmax, 1)
self.assertEqual(a1.ymax, 2)
self.assertEqual(a1.name, 'name1')
a2 = Area(10, 20, -... | true |
b9b1162c9cf6e3d52b1d0f0ce2e25ee2a91a6e6a | Python | DHaythem/Competitive-Programming-Solutions | /Codeforces/1200/A. IQ Test.py | UTF-8 | 611 | 3.09375 | 3 | [] | no_license | #https://codeforces.com/problemset/problem/287/A
a=input()
b=input()
c=input()
d=input()
k=0
for i in range(3):
L=[a[i],a[i+1],b[i],b[i+1]]
if L.count("#")>=3 or L.count(".")>=3:
print('YES')
k=1
break
if k==0:
for i in range(3):
L=[b[i],b[i+1],c[i],c[i+1]]
if L.c... | true |
78021570f9c7c95ee3401495603322d711ad340b | Python | furixturi/CTCI | /Round 3/01 arrays and strings/05-oneAway.py | UTF-8 | 1,015 | 3.8125 | 4 | [] | no_license | # One Away: There are three types of edits that can be performed on
# strings: insert a character, remove a character, or replace a
# character. Given two strings, write a function to check if they are
# one edit (or zero edits) away.
def oneAway(s1, s2):
lenDiff = abs(len(s1)-len(s2))
if lenDiff == 0:
return o... | true |
d99e613c6f6000c123b63eecab83e3b6fbcc885a | Python | zheugene/pdu | /test_xpt2046.py | UTF-8 | 2,284 | 2.640625 | 3 | [] | no_license | # Copyright 2012 Matthew Lowden
#
# 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 in writin... | true |
7be0f9da17498364e2dca6bb8deeeeab61bd2ceb | Python | n2dah/MATH-2305-Final-Project | /functions.py | UTF-8 | 3,528 | 3.453125 | 3 | [
"Unlicense"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 6 20:55:28 2020
@authors: Jeremiah Neuneker, Julia Ramirez, Warda Qadeer, Noah V.
"""
import networkx as nx
import os
def V(graph):
"""Takes in a number of vertices.
Parameters
----------
Returns
-------
A graph with set num... | true |
00c5d33b468e64ce07c0bf3ce563650304ebecb7 | Python | AndreyPankov89/python-glo | /lesson9/task5.py | UTF-8 | 81 | 2.96875 | 3 | [] | no_license | for i in range(7):
for j in range(6):
print('2', end=' ')
print() | true |
1a65736239eb4c1b19bdb49ebfdfa0574a10f342 | Python | Hash-It-Out/Fake-News-Suspector | /wce/scrapeUrl.py | UTF-8 | 1,063 | 2.546875 | 3 | [
"MIT"
] | permissive | from bs4 import BeautifulSoup
from newspaper import Article
import csv
class url_query():
def url_news(sstring):
url= sstring
print(url)
data=[None]*2
try:
article = Article(url)
... | true |
7eb8bb25546f929a4fdf04c419bc4e5ee3c795f4 | Python | kziolkowska/PyEMMA | /pyemma/msm/estimation/dense/tmatrix_sampler_jwrapper_test.py | UTF-8 | 2,909 | 2.671875 | 3 | [
"BSD-2-Clause"
] | permissive | '''
Created on Jun 6, 2014
@author: marscher
'''
import unittest
import numpy as np
from tmatrix_sampler_jwrapper import ITransitionMatrixSampler
def assertSampler2x2(sampler, C, nsample, errtol):
"""
same function as in stallone.test.mc.MarkovModelFactoryTest
"""
c1 = float(np.sum(C[0]))
c2 = fl... | true |
e1684604ac5625757d83f240c02b4297e3056e20 | Python | FredrikBakken/family-tree | /scrape/scrape.py | UTF-8 | 3,164 | 3.1875 | 3 | [
"MIT"
] | permissive | import re
import time
import random
import requests
from bs4 import BeautifulSoup
def getContents(url):
time.sleep(2) # Avoid DDoS
page = requests.get(url)
if (page.status_code == 200):
return page.content
def website(url):
contents = getContents(url)
if (contents != None):
# Par... | true |
d9ad6c1c6ca611740773639c414594d305378b4a | Python | zhou11616/myproject | /day1/c.py | UTF-8 | 585 | 3.078125 | 3 | [] | no_license | def ling(n):
nstr = range(1, 2 * n)
for i in nstr[0:n]:
for j in nstr[n - i : 0 : - 1]:
print(" ", end=" ")
for j in nstr[0 : 2 * i - 1]:
print("*", end=" ")
print("")
for i in nstr[0:n-1]:
for j in nstr[0:i]:
print(" ", end=" ")
fo... | true |
98ae47f15e089f31c8abddd6f4acfb4e51807c89 | Python | RohanAnandPandit/graphite | /src/string_formatting.py | UTF-8 | 11,035 | 3.140625 | 3 | [] | no_license | from maths.math_constants import *
from maths.math_functions import *
from utils import invert
constants = ['π', 'φ']
# Superscript numbers,variables and operator characters
numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] # Regular numbers
super_script = ['⁰', '¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹... | true |
6789c47dd25c8726ed4a62cbf39d57c8e7202513 | Python | arunajasti/python_programs | /TypesOfVariablesInOOPS/Static Variables/Employee1.py | UTF-8 | 1,367 | 4 | 4 | [] | no_license | class Employee1:
company = 'Amazon' #declare static variable outside method/constructor
def __init__(self,name):
self.name = name
Employee1.empLocation = 'DENMARK'# declare static variable inside constructor using className
def showDetails(self):
Employee1.salary... | true |
5806ea7b2e853f50ead7a72cb4eacebd259122c3 | Python | aseemm/crawlers | /src/example.py | UTF-8 | 3,543 | 2.75 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import NoSuchElementException
cl... | true |
b2fa8cb8fa9a9159c9dc2150cdcfd5aae040a4b7 | Python | xinyuewang1/hackerrankTests | /makingAnagrams.py | UTF-8 | 634 | 3.125 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
from collections import Counter
# Complete the makeAnagram function below.
def makeAnagram(a, b):
a = Counter(a)
b = Counter(b)
inter = a & b # intersection
# print(a.subtract(inter))
# if inter:
return sum((a - inter).v... | true |
59d202fefeb20b76f0d2f6ef7e9874aa0ed51114 | Python | piotroramus/Computational-Geometry-2015 | /lab1/matplotlib/main.py | UTF-8 | 960 | 3.25 | 3 | [] | no_license | __author__ = 'piotr'
from matplotlib import pyplot as plt
currentPoints = "D"
with open('../points'+currentPoints+'.txt') as inputFile:
points = []
for line in inputFile:
[x, y] = line.strip().split(';')
points.append([x, y])
plt.plot(*zip(*points), marker='.', color='r', ls='', markersize... | true |
c143d7553a633c5dc08ba671430a6426a6a66309 | Python | saatvikgulati/turtle-python | /race.py | UTF-8 | 1,246 | 3.15625 | 3 | [] | no_license | import turtle
import time
from random import randint
window=turtle.Screen()
window.bgcolor("brown")
tur=turtle.Pen()
tur.speed(0)
tur.up()
stamp_size=20
square_size=15
finish_line=200
tur.color("black")
tur.shape("square")
tur.shapesize(square_size/stamp_size)
tur.up()
for i in range(10):
tur.setpos(finish_line,(15... | true |
57f242252ea28ad0a95e39b2eeff06110cba06c7 | Python | xiaoli777/ecs289g_tsne_pres | /build.py | UTF-8 | 1,893 | 2.5625 | 3 | [] | no_license | #!/usr/bin/python3
import argparse
import os
import shutil
def handleAutoComplete():
if sys.platform == 'Mac OS X':
complete_cmd = 'complete -F _longopt {}'.format(os.path.basename(__file__))
bashrc_path = os.path.expanduser('~/.bashrc')
with open(bashrc_path) as f:
if not compl... | true |
35c02d229b85b1a2a92a9eadf207612f93f61322 | Python | LiMichael1/Space_Invaders | /PlayScreen.py | UTF-8 | 12,890 | 2.5625 | 3 | [] | no_license | import sys
from time import sleep
import pygame
from bullet import Bullet
from Alien1 import Alien1
from Alien2 import Alien2
from Alien3 import Alien3
from pygame.sprite import Group
from high_score import High_Score
from game_stats import GameStats
from scoreboard import Scoreboard
from ship import Ship
from UFO imp... | true |
221e71fa44fc9f71b5c2c61f854db74dfc91d2d1 | Python | hxl163630/practice | /31. Next Permutation.py | UTF-8 | 538 | 3 | 3 | [] | no_license | class Solution:
def nextPermutation(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
if not nums or len(nums) == 1: return
i = len(nums) - 2
while i >= 0 and nums[i + 1] <= nums[i]: i -= 1
i... | true |
24e2252193be0424394912a38d072c232cc4d852 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_135/1028.py | UTF-8 | 949 | 3.234375 | 3 | [] | no_license | import sys
if __name__ == "__main__":
T = int(sys.stdin.readline())
f = open("a.out", 'w')
for i in range(T):
r1 = int(sys.stdin.readline())
for j in range(1, 5):
if j == r1:
row = sys.stdin.readline().split()
r1_set = set(row)
else:
... | true |
b5faf9773c21e394401a5b724c92de8c642f690d | Python | harshitbhat/Data-Structures-and-Algorithms | /GeeksForGeeks/DS-Course/002-Recursion/017.print-1-to-n-without-using-loops.py | UTF-8 | 232 | 3.078125 | 3 | [] | no_license | class Solution:
#Complete this function
def printNos(self,N):
def print1ToN(n):
if n == 0:
return
print1ToN(n-1)
print(n, end=' ')
print1ToN(N) | true |
db4fb8983298740fcf0bd85ed1bb48c417e372d4 | Python | Nitishkumar-S/Cryptocurrency-sentiment-analysis | /cryptocurrency sentiment analysis.py | UTF-8 | 3,690 | 3.4375 | 3 | [] | no_license | #Import libraries
import tweepy
from textblob import TextBlob
import pandas as pd
import numpy as np
import re
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
#Function that cleans tweets
def cleanTwt(twt):
twt=re.sub("#","",twt) #removes all hash from hashtags
twt=re.sub('\\n','',t... | true |
97f045c216b79fefd9248bb7797772a0ed4f2232 | Python | astsu-dev/exapi1 | /exapi/channel_creators/binance/spot/market_data/interface.py | UTF-8 | 2,186 | 2.625 | 3 | [
"MIT"
] | permissive | from typing import Protocol, Optional
class IBinanceSpotMarketDataChannelCreator(Protocol):
"""Binance spot market data socket channel creator."""
def create_agg_trades_channel(self, symbol: str) -> str:
"""Creates agg trade channel.
Args:
symbol (str)
Returns:
... | true |
e92a58a55a7229f0e0ac5cb64ca8613aba8a8773 | Python | Sheepp96/ngoquangtruong-fundamentals-c4e17 | /Session4/while_ex.py | UTF-8 | 141 | 3.84375 | 4 | [] | no_license | n = 0
while n < 3: #sau while là kiểu boolean - true / false
#tương đương for i in range(3):
print("Hi")
n += 1
| true |
8ebf3969c1ef9a5d48df719b81b5f0f30c3f4ec6 | Python | metulburr/random | /pygame_/resizable_surface.py | UTF-8 | 3,399 | 3.046875 | 3 | [] | no_license |
import pygame as pg
import random
class Ball:
def __init__(self, screen_rect):
self.screen_rect = screen_rect
self.image = pg.Surface([50,50]).convert()
self.image.fill((255,0,0))
self.rect = self.image.get_rect()
self.speed_init = 10
self.speed = self.spee... | true |
917530577706bb6c58f0c159fc8561ac4e0dbb57 | Python | nashid/magicomplete | /oneshot.py | UTF-8 | 11,423 | 2.578125 | 3 | [] | no_license | # One-shot learning algorithms.
import random
import numpy as np
import torch
import torch.nn.functional as F
from util import batched, Progress
from user import User
from data import augment
class OneShotLearner:
def name(self):
raise NotImplemented()
def learn(self, example):
pass
def... | true |
31e94203b38d4983d907364176e7f3ed256b5166 | Python | mukeshkrishna/datastructures | /merge_two_sorted_list.py | UTF-8 | 1,697 | 4.4375 | 4 | [] | no_license | """Problem Statement #
Implement a function that merges two sorted lists of m and n elements respectively, into another sorted list. Name it merge_lists(lst1, lst2).
Input #
Two sorted lists.
Output #
A merged and sorted list consisting of all elements of both input lists.
Sample Input #
list1 = [1,3,4,5]
list2 = ... | true |
7349268d79c050a6a7b7a33368195e810bdc483a | Python | kimha1030/AirBnB_clone_v2 | /web_flask/9-states.py | UTF-8 | 967 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python3
"""Task 6"""
from flask import Flask
from flask import render_template
from models import storage
from models.state import State
from models.city import City
app = Flask(__name__)
@app.route('/states', strict_slashes=False)
def states():
"""Function that return states"""
states = storage.a... | true |
b3d913e4fcba86cbd07f96a39ce7cf53fbcd9aeb | Python | microsoft/SparseSC | /src/SparseSC/utils/misc.py | UTF-8 | 3,069 | 2.71875 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | # Allow capturing output
# Modified (to not capture stderr too) from https://stackoverflow.com/questions/5136611/
import contextlib
import sys
from .print_progress import it_progressbar, it_progressmsg
@contextlib.contextmanager
def capture():
STDOUT = sys.stdout
try:
sys.stdout = DummyFile()
... | true |
c922c9040e1b760db28a07a981f21c40e5155588 | Python | osmaralg/mywebpage | /sampleapp/ML_scripts/predict_bankrrupcy/Final_project.py | UTF-8 | 5,569 | 2.5625 | 3 | [] | no_license |
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.neural_network import MLPClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import SVC
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.ens... | true |
3abf8d7f27d317c01b1bb5cef4190d15c5993453 | Python | IgnacioPardo/PythonGalore | /scripts/style-transfer.py | UTF-8 | 1,530 | 2.875 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
import numpy as np
import tensorflow_hub as hub
from PIL import Image
from argparse import ArgumentParser
hub_module = hub.load('https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/1')
def style_transfer(content_image: np.ndarray,
style_image: np.ndarray, *,... | true |
327e1616ddac8f982f25e04cce486c77830a36c9 | Python | felipehv/iic2233 | /Actividades/AC14/test_ac14.py | UTF-8 | 2,097 | 2.8125 | 3 | [] | no_license | from main import *
import pytest
class TestSistema():
def setup_method(cls, method):
cls.base = Base()
cls.ramos = list()
cls.alumno = Alumno(cls.base, 0, "Felipe")
cls.alumno.tomar_ramo("ICS3902") # 30 creditos
cls.alumno.tomar_ramo("ICT2213") # 10 creditos quedan 10
... | true |
96f81075b0694e5033e28e4066cf966cd4225881 | Python | cs20-1/cursor-MasonShenner | /Masons_curser/Masons_curser.pyde | UTF-8 | 278 | 3.078125 | 3 | [] | no_license | # Mason Shenner
# COmputar science
# October 2
# Circle with cross
def setup():
size(500,500)
def draw():
fill(255,0,0)
ellipse(mouseX + 250, mouseY + 250, 400, 400)
fill(0,0,0)
rect(mouseX + 225, mouseY + 50, 50, 400)
rect(mouseX + 50, mouseY + 225, 400, 50)
| true |
538775e59fae3ed7d10996580b7e229c881ae0b2 | Python | DeanFujimoto/python | /test.py | UTF-8 | 1,750 | 2.671875 | 3 | [] | no_license | from scipy.io import loadmat
import numpy as num
import math
data = loadmat('16_state.mat')
data1 = loadmat('exo0.5_endo1.0023_h1.mat')
rows, cols = (16, 16)
mut = [[0 for i in range(cols)] for j in range(rows)]
state = data.get('STATE')
eqADD = data1.get('eqADD')
QADD = data1.get('QADD')
eqPROD = data1.get('eqPROD'... | true |
28eddf2ac9a45555fc8fafd356e8211e7b8f0918 | Python | HiAwesome/python-algorithm | /c05/p185.py | UTF-8 | 1,048 | 4.0625 | 4 | [
"Apache-2.0"
] | permissive | def quicksort(alist):
quicksortHelper(alist, 0, len(alist) - 1)
def quicksortHelper(alist, first, last):
if first < last:
pivot_value = alist[first]
leftmark = first + 1
rightmark = last
done = False
while not done:
while leftmark <= rightmark and alist[le... | true |
565c21c9784beb95aea35945a4aa994812ffe0e7 | Python | JakeStubbs4/MTHE-493 | /eigenfaces.py | UTF-8 | 5,689 | 3.125 | 3 | [] | no_license | # MTHE-493 Facial Recognition Project
# EigenFaces Implementation
# Prepared by Jake Stubbs
from matplotlib import pyplot as plt
import numpy as np
import os
from utilities import euclideanDistance, importDataSet, FaceImage, EigenPair, KNearestNeighbors
# Computes the vector representation of the average face of all ... | true |
4b05faeee9cc5e70aa951331a8da1d7f8d7b03ae | Python | nickvirden/deep-learning-portfolio | /Fundamentals/Data Preprocessing/data-preprocessing.py | UTF-8 | 3,619 | 3.796875 | 4 | [] | no_license | # Import libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Suppresses automatic format guessing by numpy
# I set this option because it changes numbers into scientific notation after they get disproportionately large
np.set_printoptions(suppress=True)
# Import the dataset
da... | true |
459fd6c77aa5058435f5aa6b418c12fb0cb6e582 | Python | dreadlordow/Softuni-Python-Advanced | /02.Tuples_and_Sets-Exrecise/7.Battle_of_names.py | UTF-8 | 650 | 3.609375 | 4 | [] | no_license | n = int(input())
even_set = set()
odd_set = set()
for i in range(1, n + 1):
name = input()
summed = sum([ord(x) for x in name]) // i
if summed % 2 == 0:
even_set.add(summed)
else:
odd_set.add(summed)
even_sum = sum(even_set)
odd_sum = sum(odd_set)
if odd_sum > even_sum:
difference... | true |
f37c8d222d222916a066337a44e933bf61f5f6db | Python | ysachinj99/PythonFile | /Frame.py | UTF-8 | 84 | 2.75 | 3 | [] | no_license | from tkinter import *
root=Tk()
frame=Frame(root)
frame.pack()
root.mainloop()
| true |
7c275ced5bd26fa0000aaf344f9b113475596ce6 | Python | YuanbenWang/learngit | /android/spy_360.py | UTF-8 | 1,261 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri May 12 11:30:11 2017
@author: GXW
used
"""
import re
import urllib
import os
# response=urllib.urlopen('http://zhushou.360.cn/list/index/cid/1?page=1')
# html=response.read()
# link_list=re.findall(r"(?<=&url=).*?apk",html)
# for url in link_list:
# print... | true |
0de9972676b2c6b5e3e69a48ff5573bfdd788c56 | Python | kmarkley-ksu/HumanEmotions | /Emotion_Detection_CNN/Source/Emotion_CNN.py | UTF-8 | 6,600 | 2.625 | 3 | [] | no_license | #<editor-fold> Import Statements
import matplotlib.pyplot as plot
#%matplotlib inline
import numpy
#import tensorflow
import tensorflow.compat.v1 as tensorflow
tensorflow.disable_v2_behavior()
#</editor-fold> Import Statements
#<editor-fold> Unzipping the file and getting each picture.
CIFAR_DIR = "./cifar-10-batche... | true |
ac3434b7717f2bcff37ef0c056f0993c70b4c521 | Python | videoturingtest/FALCON2018 | /src/train_test/main.py | UTF-8 | 2,792 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | """
FALCON: FAst and Lightweight CONvolution
Authors:
- Chun Quan (quanchun@snu.ac.kr)
- U Kang (ukang@snu.ac.kr)
- Data Mining Lab. at Seoul National University.
File: train_test/train_test.py
- receive arguments and train_test/test the model.
Version: 1.0
This software is free of charge under research purpose... | true |
bf4b655da24f20bb96859a6276c73ad9e954df79 | Python | Shafin-Thiyam/Sound_Content_Test | /baseXmlHelper.py | UTF-8 | 9,870 | 2.71875 | 3 | [] | no_license | # Copyright: 2018, Ableton AG, Berlin. All rights reserved.
#****************************************************************************************
#
# base xml parse functionality
#
#****************************************************************************************
try:
import xml.etree.cElementTree as ET... | true |
d3a094adf868249681683a5afa54538f249a36f2 | Python | Xiaoran807/robot-play | /src/beginner_tutorials/scripts/tempTopic/temperatureClass.py | UTF-8 | 948 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from std_msgs.msg import Float64
class TemperatureSensor:
def read_temperature_sensor_data(self):
# Here you read the data from your sensor
# And you return the real value
self.temperature = 30.0
def __init__(self):
# Create a ROS publisher
... | true |
684b2b564cd2f21801893326e18a72aa8cf56e7a | Python | michelwandermaas/scheduler_translator | /script_scheduler_writer.py | UTF-8 | 32,922 | 2.671875 | 3 | [] | no_license | '''
Author: Michel Wan Der Maas Soares (mwandermaassoares@lbl.gov)
This class is supposed to serve as a mechanism for the developer to write scripts that will work in multiple schedulers.
The project was first developed to work with Univa Grid Engine(UGE) and Simple Linux Utility for Resource Management(SLURM),
but it... | true |
5cc0b0934270492e92dbb799aa2417d716e570aa | Python | ray-project/ray | /python/ray/tune/search/bohb/bohb_search.py | UTF-8 | 13,731 | 2.609375 | 3 | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | """BOHB (Bayesian Optimization with HyperBand)"""
import copy
import logging
import math
# use cloudpickle instead of pickle to make BOHB obj
# pickleable
from ray import cloudpickle
from typing import Dict, List, Optional, Union
from ray.tune.result import DEFAULT_METRIC
from ray.tune.search.sample import (
Cat... | true |
04bf2ac55986bea800a619467034cd9a61e32141 | Python | fosua/Lab_Python_06 | /Lab06.py | UTF-8 | 3,056 | 3.421875 | 3 | [] | no_license | class Player:
def __init__(self,firstname,lastname, team= None):
self.first_name = firstname
self.last_name = lastname
self.score = []
self.team = team
def add_score(self, date, score):
self.score.append(score)
return self.score
#print self.score
def t... | true |
4c83d580d3ed5334b9afad9ab0943a1f5d1fa335 | Python | Aasthaengg/IBMdataset | /Python_codes/p02937/s449980375.py | UTF-8 | 867 | 2.8125 | 3 | [] | no_license | def main():
import sys
import copy
from bisect import bisect_right
from collections import defaultdict
input = sys.stdin.readline
s, t = input().strip(), input().strip()
lens = len(s)
index_list = defaultdict(list)
leng = defaultdict(int)
for i, ss in enumerate(s):
index_... | true |
19632b07fbb4f05c419c7f47636a8e4aa96848a8 | Python | rcasas37/PUPS | /ROV/test_uart.py | UTF-8 | 1,695 | 3.21875 | 3 | [] | no_license | # Import code modules
import time
import serial
import os
import test_uart
#def main():
# Open serial port communication
ser = serial.Serial(port='/dev/ttyS0', baudrate=9600, parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=1) # (physical ... | true |
862cba6c0ff1a1a973be4a53de4beba31595b78c | Python | tan506/wordvector | /main.py | UTF-8 | 929 | 3.109375 | 3 | [] | no_license | #First open the file location of the text document for proessing the textual schametics
#you are trying to derive morpheme embeddings using CNN'schametics
#decide on the appropriate CNN models
with open("browncorpus.txt") as model_document:
try:
while True:
latin = model_document.next().strip()
... | true |
cc24c1b611c91cc683704352bb128042497179bb | Python | tommasorea/forest_fires_cause_predictions | /src/main.py | UTF-8 | 171 | 2.671875 | 3 | [] | no_license | import pandas as pd
filepath = "../data/fires2015_train.csv"
# Read the file into a variable fifa_data
df = pd.read_csv(filepath, parse_dates=True)
print(df.head(10)) | true |
73d5c7ff2861adb81ff3effe699cf2c032d5cd96 | Python | pletzer/firstStepsInViz | /scene/coneWithLight.py | UTF-8 | 958 | 2.796875 | 3 | [] | no_license | import vtk
# create a rendering window and renderer
ren = vtk.vtkRenderer()
ren.SetBackground(0.5, 0.5, 0.5)
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.SetSize(640, 480)
# create lights
light = vtk.vtkLight()
light.SetPosition(4, 3, 2)
light.SetColor(1, 0.5, 0.3)
light.SetIntensity(0.3)
# create a... | true |
9068842e42ed47adbc77be0374f7050ab70f517b | Python | iTeam-co/pytglib | /pytglib/api/types/file_part.py | UTF-8 | 522 | 3.046875 | 3 | [
"MIT"
] | permissive |
from ..utils import Object
class FilePart(Object):
"""
Contains a part of a file
Attributes:
ID (:obj:`str`): ``FilePart``
Args:
data (:obj:`bytes`):
File bytes
Returns:
FilePart
Raises:
:class:`telegram.Error`
"""
ID = "filePart"
... | true |
724adca8ea7b9884cc7d91687f8a213b32f0623e | Python | agi1512/ConnectFourAI | /screenreader.py | UTF-8 | 5,337 | 2.765625 | 3 | [] | no_license | import win32gui, win32api, win32con, time, colorsys
from win32api import GetSystemMetrics
import ImageGrab
from connectfour import *
from minimax import *
from book import *
import threading
## TODO HANDLE WHEN TWO STRIPES ARE THE SAME COLOR
## MAKE METHOD FOR FINDING KEYS
start = [785, 135]
NUM_TABS = 20
tabs... | true |
19543e5f564d2a360d140ea427900d80d832b50e | Python | ivombi/Introduction-to-Programming | /assignment7.py | UTF-8 | 408 | 2.84375 | 3 | [] | no_license | import sys
rating = sys.argv[1:]
number_list = [1,2,3,4,5,6,7,8,9]
def catapproval(rating):
def rating_splitting(rating):
iterating_word = rating
rating_list=[]
rating_len = len(rating)
new_rating=""
for i in range(rating_len):
if i == "0" or i == str(rating_len-1):
... | true |
46f537a00838287b6a647200f1f09aa0d51e8bcd | Python | JosephMcGrath/tidyclipper | /src/tidyclipper/feed_entry.py | UTF-8 | 3,507 | 2.96875 | 3 | [
"MIT"
] | permissive | """
Tools to manage individual entries from RSS feeds.
"""
import datetime
import re
from urllib import parse
import feedparser
from bs4 import BeautifulSoup
from .templates import ENTRY
def sanitise_html(html: str) -> str:
"""
Removes a set of tags from a HTML string.
Intended to return HTML that can... | true |
2a4f9986bb02606a2946d2e746869a068a000e9f | Python | cu-swe4s-fall-2019/hash-tables-evangallagher | /hash_tables.py | UTF-8 | 3,024 | 3.03125 | 3 | [] | no_license | import hash_functions
import sys
import time
import random
class LinearProbe:
def __init__(self, N, hash_function):
"""
returns object, size, and keys from hash table
N: length of the hash array
T: array to hold the (key, value) tuples
M: number of indexes occupied by (key... | true |
581112f826749be80ac55fca91ed0457280231d9 | Python | Aasthaengg/IBMdataset | /Python_codes/p03327/s827607125.py | UTF-8 | 63 | 3.078125 | 3 | [] | no_license | N = int(input())
ans = "ABC" if N <= 999 else "ABD"
print(ans) | true |
b675edd995d0532ca10f820b01faaee8fb22cf47 | Python | ringof/pyembc | /pyembc/_pyembc.py | UTF-8 | 22,202 | 2.890625 | 3 | [
"MIT"
] | permissive | import sys
import ctypes
import struct
from enum import Enum, auto
from typing import Type, Any, Iterable, Dict, Optional, Mapping
__all__ = [
"pyembc_struct",
"pyembc_union"
]
# save the system's endianness
_SYS_ENDIANNESS_IS_LITTLE = sys.byteorder == "little"
# name for holding pyembc fields and endianness... | true |
954fe6d3523e3f7ca0a815a0770a6f1aeba61823 | Python | wangyum/Anaconda | /lib/python2.7/site-packages/networkx/generators/tests/test_degree_seq.py | UTF-8 | 5,734 | 2.75 | 3 | [
"Python-2.0",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown"
] | permissive | #!/usr/bin/env python
from nose.tools import *
import networkx
from networkx import *
from networkx.generators.degree_seq import *
from networkx.utils import uniform_sequence,powerlaw_sequence
def test_configuration_model_empty():
# empty graph has empty degree sequence
deg_seq=[]
G=configuration_model(deg... | true |
4386612ab017678dc3ef7880c2f3b2dbc7b4f2de | Python | BC-SECURITY/Empire | /empire/scripts/sync_starkiller.py | UTF-8 | 1,446 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | import logging
import subprocess
from pathlib import Path
from typing import Dict
log = logging.getLogger(__name__)
def sync_starkiller(empire_config):
"""
Syncs the starkiller directory with what is in the config.
Using dict access because this script should be able to run with minimal packages,
not... | true |
c23fdb43ac4ea21d0ecb205eca9b837296535837 | Python | sgt-nagisa/AtCoder | /ABC006D.py | UTF-8 | 337 | 3.203125 | 3 | [] | no_license | # ABC 006 D
from bisect import bisect_left
N = int(input())
A = [int(input()) for k in range(N)]
# Longest Increasing Subsequence
INF = float("inf")
L = [INF for k in range(N+2)]
L[0] = -INF
for k in range(N):
t = bisect_left(L,A[k])
L[t] = A[k]
for k in range(1,N+2):
if L[k] == INF:
print(N-k+1)... | true |
52060db05a736251f12c76a34f1c7d0c6d12fcb2 | Python | Mimik1/study | /pec/lab7/process_raw.py | UTF-8 | 1,055 | 2.625 | 3 | [] | no_license | import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
from usbtmc import UsbtmcDevice
import sys
PREAMBULE_BYTES = 11
DEVICE_PATH = sys.argv[1]
PARAMS = sys.stdin.read().splitlines()
RAW_DATA_PATH = 'data.raw'
COMMAND = 'wav:data?'
if __name__ == '__mai... | true |
25d2b9e50e85c95c6c1d1b4006cbb8f453c81786 | Python | ryanbeales/logfiledurationprocessor | /processor.py | UTF-8 | 1,560 | 2.875 | 3 | [
"MIT"
] | permissive | from collections import defaultdict, namedtuple
from glob import glob
from datetime import datetime
import re
filenames = r'*.log'
start_string = 'Start'
end_string = 'End'
uuid_pattern = r'[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
uuid_times = defaultdict()
def process_line(line):
linelis... | true |
f90b3acbfd92cc770a4dd58a33f1826141eb0e16 | Python | rustylocks79/Figgie | /agent/pricers/custom_faded_pricer.py | UTF-8 | 6,314 | 2.515625 | 3 | [
"MIT"
] | permissive | from typing import Optional
import numpy as np
from agent.modular_agent import Pricer
from figgie import Figgie, Suit
class CustomFadedPricer(Pricer):
def get_bidding_price(self, figgie: Figgie, suit: Suit, utils: np.ndarray) -> Optional[int]:
market = figgie.markets[suit.value]
return self.get_... | true |
8c15d73da8753cabe93e311099007ee4aa764313 | Python | debanjan611/Library-Management-System | /Python_prEdit.py | UTF-8 | 2,076 | 3.125 | 3 | [
"MIT"
] | permissive |
def edit():
import sqlite3
from tabulate import tabulate
con=sqlite3.connect('Library.sqlite')
cur=con.cursor()
print("\n\n********** PRINTING THE CURRENT LIBRARY DATABASE ***********\n\n")
cur.execute(" SELECT Book_Name, Author, Quantity, Book_id FROM Main ")
... | true |
8306f28381c1b9433b9273dc2101ad2acd9de478 | Python | marlboromoo/basinboa | /basinboa/d20/level.py | UTF-8 | 1,772 | 3.796875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
Level system
"""
import random
EXP_BASE = 10
EXP_STEP = 15
class Level(object):
"""docstring for Level"""
def __init__(self):
super(Level, self).__init__()
self.exp = 0
def increase(self):
"""docstring for increase"""
self.level += 1
def get(... | true |
a9891ed84a3a7d1940f5933dcb61b7105b36262a | Python | KomissarovSV/Algorithms | /Map/task1.py | UTF-8 | 2,374 | 3.6875 | 4 | [] | no_license | class Node(object):
def __init__(self,key,value):
self.key = key
self.value = value
def getKey(self):
return self.key
def getValue(self):
return self.value
class MapIterator():
def __init__(self,mas):
self.mas = mas
self.current = 0
self.size = ... | true |
fd103e8213de34dbad57ae9b84185e75be660280 | Python | AndreiKorzhun/CS50x | /pset6_Python/cash/cash.py | UTF-8 | 634 | 4.09375 | 4 | [] | no_license | from cs50 import get_float
from math import floor
def main():
# converting dollars to cents
cents = round(money() * 100)
# number of coins
number = 0
for i in [25, 10, 5, 1]:
# get the number of coins of each denomination
number += floor(cents / i)
# get the number of cen... | true |
9e6ee55e9af00bd85696f7f4ce601ff73dccb609 | Python | Rohankhadka33/practiceclass | /class(d2,p1).py | UTF-8 | 418 | 3.453125 | 3 | [] | no_license | ''' The cost of the house is $1M. If the buyer has good credit, they need to put down 10% otherwise they need to put
down 20%. print the down payment.'''
cost_of_house= 1000000
credit= True
if(credit==True):
discount=10/100
cost_of_house= cost_of_house-cost_of_house*discount
print(cost_of_house)
else:
... | true |
d6c57e2b0e9d3ae3fec291953f6e3c5dbf2a0c89 | Python | Shimpa11/PythonTutorial | /linkedlist.py | UTF-8 | 1,658 | 4.21875 | 4 | [] | no_license | """
1.Think of an object
song:title,artist,duration
"""
# 2. create its class
class Song:
def __init__(self,title,artist,duration):
self.title=title
self.artist = artist
self.duration=duration
nextSong=None
previousSong=None
def showSong(self):
print("!!!{}!!! ... | true |
866f891befdaa67b4096bdc4a6e64a8bf315d2d6 | Python | mlrequest/sklearn-json | /test/test_classification.py | UTF-8 | 7,605 | 2.734375 | 3 | [
"MIT"
] | permissive | from sklearn.datasets import make_classification
from sklearn.feature_extraction import FeatureHasher
from sklearn import svm, discriminant_analysis
from sklearn.linear_model import LogisticRegression, Perceptron
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.naive_bayes im... | true |
88d9f2f8f4f6123c571c7ce43b4a1f7c4ebde0c0 | Python | rafalacerda1530/Python | /atividades/Seção 8/Atividade 2.py | UTF-8 | 637 | 4.09375 | 4 | [] | no_license | """
Uma função que recebe a data atual (dia, mês, ano) e exiba na tela
em formato de texto
"""
meses = {1: 'Janeiro', 2: 'Fevereiro', 3: 'Março,', 4: 'Abril', 5: 'Maio',
6: 'Junho', 7: 'Julho', 8: 'Agosto', 9: 'Setembro', 10: 'Outubro',
11: 'Novembro', 12: 'Dezembro'}
def data(di, me, an):
glob... | true |
33d7b59891ebbb3da0d110b90840409b31856c5e | Python | marina90/Distributed-System-Programming-project | /vectors_pair_mapper.py | UTF-8 | 961 | 3.109375 | 3 | [] | no_license | #!/usr/bin/python
import sys
import ast
data=[]
def main():
with open ("input3.txt") as file:
for line in file:
if not line == "" and not line == '\t\n' and not line == "\n" and not line == " " :
line=line.strip()
data.append(line.split('\t'))
mapper()
de... | true |
fe546601da6402694b4ae780b766d51bd6510d70 | Python | Nordenbox/Nordenbox_Python_Fundmental | /ListenAndSpell.py | UTF-8 | 1,533 | 3.453125 | 3 | [] | no_license | """ This is a progame for practice litsen and spell for my daughter"""
import os
import random
import subprocess
file_path = (
r"//Users/nordenbox/Documents/GitHub/NordenboxPython/Nordenbox_Python_Fundmental/Speech_US"
) # read mp3 files from my file folder to ready pronunce
file_list = [] # build a empty list... | true |
4e002114ea420b2980ee9f0b815144126173c2c0 | Python | bunnymonster/personal-code-bits | /python/learningExercises/ControlFlowLoops.py | UTF-8 | 1,795 | 4.3125 | 4 | [] | no_license | #
#For Loops
#
#for loops iterate over the set of items in a given list in order.
words = ['fox','flop','number','hungry','listing']
for w in words:
print(w,len(w))
#To modify a sequence while iterating, first make a copy using slice
for w in words[:]: #loop over slice copy of entire list
if len(w) > 6:
... | true |
28331afc437a6b63c8210e46934c6658db167e54 | Python | TomAndy/python_qa | /lesson4/task2.py | UTF-8 | 345 | 2.53125 | 3 | [] | no_license |
import json
from pprint import pprint
filename='bugs.json'
new_filename='bugs_new.json'
def main():
with open(filename) as data_file:
data = json.load(data_file)
for aaa in data:
aaa['Owner']='qa5'
with open(new_filename,'w') as new_f:
new_f.write(json.dumps(data))
if __name__ ... | true |