repo_name stringclasses 400
values | branch_name stringclasses 4
values | file_content stringlengths 16 72.5k | language stringclasses 1
value | num_lines int64 1 1.66k | avg_line_length float64 6 85 | max_line_length int64 9 949 | path stringlengths 5 103 | alphanum_fraction float64 0.29 0.89 | alpha_fraction float64 0.27 0.89 |
|---|---|---|---|---|---|---|---|---|---|
aymane081/python_algo | refs/heads/master | class Solution:
def get_minimum(self, nums):
left, right = 0, len(nums) - 1
while left < right:
if nums[left] <= nums[right]: # sorted array, return nums[left]
break
mid = (left + right) // 2
if nums[mid] < nums[left]: # min is either mid the left ... | Python | 18 | 34.666668 | 79 | /arrays/find_minimum_rotated_sorted_arary.py | 0.49766 | 0.458658 |
aymane081/python_algo | refs/heads/master | # 234
from utils.listNode import ListNode
class Solution:
def is_palindrome(self, head):
if not head:
return False
rev, slow, fast = None, head, head
while fast and fast.next:
fast = fast.next.next
rev, rev.next, slow = slow, rev, slow.next
... | Python | 43 | 18.209303 | 53 | /linkedList/palindrome_linked_list.py | 0.568319 | 0.556227 |
aymane081/python_algo | refs/heads/master | class Solution(object):
# O(N) time and space
def rotate_array(self, numbers, k):
"""
:type numbers: List[int]
:type k: int
:rtype: List[int]
"""
n = len(numbers)
if k > n:
raise ValueError('The array is not long enough to be rotated')
... | Python | 39 | 27.461538 | 74 | /arrays/rotate_array.py | 0.523423 | 0.5 |
aymane081/python_algo | refs/heads/master | from utils.treeNode import TreeNode
class Solution:
#O(N) time, O(1) space
def get_left_leaves_sum(self, node):
result = 0
if not node:
return result
if node.left and not node.left.left and not node.left.right:
result += node.left.value
else:
... | Python | 51 | 19.490196 | 70 | /trees/left_leaves_sum.py | 0.636364 | 0.605742 |
aymane081/python_algo | refs/heads/master | class Solution:
def get_min_length(self, nums, target):
"""
type nums: List[int]
type target: int
:rtype : int
"""
min_length, sum_so_far, start = len(nums), 0, 0
for i, num in enumerate(nums):
sum_so_far += num
while sum_so_far - nums[... | Python | 20 | 30.200001 | 59 | /arrays/minimum_size_subarray_sum.py | 0.505618 | 0.486356 |
aymane081/python_algo | refs/heads/master | class Solution(object):
def missing_element(self, numbers):
"""
:type numbers: List[int]
:rtype: int
"""
n = len(numbers)
return (n * (n + 1) // 2) - sum(numbers)
solution = Solution()
numbers = [0, 2, 5, 3, 1]
print(solution.missing_element(numbers)) | Python | 12 | 24.416666 | 48 | /arrays/missing_element.py | 0.546053 | 0.523026 |
alan-valenzuela93/port-scanner | refs/heads/main | import socket
import argparse
from grabber import banner_grabbing
parser = argparse.ArgumentParser()
parser.add_argument('-t', '--target', help='Enter your target address', required=True)
parser = parser.parse_args()
ports = [21, 22, 25, 53, 66, 80, 88, 110, 139, 443, 445, 8080, 9050] # These are some of the m... | Python | 34 | 24.735294 | 124 | /port-scanner.py | 0.619362 | 0.579758 |
alan-valenzuela93/port-scanner | refs/heads/main | import socket
def banner_grabbing(addr, port):
print("Getting service information for open TCP/IP port: ", port + "...")
socket.setdefaulttimeout(10)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((addr, port))
data = ''
headers = \
"GET / HTTP/1.1\r\n" \
... | Python | 29 | 30.931034 | 77 | /grabber.py | 0.540314 | 0.527749 |
thevaccinetracker/data_engine | refs/heads/master | from settings import GOOGLE_DRIVER, DATA_PATH
import time
def WebScrap():
print("Raps webscrap: Started...")
driver = GOOGLE_DRIVER
driver.get('https://www.raps.org/news-and-articles/news-articles/2020/3/covid-19-vaccine-tracker')
table = driver.find_element_by_id("vax_wrapper")
table.find_eleme... | Python | 39 | 28.641026 | 102 | /web_scrap/raps_org.py | 0.603806 | 0.59083 |
thevaccinetracker/data_engine | refs/heads/master | import time
from settings import GOOGLE_DRIVER
def WebScrap():
print("Airtable webscrap: Started...")
driver = GOOGLE_DRIVER
driver.get('https://airtable.com/shrSAi6t5WFwqo3GM/tblEzPQS5fnc0FHYR/viweyymxOAtNvo7yH?blocks=bipZFzhJ7wHPv7x9z')
table = driver.find_element_by_id("table")
table.find_el... | Python | 26 | 39.807693 | 121 | /web_scrap/airtable_com.py | 0.742696 | 0.713478 |
thevaccinetracker/data_engine | refs/heads/master | from settings import GOOGLE_DRIVER, DATA_PATH
import time
def WebScrap():
print("WHO webscrap: Started...")
driver = GOOGLE_DRIVER
driver.get('https://www.who.int/publications/m/item/draft-landscape-of-covid-19-candidate-vaccines')
body = driver.find_element_by_tag_name("body")
body.find_elemen... | Python | 17 | 24.588236 | 104 | /web_scrap/who_int.py | 0.694253 | 0.682759 |
thevaccinetracker/data_engine | refs/heads/master | from web_scrap import airtable_com, raps_org, who_int
import time
airtable_com.WebScrap()
raps_org.WebScrap()
who_int.WebScrap()
print("Sleep for 1 min")
time.sleep(60 * 1)
from preprocess_data import pdf_read_table,airtable
pdf_read_table.TransformPDFData()
airtable.PreProcessAirtableData()
print("Sleep for 1 min... | Python | 21 | 17.476191 | 53 | /main_exce.py | 0.768041 | 0.747423 |
thevaccinetracker/data_engine | refs/heads/master | import gspread
from oauth2client.service_account import ServiceAccountCredentials
import time
from settings import GSHEET_CRED_FILE, GSHEET_SCOPE, GSHEET_FILE, GSHEET_WORKSHEET
from settings import WHO_INPUT_DATA, RAPS_INPUT_DATA, AIRTABLE_INPUT_DATA
from settings import VT_CORPS
import get_cosine.get_cosine
# use c... | Python | 194 | 28.572165 | 95 | /googleDb.py | 0.652432 | 0.64267 |
thevaccinetracker/data_engine | refs/heads/master | import sys
sys.path.append(r'C:\Users\v-shvi\Desktop\Personal\VT\data_engine')
sys.path.append(r'C:\Users\v-shvi\Desktop\Personal\VT\data_engine\web_scrap_data')
sys.path.append(r'C:\Users\v-shvi\Desktop\Personal\VT\data_engine\get_cosine')
sys.path.append(r'C:\Users\v-shvi\Desktop\Personal\VT\data_engine\preprocess_d... | Python | 49 | 36.693878 | 106 | /settings.py | 0.757576 | 0.751623 |
thevaccinetracker/data_engine | refs/heads/master | from settings import DATA_PATH
import csv
def parseRowToCell(row):
isSingleWord = False;
word = ""
rowArray = []
for letter in row:
if letter == "\"" and not isSingleWord:
isSingleWord = True
elif letter == "\"" and isSingleWord:
isSingleWord = False
eli... | Python | 43 | 28.60465 | 74 | /preprocess_data/airtable.py | 0.565593 | 0.562451 |
thevaccinetracker/data_engine | refs/heads/master | import tabula
from settings import DATA_PATH
file = DATA_PATH + "/novel-coronavirus-landscape-covid-19-(1).pdf"
tabula.convert_into(file, DATA_PATH + "/who_covid_data.csv", output_format="csv", pages='all')
import csv
file_CSV = open(DATA_PATH + '/who_covid_data.csv')
data_CSV = csv.reader(file_CSV)
list_CSV = list(... | Python | 48 | 27.375 | 94 | /preprocess_data/pdf_read_table.py | 0.598385 | 0.591777 |
thevaccinetracker/data_engine | refs/heads/master | statement = """"Institute of Medical Biology, Chinese Academy of Medical Sciences",Vaccine,Inactivated virus,Phase II,Phase II began June 2020,Inactivated,NCT04412538,Unknown,,,N/A,https://docs.google.com/document/d/1Y4nCJJ4njzD1wiHbufCY6gqfRmj49Qn_qNgOJD62Wik/edit,6/23/2020"""
def parseRowToCell(row):
isSingleWo... | Python | 21 | 35.142857 | 278 | /test.py | 0.643799 | 0.60686 |
thevaccinetracker/data_engine | refs/heads/master | import string
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.feature_extraction.text import CountVectorizer
from nltk.corpus import stopwords
from settings import STOPWORDS
stopwords = stopwords.words(STOPWORDS)
def cosine_sim_vectors(vec1, vec2):
vec1 = vec1.reshape(1, -1)
vec2 = vec2.... | Python | 33 | 27.363636 | 77 | /get_cosine/get_cosine.py | 0.695513 | 0.67735 |
marioxe301/ParserDR | refs/heads/master | from pyparsing import (Regex, White, Literal ,
ZeroOrMore, OneOrMore, Group , Combine ,
Word , alphanums, Suppress)
import sys
class Tokens(object):
def __init__(self,tag,token):
self.tag = tag
self.token = token
#esta clase permitira guardar en la lista
class Lexer(object):
def __init__(sel... | Python | 92 | 43.836956 | 299 | /Lexer.py | 0.558923 | 0.557953 |
marioxe301/ParserDR | refs/heads/master | from Lexer import Lexer
from treelib import Node, Tree
#verifica unicamente la declaracion de un int int <ID> := <NUMERO>
class ParserExample(object):
def __init__(self,path):
lex = Lexer(path)
lex.tokenize()
self.TOKENS = lex.tokenList
self.INDEX = 0
tree = Tree()
s... | Python | 77 | 23.688313 | 66 | /ParserSimpleExample.py | 0.460526 | 0.454211 |
marioxe301/ParserDR | refs/heads/master | from Lexer import Lexer
from treelib import Node, Tree
import re
from termcolor import colored,cprint
class Parser(object):
def __init__(self,path):
lex = Lexer(path)
lex.tokenize()
self.TOKENS = lex.tokenList
self.TYPES= re.compile(".*-TY")
def nextToken(self):
... | Python | 390 | 34.005127 | 114 | /Parser.py | 0.450443 | 0.442458 |
p4squ4lle/PI-Controller-Communication | refs/heads/main | # -*- coding: utf-8 -*-
import serial
import subprocess
import logging
from datetime import datetime
from pipython import GCSDevice, pitools
from time import sleep
# Set-Up logging
dt = datetime.now()
dt_string = dt.strftime("%H-%M_%d%m%Y")
logging.basicConfig(level=logging.INFO,
form... | Python | 131 | 33.793892 | 93 | /PIController.py | 0.565607 | 0.550885 |
p4squ4lle/PI-Controller-Communication | refs/heads/main | # -*- coding: utf-8 -*-
import serial
import subprocess
import logging
from pipython import GCSDevice, pitools
# Initialize PI Motor Controller
SN = '120060504'
STAGES = ['M-521.DG1', 'M-405.DG(FW000.000)', 'M-405.DG(FW000.000)',]
REFMODE = 'FRF'
PI = GCSDevice('C-844')
PI.ConnectUSB(serialnum=SN)
pr... | Python | 27 | 25.555555 | 69 | /PIControllerConnection.py | 0.5 | 0.453333 |
strawberryblackhole/hippopotamus | refs/heads/master | from htmlParser import getFormatedArticle
from chunkGenerator import *
from ZIMply.zimply import ZIMFile
from os import path
import math
import time
import argparse
from amulet.world_interface import load_world
def generateChunkList(totalArticleCount, chunkBookCapacity, target_pos, outputForceload = False):
#gene... | Python | 156 | 40.224358 | 213 | /fillWithWiki.py | 0.615827 | 0.599503 |
strawberryblackhole/hippopotamus | refs/heads/master | from amulet.api.block import Block
import amulet_nbt
from amulet.api.block_entity import BlockEntity
from htmlParser import getFormatedArticle
from functools import partial
import multiprocessing
from multiprocessing.pool import Pool
from multiprocessing.pool import ThreadPool
from ZIMply.zimply import ZIMFile
import t... | Python | 227 | 47.123348 | 402 | /chunkGenerator.py | 0.577589 | 0.558912 |
strawberryblackhole/hippopotamus | refs/heads/master | from html.parser import HTMLParser
from bs4 import BeautifulSoup
import json
class MyHTMLParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
def feed(self, in_html, zimFile, barrelPositionList, booksPerBarrel, chunkList, target_pos):
self._data = [""]
self._formats = [[[]... | Python | 177 | 41.305084 | 190 | /htmlParser.py | 0.534589 | 0.520967 |
strawberryblackhole/hippopotamus | refs/heads/master | from amulet.api.selection import SelectionGroup
from amulet.api.block import Block
from amulet.api.data_types import Dimension
from amulet import log
import amulet_nbt
from amulet.api.block_entity import BlockEntity
from ZIMply.zimply import ZIMFile
import os
import math
import time
from fillWithWiki import getFormate... | Python | 50 | 26.219999 | 118 | /parserTester.py | 0.667647 | 0.652941 |
ViktorMihalik/Save-the-world | refs/heads/main | import random
# ///Welcoming screen///
print("""
Ooooh welcome unknown player. I'm going to destroy all humans! But of course I have to give you a change to defend yourself.
So you suppose to be the savior of the earth? Let ma laugh- HA-HA-HA.
If you would like to save the earth you have to beat me in 4 games.... | Python | 347 | 37.561958 | 240 | /Save the world.py | 0.437791 | 0.430151 |
flinteller/unit_eleven | refs/heads/master | import pygame
import random
class Paddle(pygame.sprite.Sprite):
def __init__(self, main_surface, color, height, width):
"""
This function creates creates a surface using each other params
:param main_surface:
:param color:
:param height:
:param width:
"""
... | Python | 59 | 26.966103 | 87 | /paddle.py | 0.574713 | 0.565638 |
flinteller/unit_eleven | refs/heads/master | import pygame
class Ball(pygame.sprite.Sprite):
def __init__(self, color, window_width, window_height, radius):
# initialize sprite super class
super().__init__()
# finish setting the class variables to the parameters
self.color = color
self.radius = radius
self.w... | Python | 58 | 32.517242 | 112 | /ball.py | 0.581921 | 0.579866 |
flinteller/unit_eleven | refs/heads/master | import pygame
import sys
from pygame.locals import *
import brick
import ball
import paddle
def main():
# Constants that will be used in the program
APPLICATION_WIDTH = 400
APPLICATION_HEIGHT = 600
PADDLE_Y_OFFSET = 30
BRICKS_PER_ROW = 10
BRICK_SEP = 4 # The space between each brick
BRICK... | Python | 149 | 30.523489 | 114 | /breakout.py | 0.572493 | 0.545455 |
rafatmyo/Definition-Creator | refs/heads/master | import re
def main():
try:
print('Exit with Ctrl-C\n')
while True:
print('Please enter your article:')
input_text = input()
# Remove pronounciation, language origin, date of birth, etc.
simplified_text = re.sub('[\(\[].*?[\)\]]', '', input_text)
... | Python | 67 | 30.089552 | 102 | /program.py | 0.553794 | 0.549952 |
thejakeboyd/SEproject | refs/heads/main | from tkinter import *
import random
totalcustomers = 0
seats = []
seatstaken = []
bonly = [109, 110, 111, 112, 113, 114, 115,116, 117, 119, 119, 120]
for x in range(1, 121):
seats.append(x)
alph = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T']
customers = []
s... | Python | 748 | 43.775402 | 159 | /CapitalAirlines.py | 0.529247 | 0.492849 |
sudheermouni/NeckTie | refs/heads/main | from django.db import models
from .doctors import Doctors
from .patients import Patient
class PatentDoctorTb(models.Model):
'''
we can add extra fields here
'''
doctor = models.ForeignKey(Doctors, blank=False, null=False, on_delete=models.CASCADE)
patient = models.ForeignKey(Patient, blank=False... | Python | 13 | 26.692308 | 91 | /Necktie/necktieapp/models/patent_doctorTb.py | 0.736111 | 0.736111 |
sudheermouni/NeckTie | refs/heads/main | # Generated by Django 3.2.8 on 2021-10-28 06:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('necktieapp', '0005_auto_20211028_1129'),
]
operations = [
migrations.AlterField(
model_name='patient',
name='doctor'... | Python | 18 | 24.888889 | 126 | /Necktie/necktieapp/migrations/0006_alter_patient_doctor.py | 0.626609 | 0.560086 |
sudheermouni/NeckTie | refs/heads/main | # Generated by Django 3.2.8 on 2021-10-27 16:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('necktieapp', '0002_alter_doctors_d_phone'),
]
operations = [
migrations.CreateModel(
name='Pati... | Python | 27 | 40.148148 | 117 | /Necktie/necktieapp/migrations/0003_patient.py | 0.59586 | 0.567957 |
sudheermouni/NeckTie | refs/heads/main | from django.db import models
from model_utils import Choices
SPECIALIZATIONS = Choices(
("CD", "Cardiology"),
("GS", "General Surgery"),
("EC", "Endocrinology"),
("NT", "Neonatology"),
)
class Doctors(models.Model):
d_surname = models.CharField(max_length=20, blank=True, null=True)
d_firstnam... | Python | 28 | 30.25 | 86 | /Necktie/necktieapp/models/doctors.py | 0.661714 | 0.649143 |
sudheermouni/NeckTie | refs/heads/main | from .doctor_view import DoctorViewset # noqa: F401
from .patient_view import PatientViewset # noqa: F401 | Python | 2 | 53 | 54 | /Necktie/necktieapp/views/__init__.py | 0.785047 | 0.728972 |
sudheermouni/NeckTie | refs/heads/main | # Generated by Django 3.2.8 on 2021-10-27 16:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('necktieapp', '0003_patient'),
]
operations = [
migrations.RemoveField(
model_name='patient',
... | Python | 31 | 32.354839 | 117 | /Necktie/necktieapp/migrations/0004_auto_20211027_2226.py | 0.596712 | 0.578337 |
sudheermouni/NeckTie | refs/heads/main | # Generated by Django 3.2.8 on 2021-10-28 05:59
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('necktieapp', '0004_auto_20211027_2226'),
]
operations = [
migrations.RenameField(
model_name='doctors',
old_name='d_state',
... | Python | 23 | 21.695652 | 50 | /Necktie/necktieapp/migrations/0005_auto_20211028_1129.py | 0.545977 | 0.48659 |
sudheermouni/NeckTie | refs/heads/main | from .doctor_serializer import DoctorSerializer
from .patient_serializer import PatientSerializer | Python | 2 | 48 | 49 | /Necktie/necktieapp/serializers/__init__.py | 0.886598 | 0.886598 |
sudheermouni/NeckTie | refs/heads/main | # Generated by Django 3.2.8 on 2021-10-27 16:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('necktieapp', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='doctors',
name='d_phone',
... | Python | 18 | 21.388889 | 73 | /Necktie/necktieapp/migrations/0002_alter_doctors_d_phone.py | 0.590571 | 0.538462 |
sudheermouni/NeckTie | refs/heads/main | from django.db import models
from .doctors import Doctors
class Patient(models.Model):
p_surname = models.CharField(max_length=20, blank=True, null=True)
doctor = models.ManyToManyField(Doctors, through="PatentDoctorTb", null=True, blank=True)
p_fullname = models.CharField(max_length=20, blank=True, null... | Python | 16 | 40.5625 | 93 | /Necktie/necktieapp/models/patients.py | 0.71988 | 0.701807 |
sudheermouni/NeckTie | refs/heads/main | from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import viewsets, filters
from rest_framework.permissions import IsAuthenticated
from necktieapp.models import Patient
from necktieapp.serializers import PatientSerializer
class PatientViewset(viewsets.ModelViewSet):
permission_class... | Python | 16 | 41.5 | 89 | /Necktie/necktieapp/views/patient_view.py | 0.767647 | 0.767647 |
sudheermouni/NeckTie | refs/heads/main | from django.contrib import admin
from .models import Doctors, Patient, PatentDoctorTb
admin.site.register(Doctors)
admin.site.register(Patient)
admin.site.register(PatentDoctorTb)
| Python | 7 | 25 | 52 | /Necktie/necktieapp/admin.py | 0.82967 | 0.82967 |
sudheermouni/NeckTie | refs/heads/main | from rest_framework.routers import DefaultRouter
from django.conf.urls import url, include
from necktieapp import views
router = DefaultRouter(trailing_slash=False)
router.register(r'doctors', views.DoctorViewset)
router.register(r'patients', views.PatientViewset)
urlpatterns = [
url(r'^v1/', include(router.urls... | Python | 12 | 26.166666 | 50 | /Necktie/necktieapp/urls.py | 0.784615 | 0.781538 |
sudheermouni/NeckTie | refs/heads/main | from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import viewsets, filters
from rest_framework.permissions import IsAuthenticated
from necktieapp.models import Doctors
from necktieapp.serializers import DoctorSerializer
class DoctorViewset(viewsets.ModelViewSet):
permission_classes... | Python | 16 | 42.625 | 89 | /Necktie/necktieapp/views/doctor_view.py | 0.773639 | 0.773639 |
sudheermouni/NeckTie | refs/heads/main | import random
import string
from django.core.management.base import BaseCommand
from django.utils.crypto import get_random_string
from necktieapp.models import Doctors
sample_data = {
'd_surname': get_random_string(),
'd_firstname': get_random_string(),
'd_username': "",
'd_phone': get_random_string(... | Python | 35 | 28.942858 | 108 | /Necktie/necktieapp/management/commands/bulk_create.py | 0.651718 | 0.645038 |
sudheermouni/NeckTie | refs/heads/main | from django.test import TestCase, TransactionTestCase
from necktieapp.models import Doctors
sample_data = {
'd_surname': "sudheer",
'd_firstname': "mandi",
'd_username': "smre",
'd_phone': "7702231789",
'd_address': "Ramalingapuram",
'd_country': "India",
'd_specialization': "CD",
'd_pi... | Python | 37 | 30.837837 | 62 | /Necktie/necktieapp/tests/test_doctors.py | 0.64207 | 0.610687 |
sudheermouni/NeckTie | refs/heads/main | from rest_framework import serializers
from necktieapp.models import Doctors
class DoctorSerializer(serializers.ModelSerializer):
class Meta:
model = Doctors
fields = "__all__" | Python | 7 | 27.285715 | 52 | /Necktie/necktieapp/serializers/doctor_serializer.py | 0.730964 | 0.730964 |
sudheermouni/NeckTie | refs/heads/main | # Generated by Django 3.2.8 on 2021-10-27 15:55
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Doctors',
fields=[
('id', models.BigAutoFie... | Python | 28 | 38.785713 | 167 | /Necktie/necktieapp/migrations/0001_initial.py | 0.566427 | 0.544883 |
sudheermouni/NeckTie | refs/heads/main | from django.apps import AppConfig
class NecktieappConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'necktieapp'
| Python | 6 | 24.333334 | 56 | /Necktie/necktieapp/apps.py | 0.756579 | 0.756579 |
sudheermouni/NeckTie | refs/heads/main | from .doctors import Doctors
from .patients import Patient
from .patent_doctorTb import PatentDoctorTb
| Python | 3 | 33.333332 | 43 | /Necktie/necktieapp/models/__init__.py | 0.84466 | 0.84466 |
AlexsandroMO/Bitcoin | refs/heads/master | import pandas as pd
import pandasql as pdsql
import sqlite3
from datetime import date
from datetime import datetime
import CreateTable_SQL
#--------------------------------------------
#Adicionar dados no banco - VarBitcoin
def add_var_bitcoin(btc_last,btc_buy,btc_sell,date_btc):
# CreateTable_SQL.crea... | Python | 61 | 22.622952 | 88 | /Write_SQL.py | 0.622503 | 0.61984 |
AlexsandroMO/Bitcoin | refs/heads/master |
from django.contrib import admin
from .models import TypeWallet, MYWallet
class ListaMYWallet(admin.ModelAdmin):
list_display = ('name_wallet','var_wallet','type_wallet','log_create')
admin.site.register(TypeWallet)
admin.site.register(MYWallet, ListaMYWallet)
| Python | 9 | 28.777779 | 74 | /coin/admin.py | 0.749104 | 0.749104 |
AlexsandroMO/Bitcoin | refs/heads/master | import pandas as pd
import pandasql as pdsql
import sqlite3
from datetime import date
from datetime import datetime
import os
def verify():
directory = 'DB'
dir = directory
if not os.path.exists(directory):
os.makedirs(dir)
#-------------------------------------------------------
... | Python | 70 | 16.914286 | 56 | /CreateTable_SQL.py | 0.543873 | 0.541604 |
AlexsandroMO/Bitcoin | refs/heads/master | import pandas as pd
import pandasql as pdsql
import sqlite3
from datetime import date
from datetime import datetime
def read_sql_btc():
conn = sqlite3.connect('DB/DB_COINS.db')
sql_datas = f"""
SELECT * FROM VARBTC;
"""
read_db = pd.read_sql_query(sql_datas, conn)
co... | Python | 33 | 15.69697 | 46 | /Read_SQL.py | 0.589347 | 0.584192 |
AlexsandroMO/Bitcoin | refs/heads/master | from django.test import TestCase
# pip install django-crispy-forms
'''Upload documents on Github
git clone <nome>
<entra na pasta criada>
git add .
git commit -m "texto"
git push
''' | Python | 17 | 10.235294 | 33 | /coin/tests.py | 0.660194 | 0.660194 |
kawa-kokosowa/urlink | refs/heads/master | # builtin
import datetime
# 3rd party
import flask_sqlalchemy
import flask_user
db = flask_sqlalchemy.SQLAlchemy()
class User(db.Model, flask_user.UserMixin):
"""Generic User data model for flask_user as seen
in their documentation.
http://pythonhosted.org/Flask-User/basic_app.html
"""
id = ... | Python | 83 | 30.084337 | 104 | /models.py | 0.626744 | 0.617829 |
kawa-kokosowa/urlink | refs/heads/master | """urlink Flask App
"""
# builtin
import os
# local
import models
import config
import urlhelper
# 3rd party/pip
import flask
import flask_mail
import flask_user
import flask_login
import flask_script
import flask_migrate
import sqlalchemy
import wtforms
# flask app setup
app = flask.Flask(__name__)
app.config.fr... | Python | 193 | 26.699482 | 83 | /app.py | 0.618032 | 0.616723 |
kawa-kokosowa/urlink | refs/heads/master | """empty message
Revision ID: a77719286100
Revises: ae0cb4fef303
Create Date: 2016-10-03 13:03:02.448316
"""
# revision identifiers, used by Alembic.
revision = 'a77719286100'
down_revision = 'ae0cb4fef303'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | Python | 26 | 21.461538 | 73 | /migrations/versions/a77719286100_.py | 0.669521 | 0.597603 |
kawa-kokosowa/urlink | refs/heads/master | """Get as much info as possible about a URL.
"""
import mimetypes
import requests
import bs4
MAXIMUM_REDIRECTS = 4
FIELDS = [
{
'name': 'title',
'soup_find': ('title', {}),
},
]
_session = requests.Session()
class MaxRedirectError(Exception):
def __init__(self):
self.message... | Python | 149 | 29.852348 | 86 | /urlhelper.py | 0.63759 | 0.628671 |
kawa-kokosowa/urlink | refs/heads/master | """Really sloppy configuration that will be overhauled
to include environment-specific configs (develop, test, production).
Mostly due to a Heroku headache.
"""
import os
DEBUG = False
TESTING = False
SECRET_KEY = os.getenv('SECRET_KEY')
SQLALCHEMY_DATABASE_URI = os.getenv(
'SQLALCHEMY_DATABASE_URI', # if no... | Python | 42 | 26.404762 | 68 | /config.py | 0.721112 | 0.721112 |
kawa-kokosowa/urlink | refs/heads/master | import unittest
import os
import tempfile
import app
class UrlinkTestCase(unittest.TestCase):
def setUp(self):
"""Deploy the test DB (sqlite).
"""
self.db_handle, app.app.config['DATABASE'] = tempfile.mkstemp()
self.app = app.app.test_client()
with app.app.app_context(... | Python | 31 | 17.032259 | 71 | /tests.py | 0.567084 | 0.567084 |
nakulrathore/Machine-Learning-Projects-ud120 | refs/heads/master | #!/usr/bin/python
def outlierCleaner(predictions, ages, net_worths):
"""
clean away the 10% of points that have the largest
residual errors (different between the prediction
and the actual net worth)
return a list of tuples named cleaned_data where
each tuple is... | Python | 28 | 32.392857 | 81 | /outliers/outlier_cleaner.py | 0.638918 | 0.614984 |
nakulrathore/Machine-Learning-Projects-ud120 | refs/heads/master | #!/usr/bin/python
import pickle
import sys
import matplotlib.pyplot
sys.path.append("../tools/")
from feature_format import featureFormat, targetFeatureSplit
### read in data dictionary, convert to numpy array
data_dict = pickle.load( open("../final_project/final_project_dataset.pkl", "r") )
features = ["... | Python | 51 | 30.294117 | 144 | /outliers/enron_outliers.py | 0.594529 | 0.572644 |
nakulrathore/Machine-Learning-Projects-ud120 | refs/heads/master | #!/usr/bin/python
"""
Starter code for the regression mini-project.
Loads up/formats a modified version of the dataset
(why modified? we've removed some trouble points
that you'll find yourself in the outliers mini-project).
Draws a little scatterplot of the training/testing data
... | Python | 103 | 32.980583 | 123 | /regression/finance_regression.py | 0.657698 | 0.650763 |
Shally1130/CS7641-assignment3 | refs/heads/master | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import datetime as datetime
from sklearn.cluster import KMeans
from sklearn.mixture import GaussianMixture
from sklearn.decomposition import PCA
from sklearn.decomposition import FastICA
from sklearn.random_projection imp... | Python | 685 | 35.80584 | 100 | /abalone.py | 0.626899 | 0.602665 |
kamranrafiq/Automate-Boring-Work | refs/heads/master | import socket
for x in range(0, 65):
try:
ports = socket.getservbyport(x)
print("Port Number ",x, " runs service ", ports.upper())
except:
continue | Python | 7 | 24.714285 | 64 | /Get_Service_By_Ports.py | 0.586592 | 0.569832 |
kamranrafiq/Automate-Boring-Work | refs/heads/master | import random
name = input("What's your name? ")
print("Well! " + name + " I am thinking of a number between 1 and 20.\nYou have 6 tries to guess that number.")
secret_number = random.randint(1,20)
for guesstaken in range(1,7):
guess = int(input("Take a guess: "))
if guess < secret_number:
print("Your guess is ... | Python | 24 | 27.458334 | 124 | /Guess_game.py | 0.688141 | 0.674963 |
kamranrafiq/Automate-Boring-Work | refs/heads/master | import socket
port_numbers = input("Enter the port number: ")
service = socket.getservbyport(int(port_numbers))
print ("Port number",port_numbers,"runs service:", service.upper()) | Python | 5 | 35.200001 | 67 | /Input_port_to_get_service.py | 0.75 | 0.75 |
rafaelawon/pwnable | refs/heads/master | from pwn import *
context.log_level = 'debug'
argvs = ["" for i in range(100)]
argvs[0] = "./input"
argvs[65] = "\x00"
argvs[66] = "\x20\x0a\x0d"
target = process(executable='/home/input2/input', arvs=argvs)
target.interactive()
| Python | 12 | 18.416666 | 61 | /won/input.py | 0.651064 | 0.587234 |
Garlinsk/Password-Locker | refs/heads/main | import unittest #Importing the unittest module
from passlock import User #Importing the user class
from passlock import Credentials
import pyperclip
class TestCredentials(unittest.Testcase):
"""
Test class that defines test cases for the User class.
Args:
unittest.TestCase: TestCase class that he... | Python | 90 | 32.111111 | 89 | /passlock_test.py | 0.621649 | 0.616622 |
Garlinsk/Password-Locker | refs/heads/main | #!/usr/bin/env python3.9
from os import name
from passlock import User
def create_contact(fname,lname,phone,email):
'''
Function to create a new user
'''
new_user = User(fname,lname,phone,email)
return new_user
def save_users(user):
'''
Function to save user
'''
user.save_user()
d... | Python | 40 | 19.65 | 76 | /run.py | 0.637576 | 0.635152 |
Garlinsk/Password-Locker | refs/heads/main | from os import name
import pyperclip
class User:
"""
Class that generates new instances of user.
"""
user_list = [] # Empty user list
def __init__(self, username, password, email):
# docstring removed for simplicity
self.username = username
self.password = password
... | Python | 82 | 23.390244 | 82 | /passlock.py | 0.57314 | 0.57314 |
sarobe/VGDLEntityCreator | refs/heads/master | '''
Video game description language -- parser, framework and core game classes.
@author: Tom Schaul
'''
from random import choice
from collections import defaultdict
import pygame
from tools import Node, indentTreeParser
from vgdl.tools import roundedPoints
class VGDLParser(object):
""" Parses a string into a... | Python | 474 | 37.829113 | 111 | /vgdl/core.py | 0.526136 | 0.519833 |
sarobe/VGDLEntityCreator | refs/heads/master | from vgdl.examples.gridphysics.mazes.mazegames import polarmaze_game, maze_game
from vgdl.examples.gridphysics.mazes.simple import maze_level_1, maze_level_2 | Python | 2 | 78 | 79 | /vgdl/examples/gridphysics/mazes/__init__.py | 0.840764 | 0.828025 |
sarobe/VGDLEntityCreator | refs/heads/master | __author__ = 'Samuel Roberts'
| Python | 1 | 21 | 21 | /entitycreator/__init__.py | 0.454545 | 0.454545 |
sarobe/VGDLEntityCreator | refs/heads/master | import random
from vgdl.core import VGDLParser
UP = (0, -1)
DOWN = (0, 1)
LEFT = (-1, 0)
RIGHT = (1, 0)
BASEDIRS = [UP, LEFT, DOWN, RIGHT]
gravity = 0.5
REPEATS = 1
ACTIONS = 5
ended = False
win = False
def runLunarLander():
# import lunar lander
from vgdl.examples.continuousphysics.lander import lander... | Python | 184 | 26.63587 | 107 | /entitycreator/lunarlandertest.py | 0.644965 | 0.631393 |
yz3007/bigdata | refs/heads/master | with open('result.csv', 'r') as result, open("testdata.csv", 'r') as testdata:
k = 0.0
b = 0.0
result.readline()
testdata.readline()
while 1:
b = b+1
r1 = result.readline()
if r1 == '':
break
else:
r = r1.strip().split(" ")
t = tes... | Python | 17 | 27.411764 | 78 | /accuracy.py | 0.434783 | 0.395445 |
yz3007/bigdata | refs/heads/master | #usr/bin/python2.7
from pyspark import SparkContext
from pyspark import SparkConf
from operator import add
conf = SparkConf().setAppName("expedia_hotel")
sc = SparkContext(conf=conf)
arr = sc.textFile("./traindata.csv")
print arr.take(2)
arr = arr.map(lambda x:x.split(","))
def get_best_hotels_od_ulc(arr):
if ... | Python | 149 | 30.95302 | 150 | /recommend.py | 0.569118 | 0.536134 |
TrackingBird/pfm2png | refs/heads/master | import os
import sys
import re
import numpy as np
from PIL import Image
from matplotlib import pyplot as plt
import cv2
'''
Load a PFM file into a Numpy array. Note that it will have
a shape of H x W, not W x H. Returns a tuple containing the
loaded image and the scale factor from the file.
'''
def load_pfm(file)... | Python | 74 | 24.648649 | 78 | /pfm2png.py | 0.581138 | 0.573762 |
briis/unifiprotect | refs/heads/master | """UniFi Protect Platform."""
from __future__ import annotations
import asyncio
from datetime import timedelta
import logging
from aiohttp import CookieJar
from aiohttp.client_exceptions import ServerDisconnectedError
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONF_HOST... | Python | 241 | 32.875519 | 88 | /custom_components/unifiprotect/__init__.py | 0.640495 | 0.639025 |
briis/unifiprotect | refs/heads/master | """This component provides binary sensors for UniFi Protect."""
from __future__ import annotations
from copy import copy
from dataclasses import dataclass
import logging
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
from ... | Python | 275 | 31.072727 | 88 | /custom_components/unifiprotect/binary_sensor.py | 0.658844 | 0.658503 |
briis/unifiprotect | refs/heads/master | """UniFi Protect Integration services."""
from __future__ import annotations
import asyncio
import functools
from typing import Any
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ATTR_DEVICE_ID
from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassi... | Python | 172 | 32.180233 | 88 | /custom_components/unifiprotect/services.py | 0.684423 | 0.684072 |
briis/unifiprotect | refs/heads/master | """Support for Ubiquiti's UniFi Protect NVR."""
from __future__ import annotations
import logging
from homeassistant.components.button import ButtonDeviceClass, ButtonEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform imp... | Python | 57 | 28.456141 | 83 | /custom_components/unifiprotect/button.py | 0.679571 | 0.679571 |
briis/unifiprotect | refs/heads/master | """UniFi Protect Integration utils."""
from __future__ import annotations
from enum import Enum
from typing import Any
def get_nested_attr(obj: Any, attr: str) -> Any:
"""Fetch a nested attribute."""
attrs = attr.split(".")
value = obj
for key in attrs:
if not hasattr(value, key):
... | Python | 21 | 20.380953 | 48 | /custom_components/unifiprotect/utils.py | 0.616926 | 0.616926 |
briis/unifiprotect | refs/heads/master | """The unifiprotect integration models."""
from __future__ import annotations
from collections.abc import Callable, Coroutine
from dataclasses import dataclass
import logging
from typing import Any
from homeassistant.helpers.entity import EntityDescription
from pyunifiprotect.data import NVR, ProtectAdoptableDeviceMo... | Python | 61 | 34.19672 | 82 | /custom_components/unifiprotect/models.py | 0.673498 | 0.673498 |
marina-kantar/Python-for-Everybody | refs/heads/master | import re
name = input ('Enter file name: ')
if len(name) <= 1 : name = 'mbox-short.txt'
y = list()
handle = open(name)
for line in handle :
line = line.rstrip()
y= y+ re.findall('^From: (\S+@\S+)', line)
if len(y) < 1 : continue
print(y)
| Python | 10 | 24.1 | 46 | /mail_regex.py | 0.581673 | 0.573705 |
marina-kantar/Python-for-Everybody | refs/heads/master | import re
name = input('Enter file name: ')
if len(name) <= 1 : name = 'mbox-short.txt'
handle = open(name)
for line in handle:
line = line.rstrip()
if re.search ('From: ', line):
print(line)
| Python | 8 | 25 | 43 | /first_regex.py | 0.605769 | 0.600962 |
marina-kantar/Python-for-Everybody | refs/heads/master | # Write a Python program to display the content of robot.txt for en.wikipedia.org.
import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
import ssl
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
html= urllib.request.urlopen('http://en.wikipedia... | Python | 14 | 28.428572 | 86 | /open_text_from_page.py | 0.767554 | 0.765133 |
marina-kantar/Python-for-Everybody | refs/heads/master | import sqlite3
conn = sqlite3.connect('music.sqlite')
cur = conn.cursor ()
cur.execute('DROP TABLE IF EXISTS Tracks')
cur.execute('CREATE TABLE Tracks (title TEXT, plays INTEGER)')
cur.execute('INSERT INTO Tracks (title, plays) VALUES (?, ?)', ('My Way', 15))
cur.execute('INSERT INTO Tracks (title, plays) VALUES (?,... | Python | 24 | 25.583334 | 84 | /first_db.py | 0.695447 | 0.682889 |
marina-kantar/Python-for-Everybody | refs/heads/master | import re
name = input ('Enter file name: ')
if len(name) <=1 : name = 'mbox-short.txt'
handle = open(name)
y = list()
for line in handle :
line = line.rstrip()
y = y+ re.findall ('^From .+ ([0-9]+:[0-9]+:[0-9]+)', line)
if len(y) < 1 : continue
print(y)
| Python | 10 | 25.700001 | 63 | /time_regex.py | 0.561798 | 0.531835 |
marina-kantar/Python-for-Everybody | refs/heads/master | import re
name = input('Enter file name: ')
if len(name) <= 1 : name = 'exp.txt'
handle = open(name)
for line in handle :
line = line.rstrip()
y = re.findall('[0-9][0-9][0-9][0-9]* [0-9][0-9][0-9][0-9]* [0-9][0-9][0-9][0-9]*', line)
if len(y) < 1 : continue
print(y) | Python | 9 | 30.444445 | 93 | /phone_regex.py | 0.539007 | 0.446809 |
marina-kantar/Python-for-Everybody | refs/heads/master | import sqlite3
import re
conn = sqlite3.connect('domsql.sqlite')
cur = conn.cursor()
cur.execute('DROP TABLE IF EXISTS Counts')
cur.execute('CREATE TABLE Counts (org TEXT, count INTEGER)')
fname = input('Enter file name: ')
if len(fname)< 1 : fname = 'mbox.txt'
handle = open(fname)
for line in handle :
line = l... | Python | 33 | 26 | 80 | /sql_assignment.py | 0.632584 | 0.620225 |
marina-kantar/Python-for-Everybody | refs/heads/master | #Write a Python program to get the number of datasets currently listed on data.gov.
from bs4 import BeautifulSoup
import requests
source = requests.get('https://www.data.gov/').text
soup = BeautifulSoup(source, 'html.parser')
#print(soup.prettify)
x = soup.small.a.text
#print(x)
l =x.split()
print('Number of datase... | Python | 14 | 25.071428 | 83 | /number_of_datasets.py | 0.714286 | 0.708995 |
marina-kantar/Python-for-Everybody | refs/heads/master | import xml.etree.ElementTree as ET
data = '''
<person>
<name> Chuck </name>
<phone type="init">
+1 73 4465 789
</phone>
<email hide="yes"/>
</person>'''
tree = ET.fromstring(data)
print('Name: ', tree.find('name').text)
print('Atrr: ', tree.find('email').get('hide')... | Python | 14 | 22 | 47 | /xml1.py | 0.535826 | 0.504673 |
marina-kantar/Python-for-Everybody | refs/heads/master | import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
import ssl
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
url = input ('Enter - ')
html = urllib.request.urlopen(url, context=ctx).read()
soup = BeautifulSoup(html, 'html.parser')
suma = 0
co... | Python | 21 | 23.333334 | 54 | /assignment_beaut_soup.py | 0.694716 | 0.682975 |
marina-kantar/Python-for-Everybody | refs/heads/master | # To run this, download the BeautifulSoup zip file
# http://www.py4e.com/code3/bs4.zip
# and unzip it in the same directory as this file
import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
import ssl
# Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = Fa... | Python | 39 | 23.179487 | 58 | /assignment2_beautiful_soup.py | 0.669141 | 0.656416 |
marina-kantar/Python-for-Everybody | refs/heads/master | import re
y = list()
zbir = 0
name = input('Enter file name: ')
if len(name) <=1 : name = 'regex_sum_468299.txt'
handle = open(name)
for line in handle :
line = line.rstrip()
y=y+ re.findall('[0-9]+', line)
#print(y)
for i in y :
zbir = zbir + int(i)
print(zbir)
| Python | 13 | 20.153847 | 48 | /assigment-regulare.py | 0.6 | 0.563636 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.