blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
f4bd0ef1a27d6df2ee5626946f06d82ff83555c9 | Python | RustPython/RustPython | /Lib/uuid.py | UTF-8 | 27,461 | 3.28125 | 3 | [
"CC-BY-4.0",
"MIT",
"Python-2.0"
] | permissive | r"""UUID objects (universally unique identifiers) according to RFC 4122.
This module provides immutable UUID objects (class UUID) and the functions
uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5
UUIDs as specified in RFC 4122.
If all you want is a unique ID, you should probably call uuid1() ... | true |
52964d7d57b392017118148cac222db6268372cd | Python | jonghyuk/python_report | /python/slice/slicelist.py | UTF-8 | 188 | 3.3125 | 3 | [] | no_license | numbers = list(range(10))
numbers[1:3]=[77,88,99,1010,1111]
#1번째에서 3번째 전까지 사이값에 넣음
numbers[8:9]=[333,444]
#8번째 와 9번째 전까지 넣음
print(numbers) | true |
369b5db6f7b7d953278e63819c031053bac7b83f | Python | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/225/users/4009/codes/1590_1446.py | UTF-8 | 52 | 3.109375 | 3 | [] | no_license | Ana=float(input("Litros: "))
print(round(Ana/3,3))
| true |
1f9f47f9784348ff6d5dfe3c8500f42293ec79c0 | Python | MJHutchinson/neural-processes | /src/datagen/product_gpcurve.py | UTF-8 | 8,726 | 2.9375 | 3 | [] | no_license | import collections
from torch import eye, randint, int32, arange, Tensor, float32, sqrt
import torch
from abc import abstractmethod
from src.utils import NPRegressionDescription
from src.datagen.kernels import rbf_kernel, matern_kernel, generate_lengthscale_sigma_f
import numpy as np
class ProductRBFCurvesReader(objec... | true |
2c72c0facd33abccf950775cf5a88dfe8d5dec39 | Python | jibinsamreji/Python | /MIni_Projects/calculator.py | UTF-8 | 2,418 | 4.875 | 5 | [] | no_license | # Calculator which does basic calculations created using functions
print("\n \n------------------------- WELCOME! ------------------------- \n")
print("CAL BUDDY IS READY TO ASSIST YOU WITH YOUR CALCULATIONS :)\n")
def ops():
import sys
import math
print("\nWhat operation would you like to do now: \nPle... | true |
93065dba4ad61b4f45bb64b391eb88561cfcf3cb | Python | jonbodart/pyliar | /pyliar/client.py | UTF-8 | 524 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import logging
import socket
from messages import *
class Client:
def __init__(self, remote_addr, port):
self.remote_addr = remote_addr
self.port = port
self.handle_connection()
def handle_connection(self):
logging.debug("New Client")
logging.debug("Connecting to remo... | true |
c083b61d982d80efc3703b04b18715313f62d1a0 | Python | Aravind-Chowdary/Final_Project | /Evaluation_Boldyreva.py | UTF-8 | 439 | 2.59375 | 3 | [] | no_license |
from Boldyreva import *
import time
key = OPE.generate_key(32)
OPE = OPE(key, in_range=ValueRange(1, 2 ** 16 - 1), out_range=ValueRange(1, 2 ** 31 - 1))
i = 0
total = 0
num = 10000
f = open('rands.txt', 'r')
while i < num:
w = f.readline()
m=int(w)
start = time.time()
d=OPE.encrypt(m)
end = tim... | true |
d1db4e3b1abf0ef7fb39ca2a4496d28986b2d9c7 | Python | pythonpad/vue-pythonpad-runner | /static/brythonlib/cs1robots/robot/json_drawer.py | UTF-8 | 1,388 | 2.953125 | 3 | [
"MIT"
] | permissive | from .drawer import Drawer
from time import sleep
import json
class JsonDrawer(Drawer):
def __init__(self):
super().__init__()
def print(self, s):
print(s)
def print_dict(self, out_dict):
self.print(out_dict)
def draw(self, width, height, pieces, walls):
self.prin... | true |
b8cc46ae920cde016b89a6854b71076c57d07a09 | Python | IceXPR/web-ethereum-mining | /scratchwork/dag-partial-cache-store-miner-hashmap/server.py | UTF-8 | 4,040 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
import sys, socket, threading, traceback, json,random,logging,sha3
# bind to port
port = 9000
FOUND_ANS = False
def mkcache(cache_size, seed):
o = [[random.randint(0,100) for i in range(16)] for i in range(262139)]
return o
class network_thread(threading.Thread):
def __init__(self, ... | true |
262925c414773fe0ea3d28b7051a391c4fe4ebfb | Python | huijia11223/spider_program | /bibi/bibi/spiders/userinfo.py | UTF-8 | 1,244 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
import json
from bibi.items import BibiItem
class UserinfoSpider(scrapy.Spider):
name = 'userinfo'
allowed_domains = ['live.bilibili.com']
start_urls = ['https://api.live.bilibili.com/room/v1/area/getRoomList?platform=web&parent_area_id=2&cate_id=0&area_id=0&sort_type... | true |
fb896410e1271a213ebe703caefe261752993395 | Python | tomxey/hikari | /hikari/utilities/mapping.py | UTF-8 | 10,820 | 2.78125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# cython: language_level=3
# Copyright (c) 2020 Nekokatt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights... | true |
961ba8dda96a2226386421180c16335d7dbcd5ca | Python | RajeshPoojary/Logistic_Regression_Softmax_loss | /Logistic_Regression_Softmax_loss.py | UTF-8 | 2,406 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import math
data = []
labels = []
regc=0.1
learning_rate=0.1
s = np.zeros(3)
data.append([0.5, 0.4])
data.append([0.8, 0.3])
data.append([0.3, 0.8])
data.append([-0.4, 0.3])
data.append([-0.3, 0.7])
data.append([-0.7, 0.2])
data.append([0.7, -0... | true |
b11e9afe68f09ef982ab02bb0f138a9b97513cdf | Python | Aurora12SDD2019/12sdd-repository-MattJohnson111 | /mods.py | UTF-8 | 2,067 | 3.875 | 4 | [] | no_license | """ Modules of Standard algorithms function for the SDD course.
This script will contain functions corresponding to all of the standard
algorithms listed in the course specs for the HSC SDD course
"""
__author__ = "Matthew Johson"
__license__ = "GPL"
__version__ = "1.0.1"
__email__ = "matthew.johnson111@educ... | true |
03a2f90599c52a291fa7972b0fcd4fab85821970 | Python | shaivamkale/pythonProject | /Week2_1.py | UTF-8 | 1,968 | 5.25 | 5 | [] | no_license | # Week 2 - Assignment 1: Finding your dog’s age relative to you
# Create a program that asks for user input their first name, last name and birth year. Based on
# the input you should display the user’s full name, initials and the calculated age in human
# and dog years (The formula for calculating age in dog years ... | true |
87f7407fcf2a822447ea0d4d21b2bf3eab81eecb | Python | dxcv/Forex-Research | /STATS/Basic.py | UTF-8 | 325 | 2.8125 | 3 | [] | no_license | import numpy as np
import pandas as pd
class cal_returns(object):
def __init__(self, data):
self.data = data
@staticmethod
def ret(price):
r = price/price.shift(1) - 1
return r.dropna()
@classmethod
def multi_rets(cls, prices):
return prices.apply(lambda x: cls.ret... | true |
71614e8bd10579a51329c46bf383e1356d08c6b0 | Python | TeaDog0029/WebApp | /SocialRep/SocialRep/AppOne/ftse100_api.py | UTF-8 | 2,290 | 2.546875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pylab
import datetime as dt
import urllib
import numpy as np
import matplotlib.dates as mdates
import os
import sys
# consumer_key = "dj0yJmk9bEQwNmhTUkphbDFnJmQ9WVdrOU1IZEZRM0psTXpJbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1mZQ--"
# consumer_secret = "e562b8fb1c231bf89d70b562c86729... | true |
d275a7e43c7bb7165277c86c34b7ac4dac9b5c95 | Python | dayes/curso_Python | /SOLUCIONES/SOLUCIONES/intermedio I/funcional/list_compresion.py | UTF-8 | 700 | 3.890625 | 4 | [] | no_license | # List compresion
# Potencias de 2:
L = [2**i for i in range(0,20)]
print ("POTENCIAS DE DOS")
print (L)
# Numeros pares del 0 al 100
L2 = [i for i in range(0,100) if i % 2 == 0]
print ("\nPARES DEL 0 AL 100")
print (L2)
# los numeros que no estan en la lista anterior:
L3 = [i for i in range(0,100) if i... | true |
19464931888227780f38d0c0b9d48eeb6858ea6a | Python | plkx/mordred | /docs/scripts/gen_default_descs.py | UTF-8 | 1,949 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | import sys
from distutils.version import StrictVersion
import load_path
from mordred import Descriptor, __version__, descriptors, get_descriptors_in_module
load_path.nop()
prelude = """
Descriptor List
===============
preset descriptors
.. code:: python
calc = Calculator(descriptors)
.. csv-table:: Descriptor... | true |
27eefd3b63ab0775b2d1e64771cc9c263ef00a20 | Python | VMarty/CityEnergyAnalyst | /cea/technologies/substation.py | UTF-8 | 39,523 | 2.703125 | 3 | [
"MIT"
] | permissive | """
Substation Model
"""
from __future__ import division
import time
from cea.constants import HEAT_CAPACITY_OF_WATER_JPERKGK
import numpy as np
import pandas as pd
import scipy
from cea.technologies.constants import DT_HEAT, DT_COOL, U_COOL, U_HEAT
__author__ = "Jimeno A. Fonseca"
__copyright__ = "Copyright 2017, Ar... | true |
43b9897ae4e58d56c41feea52a0432a59465e15c | Python | hsuweibo/lc-problems | /332-FindItinerary.py | UTF-8 | 1,926 | 3.46875 | 3 | [] | no_license | import unittest
class Solution:
def findItinerary(self, tickets):
# An adjacency list. Each item in the list is a list: [dest, used].
# The used field tracks whether or not the edge is used in the current path during DFS
adj_list = dict()
for i in range(len(tickets)):
e... | true |
8e954e3f70deca0d0338e8b8409c6b004c8fd21b | Python | h9ri/ML_Models | /knn.py | UTF-8 | 4,357 | 2.671875 | 3 | [] | no_license | import math
import numpy as np
class KNN:
def __init__(self,k_near,num_train,num_test,num_feat):
self.X_train=np.zeros((num_train,num_feat))
self.Y_train=np.zeros(num_train)
self.X_test=np.zeros((num_test,3))
self.Y_test=np.zeros(num_test)
self.k=k_near
self.... | true |
e5ad646bd92009dc7a49f4fc39b6993b9a138d7c | Python | namhai923/Daily-Problem | /remove-kth-last/remove-kth-last.py | UTF-8 | 791 | 3.875 | 4 | [] | no_license | class Node:
def __init__(self, value, next = None):
self.val = value
self.next = next
def __str__(self):
current_node = self
result = []
while current_node:
result.append(current_node.val)
current_node = current_node.next
return s... | true |
8d29b82829ec57af0d1006007ae21904e9426bf9 | Python | trendmanagement/tmqrexo_alexveden | /exobuilder/data/assetindex_mongo.py | UTF-8 | 2,690 | 2.5625 | 3 | [] | no_license | from .assetindex import AssetIndexBase
import pymongo
from pymongo import MongoClient
class AssetIndexMongo(AssetIndexBase):
def __init__(self, conn_str, dbname):
self.client = MongoClient(conn_str)
self.db = self.client[dbname]
self.db.options.create_index([("idoption", pymongo.DESCENDIN... | true |
0dcd4ad26efd706882f469d72dd3bab47f06bb73 | Python | kdw9502/capstone_design_class_extra | /mask-api.py | UTF-8 | 583 | 2.921875 | 3 | [] | no_license | import requests as re
from haversine import haversine
json_data = re.get('https://8oi9s0nnth.apigw.ntruss.com/corona19-masks/v1/stores/json').json()
store_infos = json_data['storeInfos']
my_location = (37.505360, 126.901104) # latitude, longitude
distance_limit_km = 3
for store_info in store_infos:
store_locati... | true |
3dd80ff41817548694d7487d6036361c65737071 | Python | hukeyy/learn_python | /day19-1/test.py | UTF-8 | 1,024 | 3.625 | 4 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# Author: hkey
# values = [11, 22, 33, 44, 55, 66, 77, 88, 99, 90]
#
# my_dict = {}
#
# for value in values:
# if value > 60:
# if 'k1' in my_dict:
# my_dict['k1'].append(value)
# else:
# my_dict['k1'] = [value, ]
# elif value <... | true |
bac33a134b98286f4b435143caf02709e0370741 | Python | madleysk/cours_python_web | /modules/auth.py | UTF-8 | 254 | 2.859375 | 3 | [] | no_license | import hashlib
def pass_hashing(pwd):
pwd = pwd.encode()
h_pass= hashlib.sha512(pwd)
return h_pass.hexdigest()
def pass_verify(clear_pass, pass_sha512):
h_pass = pass_hashing(clear_pass)
if (h_pass == pass_sha512):
return True
else:
return False
| true |
28d48723be2faf0fc5406f7732392248fdd162f6 | Python | jtwhite79/my_python_junk | /gather/gathered/broward_nwis_plot_ts.py | UTF-8 | 3,462 | 2.515625 | 3 | [
"BSD-2-Clause",
"BSD-Advertising-Acknowledgement"
] | permissive | import os
import pylab
import pandas
import pestUtil
def build_plotname(filename):
raw = filename.split('.')
raw[-1] = 'png'
return '.'.join(raw)
#--plot directory
plt_dir_navd = 'png\\navd\\'
plt_dir_conc = 'png\\conc\\'
navd_dir = 'smp_waterlevel_navd\\'
navd_files = os.listdir(navd_dir)
chl_dir = 'sm... | true |
4e7f32e60c833ae7e6198cfa7b560af05a12852b | Python | aanojima/musicreader | /src/modules/util.py | UTF-8 | 1,345 | 3.453125 | 3 | [] | no_license | '''
Utilities for:
1) retrieving image based on bounding box (might be a duplicate to Aaron?)
2) padding image with white if not square
'''
import cv2
import object_segment3
def get_image_from_bb(bb_tuple, original_image):
(x,y,w,h) = bb_tuple
crop_img = original_image[y:y+h, x:x+w] # Crop from x, y, w, h
... | true |
a1c6ae1e6749e95863f3093a1c07577ac642cc65 | Python | monikarogulska/University-projects | /very_basic_Mario_game/mario.py | UTF-8 | 25,887 | 2.578125 | 3 | [] | no_license | from xml.dom.minidom import Document
from PyQt5 import QtGui, QtCore, QtTest
import sys
from PyQt5.QtGui import QBrush, QPen, QColor
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import *
from xml.dom import minidom
import json
class Window(QMainWindow):
i = 0
posy = 0
top = False
money = 0
mo... | true |
97f11962db38730be5a7e3bd2192e77b34b51c33 | Python | hanzhi713/Image-Transformation | /img-trans-single-thread.py | UTF-8 | 2,132 | 3.140625 | 3 | [
"MIT"
] | permissive | import numpy as np
import cv2, time
import matplotlib.pyplot as plt
def transform(x, y, orgX, orgY):
c = complex(x - orgX, y - orgY)
return c ** 1.2
const = np.array([256, 256, 256], np.int16)
# convert the sparse matrix dictionary (mapping (x, y) to (b, g, r)) to a numpy three dimensional array
def toMat... | true |
cbe8d8d258d015042e43ff982c5f4391399c80d0 | Python | vxda7/pycharm | /Algorithm 190909/subtree.py | UTF-8 | 562 | 2.84375 | 3 | [] | no_license | def find(children, cnt, root): # root를 부모로 가진 자식의 갯수 반환
for i in range(len(children)):
if children[i] == root:
cnt += find(children, 1, i)
return cnt
t = int(input())
for tc in range(1, t + 1):
E, N = map(int, input().split())
nodes = list(map(int, input().split()))
children =... | true |
73e6c12b0c6248adfbfa010982f85cd5e507cdea | Python | redhat-openstack/packstack | /packstack/installer/utils/shortcuts.py | UTF-8 | 1,694 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
# 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 writing, software... | true |
f50fb37519acc821e2336994d04eec3413b76d35 | Python | ednaelxd/aulas_pyhon | /pertence_circulo.py | UTF-8 | 859 | 3.6875 | 4 | [] | no_license | xc = float ( input('Digite a coordenada x do centro da circunferência: '))
yc = float ( input('Digite a coordenada y do centro da circunferência: '))
raio = float ( input('Qual o tamanho do raio da circunferência:? '))
xp = float ( input('Digite a coordenada x ponto: '))
yp = float ( input('Digite a coordenada y ponto... | true |
c9c50acf9758ad2cd04c19e3d3edc58d2e0cfb78 | Python | gdsa-upc/PicZam | /S3/SIFT.py | UTF-8 | 542 | 2.765625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import cv2
import matplotlib.pyplot as lt
import sys
img = cv2.imread ('C:/Users/Victor Pacheco Garci/Desktop/UPC/2017-18/GDSA/Team5/Farmacia Albinyana/farmacia_albinyana_101.jpg',1)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
sift = cv2.SIFT()
# busca directament els punts clau ... | true |
2f3d9370371ad1a4c38150380e3a8a8834f4eae8 | Python | muhammaduamirkhalid/Assignment-1 | /even odd.py | UTF-8 | 162 | 4.25 | 4 | [] | no_license | n = int(input("Enter your number here: "))
a = n % 2
if a > 0:
print('\n' + str(n) + " " + "is odd")
else:
print('\n' + str(n) + " " + "is even")
| true |
09afaffae4658dd8eb5dc0a9a0e2c3325088fe54 | Python | votti/covid-viz | /1_data_switzerland_overview.py | UTF-8 | 14,558 | 2.640625 | 3 | [
"MIT"
] | permissive | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.3.4
# kernelspec:
# display_name: Python [conda env:covid]
# language: python
# name: conda-env-covid-py
# ---
# %% [markdown]
# # Data o... | true |
99959a58cfdd08d7ab42d5c729ab98aba1557e6b | Python | wootfish/cryptopals | /challenge_43.py | UTF-8 | 4,421 | 2.734375 | 3 | [] | no_license | from random import SystemRandom
from hashlib import sha1
from typing import Optional, Tuple
from challenge_39 import invmod
rng = SystemRandom()
class BadKError(Exception): pass
class DSA:
# using parameters from problem statement
p = int("800000000000000089e1855218a0e7dac38136ffafa72eda7"
"8... | true |
6ded95e6693b0f22cc617081fa5b925bf9c858bf | Python | btrsbols/EmbeddedSys | /SimpleClient.py | UTF-8 | 974 | 2.65625 | 3 | [] | no_license | import socket
import sys
import pickle
import time
import utils
import math
import os
def FetchPrivateKey(file):
return utils.RSAFetchKeyFromFileTxt("d"+str(file)), utils.RSAFetchKeyFromFileTxt("n"+str(file))
def main():
keyNumb = 11000 # name of the key
d, n = FetchPrivateKey(keyNumb)
soc = socket.s... | true |
979db0402bacee11e466778e7c90b08b70c5afbc | Python | leidian99999/scrapy | /project_spiders/isdin.com/test_list.py | UTF-8 | 1,953 | 2.6875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import pandas as pd
url = "https://www.isdin.com/producto/"
def get_product_list(url):
request = requests.get(url)
request.encoding = 'utf-8'
soup = BeautifulSoup(request.content,'lxml')
detail_url = []
title1 = []
title2 = []
title3 = []
i... | true |
54cadc0fd50c046d567c94203a5390ce519e4fdc | Python | dcheung15/Python | /ecs102/Labs/Lab7p1.py | UTF-8 | 1,819 | 4.125 | 4 | [] | no_license | #lab7p1
#Doung Lan Cheung.
#Set up a window using user defined coordinates
#Draw Oval, explore copying an Oval using = (assignment)
# versus using .clone()
from graphics import *
def main():
#Set up the graphic window
win=GraphWin("Lab 7",400,600)
win.setBackground("lightyellow")
#I want the he... | true |
a659c28e8160f856ef0332e62e43b19eff290c45 | Python | PkuRainBow/vimpac | /video2token/utils/lmdb_utils.py | UTF-8 | 1,316 | 2.703125 | 3 | [] | no_license | import lmdb
import numpy as np
import io
def save_np_array_to_lmdb(lmdb_txn, key, np_array):
"""serialize numpy array and save it lmdb
Some notes on np array to strings:
https://stackoverflow.com/questions/25837641/save-retrieve-numpy-array-from-string
"""
in_mem_file = io.BytesIO()
np.sa... | true |
5433c826adb344d24f245d0a4de4a5ea3c376256 | Python | malep2007/healtid-web-api | /healthid/tests/authentication/test_update_user.py | UTF-8 | 2,885 | 2.515625 | 3 | [] | no_license | import json
from django.test import Client, TestCase
from healthid.apps.authentication.models import User
class UserUpdateTestCase(TestCase):
def setUp(self):
self._client = Client()
self.user = User.objects.create_user(
email="shadik.ntale@andela.com",
password="Echo-pwn... | true |
c5656c4e18a9123e6159e7b3824a47dc6bb0b9a5 | Python | johnStauffer/remote-tomcat-log-parser | /log_processor.py | UTF-8 | 7,010 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python
import datetime
import logging as logger
import os
import re
import file_utils
import parse_logs
class LogProcessor:
def __init__(self):
self.fu = file_utils.FileUtil()
self.parser = parse_logs.Parser()
self.log_dir = 'logs/'
logger.basicConfig(filename='app... | true |
f256af040a8eb5d1259346a18f8adc78be73c964 | Python | coucoulesr/advent-of-code-2019 | /03-Crossed-Wires/03-2-Soln.py | UTF-8 | 3,376 | 3.796875 | 4 | [] | no_license | class WireGrid():
def __init__(self, directionArray=[]):
"""Takes an array of directions and populates a dictionary with keys corresponding to (y, x) positions
the wire visits and values corresponding to the number of steps the wire takes to get there.
"""
self.wirePosDict = {}
... | true |
3cb6cd98047f26780ec75ab1cdc2aed790882d74 | Python | dimitar-petrov/terra-sdk-python | /tests/core/coin_test.py | UTF-8 | 2,859 | 3.265625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import pytest
from terra_sdk.core import Coin, Dec
def test_multiple_amount_types():
ref = Coin("uluna", 1000)
assert ref == Coin("uluna", 1000)
assert ref == Coin("uluna", "1000")
def test_deserializes_coin():
coin = Coin.from_data({"denom": "uluna", "amount": "1000"})
assert coin.denom == "u... | true |
0c80ae6f7adca34a3575b6d3eef0882d1f1fd4eb | Python | mcouthon/Mofel | /parsers.py | UTF-8 | 2,338 | 2.78125 | 3 | [] | no_license | from bs4 import BeautifulSoup
class ParserFactory(object):
def __init__(self):
self._domain_to_parser = {'minimalistbaker.com': MinimalistBakerParser()}
def get_parser(self, domain):
return self._domain_to_parser.get(domain, None)
class Parser(object):
def __init__(self):
self._bs = None
def parse_html(... | true |
833be31dfb6974eb501781a4ae54d099f9cab0da | Python | ITBOX-ITBOY/learningRepository | /官网pythoni学习/python流程控制/forDir/for.py | UTF-8 | 160 | 3.125 | 3 | [] | no_license | numbers = [6, 5, 3, 8, 4, 2, 5, 4, 11];
sum=0;
for i in numbers:
sum=sum+i;
print("我是总和\t",sum);
else:
print("没有要打的东西的了"); | true |
263f7970d20a0b18a9f063d5cfcded37e987663a | Python | pranurs/regression-model | /linear_regression.py | UTF-8 | 11,403 | 3.875 | 4 | [] | no_license | import pandas as pd
import numpy as np
from tqdm import tqdm, tqdm_notebook
class Regression_Model :
'''
A class used to represent a polynomial regression model in two variables.
~~~~~~~~~~~~~~~
Attributes
------------
featureMatrix : the matrix containing features as columns according to the degree of pol... | true |
c9f85a74b05f8c2f851f5725bc1ed6e037b219b6 | Python | Shanshan-IC/MachineLearningNotes | /06_decision_tree/codes/decision_tree_regression.py | UTF-8 | 711 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from decision_tree import DecisionTree
from info_cal import *
class DecisionTreeRegression(DecisionTree):
def cal_variance_reduction(self, y, y1, y2):
var_total = cal_variance(y)
var_1 = cal_variance(y1)
var_2 = cal_variance(y2)
varianc... | true |
8909f8481448091f361f2ac6dd93f25adbc1fbeb | Python | riyadhswe/Python_Javatpoint | /16 Python Set/Using subtraction.py | UTF-8 | 157 | 3.625 | 4 | [] | no_license | Days1 = {"Monday", "Tuesday", "Wednesday", "Thursday"}
Days2 = {"Monday", "Tuesday", "Sunday"}
print(Days1-Days2) #{"Wednesday", "Thursday" will be printed} | true |
644ee8bb91a532f3f7d7f0bd342da7299fc61a5a | Python | syurskyi/Algorithms_and_Data_Structure | /_algorithms_challenges/codeabbey/_CodeAbbeyPythonSolutions-master/sum_of_digits.py | UTF-8 | 347 | 3.5625 | 4 | [] | no_license | amount_values = int(input())
results = []
def calc(A, B, C):
return A*B+C
def sum_digits(num):
sum = 0
while(num != 0):
sum = sum + (num % 10)
num //= 10
return sum
for i in range(amount_values):
A, B, C = map(int, input().split())
num = calc(A,B,C)
results.append(sum_digi... | true |
e3359660fa9fd421ca4d1340872afd89fd4f8bf2 | Python | slamatik/codewars | /5 kyu/Vecotr Class 2 5 kyu.py | UTF-8 | 1,330 | 3.515625 | 4 | [] | no_license | class Vector:
def __init__(self, *args):
if len(args) == 1:
self.x = args[0][0]
self.y = args[0][1]
self.z = args[0][2]
self.magnitude = (self.x ** 2 + self.y ** 2 + self.z ** 2) ** 0.5
else:
self.x = args[0]
self.y = args[1]
... | true |
8218e1cf698312c983838bf23fe4acfca416c355 | Python | joewen85/python-1 | /flask/api/jsonrpc.py | UTF-8 | 1,165 | 2.703125 | 3 | [] | no_license | #coding:utf-8
from flask import Flask, request
from flask_jsonrpc import JSONRPC
app = Flask(__name__)
jsonrpc = JSONRPC(app, '/api')
# 响应无参数传入的method
@jsonrpc.method('App.index')
def index():
return 'hello world.'
# 响应有指定参数传入的method
@jsonrpc.method('App.name')
def name(name):
return 'hello %s.' % name
# 响... | true |
780ac1aa923f0e430df0a52a034c119f63279bfa | Python | f0rtung/wargaming_test_task | /server/serverapp/Responses/ItemsResponse.py | UTF-8 | 357 | 2.859375 | 3 | [] | no_license | from .BaseResponses import SuccessResponse
class ItemsResponse(SuccessResponse):
def __init__(self, items):
super().__init__()
self._items = items
def as_dict(self):
response = super().as_dict()
response['items'] = [
item.as_dict()
for item in self._ite... | true |
f4977e24213b976fc953a0e82ce5e5e86dce8ecd | Python | leelasd/tutorials-1 | /mod_frcmod/mod_frcmod.py | UTF-8 | 14,182 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import os, shutil
import traceback, sys, re
from subprocess import call
import pandas as pd
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from collections import defaultdict
from collections import OrderedDict
import parmed as pmd
from collections import defaultdict
import nump... | true |
07386eda0829b1c2dd5daacfbd3baa1a8bdf5881 | Python | amal20-meet/y2s19-databases | /knowledge_databases.py | UTF-8 | 1,268 | 2.609375 | 3 | [
"MIT"
] | permissive | from knowledge_model import Base, Knowledge
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
engine = create_engine('sqlite:///knowledge.db')
Base.metadata.create_all(engine)
DBSession = sessionmaker(bind=engine)
session = DBSession()
def add_article(topic,name,rating):
Narticle = Knowle... | true |
58e688343ba3eeabd28fbfb00f1574810884bb4f | Python | mrymsadeghi/MBI_registeration | /functionMapping.py | UTF-8 | 8,605 | 2.546875 | 3 | [] | no_license |
import os
import numpy as np
import cv2 as cv
def extract_index_nparray(nparray):
index = None
for num in nparray[0]:
index = num
break
return index
def funcLandmarkDetection(imgpath, midheight):
LandmarksT = []
tissueimg = cv.imread(imgpath)
timg_gray = cv.cvtColor(tissue... | true |
d0d1ee666d644e55b30bafc4605e1af89b4c41e7 | Python | xiaohai0520/Machine-Learning | /music_recommend/getInfoFromJson.py | UTF-8 | 1,229 | 2.78125 | 3 | [] | no_license | #coding: utf-8
import json
import sys
def parse_song_line(in_line):
data = json.loads(in_line)
name = data['result']['name']
tags = ",".join(data['result']['tags'])
subscribed_count = data['result']['subscribedCount']
if (subscribed_count < 100):
return False
playlist_id = data['result'... | true |
fdf67aa958865ef16f303077a2764c36114dd374 | Python | mjsmith95/Battleship-AI | /backend/load_ships.py | UTF-8 | 1,817 | 3 | 3 | [] | no_license | def load_carriers():
carriers = []
for i in range(10):
for j in range(6):
h_start = i*10 + j
v_start = j*10 + i
carriers.append((h_start, h_start+1, h_start+2, h_start+3, h_start+4))
carriers.append((v_start, v_start+10, v_start+20, v_start+30, v_start+40)... | true |
57ac7d5c4fd6d75860bab89fd1ef745ee2efdb30 | Python | QuantLet/DEDA_Class_2017 | /DEDA_Class_2017_Condition&Iteration/DEDA_Class_2017_Condition&Iteration.py | UTF-8 | 2,854 | 4.75 | 5 | [] | no_license | """
Introducing the Condition and Iteration in Python
"""
"""
Condition
"""
# if() takes 1 argument to evaluate if the argument is True or False
bool_seq = [True, False, 0, 1, -1, 100, '', (), [], {}, [False], [True]]
# False, 0, empty sequence will be evaluated as False
for bool_smb in bool_seq:
if bool_smb:
... | true |
b89dd063c5b9e89f1704a3e7c2aaf30acfda93fe | Python | AABHINAAV/python-study | /doc-string.py | UTF-8 | 257 | 3.578125 | 4 | [] | no_license | # every function in python has string in written in it that defines what it do
print(len.__doc__)
# making user defines doc sting
def fun(a,b):
'''this function returns the sum of 2 numbers passed'''
return a+b
print(fun(10,20))
print(fun.__doc__) | true |
ed59ca3492bbb3067029790bef15ec0826371bba | Python | abdrysdale/blind-chess | /index.py | UTF-8 | 3,792 | 3.171875 | 3 | [] | no_license | import re
import sys
import chess
import chess.uci
from stockfish import Stockfish
import chess.pgn
from pprint import pprint
# Here you need to add the path to stockfish or some other uci engine(that will probably work)
engine = Stockfish("/usr/bin/stockfish")
san_regex = re.compile('([KQNBR]([a-h][1-8])?x)?[KQNBR]... | true |
bc70ee8700112ae59ba4673a4f623fc195a027c5 | Python | rsiverd/kwhere | /skysquares.py | UTF-8 | 12,778 | 3.109375 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
# vim: set fileencoding=utf-8 :
#
# Test codes to project squares onto celestial sphere, i.e., given the
# center and dimensions of a rectangular FOV, directly compute RA,Dec border
# coordinates.
#
# Rob Siverd
# Created: 2013-12-13
# Last modified: 2018-05-23
#--------------------------... | true |
c688fdfc1c7260c20b73cfaff2240d9a28db796b | Python | Ruchithaakula/Python_Assignment4 | /Assignment4_reverse a string.py | UTF-8 | 252 | 3.546875 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[13]:
def reverse(str):
s = ""
for ch in str:
s = ch + s
return s
mystr = "RUCHITHA AKULA"
print("Given String: ", mystr)
print("Reversed String: ", reverse(mystr))
# In[ ]:
# In[ ]:
| true |
dbf0eb435dd71752b9c4b3d856f60d09b51f2c48 | Python | waywaywayw/printeset- | /picSpider_WAY_v1.49/selenium_webdriver/PhantomJS.py | UTF-8 | 1,605 | 2.515625 | 3 | [] | no_license | from selenium import webdriver
# 引入配置对象DesiredCapabilities
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
def webdriver_PhantomJS() :
# 模拟浏览器..获取页面...
dcap = dict(DesiredCapabilities.PHANTOMJS)
# 从USER_AGENTS列表中随机选一个浏览器头,伪装浏览器
ua = 'Mozilla/5.0 (Windo... | true |
a224b0db4c8f6edcfbf08de7222d885045449232 | Python | sarveshsiras/Digitization-of-Invoices | /s3_image_download.py | UTF-8 | 252 | 2.609375 | 3 | [] | no_license | import numpy as np
import urllib.request
import cv2
def url_to_image(url):
resp = urllib.request.urlopen(url)
image = np.asarray(bytearray(resp.read()), dtype="uint8")
image = cv2.imdecode(image, cv2.IMREAD_COLOR)
# return the image
return image | true |
e6533da515a7715881c45262212cc467fc422897 | Python | lizaboiarchuk/ball-path | /Graph.py | UTF-8 | 3,800 | 3.671875 | 4 | [] | no_license | from Node import *
from Matrix import *
class Graph:
def __init__(self, matrix):
self.matrix = matrix
self.graph = self.build_graph()
self.cost = 1 # we will define cost '1' for all movements, because they are equal
self.moves = {(1, 0): 'D',
(-1, 0): 'U',
... | true |
72dd52353608a7408ee8bc361a789d49f110f4ea | Python | ikyzmin/autotest_assignments | /dublicate_success_incorrect_test.py | UTF-8 | 255 | 2.5625 | 3 | [] | no_license | import unittest
from lists import *
class TestList(unittest.TestCase):
def test_duplicate_success_incorrect(self):
self.assertNotEqual([1,2,3,4,5,6,7,7,8,8,9,9,10,10],duplicate([1,2,3,4,5,6,7,8,9,10],5))
if __name__ == '__main__':
unittest.main()
| true |
0a993e977c387960f3590cda93e9d6811b54928b | Python | andnp/SoftmaxPolicies | /src/utils/random.py | UTF-8 | 757 | 3.3125 | 3 | [] | no_license | import numpy as np
# way faster than np.random.choice
# arr is an array of probabilities, should sum to 1
def sample(arr):
r = np.random.rand()
s = 0
for i, p in enumerate(arr):
s += p
if s > r or s == 1:
return i
# worst case if we run into floating point error, just retur... | true |
3c68148f435c3dfa2075ea2117b7d9e8dcfa51f1 | Python | ghidra/dayfornight | /parse_rain.py | UTF-8 | 348 | 2.671875 | 3 | [] | no_license | lines = [line.rstrip('\n') for line in open('rain.txt')]
counter =0
s=""
for l in lines:
n = []
for t in l.split():
try:
n.append(float(t))
except ValueError:
pass
if counter == 0:
s+=str(n[len(n)-1])+" "
if counter == 1:
s+=str(n[0])+":"+str(n[1])+"\n"
if counter == 2:
print s
... | true |
28bfa3e3bcd0cfee7219e4e70b542a84fa58ea12 | Python | Kimhyeonsuk/Programmers_Python | /python_Algorithm/DoblePriorityQueue.py | UTF-8 | 490 | 2.796875 | 3 | [] | no_license | from collections import deque
def solution(operations):
answer = []
queue=deque()
for str in operations:
newStr=''+str
sp=newStr.split(' ')
if(sp[0]=='I'):
answer.append(int(sp[1]))
elif sp[1]=='1'and answer:
answer.remove(max(answer))
elif(sp[... | true |
dd0b66852ca01238bd25a0a49713983385690aa7 | Python | zmj/Euler | /019.py | UTF-8 | 790 | 3.53125 | 4 | [] | no_license | def daysInMonth(month, year):
if month==0: #jan
return 31
elif month==1: #feb
if year%400==0 or (year%100!=0 and year%4==0):
return 29
else:
return 28
elif month==2: #march
return 31
elif month==3: #april
return 30
elif month==4: #may
return 31
elif month==5: #june
return 30
elif month==6: #j... | true |
8f5af97416222a07e448327c8943c50fa9c3ec97 | Python | GeneralMcPaws/poe_price_predictor | /Pipelines/Pipelines/fetch_stashes.py | UTF-8 | 7,949 | 2.625 | 3 | [] | no_license | import requests,time,csv,datetime,sys
import json
import pathlib
import os
import logging.config
import argparse
import json_exceptions
parser = argparse.ArgumentParser(description='This program fetches stashes as json from the official pathOfExile api')
parser.add_argument("-s","--sid",help="Input the next_change_id... | true |
3377e23ed3cead07ae9b7047c35b574e552344bb | Python | xy1377660586/Leetcode | /141/linked list cycle.py | UTF-8 | 1,112 | 3.671875 | 4 | [] | no_license | \后来找到了复杂度O(n)的方法,使用两个指针slow,fast。两个指针都从表头开始走,slow每次走一
步,fast每次走两步,如果fast遇到null,则说明没有环,返回false;如果slow==fast,说明有环,并且此时
fast超了slow一圈,返回true
为什么有环的情况下二者一定会相遇呢?因为fast先进入环,在slow进入之后,如果把slow看作在前
面,fast在后面每次循环都向slow靠近1,所以一定会相遇,而不会出现fast直接跳过slow的情况
快慢指针
# Definition for singly-linked list.
# class ListNode(object):
# def ... | true |
454048b96a7b5d02f5fbaec24c36a2389dae7f58 | Python | vjguzman/E2-MCIOC | /barra.py | UTF-8 | 3,028 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 11:49:08 2020
@author: Ale
"""
import numpy as np
g = 9.81 #kg*m/s^2
phi = 3.14
class Barra(object):
"""Constructor para una barra"""
def __init__(self, ni, nj, R, t, E, ρ, σy):
super(Barra, self).__init__()
self.ni = ni
self.nj = nj
se... | true |
5cd55cd790561c7ef2c1e2f65caca0c52a0d0be6 | Python | Aaron-hk/2018-summer_NLP_QA | /ReadFile.py | UTF-8 | 3,023 | 3.28125 | 3 | [] | no_license | # -*- encoding:UTF-8 -*-
'''
模塊說明:
構建數據集的數據結構,方便後續的預處理和操作
'''
'''
類說明:
問答集對應的數據結構
成員:
fileName:問答集的文件名
questionList:問題組成列表
qAnswersDic:答句的數據結構
qLabelsDic:答句的標籤的數據結構
quesTFDic:每個問題文檔中的詞頻數據機構
'''
class QAData():
def __init__(self, fileName):
self.fileName = fileName
sel... | true |
00dfedfe1a6db6cf7c137b21c5b124a564c172c5 | Python | qihqi/bottlerest | /rest_main.py | UTF-8 | 838 | 2.59375 | 3 | [
"MIT"
] | permissive | import bottle
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from bottlerest import RestApiApp
# Can also be constucted as api = RestApiApp(connection, app)
# where connection can be either a connection string or a sqlalchemy engine
# object; app is a bottle app ... | true |
902e4d90d190e24579c4bb0e8adbbe295a84d89d | Python | HwayoungYoon/2020-1-Exploratory-Data-Analysis | /기말 코드 정리/T-test.py | UTF-8 | 3,874 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
T 검정 T-test
"""
"""
단일표본 T검정(정규) """
# 1.library 선언
import numpy as np
import scipy.stats as stats
# 2.데이터 입력
data = np.array([5260,5470,5640,6180,6390,6515,6805,7515,7515,8320,8770])
checkValue = 7225
# 3.단일표본 T검정 통계량
stats.ttest_1samp(data, checkValue)
# 4.통계량 직접 계산
... | true |
a17a5c5ae5a61e1e8bbb8f9dd2406cc342a9f79e | Python | hrishikeshtak/Coding_Practises_Solutions | /leetcode/LeetCode-150/Heap/703-Kth-Largest-Element-in-a-Stream.py | UTF-8 | 869 | 4.3125 | 4 | [] | no_license | """
703. Kth Largest Element in a Stream
"""
import heapq
from typing import List
class KthLargest:
def __init__(self, k: int, nums: List[int]):
# minHeap with K element
self.minHeap = nums
self.k = k
heapq.heapify(self.minHeap)
while len(self.minHeap) > self.k:
... | true |
c35013fe26952fa3772bd28875a5fd4149d9eaad | Python | samarthanand12/Attendance-Monitoring-System-through-Face-Recognition | /attendance.py | UTF-8 | 18,776 | 2.53125 | 3 | [
"MIT"
] | permissive | import sys
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
try:
import ttk
py3 = False
except ImportError:
import tkinter.ttk as ttk
py3 = True
from sqlite3 import *
conn = connect('record_form.db')
mycursor = conn.cursor()
try:
mycursor.execute('sel... | true |
eecf1eee5505d724f4cb3b050cda3395c12743d1 | Python | fluffyrita/RLPaddlePARL | /practice/Jump/train.py | UTF-8 | 4,076 | 2.671875 | 3 | [] | no_license | #######################################################################################################
# 2020-06-25
# ioaniu/Jeff Young
# Modified from
# https://https://https://github.com/shivaverma/Orbit/tree/master/Paddle/agent.py
# https://https://github.com/PaddlePaddle/PARL/blob/develop/examples/DQN/repla... | true |
348f126efa2c6dbef0cade58ba2a6ff2c12c889e | Python | rohanJa/DSA_IMP | /Previous Year CodeVita/Vita_Sum.py | UTF-8 | 269 | 3.1875 | 3 | [] | no_license |
N, K = map(int, input().split(' '))
summation = 0
factorial = [0]*(N+1)
factorial[0] = 1
for i in range(1,N+1):
factorial[i] = i*factorial[i-1]
for i in range(0,K+1,2):
summation+= factorial[N] // (factorial[i]*factorial[N-i])
print(summation%(10**9 + 7))
| true |
1e9dff22a8c35805e7ccf675f58949e0faa3a608 | Python | Krishnap641/ABC_Fin_App | /smoketest.py | UTF-8 | 667 | 3.1875 | 3 | [] | no_license | """
************** loan app smoke testing ***************
Author name : Krishna
Data Written :
This program will perform the following web testing:
1. Check URL and verify the title
2. Send user query to input box and verify the rows retrieved
"""
from selenium import webdriver
from selenium.webdriver... | true |
89efef7ec780338e78b369d6dc6881ac8d9e5ad0 | Python | SK1417/Snake-Game-AI | /snake_func.py | UTF-8 | 2,814 | 3.40625 | 3 | [] | no_license | import pygame
import random
disp_length = 800
disp_width = 600
gameDisplay = pygame.display.set_mode((disp_length,disp_width))
pygame.display.set_caption('Slither.io')
clock = pygame.time.Clock()
food_length = 25
food_width = 25
snake_length = 25
snake_width = 25
def draw_rect(snake_body, snake_length, snake_width, f... | true |
1340c49fdc4462a949bf16530b7fa0ee2b3b4837 | Python | OriginLucas/monitor | /DvaMoon/monitor/acquire_data.py | UTF-8 | 1,251 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python
import redis
from monitor import models
'''
从redis中取得数据 根据不同参数取不同的时间段数据
grade1--10分钟
grade2--1小时
grade3--1天
grade4--1月
grade5--1年
'''
class Acquire(object):
def __init__(self,shaft,item):
self.shaft=shaft
self.item=item
self.pool = redis.ConnectionPool(ho... | true |
7577126f4b1ca5c2af8b91d0b11b049c41b76157 | Python | williamzhu0404/Text-Matching | /video_recommender.py | UTF-8 | 5,725 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 26 23:55:11 2019
@author: William Zhu
"""
NEGATION_MARKERS = """never nor unless n’t nothing cannot neither no nobody none not
n‘t nowhere n't""".split()
from gensim import corpora, models, similarities
import numpy as np
import spacy
#spacy_nlp = spacy.load('en')
#R... | true |
91e25be6d0c3d7334eb35850746704abaf3e875d | Python | rushikeshphalke137/rushikeshchatbot | /backend/regions/gen_summary_files_level.py | UTF-8 | 11,134 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import csv
import re
import os
from copy import deepcopy
from pathlib import Path
from pprint import pformat # format strings with pretty print for readability
from logging import (getLogger, getLevelName, basicConfig as logging_basicConfig,
CRITICAL, ERROR, WARNING, INFO, DEBUG)
logger ... | true |
6d5dde41f5819043b76436c5f79ff4ccff1bd8c9 | Python | leeylong/pystudy | /nine/c1.py | UTF-8 | 747 | 4.1875 | 4 | [] | no_license | """ 类的学习 """
#类、对象 各自的意义,关系
#定义一个对象
#类名首字母大写
#驼峰法命名
#可传参数
class Student():
#可以定义变量
name = ''
sex = ''
age = 0
#类变量:和类关联
# 示例变量:和对象关联
def __init__(self,name,sex,age):
#构造函数
self.name = name
self.age = age
self.sex = sex
# 可以定义函数
def print_file(self):
# p... | true |
27f855d7fb9f991ea7c140f531175b3d7bb2fa36 | Python | colbenkharrl/eulerPy | /source/problem4.py | UTF-8 | 1,031 | 4.46875 | 4 | [] | no_license | # Colben Kharrl | December 2016 | Project Euler Problem 4
##
## Description:
## A palindromic number reads the same both ways. The largest palindrome made
## from the product of two 2-digit numbers is 9009 = 91 × 99.
## Find the largest palindrome made from the product of two 3-digit numbers.
##
# test if strin... | true |
0603fe73b73d25cbfbdf7b652047d68c3e04e675 | Python | Italo-Neves/Python | /Curso-Em-Video/M1/ex08.py | UTF-8 | 142 | 3.984375 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
x = int(input("Digite o valor em metros: "))
cm = x*100
mm = x*1000
print(f'O valor {x}m equivale a {cm}cm e {mm}mm')
| true |
2d5a3a89591bd117081592f0b4ee5e9f60d04336 | Python | mpandeyWU/diurnalCycleCodes | /src/AS/s14_get_ASS_events.py | UTF-8 | 6,350 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
#python s14_get_ASS_events.py -tsvpath ../output/Majiq_PSI_All/tsvFiles/ -rcfile ../output/181119_ReadCount_In_TP_format_Min2.csv
import re, sys, os
from collections import defaultdict
import argparse
import numpy as np
def parse_readcount_file(filename):
rcDict = defaultdict(list)
with open(filen... | true |
6f4c8233528b97ceb509a51570c168526d0149a7 | Python | rahuld11/Facial_Recognition | /Dataset_generator.py | UTF-8 | 1,225 | 2.78125 | 3 | [] | no_license | import cv2
import numpy as np
cam = cv2.VideoCapture(0)
cam.set(3, 640) # set video width
cam.set(4, 480) # set video height
#make sure 'haarcascade_frontalface_default.xml' is in the same folder as this code
face_cascade = cv2.CascadeClassifier('G:/Opencv/Face_Recognition/Haar cascade/haarcascade_frontal... | true |
2357c121ed9429b3c6b3f7d043003c60d4d2aba1 | Python | JagritiG/DS-Algorithm-Python3 | /sorting/bubblesort/bubblesort.py | UTF-8 | 299 | 3.6875 | 4 | [] | no_license | def bubbleSort(data):
# Start with the array length and decrement each time
for i in range(len(data)-1, 0, -1):
for j in range(i):
if data[j] > data[j+1]:
temp = data[j]
data[j] = data[j+1]
data[j+1] = temp
return data
| true |
8e122b45dd2f387d791caa024525cc9dc6d6eb98 | Python | dinob0t/ga_project_final | /get_images.py | UTF-8 | 1,644 | 2.953125 | 3 | [] | no_license | import urllib
import time
def download_files(file_name, url_name, dir):
success = 0
try:
dl = urllib.urlopen(url_name).read()
success = 1
except:
time.sleep(1)
dl = urllib.urlopen(url_name).read()
success = 1
finally:
pass
if success == 1:
f = open(dir + file_name,'wb')
f.write(dl)
f.close()
... | true |
31066ed14daefc0289e9e93b77226018d031617b | Python | gautam4941/Python_Basics_Code | /Set/Why_Set.py | UTF-8 | 634 | 3.484375 | 3 | [] | no_license | a = list( range(1, 1000) ) #1, 2, 3, .., 999
print( f"type(a) = { type(a) } and len(a) = { len(a) }" )
print()
b = list( range( 1, 1000, 2 ) ) #1, 3, 5, .., 999
print( f"type(b) = { type(b) } and len(b) = { len(b) }" )
print()
for i in b:
a.append( i )
print("After Appending, ")
prin... | true |
dec9a90a6f69de8bb139b1b9caa591d4d324a28e | Python | Magsud-Hasanov/pong_game_on_python | /pong.py | UTF-8 | 6,117 | 3.90625 | 4 | [] | no_license | # Simple pong game in Python 3
#Made by Magsud Hasanov with the help of freeCodeCamp.org
# packages
import turtle
import winsound
# window of game
window = turtle.Screen() # creating object
window.title("Pong game by Magsud Hasanov") # name of the window
window.bgco... | true |
0366e949254e5e1c1a9b5468056744ea27818b7d | Python | maxwell-aladago/machine-learning | /ml-2018-homeworks/k-means & GMMs/code/q1_kmeans.py | UTF-8 | 2,442 | 2.96875 | 3 | [] | no_license | import numpy as np
from q1_dist2 import q1_dist2
def q1_kmeans(X, K, seeds_idx):
# Executes K-means clustering algorithm, using euclidean distances.
#
# INPUT:
# X : a numpy.ndarray matrix of size [m x n] and type 'float', where each row
# is an n-dimensional input example
# K: 'int', in... | true |
05282587688a5f0f05dbca3ad3199b1ba627273d | Python | hyeonukdev/Algorithm-Interview | /string/reorder-data-in-log.py | UTF-8 | 999 | 3.625 | 4 | [] | no_license | '''
로그 파일 재정렬
- 로그의 가장 앞 부분은 식별자
- 문자로 구성된 로그가 숫자 로그보다 앞에 옴
- 식별자는 순서에 영향을 끼치진 않지만, 문자가 동일한 경우 식별자 순으로 함
- 숫자 로그는 입력 순서대로 함
ex1)
입력 : logs = ["dig1 8 1 5 1", "let1 art can", "dig2 3 6", "let2 own kit dig", "let3 art zero"]
출력 : ['let1 art can', 'let3 art zero', 'let2 own kit dig', 'dig1 8 1 5 1', 'dig2 3 6']
'''
# is... | true |
61bdc3ca4d7702aa9d8793d9f0c4f28d2627971a | Python | BeaImeLm/ejwhile | /assignments/00Tabla/src/exercise.py | UTF-8 | 364 | 3.421875 | 3 | [] | no_license | import os
def main():
#escribe tu código abajo de esta línea
os.system("clear")
x = 0.5
print(f"{'x':>8}{'y':>8}{'z':>8}")
print("--------------------------")
while x <= 10:
y = 3 * x**2 + 7 * x - 15
z = y - 2 * x**2
print(f"{x:8.2f}{y:8.2f}{z:8.2f}")
x +=... | true |
b5fc846d1a9ca18e0ddd64965c796c0d3ecc6a14 | Python | lroberto68/TestPyQt | /test2.py | UTF-8 | 2,386 | 3.125 | 3 | [] | no_license | from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QLabel, QCheckBox, QComboBox, QLineEdit, QListWidget
from PyQt5.QtCore import Qt
import sys
from random import choice
class MainWindow(QMainWindow):
window_titles = [
'finestra1',
'finestra2',
'finestra3',
'finito'... | true |