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 |
|---|---|---|---|---|---|---|---|---|---|---|
e9789924e37c7ee4673c5f93a3baad6473a1e08c | mosesadelere/FromCentos | /DataStructure/arithmeticProgression.py | UTF-8 | 435 | 3.21875 | 3 | [] | no_license | from DataStructure.progression import Progression
class ArithmeticProgression(Progression):
"""
Inherit from the progression class
"""
def __init__(self, increment = 1, start = 0):
super().__init__(start)
self.increment = increment
def advance(self):
"""
This metho... | true |
d05ef861e30dab103c14347c392843cf18c07d25 | xinstant/Horoscope | /Horoscope.py | UTF-8 | 770 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 6 11:42:42 2021
@author: Maks Fraszka
Using webscraping, this function returns a paragraph detailing your current
horoscope based on your input of the zodiac sign.
"""
import requests
import bs4
zodiacs = {'Aries':1,'Taurus':2,'Gemini':3,'Canc... | true |
fbe589791d26f1894d85ada17f544c21b1bc72da | r14sandeep/Test | /python/strings/selction_sort.py | UTF-8 | 435 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python
import randomlist
def selection_sort(list1):
nitems=len(list1)
for index1 in range(nitems-1):
small=index1
for index2 in range(index1+1,nitems):
if(list1[index2]<list1[small]):
small=index2
if(index1!=small):
list1[index1],list1[small]=list1[small],list1[index1]
return
#list1=[5,2,1... | true |
48cdc8625c8b45980fdc6e6bd8463cf07b050bc3 | scvslsravikiran/GeeksforGeeks-Python | /Python-Control-Structures/Python-loops/cat-and-hat.py | UTF-8 | 931 | 4.0625 | 4 | [] | no_license | """
Created on Feb 24 2019 06:30 PM
@author : S C V S L S RAVI KIRAN
"""
'''
Zero Converter - Python
Question : https://practice.geeksforgeeks.org/problems/zero-converter-python/1/?track=python-module-2
'''
"""
{
#Initial Template for Python 3
//Position this line where user code will be pasted.
def main():
testca... | true |
04ea83bb2cd260b8c74e0b20002b754007b0e887 | suasue/Westagram | /user/views.py | UTF-8 | 5,095 | 2.5625 | 3 | [] | no_license | import json
import re
import bcrypt
import jwt
from json.decoder import JSONDecodeError
from django.http import JsonResponse
from django.views import View
from django.db.models import Q
from my_settings import SECRET, ALGORITHM
from user.models import User, Follow
from user.utils import login_decorator... | true |
65c45999a03d7e52df2b922c91b9871655f5ed35 | 123seven/fastapi_example | /utils/tools/config.py | UTF-8 | 5,375 | 2.859375 | 3 | [] | no_license | import sys
from six import iteritems, string_types, reraise
class ImportStringError(ImportError):
"""Provides information about a failed :func:`import_string` attempt."""
import_name = None
exception = None
def __init__(self, import_name, exception):
self.import_name = import_name
... | true |
2e72a8687f5ff58bf707c0b1d5767cf0a6d70e82 | BohanHsu/developer | /python/classes/scopeAndNamespaces.py | UTF-8 | 370 | 2.703125 | 3 | [] | no_license | def scope_test():
def do_local():
spam = "local spam"
def do_nonlocal():
spam = "nonlocal spam"
def do_global():
spam = "global spam"
spam = 'test spam'
do_local()
print('after local assignment:', spam)
do_nonlocal
print('after nonlocal assignment:', spam)
do_global()
print('after global assignment:', s... | true |
72e0b751dfbcd781942faf77b61fef78fdcfe24f | m-v-nikolov/grid-topo-analysis | /build-grid-topo/build_grid_topo_w_hospitals.py | UTF-8 | 10,984 | 2.75 | 3 | [] | no_license | '''
- process a collection of households into a connected grid of cells
- place a collection of hospitals within the grid cells; note that other building structures (e.g. schools) can be placed similarly
- this is a modified version of build_grid_topo.py, for illustration
- input: - households csv file with requi... | true |
0f05aa884cb8c925ae30c0cb19a33bd7b16c86c6 | miello/com_prog | /06_Func/06_Func_31.py | UTF-8 | 2,055 | 3.046875 | 3 | [] | no_license | month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
mname = ["Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"]
def zodiac(d1, m1):
z1 = None
if d1 >= 22 and m1 == 3 or d1 <= 21 and m1 == 4:
z1 = "Aries"
elif d1 >= 22 and m1 == 4 or d1 <= 21 ... | true |
a5eeaa45f20716db39375d6277b1f3af03ae38de | mikey-manma/mikey-manma | /1-10d.py | UTF-8 | 322 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
n=int(input())
a=list(map(float,input().split()))
b=list(map(float,input().split()))
c=[abs(a[i]-b[i]) for i in range(n)]
for p in range(1,4):
ans=0
for d in c:
ans+=d**p
print("{:.6f}".format(ans**(1/p)))
print("{:.6f}".format(max(c)))
# In[ ]:
... | true |
7ff977b75b134bd91fb090ece9ec070fc84b984f | memanuel/kepler-sieve | /src_py/tf_utils.py | UTF-8 | 5,424 | 2.90625 | 3 | [] | no_license | """
Harvard IACS Masters Thesis
Tensorflow Utilites
Michael S. Emanuel
Wed Jun 26 20:24:42 2019
"""
# Tensorflow
import tensorflow as tf
from silence_tensorflow import silence_tensorflow
# Core
import numpy as np
# Utility
import matplotlib.pyplot as plt
import time
import datetime
# ******************************... | true |
5d128bbca59d0f7c0576f1ad43e4ef0c546d647e | ruehowl/message_pal | /web-api/app.py | UTF-8 | 3,512 | 2.828125 | 3 | [] | no_license | from flask import Flask
from flask_restful import Api, Resource, reqparse, abort
from flask_cors import CORS
import sqlite3
app = Flask(__name__)
CORS(app)
api = Api(app)
conn = sqlite3.connect('data.db',check_same_thread=False)
cursor = conn.cursor()
with conn:
cursor.execute("""
CREATE TABLE... | true |
338e2b7085fa942cabb25a3b273814bf13faa1f7 | iPedriNNz/Exercicios | /ex019.py | UTF-8 | 527 | 4.25 | 4 | [] | no_license | # Exercício Python 019: Um professor quer sortear um dos seus quatro alunos para apagar o quadro. Faça um programa que
# ajude ele, lendo o nome dos alunos e escrevendo na tela o nome do escolhido.
from random import choice
student1 = input('Nome do primeiro aluno ')
student2 = input('Nome do segundo aluno ')
student3... | true |
390a094a8f474d0a2ff7326fc1e69d0edd59e6da | Guttappa1238/signals | /analog.py | UTF-8 | 857 | 3.1875 | 3 | [] | no_license | ##!/usr/bin/env python3
## -*- coding: utf-8 -*-
#"""
#Created on Wed Dec 5 15:02:55 2018
#
#@author: guttappa
#"""
#importing the dependencies
import numpy as np
import matplotlib.pyplot as plt
import soundfile as sf
##importing the sound file
x1, fs = sf.read('g1.wav')
##assigning the frequencies
f1=5
f2=100
f3=1000... | true |
927d9eac5564569f689dd8364293b3a5148b57cf | susiejojo/GPU_opt_traj | /numpy_RVO/new_plot_32.py | UTF-8 | 16,480 | 2.546875 | 3 | [] | no_license |
from numpy import *
import matplotlib.pyplot as plt
import scipy.special
import os
from scipy import interpolate
from scipy.io import loadmat
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
plt.r... | true |
5642c897365a61595ceb2fb58caa840ba3a74d4b | josooik/linear_algebra | /선형대수 4일차/실습/opencv10.py | UTF-8 | 1,055 | 3.140625 | 3 | [] | no_license | # 회전 이미지 8개 출력
import cv2
import numpy as np
img = cv2.imread('img/img3.jpg', cv2.IMREAD_COLOR)
# 이미지 사이즈 조정
img = cv2.resize(img, dsize=(400, 400), interpolation=cv2.INTER_AREA)
height, width = img.shape[:2]
angles = [0, 45, 90, 135, 180, 225, 270, 315]
dst = []
center_x = width / 2
center_y = height / 2
# getRo... | true |
87900c4d8be125ede2c1756b7c3926316921e7a2 | adriangrepo/mathsonmars | /mathsonmars/application/tests/test_appviewutils.py | UTF-8 | 2,242 | 3.046875 | 3 | [
"MIT"
] | permissive | #! ../env/bin/python
# -*- coding: utf-8 -*-
import unittest
import logging
import random
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
class TestApplViewUtils(unittest.TestCase):
'''couldnt run unit test on external code so copied and pasted here'''
@classmethod
de... | true |
d547df6120c0037a6d0f8ee51a3322c5e748884c | stfnwong/lernomatic | /lernomatic/util/hdf5_util.py | UTF-8 | 6,174 | 3.046875 | 3 | [
"MIT"
] | permissive | """
HDF5_UTIL
Utilities for working with HDF5 files
Stefan Wong 2018
"""
import h5py
import numpy as np
# debug
#
class HDF5Data(object):
def __init__(self, fname: str, **kwargs) -> None:
"""
HDF5Data
Wrapper around an HDF5 dataset
"""
self.filename = fname # Cache t... | true |
979e3a9cb5db75468020407c7512b5da3de878f3 | adriangohjw/CZ4032-Data-Mining-and-Analytics | /association_rule/data_processor.py | UTF-8 | 3,748 | 2.890625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import math
import matplotlib.pyplot as plt
from mlxtend.preprocessing import TransactionEncoder
from mlxtend.frequent_patterns import apriori, association_rules
def delimiter():
return '___'
def load_dataset(filename, delimiter):
return pd.read_csv(filename, ... | true |
73653f25bb3a11af02ad2a614719c957bd5a8f6a | subhamrex/Coding_Practice | /Python/OpenCv_Python/chapter3.py | UTF-8 | 332 | 3.0625 | 3 | [] | no_license | import cv2
import numpy as np
img = cv2.imread("Resources/dog.jpg")
print(img.shape)
imgResize = cv2.resize(img,(500,600)) #(Width,Height)--> Resize img
print(imgResize.shape)
imgCropped = img[0:200,200:500] #here height comes first
cv2.imshow("Output", imgResize) #show img
cv2.imshow("Cropped img: ",imgCropped)
cv... | true |
45ad4c25a9691b8040ffe6fe78128773de91fbd3 | eric496/leetcode.py | /stack/503.next_greater_element_II.py | UTF-8 | 1,511 | 4.15625 | 4 | [] | no_license | """
Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The Next Greater Number of a number x is the first greater number to its traversing-order next in the array, which means you could search circularly to find its next grea... | true |
988c13c86234bba5bbd63198851da4b254baf2ce | BarisKocaman55/MachineLearning | /MachineLearningEğitimi/Classification/Homework/Homework.py | UTF-8 | 3,237 | 3.328125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix
from sklearn.metrics import accuracy_score
#---------------READING DATA FROM EXCEL--------------
data = pd.read_excel('Iris.xls')
x = data.iloc[:, 0:4... | true |
7aa774896bb9f67d7a77ea2550bd0368bfab9d2d | FizzyBody8/arrays | /arrays.py | UTF-8 | 990 | 3.875 | 4 | [] | no_license | def countEvens(numbers):
evens = 0
for number in numbers:
if number % 2 == 0:
evens = evens + 1
return evens
print countEvens([1, 2, 3, 4, 5, 6, 7, 8, 9]) #Expect 4
def bigDiff(numbers):
max = numbers[0]
min = numbers[0]
for number in numbers:
if number > max :
... | true |
f13c13e685822a3559a5587f3012c237b8ee587c | GoogleCloudPlatform/django-cloud-deploy | /django_cloud_deploy/config.py | UTF-8 | 3,506 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | true |
07345e9f524c88f4be6c58212e4e56f97d53cc1d | jonasagx/Revision-Scoring | /revscores/scorers/scorer.py | UTF-8 | 4,090 | 3.15625 | 3 | [
"MIT"
] | permissive |
class Scorer:
"""
Interface for implementing a wide variety of scoring strategies.
"""
def __init__(self, extractor):
self.extractor = extractor
def score(self, rev_ids):
"""
Returns a sequence of scores that correspond to <rev_ids>.
"""
raise NotI... | true |
cd831a1574c8035b2112a7f796702382ad1cf918 | kbj627/LecPython | /P_Quiz1/P_Quiz1/P_Quiz1.py | UTF-8 | 551 | 3.125 | 3 | [] | no_license | import re
def password(p) :
print(len(p))
if re.match(r'[0-9, a-z, A-Z, !@#$%\^&*]{8,13}?', p) == None :
print('1', re.match(r'[0-9, a-z, A-Z, !@#$%\^&*]{8,13}', p))
return
if re.match('[0-9]*', p) == None :
print('2', re.match('[0-9]', p))
return
if re.match('[a-z,A-Z]... | true |
e18634c05d2e168a78bb7b9644945ad70ed6e1ea | octavianseciu/AutoSearchNet | /searchYoutube.py | UTF-8 | 3,045 | 2.609375 | 3 | [] | no_license | import time
from speechText import speechTtext
import re
import webbrowser
from youtubesearchpython import VideosSearch
from youtubesearchpython import Suggestions
class YoutubeSearch:
def __init__(self, comanda):
self.comanda = comanda
@property
def suggestions(self):
suggestions = Sugge... | true |
440674805dd65d9b1f5cded29cc68b9a3a817160 | AntouanK/advent-of-code_2019 | /day01/python/solve.py | UTF-8 | 291 | 3.3125 | 3 | [] | no_license | import fileinput
sumOfFuel = 0
def findFuelRequirement (mass):
return round((mass / 3)) - 2
print(findFuelRequirement(1969))
print(findFuelRequirement(100756))
for line in fileinput.input():
mass = int(line)
sumOfFuel += findFuelRequirement(mass)
print("___sum", sumOfFuel)
| true |
bc2918519d4d27e1d9cbf2893b9ce1f918bd6c9c | Jhecks/Accents-for-EGE | /Main.py | UTF-8 | 2,782 | 2.609375 | 3 | [] | no_license | import sys
from PyQt5 import QtWidgets, QtCore
import QTTest
import pymysql
from pymysql.cursors import DictCursor
import random
def initialization():
global db
db = pymysql.connect(
host='localhost',
user='root',
password='1111',
db='dictionary',
charset='utf8mb4',
cur... | true |
86ff9a186b24d34e1cbe7b3287b926c1c39f8a4d | binonguyen1090/PythonHackerRank | /mini_max_sum.py | UTF-8 | 241 | 3.40625 | 3 | [] | no_license | # https://www.hackerrank.com/challenges/mini-max-sum/problem
def miniMaxSum(arr):
new = sorted(arr)
min = 0
big = 0
for i in range(0,4):
min += new[i]
for k in range(1,5):
big += new[k]
print(min,big) | true |
675f25482db8899248ad891d10042e424c7b443d | umuero/umuero | /foobar/solution.py | UTF-8 | 13,844 | 2.828125 | 3 | [] | no_license | import math
from functools import reduce
from collections import Counter
from collections import defaultdict
try:
from queue import PriorityQueue
except:
from Queue import PriorityQueue
import fractions
def solution1(x, y):
x_c = Counter(x)
y_c = Counter(y)
if x_c - y_c:
return (x_c - y_... | true |
c0daf28fe92331aa2d3de4e254d4540188a91a2b | Hackail/Ciencias-3 | /lexer_parser2/prueba_completa.py | UTF-8 | 329 | 2.65625 | 3 | [] | no_license | import lexer_rules
import parser_rules
from ply.lex import lex
from ply.yacc import yacc
text =open("archivo.txt").read()
#text="3^2"
lexer = lex(module=lexer_rules)
parser = yacc(module=parser_rules)
expression = parser.parse(text, lexer)
print expression
"""
result = expression.evaluate()
print re... | true |
299d7c934bf1199fa0309204d9a3db5ce44b7053 | sudhanshu-jha/Scrapers | /GUI/turtle-mini-project.py | UTF-8 | 2,220 | 3.671875 | 4 | [
"MIT"
] | permissive | import turtle
# Global Project Settings
background = "black"
shape = "turtle"
speed = 0
color = "green"
start_filled = 60
start_unfilled = -60
triangle_angles = -120
# Different Triangle Sides
side = 30
# Vector Sides
start = 1
end = 3
# Angles to be drawn
specifics = {
"filled_unit": [start_filled, triangle_an... | true |
0722d05716b7a8dabee53630b2a08d72c1f3a775 | Tobias-Bjerking/AdventOfCode2019 | /DailyChallenges/Day2.py | UTF-8 | 809 | 3.359375 | 3 | [] | no_license | import GetInput
def instruction(noun: int, verb: int) -> int:
memory = GetInput.get_numbered_line("../Input/Day2.txt")
memory[1] = noun
memory[2] = verb
pointer = 0
while memory[pointer] != 99:
if memory[pointer] == 1:
memory[memory[pointer + 3]] = memory[memory[pointer + 1]] +... | true |
5fc091b837634d080460e4235524d85b5cd8309e | kukaro/ceres-webcrawler | /src/bs로 하나씩 가져오기.py | UTF-8 | 295 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen("https://www.python.org/about")
bsObject = BeautifulSoup(html, 'html.parser')
print(bsObject.head.find_all('meta'))
print(bsObject.head.find('meta', {}))
print(bsObject.head.find('meta', {'name': 'description'}))
| true |
e6abaa9e483bc536bb421c55893193a4faaca323 | edenlib/spider-yahoo-finance | /src/pipeline.py | UTF-8 | 2,344 | 2.828125 | 3 | [] | no_license | """Classic ETL pipeline.
Python 3.8
Author: Adam Turner <turner.adch@gmail.com>
"""
# standard library
import datetime
import io
import re
# python package index
import lxml.html
import pandas as pd
import requests
def extract(start_date, ticker):
"""Requests data from Yahoo Finance.
Args:
start_da... | true |
8c443f7e6eb0c90f8162953376135f087fcfeb94 | LIUJINGJI/AeroSandbox | /aerosandbox/common.py | UTF-8 | 5,386 | 3.4375 | 3 | [
"MIT"
] | permissive | from aerosandbox.optimization.opti import Opti
from abc import abstractmethod
class AeroSandboxObject:
@abstractmethod
def __init__(self):
"""
Denotes AeroSandboxObject as an abstract class, meaning you can't instantiate it directly - you must subclass
(extend) it instead.
"""... | true |
fe06ab7455ee04490583aa12f6860e0a55b28d64 | rafaelblira/python-progressivo | /progressao_aritimética.py | UTF-8 | 241 | 3.671875 | 4 | [
"MIT"
] | permissive | primeiro=int(input("Primeiro elemento: ") )
razao = int(input("Razao: ") )
n = int(input("Quantos elementos exibir: ") )
ultimo = primeiro + (n-1)*razao
ultimo = ultimo + 1
for var in range(primeiro, ultimo, razao):
print(var, end=' ') | true |
2f20c90c8657e173062aaa974404f442e5245d23 | Guyuena/dlgo-deep-learning-and-chess | /chp7/dlgo/goboard_slow.py | UTF-8 | 22,909 | 3.5625 | 4 | [] | no_license | import copy
import numpy as np
from dlgo.gotypes import Player
from dlgo.gotypes import Point
from dlgo.scoring import compute_game_result
__all__ = [
'Board',
'GameState',
'Move',
]
class IllegalMoveError(Exception):
pass
# 棋盘的棋链
# Gostring(): 跟踪、维护气数
# 多个棋子连成一片,形成棋链
class GoString():
def __in... | true |
99c12ef5bbea1f1af9442f2cbcf2897927f9dce3 | anstones/py-collection | /Other_codes/tictk.py | UTF-8 | 6,424 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python
#-*- coding:utf-8 –*-
"""Train tickets query via command-line.
Usage:
docoptTest [-gdtkz] <from> <to> <date>
Options:
-h, --help 显示帮助菜单
-g 高铁
-d 动车
-t 特快
-k 普快
-z 直达
Example:
docoptTest beijing shanghai 2016-09-26
"""
... | true |
f738a76e649f48c6024b279590ab30fb678054ae | refriansyari/Dash-plotly | /range_slider.py | UTF-8 | 772 | 2.984375 | 3 | [] | no_license | import dash
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
html.H1('Substract'),
... | true |
bcfd1895550fcb9808fa556296df4945827f6864 | alanachaval/AnalisisNumerico | /Practica1/Ejercicio10.py | UTF-8 | 887 | 3.984375 | 4 | [] | no_license | import math
class Ejercicio10:
def formula_recusiva(self, n):
x_sub_n_menos_2 = 1
x_sub_n_menos_1 = (1 - math.sqrt(5)) / 2
x_sub_n = x_sub_n_menos_2
if n == 1:
x_sub_n = x_sub_n_menos_1
for i in range(2, n + 1):
x_sub_n = x_sub_n_menos_1 + x_sub_n_m... | true |
b070aeecc766a281c0ca73f3e5960467fe36c8d9 | Lemon30/population-api | /web_service/app.py | UTF-8 | 2,785 | 2.671875 | 3 | [] | no_license | from flask import Flask, request, jsonify, render_template
import redis
import geohash as gh
import proximityhash as ph
from voluptuous import Schema, Required, Coerce
# Connect to database
r = redis.Redis(host='redis', port=6379, db=0)
r.ping()
app = Flask(__name__)
# Handle exceptions and errors
class InvalidUsage... | true |
02d754c5afb7728c1aca2b285039ec6f5cfe0518 | robertli0719/stock-value | /main.py | UTF-8 | 1,154 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
假设未来的净资产收益率以及杠杆率不变,计算股票以当前价格买入后多久可收回成本
@author: robert
"""
import math
import data
def p2f(x):
return float(x.strip('%'))/100
ticker_arr = ["AAPL", "FB", "DIS", "GOOG", "NVDA", "AMZN",
"MSFT", "IBM", "BABA", "TCEHY", "V", "NKE", "LULU","GOLD"]
title_arr = ["Trailing P/... | true |
561adc973fb90236dd7c859f2c193954ad19b9f7 | ThomasBurgess2000/BiolaFacialRecognition | /biolaFacialRecognition.py | UTF-8 | 1,600 | 3.09375 | 3 | [] | no_license | import face_recognition
import pickle
import numpy as np
import re
#Initial variables
goAgain="z"
with open ('dataset_faces.dat', 'rb') as f:
all_face_encodings=pickle.load(f)
face_names=list(all_face_encodings.keys())
face_encodings=np.array(list(all_face_encodings.values()))
#compareFace functio... | true |
00d36ef3f857079e2ccc1d26603265a1cb7e8871 | sgneves/courses | /Data_scientist_in_python/27_Machine_learning_project/03_Making_predictions.py | UTF-8 | 5,172 | 3.046875 | 3 | [] | no_license | #**************************************************************************************************#
# #
# 03_Making_predictions #
# ... | true |
640453a20d1b2c48861a4211561b287345709369 | zkbt/transit2pi-experiments | /transit2pi/maketransitcurve.py | UTF-8 | 2,311 | 2.84375 | 3 | [
"MIT"
] | permissive | from __future__ import print_function
import numpy as np
from matplotlib import pyplot as plt
import batman
from .planetplotlib import create_dome_plot
def make_transit_curve(t0=0,per=6.266,rp=0.1,a=6.85,inc=90,ecc=0,w=0, ylim=[0.95, 1.01], filename=None) :
''' Here is how to use the function.
Parameters
----... | true |
0419cf40523f7cb03d54393be76335c9e682c850 | patlach42/puer_rest | /puer_rest/serializers/fields/object_id.py | UTF-8 | 668 | 2.640625 | 3 | [] | no_license | from marshmallow.exceptions import ValidationError
from marshmallow.fields import Field
import bson
class ObjectId(Field):
"""
Marshmallow field for :class:`bson.ObjectId`
"""
def _serialize(self, value, attr, obj):
if value is None:
return None
return str(value)
def... | true |
35001dd553e677e61003877c6a8c556da2a2dd19 | AIR-ZRB/python_demo | /5. 三目运算符.py | UTF-8 | 44 | 3.328125 | 3 | [] | no_license | x = 10
y = 20
c = x if x > y else y
print(c) | true |
a25111646726d6cf2aad38896cbe9571978105c1 | Jkize/LearnPython | /Hilo.py | UTF-8 | 269 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 13 12:10:06 2019
@author: Jhoan Saavedra
"""
import threading
import time
def Multipy(a,b):
time.sleep(10)
return a*b
multThread=threading.Thread(target='Multipy',args(5,6))
multThread.start();
print('Hola')
A='NO MAS?' | true |
88dd2b925c2e6afaf91089a5fc2ccd3d0fcd545c | bridgeandcities/HackerRank | /bon-appetit.py | UTF-8 | 550 | 3.078125 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the bonAppetit function below.
def bonAppetit(bill, k, b):
annaFood = bill[k] #what anna did not eat
total = sum(bill)
split = (total - annaFood) / 2
if b != split:
print(round(b - split))
else:
prin... | true |
4b3e17a4d2920a5c5c206951976161adc7bbed0b | rohithkrn/Machine-Learning | /NaiveBayes/MultiGaussClassify.py | UTF-8 | 3,297 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 26 14:35:46 2017
@author: rohit
"""
#%%
import numpy as np
#%%
class MultiGaussClassify():
# Data features
classes = 0
count = 0
n_classes = 0
n_samples = 0
n_features = 0
# Model parameters
prior_prob = 0
class_mean = 0
co... | true |
24b216025a8d5ac0ab70b70dc5cbe0d62525585f | phuonghtruong/python | /Checkio/absolute_sorting.py | UTF-8 | 246 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
def checkio(numbers_array: tuple) -> list:
#list(i) for i in numbers_array
#map(list, numbers_array)
return sorted(numbers_array, key= abs)
if __name__ == '__main__':
print(list(checkio((-20,-5,10,15))))
| true |
d3e811b868cbbf3661066fabcaa49672972c8e1d | Vrancean/Olimp-clasa-9 | /ф1.py | UTF-8 | 215 | 3.28125 | 3 | [] | no_license | n = int(input("dati numarul de pasari: "))
gaini = n // 2
rate = gaini // 4
gaste = n - gaini - rate
print("Numarul de gaini este",gaini)
print("Numarul de rate este",rate)
print("Numarul de gaste este",gaste) | true |
1841a7d7badaecfbec53c24a9f7462df980f8260 | tallestorange/competitive_programming | /problems/ABC122/abc122_d.py | UTF-8 | 1,356 | 2.90625 | 3 | [] | no_license | N = int(input())
d = [[[[0]*4 for _ in range(4)] for _ in range(4)] for _ in range(N+1)]
d[0][0][0][0] = 1
mod = 10**9+7
# T -> 0
# A -> 1
# G -> 2
# C -> 3 とする
# 先頭の文字をi、先頭から2番めの文字をj、先頭から3番目の文字をkとなるような
# 場合の数をDPテーブルで管理する
# dp[n][i][j][k] += dp[n-1][j][k][l]
# 新しく文字を追加したとき、
# 先頭4文字が以下のようにならないようにしたい
# AGC*, ACG*, GAC... | true |
cfed9e2d88a3c8b26216d0d511a6a3448c6d3c90 | jdgalviss/banana_RL | /training.py | UTF-8 | 3,478 | 3.28125 | 3 | [] | no_license |
"""
Training loop.
"""
import numpy as np
import torch
from collections import deque
from tensorboardX import SummaryWriter
def train(env, agent, mode, n_episodes=1000, max_t=1000, eps_start=1.0, eps_end=0.01, eps_decay=0.995, goal_score = 13.0):
""" Training our Deep Q-Learning agent.
Params
======
... | true |
6f1436b90d0a39638a6ef918822e958d236b73fa | federicomachado/moonportal | /models/Simulation.py | UTF-8 | 4,121 | 2.890625 | 3 | [] | no_license | from algorithms.Algorithm import Algorithm
from Order import Order
from pydoc import locate
class Simulation:
def __init__(self, algorithm = "Algorithm", historical = "USDT-TEST-H.txt", startingBalance = 100):
print("Loading Simulation Data...")
files = open("historical/"+historical)
data... | true |
bc0f2751fe3b4c1304d83ffaa79d4c234d82dafe | leeo1116/Algorithms | /LeetCode/Python/Original/004_median_of_two_sorted_arrays.py | UTF-8 | 5,101 | 3.734375 | 4 | [] | no_license | class Solution(object):
def find_median_sorted_arrays_merge_1(self, nums1, nums2):
"""
Find median of two sorted arrays
:param nums1: array one
:param nums2: array two
:rtype: float
:return: median
"""
# Handle corner case
n1, n2 = len(nums1), ... | true |
78e8f6f24b1e58b6dcd07e0a2fc5fcda89ffd095 | AK-1121/code_extraction | /python/python_20026.py | UTF-8 | 76 | 2.53125 | 3 | [] | no_license | # How can you print cipher text as a hex string?
a.encrypt(m).encode('hex')
| true |
f6782d139a4194fb1dda623e604a0965898650c2 | wzj520xjl/studydoc | /tieba.py | UTF-8 | 1,228 | 2.875 | 3 | [] | no_license | import os
import urllib.request
import urllib.parse
def handle_request(url,page,baname):
pn=(page-1)*50
#拼接url
data={
'kw':baname,
'pn':pn,
}
url+=urllib.parse.urlencode(data)
#print(url)
headers={
'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) Apple... | true |
799842ea8103e0b1bfa39731dc078335e7621eaa | Cvig/MyCodes | /Python/Practice_Problems/UrlsAPIs.py | UTF-8 | 4,201 | 4.125 | 4 | [] | no_license | #Author: Chetna Vig
''' Problem statement:
Take a list of list of strings and concatenate them into a url
eg., Given [['www'], ['paypal', 'paypal-hub'],['com']]
Result should be:
www.paypal.com
www.paypal-hub.com
Note: list of strings could be of variable length
'''
'''
genUrls class have two major solutions to the ... | true |
b8f78c2939a5d09c9232606e6f72346ccc34ee24 | wangyum/Anaconda | /lib/python2.7/site-packages/pandas_ml/smaccessors/test/test_base.py | UTF-8 | 5,465 | 2.640625 | 3 | [
"Python-2.0",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown"
] | permissive | #!/usr/bin/env python
import numpy as np
import sklearn.datasets as datasets
import statsmodels.api as sm
import pandas_ml.smaccessors.base as base
import pandas_ml.util.testing as tm
class TestBaseRegressor(tm.TestCase):
def test_methods(self):
from sklearn.base import clone
obj ... | true |
e4f950631cbee684b8cbc858944cf8fc10e9abb9 | RazwanTanvir/URIBeginnerProblemsPython | /URI1050.py | UTF-8 | 253 | 3.296875 | 3 | [] | no_license | l = [61,71,11,21,32,19,27,31]
a = int(input())
li = {61:'Brasilia',71:'Salvador',11:'Sao Paulo',21:'Rio de Janeiro',32:'Juiz de Fora',19:'Campinas',27:'Vitoria',31:'Belo Horizonte'}
if a in l:
print li[a]
else:
print 'DDD nao cadastrado'
| true |
480b94b557b8340cf124d8afa85798b92e9b743e | Binjer/jianzhi_offer | /code/test37_prob38.py | UTF-8 | 3,748 | 3.890625 | 4 | [] | no_license | # 面试题38:字符串的排列
# 书上的思路
class Solution1(object):
def Permutation(self, ss):
res = []
if len(ss) == 0:
return res
charlist = list(ss)
self.permutation(charlist, 0, res)
res = [''.join(res[i]) for i in range(len(res))]
res.sort()
return res
... | true |
b7f144a287ec9c02f6a73f6de800cb783b0e37ac | derwinmcgeary/adventofcode2017 | /3/manhattan.py | UTF-8 | 2,794 | 3.59375 | 4 | [] | no_license | import math
target = 347991
shell = 0
bottomrightcorner = 0
for i in range(1,800,2):
if i**2 > target:
bottomrightcorner = i**2
shell = (i-1)/2
break
# Now that we know which shell
print(shell)
shellsize = shell*2 + 1
print(shellsize)
print(bottomrightcorner)
# Shellsize is always odd... | true |
a849d411b3dca6a05c97f76da2cfc98dae6d8068 | calinwolf08/python-projects | /if2.py | UTF-8 | 181 | 3.359375 | 3 | [] | no_license | people = 30
cars = 40
trucks = 15
if cars > people:
print "more cars than people"
elif cars < people:
print "more people than cars"
else:
print "same number of people and cars"
| true |
b401d0cb1f0a56875a029ea20d6c5a01fd4ebe6a | Ahn-Ssu/Class_Python | /DoITpython/Day6/function.py | UTF-8 | 534 | 3.765625 | 4 | [] | no_license | #입력 값의 갯수를 예측할 수없을 때
def sum_up(*args):
result = 0
for i in args:
result += i
return result
values = [2,3,4,5,6,7,8]
print(sum_up(values[0],values[4],values[2]))
# 매개변수 초기값 설정하기
# 초기 값을 설정한 매개변수는 뒤에서부터 순서대로 앞으로 채워져야함
def introduce(name, old, man = Ture):
print("이름 %s" % name)
print... | true |
5c0c9db92c80167791fdc0e3512f47606932f6f3 | makiwara-fr/Subtitle-Renamer | /src/subtitle_renamer/scan.py | UTF-8 | 2,971 | 2.765625 | 3 | [] | no_license | import os
from subtitle_renamer import settings as CONFIG
import re
class Scanner:
def __init__(self, regexps):
self.regexps = regexps
def recognize_season_episode(self, file_name):
"""Recognize season and episode in the file name and give it back as S[0-9]E[0-9] format. Returns an empty stri... | true |
c60ed8bc8c1ddd6fcf0ac855119ecfe613ce8008 | wrancisco/CI3715-Tarea2 | /PruebaV0.py | UTF-8 | 4,039 | 3.34375 | 3 | [] | no_license | # AUTHORES:
# Francisco Marcos 11-10569
# Julio Perez 14-10820
import unittest
from ChequeoIVSS import *
class FunctionTester(unittest.TestCase):
# Prueba inicial con la que se espera el programa arroje una respuesta positiva.
def testFirstPositiveMan(self):
# Se ingresa un hombre con... | true |
f20f4a958b3fc311aa8cdc3dc42ae941ddad6b48 | rkowalewski/MP-sort | /mpsort/tests/test_mpsort.py | UTF-8 | 5,389 | 2.53125 | 3 | [
"BSD-2-Clause"
] | permissive | import mpsort
from runtests.mpi import MPITest
import numpy
from numpy.testing import assert_array_equal
def split(array, comm, localsize=None):
array = comm.bcast(array)
if localsize is None:
sp = numpy.array_split(array, comm.size)
return comm.scatter(sp)
else:
g = comm.allgather(... | true |
9008b93bd95f2c2460b65d0b54c0fd73c89ff0f3 | DouglasAllen/sundowner | /sundowner/__init__.py | UTF-8 | 4,639 | 3.171875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
sundowner.py
Webservice to provide sunrise and sunset information.
All times are UTC. It is up to the client to convert to local time.
"""
import ephem
from datetime import date, timezone, timedelta
import dateutil.parser
from flask import Flask, request, render_templ... | true |
fa04bc9dbf6d4046ef3c94f763145af47a2515f8 | frankamp/wordpress-year-text-analysis | /01b_reconcile.py | UTF-8 | 289 | 2.71875 | 3 | [] | no_license | import os
full = set(range(1,365))
numbers = set()
for f in os.listdir('poems'):
if f.endswith('.txt'):
name, _, ext = f.partition('.')
ordinal, _, number = name.partition('_')
numbers.add(int(number))
print 'missing', full - numbers
print 'count', len(numbers) | true |
40cee520c63adadfeb8ba9c52380ed945754f2ef | AdlerChan/Euler-Problem | /problem1.py | UTF-8 | 187 | 3.28125 | 3 | [] | no_license | sum = 0
five_multiples = range(0, 1000, 5)
three_multiples = range(0, 1000, 3)
multiples = list(set(three_multiples + five_multiples))
for i in multiples:
sum = sum + i
print sum
| true |
4f8f8927d793c37fd45d52f16918daacf9f3970e | chenkangkang002/mySelenium | /search.py | UTF-8 | 887 | 3.03125 | 3 | [] | no_license | from selenium import webdriver
import time
'''
实现搜索
'''
driver = webdriver.Chrome() #实例化浏览器对象
driver.maximize_window() #浏览器窗口最大化
time.sleep(3) #设置等待时间
#实现搜索业务
driver.get('http://www.baidu.com') #访问百度
time.sleep(3)
# driver.find_element_by_link_text('地图').click() #选择链接地址
driver.find_ele... | true |
d3aca6994823e178008f2a541167bc32fb961ff1 | 8103713/autotesting | /pystudying/day-01/test01.py | UTF-8 | 846 | 4.21875 | 4 | [] | no_license | #coding:utf-8
"""
python学习第一天,乱七八糟
"""
name = "老K"
age = 18
#格式化输出--%%输出的就是%;%06d表示输出整数位数为6,不足补0,超过6位有多少显示多少;
# %.02f表示小数点后保留两位
print("我叫%s,今年%d啦" % (name,age))
percent = 99
print("完成了%d%%的工作量" % percent)
#获取变量类型
print(type(name))
#字符串变量计算
print("name"*2)
#拼接字符串
gender = "man"
print(name+gender)
#input函数 :获取用户通过键盘输入的内容... | true |
718779e498ad3ef729a8994df7a174d5b3980fd1 | by777/fluentPython | /CH00_补充随笔/3-1.Tensor.py | UTF-8 | 6,378 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @TIME : 2021/3/19 12:25
# @AUTHOR : Xu Bai
# @FILE : 3-1.Tensor.py
# @DESCRIPTION :
from __future__ import print_function # 通过 __future\ 导入新版本某些模块,测试新版本的新功能,等测试成功后再升级到新的版本上.
import torch as t
print('从接口的角度来说,对tensor的操作可分为两类:\n'
'torch.function,如torch.save等\n'
'tensor.function,如t... | true |
dc9e4efdbba4af6e10be4dcade731edbdebfb27e | michelleon/nfl_hackathon | /michelle_work/vectorize_routes.py | UTF-8 | 4,704 | 2.765625 | 3 | [] | no_license | import numpy as np
import json
import matplotlib.pyplot as plt
def load_rosters():
with open('data/team1.json') as f1:
team1 = json.load(f1)
with open('data/team2.json') as f2:
team2 = json.load(f2)
with open('data/team3.json') as f1:
team3 = json.load(f1)
with open('data/team4... | true |
ec2b8ec6e1ff8de44584e465b9fb0861a86cb553 | standbyme227/computer_science_bootcamp2 | /oop2/oop2_1/is_a.py | UTF-8 | 744 | 3.515625 | 4 | [] | no_license | class Computer:
"""
attributes:
CPU :
RAM :
"""
# 생성자
def __init__(self, cpu, ram):
self.CPU = cpu
self.RAM = ram
# 메소드
def browse(self):
print('browse')
# 메소드
def work(self):
print('work')
# Computer를 상속
class Laptop(Computer):... | true |
573303817c04e449e27ad85ac0a52d38dd3ee61d | matrix-profile-foundation/matrixprofile | /tests/test_datasets.py | UTF-8 | 1,375 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
range = getattr(__builtins__, 'xrange', range)
# end of py2 compatability boilerplate
import pytest
import numpy as np
fr... | true |
5fbc3f8f35899f87767a732f9f72a9c72d73048c | unior-nlp-research-group/Ghigliottina | /bot/ndb_base.py | UTF-8 | 504 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
from google.cloud import datastore
CLIENT = datastore.Client()
class NDB_Base(object):
attributes = ['key','entry']
def __getattr__(self, attr):
return self.entry.get(attr,None)
def __setattr__(self, key, value):
if key in self.attributes:
sup... | true |
61dfab9f696a520b74655d56e94ea22c3f32a666 | mateuszjenek/szum-scripts | /generate_report.py | UTF-8 | 3,040 | 2.796875 | 3 | [] | no_license | import os
import argparse
from PIL import Image
import numpy as np
import cv2
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("-d", "--directory", required=True, help="Directory with images")
arg_parser.add_argument("-o", "--output", required=True, help="Filepath where result will saved")
arg_parser.ad... | true |
5d184e2c3d0b34a3f2a346f332fd7cfc784459be | marko-knoebl/courses-code | /python/2018-11/tag1/babylonian.py | UTF-8 | 184 | 3.515625 | 4 | [] | no_license | n = 12345
a = n
b = 1
while abs(a-b) > 0.001:
# neues a
new_a = (a + b) / 2
# neues b
new_b = n / new_a
print(new_a)
print(new_b)
a = new_a
b = new_b
| true |
a421ed70658e2ff3b55b98611fddd6aa46d727bb | AnubisAbydos/Ant-Simulator | /Ant-Simulator/Ant-Simulator/ProceduralGeneration.py | UTF-8 | 3,125 | 3.859375 | 4 | [] | no_license | from random import *
import pygame
#COLORS
white = (255,255,255)
#COLORS
#Grid variables and 2d array
r, c = 100, 100
cells = [[0 for x in range(r)] for y in range(c)]
cellPixelSize = 10
#used during array construction to determine cells starting state
startAlivePercentage = 38
#variables used during simulation st... | true |
bd893af13577348e14fb48a57e43891cf44dc964 | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_3_neat/16_0_3_mervin01_c_coin_jam.py | UTF-8 | 3,228 | 2.890625 | 3 | [] | no_license | from shared.codejam_plumbing import CodeJamInput, CodeJamOutput
import pickle, math, random
scenarios = CodeJamInput('input_files\A-large.in', 1)
outfile = CodeJamOutput('output_files\A-large-output', True)
scenarios = CodeJamInput('input_files\C-sample.in', 1)
outfile = CodeJamOutput('test_output.txt', True)
... | true |
e8949426eb3f07c236a8ba254e28cb6b72136cb0 | yuncepu/pythontest | /test4/scope.py | UTF-8 | 937 | 3 | 3 | [] | no_license | def myfunc(a):
print(a)
class A:
a = 42
def print(self):
b = list(self.a + i for i in range(10))
print("A init b:",b)
c = list(A.a + i for i in range(10))
print("A init c:",c)
def setInstanceVar(self, value):
self.a = value
def selfMethod(self):
retur... | true |
9bf8a1b19fd391ba8dcc09f56355468d00448c91 | akaprosy/Hydraulic-Calculator- | /Pressure Spike.py | UTF-8 | 2,964 | 3.96875 | 4 | [] | no_license | #Pressure spike app development code
#Hydraulics
print("Cylinder formulas")
cylinder_calculator = input("""Choose a calculator
0 - Calculate Force given pressure and area
1 - Calculate Pressure given force and area
2 - Calculate Area given force and pressure
3 - Calculate Area of a cylinder given diameter
4 -... | true |
b61a60b66011b44cdbf0df99bc2f7adc3c5afc5b | quietsos/Python_course | /buildin_function/buildin_function_python.py | UTF-8 | 1,756 | 4.53125 | 5 | [] | no_license | # There are three famous buildin function in python these functions take another buildin function as their input.
# These are:
# 1. map()
# 2. filter()
# 3. reduce()
# map():
# Applies to a given function as its arguments to all the iterables and return a new list.
# syntax: map(function, itera... | true |
a5018f6ccab82eab02f110e2869d9cae00bc0ac6 | hbertsch/docker-cicd | /src/run.py | UTF-8 | 913 | 3.046875 | 3 | [
"Unlicense"
] | permissive | import requests
import json
import datetime
import os
import random
# Gets a random quote out of a collection of quotes
# (this is only for demonstration)
url = 'https://type.fit/api/quotes'
headers = {"Accept": "application/json"}
response = requests.get(url,headers=headers)
rnd = random.randint(0, len(response.json(... | true |
75acfb0a27e746ceabd68e45ca175edfb5f94ee5 | HenriqueSoares28/Python-EX | /ex097.py | UTF-8 | 154 | 3.078125 | 3 | [] | no_license | def texto(msg):
x = len(msg) + 4
print('~'*x)
print(f' {msg}')
print('~'*x)
#main
texto('Henrique França')
texto('Curso em vídeo')
texto('CeV') | true |
169771e81e94ba6dbbcef9df9699d49b4cd4b2b4 | Yvan666/Codewars | /Codes/Solved/Ones_and_Zeros.py | UTF-8 | 185 | 3.765625 | 4 | [] | no_license | def binary_array_to_number(arr):
lenght = len(arr) - 1
n = 0
for i in arr:
n += (i * 2 ** lenght)
lenght-=1
return n
binary_array_to_number([1, 1, 1, 1]) | true |
edfb6f9499cec04520bf998abb3f1e7642dd0b6f | zsantiago8712/MoniBootErrors | /archivos.py | UTF-8 | 4,881 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python3
from datetime import date
import sys, getopt
import os
def main(argv):
input_file = ""
output_file = ""
filas = 0
num_errores = 0;
guia = " \n"
last_line = " "
last2_lines = " "
last3_lines = " "
last4_lines = " "
clean_line = 0
error_dict = {}
fecha... | true |
d5d0870a98c28f078ae475dbbc7e0d501343ecc8 | daobilige-su/guts | /GPy-0.4.6/build/lib.linux-x86_64-2.7/GPy/models/fitc_classification.py | UTF-8 | 1,782 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | # Copyright (c) 2013, Ricardo Andrade
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
from ..core import FITC
from .. import likelihoods
from .. import kern
from ..likelihoods import likelihood
class FITCClassification(FITC):
"""
FITC approximation for classification
This ... | true |
6f30327e6e8ed43b372e58b01bac9d32e96fa6f8 | ksmrdn/Module02_Data_Analiytics_Visualization | /Day_2/api04.py | UTF-8 | 442 | 2.734375 | 3 | [] | no_license | import requests
kota = 'surabaya'
apikey = '&appid=3ac69e0b0e0a02c5c49186345f0ba92a'
url = f'http://api.openweathermap.org/data/2.5/weather?q={kota}{apikey}'
data = requests.get(url)
print(data)
print(data.json())
data = data.json()
sunrise = data['sys']['sunrise']
from datetime import datetime
utc = datetime.utcfromt... | true |
96c793926575f6255c31c0f368fb69d84a839a58 | Bikemech/AdventOfCode | /aoc2015/d08a.py | UTF-8 | 341 | 3.1875 | 3 | [] | no_license | import re
reghex = re.compile(r'(\\x[0-9a-f]{2})')
regesc = re.compile(r'(\\[\\\"\'])')
def strVal(string):
tot = len(string) - 2
tot -= len(reghex.findall(string)) * 3
tot -= len(regesc.findall(string))
return tot
total = 0
for i in open("d08", "r").readlines():
val = strVal(i.strip())
total += len(i.strip()... | true |
29d32e1be3fd6360888f27d36cc62c0b95429694 | toddatctera/ctera-python-sdk | /cterasdk/common/utils.py | UTF-8 | 2,223 | 3.171875 | 3 | [
"Apache-2.0"
] | permissive | import re
import logging
from .object import Object
def union(g1, g2):
"""
Create a union of two lists, without duplicates.
:return list: the union of the two lists
"""
return g1 + list(set(g2) - set(g1))
def merge(d1, d2):
"""
Merge two dictionaries. In case of duplicate keys, this fu... | true |
4e73741c5f87daeaeb980c18136d82781b32fa1f | sagieppel/Materials-in-Vessels-data-set | /Data_Reader.py | UTF-8 | 4,482 | 2.578125 | 3 | [
"MIT"
] | permissive | import numpy as np
import os
import scipy.misc as misc
import random
#------------------------Class for reading training and validation data for materials in vessels data set---------------------------------------------------------------------
class Data_Reader:
################################Initiate folders were ... | true |
558ec5a5dcdd7e3afccc1bf9de0a5523df9528ee | JacobLondon/pyfs | /filesystem.py | UTF-8 | 6,050 | 2.640625 | 3 | [] | no_license | import errno
import importlib
import json
import os
import signal
import socket
import socketserver
import sys
from threading import Semaphore
from typing import Dict, List
try:
from .filetypes import File
except:
from filetypes import File
_MAX_DESCRIPTORS = 128
class FileSystem:
def __init__(self):
... | true |
a5c28dafacd5bc54c66eac7d2045dc7da69ad882 | bobcaoge/my-code | /python/leetcode/1139_Largest_1-Bordered_Square.py | UTF-8 | 2,246 | 3.046875 | 3 | [] | no_license | # /usr/bin/python3.6
# -*- coding:utf-8 -*-
class Solution(object):
def largest1BorderedSquare(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
ret = 0
if max([max(x) for x in grid]) == 1:
ret = 1
row = len(grid)
col = len(gri... | true |
bfb80e45e097dba4b98bcc8ccce89cd34d13fecf | aashray18521/fyndHackingChallenge_IMDB | /movie/imdb/models.py | UTF-8 | 546 | 2.546875 | 3 | [
"MIT"
] | permissive | from django.db import models
class Genre(models.Model):
"""
Genre model
"""
name = models.CharField(max_length=256, db_index=True)
def __str__(self):
return self.name
class Movie(models.Model):
"""
Movie model
"""
popularity = models.FloatField()
director = models.Ch... | true |
6f94f2478a2939c7d8c8ff2c4e92c4ccc149ec83 | Reallife101/CPE202 | /lab3-Reallife101/queue_tests.py | UTF-8 | 1,842 | 3.46875 | 3 | [] | no_license | import unittest
from queue_array import Queue
# from queue_linked import Queue
class TestLab1(unittest.TestCase):
def test_queue(self):
"""Trivial test to ensure method names and parameters are correct"""
q = Queue(5)
q.is_empty()
q.is_full()
q.enqueue('thing... | true |