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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5b893d4b02e5e75668ac3dfb8df9d24db09711dc | Python | Nightlord851108/LineChatbot | /src/message.py | UTF-8 | 1,869 | 2.765625 | 3 | [
"MIT"
] | permissive | import json
from learning.lstm import TrainingModel
def checkType(message, list):
for i in list:
for j in list[i]:
if message.find(j)!=-1:
return i
return False
class Message:
def __init__(self, input):
self._input = input.lower()
self.lan... | true |
39fce28cdf9f42f26e302d7b0ec102a8e2516249 | Python | YoungLC/leetcode_python | /121. Best Time to Buy and Sell Stock.py | UTF-8 | 1,075 | 3.65625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
# 方法1
# max_profit = 0
# l_p = len(prices)
# for i in range(l_p - 1):
# for j in range(i, l_p):
... | true |
dae711d13b18e7a701124e76048a9bfde050efc1 | Python | Mason-mengze/robot | /face_fan_hello light.py | UTF-8 | 1,931 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import io
import picamera
import cv2
import numpy
import time
import RPi.GPIO as GPIO
import RobotApi as api
#init robot api
api.ubtRobotInitialize()
ret = api.ubtRobotConnect("SDK", "1", "127.0.0.1")
#GPIO setting for fan control
GPIO.setwarnings(False) # Ignore warning fo... | true |
cc2a84e3a87fccd26527ff32ffaf4061ce05ddd7 | Python | CartagenaMinas/voladura1 | /patron.py | UTF-8 | 4,235 | 2.765625 | 3 | [] | no_license | from os import write
from google.protobuf.symbol_database import Default
import streamlit as st
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
import pandas as pd
import streamlit.components.v1 as components
import math
import plotly.graph_objects as go
def ma... | true |
331179dfbe6b22fae7155567a90a996331b9c50d | Python | catboost/catboost | /contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/bindings/search.py | UTF-8 | 2,631 | 2.578125 | 3 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | """
Search related key bindings.
"""
from __future__ import annotations
from prompt_toolkit import search
from prompt_toolkit.application.current import get_app
from prompt_toolkit.filters import Condition, control_is_searchable, is_searching
from prompt_toolkit.key_binding.key_processor import KeyPressEvent
from ..k... | true |
62e9fcfe52f967a6d71772e569d99f7ad9018e5a | Python | useranonymous07/TimeConstrainedLearning | /machine_teacher/Definitions.py | UTF-8 | 1,403 | 3.53125 | 4 | [] | no_license | """
This modules contains the basic types (or classes) used
in the protocol definied in the Protocol module. Along
with these type, some functions to manipulate and
extract statistics from objects of these types are provided
InputSpace -- a two dimensional array from numpy lib
Labels -- a one dimensional array from nu... | true |
704067474f9eae82f4d01b30b929b7ec37e992b8 | Python | anthonywritescode/aoc2018 | /day11/part2.py | UTF-8 | 3,228 | 3 | 3 | [] | no_license | import argparse
import sys
from typing import List
import pytest
from support import timing
def power(x: int, y: int, serial: int) -> int:
rack_id = x + 10
power = rack_id * y
power += serial
power *= rack_id
power = (power % 1000) // 100
return power - 5
def compute_orig(s: str) -> str:
... | true |
313b70aaad1975263acd341e9d3dc07a5ea7cda9 | Python | luo365/Python003-003 | /week01/spiders/spiders/spiders/movies.py | UTF-8 | 1,513 | 2.8125 | 3 | [] | no_license | import scrapy
from spiders.items import MaoyanItem
from scrapy.selector import Selector
class MoviesSpider(scrapy.Spider):
name = 'movies'
allowed_domains = ['maoyan.com']
start_urls = ['https://maoyan.com/films?showType=3']
def start_requests(self):
url = 'https://maoyan.com/films?showType=3... | true |
58d635aadc15ba8a753f46e6d42b728833ba2469 | Python | syslabcomarchive/gfb.policy | /gfb/policy/order.py | UTF-8 | 536 | 2.609375 | 3 | [] | no_license | from plone.folder.default import DefaultOrdering
class PrependOrdering(DefaultOrdering):
"""prepend new added content
copied from collective.folderorder
"""
def notifyAdded(self, id):
"""
Inform the ordering implementation that an item was added
"""
order = self._order... | true |
0ad37ef6184c4e8bb300f44925460caf9aa70c98 | Python | mboomer/sqlite | /db-connection.py | UTF-8 | 1,656 | 3.265625 | 3 | [] | no_license | # sqlite3 – the Python library we will be using to connect to the database.
import sqlite3
# open a database connection
connection = sqlite3.connect('chinook.db')
# ask the connection for a cursor object
# the cursor object is used to interact with the DB and execute queries
cursor = connection.cursor()
# run a quer... | true |
fffd5ab6f45250cde94770790cb9380acd150246 | Python | hatchways/team-apple-cider | /server/models/list.py | UTF-8 | 860 | 2.828125 | 3 | [] | no_license | from database import db
class List(db.Model):
__tablename__ = 'lists'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
user_id = db.Column(db.Integer, db.ForeignKey('users.id'),nullable=False)
name = db.Column(db.String, nullable=False)
img_url = db.Column(db.String, nullable=Fal... | true |
3726d0a4b11e2493b239e129c09f6617d4c64340 | Python | Qi-Jian-Huang-DevOps/Advanced-Internet-Communication | /lab_2/4DN4_LAB2/FTPServer/FTPServer.py | UTF-8 | 16,248 | 2.546875 | 3 | [] | no_license | import socket
import threading
import thread
import SocketServer
import time
import random
import os
import cPickle
import platform
import select
import sys
import errno
# contants
CMD_LIST_ALL = 'list'
CMD_READ = 'read'
CMD_WRITE = 'write'
CMD_BYE = 'bye'
CMD_QUIT = 'quit'
CMD_CONNECT = 'connect'
FOUND = 'FOUND'
NOT... | true |
b42bd8a1315333ef3f396fca445240096ec02fd8 | Python | evertondutra/Curso_em_Video_Python | /exe095.py | UTF-8 | 1,412 | 4 | 4 | [
"MIT"
] | permissive | """
Aprimore o exercício 93 para que ele funcione
com vários jogadores, incluindo um sistema de
visualização de detalhes de aproveitamento de cada jogador.
"""
dic = {}
gols = []
jogadores = []
while True:
dic['nome'] = input('Nome do jogador: ')
part = int(input(f'Quantas partidas {dic["nome"]} jogou? '))
... | true |
1baf448bb75ed5239cb6de5138947ca07437f046 | Python | CitrineInformatics/python-citrination-client | /citrination_client/search/pif/query/chemical/composition_query.py | UTF-8 | 5,334 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | from citrination_client.search.pif.query.chemical.chemical_field_query import ChemicalFieldQuery
from citrination_client.search.pif.query.core.base_object_query import BaseObjectQuery
from citrination_client.search.pif.query.core.field_query import FieldQuery
class CompositionQuery(BaseObjectQuery):
"""
Class... | true |
9297a68a86643623f4adc465dab8c5196a1ac4e6 | Python | Schulich-Ignite/spark | /spark/util/helper_functions/arc_functions.py | UTF-8 | 2,364 | 2.921875 | 3 | [
"MIT"
] | permissive | from math import sin, cos
from ..decorators import validate_args, ignite_global
from numbers import Real
@validate_args([Real, Real, Real, Real],
[Real, Real, Real, Real, Real],
[Real, Real, Real, Real, Real, Real],
[Real, Real, Real, Real, Real, Real, str])
@igni... | true |
35fd6e1e051a49c422d6a6df2740cb259e23dfc2 | Python | bradleylight/paymo | /src/paymo_fraud.py | UTF-8 | 4,584 | 2.6875 | 3 | [] | no_license | #python3
#program that provides multiple levels of payment fraud alerts
#insight data engineering coding challenge, William Light, 2016
import sys, csv
#initialize
TRUSTED = 'trusted'
UNVERIFIED = 'unverified'
infile1 = sys.argv[1]
infile2 = sys.argv[2]
outfile1 = sys.argv[3]
outfile2 = sys.argv[4]
outfile3 = sys.a... | true |
625a758e949c34e6f8af884ab2013d7c1a1adea9 | Python | Alexsorgo/mobile_iOS | /tests/aoutgoing/acceptance/C_13.py | UTF-8 | 843 | 2.546875 | 3 | [] | no_license | from configs import config
from screens.login_screen import LoginScreen
from screens.home_screen import HomeScreen
from tests.aoutgoing.base_test import BaseTest
from utils.logs import log
from utils.verify import Verify
class TestC13(BaseTest):
"""
Nynja first run and login
"""
PHONE_NUMBER = config... | true |
dd4f6416394286d0b96836ce50e0e1b84c8a67a0 | Python | rabitdash/practice | /python-pj/repobot/employee.py | UTF-8 | 1,223 | 3.0625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
import datetime
class EmployCommit:
def __init__(self, name, commits_tot = 0, commits = []):
self.name = name
self.commits_tot = commits_tot
self.commits = commits
def add_commits_tot(self):
self.commits_tot += 1
def add_commit(self... | true |
9b9ef66b4b22d4687b7299393338748a5d30ad98 | Python | Jiwoooonnng/Learning-Project | /Reinforcement_Learning/Book/Hans-on_Reinforment_Learing_with_python/Chapter11/Pendulum.py | UTF-8 | 7,899 | 2.734375 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import gym
# number of steps in each episode
epsiode_steps = 500
# learning rate for actor
lr_a = 0.001
# learning rate for critic
lr_c = 0.002
# discount factor
gamma = 0.9
# soft replacement
alpha = 0.01
# replay buffer size
memory = 10000
# batch size for training
ba... | true |
6931c8e9cb9c37684515e0d5b8a204c982dcf4c3 | Python | iangang/mlproj | /mlmodel/PCA/PCA_python/pca.py | UTF-8 | 1,039 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2017-09-03 22:28:16
# @Author : Your Name (you@example.org)
# @Link : http://example.org
# @Version : $Id$
# PCA
import numpy as np
from numpy import linalg
def loadDataSet(fileName, delim = '\t'):
fr = open(fileName)
stringArr = [line.st... | true |
2f28f6444b1fb96ff4834af292ef5d743e16818d | Python | Binovizer/Python-Beginning | /TheBeginning/py_basics_assignments/44.py | UTF-8 | 426 | 3.0625 | 3 | [] | no_license | price_list = [1050,2200,8575,485,234,150,399];
def costliest_item(price_list):
return max(price_list)
def average(price_list):
total = 0
for i in price_list:
total += i
return round(total/len(price_list),2)
def sortByPrice(price_list):
#price_list.sort();
return sorted(pr... | true |
c024a91d6402564677405565b558b41f2930b7bb | Python | samflahive/math_blocks | /tests/algebra/products/operations/__eq__.py | UTF-8 | 578 | 2.78125 | 3 | [] | no_license | import unittest
from math_blocks.algebra.core import Number, Product
class product_eq(unittest.TestCase):
def test_number_eq(self):
main_p = Product([1,2,3])
n = Number(2)
self.assertEqual(False, main_p == n)
def test_product_eq(self):
main_p = Product([1,2,3])
... | true |
065ee6a945681a7b2ac8307f70d5c951c8578b9f | Python | Luisa-T/helloworld | /factorial.py | UTF-8 | 514 | 4.28125 | 4 | [] | no_license | # Luisa Timothy 11-03-2018
# exercise week 7 factorial
def factorial(n): # Return the factorial of n, an exact integer >= 0.
import math # importing the inbuilt maths function
result = 1
factor = 2
while factor <= n: # while the factor is smaller or equal to the integer
result *= factor # then c... | true |
8f83beb265a17ed38f2482424e59a4ef0cb6c273 | Python | kangsm0903/Algorithm | /B_2000~/B_2490.py | UTF-8 | 369 | 3.078125 | 3 | [] | no_license | A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
total=[]
total.append(A.count(0))
total.append(B.count(0))
total.append(C.count(0))
for i in total:
if i==1:
print('A')
elif i==2:
print('B')
elif i==3:
print('C')
elif i==4:
... | true |
7ff1c4e09590a70eb9b5968764afc70016176795 | Python | hube5462/Pingsweep-and-Portscan | /tcp_full_connect_portscanner.py | UTF-8 | 489 | 3.375 | 3 | [] | no_license | #Author: Aaron Huber
#Date: 3/2015
#This python script with port scan a given ip address within the specified range of ports
import socket
import sys
def main():
ip = sys.argv[1] #take the ip address from the command line
for i in range(1, 1025): #iterate through ports 1 to 1025
try:
sock = socket.soc... | true |
669b29d8818f1175d04cc0c3e085b3eec166d6a3 | Python | pepribas/F3AT | /src/feat/test/common_serialization.py | UTF-8 | 35,078 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
import itertools
import types
from zope.interface import Interface, implements
from zope.interface.interface import InterfaceClass
from twisted.python.reflect import qual
from twisted.spread import jelly
from twisted.trial.unittest import Skip... | true |
6c51b785fadd4c42761650e947620b2e3768741e | Python | drivendataorg/rinse-over-run | /10th Place/trainer/trainer.py | UTF-8 | 3,311 | 2.59375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | import datetime
import os
import numpy as np
import torch
from base import BaseTrainer, print_training_log
class TrainerRNNLSTM(BaseTrainer):
"""
Trainer class
Note:
Inherited from BaseTrainer.
self.optimizer is by default handled by BaseTrainer based on config.
"""
def __init_... | true |
c29a14b0736bd41ce8c28250f57b31e75340a3f4 | Python | Groguard/Python-mini-games | /tictactoe.py | UTF-8 | 5,031 | 3.703125 | 4 | [] | no_license | #board
freespace = ['_',' ']
board = ['_','_','_','_','_','_',' ',' ',' ']
def current_board():
print ' a b c \n1 _%s_|_%s_|_%s_\n2 _%s_|_%s_|_%s_\n3 %s | %s | %s' % (board[0],board[1],board[2],board[3],board[4],board[5],board[6],board[7],board[8])
def player_start():
who = raw_input('Who will go first?... | true |
df9a3eff9f1c50c296eb0af8f97c8d05f6b071d3 | Python | Lakshmi020390/DistributedStore | /src/db.py | UTF-8 | 1,150 | 3.09375 | 3 | [] | no_license | from .singleton import Singleton
class Database(object):
__metaclass__ = Singleton
def __init__(self, **kwargs):
self.store = {}
def get(self, **kwargs):
result = []
print(self.store, "Current Store========>>")
key = kwargs["data"]['key']
value = self.store.get(ke... | true |
0d8549dae6d824995e6597f9debd5e98c1785185 | Python | nspkumar/pythonprograms | /uncommon.py | UTF-8 | 5,532 | 3.140625 | 3 | [] | no_license | """"
def transpose():
lista = [[1,2,3], [4,5,6], [7,8,9]]
#print(lista[0][0])
#print(len(lista))
result=[[0,0,0],[0,0,0], [0,0,0]]
for i in range (0, len(lista)):
for j in range(0, len(lista)):
result[i][j] = lista[j][i]
print(result)
def intToRoman(num):
result=""
... | true |
2e9f4fc7d0a91c19a4939a8ff3df1d08b716c677 | Python | TonyLDS/pythonchallenge | /12/12.py | UTF-8 | 2,155 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 27 11:50:30 2016
@author: luzhangqin
"""
#http://www.pythonchallenge.com/pc/return/5808.html
import Image
odd_even_open = Image.open("cave.jpg","r")
odd_even_open_w, odd_even_open_h = odd_even_open.size
print odd_even_open_w, odd_even_open_h
even_even = Image.new('RG... | true |
b15b6193421321a6a2c95ec0a678253ded97527a | Python | IanEarnest/RedditAPI | /RedditAPIIHS/RedditAPIIHS/RedditAPIIHS.py | UTF-8 | 532 | 3.203125 | 3 | [] | no_license | import requests
import json
def RequestGet(url):
# HTTPS check/ skip for URL
httpsStr = "https://"
if(url.startswith(httpsStr)):
pass
else:
url = httpsStr + url
print(f"url modified to: {url}")
# HTTPS GET request
request = requests.get(url, headers = {'User-agent': 'I... | true |
d8d0dd8f16fc623f47a27e93643c6e12ade7fec0 | Python | anik3tra0/python-made-easy | /homework-3/main.py | UTF-8 | 394 | 3.5625 | 4 | [] | no_license | # This function checks equality between three parameters
def checkEquality(num1, num2, num3):
num1, num2, num3 = int(num1), int(num2), int(num3)
return num1 == num2 or num2 == num3 or num3 == num1
result = checkEquality(1, 4, 3)
print(result)
result = checkEquality(1, 4, "3")
print(result)
result = checkEqualit... | true |
c41b3240b896af18d9d50b35bf1bcf91d3a51261 | Python | Kanbo0409/InsightFace-v2 | /mobilenet_v2.py | UTF-8 | 802 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | from torch import nn
from torchsummary import summary
from torchvision import models
from config import device
class MobileNetv2(nn.Module):
def __init__(self):
super(MobileNetv2, self).__init__()
net = models.mobilenet_v2(pretrained=True)
# Remove linear layer
modules = list(net.... | true |
83104ac1fb9820bfe8c3f842c2c45126c664360c | Python | Bryan-Brito/IFRN | /Programação de Computadores (NCT)/LISTAS/Lista #04.1/Lista #04.1 Questão 4.py | UTF-8 | 207 | 3.828125 | 4 | [] | no_license | B = int(input("Informe o valor da base do triângulo:", ))
H = int(input("Informe o valor da altura do triângulo:", ))
A = (B*H)/2
print("A área do triângulo conforme os valores informados é:", A) | true |
bb39762b020b7a24c0be3f5316e5d3f5fe5d2730 | Python | jenyf/T_07_RodriguezRamon.VegaHuaman | /Rodriguez_Ramon_Jenyfer_Esthefany/Iteracion_01.py | UTF-8 | 278 | 3.1875 | 3 | [] | no_license | #Ejercicio_01
import os
adicciones= os.sys.argv [1]
for numero in adicciones:
if(numero=="1"):
print("Drogas")
if(numero=="2"):
print("Alcohol")
if(numero=="3"):
print("Cigarrillo")
if(numero=="4"):
print("videojuegos")
#fin_for
| true |
56901d4ccbd96336eaa06c914b9d132e963f29bd | Python | Loafly/hanghae99-algorithm | /BaekJoon/2021-03-08/1929.py | UTF-8 | 512 | 3.84375 | 4 | [] | no_license | import math
#변수를 입력받는 방법
min,max = input().split()
min_number = int(min)
max_number = int(max)
prime = []
for i in range(min_number, max_number + 1):
prime_check = True
#제곱근 구하기
sqrt_number = int(math.sqrt(i + 1))
for j in range(2, sqrt_number + 1):
if i % j == 0:
prime_check = Fa... | true |
962fd1a86f0d02977f7713a83c45e7330fe04828 | Python | MAG-BOSS/fermulerpy | /src/fermulerpy/analytic/function_average.py | UTF-8 | 1,578 | 3.625 | 4 | [
"MIT"
] | permissive | import math
import warnings
def divisor_function_avg(n):
"""
Returns the average order of divisor function for the positive integer n
Parameters
----------
n : int
denotes positive integer
return : float
return average order of divisor function
"""
if(n!=int(n) or n<1)... | true |
fd9880342d2c813007a83a252c9ac049fd2f5f95 | Python | jhgalino/MPv2 | /include/MPHv2.py | UTF-8 | 1,351 | 3.21875 | 3 | [
"MIT"
] | permissive | def unwrap(sandwich: str, se: set, wordLength: int):
try:
indexStart = findWord(sandwich, se)
except Exception as e:
print(e)
raise SystemExit
try:
getWord = sandwich[indexStart : indexStart + wordLength]
except Exception as e:
print(indexStart, wordLength)
... | true |
dad1f0cc2d1afd4cd344da1e9ce9803784464180 | Python | MiConnell/Katas | /codewars/Codewars_Range.py | UTF-8 | 1,082 | 4.3125 | 4 | [] | no_license | # https://www.codewars.com/kata/51ba717bb08c1cd60f00002f/train/python
"""
A format for expressing an ordered list of integers is to use a comma separated list of either individual integers
or a range of integers denoted by the starting integer separated from the end integer in the range by a dash, '-'.
The range includ... | true |
436aaad32c297cbf4edb040083ff7fafc8e70a6c | Python | dp1706/tkinter_GUI_python | /tkniter_basics_programs/frame.py | UTF-8 | 565 | 3.109375 | 3 | [] | no_license | from tkinter import *
root=Tk()
root.title('Welcome to LikeGeeks app')
root.geometry('350x200')
frame=Frame(root)
frame.pack()
bottomframe = Frame(root)
bottomframe.pack( side = BOTTOM )
redbutton = Button(frame, text = 'Red', fg ='red')
redbutton.pack( side = LEFT)
greenbutton = Button(frame, text = 'Brown', f... | true |
3346fd4dbf9bcb57636275037c35ff2f334d55ee | Python | Trusty-Rusty/BrewRate | /beers/models.py | UTF-8 | 3,265 | 2.875 | 3 | [] | no_license | from django.core.validators import MaxValueValidator
from django.contrib.auth.models import User
from django.db import models
from django.urls import reverse
# Added breweries that can be assigned to beers as they are added.
class Brewery(models.Model):
brewery_add_date = models.DateTimeField(null=True, blank=True... | true |
c5d3494b3c3d6fd03432dd9d979c961fb49dba41 | Python | lapisco/Advanced-Programming-Lists | /Lista_de_Fluxograma/Adriell/Questão 36.py | UTF-8 | 660 | 4.59375 | 5 | [] | no_license | # Fazer um fluxograma para gerar a série de Fibonacci com 20 elementos. A série de Fibonacci é formada pela seqüência
# 1, 1, 2, 3, 5, 8, 13, 21, ... . onde um termo é a soma dos dois anteriores.
def func_Fibonacci(n):
fun = list()
var = 1
aux = 0
for i in range(int(n/2)):
aux =var+aux
... | true |
9590eecc62762ec08dddafe39e6b29a839b087db | Python | AvishekVerma/Python_Learning | /Python S-7_Pattern Programs.py | UTF-8 | 2,025 | 3.75 | 4 | [] | no_license | # -*- coding: utf-8 -*-
#------------------------------ Section - 7 -------------------------------------#
#(8th-Aug-2021)
#---------------------------- Python Pattern Programs -----------------------#
#---------------- To print given number of *s in a row ------------#
n=int(input('Enter n value : '))
fo... | true |
153ed9b15616842682d11a05e21a47b651dbb67e | Python | oaxiom/glbase3 | /tests/test_utils.py | UTF-8 | 1,135 | 2.796875 | 3 | [
"MIT",
"X11-distribute-modifications-variant"
] | permissive | """
track.py tester code.
Part of glbase
Tests that track is performing accurately.
TODO:
-----
. some of the tests are not very extensive yet.
"""
import unittest, numpy
# get glbase
import sys, os
import glbase3.utils as utils
class Test_Utils(unittest.TestCase):
def test_scale_data(self):
# equal,... | true |
67ad6b750349ad0a6fb6fac192583c256555154d | Python | heigelisi/python | /学习/求角度.py | UTF-8 | 2,509 | 3.9375 | 4 | [] | no_license | # 计算任意两向量之间的夹角
#https://blog.csdn.net/DSTJWJW/article/details/84258760
import math
AB = [1,-3,5,-1]
CD = [4,1,4.5,4.5]
EF = [2,5,-2,6]
PQ = [-3,-4,1,-6]
def angle(v1, v2):
dx1 = v1[2] - v1[0]
dy1 = v1[3] - v1[1]
dx2 = v2[2] - v2[0]
dy2 = v2[3] - v2[1]
angle1 = math.atan2(dy1, dx1)
angle1 = i... | true |
9ca3c40f82a11192ed3b2b9b318c0a3db1e7773f | Python | kwhuo68/gp-stock | /kernels.py | UTF-8 | 1,141 | 3.359375 | 3 | [] | no_license | import numpy as np
from abc import ABCMeta, abstractmethod, abstractproperty
class Kernel():
__metaclass__ = ABCMeta
@abstractmethod
def type(self):
return
@abstractmethod
def dot_prod(self, x, y):
return
#Get kernel matrix
def construct_kernel_matrix(self, X, X_prime):
matrix = np.zeros((len(X), le... | true |
ab44f731f1f7d3793a2d5225cf43cb65e76edc3b | Python | floresfred/visualization | /candlestick.py | UTF-8 | 1,587 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
__author__ = 'Fred Flores'
__version__ = '0.0.1'
__date__ = '2020-04-19'
__email__ = 'fredflorescfa@gmail.com'
from math import pi
import pandas as pd
from alpha_vantage_data import AlphaVantage
from bokeh.plotting import figure, show, output_file
av = AlphaVantage.AlphaVantage(key='C1MLXDST5B... | true |
8192c743ec53255152609cbef12191d8ad5c3090 | Python | shinji-dosaka/lp3thw | /code/ex51/projects/gothonweb3/app.py | UTF-8 | 294 | 2.65625 | 3 | [] | no_license | from flask import Flask
from flask import render_template
from flask import request
app = Flask(__name__)
@app.route("/hello")
def index():
name = request.args.get('name', '名もない人')
greeting = f"ハロー、{name}"
return render_template("index.html", greeting=greeting)
| true |
b745fef22bb121fd2cc3db8dd8119b1dc79ea70e | Python | chaotianoX/Meli-Challenge | /meli_aux/meli_mail.py | UTF-8 | 2,082 | 2.734375 | 3 | [] | no_license | # Import the required libraries
import dateutil.parser as parser
from apiclient import errors
from . import meli_token as cred
# Connect to the Gmail API
service = cred.getCredentials()
# Documentation used: https://developers.google.com/gmail/api/reference/rest
# This function search for a especific word and return... | true |
34ee47816f4d4997130e7f861d7321289a4fd086 | Python | claudiodonofrio/icosapi | /src/icosapi/cp.py | UTF-8 | 3,104 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 25 21:59:04 2022
@author: Claudio
"""
from icoscp.station import station as cpstation
import requests
METAURL = 'https://meta.icos-cp.eu/objects/'
def station(**kwargs):
"""
Return a list of ICOS Stations
Parameters
----------
country : STR
... | true |
d93a4c74a0d5b235f5cf2ff9f7d91afc0a35c207 | Python | Yadav099/final_project_back | /Util/Dashboard.py | UTF-8 | 1,424 | 2.75 | 3 | [] | no_license |
# Importing all libraries
import cv2
import os
import time
from werkzeug.utils import secure_filename
from app import app
def wait(user_data):
user_data.save("data.mp4")
time.sleep(5)
def video_converter(user_data):
wait(user_data)
# asynch call so mp4 file is saved
# frames are stored ... | true |
d6ee5dcf5331c97c7cb1dd2f20d2586db652d1bd | Python | DavideFauri/euler | /Python 3/Problem_002.py | UTF-8 | 442 | 4 | 4 | [] | no_license | # Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed four million.
def evenFibonacciUnder(limit):
past = 0
yield past
present = 2
while present < limit:
yield present
future = present * 4 + past # custom formula for even-only Fibonacci numbers
... | true |
765de7bbbb058ae3dd3ecc75cf20839ac3857977 | Python | XuanHeIIIS/BNMTF | /tests/code/test_nmf_np.py | UTF-8 | 8,379 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | """
Unit tests for the methods in the NMF class (/code/nmf_np.py).
"""
import sys, os
project_location = os.path.dirname(__file__)+"/../../../"
sys.path.append(project_location)
import numpy, math, pytest, itertools
from BNMTF.code.models.nmf_np import NMF
""" Test the initialisation of Omega """
def test_init():
... | true |
5f019b51cf9e8397ae2cb659891f67c946212c84 | Python | sersajar/interactive-python-rice | /fullCircle_examples/comprehension_lists.py | UTF-8 | 1,491 | 4.8125 | 5 | [] | no_license | # create a list of numbers from 0 to 9
nums = []
for n in range(10):
nums.append(n)
print "create a list of numbers from 0 to 9"
print nums
# the same list with compr.lists
nums1 = [n for n in range(10)]
print nums1
print
# create a list of square numbers
squares = []
for square in range(10):
squares.append(square... | true |
b18f5ff4752f3e0d72dfb814e94ce528d4d1bb93 | Python | AdamHolcik/Assignment-1 | /main.py | UTF-8 | 6,980 | 4.625 | 5 | [] | no_license | #problem 1
first = input('What is your fist name? ') #takes input of the users first name
last = input('What is your last name? ') #takes input of the users last name
print('Your name backwards is',last,first) #gives output of the users last name then first name
#problem 2
num = int(input("please enter a number: "))#ta... | true |
67dd738be73a2ed2f7066d1b48e569c46167e7e8 | Python | Aasthaengg/IBMdataset | /Python_codes/p03779/s076168127.py | UTF-8 | 113 | 3.46875 | 3 | [] | no_license | x = int(input())
t = 0
while True:
if not (t*(t+1))/2 >= x:
t += 1
else:
break
print(t)
| true |
3c4a3dc515cd2b4520c10c95e12a07e5d42ee119 | Python | ddc899/cmpt145 | /Tanner's Docs/A5/a5q2_scoring.py | UTF-8 | 8,508 | 3.234375 | 3 | [] | no_license | # CMPT 145: Assignment 5 Question 2
# test script
# try to import the student's solutions
imported = False
try:
import a5q2 as student_a5q2
imported = True
except:
print('a5q2 not found')
# if a5q1 isn't there, try A5Q2
if not imported:
try:
import A5Q2 as student_a5q2
print('found A5... | true |
c47b84b68232f503019310da6c321db6b7016f40 | Python | agnaldom/microservices-hands-on | /kafka-producer-microservice/server.py | UTF-8 | 1,007 | 2.5625 | 3 | [
"MIT"
] | permissive | from flask import render_template
import connexion
from producer import create
from flask_cors import CORS
# Create the application instance
app = connexion.App(__name__, specification_dir='./')
# Read the swagger.yml file to configure the endpoints
app.add_api('swagger.yml')
CORS(app.app,resources=r'/api/*... | true |
b1e7067bf9b0dcb8853fbf560fc4565e15b46055 | Python | MattScheffler/AstroFunctions | /AstroFunctionsMain.py | UTF-8 | 1,447 | 3.6875 | 4 | [] | no_license | #AstroFunctions main page
import AstroFunctionsIndex as index
#make a main menu
def mainMenu():
print("Enter the number of the function you want to use:")
print("1. Blackbody distribution plot.")
print("2. Phase plot.")
print("3. Kepler's third law.")
print("4. Flux and luminosity.")
print("5.... | true |
216724812a8dff0bf51641b1301cd93f446592f9 | Python | VamsiMohanRamineedi/Algorithms | /268.Missing_Number.py | UTF-8 | 456 | 3.4375 | 3 | [] | no_license | #Time - O(n), space - O(1)
class Solution:
def missingNumber(self, nums: List[int]) -> int:
n = len(nums)
req_sum = n * (n + 1) // 2
given_sum = sum(nums)
return req_sum - given_sum
'''
# Time and space - O(n)
class Solution:
def missingNumber(self, nums: List[int]) -> int:
... | true |
4ab2af2291f831146f9df48164b8127031dab161 | Python | toastwaffle/LiME | /lime/database/setting.py | UTF-8 | 1,590 | 2.6875 | 3 | [
"MIT"
] | permissive | """Model for user settings."""
import enum
import typing
from . import db
# pylint: disable=unused-import,ungrouped-imports,invalid-name
if typing.TYPE_CHECKING:
from typing import (
Union,
)
# pylint: enable=unused-import,ungrouped-imports,invalid-name
DB = db.DB
class SettingType(enum.Enum):
"""Valu... | true |
1ec714e231715030b35ca5274af8f1e88c7f4026 | Python | shodges201/Project-Euler | /Problem6/solution.py | UTF-8 | 731 | 4.21875 | 4 | [] | no_license | import time
def sumOfSquares(maxNum):
sum = 0
for i in range(1, maxNum+1):
sum += i * i
return sum
def sumUpToNumber(num):
if(num % 2 == 0):
sum = (num + 1) * (num // 2)
else:
sum = ((num + 1) * (num // 2)) + ((num+1)//2)
return sum
def squareOfSums(maxNum):
sum =... | true |
2b1deb305d91a407e2d0ffd4d4e00599e342a1cc | Python | lhd0320/AID2003 | /official courses/month01/day08/exercise01.py | UTF-8 | 451 | 3.5625 | 4 | [] | no_license | list01 = [
[1, 2, 3, 4, 5],
[6, 7, 8, 9, 10],
[11, 12, 13, 14, 15],
[16, 17, 18, 19, 20],
]
print(list01[0][2],end=" ")
print(list01[2][0],end=" ")
print(list01[3][2])
for c in list01[1]:
print(c,end=" ")
print()
for c in list01[3][::-1]:
print(c,end=" ")
print()
for c in list01[0]:
print(... | true |
671988b6f58b1ae4ddf280309e6002855959a0a0 | Python | CrushAndRun/Wordhunter | /modifiers/unique.py | UTF-8 | 793 | 2.75 | 3 | [] | no_license | import re
import random
from constants import NUM_TIMES
from formatting import embolden
STR_ANNOUNCE_MOD = "You "+embolden("must not")+" use any letter "+embolden("more than")+" {}!"
class modifiergenerator():
def __init__(self):
pass
def generate(self, word, round_name, involved_letters, difficulty):
if roun... | true |
5f63bc2c73254a4ba153f1945104043e09873d14 | Python | namujinju/study-note | /python/my problem/binary_steps.py | UTF-8 | 508 | 4.09375 | 4 | [] | no_license | # 자연수 n을 이진수로 바꾸고 1의 갯수를 센 후 그 갯수를 다시 이진수로 바꾸는 작업을 반복한다.
# 1이 나올 때까지 반복한다.
# 이 작업의 단계 수를 구하는 함수를 작성해라.
def bin_count(n, ans=0):
if n == 1:
print(f"n = {n}")
print(f"steps : {ans}")
return ans
else:
m = bin(n)
print(f"n = {n} ---> {m}")
n = bin(n).count("1")
... | true |
35b7f5456b5272e041f4cabbb8db0b529c36734a | Python | suhas004/Face-recognition-using-VGG6 | /predict.py | UTF-8 | 978 | 2.84375 | 3 | [] | no_license | import numpy as np
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing import image
class cricket:
def __init__(self,filename):
self.filename =filename
def prediction_cricket(self):
# load model
model = load_model('resnet.h5')
# sum... | true |
3c5a4cffcd620aede744144f3bd4f2efd217c83d | Python | RomeroLab/PU-learning-paper-analysis | /data/SUMO1/sam2mutations.py | UTF-8 | 4,543 | 2.6875 | 3 | [] | no_license | import sequence_tools
import NGS_tools
from sys import argv
### input files and options ##########################################
samfile = argv[1] # the sam file to be converted to mutations
reffile = 'SUMO1.fasta' # the sequence used as a reference in the Bowtie2 run
outfile = samfile.split('/')[-1].replace('.sa... | true |
cf77ebd3e57d02bb6aea453051740c46fbd74b30 | Python | uu-it-teaching/1DT051-2017-assignment-2 | /demo.py | UTF-8 | 5,903 | 3.921875 | 4 | [] | no_license | '''
This module demonstrates the checkKey() and checkMouse() methods
and the autoflush property of graphics.py version 5.0.
Using checkKey() and checkMouse() allows you to check for key presses
and mouse clicks without blocking the program.
getKey()
Wait (blocks) for user to press a key and return it as a string.
... | true |
67564b1c899995b313d3e941b810c0d6c1886db0 | Python | GittHubchik/PZ1 | /task_01_40-506C_Sukharev_07.py | UTF-8 | 672 | 2.953125 | 3 | [] | no_license | import numpy as np
import matplotlib.pylab as plt
import csv
import os.path
x = np.arange(-512,512,1)
A = 512
def f(x):
return -(A + 47) * np.sin(np.sqrt(abs(x / 2 +
(A + 47)))) - x * np.sin(np.sqrt(abs(x - (A + 47))))
plt.grid()
plt.plot(x, f(x))
plt.xlabel('x')
plt.ylabel('f (x)'... | true |
aec51020df0b3b7de024fce0dbecaefedba0cc7f | Python | Hedyju/hello-world | /2-9.py | UTF-8 | 516 | 3.28125 | 3 | [] | no_license | Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> # # convert.py
>>> # 화씨온도를 섭씨온도로 변환하는 프로그램
>>> def main():
print("The program converts temperatures from Fahernheit to Celsius")
print()
fahernheit ... | true |
e7d8705193a44e42c65eb66332fbd4d256dc81c1 | Python | vprotsenko/python- | /homework/lesson16/rooms.py | UTF-8 | 3,452 | 3.140625 | 3 | [] | no_license | rooms = {'1':{'name':'room1', 'description':'this is room one ', 'exit':{'east': '2', 'south': '4'}, 'invent':[]},
'2':{'name':'room2', 'description':'this is room two ', 'exit':{'west': '1','east': '3','south': '5'}, 'invent':[]},
'3':{'name':'room3', 'description':'this is room three ', 'exit':... | true |
f4a753312e50419d09699c4abc801305b5c7f9d3 | Python | nataliehan23/LeetCode-Python | /anagrams.py | UTF-8 | 625 | 3.4375 | 3 | [] | no_license | class Solution:
# @param strs, a list of strings
# @return a list of strings
def anagrams(self, strs):
new = set()
seen = set()
table = {}
res = []
for s in strs:
ss = ''.join(sorted(s))
if ss in table:
table[ss] += [s,]
... | true |
866cd6b61dbbcc242b00eeb3aafc9fb494cc762b | Python | CSU-Robosub-2017-2018/Controls | /RaspberryPi/old things/Misc/MPU6050andLCD2.py | UTF-8 | 478 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
import lcddriver
from mpu6050 import mpu6050
import math
sensor = mpu6050(0x69)
lcd = lcddriver.lcd()
while True:
accel_data = sensor.get_accel_data()
pitch = math.atan2(accel_data['z'],accel_data['y'])
roll = math.atan2(accel_data['z'],accel_data['x'])
print(pitch)
print(r... | true |
dd05bfb32ad1fd28b3952cebfde4b6feb2e167cc | Python | lalit-vasoya/python-training | /torrentbill/typeofbill/tmp.py | UTF-8 | 579 | 3.328125 | 3 | [] | no_license | from .base import Base
class TMP(Base):
""" TMP : Low Tension Temporary Supply """
def __init__(self):
""" Constructor of TMP : Low Tension Temporary Supply """
super(TMP,self).__init__() # calling a __init__ method of base class
self.cal_tmp() # calling a method of sub class or same c... | true |
cfbcd14bfb971d6ed4cc898fe1a16f8bb5b56462 | Python | hashimreja/machine-learning | /Regression/RandomForestRegressor/hrrfr.py | UTF-8 | 702 | 3.328125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
data = pd.read_csv('Position_Salaries.csv')
X = data.iloc[:,1:2].values
y = data.iloc[:,-1].values
#regressor
from sklearn.ensemble import RandomForestRegressor
#n_estimators means no trees you want to built
regressor = RandomForestR... | true |
b056eb648adc8568157b9dfc07a8bf8fae76e588 | Python | CommReteris/Ventilator-Dev | /tests/test_controller.py | UTF-8 | 13,748 | 2.796875 | 3 | [] | no_license | import time
import numpy as np
import pytest
import random
from vent.common.message import SensorValues, ControlSetting
from vent.alarm import AlarmSeverity, Alarm
from vent.common.values import ValueName
from vent.coordinator.coordinator import get_coordinator
from vent.controller.control_module import get_control_mo... | true |
3a5ec2e3f948568cacad6c9fb4b18160e6b039d4 | Python | rameshkonatala/Programming | /Spoj/EIGHTS.py | UTF-8 | 80 | 2.9375 | 3 | [] | no_license | t=int(raw_input())
for i in range(t):
k=int(raw_input())
print (250*(k-1))+192 | true |
ac4a94b3db1171b7393e2e8165cf68f9725f038f | Python | antoinewdg/pyffs | /test/automaton_management/test_automaton_manager.py | UTF-8 | 872 | 2.65625 | 3 | [
"MIT"
] | permissive | from time import time
import pytest
from pyffs.automaton_management import generate_automaton_to_file
from pyffs.automaton_management.automaton_manager import Manager
from test.utils import clean_generated_dir
class TestManager:
def test_memoization_works(self):
# The file need to be generated beforehan... | true |
46e2a3f048ba4e255726930c94c50b9beece5b04 | Python | kuzmichevdima/coding | /reducto_1/divide.py | UTF-8 | 128 | 3.40625 | 3 | [] | no_license | for i in range(1,999):
x=i
w=[0]
while x:
d=x%10;
if d in w or i%d:
break
w+=[d];x//=10
if x<1:
print(i,end=' ')
| true |
17ad45e935d810413411b996910b9f70d496b937 | Python | CWNUMIT/mit_algorithm_study | /2020_01_06/이건탁/nan_anya - paperfolding.py | UTF-8 | 365 | 2.921875 | 3 | [] | no_license | def solution(n):
answer = [0]
for i in range(n-1):
temp = []
temp = answer[:]
temp.reverse()
for j in range(0, len(temp)):
if temp[j] == 1:
temp[j] = 0
else :
temp[j] = 1
answer.append(0)
... | true |
83f9600110747cd6567c6305aa87156466cb4493 | Python | miltonbd/computer_vision_utils | /vision_utils/fileutils.py | UTF-8 | 995 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | import csv
import json
import os
from os.path import *
def create_dir_if_not_exists(dir):
if not os.path.exists(dir):
os.makedirs(dir)
def check_if_exists(dir):
return os.path.exists(dir)
def read_csv_file(csv_path):
with open(csv_path) as csv_file:
csv_reader = csv.reader(csv_file, delim... | true |
d269b603e9cf7138cb01c0244251da173cb39cbd | Python | Hyunjong1461/python | /200215/시험 성적.py | UTF-8 | 169 | 3.328125 | 3 | [] | no_license | A = int(input())
if 90<=A<=100:
print('A')
if 80<=A<=89:
print('B')
if 70<=A<=79:
print('C')
if 60<=A<=69:
print('D')
elif A<60 or A>100:
print('F') | true |
c75e4ee3bc9ef5adebf10b12be1c30735374411c | Python | JimBlaney/patchwork | /patchwork/_labeler.py | UTF-8 | 11,976 | 2.6875 | 3 | [
"MIT"
] | permissive | """
_modelpicker.py
GUI code for training a model
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import panel as pn
import os
import warnings
from patchwork._sample import find_subset
from patchwork._util import shannon_entropy#, tiff_to_array
de... | true |
04e3f805db04cd2b66c0ac814844d5c5eddecef8 | Python | onmyway4212/Reptilian | /077多线程5.py | UTF-8 | 162 | 2.71875 | 3 | [] | no_license | import threading
threadobj = threading.Thread(target=print, args = ['cat','dog','freogs'],
kwargs = {'sep': ' & '})
threadobj.start() | true |
eef9795960a0e6ae94ea8333437aac5a76d49aa1 | Python | wkoszek/book-real-world-haskell | /examples/ch02/myDrop.py | UTF-8 | 142 | 2.953125 | 3 | [
"BSD-2-Clause"
] | permissive | ## snippet myDrop
def myDrop(n, elts):
while n > 0 and elts:
n = n - 1
elts = elts[1:]
return elts
## /snippet myDrop
| true |
2f714c4e4673e21b51f28110d9a27ff9c10cc64b | Python | m-kostrzewa/pajton | /point.py | UTF-8 | 579 | 3.71875 | 4 | [
"MIT"
] | permissive | class Point:
def __init__(self, x = 0, y = 0):
self.x = x
self.y = y
def scale(self, scalar):
return Point(self.x * scalar, self.y * scalar)
def add(self, other):
return Point(self.x + other.x, self.y + other.y)
def subtrac... | true |
817e46a24d8c01acb26776a52e59536733bdf42c | Python | zsennenga/scorched-earth-mountain | /file_formats/structs/mtn.py | UTF-8 | 3,112 | 3.046875 | 3 | [
"MIT"
] | permissive | from construct import *
mtn_struct = Struct(
"signature" / Const(b"MT\xbe\xef"),
"version" / Const(1, Int16ub) * "Version number of the file.",
"width" / Int16ul,
"minimum_bytes_per_row" / Int16ul * "Likely used to aid resizing",
"height" / Int16ul * "Seems to be decreased by 1 when using the stand... | true |
022fb92b2ab7691a059b1f05adb13ef3b4893ab6 | Python | GLO3013-E4/COViRondelle2021 | /station/path_planning/pathfinding/breadth_first_search.py | UTF-8 | 1,729 | 3.34375 | 3 | [
"MIT"
] | permissive | """
Algorithm that finds a path from a starting node to the first node met with a TileRole.END role.
"""
from collections import deque
from pathfinding.pathfinding_algorithm import PathfindingAlgorithm
from pathfinding.path_not_found_exception import PathNotFoundException
from pathfinding.tile_role import TileRole
... | true |
9232820ae73b1a20a0cc25680eace967b32f9428 | Python | corbinmcneill/gbnid | /scripts/maxmin.py | UTF-8 | 544 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | from sys import argv, maxint
filename, inputfilename = argv
lines = [line for line in open(inputfilename, 'r')]
biggest = [0 for i in range(41)]
smallest = [maxint for i in range(41)]
k=0
for i in lines:
if k%10000 == 0:
print k
values = i.split(',')[:-1]
for j in range(41):
if not j in [1,2,3]:
if float(... | true |
38b18c29eecb8e126dc8a8348cc8aaa78cb5834a | Python | jackharrhy/muntrunk | /muntrunk/data.py | UTF-8 | 1,260 | 2.828125 | 3 | [] | no_license | import shelve
import logging
from typing import List
from pydantic import BaseModel
from .types import Semester
from .parse import parse_semester
from .scrape import fetch_banner
logger = logging.getLogger(__name__)
# BIG MASSIVE TODO
# if the initial year is 2000, this uses up
# too much ram on my VPS and kills it... | true |
cccfe9685cb8893caa172d1b02a00c429975aad5 | Python | AdvancingStone/stock-data-analysis-and-prediction | /src/main/python/com/bluehonour/utils/Utils.py | UTF-8 | 4,402 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
from pathlib import Path
import os
import shutil
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.chrome.options import Options
from readConfig import ReadConfig
from datetime import datetime
class Utils:
"""
工具类
"""
@sta... | true |
86ce9ecb477c12fdf8b55217c197e43be9886d9e | Python | Larleyt/mst-test-case | /api/models.py | UTF-8 | 2,443 | 2.53125 | 3 | [] | no_license | from sqlalchemy.orm import synonym
from . import db
books = db.Table('books',
db.Column(
'book_id',
db.Integer,
db.ForeignKey('book.id'),
primary_key=True
),
db.Column(
'transaction_id',
db.Integer,
db.ForeignKey('transaction.id'),
primary_k... | true |
cdb5c0da0f39769f88ccfabad6ae789da5190c39 | Python | nikhiilll/Data-Structures-and-Algorithms-Prep | /Arrays/LeetCode/MinimumAbsoluteDifference_1200.py | UTF-8 | 1,954 | 3.234375 | 3 | [] | no_license | # def minimumAbsDifference(arr):
# diff_dict = {}
# n = len(arr)
# for i in range(n - 1):
# for j in range(i + 1, n):
# abs_diff = abs(arr[i] - arr[j])
# if abs_diff not in diff_dict:
# if arr[i] < arr[j]:
# diff_dict[abs_diff] = [[arr[i]... | true |
f11147fbb2c62933fee9178cce1473fbcdcf9d7c | Python | brdimitrius/works.py | /vehicle_searcher.py | UTF-8 | 1,620 | 3.25 | 3 | [] | no_license | import requests
import re
import locale
getlang = locale.getdefaultlocale() # Lang
lang = (getlang[0]) # Lang
if lang == "pt_BR":
langen = False
langbr = True
marca = input("Coloque a marca do carro aqui: ")
modelo = input("Coloque o modelo do carro aqui: ")
elif lang != "pt_BR":
langen = True
... | true |
2cf480b9788127d61fe30daca7cc50e015968e3b | Python | CalilQ/ComDig | /3. Data types and operators/arithmetic_operators.py | UTF-8 | 343 | 4.25 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 19 15:49:02 2017
@author: Calil
"""
# Declarar variaveis
a = 10
b = 3
c = 3.1415
# Soma
r1 = a + b
print(r1)
# Subtracao
r2 = a - c
print(r2)
# Multiplicacao
print(a*5.3)
# Divisao real
print(a/b)
# Modulo
print(a%b)
# Expoente
print(b**3)
# Divisao inteira (floo... | true |
4d234da400edeaa4969fab585d8a527a3f1a2a5d | Python | jemmyperez28/TestPython | /pregunta5.py | UTF-8 | 524 | 4.21875 | 4 | [] | no_license | """ Escribir una funcion sum() y una función multip() que sumen y multipliquen respectivamente todos los números de una lista. """
#numeros=[1,2,3,4]
#suma=sum(numeros)
#print(suma)
#resultado=1
#for x in numeros:
# resultado=resultado*x
#print(resultado)
def suma(lista=[],*args):
suma=sum(lista)
retur... | true |
ea953ede5e5ce8b252cd2ad5a16f7ee7d9688388 | Python | ganeshsutar/opencv-tutorials | /show-image.py | UTF-8 | 612 | 2.546875 | 3 | [] | no_license | #! /usr/bin/python
import cv2
import argparse
import logging
parser = argparse.ArgumentParser(description="Feature Matchers with ORB")
parser.add_argument('-v', '--verbose', help='Set logging level to DEBUG', action='store_true')
parser.add_argument('image', help='Path of the image you want to see')
args = parser.pa... | true |
39dd9fafe400a746c4a7e28803dfae0de073f0b9 | Python | ponedo/legal_IE | /src/try_ner_with_tools/nltk_ner.py | UTF-8 | 1,714 | 2.796875 | 3 | [] | no_license | import nltk
import os
from nltk.tokenize import word_tokenize, sent_tokenize
from nltk.tag import pos_tag
from nltk import tree2conlltags, conlltags2tree
from nltk import ne_chunk
from nltk import RegexpParser
data_dir = "..\\ivan_data\\merged"
file_list = os.listdir(data_dir)
ex = 'European authorities fined Google ... | true |
15c9f35a91bea84d619631bac5d8f611884346f5 | Python | ekmahama/Dataminr-interview | /rotateMatrix.py | UTF-8 | 760 | 3.71875 | 4 | [] | no_license | """
You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).
You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
"""
def rotateClokwise(matrix):
matrix.reverse()
fo... | true |