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 |
|---|---|---|---|---|---|---|---|---|---|---|
669a10c87489ff0308c1726c246f117f25eea84e | Jdababneh/work | /hack2.py | UTF-8 | 350 | 2.75 | 3 | [] | no_license | #!/usr/bin/python
from __future__ import unicode_literals
import subprocess
import json
import sys
import re
import os
print ("\n\nWelcome to the magic machine\n")
print ("Enter the name of the love of your life\n")
name = raw_input()
print("\n")
print (name + " is the most amazing girl ever oh gosh\n")
print ("This ... | true |
011b226cf6238d8d92b50f7243a17f6e6a0e9d3a | zxgdll/machinelearning | /BPNN/BPnn.py | UTF-8 | 3,808 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python
#coding=utf-8
#BP神经网络模型实现
#作者:zxgao
#BP神经网络原理:http://www.hankcs.com/ml/back-propagation-neural-network.html
import math
import random
random.seed(0)
def rand(a,b):
"""
生成一个(a,b)范围内的随机数
"""
return (b-a)*random.random()+a
def makeMatrix(m,n,fill=0.0):
"""
创建矩阵,行数为:m,列数为:n
填充 0.0
"""
res=[]... | true |
ddaacd110b2f1e48230ab3a5f9a593b13751c02f | johnesteban/ST0245-002 | /proyecto/codigo/Entrega 3- Final/VecinoMasCercano_.py | UTF-8 | 1,528 | 2.90625 | 3 | [] | no_license | import numpy as np
import math
def vecinoCompresion(archivo,tamano):
copia=np.copy(archivo)
filas,columnas=copia.shape
filaSalida=int(filas*tamano)
columnaSalida=int(columnas*tamano)
salida=np.zeros((filaSalida,columnaSalida))
filaElegida=0
columnaElegi... | true |
3fa6e7c2bdaa678760b8392bd72fc3172a60bf73 | sebastianpinedaar/machine-learning-codes | /master-labs-2S/Exercise1/exercise1-b.py | UTF-8 | 1,488 | 2.9375 | 3 | [] | no_license | #Author: Sebastian Pineda Arango
#Institution: University of Hildesheim
#Year: 2019
#Functionality: This script should be called with mpiexec and is
#able to find the average of a randomly generated using several processes
#that communicate with each other using MPI.
# #importing libraries
from mpi4py import MPI
import... | true |
727f60115ad9b8d93c1694452c370879dbe42784 | jiangkangkang/tornado_oms | /utils/verification_code.py | UTF-8 | 2,460 | 3.1875 | 3 | [] | no_license | from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import random
import os
def getRandomColor():
'''获取一个随机颜色(r,g,b)格式的'''
c1 = random.randint(100, 255)
c2 = random.randint(100, 255)
c3 = random.randint(100, 255)
return (c1, c2, c3)
def getRandomStr():
'''获取一个随机字符串,每个字符... | true |
8d5fad838984c3812e8514f99b3dcdaa15b24489 | Jim-bin/Python-spider | /meizitu3.py | UTF-8 | 13,083 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
python 3.5.2
'''
# 导入模块
import time
import requests, re, random, os
from bs4 import BeautifulSoup
def ip_test(ip, url_for_test='https://www.baidu.com', set_timeout=10):
'''
检测爬取到的ip地址可否使用,能使用返回True,否则返回False,默认去访问百度测试代理
:param ip:
:param url_for_test:
:param set_timeou... | true |
7f6f7e0d6b56bb1705c83487a925c6cf794787a2 | shewey/exploit-db | /platforms/windows/remote/30816.py | UTF-8 | 1,561 | 3.046875 | 3 | [] | no_license | source: http://www.securityfocus.com/bid/26604/info
Autonomy KeyView is prone to multiple buffer-overflow vulnerabilities.
Successfully exploiting these issues could allow an attacker to execute arbitrary code in the context of the user running the application.
Multiple applications incorporate the vulnerable ... | true |
0b89cf03f5d28f9457124b3eeb4140552df1ecb2 | Yangidan/LeetCode50 | /#46_Permutations.py | UTF-8 | 639 | 3.375 | 3 | [] | no_license | # day 17 2019-05-26 Sun
# 46. Permutations
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
# a list of len 1 or less only has one permutation: itself
if len(nums) <= 1:
return [nums]
else:
perms = []
# for each num n, co... | true |
8f78a37a48ed78ffc0cd70c4f81e7e3de58a68d9 | goheea/CSOS-Algorithm | /BOJ/1764/dkdlelk99.py | UTF-8 | 359 | 2.859375 | 3 | [] | no_license | import sys
# input
N, M = map(int, sys.stdin.readline().split())
known = set()
for _ in range(N):
known.add(sys.stdin.readline().rstrip())
answer = [0]
for _ in range(M):
check = sys.stdin.readline().rstrip()
if check in known:
answer.append(check)
answer[0] += 1
# output
print(answer.pop(0)... | true |
2b714b17d4c53a86975de218c77e393e07949d43 | thucuc1996/linux | /sv.py | UTF-8 | 931 | 2.640625 | 3 | [] | no_license | class SV:
MSSV=""
Hoten=""
Khoa=""
def __init__(self,MSSV,Hoten,Khoa):
self.MSSV=MSSV
self.Hoten=Hoten
self.Khoa=Khoa
def toString(self):
print(self.MSSV,self.Hoten,self.Khoa)
def getMSSV(self):
return self.MSSV
def getHoten(self):
return self.Hoten
def getKhoa(self):
return self.Khoa
class KH:
M... | true |
c549ab8b89c849da7c3a6c6878c6221200df3b2a | VictorAdamse01/PythonWeek1 | /Les2/pe2_2.py | UTF-8 | 306 | 3.078125 | 3 | [] | no_license | cijferICOR = 7.0
cijferPROG = 8.5
cijferCSN = 7.5
gemiddelde = (cijferCSN + cijferICOR + cijferPROG) / 3
beloning = (cijferCSN + cijferICOR + cijferPROG) * 30
overzicht = 'Mijn cijfers (gemiddeld een ' + str(round(gemiddelde,1)) + ') leveren een beloning van € ' + str(beloning) + ' op!'
print(overzicht) | true |
74df346d8a80ab4cbe7faaf8240810ba01e4f483 | DaaBomb/DBMS_Project | /Group_13/enroll/client.py | UTF-8 | 643 | 2.625 | 3 | [] | no_license | from ftplib import FTP
import os
class ftp_client():
def __init__(self,hostname,uid,pwd,port=1026):
self.ftp = FTP('')
self.ftp.connect(host=hostname,port=port)
self.ftp.login(uid,pwd)
self.ftp.cwd('')
def uploadFile(self,filename, name, tp):
fls = filename.split("/")
fname = fls[len(fls)-... | true |
ca09160edd2ad95b0f6cee5c1d764367a9c7c431 | SantoshKumarSingh64/January2021-LeetCode-Monthly-Challenge | /D21/PythonSolution.py | UTF-8 | 550 | 3 | 3 | [] | no_license | class Solution:
def mostCompetitive(self, nums: List[int], k: int) -> List[int]:
stack = []
numbersToRemoved = len(nums)-k
for x in nums:
while stack and numbersToRemoved > 0 and stack[-1] > x:
stack.pop()
n... | true |
9d79c020730e13f53db9670b5daa875404023ce5 | tanujdey7/Python-Basics | /forLoop.py | UTF-8 | 246 | 3.46875 | 3 | [
"MIT"
] | permissive | fruit = ['mango','apple','orange']
for i in fruit:
print(i)
print('\r')
for value in range (-2,5):
print(value)
print('\r')
for value in range (0,10,2):
print(value)
print('\r')
name = 'Tanuj'
for i in name:
print(i) | true |
f5ddf055098922ec302fe306c25c50cdb3b01d6a | BridgesLab/Lab-Website | /personnel/api.py | UTF-8 | 8,415 | 3.28125 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | '''This package controls API access to the :mod:`personnel` app.
Overview
--------
The API for the :mod:`personnel` application provides data on people. The data can be provided as either a group of people or as a single person. Only GET requests are accepted.
These urls are served at the endpoint **/api/v1/personn... | true |
15f214614e05fb4a6254dd10bfdaabc09f9b8528 | tassioferenzini/Graph---Network-Analyzer | /homo.py | UTF-8 | 1,436 | 3.03125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import networkx as nx
import os
import csv
import codecs
def main():
instance_path = "/Users/tassio/PycharmProjects/Graph---Network-Analyzer"
file_list = [f for f in os.listdir(instance_path)
if f.startswith('') and f.endswith('1408.csv')]
for f... | true |
58c95d7104f1c3bca36cf7d4d155e392408c8213 | drewfustin/pelican-sites | /drewfustin/plugins/liquid_tags/code.py | UTF-8 | 3,016 | 2.734375 | 3 | [
"MIT"
] | permissive | """
Code Tag
---------
This implements a Liquid-style code tag for Pelican,
based on the octopress image tag [1]_
Syntax
------
{% code /path/to/code [language:X] [lines:X-Y] [:download:] %}
Examples
--------
{% code test/code/code.py %}
{% code
test/code/code.py
language:python
lines:20-30
:download:
%... | true |
c20a89075ba799349d303dd051499168ebee3b77 | SUMAN147/PROJECT | /Practice/Tensorflow/3_NeuralNetworks/CNN_raw.py | UTF-8 | 3,900 | 3.171875 | 3 | [] | no_license | """ Convolutional Neural Network
Build and train a convolutional neural network with TensorFlow.
This example is using the MNIST database of handwritten digits
"""
from __future__ import division, print_function, absolute_import
#Import MNIST data
from tensorflow.examples.tutorials.mnist import input_data
mnist = inp... | true |
6b051d1d4eb508a71e8e1b9178952d282e5337ca | sjzyjc/leetcode | /200/200-uf.py | UTF-8 | 2,198 | 3.125 | 3 | [] | no_license | class UnionFind:
def __init__(self, grid):
n = len(grid) * len(grid[0])
self.parents = [i for i in range(n)]
for i in range(len(grid)):
for j in range(len(grid[i])):
if grid[i][j] == "0":
self.parents[i * len(grid[0]) + j] = -1
... | true |
f046db2cee6b4eed0382e152a2f4c8f18a878df5 | JonathonJackQueryLai/graduate | /crawl/Anjuke/chaojiying.py | UTF-8 | 4,540 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# coding:utf-8
import hashlib
import math
import time
import requests
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
"""
MD5: C734C4372BB422EDCA8F3E32D0D321CA
SHA1: 3EC2079B9B5CCAC3B51A9F955110F095A2AD7EB1
CRC32: 1166E524
"""
# 发送代码的
class Chaojiying_Clie... | true |
7447177a18221df637a174d0c9d275d81ae3bc7e | Filz0r/nginx-defender | /lib/menu.py | UTF-8 | 2,931 | 3.125 | 3 | [] | no_license | from lib.modules.log_parser import log_parser
from lib.modules.ip_filter import log_finder
from lib.modules.geo_ip import geo_ip
from lib.modules.ip_blocker import ip_blocker
from lib.modules.log_import import log_import
from lib.modules.result import result
# This is my menu solution so far you input the number of t... | true |
b8275fdf66933d379a9ae1fdb120b4cf1c4828c3 | codeIsAPoetry/PythonApplication1 | /PythonApplication1/module.py | UTF-8 | 720 | 3.09375 | 3 | [] | no_license | import math
def sum(x,y):
return x+y
def div(x,y):
return x/y
def mult(x,y):
return x*y
def sub(x,y):
return x-y
def recfact(x):
if x==1:
return x
return x*recfact(x-1)
def recsum(lst):
if lst==[]:
return 0
return lst[0]+recsum(lst[1:])
def recmult(lst):
if l... | true |
4969a2c453b8a408256d78f219cf378e7c578684 | jinyangb/WeatherTalk | /models/post.py | UTF-8 | 1,617 | 2.53125 | 3 | [] | no_license | from datetime import datetime
from models.db import db
class Post(db.Model):
__tablename__ = 'posts'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), nullable=False)
location = db.Column(db.String(80), nullable=False)
content = db.Column(db.String(255))
temperature ... | true |
ad2dfc85ead6d4df3f4e46c4a43199583779fa26 | kaz-koba/MI-BCI | /CSPmodel.py | UTF-8 | 8,149 | 2.6875 | 3 | [] | no_license | import numpy as np
import scipy.linalg as la
from mne import cov as co
class CSP():
def __init__(self, n_components=10, reg=None, log=None, cov_est="concat",
transform_into='average_power', norm_trace=False,
cov_method_params=None, rank=None):
"""Init of CSP."""
#co... | true |
d5cbc799ed5fd1bd68fb4bf4cbac555e34731edf | StefansM/EaterCpu | /test/test_logic_parts.py | UTF-8 | 16,329 | 2.671875 | 3 | [] | no_license | import dataclasses
from typing import List, Optional, Tuple
import pytest
import eater.part
@pytest.fixture(params=eater.part.PoweredPart.__subclasses__())
def logic_gate(request) -> eater.part.PoweredPart:
return request.param()
def init_power(part: eater.part.PoweredPart):
part.VCC.set(eater.part.Voltag... | true |
ea9eb60c23b3c14dc814edf4d90b719becc011d9 | giorgioottolina94/Data-Management-and-Visualization | /my-data/API Aria Producer.py | UTF-8 | 3,280 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ## Import
# In[1]:
#get_ipython().system('pip install sodapy')
#get_ipython().system('pip install kafka-python')
# In[1]:
import json
from sodapy import Socrata
from datetime import datetime, timedelta
from dateutil.parser import parse
# ## Functions
def change_format... | true |
51b08ed829f6424c794a86b4263dbaf0aee95e06 | shlvd/Leetcode_Hackerrank | /Easy/pascals_triangle_ii.py | UTF-8 | 219 | 2.71875 | 3 | [] | no_license | def getRow(self, rowIndex: int) -> List[int]:
if rowIndex == 0: return [1]
res=[1]
for i in range(rowIndex):
res = [1]+[a+b for a, b in zip(res[:-1],res[1:])] +[1]
return res
| true |
bbbc242cc7f143d039b32cd49bfd4b9b79357665 | juliovt-07/Exercicios-Python | /Variaveis 39.py | UTF-8 | 170 | 3.328125 | 3 | [] | no_license | v = float(780.000)
g1 = v*0.46
g2 = v*0.32
resto = ((0.46+0.32)-1.00)
g3 = v*(resto*(-1))
print("1º Ganhador: ",g1)
print("2º Ganhador: ",g2)
print("3º Ganhador: ",g3) | true |
707b336e75eb226d259a98bfe027bce0384c469d | danielsbonnin/rpiStopMotion | /test/testMovie.py | UTF-8 | 3,303 | 3.125 | 3 | [] | no_license | ''' testMovie.py '''
import unittest
import movie
import pickle
def exampleMovie():
testMovie = movie.Movie()
testMovie.capture_count = 100
testMovie.frame_count = 0
testMovie.cur_frame = 1
testMovie.preview_count = 20
testMovie.data_file = "testData.p"
return testMovie
class movieTest(unit... | true |
a88e7a03aa31419e149aca89025e23e7cb4dc007 | mhelmih/tubes-daspro | /function/login.py | UTF-8 | 1,896 | 3.734375 | 4 | [] | no_license | from function.hashing import hash # pylint: disable=import-error
def cekSama(nama, listKamus, data):
# untuk memeriksa apakah suatu nama sama dengan sebuah value dari data pada array of dictionary
count = 0
for i in range (1,len(listKamus)):
if (nama == listKamus[i][data]):
count += 1
... | true |
12faf039a81714db8d4b4fc41c26a57d14c143f4 | itsEmShoji/TCScurriculum | /2_dungeon_crawl/complete_solution/autograder/grader.py | UTF-8 | 1,153 | 2.84375 | 3 | [
"MIT"
] | permissive | import subprocess
import csv
# Compares the expected output to the actual based on naming convention
# Test Name: test{name}_{map/coord}.txt
# Sol Name: test{name}_{stack/queue}.txt
# Student output Name: student{name}_{stack/queue}.txt
# A test can have both stack and queue solutions available to compare
def compare_t... | true |
7d0a663af57dde9e515a60723a5b2b141ee43ae8 | jonstaebell/grandfather | /grandfather.py | UTF-8 | 2,297 | 2.875 | 3 | [] | no_license | #Grandfather clock application by Jon Staebell 1/4/2019
import datetime, time, pychromecast, urllib.request
# set beginning and ending hours for the clock chimes
beginhour = 7
endhour = 21
# Set volume for clock chimes between 0 and 1:
clockvolume = .2
# display debug messages?
debug = False
# Your Chromecast devi... | true |
0aa7e787d8a1efe84f5af4223a3e309bbaae4ec3 | dantclee/how-to-think-like-a-computer-scientist | /3.4.4_4(2)_d.py | UTF-8 | 117 | 3.125 | 3 | [] | no_license | numbers = [12, 10, 32, 3, 66, 17, 42, 99, 20]
product = 1
for _ in numbers:
product = product * _
print(product)
| true |
776bb5092daf994cf3dbca1f911a057535ac5546 | cnwangfeng/integration-prototype | /common/test/state_machine_test.py | UTF-8 | 1,727 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | import unittest
from sip_common.state_machine import State
from sip_common.state_machine import StateMachine
trace = []
class Offline(State):
def __init__(self, sm):
trace.append("entering offline")
def exit(self):
trace.append("exiting offline")
class Online(State):
def __init__(self, s... | true |
f6c09a27f0d0181431568a7c67463e6f6e403ff6 | BBangNa/Asia_GAN-2 | /prj2_Movie_for_you/movie_recommendation_system.py | UTF-8 | 4,192 | 3.125 | 3 | [] | no_license | # import pandas as pd
# from sklearn.metrics.pairwise import linear_kernel
# from scipy.io import mmwrite, mmread
# import pickle
#
# df_review_one_sentence = pd.read_csv('./crawling/one_sentence_review_2016_2021.csv', index_col=0) # 데이터 프레임
# Tfidf_matrix = mmread('./models/tfidf_movie_review.mtx').tocsr() # 매트... | true |
b7d7c499a7a5e6c5165a8326600dcd166f3de244 | ffabut/kreap1 | /3/ukol1.py | UTF-8 | 375 | 3.9375 | 4 | [] | no_license | x = input() # uzivatel zada cislo a to ulozime do promenne X (pozor: input() vraci datovy typ string)
x = int(x) # a proto string prekonvertujeme pomoci funkce int() na cele cislo
if x > 100:
print("cislo je vetsi nez 100!")
if x < 100:
print("cislo je mensi nez 100!")
# vsimneme si, ze jsme vlastne nepokryl... | true |
5396dc2cf876b74c88bf3e46fc52fa63478b18f2 | Masa-74/stock_preb | /msvc/py/services/utils/date_manager_util.py | UTF-8 | 1,679 | 3.5 | 4 | [] | no_license | # -- Load libraries
from datetime import timedelta, date
import os, sys, traceback
########################################################
# Get a daily range from start_date to end_date.
# The range includes start_date and end_date too.
# Input:
# - start_date <Type: datetime.date>:
# - end_date <Type: datetime... | true |
8168919123b14c1fb6e33784e93d723c4a7d1e94 | ggsant/pyladies | /iniciante/Mundo 03/Exercícios Corrigidos/Exercício 082.py | UTF-8 | 756 | 4.65625 | 5 | [
"MIT"
] | permissive | """
EXERCÍCIO 082: Dividindo Valores em Várias Listas
Crie um programa que vai ler vários números e colocar em uma lista. Depois disso, cria duas listas extras que vão
conter apenas os valores pares e os valores ímpares digitados, respectivamente. Ao final, mostre o conteúdo das
três listas geradas.
"""
num = list()
p... | true |
c65452e36600e5e965c7d1292ed6aaf611d3c896 | harishk-97/python | /beginner level/printnumber52.py | UTF-8 | 423 | 3.328125 | 3 | [] | no_license | m=input()
m=list(map(int,m))
n=len(m)
if (n<2):
if(m[0]==1):
print('One')
elif(m[0]==0):
print('Zero')
elif(m[0]==2):
print('Two')
elif(m[0]==3):
print('Three')
elif(m[0]==4):
print('Four')
elif(m[0]==5):
print('Five')
elif(m[0]==6):
print('Six')
elif(m[0]==7):
print('Sev... | true |
1437a0a36aaefd9453062fd20a477a39b48b0490 | jh-lau/leetcode_in_python | /01-数据结构/链表/1290.二进制链表转整数.py | UTF-8 | 1,236 | 3.84375 | 4 | [] | no_license | """
@Author : liujianhan
@Date : 2020/4/15 上午10:41
@Project : leetcode_in_python
@FileName : 1290.二进制链表转整数.py
@Description : 给你一个单链表的引用结点 head。链表中每个结点的值不是 0 就是 1。已知此链表是一个整数数字的二进制表示形式。
请你返回该链表所表示数字的 十进制值 。
示例 1:
输入:head = [1,0,1]
输出:5
解释:二进制数 (101) 转化为十进制数 (5)
示... | true |
99a1ce95c195e919cc12305feeb9fc3b68b12f26 | thijsrmbecker/classify_w_deferral_seizure | /classification_w_deferral/segment_count.py | UTF-8 | 871 | 2.96875 | 3 | [] | no_license | import numpy as np
def count_segments(segments_to_check, total_length):
n_seg = 0
seg_length = []
n_segments_algo = np.array(segments_to_check).shape[0]
if segments_to_check[0][0] != 0:
n_seg += 1.
seg_length.append(segments_to_check[0][0] - 1)
for i in range(n_segments_algo-1):
... | true |
d5840e6d118ea6b1b5f0d6d84f799dd02212465b | xflashxx/seq2seq_nmt_att | /model.py | UTF-8 | 5,606 | 2.859375 | 3 | [
"MIT"
] | permissive | '''
Definition of Seq2Seq Attention model.
Implemention after Luong(2015) with score function: "concat"
'''
import tensorflow as tf
from tensorflow.keras.layers import (LSTM, Concatenate, Dense, Embedding, Input, Layer)
from tensorflow.keras.models import Model
from hyperparameters import K
from attentionLayer import ... | true |
f404991617961e3d08bbc23e19c117a841e6558a | posm/osm-export-tool2 | /utils/shp.py | UTF-8 | 3,944 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import with_statement
import argparse
import logging
import os
import shutil
import subprocess
from string import Template
logger = logging.getLogger(__name__)
class SQliteToShp(object):
"""
Convert sqlite to shapefile.
"""
def __init__(self, sqlite=None, sha... | true |
ebcfdca77837207e45d182ed0fe5f1e59d592f75 | akvir-k/IMDB-website | /task3.py | UTF-8 | 389 | 2.96875 | 3 | [] | no_license |
import pprint,string
from task1 import scrape_top_list
def group_by_decades(scrape_top_list):
group={}
for i in scrape_top_list:
value=i['year']
value=value//10
new_value=int(str(value)+'0')
if new_value not in group:
group[new_value]=[]
group[new_value].append(i)
else:
group[new_value].append(i... | true |
1a5a1016bf26263dc56c7b94a07d4329a553a6d1 | dishant470266/hacker_rank | /add_list_append.py | UTF-8 | 1,171 | 4.09375 | 4 | [] | no_license | # fruits = ['banana','apple']
# fruits.append('mango')
# print(fruits)
#=======================================
#more method to add data
# fruits1 = ['banana','apple']
# fruits1.insert(1,'mango')
# print(fruits1)
#========================================
#extend_method
# fruits1 = ['banana','m... | true |
fc20e7eec1c68c829a03279ce21da635d38bf2dd | takin6/algorithm-practice | /at_coder/abc/old/148/d_3.py | UTF-8 | 188 | 3.03125 | 3 | [] | no_license | N = int(input())
A = list(map(int,input().split()))
cnt = 0
cur = 1
for i in A:
if i == cur:
cur += 1
else:
cnt += 1
if cnt == N:
print(-1)
else:
print(cnt) | true |
bbc57777424f696844f7e498b402b19df329f09b | marissabhavsar/dcfanalysis | /collectData.py | UTF-8 | 3,129 | 2.953125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from csv import writer
def getTicker():
ticker = input("Enter Ticker: ").upper()
return ticker
#for each separate website link (3) have a function that collects necessary data and organizes it
#income statement: total revenue, net income (in drop down)
#cash f... | true |
8b07f2771fbcae855b8525cac95bd1ddf8a7184b | shiki7/Atcoder | /ABC035/C.py | UTF-8 | 345 | 2.8125 | 3 | [] | no_license | import itertools
N, Q = map(int, input().split())
lr = [list(map(int, input().split())) for _ in range(Q)]
a = [0] * (N+1)
# いもす法
for i in range(Q):
le = lr[i][0]
ri = lr[i][1]
a[le-1] += 1
a[ri] -= 1
ans = []
a = list(itertools.accumulate(a))
for i in range(N):
ans.append(a[i] % 2)
print(''.join... | true |
47fdda3bf16f1e028a002370e7de0e304da3b84e | Alfred-N/EQ2341-Assignment3 | /PattRecClasses/DiscreteD.py | UTF-8 | 2,514 | 3.234375 | 3 | [] | no_license | import numpy as np
class DiscreteD:
"""
DiscreteD - class representing random discrete integer.
A Random Variable with this distribution is an integer Z
with possible values 1,...,length(ProbMass).
Several DiscreteD objects may be collected in an array
"""
def __init__(self, x):
... | true |
bc02627d5071cf725ae36ed08ee453469597ba8b | wan-catherine/Leetcode | /test/test_N2808_Minimum_Seconds_To_Equalize_A_Circular_Array.py | UTF-8 | 889 | 3.40625 | 3 | [] | no_license | from unittest import TestCase
from problems.N2808_Minimum_Seconds_To_Equalize_A_Circular_Array import Solution
class TestSolution(TestCase):
def test_minimum_seconds(self):
self.assertEquals(1, Solution().minimumSeconds([1,2,1,2]))
def test_minimum_seconds_1(self):
self.assertEquals(2, Solutio... | true |
d9b33e0a7175c5608de6a8f93ee8dbd38dde996c | Way-U-Need/ContentAggregator | /categories/main.py | UTF-8 | 3,433 | 3.09375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from dataclasses import dataclass
import threading
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
}
@dataclass
class Part():
'''
Class to Represent a Part from a given ... | true |
bf6cd515d8651c1110402b6b386d96a111a51333 | caoxinling98/selenium-ui | /API/切换至bing网站.py | UTF-8 | 342 | 2.671875 | 3 | [] | no_license | from selenium import webdriver
driver = webdriver.Chrome('../../chromedriver.exe')
driver.get("file:///D:/python/selenium_pages-master/swtich_window_sample.html")
mainWindow = driver.current_window_handle
a = driver.find_element_by_tag_name("a")
a.click()
driver.switch_to.window(driver.window_handles[1])
print(driver.... | true |
1e12cf1f56823a324187c172ddf80133fbeb1065 | JadenTurnbull/Crash-Course-Python | /chap08/TryItYourself_p221.py | UTF-8 | 213 | 4.15625 | 4 | [] | no_license | #8-15
def make_shirt(size, *colors):
"""Summarize the pizza we are about to make."""
print(f"\nMaking a shirt with size {size} with the following color combinations:")
for color in colors:
print(f"- {color}") | true |
8648b366d9c9b8805a328c27bec00e2839738b19 | gmaxwell1/pyECB_gmaxwell | /modules/general_functions.py | UTF-8 | 9,752 | 3.203125 | 3 | [] | no_license | """
filename: general_functions.py
The following functions are of general use for file management and simple calculations.
They also contain transformations between the different coordinate systems in use,
namely stage coordinates, (Metrolab) sensor coordinates and magnet coordinates.
Author: Nicholas Meinhardt (Q... | true |
c7e9c99e4326c01003d8cd6b1da00be4c131be5c | pinetree408/apss | /projects.py | UTF-8 | 4,003 | 2.84375 | 3 | [] | no_license | class Solver:
def __init__(self):
self.INF = 2000000000
def network_flow(self, n, m, source, sink, capa, flow):
total_flow = 0
while True:
parent = [-1 for i in range(n+m+2)]
q = [source]
parent[source] = source
while len(q) != 0 and paren... | true |
1a4fb43db09176c9e9e1916715bbfcb1d70c3b96 | ssm160930/Nutriack | /QR_Gen_Code.py | UTF-8 | 252 | 2.90625 | 3 | [] | no_license | from qrcode import *
message = input ("Enter a message here: ")
qr = QRCode(version=1)
qr.add_data(message)
qr.make() # Generate the QRCode itself
# im contains a PIL.Image.Image object
im = qr.make_image()
# To save it
im.save("%s.png" % (message))
| true |
8b107f82f3dacd0911650485317e120d4d386ad0 | Edge-Computing-Embedded-Platform/ecep_client | /ecep_endNode/ecep_wampClient/callContainer_api.py | UTF-8 | 3,727 | 2.625 | 3 | [] | no_license | """
Edge Computing Embedded Platform
Developed by Abhishek Gurudutt, Chinmayi Divakara
Praveen Prabhakaran, Tejeshwar Chandra Kamaal
This is to interface between Wamp client and
container API.
"""
import threading
from ..ecep_docker import container, addFile_toContainer
import fetcher
threads = {}
# Call appropria... | true |
7a3fa65cae5bcfa4514560be30f23a2018b85854 | bjornbugge/anagopos | /src/parser/trsparser/trs_parser.py | UTF-8 | 6,911 | 2.671875 | 3 | [] | no_license | '''
A parser for a term reduction system (TRS).
'''
# Reduction Visualizer. A tool for visualization of reduction graphs.
# Copyright (C) 2010 Niels Bjoern Bugge Grathwohl and Jens Duelund Pallesen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public ... | true |
2fd443cd735c8ab7aef23e5ec7677632f6c5b24a | ladoozieme/bad-python-imgur-uploader | /uploadToImgur.py | UTF-8 | 2,696 | 2.78125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | #!/usr/bin/env python
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPY... | true |
7db1f931f3f36975713f986abf0dc8c97615e632 | AstrocyteResearch/portformer | /portformer/viz/main.py | UTF-8 | 1,827 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | """Misc Visualization libraries to assist in visualizing Breakpoint and Portformer Data"""
import matplotlib.pyplot as plt
import pandas as pd
# %matplotlib inline
def format_rcParams():
plt.rcParams["figure.figsize"] = (16.0, 10.0)
plt.rcParams["figure.titlesize"] = 20
plt.rcParams["font.size"] = 16
# ... | true |
7a09582ab1dad8d412aae2e8da5d3355657d5d26 | HongDaeYong/codingStudy | /tobby/1.hash/03.py | UTF-8 | 268 | 3.046875 | 3 | [] | no_license | def solution(clothes):
answer = 1
d = {}
for cloth in clothes :
if cloth[1] not in d.keys():
d[cloth[1]] = 2
else :
d[cloth[1]] +=1
for n in d.values():
answer *= n
return answer - 1
| true |
6bb0371d09905244701b3eb8d12cec493ea3d6c5 | yoheiMune/Python-LectureNote | /day2/ex2.py | UTF-8 | 5,759 | 4.03125 | 4 | [] | no_license | #
# 線形回帰(線形)の演習
#
# [演習2]
# ここでは「y = ax + b」の回帰直線を用いて、線形回帰を実装します。
# (ex1からの発展系です)。
#
# [実装説明]
# 以下3つの関数を実装して、完成させてください。
# ・hypothesis : 仮説関数の実装
# ・compute_cost:コスト関数の実装
# ・gradient_descent:勾配降下法の実装
#
# [注意]
# 今回は、Thetaが配列となります(Theta0とTheta1の値を持つ)。
#
# [演習の回答]
# この演習の回答は「ex2_answer.py」にあります。
#
# では、幸運を祈ります!!!
#... | true |
a2839b4a90189ce6147f024354685615ff9523bb | r4ulill0/dbjudge | /tests/filler_test.py | UTF-8 | 1,234 | 2.640625 | 3 | [
"MIT"
] | permissive | import pytest
from dbjudge import filler
from dbjudge.structures.context import Context
from dbjudge.structures.table import Table
from dbjudge.structures.column import Column
from dbjudge.fake_data_gen import Faker
def test_generate_fake_data(database_connection, db_empty_table, database_manager):
context = Co... | true |
6bb4ccc774954c107e5baa26465573ab1cf008f1 | joshuamwolfe/warbler | /test_user_model.py | UTF-8 | 4,142 | 2.9375 | 3 | [] | no_license | """User model tests."""
# run these tests like:
#
# python -m unittest test_user_model.py
import os
from unittest import TestCase
from sqlalchemy import exc
from models import db, User, Message, Follows
# BEFORE we import our app, let's set an environmental variable
# to use a different database for tests (we n... | true |
38eaa7b73dbd2ada4abd901cc048511465f3b556 | ConorMacBride/mcalf | /src/mcalf/visualisation/spec.py | UTF-8 | 8,471 | 2.546875 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
from mcalf.profiles.voigt import double_voigt, voigt, voigt_faddeeva
from mcalf.utils.plot import hide_existing_labels
from mcalf.utils.spec import reinterpolate_spectrum
__all__ = ['plot_ibis8542', 'plot_spectrum']
def plot_ibis8542(wavelengths, spectrum, fit=None... | true |
c6678b3ebc509d9d25bd54744e09acf3985315b8 | andri95/Verklegt1_AHERO | /Models/destinationData.py | UTF-8 | 1,132 | 3.109375 | 3 | [] | no_license | '''Model class used solely as data transfer object when passing
information between layers. Class only contains getters and setters'''
class DestinationData:
def __init__(self, country, flightTime, contact, emergencyNumber, destId=''):
self.country = country
self.flightTime = flightTime
s... | true |
04e08c18ea737bb2f040d6c9741e3fc9b980468c | WalterKahn4/Python | /Les8/Opdracht 8.3.py | UTF-8 | 369 | 3.78125 | 4 | [] | no_license | def code(invoerstring):
asciiCode = ''
for karakter in invoerstring:
asciiCode += chr(ord(karakter) + 3)
return asciiCode
gebruiker = input('Gebruikersnaam: ')
beginstation = input('Bij welk station begint de reis: ')
eindstation = input('Bij welk station eindigt de reis: ')
asciiCode = code(geb... | true |
3c171bffc10beda15d5cf9f48695d8d006fdaabc | StevenDavenport/DeepQLearning-SnakeGame | /food_obj.py | UTF-8 | 431 | 3.59375 | 4 | [] | no_license | import random
class Food:
def __init__(self, height_of_board, width_of_board):
self.pos_x = 0
self.pos_y = 0
self.new_position(height_of_board, width_of_board)
def new_position(self, height_of_board, width_of_board):
self.pos_x = round(random.randrange(0, width_of_bo... | true |
37e303785efd2b64a446c76c76dad2d2bb3890ad | nekoTheShadow/atcoder-answers | /ABC116/d.py | UTF-8 | 736 | 2.90625 | 3 | [] | no_license | import operator
import collections
n, k = map(int, input().split())
sushies = []
for _ in range(n):
t, d = map(int, input().split())
sushies.append((t, d))
sushies.sort(key=operator.itemgetter(1), reverse=True)
dishes = sushies[:k]
c = collections.Counter(t for t, d in dishes)
a = sum(d for t, d... | true |
219001887a5b763e2c1f37f2623a5fe58e04406d | arnoringi/forritun | /Assignment 3 (While loops)/3_4) Factors.py | UTF-8 | 178 | 3.75 | 4 | [] | no_license | n = int(input("Input an int: ")) # Do not change this line
count = 0
# Fill in the missing code below
while n > count:
count += 1
if n % count == 0:
print(count) | true |
992f69ca0408ab39fdccb05cdafa6e09f7072dc0 | wesenu/math_for_programmers | /02/problem_2.25_26.py | UTF-8 | 823 | 3.046875 | 3 | [] | no_license | from numpy.lib import ufunclike
from vector_drawing import *
from random import uniform
from math import sqrt
def subract(v1, v2):
return (v1[0] - v2[0], v1[1] - v2[1])
def length(v):
return sqrt(v[0] ** 2 + v[1] ** 2)
def distance(v1, v2):
return length(subract(v1, v2))
def perimeter(vectors):
distances = [di... | true |
3d91fa8a614328becc3c503232c9cea515678e10 | Oschart/ConvNet | /src/cnn/layers/dense.py | UTF-8 | 1,073 | 2.53125 | 3 | [] | no_license | import cupy as cp
from .layer import Layer
class Dense(Layer):
def __init__(self,
fan_out,
learning_rate=0.001,
lr_decay=0.9999
):
super().__init__(learning_rate=learning_rate, lr_decay=lr_decay)
self.fan_out = fan_out
de... | true |
fe0ad7f5bf9b29d926902b8afc4b5b3958456d8d | thorn5918/PyCharm_Coder | /Student_Coder/Austin_Coder/20210516/lesson02.py | UTF-8 | 226 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2021/5/16 9:08 上午
# @Author : AI悦创
# @FileName: lesson02.py
# @Software: PyCharm
# @Blog :http://www.aiyc.top
# @公众号 :AI悦创
s = R"Hello, Austin!\n aiyc"
print(s) | true |
f5bb35f5c292f8c6161424786c98295eb371884e | RocketPuppy/IGN-Code-Foo | /Q3/Q3.py | UTF-8 | 4,108 | 3.96875 | 4 | [] | no_license | #!/usr/bin python3
"""IGN Code-Foo Question 3
You own a license plate manufacturing company. Given a population, determine the simplest pattern that will produce enough unique plates. Since all the plates that match the pattern will be generated, find the pattern that produces the least excess plates. Use a combination... | true |
3c9d1ab2ae62bee06a8beeec1e54c582da91f7eb | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4137/codes/1747_1539.py | UTF-8 | 253 | 3.546875 | 4 | [] | no_license | x = float(input("Insira um numero real x:"))
k = int(input("Quantidade de termos da serie:"))
soma = 0
cont = 0
e = 0
e1 = 2
y = 1/(1+x)
while(cont < k):
soma = soma + (x**e)*((-1)**e1)
e1 = e1 + 1
e = e + 1
cont = cont + 1
print(round(soma, 7)) | true |
2d1311f5fcc781f259c55002b06bc24caadd21fd | stsirikov/PythonCapstone | /test.py | UTF-8 | 1,993 | 2.71875 | 3 | [
"Unlicense"
] | permissive | from datetime import datetime
from sqlalchemy.orm import sessionmaker
from os import path, remove
import unittest as ut
import pandas as pd
from blog.blog.database import engine, Article
from analytics import top_articles, top_authors, tags_plot
class TestBD(ut.TestCase):
def setUp(self):
Session = sessi... | true |
5531c19203aa4975baabd0b98cbb0621a47bb3f8 | i2mint/py2misc | /py2store/tree_store.py | UTF-8 | 10,116 | 3.59375 | 4 | [
"Apache-2.0"
] | permissive | """
Also posted on https://stackoverflow.com/questions/57596431/python-dict-like-interface-to-glom.
See there for possible comments.
"""
from collections.abc import Mapping, Collection
# from glom import glom, Literal, Path, PathAccessError
dot_str_key_iterator = lambda p: p.split('.')
bracket_getter = lambda obj, k... | true |
d5db3ea102d4f70955fd720ce3c34bcf38041147 | MadSkittles/leetcode | /777.py | UTF-8 | 423 | 2.96875 | 3 | [] | no_license | class Solution:
def canTransform(self, start, end):
s, e = [(v, i) for i, v in enumerate(start) if v != 'X'], [(v, i) for i, v in enumerate(end) if v != 'X']
return len(s) == len(e) and all(c1 == c2 and ((c1 == 'L' and i >= j) or (c1 == 'R' and i <= j)) for (c1, i), (c2, j) in zip(s, e))
if __name... | true |
baa8f092d32eaf9fddc3e19f10332a3c097bb66f | ad3002/Lyrebird | /trseeker/tools/raw_reads_tools.py | UTF-8 | 5,863 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Aleksey Komissarov ( ad3002@gmail.com )
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""
Short functions for working with collection... | true |
82a674cf45709282d0bfdc764cf1c9fdc77ce911 | twestpha/Gnarly | /main.py | UTF-8 | 788 | 2.84375 | 3 | [] | no_license | # main.py
# Trevor Westphal
import datetime
from parsing_lib.brothersbrick import parseBrothersBrick
class parseController:
def __init__(self):
self.setupKeywordParsingDict()
def setupKeywordParsingDict(self):
self.parsingDict = {
"brothersbrick":parseBrothersBrick,
"reddit":self.nullFunction
}
def ... | true |
51996e6efd6aa2749491354be1701a90e0b408c3 | damv00/da-academy-pycharm | /Repaso/Array_programs/Rotacion_array.py | UTF-8 | 301 | 3.71875 | 4 | [] | no_license | #Rotate array
def rotate(ar, d, n):
lista=[]
segundalista=[]
cont=0
for i in ar:
cont+=1
if cont>d:
lista.append(i)
else:
segundalista.append(i)
lista.extend(segundalista)
print(lista)
arr=[1,2,3,4,5,6,7]
rotate(arr,3,len(arr)) | true |
0e0215191acbc44d0f603a4004249355f8ce0417 | Allen-C-Guan/Master_Capstone_Project | /Project/Code/google cloud/Saving_csv.py | UTF-8 | 458 | 2.890625 | 3 | [] | no_license | import csv
import time
class SavingCsv:
@classmethod
def saveAsCsv(cls, dic:dict):
#statistic_dict[label] = [cnt, weight,round(weight * DataGenerator.co2_dict.get(label, 5), 2)]
with open(time.strftime("%Y_%m_%d", time.localtime()) + '.csv', 'w') as csvfile:
writer = csv.writer(csvfi... | true |
03024b87d391068944fa794b0082d0346ab7e90a | chemil5000/DUSoundTransmission | /scipyHilbert.py | UTF-8 | 645 | 2.65625 | 3 | [] | no_license | import numpy as np
from numpy import (asarray, iscomplexobj, sinc)
def hilbert(x, N=None, axis=-1):
x = asarray(x)
if iscomplexobj(x):
raise ValueError("x must be real.")
if N is None:
N = x.shape[axis]
if N <= 0:
raise ValueError("N must be positive.")
Xf = np.fft.fft(x, N... | true |
5d1d28a573884066e571fca0ce1ee6f116d38fd4 | MichaelMauderer/prysm | /prysm/conf.py | UTF-8 | 2,827 | 2.875 | 3 | [
"MIT"
] | permissive | ''' Configuration for this instance of prysm
'''
import numpy as np
_precision = 64
_precision_complex = 128
_parallel_rgb = True
_backend = 'np'
_zernike_base = 1
class Config(object):
''' global configuration of prysm.
'''
def __init__(self,
precision=_precision,
paral... | true |
83b382ee51580fa204a3ea640ee9cf85c1a4fe34 | VeNOM4171/python | /CheckPerformance.py | UTF-8 | 280 | 3.15625 | 3 | [] | no_license | #Decorator
from time import time
def performance(ftn):
def wrapper(*args,**kawrgs):
t1=time()
result = ftn(*args,**kawrgs)
t2=time()
print(f'took {t2-t1} ms')
return result
return wrapper
@performance
def long_time():
for i in range(10000000):
i*5
long_time() | true |
792fc7a4550b76a54b3186c8eee37fd6eb8526ee | shubhdashambhavi/learn-python | /org/shubhi/general/Tuple.py | UTF-8 | 935 | 4.1875 | 4 | [
"Apache-2.0"
] | permissive | #initialize tuple
'''
my_tuple=()
my_tuple_2=tuple()
print(my_tuple)
print(my_tuple_2)
my_tuple=my_tuple + (1,2,3)
print(my_tuple)
#initializing elements to the tuple
my_tuple=(1,2,3)
my_tuple_2 =tuple(('Python','for','edureka'))
print(my_tuple)
print(my_tuple_2)
my_tuple_3 ='example', # add comma in the end if you ... | true |
f3e7ebb6f7cca7d165e42cf51da02f6733812114 | Leticia-maria/funsies | /src/funsies/ui.py | UTF-8 | 13,443 | 2.625 | 3 | [
"MIT"
] | permissive | """User-friendly interfaces to funsies functionality."""
from __future__ import annotations
# std
import shutil
import time
from typing import Iterable, Mapping, Optional, overload, TypeVar, Union
# external
from redis import Redis
# python 3.7 imports Literal from typing_extensions
try:
# std
from typing im... | true |
0d139ecafc2e70cb4bc021982e03ecb652af9814 | mitchell-dawson/PyInstaller_examples | /test_app_6/main.py | UTF-8 | 1,019 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python2
import os
import sys
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for Py... | true |
ecb87e3a01ef18e9c2f6b9755b374eca33cdb906 | q11421684628/PythonSDET | /PageObjectLianXi/page/base_page.py | UTF-8 | 510 | 2.546875 | 3 | [] | no_license | import time
from selenium import webdriver
from selenium.webdriver.remote.webdriver import WebDriver
class BasePage:
def __init__(self, driver: WebDriver = None):
if driver is None:
self._driver = webdriver.Chrome()
self._driver.implicitly_wait(3)
self._driver.maximize... | true |
95afc8ad48e4a2f5e3f6e0ed7d133e41e124c2f6 | AkhileshPandeyji/Python_All | /Python_Database/pandas_database_read.py | UTF-8 | 463 | 2.765625 | 3 | [] | no_license | import pymysql
import pandas as pd
connection = pymysql.connect(host='localhost',port=3306,user='root',database='lsb',autocomit=True,passwd='')
query = 'select * from Book'
dataset = pd.read_sql_query(query,connection)
print(dataset)
book_id = 1
book_title = "Name"
book_price = 23.06
book_author = 'Ravi Shastr... | true |
8a241c240519f6f28835aa07ff6dd7ce2f269731 | vsnupoudel/Machine-Learning | /All-algorithms combined.py | UTF-8 | 10,003 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Start for Random forest in a grid
# In[24]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# In[25]:
df = pd.read_csv("glassTrain.csv", index_col=0)
df_test = pd.read_csv("glassTest.csv", index_col=0)
# ## Using the best features gi... | true |
33b60558d3070dca793240d74a308c5e90d048c8 | guemin96/StudyRaspberry21 | /gps_ex01.py | UTF-8 | 1,428 | 3.53125 | 4 | [] | no_license | import serial # 시리얼 통신 모듈
def get_GPS_info(buffer):
nmea_latitude = buffer[1] #위도
nmea_longitude = buffer[3] #경도
#print('{0}/{1}'.format(nmea_latitude,nmea_longitude))#위도, 경도만 출력시켜주는 코드
latitude = convert_to_degree(nmea_latitude)
longitude = convert_to_degree(nmea_longitude)
#35.
print('... | true |
12f0e78691696cd96efe42c80f6580730655a637 | scaniasvolvos/python-basics | /factorial.py | UTF-8 | 138 | 3.953125 | 4 | [] | no_license | def factorial(n):
return 1 if (n == 1 or n == 0) else n * factorial(n-1)
n = 6
print("Factorial of {} is {}".format(n,factorial(n))) | true |
2511ec428c6ec72f006f7ec4406eaace34a04467 | joeynosharefood/estudos | /Python/Exercicios/90.py | UTF-8 | 529 | 3.40625 | 3 | [] | no_license | alunos = list()
temp = dict()
while True:
temp['nome'] = str(input('Insira o nome: '))
p1 = float(input('Insira a nota da P1: '))
p2 = float(input('Insira a nota da P2: '))
media = (p1+p2)/2
temp['p1'] = p1
temp['p2'] = p2
temp['media'] = media
alunos.append(temp.copy())
brk = str(i... | true |
4115e2d86f6ad9a0ddca3954f3bcbb093286465e | valentinPertierra/DSP_UTN | /TP3/TP3.py | UTF-8 | 4,239 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 16 00:27:54 2018
@author: Valentin
"""
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from pandas import DataFrame
from IPython.display import HTML
from funciones import *
N = 1024
fs = 1000
realizaciones = 200
# Param... | true |
25ea9a9bfa03e82461d0ffd2446c7be46655acea | clutcher/nrt | /find_etta.py | UTF-8 | 1,667 | 2.78125 | 3 | [] | no_license | import lib.generator as generator
import numpy as np
import pylab
from scipy.optimize import curve_fit
from scipy.optimize import fsolve
from scipy.misc import derivative
import math
def sigmoid(x, a, b, c, d, f, alpha):
y =np.sin(a- b / (c + np.exp(-d*(x-f))))
return y
# def sigmoid(x, a1,b1,c1,a2,b2,c2,a3,... | true |
58002c94f7e3a13a3a3350e0a10e1ec600d2e680 | Vovchyk69/CelestialNavigation | /StarsDB/StarCatalog.py | UTF-8 | 4,339 | 2.90625 | 3 | [] | no_license | import time
import motor.motor_asyncio
import numpy as np
import pandas as pd
import json
import math
from bson import SON
from pymongo import GEO2D, GEOSPHERE
# a class to work with star database
class StarCatalog:
def __init__(self, connection, dbName=None, collectionName=None):
self.dbName = dbName
... | true |
6ab263b3f536cbeb3a210039cee9957a41b78bbd | t3cht0n1c/PvJ_Raiders0fTheL0stArp | /Monitoring and Alerting/Zaeyx-invisiport-8cf53321106f/invisiport.py | UTF-8 | 1,311 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
import socket
import os
#hosts to avoid blacklisting
whitelist = ['127.0.0.1','localhost']
#ports to show as up to blacklisted clients
#Think about what the attacker will think if he sees different profiles before and after a scan
ports = ['21','80','445']
#IP to bind to. Leave as empty string... | true |
2027614613471b1fdf39a7b783fb09a01e37438a | mostafaashraf413/world_models | /obstacle-tower-challenge/dqn.py | UTF-8 | 8,270 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 27 06:01:49 2019
@author: mostafa
"""
from obstacle_tower_env import ObstacleTowerEnv
import argparse
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torchvision.transforms as T
import cv2
fro... | true |
739f88996d20165e4de6465e6ba363d31368e8f6 | dougBelcher/SQLite | /dump_table.py | UTF-8 | 493 | 2.640625 | 3 | [] | no_license | import sqlite3
import pandas as pd
def to_csv():
db = sqlite3.connect('sakila.db')
cursor = db.cursor()
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
tables = cursor.fetchall()
for table_name in tables:
table_name = table_name[0]
table = pd.read_sql_query("SE... | true |