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 |
|---|---|---|---|---|---|---|---|---|---|---|
78f6cae78c1ace104f45fa8466fe4e9fcabc1282 | edumeirelles/Blue_modulo1 | /Aula_10/Exercicios_aula_10_ex4_FORCA2.py | UTF-8 | 1,202 | 3.828125 | 4 | [] | no_license | import random
lista = input('digite uma lista de palavras separadas por espaço: ')
lista = lista.split(' ')
if len(lista) == 1:
palavra = lista[0].upper()
else:
palavra = random.choice(lista).upper()
palavra_forca = ['_' for i in palavra]
chance = 0
print('A palavra é: ', end = '')
print(' '.join(palavra_... | true |
bbca491b11872f81a4ec5dfe5179d5916dfaf11e | zhangshuai365/my-python-repository | /Python经典练手小程序100例/program_12.py | UTF-8 | 511 | 4.0625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
【程序12】
题目:判断101-200之间有多少个素数,并输出所有素数。
程序分析:判断素数的方法:用一个数分别去除2到sqrt(这个数),如果能被整除,则表明此
数不是素数,反之是素数。
"""
from math import sqrt
a = []
for i in range(101, 201):
for j in range(2, int(sqrt(i)) + 1):
if i % j == 0:
break
else:
a.append(i)
print("素数个数:", len(a))... | true |
87f34da2310425f20a1bd86c2ca3e001bfc4c850 | supriyamarturi/pyphonprograming | /677.py | UTF-8 | 94 | 3.125 | 3 | [] | no_license | k=int(raw_input())
m=k+1
while(m!=0):
if m%10==0:
print m
break
m=m+1
| true |
dd5c1758b8c44310933b59640b378cf961a28f02 | ALEX7320/documentacionpyqt | /qscrollarea/mainsarea.py | UTF-8 | 824 | 2.734375 | 3 | [] | no_license | # modulos de PySide2 utilizados
from PySide2.QtWidgets import QMainWindow
# diseño
from view.ui_elementos import Ui_Elementos
class MainSarea(QMainWindow):
def __init__(self):
super(MainSarea, self).__init__()
self.raiz = Ui_Elementos()
self.raiz.setupUi(self)
# primero e... | true |
39a1c19e64dffb02a8c6146d55a2db4cb4d67b14 | leo-editor/ast-token-tools | /ast_token_tools/leoAst.py | UTF-8 | 190,255 | 2.59375 | 3 | [
"MIT"
] | permissive | #@+leo-ver=5-thin
#@+node:ekr.20141012064706.18389: * @file leoAst.py
"""AST (Abstract Syntax Tree) related classes."""
import leo.core.leoGlobals as g
import ast
import time
import types
#@+others
#@+node:ekr.20160521104628.1: ** leoAst.py: top-level
#@+node:ekr.20191027072910.1: *3* exception classes
class AstNotEq... | true |
b14dfcea7a6ba251a286cd3014a1ba2c66b1ee4c | xiaolongjia/techTrees | /Python/02_DataEngineering/Pandas/examples/dayMomentum.py | UTF-8 | 1,502 | 2.546875 | 3 | [] | no_license | # encoding: UTF-8
from sys import argv
import pandas as pd
pd.set_option('display.width', None)
import numpy as np
import sys
sys.path.append('..')
import common.futuData as fu
def oneDay(ticker, pchgLimit=2):
df = fu.getDayK(ticker)
# print(df)
df['chg'] = df['close'] - df['open']
df['chgon'] = df['close'] ... | true |
4d5dcf413df15113ea97c577d7ddbb6aa2c97e6c | nickelwick/tango | /rango/views.py | UTF-8 | 2,163 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.shortcuts import render
from django.http import HttpResponse
# Models
from rango.models import Category, Page
def index(request):
# Query the databas... | true |
4f57e43d1181316bb504a9f34cef74cb81a06be6 | ddp-danilo/ddp-pythonlearning1 | /sm5ex2.py | UTF-8 | 1,087 | 3.296875 | 3 | [] | no_license | def multiplo_de_3(sm):
sd = 0
while sm != 0:
sd += sm % 10
sm //= 10
if ((sd % 3) == 0):
return True
else:
return False
def multiplo_de_cinco(c):
if ((c % 10) == 5) or ((c % 10) == 0):
return True
else:
return False
def e_par (pa):
if (((pa ... | true |
4e0ff6ad448f20deb8d9108a40026f185ddd359e | zackbakerusc/plotille-1 | /examples/example_single_hist.py | UTF-8 | 204 | 2.703125 | 3 | [
"MIT"
] | permissive | import plotille
import numpy as np
print('Histogram left to right')
print(plotille.hist(np.random.normal(size=10000)))
print('Histogram rotated')
print(plotille.histogram(np.random.normal(size=10000)))
| true |
bffb2e6c202ad7553874a50cee10d72cd3b42cab | slevin886/trip_durations | /commute_analyzer.py | UTF-8 | 6,457 | 3.109375 | 3 | [] | no_license | """Takes in google API commute data and returns statistics and figures"""
import pandas as pd
from pandas.tseries.holiday import USFederalHolidayCalendar
import re
import datetime
from plots import (mean_commute_time_plot, daily_commute_time_plot, lost_time_plot,
commute_distance_variation_plot, tot... | true |
36052a74e067159a961126db1c4b69ba94f8fd5b | wojtas2000/python | /tasks from the course/Day10/example4.py | UTF-8 | 299 | 2.84375 | 3 | [] | no_license | class Samochod:
def __init__(self, marka):
self.marka = marka
self.czy_wlaczony = False
def wlacz(self):
self.czy_wlaczony = True
def wylacz(self):
self.czy_wlaczony = False
samochod = Samochod("Volvo")
# samochod.czy_wlaczony = True
samochod.wlacz()
| true |
a939ee449143148583eee651d8fb600f28c54e58 | asobey/gravit8 | /main.py | UTF-8 | 13,328 | 2.625 | 3 | [] | no_license | #!python3
# GRAVIT8 - Physics Game
# --- ATTRIBUTIONS / CREDITS ---
# Music By: his work is licensed under the Creative Commons Namensnennung - Weitergabe unter gleichen Bedingungen 3.0
# Unported License Author: sofamusik
# Sprites By: Kenney.nl
# Sounds Using: bfxr.net
# Planets By: Viktor.Hahn@web.de
# Background... | true |
da9dc9fece067cb0c4a15383953ad14a1167a9d8 | SinduMP/Dasar-Pemrograman | /jobsheet.py | UTF-8 | 3,917 | 4.09375 | 4 | [] | no_license | #Sistem Matematika
#Membuat Program Menghitung Luas dan keliling Bangun Datar
def luas_bujur_sangkar (s):
luas = s*s
return luas
def keliling_bujur_sangkar (s):
keliling = 4*s
return keliling
def luas_persegi_panjang (p,l):
luas = p*l
return luas
def keliling_persegi_panjang (p,l):
kelili... | true |
0e1636d625835683ef2654a453c0cec9f2d66186 | codevscolor/codevscolor | /python/python-get-all-sublists-list/example2.py | UTF-8 | 703 | 4.09375 | 4 | [
"Apache-2.0"
] | permissive | # https://codevscolor.com/python-get-all-sublists-list
def get_sublists(l):
if len(l) == 0:
return [[]]
sublists = []
first = l[0]
remaining = l[1:]
sublist_remaining = get_sublists(remaining)
for sublist in sublist_remaining:
sublists.append([first] + sublist)
sublists.ex... | true |
6d5a6f0f1c4132c1fe7e746a61c4013af29c14f9 | EllipticBike38/PyAccademyMazzini21 | /Lelio_es1.py | UTF-8 | 132 | 3.09375 | 3 | [] | no_license | def quad(n=10):
ans=[]
for i in range(n):
ans.append(i**2)
return ans
ans=[i**2 for i in range(10)]
| true |
468231acd2499577ce8bc959f5551ea0a08eaec8 | S180231891/PaChong | /Day14-IP代理.py | UTF-8 | 1,045 | 2.625 | 3 | [] | no_license | # -*- coding= utf-8 -*-
# @Time : 2021-04-26 10:11
# @Author : baoguo
# @File : Day14-IP代理.py
# @Software : PyCharm
"""
IP代理网站:
快代理
西祠代理
http://www.goubanjia.com/
代理IP的匿名程度:
- 透明:服务器知道该次请求使用了代理, 知道请求对应的真实IP
- 匿名:服务器知道请求使用了代理, 但不知道请求的真实IP
- 高匿名:不知道使用了代理, 不知道真实IP
""... | true |
0800cb09c0f8caf481b8e18e2335c8a5826f5512 | LuckyBoy314/LightningBulletin_v1 | /BulletinsCrawl.py | UTF-8 | 4,997 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import re
import urllib2
import urllib
import urlparse
from bs4 import BeautifulSoup
import cookielib
loginurl = 'http://122.224.174.179:8088/login.jsp'
class Login(object):
def __init__(self):
self.name = ''
self.passwprd = ''
self.cj = cookielib.LWPCookieJar()
... | true |
48108c370d53abafec52e792777c62101fa5cad2 | jrahm/DuckTest | /writeup/examples/linkedlist.py | UTF-8 | 386 | 3.421875 | 3 | [
"BSD-2-Clause"
] | permissive | class LinkedList:
def __init__(self):
self.next = None
self.data = None
def append(self, d):
self.data = d
self.next = LinkedList()
return self.next
def add_two(x):
return x + 2
head = LinkedList()
cursor = head
cursor = cursor.append(1)
cursor = cursor.append(2)
a... | true |
8821de90906a41c7c0fa44c3b1aa620fdc7005fb | shubham860/Machine-learning-programs | /ml5-poly.py | UTF-8 | 1,027 | 3.453125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#GENERATING FAKE DATA
m = 100
X = 6 * np.random.randn(m ,1) - 3 #-3 FOR MAKING CURVE
y = 0.5 * X ** 2 + X + 2 + np.random.randn(m,1)
#PLOTING FAKE DATA
plt.scatter(X,y)
plt.axis([-3, 3, 0, 9]) #for zoom B/w -3 and 3 on x-axis and b/w 0 to 9 on... | true |
b2df5a5ab7c5f307c6b594c70a58578ed48924a9 | tmusale/ML-Projects | /naive bayes/email classification/email.py | UTF-8 | 4,848 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 21 11:29:34 2019
@author: tushar
"""
import nltk
#nltk.download('punkt')
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from collections import Counter
from nltk.tokenize i... | true |
3b924a01fae8e1665915c7e3e10558d4bebaf7d0 | rronan/pyronan | /pyronan/utils/html_viz.py | UTF-8 | 4,122 | 2.609375 | 3 | [
"MIT"
] | permissive | import argparse
import json
import math
import os
import shutil
import tempfile
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import yaml
from path import Path
matplotlib.use("Agg")
html_template = """
<!-- ## Code -->
<!-- <meta charset="utf-8"/> -->
<!DOCTYPE html>
<html>
<body>
<p>
... | true |
186eff9e73472131607259a06c377408ed7b9790 | JenZhen/LC | /lc_ladder/company/fb/Walls_And_Gates.py | UTF-8 | 1,867 | 3.4375 | 3 | [] | no_license | #! /usr/local/bin/python3
# https://leetcode.com/problems/walls-and-gates/
# Example
# You are given a m x n 2D grid initialized with these three possible values.
#
# -1 - A wall or an obstacle.
# 0 - A gate.
# INF - Infinity means an empty room. We use the value 231 - 1 = 2147483647 to represent INF
# as you may assu... | true |
723dad4c7baf86943d55f37ae8adc21cd1be6b88 | cz-fish/advent-of-code | /2019/17b.py | UTF-8 | 533 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import intcode
with open('input17.txt', 'rt') as f:
lines = f.readline().strip()
program = [int(i) for i in lines.split(',')]
program[0] = 2
input_lines = [
'A,B,A,B,C,C,B,A,C,A\n',
'L,10,R,8,R,6,R,10\n',
'L,12,R,8,L,12\n',
'L,10,R,8,R,8\n',
'n\n'
]
input = [ord(c) fo... | true |
1c813f6f6600f8ecb44acdc2ac95187ab736e84c | vijaykm2/ToDoList | /Problems/Jackie's Savings/main.py | UTF-8 | 203 | 3.3125 | 3 | [] | no_license | def final_deposit_amount(*interests, amount=1000):
result = amount
for interest in interests:
result *= (1+interest/100)
return round(result, 2)
# print(final_deposit_amount(5,7,4)) | true |
88e399374bae718a31f43e527574f0b4444a4fda | anilkumar5042001/profile | /MyApp/DBObjects/BAL/CountryBAL.py | UTF-8 | 581 | 2.515625 | 3 | [] | no_license | from ..DAL.CountryDAL import CountryDAL
class CountryBAL:
def GetCountryById(self,countryId):
objCountryDAL=CountryDAL()
return objCountryDAL.GetCountryById(countryId)
def GetCountries(self):
objCountryDAL=CountryDAL()
return objCountryDAL.GetCountries()
def InsertCountry... | true |
664d5f679cbe88f4fafc752d1a1136095c4b0c00 | rajdharmkar/Python2.7 | /nonumeric1.py | UTF-8 | 336 | 4.3125 | 4 | [] | no_license | # define punctuation
#numerals = '[0-9]'
numerals = '0,1,2,3,4,5,6,7,8,9'
# take input from the user
my_str = raw_input("Enter a alphanumeric string: ")
# remove numerals from the string
no_numer = ""
for i in my_str:
if i not in numerals:
no_numer = no_numer + i
# display the alphabet string
p... | true |
5c78219e396ec3f41a38ed31f6e411744cdca052 | Shellowb/BioMixer | /biomixer-venv/lib/python3.9/site-packages/sqlformat/storage/StorageStrategyTemplate.py | UTF-8 | 1,314 | 2.65625 | 3 | [
"MIT"
] | permissive | from abc import ABC, abstractmethod
import json
from sqlformat.helper import sql_helper
class StorageStrategyTemplate(ABC):
def parse_procedure(self, procedure_path, procedure_variables: dict):
"""
To download procedure from storage and transform placeholder with value
"""
proced... | true |
6a90dbc8a0f55543e984a53d194440c9dd54b733 | jdthorne/spacegame2d | /src/math/Timing.py | UTF-8 | 681 | 3.03125 | 3 | [] | no_license | import time
times = { }
calls = { }
timing = False
def timedFunction(fn):
def wrap(*args, **kwargs):
start = time.clock()
result = fn(*args, **kwargs)
end = time.clock()
delta = end - start
name = fn.__module__ + "." + fn.__name__
if not name in times:
times[name] ... | true |
de9bb9a25777cfee2f50298a9f94753bf39444a6 | hrishi32/PageRank-Algorithm | /Matrix/mapper3.py | UTF-8 | 756 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
import fileinput
Nr = 0
Nc = 1
Mr = 0
Mc = 0
for pos, line in enumerate(fileinput.input()):
line = line.strip()
if pos == 0:
# line = line.split()
Mr, Mc, Nr = int(line),int(line), int(line)
# elif pos == 1:
# Nr, Nc = map(int, line.split())
# assert M... | true |
eea8bb787f304ec4404f07ea04cc86a4b9e19894 | higornobrega/Selenium_Python | /aula4/aula4_5.py | UTF-8 | 1,233 | 3.734375 | 4 | [
"MIT"
] | permissive | from selenium.webdriver import Chrome
from pprint import pprint
from time import sleep
'''
# Pegar todos os links de aula
{'nome da aula':'link da aula'}
# Navegar até o exercício 3
Achar a url do exercício 3 e ir até lá
'''
browser = Chrome()
browser.get('https://selenium.dunossauro.live/aula_04.html')
de... | true |
8499ab8b5670d19fa12402bacf3b00e5a70344ca | BIGtigr/codeml | /sds-az/Part 1 - Data Preprocessing/Section 2 - Data Preprocessing/DataPreprocess.py | UTF-8 | 3,296 | 3.3125 | 3 | [
"MIT"
] | permissive | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
Created on : Mon Apr 9 22:12:35 2018
@author : Sourabh
"""
# %%
# import the libraries
import numpy as np
import pandas as pd
from sklearn.preprocessing import Imputer
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import OneHotEnco... | true |
d16561217aab173564ba900c65b9abe1cc893955 | JnnyRdng/testing_using_unittest | /tests/calculator_test.py | UTF-8 | 1,101 | 3.4375 | 3 | [] | no_license | import unittest
from src.calculator import add, divide, multiply, subtract
class TestCalculator(unittest.TestCase):
def test_add(self):
# test that the add() function in calculator produces the correct results
expected = 7
actual = add(2, 5)
self.assertEqual(expected, actual)
... | true |
3c692e07c2d1cc9db8521048e602f810c250d5bf | thunderzwei/accompany-music-vae | /utils.py | UTF-8 | 1,391 | 3.453125 | 3 | [
"MIT"
] | permissive | '''
Project-wide utilities.
Functions
---------
is_melody(Note) : bool
strip_to_melody(NoteSequence) : NoteSequence
remove_melody(NoteSequence) : NoteSequence
'''
from copy import deepcopy
def is_melody(note):
return note.program <= 31 and not note.is_drum
def strip_to_melody(sequence):
'''
Strip a N... | true |
b3eb2ccdb0717be9a48208a96a4b7465a8073f01 | SirFloIII/GeoDat | /geodat_1_turtle.py | UTF-8 | 215 | 3.359375 | 3 | [] | no_license | import turtle
import math
dx = 0.01
zoom = 200
t=0
while t<2*3.1415:
turtle.left(180/3.1415 * dx * 2/math.sqrt(3*math.sin(t)**2 +1)**3)
turtle.forward(zoom * dx)
dt = dx / math.sqrt(3*math.sin(t)**2+1)
t += dt | true |
54a15cb65a881d90a92bf76b4a3bca879623b6ee | vidyasagarr7/DataStructures-Algos | /GeeksForGeeks/Strings/PrintWords.py | UTF-8 | 635 | 4.0625 | 4 | [] | no_license |
"""
Recursively print all sentences that can be formed from list of word lists
Given a list of word lists How to print all sentences possible taking one word from a list at a time via recursion?
Example:
Input: {{"you", "we"},
{"have", "are"},
{"sleep", "eat", "drink"}}
Output:
you have sleep
yo... | true |
7d6355473cb3a9c4dc6440daa11980ded47535f9 | TahaAlTamimi/python-web | /project4.py | UTF-8 | 2,271 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 12 06:15:43 2019
@author: OJO3
"""
from flask import Flask,render_template,request, redirect, url_for
import sqlite3 as sql
app=Flask(__name__)
app.secret_key='abc'
@app.route('/')
def login():
return render_template('login_project4.html')
@... | true |
ce11a47b895f96cea14d98e8c92ab275f0c5a3f8 | ogi-ivanovic/Label-Creator | /excel.py | UTF-8 | 4,246 | 3.03125 | 3 | [] | no_license | import os
import openpyxl
def formatDate(date):
year = date[0:4]
month = date[5:7]
day = date[8:10]
if day[0] == '0':
day = day[-1]
if month == '01':
month = 'January'
if month == '02':
month = 'February'
if month == '03':
month = 'March'
... | true |
dfd4fa481b51f298a110be59393e76bb8f196352 | nyamanana/hangman | /12-1.py | UTF-8 | 182 | 2.953125 | 3 | [] | no_license | class Apple:
def __init__(self,num,lar,col,wei):
self.number = num
self.large = lar
self.color = col
self.weight = wei
print("Created!")
| true |
899a1c910bef7f1bd2df98ef01588d1148ed787e | SumitPugalia/heuristics | /python/linked_list.py | UTF-8 | 4,011 | 3.703125 | 4 | [] | no_license | class Node:
slots = '_data', '_next'
def __init__(self, _data):
self._data = _data
self._next = None
class LinkedList:
def __init__(self):
self._head = None
def printList(self):
temp = self._head
while (temp):
print(temp._data)
temp = tem... | true |
8b96cc24e2642c33183c82799f43c9f3815cc5f9 | nswa17/Mn | /python/py0502/test2.py | UTF-8 | 262 | 2.921875 | 3 | [
"MIT"
] | permissive | from random import normalvariate
import matplotlib.pyplot as plt
def ts(T, alpha):
series = [0]
for i in range(T):
series.append(alpha*series[i] + normalvariate(0, 1))
return series
#print(ts(100, 0.98))
plt.plot(ts(100, 0.98))
plt.show()
| true |
3d5c08f3774c4806f7e0d8ccc0eb6f0f9512ac6c | Elig-GM/st0256 | /entrega1/lenguajes_adicionales/python/secante.py | UTF-8 | 1,162 | 3.71875 | 4 | [] | no_license | import math
def f(x) : return math.exp(-math.pow(x, 2) + 1) - 4 * math.pow(x, 3) + 25
if __name__ == "__main__":
x0, x1, tol = 1.0, 2.0,0.0005
fx0, e = f(x0), tol + 1.0
fx1, xa, den = None, None, None
iter, n, error = 100, 0, 0
print("\n{:^5}{:^18}{:^15}{:^15}\n".format("n", "xn", "f(... | true |
d505f84b41da31c705a67dee918512e45c226c4f | shokokb/personal-study | /env/opt/leetcode/0100/0161_One_Edit_Distance.py | UTF-8 | 1,050 | 2.984375 | 3 | [] | no_license | class Solution:
def isOneEditDistance(self, s: str, t: str) -> bool:
short_term = list(s) if len(s) < len(t) else list(t)
long_term = list(t) if len(s) < len(t) else list(s)
if len(long_term) == len(short_term):
for i in range(len(long_term)):
if short_t... | true |
5305188516ff5763f42d29c4893e961b07b8634c | tbblank/Machine_Language | /AP2/AP2.py | UTF-8 | 1,389 | 2.640625 | 3 | [] | no_license | from random import random;
from pybrain.datasets import ClassificationDataSet;
from pybrain.tools.shortcuts import buildNetwork;
from pybrain.structure.modules import SoftmaxLayer;
from pybrain.supervised.trainers import BackpropTrainer;
from pybrain.utilities import percentError;
from math import... | true |
156101adc30c5366a2b85ab3b6de2917241f82fb | jdeitelzweig/hackpton19 | /nlp.py | UTF-8 | 1,733 | 3.03125 | 3 | [] | no_license | import os
# Imports the Google Cloud client library
from google.cloud import language
from google.cloud.language import enums
from google.cloud.language import types
# Set environment variable to API Key
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "google-cloud-key.json"
# Instantiates a client
client = language.... | true |
12c146a3dd1f157a015402999958b8aa3cbe73d8 | s87485759/Monad2015-trial | /LookAhead/fitness.py | UTF-8 | 8,078 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Copyright 2015 Ericsson AB
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | true |
d4cc0588040110c7ee1de7622bff0ec8ee8e98a8 | gabrielcaldeira757/Estudos-de-Python | /Preço do cafe.py | UTF-8 | 386 | 3.109375 | 3 | [] | no_license | import urllib.request
import time
finalizar = 'a'
dindin = 99.99
while dindin >= 4.74:
pagina = urllib.request.urlopen('http://beans.itcarlow.ie/prices.html')
texto = pagina.read().decode('utf8')
preco = texto.find('$')
dindin = float(texto[preco+1: preco+5])
if dindin < 4.74:
print(dindin)
else :
print('Val... | true |
1ffabb291f1a33e3041ce2d8c3e2883339f85dbb | eduardoansi/data_jobs_skills | /jobs_analysis.py | UTF-8 | 3,557 | 3.28125 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
import re
import pathlib
# Get current path
cur_path = str(pathlib.Path().absolute())
# Import dataset
df = pd.read_excel(cur_path + "\\jobs.xlsx")
df.columns = np.arange(0,df.shape[1])
# New dataframe to store transformations
df_clean = pd.DataFrame()
# Iterate... | true |
b6632a6d96bb8b8fda324e4cffa791f709e48538 | GaretJax/mddns | /mddns/server.py | UTF-8 | 4,235 | 2.53125 | 3 | [
"MIT"
] | permissive | import os
import json
import hmac
import binascii
import threading
import time
import itertools
import smtplib
from email.mime.text import MIMEText
from http.server import HTTPServer, BaseHTTPRequestHandler
# TODO: Tests, Logging, Configuration, Packaging, Deployment
class Handler(BaseHTTPRequestHandler):
encod... | true |
ea22dd4e51729f27813970934b766e405a23a44e | jakeberg/backend-tdd-assessment | /tests/test_echo.py | UTF-8 | 2,629 | 3.078125 | 3 | [] | no_license | import unittest
import sys
import subprocess
import echo
class TestEcho(unittest.TestCase):
def test_help(self):
""" Running the program without arguments should show usage. """
# Run the command `python ./echo.py -h` in a separate process, then
# collect it's output.
process... | true |
867fd4b95733bb7a2d1fc5e9fc33cb6ead0585cd | jdkandersson/OpenAlchemy | /tests/test_cli.py | UTF-8 | 4,558 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | """Tests for the CLI."""
import argparse
import os
import pathlib
import sys
from unittest import mock
import pytest
from open_alchemy import cli
from open_alchemy import exceptions
from open_alchemy.helpers import command as command_helper
@pytest.mark.parametrize(
"specfile",
[
pytest.param("spec... | true |
926c4b26582ce5713b7645f82895cc7e352e7dff | Ramanujan1997/FYS3150 | /project5/plotting/different_omega.py | UTF-8 | 2,844 | 2.640625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import os
plt.style.use("bmh")
sns.color_palette("hls", 1)
import matplotlib
matplotlib.rc('xtick', labelsize=14)
matplotlib.rc('ytick', labelsize=14)
matplotlib.rcParams['mathtext.fontset'] = 'stix'
matplotlib.rcParams['font... | true |
e0158f37439ce92eb072ac20759d6ad76d35964e | xbx12138/Python_study_120191080123 | /exercise/01_week/do_reserver.py | UTF-8 | 599 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# file:do_reserver.py
# author:Asus
# datetime:2021/3/4 15:17
# software: PyCharm
'''
this is functiondescription
'''
# import module your need
# 课堂练习:
# 输入一个字符串,比如 abcdef;1 通过字符串切片方式反向输出;2 存放到列表中,然后反向输出:fedcba
def reverseStr(input):
print(input[::-1])
def reverselis... | true |
c98a63165d331410ca56ea2e01ecbb99c2eca825 | pragati4721/LPTHW | /ex18.py | UTF-8 | 325 | 3.09375 | 3 | [] | no_license | def printwo(*args):
arg1,arg2 = args
print "arg1: %r,arg2: %r"%(arg1,arg2)
def printwoag(arg1,arg2):
print "arg1: %r,arg2: %r"%(arg1,arg2)
def printone(arg1):
print "arg1: %r"%arg1
def printnon():
print "I got nothin'."
printwo("Pragati","Singh")
printwoag("Pragati","Singh")
printone("Boom!")
printn... | true |
8ba2d4e8a7bbf8059a716fb922bed68f8d8a68ea | jlubo/memory-consolidation-stc | /analysis/averageWeights.py | UTF-8 | 3,447 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | ######################################################
### Averages early- and late-phase weight matrices ###
######################################################
### Copyright 2019-2022 Jannik Luboeinski
### licensed under Apache-2.0 (http://www.apache.org/licenses/LICENSE-2.0)
### Contact: jannik.lubo[at]gmx.de
i... | true |
2c9377897839ce13a2ae78c55f6e3433753e2d4c | piotrsobecki/PCa-CNNs | /src/cnn/network_input_provider.py | UTF-8 | 2,675 | 2.53125 | 3 | [
"MIT"
] | permissive | from prostatex.dataset import DataSet
from prostatex.batch import get_xy
from constants import Constants, NetStructure, Variables
from cnn.network_input import NetworkInput
import pickle
from prostatex.data_augmentation import augment_data, crop_data
class NetworkInputProvider:
data_dir = str
data = None
... | true |
7f3c36e80e0e198fe7394be2201086722c5219d3 | bainco/bainco.github.io | /course-files/lectures/lecture24-old/05_files_from_the_internet/03_data_file.py | UTF-8 | 579 | 2.953125 | 3 | [] | permissive | import utilities
import ssl # for https requests
from urllib.request import urlopen
# 1. get it from the internet
context = ssl._create_unverified_context()
response = urlopen('https://www.apitutor.org/twitter/1.1/search/tweets.json?q=cats', context=context)
file_data = response.read().decode('utf-8', 'ignore')
# 2.... | true |
7dbb594435321020719050551952a414d39401a3 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_155/2717.py | UTF-8 | 315 | 2.984375 | 3 | [] | no_license | t=int(raw_input())
i=0
while i!=t:
i=i+1
count=0
sh, sm=raw_input().split()
a=int(sh)
b=0
for j in range (0,a+1):
b=b+int(sm[j])
#print(b)
while b<=j:
count=count+1
b=b+1
j=j+1;
print("case#"+i+":"+count)
| true |
3eb6770871c5489bee9db9722b83b4df2b7bdef6 | webclinic017/AlgoSim | /algosim/statistics/quintiles.py | UTF-8 | 7,987 | 2.890625 | 3 | [] | no_license | # encoding: utf-8
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
def scale_one(x):
#归一化处理
x[np.isinf(x)] = np.nan
res = (x.T / (np.nansum(np.abs(x), axis=1) + 1e-20)).T
return res
def cal_net_alpha_pnl(commission, alpha, alpha_pnl):
commission = 0
alpha[np.is... | true |
e28b43c2683f272382d506f282a30ecd848f82ee | sikaiyin/Python-Project | /proj3/catmouse.py | UTF-8 | 1,126 | 2.53125 | 3 | [] | no_license | import argparse
from tkinter import *
from libs.Arena import Arena
from Cat import Cat
from Mouse import Mouse
from Statue import Statue
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Project 3: Turtle Behavior')
parser.add_argument('--no-gui', action='store_true')
args = parse... | true |
75b328e253eb856f78dc486c6febb831248b25f9 | Tempah28/python-tdlib | /py_tdlib/constructors/deep_link_info.py | UTF-8 | 590 | 2.640625 | 3 | [
"MIT"
] | permissive | from ..factory import Method, Type
class deepLinkInfo(Type):
# information about a tg:// deep link @text Text to
# shown to the user @need_update_application True, if user should
# asked to update the application
text = None # type: "formattedText"
need_update_application = None # type: "Boo... | true |
23cef4598154c08b51548962e132446b67f236c5 | nadiyade/hw | /Tasks_week02/fizz-buzz_v1.py | UTF-8 | 1,922 | 4.15625 | 4 | [] | no_license | #Задача fizz-buzz:
#У вас есть три числа, они вводятся из консоли. Первое число называется fizz, второе называется buzz. До третьего необходимо досчитать от единицы. Считая, надо выводить число. Если число кратно fizz - надо выводить F вместо числа. Если число кратно buzz - надо выводить B вместо числа. Если число крат... | true |
7966b212ae33e2f5e0ab93d5837e94ba099c9583 | basdijkstra/python-for-testers | /ui_tests/exercises/exercises_03.py | UTF-8 | 2,166 | 3.078125 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
import pytest
import time
@pytest.fixture
def browser():
driver = web... | true |
cd77f92a5c2817332379e53da4eda67c1def9311 | doubiiot/Text-Extraction-System-of-Business-Information-Pictures-in-Online-Stores | /Main/workspace/train/clear_water_mark.py | UTF-8 | 1,829 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import cv2
import numpy as np
def clear_water_mark_alpha(src, value, show):
#图片不存在
if not src.data:
print("Picture is not exist!\n")
return -1
#图片通道数不为4,无法采用此方式进行水印处理
if src.shape[2] != 4:
print("This picture's alpha channel is not exist, please try an... | true |
520619d7bc111f5cfbd34b9ac640f94825ae2bf0 | avacaflores/opendataportal | /scripts/open_unicef_org_python/lib/donor_categories.py | UTF-8 | 836 | 2.65625 | 3 | [] | no_license | import csv
import difflib
import os
import names
def load(filename):
donor_categories = {}
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)),'..',filename), 'rU') as f:
reader = csv.DictReader(f)
for row in reader:
donor_name = row['DONOR_NAME'].strip()
donor_name = names.alias(donor_name)
... | true |
af8e0dd624675105cfdbda93cca79c4069f3e91c | moiw/ert | /devel/python/test/tvector_test.py | UTF-8 | 4,909 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# Copyright (C) 2011 Statoil ASA, Norway.
#
# The file 'tvector_test.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Founda... | true |
a4d55ebd9e031164dcb709ea05c5cad8448f8ed3 | xocoderxo/lpthw | /ex/ex5.py | UTF-8 | 615 | 3.203125 | 3 | [] | no_license | my_name = 'xo_coder_xo'
my_age = 22
my_height = 83 # inches
my_weight = 192 # lbs
my_eyes = 'Brown'
my_teeth = 'white'
my_hair = 'Black'
print "let's talk about %s" % my_name
print "She is %d inches tall" % my_height
print "She's %d punds heavy" % my_weight
print "Actually thats not too heavy ^___^"
print "She's g... | true |
542a85f36413e42ae6075bd6045382a795a2ca97 | avats101/Fraud-Detection | /main.py | UTF-8 | 1,676 | 3.1875 | 3 | [] | no_license | import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
from sklearn import linear_model #Importing Linear model from sklearn library
from sklearn.model_selection import train_test_split #Importng train_test_split to split the data for training and testing.
from sklear... | true |
203d5d8922053921e5127b08a22c0b59ae9f97d2 | alex75311/parser_GB | /parser.py | UTF-8 | 5,770 | 2.90625 | 3 | [] | no_license | ######################################################################################################
# В файле config.py должны быть строки
# email = 'your_email'
# password = 'your_password'
# либо удалить строку from config import email, password
# и вставить строки с email и password в код программы
#
# Для скачив... | true |
a9a3c296a327fc33c781c4ba2335c2d3afb38aa4 | adludlow/taxcalc | /taxcalc_cli.py | UTF-8 | 4,364 | 2.734375 | 3 | [] | no_license | import cmd2 as cmd
import taxcalc
from dataTypes import Transaction, Account
from tabulate import tabulate
class TransactionTypeSelector(cmd.Cmd):
def __init__(self, txnTypes, txn):
super(TransactionTypeSelector, self).__init__()
self.txnTypes = txnTypes
self.txn = txn
self.txnTypeL... | true |
4206f14c2b31537ac8b6c3cd9f30f64281a31d90 | berkando/frecog | /frecog/image_handler.py | UTF-8 | 2,000 | 2.5625 | 3 | [] | no_license | import pickle
from operator import itemgetter
import cv2
import numpy as np
import openface
import os
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.svm import SVC
from constants import predictor_model, network_model
image_dim = 96
net = openface.TorchNeuralNet(network_model, imgDim=... | true |
fa68cb3f39e35e0adec82cfe0e7d790c0eee74bb | chb50/Snake-Game | /SnakeGame.py | UTF-8 | 20,866 | 3.125 | 3 | [] | no_license | ### THIS IS THE MAIN FILE, THE GAME SHOULD BE RAN FROM HERE ###
### VERSION 1.0 --- WRITTEN BY CEDRIC BLAKE ###
import sqlite3
import pygame
import random
from SnakeGameProperties import *
from SnakeGameFunctions import *
from SnakeGameClasses import *
pygame.init()
pygame.display.set_caption('Snake Mania')
... | true |
e6a20df35989103f20b77ffe420f6127f75eabb7 | ikuklos/home_work | /task_10_2.py | UTF-8 | 1,774 | 3.8125 | 4 | [] | no_license | # Реализовать проект расчёта суммарного расхода ткани на производство одежды.
# Основная сущность (класс) этого проекта — одежда, которая может иметь определённое название.
# К типам одежды в этом проекте относятся пальто и костюм.
# У этих типов одежды существуют параметры: размер (для пальто) и рост (для костюма).
# ... | true |
12e550f4b3d19912bfea28c5003cd87db2c98e10 | sargilad/PythonProject | /venv/Scripts/johnbryce/webdriver/from_yair/webdriver_test.py | UTF-8 | 2,179 | 2.640625 | 3 | [] | no_license | import time
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from my_wrapper import SeleniumWrapper
search_term = "נמייה"
driver = webdriver.Chrome()
driver.get("http:\\www.google.com")
wrapper = SeleniumWrapper(driver)
input_box... | true |
06afb293d8695125c5c5e1c3042dc463da2cc165 | bookla-foundation/meerkat | /src/meerkat/data_providers/database/mongo/transformers.py | UTF-8 | 737 | 2.796875 | 3 | [] | no_license | from meerkat.data_providers.database.mongo.documents import PostDocument
from meerkat.domain.common.value_objects import Body, Id, Title
from meerkat.domain.post.entities import Post
class PostDocumentTransformer:
def transform_to_document(self, post: Post) -> PostDocument:
return PostDocument(
... | true |
02919eafe53fdf79c31bf32da78b00f116549b2a | thatz98/hangman | /get_word.py | UTF-8 | 172 | 3.171875 | 3 | [] | no_license | import random
def get_word(word_list):
word = random.choice(word_list)
while '-' in word or ' ' in word:
word = random.choice(word_list)
return word
| true |
61104dd18a66c0144a8b1eb6ff0fbda3b30592dc | ectrimble20/PythonExerciseCode | /PracticePython/ListEnds.py | UTF-8 | 607 | 4.5625 | 5 | [] | no_license | # ListEnds.py
"""
Write a program that takes a list of numbers (for example, a = [5, 10, 15, 20, 25]) and makes a new list of
only the first and last elements of the given list. For practice, write this code inside a function.
Could use the deque from collections to get popleft() which would do the [0] index for us
""... | true |
bac5c70a9f2ff1191dac3348e8f1f49bdcf84b33 | seoyeonhwng/algorithm | /BJ/1738.py | UTF-8 | 1,297 | 2.953125 | 3 | [] | no_license | import sys
from collections import deque, defaultdict
input = sys.stdin.readline
def check(start):
stack = [start]
visited = [False] * (N+1)
visited[start] = True
while stack:
node = stack.pop()
if node == N:
return True
for w, _ in graph[node]:
if not ... | true |
51f263aaaa714318f60ed5064596947f94ab5d07 | Fr4nc3/code-hints | /python/structures/sample3/ClassClass.py | UTF-8 | 4,504 | 4.28125 | 4 | [] | no_license | '''
Name: class_class.py
template class
'''
class Parent(object):
'''I am a parent class. Not very exciting but useful to show
basic inheritence
'''
def __init__(self, Mother='Anne', Father='Andy', Value=5):
'''Setting the default values when the class is instantiated'''
self.greetin... | true |
081db48408f4c9f517f3c6d45a3d8a46088a2c3a | julia2669/API_fram1 | /apiFrame/utils/operationYaml.py | UTF-8 | 424 | 2.53125 | 3 | [] | no_license | import yaml
from common.public import filePath
class OperationYaml:
def readYaml(self):
with open(filePath(),'r',encoding='utf-8') as f:
return list(yaml.safe_load_all(f))
def dictYaml(self,fileDir='config',fileName='book.yaml'):
with open(filePath(fileDir=fileDir,fileName=fileName),'r',encoding='utf-8') a... | true |
1fab67acc3de4b78f1883da99e71fe564f7f6fed | smartao/estudos_python | /03_estrutura_controle/05_for_v4_break.py | UTF-8 | 1,461 | 3.921875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/python3
from random import randint
'''
Nesse exemplo sera usando o laço for junto com a break + else
No Exemplo a baixo o Break server para nao executar a estrutura else do laco
Em python é permitido declarar o else sem estar diretanete liagado ao if
'''
print('\nExemplo simples de for + break + else')
for... | true |
625ce29f97e6098cef1a7e3ebf7302abee4232b4 | schwab/hadoop-log-insight | /count_reducer.py | UTF-8 | 487 | 3.0625 | 3 | [] | no_license | #!/usr/bin/python
import sys
dtcount = {}
def create_key(vals):
key = str(vals[0]) + ',' + str(vals[1]) + ',' + str(vals[2]) + ',' + str(vals[3])
return key
print "year,month,day,hour,messages"
for line in sys.stdin:
try:
s = line.split(',')
key =create_key(s)
if key in dtcount:
... | true |
fab883ef4d293b3553c7357ebd0b462bbccdbcf2 | sivajipr/python-course | /days/3/applications/rpi/blink.py | UTF-8 | 263 | 2.859375 | 3 | [] | no_license | #P1.6 is GND
#P1.8 is OUTPUT
#Blink LED on P1.8
import RPi.GPIO as gpio
import time
gpio.setmode(gpio.BOARD)
gpio.setup(8, gpio.OUT)
while True:
gpio.output(8, gpio.HIGH)
time.sleep(.1)
gpio.output(8, gpio.LOW)
time.sleep(.1)
| true |
af556bad8424727fafb89783e8bccfe79055cad9 | taketakeyyy/atcoder | /abc/141/b.py | UTF-8 | 499 | 3.203125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import sys
def solve():
S = input()
for i in range(len(S)):
if (i+1)%2 == 0:
# 偶数
if S[i] in ("L", "U", "D"):
continue
else:
print("No")
return
else:
# 奇数
if S[i] i... | true |
84541183d8997e6d5607ba4757d9d9b92fb4e30f | Vardominator/bioinformatics-training | /coursera/ucsd_bioinformatics_algorithms/1_hidden_messages/2_replication_origin_part_2/frequent_words.py | UTF-8 | 2,388 | 3.25 | 3 | [] | no_license | def HammingDistance(p, q):
return len([i for i in range(len(p)) if p[i] != q[i]])
# Generate the reverse complements of "possible kmers"
nucs = { 'A' : 'T', 'C' : 'G', 'G' : 'C', 'T' : 'A'}
RCDict = {}
RCList = []
def RevComplement(kmerList):
for kmer in kmerList:
c = ''
for letter in kmer:
... | true |
0f1a1cd9ae612d221afa5c984bbf80d36a0bb497 | eklockare/chess-experiment | /tests/test_check_mate.py | UTF-8 | 3,565 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import unittest
from board_parts import ChessCoord, black, white
from directions import go_south
from move_inspect_result import MoveInspectResult
from pieces.bishop import Bishop
from pieces.king import King
from pieces.knight import Knight
from pieces.pawn import Pawn
from pieces.queen import... | true |
c8ab57bdceb1d6fe0e189d3601982a59d97c0b25 | Dis-count/Python_practice | /Machine_Learning/MachineLearning_Zhouzhihua_ProblemSets-master/ch10--降维与度量学习/10.6-PCA.py | UTF-8 | 2,127 | 3.453125 | 3 | [] | no_license | import scipy.io as scio
import numpy as np
import matplotlib.pyplot as plt
class PCA(object):
def __init__(self, n_components):
self.n_components = n_components
def fit(self, X):
self.x_mean = np.mean(X, axis=0)
self.x_std = np.std(X, axis=0)
X = (X - self.x_mean) / self.x... | true |
a4d0decb76958450d001cb0d58efa347b3d429ba | dpm76/eaglebone | /drone/flight/driving/sysfs_writer.py | UTF-8 | 654 | 3.203125 | 3 | [
"ISC"
] | permissive | # -*- coding: utf-8 -*-
'''
Created on 06/04/2015
@author: david
'''
from os import system
class SysfsWriter(object):
@staticmethod
def writeOnce(text, path):
'''
writer = SysfsWriter(path)
writer.write(text)
writer.close()
'''
system("echo {0} > {1}".for... | true |
f0697e4fe32209a1629990cdc77e1019d3c9b727 | Nyapy/TIL | /04_algorithm/백준/1525퍼즐.py | UTF-8 | 1,142 | 3.09375 | 3 | [] | no_license | import sys
sys.stdin = open("1525.txt")
from collections import deque
board = []
for i in range(3):
tem = input().split()
board += tem
visited = dict()
visited[str(board)] = 1
for i in range(len(board)):
if board[i] =="0":
zero = i
a = [[1,3],[0,4,2],[1,5],[0,4,6],[1,3,5,7],[2,4,8],[3,7],[4,6,8... | true |
0387788405d030c10dfb640eb75ffb6fff5b172b | rodrigobn/Python | /Lista de exercício 4 (laços)/ex22.py | UTF-8 | 833 | 4.15625 | 4 | [] | no_license | """
22 - Faça um programa que peça para n pessoas a sua idade, ao final o programa devera verificar se a média de idade da turma varia entre 0 e 25,26 e 60 e maior que 60; e então, dizer se a turma é jovem, adulta ou idosa, conforme a média calculada.
"""
n = int(input("Digite a quantidade de pessoas: "))
idade0a25 =... | true |
931cfbf117ba31f03cd3190d509ce9add488f427 | vasyllyashkevych/Python-TCP-Image | /server.py | UTF-8 | 1,374 | 3 | 3 | [
"MIT"
] | permissive | import numpy as np
import cv2
import socket
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Bind the socket to the port
server_address = ('0.0.0.0', 7777)
print('starting up on %s port %s' % server_address)
sock.bind(server_address)
# Listen for incoming connections... | true |
d5168cedb8c01d94a09935c4be72a01ebcbb97d0 | alzheimeer/holbertonschool-higher_level_programming | /0x0B-python-input_output/read_write_heap.py | UTF-8 | 1,887 | 3.390625 | 3 | [] | no_license | #!/usr/bin/python3
"""Finds & overwrites a string in a process' mem file"""
from sys import argv
USAGE = "USAGE: read_write_heap.py pid search_string replace_string"
def search_in_maps(pid):
"""search in maps file"""
ini = final = None
try:
with open("/proc/{:d}/maps".format(pid), "r") as maps:
... | true |
353295ead4eef0e865f74c0103095abe3e5fbf3c | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_2_neat/16_0_2_theWingThing_bPancakes.py | UTF-8 | 342 | 3.34375 | 3 | [] | no_license | def main():
T = int(raw_input())
for t in xrange(T):
count = 0
S = raw_input()
flipAt = "-"
for x in S[::-1]:
if (x == flipAt):
count += 1
if (flipAt == "-"):
flipAt = "+"
else:
flipAt = "-"
print "Case #{}: {}".format(t+1, count)
if __name__ ==... | true |
da8519ae1687915fa0a67a2af2140e13246b1f64 | JoaoPauloLeal/toolbox | /bth/interacao_cloud.py | UTF-8 | 51,999 | 2.578125 | 3 | [] | no_license | import requests
import json
import re
import getpass
import settings
import math
import time
import sys
import logging
from tqdm import tqdm
from time import sleep
from datetime import datetime
def verifica_token(token):
r = {"expired": True}
print(f'\n:: Iniciando validação do token {token}')
try:
... | true |
184fcc6cf1a0f8a6a2e648371373fc475d4137d9 | frapa/saga | /setup_website.py | UTF-8 | 669 | 2.90625 | 3 | [] | no_license | import sys
import os
if __name__ == "__main__":
host = input("ftp host: ")
nickname = input("nickname: ")
password = input("password (will be stored as plain txt): ")
root = input("root folder (on the ftp host): ")
path = os.getcwd()
with open(os.path.join(path, "settings.txt"), "w") as outfile:
outfile.wr... | true |
3df0bbd84551abcf8dd442bd46d5e66e2a0fcb25 | Aasthaengg/IBMdataset | /Python_codes/p02271/s752834762.py | UTF-8 | 454 | 2.90625 | 3 | [] | no_license | def subset_sum(n, s, a):
dp = [[0 for x in range(s+1)] for x in range(n+1)]
for i in range(n):
v = a[i]
for j in range(s+1):
if v==j or (v<j and dp[i][j-v]>0):
dp[i+1][j] = dp[i][j] + 1
else:
dp[i+1][j] = dp[i][j]
return dp[n][s] > 0
n = int(input())
a = list(map(int, input().split()))
q = int(inp... | true |
b91acd6e0b562a8cde7dd3767a62f562e4b050b3 | CosmoStat/lenspack | /lenspack/geometry/projections/gnom.py | UTF-8 | 4,468 | 3.40625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import numpy as np
def radec2xy(ra0, dec0, ra, dec):
"""Project spherical sky coordinates to a tangent plane.
Parameters
----------
ra0 : float
Right ascension of the projection origin.
dec0 : float
Declination of the projection origin.
ra : float or a... | true |
ef6292f0fdeb955da03212c58a73afda05363e51 | MadInc63/8_vk_friends_online | /vk_friends_online.py | UTF-8 | 901 | 2.875 | 3 | [] | no_license | import vk
import getpass
APP_ID = 6274359
def get_user_login():
login_vk = input('Type login VK: ')
return login_vk
def get_user_password():
password_vk = getpass.getpass('Type your password: ')
return password_vk
def get_online_friends(account_login, account_password):
session = vk.AuthSessi... | true |
3900b858de778154f5d582c67f7a3b37d0e22b35 | jhoetter/onetask-python | /onetask/exceptions.py | UTF-8 | 2,182 | 2.96875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from typing import Optional
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses
class OneTaskError(Exception):
"""
Base Entity for onetask errors.
"""
def __init__(self, message: Optional[str] = None):
if message is None:
messa... | true |
f34a367db7d0e69171766e674685bb008b2e24c1 | knowark/tenark | /tests/cataloguer/test_json_cataloguer.py | UTF-8 | 4,183 | 2.6875 | 3 | [
"MIT"
] | permissive | import json
from pathlib import Path
from pytest import fixture, raises
from tenark.common import (
QueryParser, TenantRetrievalError)
from tenark.models import Tenant
from tenark.cataloguer import JsonCataloguer
@fixture
def cataloguer(tmp_path) -> JsonCataloguer:
path = str(tmp_path / 'tenants.json')
pa... | true |
515a9d7945761f53574b839bc8e964fdb70ba275 | sankeerth/Practice | /leet_code/reconstruct_itinerary.py | UTF-8 | 536 | 3.453125 | 3 | [] | no_license | from collections import defaultdict
def findItinerary(tickets):
for a, b in sorted(tickets)[::-1]:
targets[a] += b,
print(sorted(tickets)[::-1])
#targets['JFK'].sort()
print(targets)
visit('JFK')
return route[::-1]
def visit(airport):
while targets[airport]:
visit(targets... | true |