blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
8440a8b0bd5242420c471d1bf70c4d2189e44f32 | niuyaning/PythonProctice | /06/07/python_init.py | UTF-8 | 746 | 3.828125 | 4 | [] | no_license | '''
python 子类继承父类构造函数说明
情况1:子类需要自动调用父类的方法:子类不重写__init__()方法,实例化子类后,会自动调用父类的__init()的方法
情况2:子类不需要自动调用父类的方法:子类重写__init__()方法,实例化子类后,将不会自动调用父类的__init__()的方法
情况3:子类重写__init__()方法又需要调用父类的方法
'''
class Father():
def __init__(self,name):
self.name = name
print("name %s" % (self.name))
def getName(self)... | true |
ca3fc432aa67691f5ea776447e0d2aefd44c4471 | muktabhave/Python | /NumPy/TransposeAndFlatten.py | UTF-8 | 362 | 3.703125 | 4 | [] | no_license | # https://www.hackerrank.com/challenges/np-transpose-and-flatten/problem
# Sample Input
# 2 2
# 1 2
# 3 4
# Sample Output
# [[1 3]
# [2 4]]
# [1 2 3 4]
import numpy
n , m = input().split();
a = [];
for i in range(int(n)):
my_array = input().split();
a.append(my_array);
lis1 = numpy.array(a,int);
print(nump... | true |
d8f8370492de7b504eca18892fb3ef3113865f08 | limazix/cps863-machine-learning | /tests/test_chart_tools.py | UTF-8 | 1,801 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | # -*- utf-8 -*-
from base64 import b64encode
import plotly.express as px
import numpy as np
from unittest import TestCase
from unittest.mock import patch
from tools.chart_tools import ChartTools
class TestChartTools(TestCase):
def setUp(self):
self.tool = ChartTools()
self.figure = self.build_f... | true |
f0cdfc8aeea6e67e8df2bb82fd8071d25ba25251 | scnkmr/selenium_whatsapp_automation | /sel2.py | UTF-8 | 958 | 3 | 3 | [] | no_license | from tkinter import *
from tkinter import filedialog
import csv
window=Tk()
window.title("Whatsapp NO list and message")
#select no button
def noCsv():
nname= filedialog.askopenfilename(title="SELECT CSV FILE OF PHONE NUMBER")
with open(nname, 'r') as f:
reader = csv.reader(f)
n_list = list(r... | true |
450df53f883b1bc9e00a6e18a0974e86cb88161b | jorgediazjr/dials-dev20191018 | /modules/xia2/Decorators/DecoratorFactory.py | UTF-8 | 1,052 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | # Copyright (C) 2006 CCLRC, Graeme Winter
#
# This code is distributed under the BSD license, a copy of which is
# included in the root directory of this package.
#
# 31st May 2006
#
# A factory to provide access to the decorator classes. So far this is
#
# "ccp4" -> A CCP4 Decorator
#
from __future__ import abs... | true |
d2ff7338d139e4bf966921f3b571c5f99ea83d71 | treewojima/sudoku_solver | /solver/subgroups/subcolumn.py | UTF-8 | 399 | 2.90625 | 3 | [] | no_license | from .subgroup import SubGroup
class SubColumn(SubGroup):
def get_cells(self):
return [self.box.get_cell(self.index, row) for row in range(0, 3)]
def get_column(self):
return self[0].get_column()
def __str__(self):
s = "SubColumn<Box<" + str(self.box.boxcol) + "," + str(self.box.b... | true |
37bdd559466351724d0c765f559b3754219f55b1 | SaiChandraCh/leetcode-py | /src/122.py | UTF-8 | 485 | 3.40625 | 3 | [] | no_license | class Solution(object):
def maxProfit(self, prices):
buy = 0
sell = 1
profit = 0
length = len(prices)
while sell < length:
if(prices[sell]>prices[buy]):
profit += prices[sell]-prices[buy]
buy = sell
else:
... | true |
c6d4e62a6f7e989d4d755913109c559ebe8703f3 | EliakinCosta/python_sessao_da_tarde | /code/exemplo_classe.py | UTF-8 | 543 | 3.609375 | 4 | [] | no_license | class Carro(object):
def __init__(self, marca, cor, velocidade=0):
self._marca = marca
self._cor = cor
self._velocidade = velocidade
@property
def marca(self):
""" Proprieda somente para leitura """
return self._marca
@property
def cor(self):
return self._cor
@cor.se... | true |
f8041ace31e7096e34a5edcb2db21a3dc00773b8 | xczhang07/leetcode | /python/easy/minimum_index_sum_of_two_lists.py | UTF-8 | 735 | 2.84375 | 3 | [] | no_license | class Solution(object):
def findRestaurant(self, list1, list2):
"""
:type list1: List[str]
:type list2: List[str]
:rtype: List[str]
"""
d1 = dict()
least_idx_sum = sys.maxint
idx = 0
ret = list()
for idx in range(0, len(list2)):
... | true |
7a06eec0e8b0b17128bb32817c076d2817654dc8 | deeuu/supriya | /supriya/ugens/CoinGate.py | UTF-8 | 669 | 2.734375 | 3 | [
"MIT"
] | permissive | import collections
from supriya import CalculationRate
from supriya.synthdefs import UGen
class CoinGate(UGen):
"""
A probabilistic trigger gate.
::
>>> trigger = supriya.ugens.Impulse.ar()
>>> coin_gate = supriya.ugens.CoinGate.ar(
... probability=0.5,
... trigg... | true |
71723166520784e1f47aa2f30877c10adc6ebdf4 | sunny-aguilar/python-email | /email.py | UTF-8 | 552 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
#
# S
# s
# s
#
# Author: Sandro Aguilar
# Date: April 20, 2020
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
import os
import smtplib
from email.message import EmailMessage
sender = "sender@yahoo.com"
recipient = "receiver@yahoo.com"
messag... | true |
5ae413ebdb018daab8e59ee5270089b82770de19 | wikimedia/operations-dumps | /xmldumps-backup/dumps/recompressjobs.py | UTF-8 | 31,200 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python3
'''
All dump jobs that recompress the output
from other dump jobs are defined here
'''
from os.path import exists
import os
from dumps.exceptions import BackupError
from dumps.fileutils import DumpFilename
from dumps.jobs import Dump, ProgressCallback
from dumps.outfilelister import OutputFileLister... | true |
9f749e2a73e1263bf23dd2ada884f21f7cb6e967 | ryeLearnMore/LeetCode | /047_permutations-ii.py | UTF-8 | 832 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#@author: rye
#@time: 2019/3/15
'''
跟第46题一样,就是最后append的时候不一样,只有没有结果里面没有的才加入
'''
class Solution(object):
def permuteUnique(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
if len(nums) == 0:
... | true |
ce156cf67b3f10ccca6d939e0b7737747ec90b31 | singegow/PythonBasics | /parse.py | UTF-8 | 1,294 | 3.5625 | 4 | [] | no_license | import json
#
data = {"name" : "anitha"}
with open("data_file.json", "w") as write_file:
json.dump(data, write_file)
#
# json_string = json.dumps(data)
# print(type(json_string))
#
# # read a json variable inside a file and dump into a file or just assign to a string
#
# # Note that dump() takes two positional arg... | true |
f860db5111eb1da787803088f2b609a18f1f7003 | brondsem/mongo-oplogreplay | /oplogreplay/test/test_oplogreplayer.py | UTF-8 | 7,945 | 2.75 | 3 | [
"MIT"
] | permissive | import unittest2 as unittest
import pymongo
import time
import random
import threading
from oplogreplay import OplogReplayer
SOURCE_HOST = '127.0.0.1:27017'
DEST_HOST = '127.0.0.1:27018'
TESTDB = 'testdb'
# Inherit from OplogReplayer to count number of processed_op methodcalls.
class CountingOplogReplayer(OplogRepl... | true |
d99fb797651b61b2cf7cc2d760a0ac8433682a87 | Insookim0702/python_Algorithm | /책/문제/모험가길드3.py | UTF-8 | 223 | 3.265625 | 3 | [] | no_license | n = int(input())
arr = list(map(int, input().split()))
arr.sort()
group_count = 0;
result = 0;
for i in range(n):
group_count += 1
if group_count == arr[i]:
group_count = 0
result += 1
print(result)
| true |
45265fc46755f29af92564efa7c11970b92d62da | adafruit/circuitpython | /tests/basics/closure_defargs.py | UTF-8 | 154 | 3.46875 | 3 | [
"MIT",
"GPL-1.0-or-later"
] | permissive | # test closure with default args
def f():
a = 1
def bar(b = 10, c = 20):
print(a + b + c)
bar()
bar(2)
bar(2, 3)
print(f())
| true |
62e2ee8d06020d9ba375db16b75186c3ed33bc4e | vishalghor/Text_Classification | /Data_clean_and_Visualize/Clean_visualize.py | UTF-8 | 1,913 | 3.140625 | 3 | [] | no_license | import pandas as pd
import nltk
nltk.download('stopwords')
import re
import string
pd.set_option('display.max_colwidth', 150)
fullCorpus = pd.read_csv(r'C:\\Sheet_2.csv',usecols=['resume_id','class','resume_text' ],encoding='latin-1')
fullCorpus.columns = ['','label', 'body_text']
print(fullCorpus.head())
print(fullCo... | true |
2f3f46bacbff9ea5891d81569ef4c071f044412e | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_200/776.py | UTF-8 | 1,502 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python3
def main():
testcases = int(input())
for i in range(testcases):
upper_bound = int(input())
tidy_result = find_tidy_number_below(upper_bound)
print_case(i, tidy_result)
def print_case(case_zero_based, result):
string = 'Case #' + str(case_zero_based + 1) + ': '... | true |
48b0f97bc1831f58c5e062612d874d15616fe9d1 | HuanjunWang/Hackathon | /delay_data_analysis.py | UTF-8 | 263 | 2.71875 | 3 | [] | no_license | import pickle
import numpy as np
from matplotlib import pyplot as plt
with open('delay.txt', 'rb') as fp:
data = pickle.load(fp)
plt.bar(data[:100000])
# fixed bin size
i = 0
while i < 500000:
plt.plot(data[i:i+500], 'b')
i += 1000
plt.show()
| true |
c3f634f443493a789cb22ac9da447b695740169c | shreyagupta30/vineperf | /tools/pkt_gen/dummy/dummy.py | UTF-8 | 10,785 | 2.765625 | 3 | [
"CC-BY-4.0",
"Apache-2.0"
] | permissive | # Copyright 2015-2017 Intel Corporation.
#
# 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... | true |
720c4f6647461a759815e5f272b03820a06411ac | qintangtao/python.script | /qin3/rsa.py | UTF-8 | 1,562 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from Crypto.Cipher import PKCS1_v1_5 as Cipher_pkcs1_v1_5
from Crypto.PublicKey import RSA
from Crypto.Hash import SHA
from Crypto import Random
from Crypto.Util.number import ceil_div
import Crypto.Util.number
import base64
def __get_max_length(key, encrypt=True):
modBits... | true |
c453a87016e680671b0b7059746882499508081d | jjshoots/AntiAway | /AntiAway_Class.py | UTF-8 | 1,243 | 2.828125 | 3 | [] | no_license | import pyautogui
from pynput import keyboard
from pynput import mouse
import random
import time
class AntiAway_Class:
def __init__(self):
self.size_x, self.size_y = pyautogui.size()
self.size_x *= 0.5
self.size_y *= 0.5
self.time_since_idle = time.time()
self.start_listener... | true |
44e8ce285a9301a5f876af4e751a5b9063dacba6 | irvingliao/CarND-Advanced-Lane-Lines | /Code/Warp.py | UTF-8 | 1,265 | 2.8125 | 3 | [
"MIT"
] | permissive | import numpy as np
import cv2
import glob
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import re
# Warp image by using Perspective Transform
def warper(img, src, dst):
# Compute and apply perpective transform
img_size = (img.shape[1], img.shape[0])
M = cv2.getPerspectiveTransform(src, ... | true |
77ac6f687a316bac8e2d58da57ac6285162aa10a | CatsAreFluffy/Charcoal | /astprocessor.py | UTF-8 | 12,065 | 2.6875 | 3 | [
"MIT"
] | permissive | from charcoaltoken import CharcoalToken
from unicodegrammars import UnicodeGrammars
def PassThrough(result):
return result
ASTProcessor = {
CharcoalToken.Arrow: [
lambda result: result[0] + ": Left",
lambda result: result[0] + ": Up",
lambda result: result[0] + ": Right",
lamb... | true |
c3e5a884b7d69c8fa3d77ab6d0fff21ede6055da | RinatStar420/programming_training | /lesson/class_name.py | UTF-8 | 330 | 3.96875 | 4 | [] | no_license | #добавим параметр name в метод инициализации
#Создадим объект класса Person, передав строку для параметра name
class Person():
def __init__(self, name):
self.name = name
hunter = Person('Elmer Fudd')
print('The mighty hunter: ', hunter.name) | true |
efa55ece22ecb753054e86692042856096f20c1d | dmitriyanishchenko/Teach_My_Skills_Python_base | /src/Home-_and_classworks/Work_7_and_8[functions]/cw_8_task_8_6.py | UTF-8 | 788 | 4.21875 | 4 | [] | no_license | # Дан массив целых чисел A. Найти суммы положительных и отрицательных элементов массива,
# используя функцию определения суммы
from random import randint
def summ_elem(*args):
summ = sum(args)
return summ
row = []
for i in range(1, 10):
elem = int(randint(-9, 9))
row.append(elem)
print(f'Massive A... | true |
2eaa6c63cd431ddb5ae9a1535d5f470b22145217 | Ticonderoga/CoursInfoL2 | /Vecteurs.py | UTF-8 | 1,731 | 3.625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 15 15:06:50 2020
@author: phil
"""
class Vector(object):
"""
Documentation de vecteur
"""
def __init__(self,u=0,v=0):
self.__x = u
self.__y = v
def getx(self):
return self.__x
def gety(self):
... | true |
8bc23e9575241e7092edd2adb4ac6e8f43b9df64 | jasonncleveland/cs2613 | /final/q3/test_ages.py | UTF-8 | 1,319 | 3.953125 | 4 | [] | no_license | from ages import Ages
def test_simple():
"""Simplest matching case"""
assert list(Ages("Bob is 123")) == [("Bob", 123)]
def test_capital():
"""Names must be capitalized"""
assert list(Ages("bob is 123")) == []
def test_multiple():
"""Multiple matches"""
iter_ = Ages("Bob is 42, Mary is 43")
... | true |
1fea3cebe3fe272e845c8e0a51c362e8681cc662 | expandaventures/raw_tiles | /raw_tiles/util.py | UTF-8 | 557 | 2.578125 | 3 | [] | no_license | MERCATOR_WORLD_SIZE = 40075016.68
def bbox_for_tile(z, x, y):
max_coord = float(1 << z)
return (
((x / max_coord) - 0.5) * MERCATOR_WORLD_SIZE,
(0.5 - ((y + 1) / max_coord)) * MERCATOR_WORLD_SIZE,
(((x + 1) / max_coord) - 0.5) * MERCATOR_WORLD_SIZE,
(0.5 - (y / max_coord)) * ME... | true |
af55dc536551109865255413add60eb35762f87a | HsiehYuho/Courses | /Coursera/DSfromUCSD/Week2/HW/Starters PA2/make_heap/build_heap.py | UTF-8 | 2,355 | 3.5625 | 4 | [] | no_license | # python3
class HeapBuilder:
def __init__(self):
self._swaps = []
self._data = []
def ReadData(self):
n = int(input())
self._data = [int(s) for s in input().split()]
assert n == len(self._data)
def WriteResponse(self):
print(len(self._swaps))
for swap in self._swaps:
... | true |
e42af591685f9719ae9a7767c3544e4a4b71b6ce | Zahidsqldba07/coding-problems-2 | /dynamic-programming/Andrey-Grehov/0019_coin_change_even.py | UTF-8 | 1,556 | 3.921875 | 4 | [] | no_license | import unittest
'''
Problem: Coin change
Given an unlimited supply of coins of given denominations,
find the total number of ways to make a change of size n, by
using an even number of coins.
# 1, 3, 5, 10
# 0 -> odd, 1 -> even
f[i][0] = f[i-1][1] + f[i-3][1] + f[i-5][1] + f[i-10][1]
f[i][1] = f[i-1][0] + f... | true |
48132dff634c459a2badb54be95973827d54f719 | iTakeshi/ecell4 | /reaction_reader/tests/test_species.py | UTF-8 | 2,938 | 3.015625 | 3 | [] | no_license | import unittest
import species
from decorator2 import create_species
class SpeciesTestCase(unittest.TestCase):
def setUp(self):
pass
def test_creation(self):
sp1 = species.Species()
su1 = species.Subunit("A")
su1.add_modification("l", binding=1)
su1.add_modification(... | true |
3ea2765fd7d739dda2c7f3fcceb5b307cbe6db33 | ariqrafikusumah/Tugas | /Chapter 2/D4 TI C/Alvian Daniel Sinaga(1184077)/src/2err.py | UTF-8 | 139 | 2.859375 | 3 | [
"MIT"
] | permissive | try:
string = "1"
integer = 3
hasil = string + integer
except:
print("Kondisi diatas Tidak dapat dioprasikan dengan benar Laeee....") | true |
7ad28b47a64184b1b544261474a764225ff16db0 | alicesilva/P1-Python-Problemas | /imprime1_n.py | UTF-8 | 158 | 3.25 | 3 | [] | no_license | #coding: utf-8
def imprime1(n):
indices = []
for i in range(n):
i += 1
for j in range(1,i+1):
print j,
print
n = int(raw_input())
imprime1(n)
| true |
8f43a2c973a87a42c874b03f52bfa50c65ca6dc4 | kzky/works | /st_rnn/st_rnn/models.py | UTF-8 | 11,550 | 2.796875 | 3 | [] | no_license | """Models
"""
import numpy as np
import chainer
import chainer.variable as variable
from chainer.functions.activation import lstm
from chainer import cuda, Function, gradient_check, report, training, utils, Variable
from chainer import datasets, iterators, optimizers, serializers
from chainer import Link, Chain, ChainL... | true |
0ca8689683279bb83fe326756cdfee1852e77bc0 | 448Watanabe/python_random_test | /forTest.py | UTF-8 | 172 | 3.625 | 4 | [] | no_license | word = ["av","cs","ef", "gh"]
# word内の3つまでをプリントする
for i in range(3):
print word[i]
# word内の全てをプリントする
for w in word:
print w | true |
b86e0bcd321eed38b6441e69007a383e9d9be995 | bradleygolden/gmail-image-extractor | /app/objects/extractor.py | UTF-8 | 21,409 | 2.515625 | 3 | [
"MIT"
] | permissive | import os
import config
import PIL
from PIL import Image
import StringIO
from hashlib import sha256
import hmac
import base64
import pygmail.errors
from pygmail.account import Account
import zipfile
import time
import tornado
from app.objects.image import Image
import app.objects.image
import re
import math
import uuid... | true |
67477f339239be049a6aec0f435159166d6eca83 | den4uk/andriller | /tests/test_config.py | UTF-8 | 1,372 | 2.515625 | 3 | [
"MIT"
] | permissive | import os
import json
import time
import shutil
import pytest
import tempfile
import requests
from unittest import mock
from andriller import config
from andriller import __version__
@pytest.fixture
def conf():
os.environ['HOME'] = tempfile.mkdtemp()
yield config.Config()
shutil.rmtree(os.environ['HOME'])... | true |
ab29c097749faa8c9abbb8fd9a8f868df8f39581 | MilindPurswani/lvrt-deb-pkg | /exploit.py | UTF-8 | 1,545 | 2.515625 | 3 | [
"MIT"
] | permissive | import requests
import argparse
import time
'''
This exploit leverages the fact that the service NiSysServer.py, running on port number 3580 is open to internet. There is no form of basic authentication implemened on this service which is exposing the endpoint /rtexecsvc/RebootEx
Once an attacker knows that the servic... | true |
4622880a6d63fdfce8451569f6b3d4eb2adc838e | priyapriyam/E-Commerce_Turing_Project | /routes/trial_questions.py | UTF-8 | 645 | 2.84375 | 3 | [] | no_license | # number=input("Enter the number")
# # print number
# s=0
# if number > 5 or number < 2:
# print number ,"ye number 10 se chhota aur 5 se bda hai"
# else:
# print "wrong"
# print (not true)
# app.get('/products/locations/:product_id',(req,res)=>{
# product_id=req.params.product_id
# ... | true |
ea9b5701b90758bbefc30d6b47f3a4996f91e51f | JiuyangF/DSPProject | /tools/telnet.py | UTF-8 | 1,003 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import telnetlib
import time
'''Telnet远程登录:Windows客户端连接Linux服务器'''
# 配置选项
Host = '172.31.33.69' # Telnet服务器IP
username = 'jiuyang' # 登录用户名
password = 'syswin#123' # 登录密码
finish = b'$ ' # 命令提示符(标识着上一条命令已执行完毕)
# 连接Telnet服务器
tn = telnetlib.Telnet(Host)
# tn.write('\n'.encode())
print("teln... | true |
ed22a67913bea89c47aaadfa953f77dcd17994ff | EmilMachine/ml_club | /10_data_web_apps/DashApp/prophet_app.py | UTF-8 | 6,033 | 2.609375 | 3 | [
"MIT"
] | permissive | import dash
import dash_html_components as html
import dash_core_components as dcc
import plotly.graph_objects as go
import pandas as pd
from dash.dependencies import Input, Output
from fbprophet import Prophet
from datetime import datetime, timedelta
# gobals
step_num = 100
# Load data
df = pd.read_csv('data/stockd... | true |
c01e6bc61bace6c1028b42eb4ac118c7c190117d | shengng325/LeetCode.py | /smallestSubstringWithPattern.py | UTF-8 | 1,096 | 3.328125 | 3 | [] | no_license | def smallestSubstringWithPattern(string, pattern):
patternChars = {}
for char in pattern:
if char not in patternChars:
patternChars[char] = 0
patternChars[char]+=1
left = 0
matched = 0
minLength = len(string) + 1
for right in range( len(string) ):
rightChar =... | true |
f3fd696899a71e15b13674119bf39b3af9c3c86c | Onkeliroh/RaspberryPi-Scripts | /tests/lampe/lampe.py | UTF-8 | 406 | 3.34375 | 3 | [] | no_license | #dieses Programm testet nur die GPIO Funktionen mit Hilfe einer Lampe
import RPi.GPIO as gpio
import time
#set up pin 14 and 15 as output
gpio.setmode(gpio.BCM)
gpio.setup(15, gpio.OUT)
gpio.setup(14, gpio.OUT)
#Make an LED flash on and off forever
while True:
gpio.output(15, gpio.HIGH)
gpio.output(14, gpio.LOW)
... | true |
886d191eadbfb2997bf12a31d226ad94706929b5 | lming24/nlu-p1 | /datasets.py | UTF-8 | 4,473 | 2.65625 | 3 | [] | no_license | import preprocessing as prep
import constants as con
import pickle
from pathlib import Path
my_file = Path("dataset.pkl")
test_file = Path("test.pkl")
sentence_continuation_file = Path("sentencecontinuation.pkl")
class NLUProject1Dataset(object):
def __init__(self):
if my_file.is_file():
pri... | true |
98384603d3d6630d5a1d71500e41a9bbe45a619c | Ads99/python_learning | /MITx-6.00.1x/ProblemSet2/ps2.py | UTF-8 | 3,116 | 4.25 | 4 | [] | no_license | # Problem 1
# Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly payment
# required by the credit card company each month. The following variables contain values as described below:
# balance - the outstanding balance on the credit card
# annualInterestRate... | true |
84ad9e68655a19d90f14143d2b30a9bc6bc2785c | timclarkGE/TIMC-PIPING | /Development/Serialtest2.py | UTF-8 | 5,952 | 3.484375 | 3 | [] | no_license | """
Simple program to send commands to Aerotech to see how the queue is used
"""
from tkinter import *
import serial
import threading
import time
import queue
class Comm:
def __init__(self, baud):
self.port_open = 0
self.baud = baud
self.s = serial.Serial()
# Open the serial port
... | true |
9befac00ca276536f1cbf9c050ecf0904e0e9b2e | gpcarlos/zotero-reMarkable-sync | /utils/remarkable.py | UTF-8 | 7,870 | 2.59375 | 3 | [
"MIT"
] | permissive | import os
import sys
from colorama import Fore, Style
from rmapy.api import Client
from rmapy.exceptions import AuthError
from rmapy.folder import Folder
from rmapy.document import ZipDocument
from utils.common import File
class ReMarkable():
def __init__(self, local_dir, reMarkable_dir):
"""
Ini... | true |
e9826b7e963e1dfa23af7c086ebd6e9654bd3a95 | ewized/cis-python | /control/squares.py | UTF-8 | 623 | 4.25 | 4 | [] | no_license | '''
name: Joshua Rodriguez
email: ewized@gmail.com
file: squares.py
problem: chapter 2 number 22 page 149
description: Create a program that prompts for a positive number greater than 2
(check if the input is greater than 2) and then keeps taking the square root of that
number until the square root is less tha... | true |
84661117646876d5431afc25478a3bab54249bb8 | tjggnut/nlp | /reg.py | UTF-8 | 2,214 | 3.46875 | 3 | [] | no_license | import re
s = "网络爬虫(又被称为网页蜘蛛,网络机器人,在FOAF社区中间,更经常的称为网页追逐者),是一种按照一定的规则,自动地抓取万维网信息的程序或者脚本。另外一些不常使用的名字还有蚂蚁、自动索引、模拟程序或者蠕虫。"
s2 = "文本最重要的来源无疑是网络。我们要把网络中的文本获取形成一个文本数据库。利用一个爬虫抓取到网络中有用的信息。爬去的策略有广度爬取和深度爬取。根据用户的需求,爬虫可以有主题爬虫和通用爬虫之分。"
regex = "爬虫"
ss = s.split('。')
for string in ss:
if re.search(regex,string) is not None:
... | true |
50dd628679c9c06afc420cbf0f4e987e76b0807f | jason-guanqun/ComputerNetworkProjects | /project2/step34/jtraceroute | UTF-8 | 1,380 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python
import socket
import json
import argparse
import time
import threading
UDP_IP = "127.0.0.1"
# UDP_PORT = 5005
parser = argparse.ArgumentParser(description='UDP receiver')
parser.add_argument('-p', dest='rec_port_num', action='store', default=5001, type=int)
args, unknownargs = parser.parse_known_args... | true |
832b7fc3b97aaa84bb9e8189bd3322a11ed11799 | AErenzo/Python_course_programs | /displayInfo.py | UTF-8 | 264 | 4.15625 | 4 | [] | no_license | def userInfoDisplay():
name = input('What is your name? ')
age = input('How old are you? ')
gender = input('What is your gender? ')
print('Name: ', name, '\n'
'age: ', age, '\n'
'Gender: ', gender)
userInfoDisplay()
| true |
19b8b722449a5e956f80b3622235d5da55427194 | pauldechorgnat/master_thesis | /viz.py | UTF-8 | 3,101 | 3.0625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def plot_hyperboloid_model_2d():
x = np.linspace(start=1, stop=2, num=1000)
y1 = np.sqrt(np.power(x, 2)-1)
y2 = -np.sqrt(np.power(x, 2)-1)
plt.figure(figsize=(8, 8))
plt.plot(y1, x, color='b')
plt.plot(y2, x, color='b')
first_level = [np.... | true |
13a5d996007a285752427d9d9041924395ea4355 | psadaic/py-ts3 | /ts3/_lib.py | UTF-8 | 4,976 | 3.015625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# The MIT License (MIT)
#
# Copyright (c) 2013-2015 Benedikt Schmitt <benedikt@benediktschmitt.de>
#
# 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 restrict... | true |
ac6881efff6503e99651a61cd017cdd467e841d3 | mrfox321/leetcode | /leetcode/p131.py | UTF-8 | 1,154 | 3.765625 | 4 | [] | no_license | def isPalindrome(string):
center = len(string)//2
if len(string) == 1:
return True
if len(string)%2 == 1: #odd:
if string[:center] == string[-1:center:-1]:
return True
else: #even
string[:center],string[center:]
if string[:center] == string[-1:center-1:-1]:
... | true |
685d2871d9cd8ea4550276b7baf24d5240d08cf2 | thaisnat/LP1 | /TST/unidade4/criacao_nova_palavra/novaa_palavra.py | UTF-8 | 318 | 3.390625 | 3 | [] | no_license | # coding: utf-8
# Unidade 4 - Criação de uma Nova Palavra
# Thaís Nicoly - UFCG 2015.2 - 11/03/2016
palavra_fonte = raw_input()
numero_apoio = raw_input()
n = len(palavra_fonte)
nova_palavra = ''
for i in range(n):
nova_palavra += (int(numero_apoio[n -i -1]))*(palavra_fonte[i]) + palavra_fonte[i]
print nova_palavr... | true |
67ac2259f7e5f3c5a381a8d2a3704472535711fa | SongbiaoZhu/python_spider | /bioinformatics_API/STRING/stringApiNetwork.py | UTF-8 | 1,355 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 5 17:55:38 2019
@author: samsung
"""
#!/usr/bin/env python
################################################################
## For a given list of proteins single out only the interactions
## which have experimental evidences and print out their score
#################... | true |
f0c1858825b0bc5a2f279aad4d865ae096fd5a92 | TsubasaKiyomi/function-section | / section3/string-slice-index.py | UTF-8 | 311 | 4.0625 | 4 | [] | no_license | word = "hello world"
print(word[2])
print(word[6])
def greeting(a, b, c):
s = a + b + c
return s
num = greeting("おはようございます", '\nこんにちは', '\nこんばんわ')
print(len(num))
print(num[0:9])
print(num[10:15])
print(num[16:])
num = 'good', 'morning ' + num[16:]
print(num)
| true |
212e03f43c8de4283b8b20d4a782facb3ef6cdc2 | friendoye/Masters-Algo-Course | /Python/Lab2/merge_sort.py | UTF-8 | 906 | 3.640625 | 4 | [] | no_license |
def sort(objects):
if len(objects) == 1:
return objects
else:
mid = len(objects) / 2
left_part = sort(objects[:mid])
right_part = sort(objects[mid:])
l_index = 0
r_index = 0
buffer = objects[mid:mid]
while l_index < len(left_part) and r_index < ... | true |
abf19270cad5e8a499973bba416d61671c0a15ad | JujuDel/SmoothGradCAMplusplus | /cam.py | UTF-8 | 14,840 | 2.796875 | 3 | [] | no_license | import torch
import torch.nn.functional as F
from statistics import mode, mean
class SaveValues():
def __init__(self, m, verbose=False):
# register a hook to save values of activations and gradients
self.activations = None
self.gradients = None
if verbose:
print('Regis... | true |
1dda5898f92520487b2e732db992b798ad56bdc9 | levinhkhangdeptrai/aaai21-copy-that | /data/nlrepresentationviz.py | UTF-8 | 2,061 | 2.546875 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | import json
import os
from typing import List, Callable, TypeVar, Generic, Optional
import numpy as np
from annoy import AnnoyIndex
from sklearn.manifold import TSNE
from data.representationviz import RepresentationsVisualizer
T = TypeVar('T')
class NLRepresentationsVisualizer(RepresentationsVisualizer):
def __i... | true |
46b0e75ca998e8a09f2e7cbcacfbfb1aedafb2c9 | itsvinayak/scripts | /audio_news/main.py | UTF-8 | 1,044 | 2.953125 | 3 | [] | no_license | import pyttsx3
import requests
import json
import time
url = ('https://newsapi.org/v2/top-headlines?'
'country=in&'
'apiKey=7c43977c018a4fab95f8e7ab3aa7e710')
engine = pyttsx3.init()
rate = engine.getProperty('rate')
engine.setProperty('rate', rate+10)
volume = engine.getProperty('volume')
engine.setPro... | true |
b18b6fc95a1c723b5992c8840b96b1e1d3449af5 | kalvatn/dotfiles | /bin/lastfm | UTF-8 | 576 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python3
from urllib.request import urlopen
import json
def main():
json_data_url = urlopen("http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=chauney&api_key=dea841e75b7c112bb48959f7c1738f80&limit=1&extended=0&format=json")
data = json_data_url.read().decode("utf-8")
json_da... | true |
cb9dc09d1dbcf57117fd99ddbb487ddf238d25a5 | TechnionYP5779/SimuMole | /src/SimuMole/SimuMoleScripts/uploaded_simulation.py | UTF-8 | 1,752 | 2.546875 | 3 | [] | no_license | import pymol2
from .simulation_main_script import create_movies_from_different_angles
from .basicTrajectoryBuilder import update_simulation_status
from time import sleep
temp = 'media/files/' # path to temp folder
def pdb_and_dcd_match(pdb_file_name, dcd_file_name, user_rand):
# pymol.finish_launching(['pymol',... | true |
9a7b65791dd98c4cf419bb7a72b2c5fa2a615576 | utepsilon/Competitive_Programming | /Solved Problems and Codes/Easy sum set.py | UTF-8 | 1,550 | 3.59375 | 4 | [] | no_license | n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
c = [int(x) for x in input().split()]
b = []
for i in range(len(a)):
b.append([])
for j in range(len(c)):
b[i].append(c[j]-a[i])
k = set()
if len(b)>1:
p = set(b[0])
q = set(b[1])
k = p.intersection(q)
fo... | true |
9713a3f1bb0099a9c93b43128f7c0f1ff87faea3 | jasonb5/pyneat | /pyneat/genotype/gene.py | UTF-8 | 504 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | class Gene(object):
"""Representation of a link in a genome.
Describes a link in a genome between two neurons. The link can be
enabled and disabled.
Args:
inode: in node index
onode: out node index
weight: weight of link
innov: innovation id of the link
"""
def... | true |
0d14cee7fa27642bf7d03f47106a7b719c47d2a1 | Sveder/bdlr | /bdlr/flowers/spritesheet_lib.py | UTF-8 | 2,721 | 2.703125 | 3 | [
"MIT"
] | permissive | import os
from PIL import Image
from django.conf import settings
CSS_TEMPLATE = """
body:after{
display:none;
content: url(/static/spritesheet/%s);
}
.sprite-sheet-%s {
background: url("/static/spritesheet/%s"), no-repeat;
display: block;
}
"""
CSS_SS_ITEM_TEMPLATE = """.sprite-%s {
width: %spx... | true |
c177ae23982157174be19ab7d5ed213eb021ddf8 | MarcosPTProenca/Coursera-exercises | /src/remove_repetidos.py | UTF-8 | 377 | 3.28125 | 3 | [] | no_license | def remove_repetidos(lista):
lista.sort()
count = 0
for i in lista:
for j in lista:
if i == j:
count += 1
if count > 1:
for k in range(count-1):
del lista[lista.index(i)]
count = 0
return sorted(lista... | true |
e191921f9bd1be233b643c322aa9c57279f19e5c | drijks/Fractal-Maker | /fractals3d.py | UTF-8 | 11,269 | 3.125 | 3 | [] | no_license | import pygame
import math
import random
import colors
#pygame.init()
#purples = [colors.lavender, colors.thistle, colors.plum, colors.orchid, colors.violet, colors.fuchsia, colors.magenta, colors.mediumorchid, colors.darkorchid, colors.darkviolet, colors.blueviolet, colors.darkmagenta, colors.purple, colors.medi... | true |
b9ac01254d0a992c9d1ef8eb71acdba6ec6e541e | yuliia43/MS | /lab7/PetriElements.py | UTF-8 | 9,687 | 2.96875 | 3 | [] | no_license | import numpy as np
class Place:
place_id = 1
min_markers = 100000000000000000000
max_markers = 0
avg_markers = 0
changes_count = 0
def __init__(self, markers=0, name=None):
self.__markers = markers
self.min_markers = 100000000000000000000
self.max_markers = 0
s... | true |
50419d87b811320fca23bf441125a8804c85da58 | razyesh/razyesh.github.io | /iw/python-assignment-ques/functions_ex/q13.py | UTF-8 | 342 | 3.75 | 4 | [] | no_license | """
13. Write a Python program to sort a list of tuples using Lambda.
"""
from utils import get_random_list
"""
lambda function to sort tuple
"""
sort_tuple = lambda sample_tuple : sorted(sample_tuple)
if __name__ == "__main__":
sample_tuple = tuple(get_random_list())
result = sort_tuple(sample_tuple)
... | true |
0592c9d98894fdc62ac2317a4ffaf5d4239accae | jsculsp/tango_with_django_project | /tango_with_django_project/utils/log.py | UTF-8 | 638 | 2.703125 | 3 | [] | no_license | import time
from pprint import pprint
def log(*args, **kwargs):
f = '%Y/%m%d %H:%M:%S'
value = time.localtime(int(time.time()))
dt = time.strftime(f, value)
with open('log.txt', 'a') as f:
print('============================================', file=f)
print(dt, *args, file=f, **kwargs)
... | true |
23dd201da64011165f86f803d320a672361dacf3 | gonzaemon111/aiacademy-repo | /2_num.py | UTF-8 | 430 | 4.125 | 4 | [] | no_license | # coding: UTF-8
print(10) # 数値はクォーテーションで囲む必要はありません。
print(10 + 5) # 足している
print(5 - 2) # 引いている
print(10 / 2) # 割っている
print(10 % 5) # あまりを求めている
# 優先順位の変更
# 通常は +と-よりも*や/の方が優先度が高いですが、()で囲むことで優先度を変えることができます。
print((20 - 5) // 3) # 5 | true |
571fad97cf2b38b1add34b8deb52944591bcf08b | Oneplus/pyspf | /spf/utils/lisp_reader.py | UTF-8 | 1,654 | 3.71875 | 4 | [] | no_license | #!/usr/bin/env python
class LispReader(object):
"""
Used to read data in lisp format. File leading with # will be escaped. Iteratively
breaking lisp expression into sub sequences, like:
'(a (b c) (d e))' => ['a', '(b c)', '(d e)']
"""
def __init__(self, handler):
self.handler = handl... | true |
9ace389d02a0545e910ea343b8ba9443fbd82a0c | gbroiles/pydiary | /d.py | UTF-8 | 1,226 | 2.765625 | 3 | [
"MIT"
] | permissive | import datetime
# import nacl
# import dropbox
import PySimpleGUI as sg
# import pprint
def main():
""" main event loop """
layout = [
[
sg.Multiline(
key="diary", size=(85, 25), autoscroll=True, font=("Times", 12, "")
)
],
[sg.StatusBar("Stat... | true |
88d550442dffecc73482d35781fbde69a571beba | XinJCheng/Basic-DRL-tensorflow | /Q_learning/ql_table.py | UTF-8 | 2,167 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
'''
* @Author: Xinjing Cheng
* @Date: 2018-07-23 11:35:33
* @Description: Basic implementation for Q table
* @Email: cnorbot@gmail.com
* @Company: Baidu Research, Baidu Inc.
'''
import numpy as np
import pandas as pd
class QLearningTable:
def __init__(self, ... | true |
ee6cda51313d3150e39dde25dd911b600dfd6b0a | 2020-A-Python-GR1/py-capa-espin-ana-maria | /Deberes/Rompecabezas/Rompecabezas.py | UTF-8 | 1,667 | 3.015625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage
from scipy import misc
from random import sample
mapache = misc.face()
rompecabezas = []
juego = []
def partes_4(imagen):
global rompecabezas
arr1, arr2 = np.split(mapache,2)
arr1, arr3 = np.hsplit(arr1,2)
arr2... | true |
aabeec0dea18c0b731b5b4ce1803729563362b10 | alex-golts/advent_of_code_2019 | /day10.py | UTF-8 | 4,812 | 3.25 | 3 | [] | no_license | import numpy as np
import math
f = open('input10.txt','r')
txt = f.read()
txt = txt.split('\n')
txt = txt[:-1]
# txt = ['.#..##.###...#######',
# '##.############..##.',
# '.#.######.########.#',
# '.###.#######.####.#.',
# '#####.##.#.##.###.##',
# '..#####..#.#########',
# ... | true |
bc45a0276dd85708a792139e5506cbc9aac7f151 | YoTaShimoda/1103_kishimoto | /return_file_path.py | UTF-8 | 970 | 2.546875 | 3 | [] | no_license | import glob
def numfour_return_file_path():
numfour = glob.glob('/Users/yota/1103_kishimoto/csv_data/active_rate/active_no4/*')
numfour = sorted(numfour)
return numfour
def numfive_return_file_path():
numfive = glob.glob('/Users/yota/1103_kishimoto/csv_data/active_rate/active_no5/*')
numfive = sor... | true |
936e5e26ddbb523347bae0e7cd7614775a8b42f5 | openvinotoolkit/mmaction2 | /mmaction/datasets/pipelines/augmentations.py | UTF-8 | 63,452 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import random
import os.path as osp
from collections.abc import Sequence
import mmcv
import numpy as np
from torch.nn.modules.utils import _pair
from ..registry import PIPELINES
def _init_lazy_if_proper(results, lazy):
"""Initialize lazy operation properly.
Make sure that a lazy operation is properly initi... | true |
7472ebc07a07a392598bb041a22ffbb90ad724f2 | yanxurui/keepcoding | /python/algorithm/剑指offer/2.py | UTF-8 | 790 | 3.921875 | 4 | [] | no_license | # -*- coding:utf-8 -*-
class Solution:
# s 源字符串
def replaceSpace(self, s):
# write code here
tmp = []
for c in s:
if c == ' ':
tmp.append('%20')
else:
tmp.append(c)
return ''.join(tmp)
# 请实现一个函数,将一个字符串中的每个空格替换成“%20”。例如,当字符... | true |
34ddc2f53b4b0507fc0895a28e4bebd28215e2d6 | AppleEggX/Python-Algorithm | /quick_sort.py | UTF-8 | 1,049 | 3.25 | 3 | [] | no_license |
import sys
sys.setrecursionlimit(10000000)
###################################################
################## quick sort ####################
def partition(li, left, right):
##### this is for the worst case. However, it doesnt
##### change the worst time complexity o(n^2)
ranid = random.randint(left,r... | true |
b7926fe76501349622c0cdab21dbd3d98cdcd1c9 | ARES3366/aladdin | /aladdin-cas/unit_test/test_api_privacy.py | UTF-8 | 1,953 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from requests import session
import unittest
import numpy as np
content = '''
太阳毫不留情的炙烤着银行卡号:6222044,大地和海洋,时间才电话号码进入18518886663六月,红洋市就迎来了高温。
敖沐阳走上码头随意的打量周围邮箱:1010276502@qq.com,和他五年前离开家乡时一样,浑浊的海面上停靠着几十艘船,大多是筏子、舢板和小渔船,大船少见。
这个小码头叫龙王渡,他在的村子名为龙头村,二者名字息息相关... | true |
4adfefeaac42bbdd76778a92949f9073fff498d9 | lmeyre/Expert-System | /main.py | UTF-8 | 1,869 | 2.765625 | 3 | [] | no_license | #! /usr/bin/env python3
import argparse as arg
import sys
import Parser
import Resolver
import Display
def main():
arg_parse = arg.ArgumentParser()
arg_parse.add_argument("file")
arg_parse.add_argument("-S", "--show", action="store_true", default=False, help= "Show input file")
arg_parse... | true |
1be8fe515f9d5cb2e7297cfc4c67b10794a3cbb0 | BitOpenFPGA/fpga_test_soc | /run/bus_interface.py | UTF-8 | 3,007 | 2.984375 | 3 | [] | no_license | import sys
from uart_bus_interface import *
##################################################################
# BusInterface: Bus Interface Wrapper
##################################################################
class BusInterface:
##################################################################
# Const... | true |
82022060c62acc63c56345ec526c9470282fa38f | Mezheneva/ITMO-Python | /lesson 4/333.py | UTF-8 | 86 | 3.546875 | 4 | [] | no_license | a = int(input())
b = int(input())
a += a%2
for i in range(a, b+1, 2):
print(i)
| true |
06b61b259f887240c7da17cb3812708c4979cae0 | bright-dev/bright | /bright/gui/views/graph_container.py | UTF-8 | 6,945 | 2.625 | 3 | [
"WTFPL"
] | permissive | import networkx
import numpy
from enable.api import Container
from kiva.constants import CAP_BUTT
from traits.api import Instance, Enum, Bool, Property
from graphcanvas.layout import tree_layout
class CustomGraphContainer(Container):
""" Enable Container for Directed Acyclic Graphs
"""
bounds = [350, 35... | true |
82fb885d5826b90fb1805da3624111b26d75e219 | vernonjohnson23/cssiproject.github.io | /noteshandler.py | UTF-8 | 1,676 | 2.515625 | 3 | [] | no_license | import webapp2, jinja2, os, logging
from google.appengine.ext import ndb
from google.appengine.api import users
import classes
template_dir = os.path.join(os.path.dirname(__file__), 'templates')
jinja_environment = jinja2.Environment(
loader=jinja2.FileSystemLoader(template_dir))
class NotesHandler(webapp2.RequestHa... | true |
4d46f0b5ef7b0a8cf410f33c749ec759f0516f2f | nishaagrawal16/Datastructure | /Tree/simple_tree/inorder_tree_traversal_without_recursion.py | UTF-8 | 1,499 | 4.71875 | 5 | [] | no_license | # 1) Create an empty stack S.
# 2) Initialize current node as root
# 3) Push the current node to S and set current = current->left until current is NULL
# 4) If current is NULL and stack is not empty then
# a) Pop the top item from stack.
# b) Print the popped item, set current = popped_item->right
# c) ... | true |
a83ab36a4c8d4ff7ac8db30e32c0e53d72fef718 | CarsonSlovoka/geo-coor | /geo_coor/core.py | UTF-8 | 3,549 | 3.171875 | 3 | [] | no_license | import math
from pathlib import Path
from contextlib import contextmanager
import pandas as pd
from enum import Enum
import functools
from typing import Union, List
class OutputFormat(Enum):
__slots__ = ()
WGS84 = 0
TWD97 = 1
class GeoCoordinate:
__slots__ = ()
distance_between_longitude_on_equa... | true |
3adadcd679d08aa7342d0822c7ff93231535a4bb | maximfreerider/my_algoritms_labs | /first lab/student.py | UTF-8 | 567 | 3.484375 | 3 | [] | no_license | class Student:
comparisons = 0 # кількість операцій порівняння
swaps = 0
@staticmethod
def comperisons_method():
Student.comparisons +=1
return Student.comparisons
@staticmethod
def swap_method():
Student.swaps += 1
return Student.swaps
def __init__(self, name, surname, rate, heig... | true |
bd072bcccce823e70283781ae56c64949439fab7 | lilimonroy/CrashCourseOnPython-Functions | /q2.py | UTF-8 | 635 | 5.03125 | 5 | [
"MIT"
] | permissive | # This function compares two numbers and returns them in increasing order.
# Fill in the blanks, so the print statement displays the result of the function call in order.
#Hint: if a function returns multiple values, don't forget to store these values in multiple variables
# This function compares two numbers and... | true |
372f296a7df2c1a0016d575644626b592671eef7 | OTR-Capstone/Off_The_Rails | /explore.py | UTF-8 | 3,146 | 3.546875 | 4 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from scipy import stats
def train_validate_test_split(df, target, seed=123):
'''
This function takes in a dataframe, the name of the target variable
(for strati... | true |
e5af409ff8999b07261a5cdd52d76f7040cc7ec3 | huazhige/EART119_Lab | /mid-term/johannessonsofia/johannessonsofia_37907_1312320_bonus.py | UTF-8 | 3,323 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#imports
import numpy as np
import matplotlib.pyplot as plt
#================================
# functions
#================================
def lin_LS( aX, aY):
"""
- linear least squares assuming normal distributed errors in Y, no errors in X
:param aX: - i... | true |
5eb675ccf7d8db1b5da5299adae94984805b5b1e | shasfin/begfor | /Repeat Aufgaben/programs/greek-meander.py | UTF-8 | 499 | 3.28125 | 3 | [] | no_license | from gturtle import *
makeTurtle()
setPenColor("turquoise")
penUp()
back(200)
left(90)
forward(450)
right(90)
penDown()
repeat 7:
forward(100)
right(90)
forward(100)
right(90)
forward(80)
right(90)
forward(60)
right(90)
forward(40)
right(90)
forward(20)
right(90)
... | true |
496647c50906f0e42886959b4ecdcd0f9546c92a | kmzn128/CCI_Python | /CCI_1/CCI_2/2_6.py | UTF-8 | 269 | 3.28125 | 3 | [] | no_license | from linked_list import LinkedList
ll = LinkedList()
input_list = [3,5,8,10,8,5,4]
for i in input_list:
ll.appendToTail(i)
reversed_ll = LinkedList()
for i in input_list:
reversed_ll.appendToTail(i)
reversed_ll.reverse()
reversed_ll.list_print()
| true |
1245fb30afd93ba84bebed4215e4f9f8bb07eccc | earthexploration/MKS-Experimentation | /fip_collab/2016_06_09_check_FIP_RVE/plt_gamma_parameters_2.py | UTF-8 | 975 | 2.6875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import h5py
def pltmap(ns_max, step):
plt.figure(num=1, figsize=[7, 3])
f = h5py.File("responses.hdf5", 'r')
coefs = f.get('gamma_coefs')[...]
f.close()
loc = np.log(coefs[(step-2)::step, 1]) # mu-sub-g
scale = np.log(coefs[(step-2)::step,... | true |
6b46800f550fff0faa4c1eb2ddfe6d6d305cc090 | evhollins/Group-Game | /gametest1.py | UTF-8 | 1,046 | 3.640625 | 4 | [] | no_license | from random import randint
# weapon = [damage, price, acuracy out of 5]
wooden_sword = [1, 0, 2]
sword1 = [3, 100, 3]
sword2 = [5, 200, 4]
sword3 = [10, 300, 3]
bow = [randint(1,10), 300, 5]
weapons = [wooden_sword, sword1, sword2, sword3, bow]
weapons_text = ['wooden_sword', 'sword1', 'sword2', 'sword3', 'bow']
def ... | true |
093c887797b27f116a9ffd77b835526818f1af32 | olesiastetsiuk/data_pipeline_processor | /data_processor/data_transformator/exploratory_data_analysis.py | UTF-8 | 970 | 3.03125 | 3 | [] | no_license | import matplotlib.pyplot as plt
from glob import glob
import random
import cv2
def plot_random_images_from_folder(path, sample_size=9):
"""Function which plot 9 (by default) random images from a specified foldr.
"""
path = glob(path+"/*.jpg")
r = random.sample(path,sample_size)
plt.figure(figsi... | true |