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 |
|---|---|---|---|---|---|---|---|---|---|---|
91e91ea059da190fe141d7bcc1e346f6b903b37d | srike27/jetPR-source | /src/jetPR_drivers/src/pyre.py | UTF-8 | 757 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
import serial
import rospy
from std_msgs.msg import Float64
def main():
ser = serial.Serial(port = '/dev/ttyTHS1', baudrate = 115200, timeout = 1, parity = serial.PARITY_NONE, stopbits = serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS)
pub = rospy.Publisher('voice_doa', Float64, queue_size=10)
... | true |
23b9daa522356f43c0a8d4cc6eff19aa2ee664ee | CIFASIS/dataset-processing | /trajectory_aligment/vectors_align.py | UTF-8 | 3,732 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import math
import matplotlib.pyplot as plt
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
from utils import plotHelpers as ph
import argparse
import tf
import os
sptam_x = []
sptam_y = []
sptam_z = []
sptam_orig_x = []
sptam_orig_y = []... | true |
4ec816398a30b98d19567011188b9946214f72bd | simonsben/intent_detection | /model/extraction/subjectivity.py | UTF-8 | 683 | 3.046875 | 3 | [] | no_license | from pandas import DataFrame
from sklearn.feature_extraction.text import CountVectorizer
def subjectivity(dataset, lexicon):
""" Constructs a document-term matrix using the subjectivity lexicon """
if type(dataset) is not DataFrame:
raise TypeError('Dataset must be a (Pandas) Dataframe')
... | true |
32ffce9e643682294cb4e29b4c5891ccbd50d47d | danildanil86660/OPC_UA | /server.py | UTF-8 | 1,785 | 2.609375 | 3 | [] | no_license | import random
from opcua import Server
from random import uniform, seed
seed(42)
class OPCServer:
def __init__(self, url="opc.tcp://127.0.0.1:48402/freeopcua/server/",
name="OPCUA_SIMULATION_SERVER"):
self.url = url
self.server = Server()
self.server.set_endpoint(self.url... | true |
695bde283f844c058709aa304687c33e5c8fb137 | gabriellaec/desoft-analise-exercicios | /backup/user_136/ch43_2020_10_05_14_03_47_631474.py | UTF-8 | 167 | 3.1875 | 3 | [] | no_license | lista= [janeiro, fevereiro, março, abril, maio, junho, julho, agosto, setembro, outubro, novembro, dezembro]
w= int(input('qual o número ? '))
w+= 1
print (lista[w]) | true |
932156cc4f0e9528ce265207553cf6167710c97c | ujusy/Blog_Django | /Blog/blogproject/blogapp/views.py | UTF-8 | 1,492 | 3.09375 | 3 | [] | no_license | from django.shortcuts import render, get_object_or_404,redirect
from django.utils import timezone
from blogapp.models import Blog
# Create your views here.
def home(request):
blogs = Blog.objects #쿼리셋
return render(request,'blogapp/home.html',{'blogs':blogs})
def detail(request, blog_id):
details = get_ob... | true |
5f19ce415272309121e9bcdc1377046e3ef35cdc | Hanlen520/learnPython | /201802month/socket/socketServer1.py | UTF-8 | 498 | 2.90625 | 3 | [] | no_license | #!/user/bin/env python
# -*- coding:utf-8 -*-
import socket
if __name__ == '__main__':
sk = socket.socket()
host = socket.gethostname() # 获取本地主机名
ip = socket.gethostbyname(host) # 获取本地IP
sk.bind((host, 5666)) # 绑定端口
sk.listen(5) # 等待客户端连接,最大连接数5
while True:
c, addr = sk.accept() ... | true |
235d1c401c548730fbbf5b022afa603a3e7df444 | Glairly/Data-Structure-Lab | /lab4.py | UTF-8 | 13,310 | 3.203125 | 3 | [] | no_license |
# มาใช้ queue กันเถอะ ไอเด็กเปรต
# class Queue:
# class Node:
# def __init__(self,value):
# self.value = value
# self.next = None
# def __init__(self):
# self.last = None
# self.first = None
# def insert(self,value):
# newNode = self.N... | true |
4f3c01aaa323c891bf0089740c6055a66184a1a1 | esmexx/Machine-Learning-Regression | /RegressionTools.py | UTF-8 | 1,794 | 3.421875 | 3 | [] | no_license | import numpy as np
def simple_linear_regression(data, input_feature, output_feature):
# closed-form solution
x = data[input_feature]
y = data[output_feature]
N = len(x) * 1.0
xy = x * y
xsquared = x ** 2
slope = (xy.sum() - (y.sum() * x.sum() / N)) / (xsquared.sum() - (x.sum() * x.sum() / N... | true |
0aabd63022a58f86edc35ac17659c28398bccfe1 | zhangxshen/AAA | /main.py | UTF-8 | 4,390 | 2.515625 | 3 | [] | no_license | from pandas import read_csv, ExcelWriter
from time import localtime, strftime
# 先定义一个字典,键为各个地市,键值为派单节点
jiedian = {'省客响': '广东公司-云计算和客户响应中心-家宽服务支撑室-值班专家组-客户响应中心(运营管控)',
'潮州': '广东公司-潮州分公司-客户响应中心-集团专线服务支撑室',
'东莞': '广东公司-东莞分公司-客户响应中心-全业务协调办公室-全业务协调办公室',
'佛山': '广东公司-佛山分公司-客户响应中心-集客维护室',
... | true |
7e34f43919ecab0a954826b9bf393f8a775ea81d | huangnauh/learnpython | /form.py | UTF-8 | 663 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import cgi
header = 'Content-Type: text/html\n\n'
html = '<h3>接受处理表单数据\n</h3>'
#打印返回的内容
print header
print html
# 接受表达提交的数据
form = cgi.FieldStorage()
print '接收表达get的数据 :',form
print '<p />'
# 解析处理提交的数据
username = for... | true |
17ce10ae2d0eaf39a79e24b6beae16cd1cf3dacf | Hellco3/learnpython | /python/danci_test.py | UTF-8 | 1,946 | 3.171875 | 3 | [] | no_license | import requests
url = 'https://www.shanbay.com/api/v1/vocabtest/category/'
res = requests.get(url)
js_link = res.json()
number = int(input('''请输入对应词库的标号:1.GMAT,2.考研,3.高考,4.四级,
5.六级,6.英专,7.托福,8.GRE,9.雅思,10.任意:'''))
ciku = js_link['data'][number-1][0]
url_1 = 'https://www.shanbay.com/api/v1/vocabtest/vocabularies/?categ... | true |
71ee7bcbc489283762c2f2569d8f9b751ffeda81 | maldonadoq/spark | /linear-regression-csv.py | UTF-8 | 1,458 | 3.515625 | 4 | [] | no_license | from pyspark.sql import SparkSession
from pyspark.ml.regression import LinearRegression
from pyspark.ml.linalg import Vectors
from pyspark.ml.feature import VectorAssembler
# Create Spark Session
spark = SparkSession.builder.appName('Linear Regression').getOrCreate()
spark.sparkContext.setLogLevel('ERROR')
# Read CS... | true |
4d332e5d1338f66e6d468c358d0517544dda5c96 | ma-tech/Anatomy | /SourceCode/Python/Archive/GenerateTreeFormats/generateTreeReports.py | UTF-8 | 4,548 | 2.671875 | 3 | [
"CC-BY-3.0"
] | permissive | #!/usr/bin/env /usr/bin/python
# -*- coding: iso-8859-1 -*-
#-------------------------------------------------------------------
"""
Control program for generating anatomy database reports that present
the anatomy as a tree (even though it is a DAG). Tree reports are
well-suited for presenting the anatomy as a tree. ... | true |
2129d62ccdcf5cb98c5cfb6cf9d8131aa380c544 | namproctin/logparse | /parse.py | UTF-8 | 3,791 | 2.609375 | 3 | [] | no_license | import os
import re
import sys
import json
import logging
import datetime
import multiprocessing as mp
import maxminddb
from main import db, Request
logger = logging.getLogger("Log parse")
maxminddb_path = 'GeoLite2-Country_20171107/GeoLite2-Country.mmdb'
reader = maxminddb.open_database(maxminddb_path)
log_line_re... | true |
68b4995ed85b2f7a8d9093d941d37bb4eebdbdd1 | NadiaAntony/tests-hrank | /validate_sessions/session_time.py | UTF-8 | 1,966 | 3.234375 | 3 | [] | no_license | from collections import defaultdict
import time
# decorator function to check elapsed time
def elapsed_time(f):
def wrapper(*args, **kwargs):
t1=time.time()
f(*args, **kwargs)
t2=time.time()
print("time elapsed: ", ((t2-t1)*1000), "ms")
return wrapper
@elapsed_time
def check_se... | true |
be8790e30c4fd0b9ce4209a4a44f3d6156fc74ba | teamhead/lan | /py/sqlmanager/App/InsertInstance/parseCustomInfo.py | UTF-8 | 2,184 | 2.890625 | 3 | [] | no_license | class ParseCustomInfo(object):
def InsertSql(self,datas):
try:
instance_name = datas['instanceName']
instance_ip = datas['instanceIp']
instance_port = datas['instancePort']
instance_user = datas['instanceUser']
instance_passwd = datas['insta... | true |
bbc04c74d1e4814f5661f2472c79e9665d1da83c | henokwon/AirBnB | /tests/test_models/test_engine/test_file_storage.py | UTF-8 | 9,620 | 2.625 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/python3
"""
Unit Test for BaseModel Class
"""
import unittest
from datetime import datetime
import models
from models import engine
from models.engine.file_storage import FileStorage
import json
import os
User = models.user.User
BaseModel = models.base_model.BaseModel
FileStorage = engine.file_storage.FileS... | true |
0acb42e875d950ad340b4d880389d53a3b7eeb87 | rvolkmann/d2d_gis-code-challenge | /processing/run.py | UTF-8 | 6,948 | 3.21875 | 3 | [] | no_license | #!/usr/bin/python
""" CONFIG """
# Maximum time we want people to walk to the next bus stop
max_minutes = 10
# m/s (default=1.4 via Wikipedia)
walking_speed = 1.4
# File locations
activity_points_file = '../data/activity_points.geojson'
routes_file = '../data/routes.geojson'
streets_file = '../data/osm_major_street... | true |
9ee1a823d98fd4d46fb7c53a21835b417a3992a4 | jomit/AITrials | /aml/startupfunding/scoreandcollect.py | UTF-8 | 1,155 | 3 | 3 | [] | no_license | from azureml.datacollector import ModelDataCollector
def init():
from sklearn.externals import joblib
global model
model = joblib.load('startupfunding.pkl')
global inputCollector, predictionCollector
inputCollector = ModelDataCollector('model.pkl',identifier="inputs")
predictionCollector = Mod... | true |
b208f0aca0144cf461b3d0c213014afbaa10f8ae | vikky-aradhya/DemoGitProject | /Demo1/Handling_Dropdown_part1.py | UTF-8 | 1,853 | 3.25 | 3 | [] | no_license | import unittest
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from time import sleep
class Dropdown(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.driver = webdriver.Chrome()
cls.driver.maximize_window()
cls.driver.get("https://ww... | true |
015f393ed0f34e06e4e12e899ead2fcfddc00fd5 | mbal/jing | /python/p191.py | UTF-8 | 842 | 3.859375 | 4 | [] | no_license | # Easy, once you get the trick.
# In this case, we ignore the L result, at first, and we generate strings
# with A and O. Listing the first few cases we can guess a formula that links
# the f(n) with f(n-1), and we use it to compute the answer. Then, We add
# the single L in every possible position.
CACHE = [0 for x i... | true |
5e61446f8fe040ae54e832c9efc5a4dc688b3d6d | Aasthaengg/IBMdataset | /Python_codes/p02787/s937829123.py | UTF-8 | 506 | 3.03125 | 3 | [] | no_license | import sys
input = sys.stdin.readline
h, n = map(int, input().split())
a = [0]*n
b = [0]*n
for i in range(n):
a[i] ,b[i] = map(int, input().split())
inf = float("inf")
# dp[i][j]:i-1番目までの魔法で体力をj減らした時の消耗魔力の最大値
dp = [[inf]*(h+2) for i in range(n+1)]
dp[0][0] = 0
for i in range(n):
for j in range(h+1):
... | true |
1403815164a72ff3993830ce5844dc4576b449fa | MikkLaur/cv.ee-scraper | /scraper.py | UTF-8 | 2,015 | 2.6875 | 3 | [
"MIT"
] | permissive | # !/usr/bin/env python3
from urllib.request import urlopen
from bs4 import BeautifulSoup
import time
from persistence import save
import date_converter
URL = 'https://www.cv.ee/search?limit=1000&offset=0&categories[0]=INFORMATION_TECHNOLOGY&isHourlySalary=false'
soup = BeautifulSoup(urlopen(URL), 'html.parser')
fo... | true |
a7b22942c1c84fa77739d390366c23efa2ab7ac7 | sanonzon/parkeringen | /parkering/kombo_parking/models.py | UTF-8 | 1,969 | 2.515625 | 3 | [] | no_license | from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
# DB User parking spaces
class Parking_space(models.Model):
number = models.IntegerField(unique=True)
owner = models.ForeignKey(User)
def... | true |
87499da528e3a841ea8e37b9a398f8a76ce7c362 | aneesahmedpro/rock-paper-scissor-vision | /uses_pygame/gamedisplay.py | UTF-8 | 2,178 | 2.6875 | 3 | [
"MIT"
] | permissive | import numpy as np
import pygame
from config import CNN_INPUT_IMG_WIDTH, CNN_INPUT_IMG_HEIGHT
from image_utils import surface_from_array
class GameDisplay:
def __init__(self):
self.img_rock = pygame.image.load('assets/rock.png')
self.img_paper = pygame.image.load('assets/paper.png')
sel... | true |
6277c54ed70fe08bb86f3e30cc5c17ac9d1e59bd | TCKnickerbocker/shortPythonProblems | /shortProblems.py | UTF-8 | 6,891 | 3.875 | 4 | [] | no_license | import random
def complement(dna_str):
'''
Purpose: To take a dna strand as a string input and return a string of the complementary dna strand
Input Parameter(s):
dna_str: a string of lowercase a, t, g, and cs
Return Value:
the list my_str, which is the complement of dna_str
'''
dna_str = dna_str.lower()
... | true |
e4a2241c37425e5fcdd5a110f704fdec98fa9ba1 | laurajauch/phase2 | /plot.py | UTF-8 | 18,985 | 2.765625 | 3 | [] | no_license | from main import *
from solver import *
from Form import *
from Transition import *
from matplotlib import *
from numpy import *
import matplotlib.pyplot as plt
import RobertsPlotter
class Plot:
def prompt(self):
self.form = Form.Instance().get()
return "What would you like to plot (u1, u2, p, strea... | true |
c3ff274f6dbabb674d725292a3681a36f7fe7059 | PythoudGuillaume/shutHumInt | /server_led/simple_server.py | UTF-8 | 2,887 | 2.703125 | 3 | [] | no_license | import socket,pickle, random, random
from neopixel import *
# LED strip configuration:
LED_COUNT = 900 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!).
LED_ROW = 10
LED_COLUMN = 90
#LED_PIN = 10 # GPIO pin connected to the pixels (10 ... | true |
0628d517170940444101244843ec111e42caf2ff | mefffodyka/demo_SIBUR | /front_py.py | UTF-8 | 1,949 | 2.65625 | 3 | [] | no_license |
from collections import OrderedDict
polka_1 = ['E20000196609011615205616', 'E2000019660901161490562A', 'E2000019660901161510561E']
polka_2 = ['E20000196609011614805626', 'E20000196609011614605632', 'E20000196609011614405636']
uid = 'user 1'
shkaf = polka_1+polka_2
timer_book = ['']
def chtenie_bd():
... | true |
c43c830389432a7e7847525524c618e4b9d6f101 | FBanuet/Generative-Design | /CLASSES/LOTE_CLASS.py | UTF-8 | 1,278 | 3.1875 | 3 | [
"MIT"
] | permissive | # CLASE LOTES
class Lote:
#Atributos Objeto
def __init__(self,nombre,uso_suelo,max_viv,max_niv,altura_max,superficie,cos,a_libre,a_verde):
self.nombre = nombre
self.uso_suelo = uso_suelo
self.max_viv = max_viv
self.max_niv = max_niv
self.altura_max = altura_... | true |
9d88f4f50a8d91234c3fdbdaefb9c99b80007ae3 | bhhe/TeamManager | /View/page1_view.py | UTF-8 | 1,496 | 3.125 | 3 | [] | no_license | import tkinter as tk
class Page1View(tk.Frame):
""" Page 1 """
def __init__(self, parent, submit_callback):
""" Initialize Page 1 """
tk.Frame.__init__(self, parent, width=1500, height=1200)
self._parent = parent
self._submit_callback = submit_callback
self._create_wid... | true |
f0fcbd46d32c9e6dae89c4c22731af1524c7a26f | TonyWu1995/google-geo-pipline | /config/ftp_config.py | UTF-8 | 581 | 2.640625 | 3 | [] | no_license | # ip = '10.0.1.3'
# port = 21
# username = 'adnext'
# password = '28892170'
class FTPConfig:
def __init__(self, ip: str, username: str, password: str):
self.__ip = ip
self.__username = username
self.__password = password
@property
def ip(self):
return self.__ip
@prop... | true |
84ae4717f52f01ea1b44c42a1852eae0916e78d3 | Hanlen520/Leetcode-4 | /src/54. Spiral Matrix.py | UTF-8 | 796 | 3.03125 | 3 | [] | no_license | class Solution:
def spiralOrder(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: List[int]
"""
if matrix == []:
return []
import numpy as np
r, l, lenr, lenl = 0, 0, np.shape(matrix)[0]-1, np.shape(matrix)[1]-1
output = []
w... | true |
9bb700c49fac500e1198eddc96eb313f7ba9c2d7 | bbjork/databas_gym | /gym_db.py | UTF-8 | 13,689 | 2.953125 | 3 | [] | no_license | #Imports
import mysql.connector
from mysql.connector import errorcode
import csv
#Connection details
mydb = mysql.connector.connect(
host = "localhost",
user = "root",
passwd = "Ambition2020",
#database = "björkman"
)
DB_NAME = "gym_db"
cursor = mydb.cursor()
#Create a database that does not exist
d... | true |
210e65b5df5646851254c69dc86608af8617c59d | renatogo/estudo_python | /exercícios/jogos/Calculadora.py | UTF-8 | 929 | 4.5 | 4 | [] | no_license | print("*****************************")
print("*********Calculadora*********")
print("*****************************")
# declaracão das variáveis
resultado: float
executar_calculadora: bool = True
# verifica qual é o operador escolhido e aplica o mesmo nos números informados
while executar_calculadora:
valor1 = fl... | true |
5149946b5b96394709c5af3e32d94b2ad1730308 | insequent/fibserv | /fibserv/engines/twisted_engine.py | UTF-8 | 803 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Sadly, by switching to python 3, this engine can no longer be used.
Twisted needs to catch up with the times.
"""
from twisted.internet import reactor
from twisted.web.server import Site
from twisted.web.resource import Resource
class MainHandler(Resource):
""" Sin... | true |
4bddeab214bb65987d8143584b916b3dd48d40c7 | saranyab9064/leetcode-geeks | /Linked_Lists/61_rotate_list.py | UTF-8 | 1,348 | 3.90625 | 4 | [] | no_license |
"""
Given the head of a linked list, rotate the list to the right by k places.
Example 1:
Input: head = [1,2,3,4,5], k = 2
Output: [4,5,1,2,3]
Example 2:
Input: head = [0,1,2], k = 4
Output: [2,0,1]
Constraints:
The number of nodes in the list is in the range [0, 500].
-100 <= Node.val <= 100
0 <= k <= 2 *... | true |
a75fe388f49333ff149c45d070bd84bc0217b6a0 | JazminPineda/javascript_inicial | /14 Eje_py/15. Ejerc_distancia .py | UTF-8 | 668 | 3.9375 | 4 | [] | no_license |
# variable de instancia: esta variable ùnicamente se relaciona con la instancia de una clase
# se define asi
class Persona():
edad = 18 #variables de clase, como se utiliza forma general global
def __init__(self, nombre, nacionalidad):#al inicio se coloca parametros, self es por defecto
self.nombre =... | true |
1805e03c5f0935987667d1dcb052b2d6d163d673 | ytyc2k/Canadian-Computing-Competition | /2021CCC_J5_2.py | UTF-8 | 628 | 3.046875 | 3 | [] | no_license | '''
4
5
7
R 3
C 1
C 2
R 2
R 2
C 1
R 4
'''
from time import time
T=time()
print(T)
R = 4
C = 5
N = 7
Canvas = [[0] * C for i in range(R)]
Rc = [1 for _ in range(R)]
Cc = [1 for _ in range(C)]
for i in range(R):
print(Canvas[i])
for i in range(N):
x, y = input().split()
y = int(y) - 1
if x == 'R':
... | true |
23715e004bb9f77277794e3d6ccffed51b9652c7 | KamalTaleb/holbertonschool-python | /0x0C-python-input_output/100-append_after.py | UTF-8 | 428 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python3
""" search and update"""
def append_after(filename="", search_string="", new_string=""):
"""
append after
"""
with open(filename, 'r+', encoding='utf-8') as f:
listtmp = []
for line in f:
listtmp.append(line)
if search_string in line:
... | true |
32e120246f1f0d2b54f2b4bb2b4925aceb00ce22 | arumsey93/Python-lightning-examples | /LE4/LE4.py | UTF-8 | 358 | 3.265625 | 3 | [] | no_license | Appliances = ("oven", "refrigerator", "coffee maker", "rice cooker")
# Add 3 indispensable appliances to this tuple
# Way One:
# Appliances = Appliances + ("Stove", "Microwave", "Toaster")
# print(Appliances)
#Way Two:
Appliances = set(Appliances)
Appliances.update(["dishwasher", "microwave", "toaster"])
Appliances... | true |
ea9148ba44bf90c77e1a864c7dc43a2902d75134 | nihalsinghraju/Python | /first.py | UTF-8 | 46 | 2.703125 | 3 | [] | no_license | print("My name is nihal Kumar singh")
a=5
b=10
print(a+b) | true |
c6418ac6dead963b092774d44b6976ffc17494d5 | wildiney/py-xtract-data-pdf | /classes/Xtractdata.py | UTF-8 | 9,523 | 2.84375 | 3 | [] | no_license | import os
import re
import PyPDF2
import csv
class Xtractdata:
def __init__(
self,
pdfs_directory,
company,
save_as,
delete=False,
repeat=False
):
self.pdfs_directory = pdfs_directory
self.company = company
self.sa... | true |
4fd5c7513fe612a12817bdb752262e317a94a25d | muzihuole/SpeechGenderRecognition | /tools/file_tools.py | UTF-8 | 1,273 | 3.171875 | 3 | [
"MIT"
] | permissive | import os,shutil
import csv
def move_file(srcfile, dstfile):
if not os.path.isfile(srcfile):
print("%s not exist!"%(srcfile))
else:
fpath,fname=os.path.split(dstfile) #分离文件名和路径
if not os.path.exists(fpath):
os.makedirs(fpath) #创建路径
shutil.move(srcfi... | true |
a25c1949d4adb69db9e0da031a4ed0c6c465c562 | vpetrosiants/aca_python | /004.py | UTF-8 | 1,972 | 3.4375 | 3 | [] | no_license | a= ' , first string and end of example'
b = '.... .. second string number 2 and etc'
# delete all space in the begin of the string
a_d = a.lstrip(' ')
b_d = b.lstrip(' ')
print(a_d)
#delete all symbolds in the begining of the string
for i in a:
if not i.isalpha() and i != ' ':
a = a.replace(i, '')
... | true |
af4f40fd0990230b99408f9a218a093d582e23ab | nas539/printingSquaredNumbers | /main.py | UTF-8 | 497 | 3.703125 | 4 | [] | no_license | first_number = 1
second_number = 15
third_number = 20
fourth_number = 35
def printing_a_dictionary_of_squared_numbers(num1, num2):
first_list = [number for number in range(num1, num2 + 1)]
squared_list = [number ** 2 for number in range(num1, num2 + 1)]
new_list = zip(first_list, squared_list)
return n... | true |
a1ec07da347f93a1751087b4df366cc3a503f6e7 | traceover/tython | /tython/types/List.py | UTF-8 | 1,812 | 3.078125 | 3 | [
"MIT"
] | permissive | from tython.types.Number import Number
from tython.types.base import Value, Types
from tython.errors import RuntimeError
class List(Value):
def __init__(self, elements):
super().__init__()
self.elements = elements
self.type = Types.List
def __repr__(self) -> str:
elements = ",... | true |
0eccdffa92ea30dec13b317b70956db913210d6f | sadirbaev/sozlik-web | /sozik.py | UTF-8 | 2,598 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sqlite3
from flask import Flask, render_template, g, jsonify
from util.spell import candidates
app = Flask(__name__)
DATABASE = app.root_path + '/db/sozlik.db'
def get_db():
db = getattr(g, '_database', None)
if db is None:
db = g._databa... | true |
b5e44be39b60f8f8c67f8884f93634857d02c9fb | djcaminero/MoSQITo-FDP | /mosqito/validations/hearing_model/valid_gammatone.py | UTF-8 | 3,250 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
@author: Daniel Jiménez-Caminero Costa and modifications by "martin_g" of Eomys
"""
from scipy.signal import gammatone as scipy_gamma, freqz
from numpy import log10, abs as np_abs
import matplotlib.pyplot as plt
from mosqito.functions.hearing_model.gammatone import gammatone as mo... | true |
f47543a0f0254098e463c23c3186892dd9b4fdf9 | lucsaito/My-HackerRank-Solutions | /Algorithms/Warmup/Solve Me First.py | UTF-8 | 97 | 2.796875 | 3 | [] | no_license | # Creates a function that returns the sum of two parameters
def solveMeFirst(a,b):
return a + b | true |
e3ba60f8d17cadfd42e90a61595182f9bdc1de71 | SaminYeasar/Reinforcement-Learning-Algorithms | /GAIL/GAIL_deterministic_PolicyNN/data.py | UTF-8 | 3,669 | 2.75 | 3 | [
"MIT"
] | permissive | import numpy as np
import h5py
import torch
import torch.utils.data
class ReplayBuffer(object):
def __init__(self):
self.storage = []
# Expects tuples of (state, next_state, action, reward, done)
def add(self, data):
self.storage.append(data)
def sample(self, batch_size=100):
... | true |
8edf34062f109785f52ab28c3bc32b8172ce02da | boehmrya/maps | /usa_map_data_change/process_json.py | UTF-8 | 3,310 | 3.015625 | 3 | [] | no_license |
import json
import csv
import requests
# build dict with state to abbreviation translation
stateDict = {}
stateAbbrevDict = {}
with open('states.csv', 'rb') as csvfile:
states = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in states:
state = row[0][1:-1]
abbrev = row[1][1:-1]
... | true |
c5afac26dd0d5c7ebb3aed37868756231babb97a | antoniomdk/practicas_mh_ugr | /practica3/software/FUENTES/algorithms/evolutionary/genetic_algorithm.py | UTF-8 | 5,059 | 2.578125 | 3 | [
"MIT"
] | permissive | import random
from functools import partial
import numpy as np
from deap import base, creator, tools
from ..core import evaluate, AlgorithmBase
from .operators import mut_gaussian, cx_arithmetic, cx_blx
from .strategies import memetic_strategy, run
creator.create("FitnessMax", base.Fitness, weights=(1.0, ))
creator.... | true |
89158853efb07953d639b39a008a5c5698fbe521 | jmcs811/interview_prep | /ctci/1_strings_arrays/3_URLify.py | UTF-8 | 548 | 3.90625 | 4 | [] | no_license | # problem: Wreite a method to replace all spcaes in a string with '%20'. You may assume
# that the string has sufficient space at the end to hold the additional characters
# and you are given the true lenght of the string
# Example:
# INPUT: "Mr John Smith", 13
# OUTPUT: "Mr%20John%20Smith"
def ... | true |
f04889b21a1b57d6aa2d04bc9e577c47c9877082 | carlosalbertoestrela/CursoEmVideoPython | /100_exercicios_guanabara/Concluídos/exe44.py | UTF-8 | 1,170 | 4.3125 | 4 | [] | no_license | """
Elabore um programa que calcule o valor a ser pago por um produto, considerando seu preço normal e a condição de
pagamento:
- À vista Dinchero/cheque: 10% de desconto.
- À vista no Cartão: 5% de desconto.
- Em até 2x no cartão: Preço normal.
- 3x ou mais no cartão: 20% de juros.
"""
print(f'{" Lojas Beto ":=^40... | true |
c7c5b95bd5178b87a42aa84295ecb34bcd47ebd8 | Terraider/--- | /python/src/Bakery.py | UTF-8 | 2,191 | 3.09375 | 3 | [] | no_license | from src.Baker import Baker
from src.Pastry import Pastry
class Bakery:
"""Class bakery."""
def __init__(self, name: str, min_experience_level: int, budget: int):
"""Class constructor."""
self.name = name
self.min_experience_level = min_experience_level
self.budget = budget
... | true |
56685fa4fc7dccadd85cb6920be5b5008bb5a231 | UKHomeOffice/qrpermission | /permission/__main__.py | UTF-8 | 1,854 | 2.8125 | 3 | [
"MIT"
] | permissive | import pyqrcode
from skimage.io import imread as read_image
import zbar
import zbar.misc
from permission.permission import Permission, from_qr_code_format
PRIVATE_KEY = 'etc/permissions_key'
PUBLIC_KEY = 'etc/permissions_key.pub'
SCALE = 2
def generate_qr_codes():
perm = Permission('Joe Bloggs', '23/4/2015', 'NZ1... | true |
b1a49a94a06e4708c6c855754c60b5fcccff580a | Natalnet/lib_ura_esp | /devs/SpeedControl/testPulses.py | UTF-8 | 235 | 2.921875 | 3 | [] | no_license | from machine import Pin, ADC
from time import sleep
pot = ADC(Pin(36))
pot.atten(ADC.ATTN_11DB) #Full range: 3.3v
cont = 0
while cont < 100:
pot_value = pot.read()
print(pot_value)
sleep(0.1)
cont=cont+1
| true |
1e424d4996c62f10f197d17b5287850338381873 | JeathRahmatUllah/speedtest | /speedTest.py | UTF-8 | 406 | 3.03125 | 3 | [] | no_license |
# First you have to add 'speedTest' package in project -> python interpreter
import speedtest
s = speedtest.Speedtest()
print("Testing...\n")
downloadSpeed = s.download() / 104856
uploadSpeed = s.upload() / 1048576
pingResult = round(s.results.ping)
print(f"Download speed: {downloadSpeed: .2f} Mbps")... | true |
2a2757d4f6c64eecd8286ddd7358999616df26d4 | daniel-reich/ubiquitous-fiesta | /KEz3TAQfh9WxSZMLH_13.py | UTF-8 | 277 | 3.703125 | 4 | [] | no_license |
def count_all(string):
alphacount = 0
digicount = 0
for char in string:
if char.isdigit():
digicount += 1
elif char != " ":
alphacount += 1
return {"LETTERS": alphacount, "DIGITS": digicount}
| true |
f43dd0d47719435dcc97700280d7132a2071f5b9 | Jeasonxiu/rednoise | /py/tools/tsutils.py | UTF-8 | 2,835 | 3.21875 | 3 | [] | no_license | """
Helper routines for time-series
"""
import numpy as np
def autocorrelate(data):
"""
Calculate the autocorrelation function of some input data. Copied more or
less directly from http://stackoverflow.com/questions/643699/
how-can-i-use-numpy-correlate-to-do-autocorrelation
"""
yunbiased = ... | true |
8c4402d000efbd95bae208d1ef41d1a3a815d594 | ZigaHajsen/cs50 | /pset6/dna.py | UTF-8 | 1,040 | 3.046875 | 3 | [] | no_license | from sys import argv
if len(argv) != 3:
print('There need to be 3 comand line arguments')
exit(1)
file = open(argv[1], 'r')
strands = []
persons = {}
for index, row in enumerate(file):
if index == 0:
strands = [strand for strand in row.strip().split(',')][1:]
else:
curr_row = row.stri... | true |
2aea96e654f759cbd9e160d0d15005812f1b97c7 | ioam/topographica | /topo/base/generatorsheet.py | UTF-8 | 11,185 | 2.71875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | permissive | """
GeneratorSheet: a sheet with a pattern generator.
"""
import param
from topo.base.sheet import Sheet
from topo.base.patterngenerator import PatternGenerator,Constant
from topo.base.simulation import FunctionEvent, PeriodicEventSequence
from holoviews.interface.collector import AttrDict
from holoviews import Imag... | true |
447b411a48b45e19a0a8f5194c1a02adc8586113 | Victoradukwu/simple_blog | /tests/test_models/test_blog_model.py | UTF-8 | 1,273 | 2.59375 | 3 | [] | no_license | from django.test import TestCase, Client
from blog.models import Post
from model_mommy import mommy
class TestBlogModel(TestCase):
def test_can_create_post(self):
blog = mommy.prepare('Post', author=mommy.make('User'))
Post.objects.create(title=blog.title, content=blog.content, author=blog.author)
self.asse... | true |
a15cb9aee543d912ac1267bf10a09167ed99edf0 | pawarspeaks/python4beginners-Hacktoberfest21 | /Python Codes/matrix_multiplication.py | UTF-8 | 687 | 3.640625 | 4 | [] | no_license |
# Matrix Multiplication Program
def matrix_multiplication():
for i in range(len(A)):
for j in range(len(B[0])):
for k in range(len(B)):
res[i][j] += A[i][k] * B[k][j]
A=[]
B=[]
print("Enter N:")
n = int(input())
print("Enter Matrix A:")
for i in range(0, n):
temp = []
for j in range(0... | true |
b0d09810f853a3585814eaebe5c212b2ac5b2b52 | liyu711/SUAS-Competition | /ImgProcessingCLI/ImgProcessingCLI/ImageOperation/ImageMath.py | UTF-8 | 5,198 | 2.671875 | 3 | [
"MIT"
] | permissive | import numpy
from PIL import Image, ImageDraw
import ImgProcessingCLI.ImgStat.StatMath as StatMath
def get_bw_img_mean_pixel(img, image):
pixels_x = []
pixels_y = []
for x in range(0, img.size[0]):
for y in range(0, img.size[1]):
if image[x,y] != 0:
pixels_x.append(x)
... | true |
21ad1d32b1fb3f450df04f7b8f950c484028d4c6 | gmgt/learning | /ch3.py | UTF-8 | 562 | 3.390625 | 3 | [] | no_license | #попытка создать "Случайное число"
#import random
#k1 = random.randint(1, 10)
#k2 = random.randrange(10)
#print(k1, k2)
#input ("enter")
#s = input("text ")
#if s == "text":
# print("o/")
#else:
# print("\o")
#input("enter")
#import random
#n = random.randint(1,5)
#if n == 1:
# print("a")
#elif n == 2:... | true |
3a9ff13bd7e18bc740c3f85a5ec6795c788bef11 | newmansw93/intro_to_python_solns | /week2/day4-data_structures_cont/nums_to_list_of_tuples.py | UTF-8 | 286 | 3.75 | 4 | [] | no_license | num_string = input('Please input numbers separated by commas: ')
nums = num_string.split(', ')
tuple_list = []
for two in zip(nums[::2], nums[1::2]):
tuple_list.append(two)
# List comp way of doing this
tuple_list = [two for two in zip(nums[::2], nums[1::2])]
print(tuple_list)
| true |
5b8c151b5bdcd19d89357ee40dc74f3a54185934 | EmilioMuniz/ops-401d2-challenges | /class11.py | UTF-8 | 1,454 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python3
# Script: ops-401d2-challenge-class11.py
# Author: Emilio Muniz
# Date of latest revision: 4/20/2021
# Purpose: Network Security Tool with Scapy Part 1.
# Import libraries:
import random
from... | true |
0e9ee53857cbd1389d085c8900764f4aff86c0f9 | yukinarit/pyserde | /examples/nested.py | UTF-8 | 379 | 3 | 3 | [
"MIT"
] | permissive | from dataclasses import dataclass
from serde import serde
from serde.json import from_json, to_json
@serde
@dataclass
class Bar:
b: int
@serde
@dataclass
class Foo:
a: Bar
def main() -> None:
f = Foo(Bar(10))
print(f"Into Json: {to_json(f)}")
s = '{"a": {"b": 10}}'
print(f"From Json: {fr... | true |
69679412b06eb487923bd0770c68e8d38529e785 | vedrankolka/APR | /dz5/zad1.py | UTF-8 | 1,327 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | from main import *
# calculate real values
real_xs = [x0]
ts = np.arange(start, end + step, step)
for t in ts[1:]:
next_x1 = x0[0] * math.cos(t) + x0[1] * math.sin(t)
next_x2 = x0[1] * math.cos(t) - x0[0] * math.sin(t)
real_xs.append([next_x1, next_x2])
real_xs = np.array(real_xs)
if args.plot is True:
... | true |
6969a27ac8d0649a4eed43be9c440c514cf1e887 | GraduationProject5/pai-algorithm-server | /pai_algorithm/feature/discrete_service.py | UTF-8 | 2,416 | 2.8125 | 3 | [] | no_license | import pandas as pd #数据分析
import numpy as np #科学计算
from flask import Flask
import json
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from sklearn.linear_model import LogisticRegression
import os
import csv
import uuid
from pai_algorithm.pre import csv_util
from sklearn.cluste... | true |
37786f2e65ef39cefb03db7a05b136e2320f14f4 | felipevitalrc/CursoEmVideoPythonExercicios | /aula12G.py | UTF-8 | 987 | 4.40625 | 4 | [] | no_license | print('---PROGRAMA PARA CALCULAR TIPO DE TRIÂNGULO---')
ladoA = float(input('Digite a primeira reta: '))
ladoB = float(input('Digite a segunda reta: '))
ladoC = float(input('Digite a terceira reta: '))
triangulo = bool(False) #variável para identificar se foi formado triângulo com os valores informados '0' para não '1'... | true |
73144abecb7294e7217a13d1d76bf41fd4aacc17 | toshikish/atcoder | /abc/abc108_b.py | UTF-8 | 174 | 3.46875 | 3 | [] | no_license | x1, y1, x2, y2 = map(int, input().split())
dx1 = x2 - x1
dy1 = y2 - y1
dx2 = -dy1
dy2 = dx1
x3 = x2 + dx2
y3 = y2 + dy2
x4 = x3 - dx1
y4 = y3 - dy1
print(x3, y3, x4, y4)
| true |
2a31134430ffdab86223cd5c36b1cfb7ce9b8d7a | Saumyaoec/login_admin_user_countdown | /countdown_core/services/countdown_management.py | UTF-8 | 1,225 | 2.875 | 3 | [] | no_license | from django.contrib.auth import get_user_model
def create_countdown(form, user=None):
"""
Creates new countdown object and and saves it to db.
:param form: instance of CountdownForm
:param user: user from request, default is None
:return: countdown object if created successfully else None
"""
... | true |
7ee7707c4bf3d822b3c7634ce9b6963f45cf3c77 | cugis2019dc/cugis2019dc-Shaine-San | /day 1.py | UTF-8 | 479 | 3.53125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
Hello my name is shiane
print("my name is shaine")
print("i want food")
5/2
5*2
5-2
5^2
8/9*2
print("5*2")
def mutiply(a,b):
mutiply=a*b
print(mutiply)
multiply(4,5)
def mutiply ... | true |
c77f4b3e9528beae44b1a52cd3e4a0904c9c7c91 | ArlenZhang/basic_python_code | /Learn21.py | UTF-8 | 1,673 | 4.25 | 4 | [] | no_license | """
描述符类:将某种特殊类型的类的实例指派给另一个类的属性
__get__(self,instance,owner) 访问属性
__set__(self,instance,value) 设置属性
__delete__(self,instance) 删除属性 的时候调用
property实际上就是描述符类~
"""
class Desc:
def __get__(self, instance, owner):
print('getting ', self, instance, owner) # 参数:描述类、被描述属性的对象实例、对象属类... | true |
3d1e5eb1c895916677afc88b362175f5fad6f98f | LitingLin/ubiquitous-happiness | /models/TransT/variants/aft_feature_fusion/feature_fusion.py | UTF-8 | 2,350 | 2.53125 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.nn import ModuleList
from .cross_attention import AFTCrossAttention, AFTCrossAttentionDecoder
from .self_attention import AFTSelfAttention
class Encoder(nn.Module):
def __init__(self, dim, z_size, x_size, # (H, W)
aft_type):
super(Encoder, sel... | true |
787212657286a9386b6d0fdb2eface41c27da8d0 | nabeel-malik/my_python | /python_challenge/python_challange_2_regex_pagesource.py | UTF-8 | 620 | 2.828125 | 3 | [] | no_license | import sys
import os
import linecache
import itertools
import fileinput
import re
with open('./inputfiles/python_challange_2_regex_pagesource/pagesource.txt', 'r+') as pagesource_file:
pagesource_string = pagesource_file.read()
regex = r"""
^<!--
[\w\s:]*?
-->.*?
^<!--
(.*?) ... | true |
cfc0a1f6b99945df7039f3557ea146e97792b501 | r0x57n/library-wallpaper | /library-wallpaper.py | UTF-8 | 8,524 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
from os.path import isfile
from os import remove
import requests
import random
import io
import sys
import toml
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
DEFAULT_CONF_PATH = "./config"
class Config:
"""
Keeps the configuration of the application, includes... | true |
ef83df1c9230db6e7e0b8fb3924821e50138517d | oalejel/maizebot | /main.py | UTF-8 | 2,455 | 2.6875 | 3 | [] | no_license | from maze import Maze
from controls import Controller
from planning import Planner
from gui import MazeGUI
from video_reader import *
from diagnostics import *
import cv2
import threading
import time
GUI_ENABLED = True
def main():
# prepare higher level objects
reader = Reader(2, True)
diagnostics =... | true |
88f21d0cbd2f682f3a4b9c0dd6e8fd98dd777256 | jpschewe/gnucash-stock-portfolio | /gnucash_patch.py | UTF-8 | 1,195 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Monkey patch for GnuCash Python bindings as the Python class GncPrice does not implement a correct __init__ method by default
'''
import datetime
import gnucash.gnucash_core_c
from gnucash.function_class import ClassFromFunctions
from gnucash import Session, GncPrice... | true |
575055541a46fb31201d0fe570316224d8696bb8 | daniel-reich/ubiquitous-fiesta | /928sxbEt8gyZ5uBBt_0.py | UTF-8 | 248 | 3.375 | 3 | [] | no_license |
def wurstIsBetter(str):
sausages = ["Kielbasa", "Chorizo", "Moronga", "Salami", "Sausage", "Andouille", "Naem", "Merguez", "Gurka", "Snorkers", "Pepperoni"]
return " ".join(["Wurst" if x.title() in sausages else x for x in str.split() ])
| true |
3adf383c17f3e34c93d35bd5647496d4ec40531e | met1366/NADICS | /nadics/selector.py | UTF-8 | 2,703 | 3.140625 | 3 | [] | no_license | ###############################################################################
# #
# Evaluating, selecting and extracting the relevant features from our dataset.#
# #
... | true |
e60fcab5b631fbca307234627c5c45d31351a395 | edgeware/mockito-python | /mockito_test/staticmethods_test.py | UTF-8 | 3,268 | 2.828125 | 3 | [
"MIT"
] | permissive | from mockito_test.test_base import *
from mockito import *
class Dog:
@staticmethod
def bark():
return "woof"
@staticmethod
def barkHardly(*args):
return "woof woof"
class Cat:
@staticmethod
def meow():
return "miau"
class StaticMethodsTest(TestBase):
def tearDown(self):
unstub(... | true |
0ca30c9f5b80245f5b5aff6dc16c45aa489581e5 | ryanGT/krauss_misc | /regexp_replacer.py | UTF-8 | 1,010 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
import txt_mixin
from optparse import OptionParser
usage = 'usage: %prog [options] regexp replacement inputfile'
parser = OptionParser(usage)
## parser.add_option("-r", "--runlatex", dest="runlatex", \
## help="Run LaTeX after presentation is converted to tex.", \
## ... | true |
e4daf7f7831bde0c95592ae6ea7acccff1cbdbb3 | fanwei666/201814811fanwei | /knn/VSM.py | UTF-8 | 3,978 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import nltk
import random
import os
#nltk.download('stopwords')
#nltk.download('wordnet')
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
from nltk.stem.porter import PorterStemmer
from sklearn.feature_extractio... | true |
73e0837d45fabda6b79a5f47dbdcfdf1ba3231c7 | saenyakorn/2110101-COMP-PROG | /08/08_Dict_21.py | UTF-8 | 319 | 3.375 | 3 | [] | no_license | s = input().lower()
frq = {}
for c in s:
if 'a' <= c <= 'z':
if c in frq : frq[c] += 1
else : frq.update({c:1})
ls = []
for k,v in frq.items():
ls += [(k,v)]
ls.sort(key = lambda x : x[0])
ls.sort(key = lambda x : x[1],reverse=True)
for item in ls:
print("{} -> {}".format(item[0],item[1])) | true |
432acbfc4bc25ff41bb771460ec00319f2a3fe54 | vladaspasic/fireant | /fireant/slicer/widgets/helpers.py | UTF-8 | 3,810 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from fireant import utils
from fireant.formats import (
INF_VALUE,
NULL_VALUE,
)
from fireant.slicer.totals import TOTALS_MARKERS
from ..references import reference_label
def extract_display_values(dimensions, data_frame):
"""
Retrieves the display values for each dimension.
F... | true |
0274764728a7d772dce5f0bf0844a41615d85a2f | jgorman3691/PyNetworkCookBook | /Chapter4/4_1_download_data.py | UTF-8 | 1,973 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
import ssl
import argparse
import http.client as ht
REMOTE_SERVER_HOST = 'www.python.org'
REMOTE_SERVER_PATH = '/'
REMOTE_SERVER_PORT = 443
class HTTPSClient:
def __init__(self, host=REMOTE_SERVER_HOST, port=REMOTE_SERVER_PORT):
self.host = host
self.port = port
self.http_... | true |
d985123da63a42d1d36b18d3155d109efcd7dd26 | lisfer/seawar_core | /tests/test_core.py | UTF-8 | 15,777 | 2.96875 | 3 | [] | no_license | import unittest
from seawar_core.seawar_core import base_cell, Matrix, Field, ShipService, CellField, CoordOutOfRange, UnknownCellValue, \
TargetField, CellTarget
class CellTest2(unittest.TestCase):
def test_default_value(self):
cell_class = base_cell(values=['ship', 'empty'])()
cell = cell_... | true |
213ba5866ee9becd471498801ee59c92cccd563b | nao1412/Competitive_Programing_Codes | /Algo/順列全探索/145C.py | UTF-8 | 390 | 3.109375 | 3 | [] | no_license | from itertools import permutations
n = int(input())
x, y = [0]*n, [0]*n
for i in range(n):
x[i], y[i] = map(int, input().split())
def dist(a, b):
dx = x[a] - x[b]
dy = y[a] - y[b]
return (dx**2 + dy**2)**0.5
ans = 0
np = [x for x in range(n)]
p = list(permutations(np))
for a in p:
memo = 0
for i in range... | true |
bd4d09d81927fd2023fd110ff2771dee823e4b04 | anjan4273/Python | /Day2/DictionariesTest.py | UTF-8 | 419 | 3.734375 | 4 | [] | no_license | a = {'name': 'anjan', 'proper': 'ananthapur', 'name': "viswa"}
# key : value, key : value
print(type(a))
print(len(a))
print(dir(a))
#How to get all keys form dict varaible
print(a.keys())
print(a.values())
#Styel One
print(type(a.get('name')))
print((a.get('name')).upper())
print(a.get... | true |
26f86f265e6c6653a91ae3b2a2e30f271a402d58 | faris-shi/python_practice | /prime_number.py | UTF-8 | 546 | 3.734375 | 4 | [
"MIT"
] | permissive | """
generate all possible prime numbers through the Sieve of Eratosthenes algorithm
Reference: https://en.wikipedia.org/wiki/Prime_number
Reference: https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
"""
def _odd_iter():
n = 1
while True:
n += 2
yield n
def primes_number():
yield 2
i... | true |
d808a41b83d832ff51cbef085b21b5c4ca72d6dc | Aasthaengg/IBMdataset | /Python_codes/p03555/s186691101.py | UTF-8 | 80 | 3.359375 | 3 | [] | no_license | a = input()
b = input()
print('YES' if a == b[::-1] and b == a[::-1] else 'NO')
| true |
efe620a80d5e5d317726ea894b82fb1d14e9fef0 | DrVTomY/python-assignments | /excelreader.py | UTF-8 | 312 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 18 10:20:32 2019
@author: GaonkarN
"""
import pandas as pd
import xlrd
wb = xlrd.open_workbook('jff.xlsx')
print(wb.sheet_names())
sheet = wb.sheet_by_index(0)
data = pd.read_excel(r'jff.xlsx')
df = pd.DataFrame(data, columns=['a', 1])
print(df)
| true |
c3b9b154e59f65d691dd9ad64c4a9b2810d7e0fb | hoangchunghien/deep-learning-framework | /optimizers.py | UTF-8 | 371 | 2.75 | 3 | [] | no_license |
class SGD(object):
def __init__(self, parameters, lr=0.1):
self.parameters = parameters
self.lr = lr
def zero(self):
for p in self.parameters:
p.grad.data *= 0
def step(self, zero=True):
for p in self.parameters:
p.data -= p.grad.data * self... | true |
69debf8f3a9d08883b7f6f3ae958e1a4728269ab | parisChatz/CMP9767M | /uol_cmp9767m_tutorial/scripts/image_projection_1.py | UTF-8 | 3,008 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# Python libs
import sys, time
# OpenCV
import cv2
# Ros libraries
import roslib, rospy, image_geometry,tf
# Ros Messages
from sensor_msgs.msg import Image, CameraInfo
from geometry_msgs.msg import PoseStamped
from cv_bridge import CvBridge, CvBridgeError
class image_projection:
camera_mo... | true |
6a3b7d186f22c824f3d43e030ad51e1692ec0409 | Vishal45-coder/Day13 | /Module5_A2_Dict(DelKey).py | UTF-8 | 155 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 3 08:54:35 2020
@author: vishal
"""
sample={"one":1,"two":2}
del sample["one"]
print(sample) | true |