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 |
|---|---|---|---|---|---|---|---|---|---|---|
fbd2c643498573f71bd7478548634d1d44e57522 | lyletang/MonitoringLED | /slave/on.py | UTF-8 | 395 | 2.8125 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
RED = 33
GREEN = 35
BLUE = 37
GPIO.cleanup()
GPIO.setmode(GPIO.BOARD)
GPIO.setup(RED, GPIO.OUT)
GPIO.setup(GREEN, GPIO.OUT)
GPIO.setup(BLUE, GPIO.OUT)
GPIO.output(BLUE,GPIO.HIGH)
GPIO.output(RED,GPIO.HIGH)
p = GPIO.PWM(GREEN,100)
p.start(100)
a = range(0,101,4)
a += range(96,0,-4... | true |
7c7956cb1b5d10da709897d31b77527bbd3b962d | jkuck/low_density_parity_checks | /SAT_solver_speed.py | UTF-8 | 14,673 | 2.90625 | 3 | [] | no_license | #Code for checking SAT solver speed when using various
#low density parity check matrix constructions
#import subprocess
import commands
import numpy as np
import copy
from decimal import Decimal
from itertools import combinations
import operator as op
import time
import matplotlib
matplotlib.use('Agg') #prevent erro... | true |
87b7c0f53e0f9c04e877ff770ea446774e1eea46 | Elki007/MMaR | /Project2_06_Game/Classes/Vector.py | UTF-8 | 3,593 | 3.625 | 4 | [] | no_license | import math
import numpy as np
class Vector:
def __init__(self, x, y, z=0):
self.x = x
self.y = y
self.z = z
def make_vector(self,a,b):
return Vector(b[0]-a[0],b[1]-a[1],0)
def __str__(self):
return "<" + str(self.x) + " " + str(self.y) + ">" # " " + str(self.z)... | true |
4f9956d8b3046353ac30b3fcd318b7f83e4f83c1 | amathebest/DSP | /chiave_pubblica/common_modulus_failure.py | UTF-8 | 1,138 | 2.859375 | 3 | [] | no_license | import extended_euclid as eu
import quick_exp as qe
from decimal import Decimal
# values given by the excercise
n = 12008675891384028368330116279226488438653987583561192432375289921926611958833566328973455887193049344385342053547879188978348615770853447623271439562209117212615284442000916122037997098345949977750679178... | true |
e6747f1d84d89c40c536a558ac3bf614714347da | SapirAlmog/employee-management-system | /add_employee_manually.py | UTF-8 | 888 | 3.65625 | 4 | [] | no_license | import pandas as pd
"""
This function gets employee's information (ID, Name, Phone number, Age) as an input from the user, and saves it into
pandas data frame
"""
def addemployee():
input_id = input("Enter employee's ID :")
if input_id.isdigit():
print("User ID is Number ")
else:
print("... | true |
a106179e447270f0503c1c67fddbd791ed94eefb | yutarochan/DTSF-Benchmarks | /src/utils/logger.py | UTF-8 | 744 | 3.09375 | 3 | [] | no_license | '''
Logger Utility Function
Author: Yuya Jeremy Ong (yuyajeremyong@gmail.com)
'''
from __future__ import print_function
'''
TODO:
- Export logger function to better infrastructure support with monolog.
- Use an external logger service similar to weights and biases.
'''
class Logger:
def __init__(self, root_dir, h... | true |
0dfdc03180169dd02e752eeaf20b22d496bcf834 | OleksiiTarasikov/PYTHON | /python-igra-morskoy-boy/main_lesson_1.py | UTF-8 | 1,574 | 2.78125 | 3 | [] | no_license | # импорт модулей
from tkinter import *
from tkinter import messagebox
import time
# создадим рабочую область
tk = Tk()
# создадим переменную для сообщения что наше приложение все еще работает, будет иметь "булевское" значение
app_runing = True
# окно приложения сделаем фиксированными, это будкм определять через пер... | true |
6a72544cd2e7ac69e5b9aa3f6287951ef3bea8eb | alexisflores99/Repo-for-Python | /oprelacionales.py | UTF-8 | 344 | 4.125 | 4 | [] | no_license | #Operador ==
# c = 5 ==5
# print(c)
# c = "Marcos" == "Marcos"
# print(c)
#Operador diferente que !=
# a = 5 != 3
# a = "Pepe" != "Pepe"
# print(a)
#Operador menor que <
# b=5<3
# print(b)
#Operador mayor que >
# b = 5>3
# print(b)
#Operador menor igual que <=
# b = 20<=10
# print(b)
#Operador mayor que >=
# b =... | true |
d9689088d7024cba3a37def3273bedd0e84111f9 | zixuanhe/ycsb-clone | /munin/cassandra_number_of_keys | UTF-8 | 1,162 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import sys
from subprocess import Popen
from subprocess import PIPE
def listCFkeys():
for line in Popen(['/opt/cassandra/bin/nodetool', 'cfstats'], stdout=PIPE).stdout:
line = line.strip()
try:
if line.startswith('Keyspace:'):
keyspace = line.split... | true |
353068b4a6fd82f90ea534f41db200385cf1de45 | plotly/dash | /tests/unit/development/test_component_loader.py | UTF-8 | 5,398 | 2.578125 | 3 | [
"MIT"
] | permissive | import collections
import json
import os
import shutil
import pytest
from dash.development._py_components_generation import generate_class
from dash.development.base_component import Component
from dash.development.component_loader import load_components, generate_classes
METADATA_PATH = "metadata.json"
METADATA_ST... | true |
081b6202df0cee8ce72dfb8150bf35e8802d3ad1 | haowen-xu/tfsnippet | /tfsnippet/examples/utils/jsonutils.py | UTF-8 | 5,598 | 3 | 3 | [
"MIT"
] | permissive | import json
from base64 import b64encode, b64decode
from datetime import datetime
import numpy as np
import six
__all__ = [
'JsonBinary', 'JsonEncoder', 'JsonDecoder',
]
class JsonBinary(object):
"""
Wrapper class for binary objects.
In Python2, ordinary strings are binary strings, thus we cannot e... | true |
d121bf079e21bb3572451d80d62d4a0be0a819dd | LiuyangJLU/Dementia | /RFE_1030_MultiClass.py | UTF-8 | 5,624 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 29 08:52:43 2017
Python3
Required Packages
--pandas
--numpy
--sklearn
--scipy
Info
-name :"liuyang"
-email :'1410455465@qq.com'
-date :2017-10-29
-Description
Q_AD_DLB_VD_after_normalizion_0_to_三分类问题
利用递归特征消除法,
@author: ly
"""
import numpy as np
import pandas as pd
... | true |
f63a510d5682a73a4bb2b57f8273a413209cdc70 | xiuyanw/python | /hash_func.py | UTF-8 | 328 | 2.84375 | 3 | [] | no_license | import hashlib
import sys
def hash_fname(fname):
m=hashlib.md5()
with open(fname,'rb') as src_fobj:
while True:
data=src_fobj.read(4096)
if not data:
break
m.update(data)
return m.hexdigest()
if __name__ == '__main__':
print(hash_fname(sys.a... | true |
451e25002cb1a0856ac1efafd5b44d1b7d9f5045 | catboost/catboost | /contrib/python/matplotlib/py3/matplotlib/projections/__init__.py | UTF-8 | 3,998 | 3.171875 | 3 | [
"Apache-2.0",
"CC0-1.0",
"BSD-3-Clause",
"MIT",
"Bitstream-Charter",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-bakoma-fonts-1995",
"LicenseRef-scancode-unknown-license-reference",
"OFL-1.1"
] | permissive | """
Non-separable transforms that map from data space to screen space.
Projections are defined as `~.axes.Axes` subclasses. They include the
following elements:
- A transformation from data coordinates into display coordinates.
- An inverse of that transformation. This is used, for example, to convert
mouse posi... | true |
ed160eee8089fbd247a6f2d5835b21c93b1b0910 | seoul-ssafy-class-2-studyclub/Algorithms-Tess | /SWexpertacademy/D4/4366_정식이의은행업무_2진수.py | UTF-8 | 1,782 | 3.546875 | 4 | [] | no_license | # 2진수와 3진수의 한 자리를 값을 바꿔주는 것
# 바꾼 2진수와 3진수를 10진수의 값으로 변환
# 이 두 개의 값을 비교해서 같은지를 비교
#(1) 2진수와 3자리수의 값들을 for문을 통해서 숫자 한자리씩 변경해주고,
# 그것을 (2) 10진수 값들로 변환한후 각각의 다른 배열에 저장합니다.
# (3)최종적으로 서로 비교해주면 됩니다.
import sys
sys.stdin = open('4366.txt', 'r')
T = int(input())
for tc in range(1, T+1):
bi_num = input()
tri_num =... | true |
d680d9e17be57e1c3695eaf18121fccb56bf3b54 | MarcosMorales2011/Startup-Prediction-App | /tabs/intro.py | UTF-8 | 1,578 | 3.40625 | 3 | [
"MIT"
] | permissive | from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
from app import app
colors = {
'background': '#111111',
'text': '#7FDBFF'
}
layout = dcc.Markdown("""
## Startup Prediction
What causes a startup to succeed or fail? Startups, or new established... | true |
7236e3f971ed0f2bba0afd8c9621cdcb5ea3fdb8 | dominoeffect/PythonBasics | /(P1+P2)cn-python-foundation-master/investigate texts and calls/ZH/Task0.py | UTF-8 | 1,079 | 3.953125 | 4 | [] | no_license | #coding:utf-8
"""
下面的文件将会从csv文件中读取读取短信与电话记录,
你将在以后的课程中了解更多有关读取文件的知识。
"""
import csv
with open('texts.csv', 'r') as f:
reader = csv.reader(f)
texts = list(reader)
with open('calls.csv', 'r') as f:
reader = csv.reader(f)
calls = list(reader)
def first_re():
list_one = texts[1]
massage_o... | true |
5f918ff477466b080ab6afe586466a9a736ef9aa | apache/airflow | /airflow/providers/amazon/aws/hooks/ec2.py | UTF-8 | 7,928 | 2.546875 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | permissive | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | true |
a00c8a8a01ea2cac86acbf3492250a3e1711f41f | Chang-Chia-Chi/Machine-Learning-Foundations-Techniques | /Assignment-7/HW7_Q13toQ20.py | UTF-8 | 8,800 | 3.375 | 3 | [] | no_license | import time
import numpy as np
class Node:
"""
Node for decision tree.
param:
hypo: hypothesis of branch if it's a root of a sub-tree
value: return value if it's a leaf node
left: left sub-tree
right: right sub-tree
"""
def __init__(self, hypo, value=None, left=None, right=None):
... | true |
afd0448a017cd8aafcf20313381638b067b7d8f6 | Greycampus/python | /datatypes/type1.py | UTF-8 | 377 | 4.21875 | 4 | [] | no_license | '''
Python program to print of data inputed by user
Input
1
Output
the type of data you entered is:<type 'int'>
'''
#taking data from user
#use python3
#if you are using the python 2.x string variables gives error enter string in quotes for python 2.x
k = input('enter the data:')
#printing type using the type functio... | true |
f523ad4d385c2406824c38635f4218f92cd1d978 | taehwan920/Algorithm | /baekjoon/5032_soda.py | UTF-8 | 532 | 3.359375 | 3 | [] | no_license | e, f, c = map(int, input().split())
def new_bot(e, f):
new = (e + f) // c
empty = (e + f) % c
if new + empty < c:
return new
else:
return new + new_bot(new, empty)
print(new_bot(e, f))
# 처음에 생각없이 가진 병, 주운 병을 더해 필요한 병의 몫으로 했더니 틀렸었음.
# 빈병을 모아서 바꿔서 새로 받은 병을 다 마시고 생긴 빈병과 방금 전에 바꾸고 남은 빈병... | true |
fc3ce6dcea619cff98af5e212911ea228a3e9202 | torstenfeld/coderbyte | /medium-palindromeTwo.py | UTF-8 | 380 | 3.5625 | 4 | [] | no_license |
import re
def PalindromeTwo(sen):
sen = re.sub(r'\W+', '', sen)
sen = sen.lower()
strList = list(sen)
strListReversed = strList
strListReversed.reverse()
strReversed = ''.join(strListReversed)
if strReversed == sen:
return 'true'
else:
return 'false'
#sen = "Noel - s... | true |
99e2aabed9bbc58d6231e14aac8bec03b42b0c6f | saumyarshah9697/Machine-Learning | /HAMSPAM/CreateStopWords.py | UTF-8 | 1,909 | 2.890625 | 3 | [] | no_license | # coding= utf-8
from nltk.tokenize import sent_tokenize, word_tokenize
import re
from tqdm import tqdm
from nltk.stem import PorterStemmer
ps=PorterStemmer()
data="HamSpamData.txt"
''' Input:[...........,sents1,sents2,sents3,.........]
Output:[.......[0,[sentdata]],.........[1,[sentdata]].......]
'''
def Prepro... | true |
4cbd0b8c5b9a5dc217d1993d39c5da4f248cf571 | zhxjnkjbh/imgDetecter | /test.py | UTF-8 | 235 | 3.359375 | 3 | [] | no_license | import os
class A:
def __init__(self, x = 0, y = 0):
self.x = x
self.y = y
class B:
def __init__(self):
pass
def get(self):
self.a = A(1,3)
return self.a
a = A(1, 2)
print(a.x, a.y)
b = B()
a = b.get()
print(a.x, a.y) | true |
c9238d4b95cffda283ccf3d06538efa77adaebc8 | CodewitheEtash/codes | /main.py | UTF-8 | 140 | 3.328125 | 3 | [] | no_license | print ("what is the temprature ")
temprature = 60
if temprature > 90:
print ("it is to hot for me ")
else:
print ("its not very hot ")
| true |
cb26b10164f786845f767b1337ea45c8131b9ba9 | winterfellding/mit-cs-ocw | /6.006/lec7.py | UTF-8 | 731 | 3.484375 | 3 | [] | no_license | def counting_sort(ary):
max_num = max(ary)
nums = [0] * (max_num + 1)
for i in ary:
nums[i] += 1
result = []
for i in range(len(nums)):
if nums[i] > 0:
for j in range(nums[i]):
result.append(i)
return result
# print(counting_sort([3, 4, 1, 1, 2, 3, 4,... | true |
e4d8ffa8313ca84eb6835be01a269b52317752c5 | rluethy/ToolBelt | /Scripts/chalk.py | UTF-8 | 7,527 | 2.6875 | 3 | [] | no_license | #!python
__version__ = "Feb. 2013"
import fnmatch
import os
import datetime
import xml.etree.ElementTree as xmlDoc
from xml.dom import minidom
import re
class ChalkTool:
def ProcessCommandLine(self):
import optparse
parser = optparse.OptionParser()
parser.set_description("Creates and in... | true |
e009658d2816c91a4ec615b009fea6116c7a9b3f | jdanray/leetcode | /maxScore2.py | UTF-8 | 254 | 3.1875 | 3 | [] | no_license | # https://leetcode.com/problems/rearrange-array-to-maximize-prefix-score/
class Solution(object):
def maxScore(self, nums):
nums = sorted(nums, reverse=True)
res = 0
pre = 0
for n in nums:
pre += n
if pre > 0:
res += 1
return res
| true |
52276cc0cfd2377460d3bdb10bbc08ef82a63d77 | dextertechnology/bitbucket_build_webhook | /hash_generator.py | UTF-8 | 421 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import hashlib, binascii
PASSWORD = b"Welc0me t0 the T9em |f y0u can cr@ck th|5 p@$$w0rd"
def encode(password):
dk = hashlib.pbkdf2_hmac('sha256', password, b'salt', 234273)
print("================================================================")
print(binascii.hexlify(dk).decod... | true |
8946c7b6562ab0abc2c3657d90872c0d2eb5dbd8 | tggithub619/Codewars_Python | /6 kyu Prime Primes.py | UTF-8 | 495 | 3.359375 | 3 | [] | no_license | #https://www.codewars.com/kata/57ba58d68dcd97e98c00012b/solutions/python/me/best_practice
def is_prime(n):
if n <= 1 :
return False
for i in range(2,int(n**0.5+1)):
if n % i == 0:
return False
return True
def prime_primes(n):
count = 0
s = 0
arr = [ i for i in ran... | true |
5c508271286cf56c49493d17fa68f1bb0cd2faff | pharaofranz/baseband | /baseband/mark5b/header.py | UTF-8 | 9,547 | 2.6875 | 3 | [] | no_license | """
Definitions for VLBI Mark5B Headers.
Implements a Mark5BHeader class used to store header words, and decode/encode
the information therein.
For the specification, see
http://www.haystack.edu/tech/vlbi/mark5/docs/Mark%205B%20users%20manual.pdf
"""
from __future__ import (absolute_import, division, print_function,
... | true |
4aee30ef812b8d729b58e4cb65e94065e397434d | tomboxfan/PythonExample | /exercise/006/P006Solution1.py | UTF-8 | 266 | 3.09375 | 3 | [] | no_license | i = 0
j = 1
# sep separator
# \n next line 换行符
# (i,j, sep='\n') parameter 参数列表
print(i,j, sep='\n')
for k in range(18):
next = i + j
print(next)
# variable reuse - the difficult part
i = j
j = next | true |
39655498f16d79f1d79635a15aeac449446b00af | kgalloway2/VSC-Code | /python stuff/dataEditor.py | UTF-8 | 291 | 2.84375 | 3 | [] | no_license | import pandas as pd
df = pd.read_csv("PokemonDataCleaned.csv")
def legend(x):
if x in ['\"Legendary\"', '\"Sub-Legendary\"', '\"Mythical\"']:
return x
else:
return '\"Non-Legendary\"'
df['Legendary.Type'] = df['Legendary.Type'].apply(legend)
df.to_csv("test.csv") | true |
0d32082b11f4467e34f0b40f5954ce3ba6bb4208 | mburq/Deep_rl_stochastic_opt | /src/environment/matching.py | UTF-8 | 1,677 | 3.09375 | 3 | [
"MIT"
] | permissive | import numpy as np
from numpy.random import rand, binomial
class simple_matching(object):
"""
Implements a simple dynamic matching environment,
where arrivals and departures are generated stochastically.
"""
def __init__(self,
types,
weight_matrix,
ar... | true |
81d9c135f654d657025e89b3a1e4f8be26b94c8d | dyniol/pythonTesting | /pythontesting/unittest/lecture3 - pytest/fixture/test_file_fixture.py | UTF-8 | 801 | 3.265625 | 3 | [] | no_license | import pytest
import os
@pytest.fixture
def test_file():
print('\nCreating file')
f = open('test_file.txt', 'a+')
return f
def test_write_ten_lines(test_file):
print('\nWriting ten lines')
num_lines_before = sum(1 for line in open(test_file.name))
for i in range(10):
test_file.write(... | true |
dfba093e05773faa750b19bb5612ee5be9fc5d9d | shinys88/challenges-python | /Day_08_Alba_Save_to_csv/main.py | UTF-8 | 1,592 | 2.671875 | 3 | [] | no_license | import os
import csv
import requests
from bs4 import BeautifulSoup
os.system("clear")
alba_url = "http://www.alba.co.kr"
result = requests.get(alba_url)
soup = BeautifulSoup(result.text, "html.parser")
boxs = soup.select("#MainSuperBrand .goodsBox .impact")
brand_list = []
# Main 브랜드 저장
for box in boxs :
anchor... | true |
b03e496345fa9d3164b018c4ad11fb68b1ec8bed | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_76/390.py | UTF-8 | 406 | 3.484375 | 3 | [] | no_license | #! /usr/bin/python
'''
Splitting candy
'''
import operator
T = int(raw_input())
for i in range(T):
C = int(raw_input())
candies = map(int, raw_input().split())
candies = sorted(candies)
answer = reduce(operator.xor, candies, 0)
if answer:
answer = "NO"
else:
answer = reduce(op... | true |
cfe3ffed30797dc448aa39502e7b4c0ce157b568 | DickinsonBP/SDpract1 | /generadorDeArchivos.py | UTF-8 | 372 | 3.046875 | 3 | [] | no_license | import random
palabras = open('listado-general.txt','r')
palabras = list(palabras.readlines())
num_files = 0
while (num_files < 10):
nombre = 'files/f'+str(num_files+1)
f = open(nombre,'w')
for i in range(200):
word = random.choice(palabras)
f.write(word)
f.close()
print('Se ha escr... | true |
181d3deaad82d7230d43df9e44aa1284fd3f25d6 | EdwinHe/Django_Learning | /depot/depotapp/models.py | UTF-8 | 1,594 | 2.65625 | 3 | [] | no_license | from django.db import models
from django.contrib.auth import models as auth_models
# Create your models here.
class Product(models.Model):
title = models.CharField(max_length=100, unique = True)
description = models.TextField()
image_url = models.URLField(max_length=200)
price = models.DecimalField(max... | true |
afd655c375ffedebd45f4891234a1021b86db531 | MasroorHamdani/parking_lot | /main.py | UTF-8 | 1,224 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python3
import sys, os
from command_execute import CommandExecute
command_execute_obj = CommandExecute()
def main():
"""
This function will handle the interaction part
Differentiates if the commands are passed
as a file or manually
"""
try:
file_path = sys.argv[1] if le... | true |
16c0f344a3b6a3c1629adadbce1bf8d069198573 | cuitianfeng/Python | /python3基础/8.Python修炼第八层/网络编程(socket-tcp流式协议-udp数据报协议)/8 粘包现象1-客户端粘包/客户端.py | UTF-8 | 307 | 2.71875 | 3 | [] | no_license | from socket import *
client=socket(AF_INET,SOCK_STREAM)
client.connect(('127.0.0.1',8080))
client.send('hello'.encode('utf-8'))
# import time
# time.sleep(10) # 时间间隔大的包不会粘在一起,不加sleep这俩个数据包是在客户端粘的
client.send('world'.encode('utf-8')) | true |
32b8ac2d5cd8fb14208b92e9e4646511b0dc8809 | delisiu/Python-from-scratch-Udemy | /LAB_93.py | UTF-8 | 1,516 | 3.625 | 4 | [] | no_license | ##Sekcja 7, wykład 93
##
##Dane są następujące napisy:
## string_A = '+---+---+---+---+'
## string_B = '| | | | |'
##1Korzystając z polecenia FOR wyświetl:
## +---+---+---+---+
## +---+---+---+---+
## +---+---+---+---+
## +---+---+---+---+
## +---+---+---+---+
## +---+---+---+... | true |
9a5142ecc3924c36b4f851c51771de06e7f9b3e1 | ghostklart/python_work | /03.07.py | UTF-8 | 1,377 | 2.96875 | 3 | [] | no_license | glist = []
glist.append('sergey')
glist.append('mikhail')
glist.append('dmitriy')
#print(glist)
message = 'Thank you for coming to my dinner,'
nmesg = "will not be coming today!"
print(f"{glist[1].title()} {nmesg}")
glist[1] = 'alexey'
#print(glist)
fmesg = f"{message} {glist[0].title()}!"
print(fmesg)
fmesg = f"{... | true |
286b70ef2f7182b2dd5f980b45287311c5e1dedc | robincvlr/ia-training | /Documents formation Udemy/ann.py | UTF-8 | 5,096 | 3.390625 | 3 | [] | no_license | # Artificial Neural Network
####################################### Data processing
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Churn_Modelling.csv')
X = dataset.iloc[:, 3:13].values
y = dataset.iloc[:, 13].values
# ... | true |
3f9ac776964dc434d3137449bb1d134173462be5 | J-Bentley/SMS-Spammer | /spammer.py | UTF-8 | 602 | 2.546875 | 3 | [] | no_license | from twilio.rest import Client
#Enter account details (see: https://www.twilio.com/console) include areacode
account_sid = "AC...a1"
auth_token = "0a...6d"
twilioNumber = "+12345678910"
client = Client(account_sid, auth_token)
receiver = input("Victim number including country/area code\n>>")
msg = input("Message (Fr... | true |
f9913193d6e22317659a257b21362fef420c2e3d | crowledj/GitBugsRestAPI | /easyWebPg_2.py | UTF-8 | 3,952 | 3.015625 | 3 | [] | no_license | '''A simple program to create an html file froma given string,
and call the default web browser to display the file.'''
contents = '''<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title> Git 'Buggy' commits ... | true |
7a20459bf7baa55adfc86c81c3a3ce18ba764f1e | whomikedao/PythonExercises | /ListEx.py | UTF-8 | 1,579 | 3.796875 | 4 | [] | no_license | # #1
# numbers = [1, 2, 3, 4, 5]
# sum = 0
# for i in numbers:
# sum += i
# print(sum)
# #2
# numbers = [1, 2, 3, 4, 5]
# print(max(numbers))
# #3
# numbers = [1, 2, 3, 4, 5]
# print(min(numbers))
# #4
# numbers = [1, 2, 3, 4, 5]
# even = []
# for i in numbers:
# if i % 2 == 0:
# even.append(i)
# pri... | true |
29a27bcaed6195183ae680a1f248da81fb1dd3a7 | mapsver/MGTOA-Calendar | /DbgScripts/excelWriter-rev2-debug.py | UTF-8 | 13,150 | 2.609375 | 3 | [] | no_license | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: shiv
#
# Created: 29/09/2014
# Copyright: (c) shiv 2014
# Licence: <your licence>
#-------------------------------------------------------------------------------
import ctypes
... | true |
be14e29528a99c7151de0debc702cf8c81d185fe | renales/Python | /Ejemplos Python/Ejemplo_excepciones_basico.py | UTF-8 | 411 | 3.828125 | 4 | [] | no_license | #!/bin/python3
# coding: utf-8
# Ejemplo de uso avanzado de excepciones
# Raul Renales 13/5/2020
try:
x = int(input("Ingresa un numero: "))
y = 1 / x
print(y)
except ZeroDivisionError:
print("No puedes dividir entre cero, introduce otro numero.")
except ValueError:
print("Por favor, ing... | true |
ea6037fdcef6ca6559c72a835938b96a6397c158 | taketakeyyy/atcoder | /abc/037/a.py | UTF-8 | 149 | 2.671875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
def solve():
A, B, C = list(map(int, input().split()))
print(C // min(A,B))
if __name__ == "__main__":
solve()
| true |
38f65a764f0e7a2cfc578b54fc93bda1b74edafc | muzavan/py-interviewbit | /math/greatest_common_divisor.py | UTF-8 | 336 | 3.40625 | 3 | [] | no_license | class Solution:
# @param A : integer
# @param B : integer
# @return an integer
def gcd(self, A, B):
if A < B:
return self.gcd(B, A)
if A%B == 0:
return B
nextA = B
nextB = A%B
return self.gcd... | true |
b802867170ffe3f9c9459a39b05aff6d79a5d85a | it-engineer-me/pyneng-examples | /ssh_telnet/netmiko/ex03_netmiko_telnet.py | UTF-8 | 975 | 2.625 | 3 | [
"MIT"
] | permissive | from pprint import pprint
import socket
import yaml
from netmiko import (
Netmiko,
NetmikoTimeoutException,
NetmikoAuthenticationException,
)
def send_show_command(device, commands):
result = {}
if type(commands) == str:
commands = [commands]
try:
with Netmiko(**device) as ssh... | true |
d26a41047b0e555ea74b114ae6c536b26cac134b | FlyingWithJerome/SecurityCameraSystem | /utils/serial_number.py | UTF-8 | 815 | 3.203125 | 3 | [] | no_license | '''
serial_number.py
This module generates the output file names
for videos and pictures
'''
import time
from datetime import date
class FileName:
_VIDEO_SERIAL = 1
_PICTURE_SERIAL = 1
def get_filename(type_='video'):
'''
get the next available file name
'''
if type_ =... | true |
ff442cd7526e8fcdf17bc27d6c873ad0db9801d3 | ctames/TextAnalysis | /rematchr/pdfManage/processing.py | UTF-8 | 1,799 | 2.78125 | 3 | [
"MIT"
] | permissive | import sys
import wordcloud
import operator
from django.conf import settings
def process_file(filepath, strip_chars, ignore_words):
"""returns two dictionaries reprsenting the count of words and their rate of
occurence in a document"""
text = ""
with open(filepath, 'r') as file:
text = file.read()
words = ... | true |
8fb86042cc2446e53845cc704801b3e9cc21283f | SuperJason/scenario | /apollo3/amdtp_ble.py | UTF-8 | 7,701 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Communiate to apollo3 with ble amdtp
"""
from bluepy.btle import Scanner, DefaultDelegate, Peripheral
import numpy as np
import crcmod
class ScanDelegate(DefaultDelegate):
def __init__(self, params):
DefaultDelegate.__init__(self)
self.count = 0
... | true |
d58a62982af00b2cddff069eba1d24a1d19f5f00 | apsz/python-learning | /Third Chapter/uniquewords.py | UTF-8 | 592 | 3.609375 | 4 | [] | no_license | #!/usr/bin/python3
import string
import sys
import collections
def main():
words = collections.defaultdict(int)
strip = string.whitespace + string.punctuation + string.digits + "\"'"
for filename in sys.argv[1:]:
for line in open(filename):
for word in line.lower().split():
... | true |
9941f18848053db0781449ad2cf090d7a1a9d28b | altoid/hackerrank | /special_palindrome_2/do_over.py | UTF-8 | 3,244 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python3
# https://www.hackerrank.com/challenges/special-palindrome-again/problem?h_r=internal-search
import unittest
from functools import reduce
# encoding '' should yield []
# encoding None should yield None
# decoding None should yield None
# decoding [] should yield ''
#
# None and '' must be hand... | true |
a98223c0ddbd6910990c1dd1ee0aa4b325d5a23c | ivan-alles/MiDaS-1 | /run.py | UTF-8 | 3,816 | 2.578125 | 3 | [
"MIT"
] | permissive | """Compute depth maps for images in the input folder.
"""
import os
import glob
import torch
import utils
import cv2
from torchvision.transforms import Compose
from models.midas_net import MidasNet
from models.transforms import Resize, NormalizeImage, PrepareForNet
from torch.utils import tensorboard
def run(input_... | true |
2e9826858b0bf5708e44dc0d7886952fa25aa535 | farhan85/Misc | /python/sqs_wait_read.py | UTF-8 | 967 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
import boto
import click
def wait_and_get(sqs_client, queue_url, wait_time_s=20):
while True:
response = sqs_client.receive_message(QueueUrl=queue_url, WaitTimeSeconds=wait_time_s)
for message in response.get('Messages', []):
sqs_client.delete_message(QueueUrl=qu... | true |
35150661d61108d4dcfbdd598edb989c2567d550 | gabriellaec/desoft-analise-exercicios | /backup/user_058/ch30_2019_11_09_02_40_16_935017.py | UTF-8 | 394 | 3.625 | 4 | [] | no_license | from math import sin
v = int(input("Qual a velocidade da Jaca? "))
a = int(input("Qual o angulo de lançamento? "))
g = 9.8
catapulta_visinho = 100
vq = v**2
seno = sin(2*a)
d = (vq*seno)/g
if d < catapulta_vizinho - 2:
print ("Muito perto")
elif d > catapulta_vizinho + 2:
print ("Muito longe")
elif d >= c... | true |
9b36254bcc55fab6a26f3324cd96313af758987c | afrizalmuchrom/pygethwid | /hid.py | UTF-8 | 718 | 2.78125 | 3 | [] | no_license | import tkinter as tk
import requests
import subprocess
import os
import hashlib
def GetUUID():
cmd = 'wmic csproduct get uuid'
uuid = str(subprocess.check_output(cmd))
pos1 = uuid.find("\\n")+2
uuid = uuid[pos1:-15]
return uuid
# print(GetUUID())
md5 = hashlib.md5()
md5.update((GetUUID()).encode(... | true |
6b3d1ef63ddbdd7abbea94d98eebd50477f4c49c | LeenaKH123/API_DB | /apis/Exercise_06.py | UTF-8 | 4,505 | 3.09375 | 3 | [] | no_license | <<<<<<< HEAD
'''
=======
"""
>>>>>>> 7856ef653394a526e65c67837963d4168e968336
Create an application that interfaces with the user via the CLI - prompt the user with a menu such as:
Please select from the following options (enter the number of the action you'd like to take):
1) Create a new account (POST)
2) View all y... | true |
f9d5747c80b042842a502be3d6833f5568b80a6c | l0rd11/Grant_GAZE | /examples/move.py | UTF-8 | 1,466 | 2.6875 | 3 | [] | no_license | import qi
import argparse
import sys
import math
import almath
def main(session):
"""
Move To: Small example to make Nao Move To an Objective.
"""
# Get the services ALMotion & ALRobotPosture.
motion_service = session.service("ALMotion")
posture_service = session.service("ALRobotPosture")
... | true |
beefc505b083b84ddb8835798ade06ea4ff31cd9 | gngoncalves/cursoemvideo_python_pt2 | /desafio67.py | UTF-8 | 382 | 3.953125 | 4 | [] | no_license | from time import sleep
c = 1
while True:
num = int(input('Insira um número, para calcular a sua tabuada: '))
print('-' * 50)
if num < 0:
break
print(f'Tabuada de {num}:')
while c <= 10:
p = num * c
print(f'{num} x {c:2} = {p:2}')
c += 1
print('-' * 50)
c = 1
p... | true |
cb7841ec4667d040d5244d84ea49157a28360bcd | peternortonuk/quiz-questions | /interviews/weather_uk_dimitrii/tests/app_test/weather_test/test_routes.py | UTF-8 | 2,666 | 2.5625 | 3 | [] | no_license | from datetime import datetime
from unittest.mock import patch
import pytest
import requests
from app.weather.models import City, Weather
@pytest.fixture
def client(get_app):
return get_app[0].test_client()
@pytest.fixture()
def create_one_weather_for_client(get_app):
app, db = get_app
city_obj = City(... | true |
0a97994893e1f1c9bea9eb6bd31ce6509ceda50e | jin-sj/pytorchzerotoall | /mnist.py | UTF-8 | 3,006 | 2.796875 | 3 | [] | no_license | import numpy as np
import torch
import torch.nn.functional as F
from torch.autograd import Variable
from torch.utils.data import Dataset, DataLoader
from torchvision import datasets, transforms
dev = "cpu"
if torch.cuda.is_available():
dev = "cuda:0"
device = torch.device(dev)
class Model(torch.nn.Module):
de... | true |
e7f01df2a44188899c8a815af5f24b0b92c03f84 | frrad/leetweek | /1792.maximum-average-pass-ratio.py | UTF-8 | 790 | 3.734375 | 4 | [] | no_license | import heapq
class Solution:
def maxAverageRatio(self, classes: List[List[int]], extraStudents: int) -> float:
h = [self.entry(x[0], x[1]) for x in classes]
heapq.heapify(h)
for x in range(extraStudents):
best = heapq.heappop(h)
heapq.heappush(h, self.entry(best[1]... | true |
2a6f5899f800076b549b6af8891216891b991a0f | maxwell912/BattleCity | /BattleCity.py | UTF-8 | 1,085 | 2.53125 | 3 | [] | no_license | from game_mech import interface_classes as ic
from game_mech import conf
from game_mech import music
import pygame
import sys
import os
sys.path.insert(0, os.path.join("game_mech"))
pygame.init()
win = pygame.display.set_mode((conf.win_width, conf.win_height))
clock = pygame.time.Clock()
def game():
while game... | true |
129e1bba9183efbf7be66d4a9ef8cc1814240d4a | nmap1208/2016-python-oldboy | /Day6/shelve_3.py | UTF-8 | 768 | 3.015625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import shelve
d = shelve.open('shelve_test') #打开一个文件
class Test(object):
def __init__(self,n):
self.n = n
t = Test(123)
t2 = Test(123334)
name = ["alex","rain","test"]
d["test"] = name #持久化列表
d["t1"] = t #持久化类
d["t2"] = t2
d.close()
a = shelve.open('shelve_test')
print(dir... | true |
d07f2edf5af1f108f7bf4992536627ca6184a954 | andersonsouza/ptaas | /scripts/models.py | UTF-8 | 5,505 | 2.609375 | 3 | [] | no_license | from __future__ import unicode_literals
from datetime import datetime
from django.core.validators import RegexValidator
from django.db import models
from django_extensions.db.models import TimeStampedModel
class ScriptCategory(models.Model):
category = models.CharField('Script Category', max_length=50, help_te... | true |
7bfd8f2a5a160ac2a54c25ec978c1b6684a5eb92 | sople1/slosk | /app.py | UTF-8 | 1,633 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
"""
app.py
app root file for Slide-OSK
(c) 2019 SnooeyNET
"""
from tkinter import *
import keyboard
from core import windowing
from core.ui_extender import *
class App(Tk):
def __init__(self, *args, **kwargs):
Tk.__init__(self, *args, **kwargs)
self.btn... | true |
85db16532665c26c07a871b3f6a89d9efa78cb03 | ashish-bisht/leetcode_solutions | /1641_count_sorted_vowel_Strings.py | UTF-8 | 341 | 3.828125 | 4 | [] | no_license |
def count_vowels_strings(n):
res = []
vowels = "aeiou"
helper(vowels, n, '', res)
return res
def helper(vowels, n, cur, res):
print(cur)
if len(cur) == n:
res.append(cur)
return
for i in range(len(vowels)):
helper(vowels[i:], n, cur + vowels[i], res)
print(coun... | true |
4a26b3a1bcca2821fc96b8d3ed671e77b173a05c | muhammad-masood-ur-rehman/Skillrack | /Python Programs/fibonacci-sequence.py | UTF-8 | 528 | 4.34375 | 4 | [
"CC0-1.0"
] | permissive | Fibonacci Sequence
An integer value N is passed as the input. The program must print the first N terms in the Fibonacci sequence.
Input Format: The first line denotes the value of N.
Output Format: The first N terms in the Fibonacci sequence (with each term separated by a space)
Boundary Conditions: 3 <= N <= 50
Examp... | true |
bb87f74ce8e9efdc6326d3fb11225829bd7cbdea | lanzn/stockPredict | /code_step1/model2/DNN_moduel.py | UTF-8 | 11,325 | 2.765625 | 3 | [] | no_license | #coding:utf-8
#采用新数据,新逻辑,进行预测
#训练集采用20180331的财报行为得到20186月的涨跌
#验证集采用20180630的财报行为得到20189月的涨跌
#TARGET_PATH = "../../data/Train&Test/C1S1_oldlabel/"#y是涨跌
#TARGET_PATH = "../../data/Train&Test/C1S1_newlabel/"#改名叫C1S1了
#TARGET_PATH = "../../data/Train&Test/C2S1_newlabel/"
# TARGET_PATH = "../../data/Train&Test/C4S1_newlab... | true |
d7e8365887a4120554bb345f177104259e69cf5d | alulec/CYPAlexisCC | /libro/problemas_resueltos/capitulo_1/problema1_8.py | UTF-8 | 367 | 4.03125 | 4 | [] | no_license | # Programa que calcula la distancia entre dos puntos a partir de sus corrdenadas
print("Primer punto")
x1= float(input("Dame x: "))
y1= float(input("Dmae y: "))
print("Segundo punto")
x2= float(input("Dame x: "))
y2= float(input("Dmae y: "))
dist= ((x1-x2) **2 + (y1-y2) **2) ** .5
print(f" La distancia entre el punto ... | true |
02d123e54db296df573b6a9f5d4254214d5f2774 | ryuseiasumo/Gazoshori100knock | /Question_21_30/q25.py | UTF-8 | 759 | 2.8125 | 3 | [] | no_license | import cv2
import numpy as np
def Nearest_Neighbor(_img, ax = 1.5, ay = 1.5):
H, W ,C = _img.shape
img = _img.copy().astype(np.float)
aH = int(ay*H)
aW = int(ax*W)
y = np.arange(aH).repeat(aW).reshape(aH, -1)
print(y)
x = np.tile(np.arange(aW), (aH,1))
print(x)
y = np.round(y/ a... | true |
38318841b9581ee40bce31573cf64088fd31ae19 | idiotfenn/useless-project-example | /source/what.py | UTF-8 | 290 | 3.8125 | 4 | [
"MIT"
] | permissive | #!/bin/python
import random
string = input("Enter a string: ").title()
i = len(string) - 1
while i > 0:
char = string[i-1:i]
if random.randint(0, 1) == 1 and char.islower():
char = char.swapcase()
string = string[:i-1] + char + string[i:]
i = i - 1
print(string)
| true |
e931f9a537ccfd638450853c51a01e68758544b6 | Wei-Jyu/US-Baby-Names | /Baby_names.py | UTF-8 | 7,562 | 3.015625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import scipy.stats as stats
import glob
%matplotlib inline
filenames = glob.glob('dir/namesbystate/*.csv')
column_names = ['State', 'Sex', 'Year', 'Name', 'Num']
Data = pd.DataFrame(columns = column_names)
i = 0
N = np.zeros((51,2))
M = np.zeros((5... | true |
6e35abad1f1a415598d60a96207503d14afd0740 | LabinNovenki/mrfish_ids | /test.py | UTF-8 | 91 | 2.59375 | 3 | [] | no_license | import time
def print_hi_forever():
while(1):
print('hi')
time.sleep(1) | true |
0ab96c4ca008b54c7dc3a43b176d0c18d54bb69f | stevenlundy/programming-pearls | /column4/binary_search.py | UTF-8 | 961 | 3.5625 | 4 | [] | no_license |
def find_position(values, target):
bottom = 0
top = len(values) - 1
while top >= bottom:
middle = (top + bottom) // 2
if values[middle] > target:
top = middle - 1
elif values[middle] < target:
bottom = middle + 1
else: # values[middle] == target
... | true |
b98cad421e4060f2a0a71bd4f9b6e816959d66b6 | faroeq33/pythonworkshop | /exercises/chapter3/exercise57.py | UTF-8 | 207 | 3.640625 | 4 | [] | no_license | nums = list(range(1000))
filtered = filter(lambda x: x % 3 == 0 or x % 7 == 0, nums)
print(sum(filtered))
names = ['Ming', 'Jennifer', 'Andrew', 'Boris']
sorted(names, key=lambda x: len(x))
print(names)
| true |
009c3021855d514cd35cac9129f62554fbeaf02b | feng1o/python_1 | /oop使用元类.py | UTF-8 | 4,172 | 4.1875 | 4 | [] | no_license | # _*_ coding:utf-8 _*_
# http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/0014319106919344c4ef8b1e04c48778bb45796e0335839000
"""type()
动态语言和静态语言最大的不同,就是函数和类的定义,不是编译时定义的,而是运行时动态创建的。
比方说我们要定义一个Hello的class,就写一个hello.py模块:from hello import Hello"""
class Hello(object):
def he... | true |
7e6dd892335fa7f4f9af70d7c4f596101867d008 | jwhite333/CS-4100-Pacman-MutiAgentSearch | /multiAgents.py | UTF-8 | 22,315 | 3 | 3 | [] | no_license | # multiAgents.py
# --------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.e... | true |
7c7f7a2ba0de4041bd10c5b5b831d62eabe8b047 | the-silent-partner/PiPixelProject | /pi_pixel_project.py | UTF-8 | 1,785 | 3.484375 | 3 | [] | no_license | ## Importing the relevent directories
from PIL import Image
import os.path
from Pi100Million import Pi100Mil
## Setting the boundries
total_digits = len(Pi100Mil)-2
total_poss_area = total_digits/9
## Welcome message
print u"-- Welcome to the \u03c0 Pixel Project."
print u"-- Please pick a width and height for your \... | true |
62b36a34260bb271c553f9127f43da0524b6c76a | variablejun/keras__R | /keras2/keras72_02_cifar_xception.py | UTF-8 | 2,961 | 2.59375 | 3 | [] | no_license | from tensorflow.keras.layers import Dense, Flatten, MaxPooling2D,Conv2D,GlobalAveragePooling2D
from tensorflow.keras.models import Sequential
from tensorflow.keras.applications import VGG16, VGG19,Xception
from tensorflow.keras.datasets import cifar10
from tensorflow.keras.datasets import cifar100
import tensorflow as ... | true |
a190c4ff321da16f04184fbdf1eebf9ce08c24f0 | palladine/edu_python | /search.py | UTF-8 | 1,977 | 4.125 | 4 | [] | no_license | import random
from datetime import datetime
arr = [random.randint(1, 10) for x in range(10)]
el = random.randint(1, 10)
print(arr)
# Linear search
def lsearch(arr, z):
count = 0
# for x in arr:
# if x == z
for x in range(len(arr)):
if arr[x] == z:
count += 1
... | true |
3040391dde782a713556b95258cc472ea0671df8 | phantomDai/mypapers | /AMT/experiment/scripts/grep_test_scripts-master/partition/allocation_testcases_4_partitions.py | UTF-8 | 2,707 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019/10/29
# @Anthor : phantomDai
"""
为分区模式分配测试用例
"""
import linecache
from constant import constantNumber as constant
def allocation_testcases():
"""
为每一个分区模式分配测试用例
:return:
"""
partition_testcases = {}
# 存放所有的分区模式
partition_... | true |
5eb6cb00a8a7f81639f1381dd0d388ab15f0943c | serereuk/Newthings | /phan.py | UTF-8 | 1,823 | 3.265625 | 3 | [] | no_license | import numpy as np
def rle2(x, color):
dots = np.where(x.T.flatten() == color)[0]
run_lengths = []
prev = -2
for b in dots:
if b>prev+1: run_lengths.append([color, 0])
run_lengths[-1][1] += 1
prev = b
return run_lengths
class Phan:
def __init__(self, gbsize, win_stand... | true |
4a6a330f84993ce1f5f0bed43944f956a567bf27 | aryanmalik567/ProjectEuler | /Problems 10 - 19/Problem 17.py | UTF-8 | 1,593 | 4.0625 | 4 | [] | no_license | def num_to_words(number):
switcher = {
0: "",
1: "one",
2: "two",
3: "three",
4: "four",
5: "five",
6: "six",
7: "seven",
8: "eight",
9: "nine",
10: "ten",
11: "eleven",
12: "twelve",
13: "thirteen",
... | true |
3f53878e07e1bced15d1ae5c32f80e40d0e2a56c | IwoHerka/sexpr | /sexpr/types/non_terminal.py | UTF-8 | 1,102 | 3.75 | 4 | [
"MIT"
] | permissive | from ..matcher import Matcher
class NonTerminal(Matcher):
def __init__(self, name, body):
self.name = name
self.body = body
def matches(self, sexp):
'''
Body of a non-terminal is always a :class:`Sequence`. For an s-expr
to match, it must be of the form::
... | true |
3ce4e957f381b93bf8e43a7ed53f306684e54def | crazyguy106/cfclinux | /ethan/python/day1/validity.py | UTF-8 | 394 | 3.96875 | 4 | [] | no_license | #!/usr/bin/python3
password=input("Please put in a password: ")
if len(password) < 6:
print("Your password needs to have at least 6 characters.")
if not any(char.isdigit() for char in password):
print("Make sure your password has a number in it.")
if not any(char.isalpha() for char in password):
print("Make sure y... | true |
47bd300b827c651d1404d8c543fed2d2bacafef8 | flerro/weather-api-python | /app/models.py | UTF-8 | 1,527 | 2.578125 | 3 | [] | no_license | import json
import os
import datetime
from json import JSONEncoder
from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute, NumberAttribute, MapAttribute
from botocore.session import Session
locationTable = os.getenv('LOCATIONS_TABLE')
defaultRegion = Session().get_config_variable('region')... | true |
7966445026326b5ba4cb38c3cf62eaa6dde2321e | JasonNew/Lxcoff-Framework | /scripts/timeuse.py | UTF-8 | 1,126 | 2.765625 | 3 | [] | no_license | import xlwt
import os
import string
def getfilelist():
FileList = []
FileNames = os.listdir(os.getcwd())
if (len(FileNames)>0):
for fn in FileNames:
if 'game' in fn:
fullfilename=os.path.join(os.getcwd(),fn)
FileList.append(fullfilename)
if (len(FileList... | true |
4ee35d5b6be5aad8fad9e9771d67023e9314e66a | rjc89/LeetCode_medium | /interval_list_intersections.py | UTF-8 | 720 | 3.328125 | 3 | [] | no_license | # https://leetcode.com/problems/interval-list-intersections/discuss/828650/Python-two-pointer-beats-98
from typing import List
class Solution:
def intervalIntersection(self, A: List[List[int]], B: List[List[int]]) -> List[List[int]]:
a, b = 0, 0
res = []
while a < len(A) and b < len(B):
... | true |
a92f2ee62ecf7ce1b8bf509256ccc2b14b80fbcb | israelmendez232/log-parsing-data-analytics | /app/scripts/simulate_logs.py | UTF-8 | 797 | 3.453125 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
from random import randrange
def insert_log():
"""
# INSERT THE LOG
Inserting the logs into the file to simulate a real envoironment of data generation.
"""
log_file = "./logs/nginx.log"
df = pd.read_csv(log_file, delimiter = "\t", sep=" ", header=None)
lines = le... | true |
bdcfd230a237416249178b320236c152de8c75c8 | numigi-com/TechnicalTest-HR | /test_5_random.py | UTF-8 | 1,364 | 3.953125 | 4 | [] | no_license | from typing import List
import random
from random import randint
def list_random_numbers(min: int, max: int, length: int) -> List:
""" Return a list of random number between min and max. The list will count `length`
items.
:param int min: the lower number that can be added
:param int max: the h... | true |
feb8d549dc8c674988586dd07e9808db7c7871d8 | Thrax37/ffe-master | /Socialist.py | UTF-8 | 559 | 2.953125 | 3 | [] | no_license | from sys import argv
data=argv[1].split(";")[2].split("_")
inf=int(data[2])
hel=int(data[1])
dead=int(data[3])
if inf>29:
print("CQM") # if there is to many sick cure some, quarantine some, and try to get rid of the disease
else:
if hel<80:
print("BMV") # if there's few healthy, close our borders, be... | true |
cf842aed891e2aca07fcf7a70eeb6bcc475aa33b | HangCoder/micropython-simulator | /tests/basics/builtin_round.py | UTF-8 | 133 | 3.296875 | 3 | [
"MIT"
] | permissive | # test round() with integral values
tests = [
False, True,
0, 1, -1, 10
]
for t in tests:
print(round(t))
print("PASS") | true |
7a28ec8532f1e42bc1f130fafaa362566ed6c003 | odartsi/Math-Logic-Puzzels | /IntegerToRoman.py | UTF-8 | 795 | 3.453125 | 3 | [] | no_license | class Solution:
def intToRoman(self, num: int) -> str:
roman_dict = {1:'I', 5:'V', 10:'X', 50:'L' , 100:'C', 500 :'D', 1000:'M'}
ans = ""
keys = list(roman_dict.keys())[::-1]
for i in range(0, len(keys), 2):
q = num // keys[i]
r = n... | true |
899553c5760322cd068f18217324f3712b0e886e | yuzhecd/al_py | /Linklist/reverse_m2n.py | UTF-8 | 644 | 3.328125 | 3 | [] | no_license | from linklist_f import LinkList
from linklist_f import Node
def reverse_m2n(alist, m, n):
pre = alist.head
for _ in range(m-1):
pre = pre.next
cur = pre.next
result = None
for _ in range(n-m+1):
temp = cur.next
cur.next = result
result = cur
cur = temp
p... | true |