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 |
|---|---|---|---|---|---|---|---|---|---|
lukemadera/ml-learning | refs/heads/master | import copy
import random
def findIndex(array1, key, value):
return find_index(array1, key, value)
def find_index(array1, key, value):
for index, arr_item in enumerate(array1):
if key in arr_item and arr_item[key] == value:
return index
return -1
def extend_object(default, new):
f... | Python | 97 | 26.216496 | 95 | /lodash.py | 0.598485 | 0.577273 |
andrew-li729/CIS-2348-Homework-3 | refs/heads/master | # Andrew Li
# 1824794
class FoodItem:
def __init__(self, name="None", fat=0, carbs=0, protein=0):
self.name = name
self.fat = fat
self.carbs = carbs
self.protein = protein
def get_calories(self, num_servings):
# Calorie formula
calories = ((self.fat * 9) + (self.... | Python | 37 | 33.432434 | 99 | /Lab_10.11.py | 0.596863 | 0.573333 |
andrew-li729/CIS-2348-Homework-3 | refs/heads/master | # Andrew Li
# 1824794
class ItemToPurchase:
def __init__(self, item_name="none", item_price=0, item_quantity=0, item_description="none"):
self.item_name = item_name
self.item_price = item_price
self.item_quantity = item_quantity
self.item_description = item_description
def prin... | Python | 141 | 34.914894 | 114 | /Lab_10.19.py | 0.563784 | 0.559439 |
andrew-li729/CIS-2348-Homework-3 | refs/heads/master | # Andrew Li
# 1824794
player_dict = {}
key_list = []
option = ''
# gets user input and adds to dictionary
for i in range(1, 6):
jersey_num = input("Enter player {}'s jersey number:\n".format(i))
player_rating = input("Enter player {}'s rating:\n".format(i))
print()
player_dict[jersey_num] = player_rat... | Python | 66 | 29.5 | 114 | /Lab_11.27.py | 0.590164 | 0.585693 |
andrew-li729/CIS-2348-Homework-3 | refs/heads/master | # Andrew Li
# 1824794
input_list = input().split(" ")
for i in range(0, len(input_list)):
input_list[i] = int(input_list[i])
input_list.sort()
# print(input_list) # for debugging
for num in input_list:
if num >= 0:
print(num, end=' ')
| Python | 12 | 19.916666 | 38 | /Lab_11.18.py | 0.59761 | 0.561753 |
andrew-li729/CIS-2348-Homework-3 | refs/heads/master | # Andrew Li
# 1824794
input_list = input().split(" ")
for word in input_list:
print(word, input_list.count(word))
| Python | 7 | 15.714286 | 39 | /Lab_11.22.py | 0.630252 | 0.571429 |
andrew-li729/CIS-2348-Homework-3 | refs/heads/master | # Andrew Li
# 1824794
class ItemToPurchase:
def __init__(self, item_name="none", item_price=0, item_quantity=0):
self.item_name = item_name
self.item_price = item_price
self.item_quantity = item_quantity
def print_item_cost(self):
print("{} {} @ ${:.0f} = ${:.0f}".format(self.i... | Python | 37 | 32.675674 | 140 | /Lab_10.17.py | 0.630819 | 0.605136 |
grizzlypeaksoftware/tankbot | refs/heads/master | import RPi.GPIO as GPIO
from time import sleep
def Init():
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(3,GPIO.OUT,initial=GPIO.LOW) #blue
GPIO.setup(5,GPIO.OUT,initial=GPIO.LOW) #green
GPIO.setup(16,GPIO.OUT,initial=GPIO.LOW) #yellow
GPIO.setup(18,GPIO.OUT,initial=GPIO.LOW) #orange
Welcome... | Python | 85 | 14.42353 | 51 | /tankbot.py | 0.677863 | 0.635114 |
grizzlypeaksoftware/tankbot | refs/heads/master | import tankbot
import keyboard
import time as _time
tankbot.Init()
recorded = []
recording_started = False
def ControlSwitch(key, event):
global recording_started
#print(key)
#print(event.event_type)
if key == "s":
tankbot.Stop()
if key == "up":
tankbot.Forward()
if key == "down":
tankbot.Reverse()
if... | Python | 81 | 19.790123 | 69 | /bot.py | 0.649644 | 0.646081 |
lopuhin/scrapy-s3-bench | refs/heads/master | # -*- coding: utf-8 -*-
BOT_NAME = 's3bench'
SPIDER_MODULES = ['s3bench.spiders']
NEWSPIDER_MODULE = 's3bench.spiders'
USER_AGENT = (
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) '
'AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/51.0.2704.84 Safari/537.36')
ROBOTSTXT_OBEY = False
CONCURRENT_REQUE... | Python | 29 | 19.068966 | 60 | /s3bench/settings.py | 0.702749 | 0.621993 |
lopuhin/scrapy-s3-bench | refs/heads/master | # -*- coding: utf-8 -*-
import os.path
import scrapy
from scrapy.linkextractors import LinkExtractor
import vmprof
class Spider(scrapy.Spider):
name = 'spider'
def __init__(self):
with open(os.path.join(
os.path.dirname(__file__), '..', 'top-1k.txt')) as f:
self.start_ur... | Python | 55 | 28.163637 | 79 | /s3bench/spiders.py | 0.561097 | 0.558603 |
akabaker/firmware_state | refs/heads/master | #!/usr/bin/python -tt
from elementtree import ElementTree
from subprocess import Popen, PIPE
from urllib2 import urlopen, URLError, HTTPError
from socket import gethostname
from email import MIMEMultipart, MIMEText
import smtplib
import yaml
import re
class Omreport:
"""
Use omreport to determine if system firmware ... | Python | 135 | 25.200001 | 117 | /firmwarestate.py | 0.666101 | 0.663274 |
Leovilhena/mailbox2fs | refs/heads/master | import os
import email
import imaplib
import logging
import traceback
from time import sleep
from typing import Tuple
from pathlib import Path
from functools import wraps
# Global variables
SERVER = os.environ.get('FASTMAIL_IMAP_HOST', 'imap.fastmail.com')
PORT = os.environ.get('FASTMAIL_IMAP_PORT', 993)
USER = os.env... | Python | 235 | 32.136169 | 112 | /app/main.py | 0.634262 | 0.629896 |
yoongyo/TsF | refs/heads/master | from .models import Post
from django import forms
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = [
'title',
'Tourtype',
'Country',
'City',
'Language',
'DetailContent',
'BriefContent',
... | Python | 36 | 20.527779 | 40 | /ch1/travel/forms.py | 0.420645 | 0.420645 |
moozer/ProItsScripts | refs/heads/master | #!/usr/bin/env python
# pushes data to a given server
from ftplib import FTP, FTP_TLS
import sys
import os
import paramiko
FilesToPut = ['../php/basedata.php']
def Push( FtpServer, Username, Password, uploadlist = FilesToPut, port = 21, passive = False, Sftp = False ):
print "Login to %s:%s using %s:%s (%s)... | Python | 51 | 29.274509 | 109 | /scripts/PushToFtp.py | 0.573187 | 0.567358 |
moozer/ProItsScripts | refs/heads/master | #!/usr/bin/env python
import sys
import urllib2
import json
def FetchBaseData( URL ):
print 'Fetching basedata from %s :'%(URL,)
# fetch data
req = urllib2.Request(URL)
response = urllib2.urlopen(req)
jsondata = response.read()
response.close()
# parsing json
data = json.loads( jsondata )
print 'Data... | Python | 38 | 16.473684 | 117 | /scripts/CheckBaseData.py | 0.635277 | 0.623318 |
moozer/ProItsScripts | refs/heads/master | #!/usr/bin/env python
# reads config and pushes data
import ConfigParser
from CheckBaseData import FetchBaseData
Grouplist = "../grouplist.txt"
GroupNames = ["Group01", "Group02", "Group03", "Group04", "Group05", "Group06", "Group07", "Group08" ]
if __name__ == "__main__":
#config = ConfigParser.ConfigParser()
... | Python | 23 | 24.652174 | 102 | /scripts/ReadAllBase.py | 0.692047 | 0.664975 |
moozer/ProItsScripts | refs/heads/master | #!/usr/bin/env python
# reads config and pushes data
import ConfigParser
from PushToFtp import Push
Grouplist = "../grouplist.txt"
GroupNames = ["Group01", "Group02", "Group03", "Group04", "Group05", "Group06", "Group07", "Group08" ]
if __name__ == "__main__":
#config = ConfigParser.ConfigParser()
config = Confi... | Python | 31 | 30.096775 | 102 | /scripts/PushAll.py | 0.658031 | 0.639378 |
stvncrn/stockx_api_ref | refs/heads/master | from __future__ import print_function
import time
import io_stockx
from io_stockx.rest import ApiException
from pprint import pprint
class ExampleConstants:
AWS_API_KEY = "<API Key>"
STOCKX_USERNAME = "<StockX Username>"
STOCKX_PASSWORD = "<StockX Password>"
DEMO_PRODUCT_ID = "air-jordan-1-retro-hi... | Python | 21 | 19.666666 | 65 | /sdk/python/src/example_constants.py | 0.699769 | 0.681293 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 1,554 | 36.826256 | 176 | /sdk/python/lib/build/lib/io_stockx/api/stock_x_api.py | 0.572488 | 0.561686 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 1,022 | 29.807241 | 822 | /sdk/python/lib/io_stockx/models/market_data_market.py | 0.608099 | 0.595935 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 166 | 26.728916 | 176 | /sdk/python/lib/build/lib/io_stockx/models/product_info_attributes.py | 0.571149 | 0.559852 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 242 | 27.652893 | 176 | /sdk/python/lib/io_stockx/models/portfolio_request_portfolio_item.py | 0.587395 | 0.576868 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 320 | 26.88125 | 202 | /sdk/python/lib/io_stockx/models/address_object.py | 0.577785 | 0.564335 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 137 | 20.489052 | 176 | /sdk/python/lib/test/test_stock_x_api.py | 0.584579 | 0.57303 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 356 | 30.960674 | 198 | /sdk/python/lib/io_stockx/models/portfolio_id_del_response_portfolio_item_merchant.py | 0.612674 | 0.600457 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 190 | 27.168421 | 176 | /sdk/python/lib/build/lib/io_stockx/models/search_hit_searchable_traits.py | 0.577915 | 0.567638 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 190 | 28.321053 | 176 | /sdk/python/lib/io_stockx/models/customer_object_merchant.py | 0.588045 | 0.578173 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 270 | 26.299999 | 176 | /sdk/python/lib/build/lib/io_stockx/models/billing_object.py | 0.571293 | 0.556641 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 140 | 26.864286 | 176 | /sdk/python/lib/build/lib/io_stockx/models/portfolio_id_del_request.py | 0.554986 | 0.543963 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 194 | 37.082474 | 176 | /sdk/python/lib/build/lib/io_stockx/models/portfolio_id_del_response_portfolio_item_product_shipping.py | 0.647672 | 0.638603 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 1,198 | 33.464943 | 719 | /sdk/python/lib/build/lib/io_stockx/models/portfolioitems_id_get_response_portfolio_item_product.py | 0.647218 | 0.634261 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 1,027 | 27.773125 | 707 | /sdk/python/lib/io_stockx/models/customer_object.py | 0.595431 | 0.583012 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
# flake8: noqa
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swag... | Python | 76 | 72.684212 | 176 | /sdk/python/lib/build/lib/io_stockx/models/__init__.py | 0.872143 | 0.870714 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 40 | 30.125 | 176 | /sdk/python/lib/build/lib/test/test_portfolio_id_del_response_portfolio_item_product_media.py | 0.747791 | 0.737349 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 846 | 31.914894 | 515 | /sdk/python/lib/build/lib/io_stockx/models/portfolio_id_del_response_portfolio_item.py | 0.626517 | 0.613122 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 580 | 27.908621 | 354 | /sdk/python/lib/io_stockx/models/product_info_product_attributes.py | 0.600167 | 0.588835 |
stvncrn/stockx_api_ref | refs/heads/master | from __future__ import print_function
import time
import io_stockx
from example_constants import ExampleConstants
from io_stockx.rest import ApiException
from pprint import pprint
# Configure API key authorization: api_key
configuration = io_stockx.Configuration()
configuration.host = "https://gateway.stockx.com/sta... | Python | 71 | 32.549297 | 113 | /sdk/python/src/place_new_lowest_ask_example.py | 0.72628 | 0.699832 |
stvncrn/stockx_api_ref | refs/heads/master | from __future__ import print_function
import time
import io_stockx
from example_constants import ExampleConstants
from io_stockx.rest import ApiException
from pprint import pprint
# Configure API key authorization: api_key
configuration = io_stockx.Configuration()
configuration.host = "https://gateway.stockx.com/stag... | Python | 23 | 35.086956 | 113 | /sdk/python/src/login.py | 0.781928 | 0.781928 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 973 | 26.171635 | 639 | /sdk/python/lib/io_stockx/models/search_hit.py | 0.573795 | 0.559536 |
stvncrn/stockx_api_ref | refs/heads/master | # coding: utf-8
"""
StockX API
PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git... | Python | 140 | 25.478571 | 176 | /sdk/python/lib/build/lib/io_stockx/models/search_results.py | 0.543027 | 0.531427 |
joshling1919/django_polls | refs/heads/master | from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from django.views import generic
from django.utils import timezone
from .models import Answer, Question
def index(request):
latest_question_list = Question.objects.order_by('id')[:2... | Python | 18 | 27 | 63 | /mysite/survey/views.py | 0.75 | 0.740079 |
jlamonade/splitteroni | refs/heads/master | from django.test import TestCase
from django.urls import reverse, resolve
from django.contrib.auth import get_user_model
from .views import HomePageView
# Create your tests here.
class HomepageTests(TestCase):
def setUp(self):
url = reverse('home')
self.response = self.client.get(url)
sel... | Python | 40 | 34.474998 | 104 | /pages/tests.py | 0.664321 | 0.66221 |
jlamonade/splitteroni | refs/heads/master | from django.test import TestCase, RequestFactory
from django.urls import reverse
from django.contrib.auth import get_user_model
from decimal import Decimal
from .models import Bill, Person, Item
# Create your tests here.
class SplitterTests(TestCase):
def setUp(self):
self.user = get_user_model().object... | Python | 149 | 39.328857 | 98 | /splitter/tests.py | 0.645306 | 0.630992 |
jlamonade/splitteroni | refs/heads/master | from django.urls import path
from .views import (
BillCreateView,
BillDetailView,
PersonCreateView,
PersonDeleteView,
BillListView,
ItemCreateView,
ItemDeleteView,
SharedItemCreateView,
BillUpdateView,
BillUpdateTaxPercentView,
BillUpdateTaxAmountView,
BillUpdateTipAmoun... | Python | 53 | 33.188679 | 100 | /splitter/urls.py | 0.646052 | 0.646052 |
jlamonade/splitteroni | refs/heads/master | from django.forms import forms, ModelForm
from django.utils.translation import gettext_lazy as _
from .models import Bill
class BillCreateForm(ModelForm):
class Meta:
model = Bill
fields = ('title', 'tax_percent', 'tip_percent',)
labels = {
'title': _('Name'),
}
... | Python | 88 | 25.625 | 111 | /splitter/forms.py | 0.505978 | 0.505551 |
jlamonade/splitteroni | refs/heads/master | import uuid
from django.db import models
from django.contrib.auth import get_user_model
from django.urls import reverse
from decimal import Decimal
from .utils import _check_tip_tax_then_add
# Create your models here.
class Bill(models.Model):
id = models.UUIDField(
primary_key=True,
default=uuid... | Python | 154 | 32.474026 | 96 | /splitter/models.py | 0.612997 | 0.60388 |
jlamonade/splitteroni | refs/heads/master | # Generated by Django 3.1.2 on 2020-10-09 14:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('splitter', '0004_auto_20201008_2206'),
('splitter', '0004_auto_20201009_1430'),
]
operations = [
]
| Python | 14 | 18.642857 | 48 | /splitter/migrations/0005_merge_20201009_1438.py | 0.629091 | 0.458182 |
jlamonade/splitteroni | refs/heads/master | # Generated by Django 3.1.2 on 2020-10-09 16:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('splitter', '0006_auto_20201009_1603'),
]
operations = [
migrations.AddIndex(
model_name='item',
index=models.Index(f... | Python | 21 | 23.666666 | 70 | /splitter/migrations/0007_auto_20201009_1606.py | 0.569498 | 0.509652 |
jlamonade/splitteroni | refs/heads/master | # Generated by Django 3.1.2 on 2020-10-12 20:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('splitter', '0008_auto_20201011_1907'),
('splitter', '0008_auto_20201011_0301'),
]
operations = [
]
| Python | 14 | 18.642857 | 48 | /splitter/migrations/0009_merge_20201012_2025.py | 0.629091 | 0.458182 |
jlamonade/splitteroni | refs/heads/master | from django.contrib import admin
from .models import Bill, Person, Item
# Register your models here.
admin.site.register(Bill)
admin.site.register(Person)
admin.site.register(Item)
| Python | 7 | 25 | 38 | /splitter/admin.py | 0.796703 | 0.796703 |
jlamonade/splitteroni | refs/heads/master | """
Django settings for config project.
Generated by 'django-admin startproject' using Django 3.1.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib imp... | Python | 191 | 28.020943 | 96 | /config/settings.py | 0.712739 | 0.70498 |
jlamonade/splitteroni | refs/heads/master | # Generated by Django 3.1.2 on 2020-10-08 03:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('splitter', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='item',
name='title',
fie... | Python | 23 | 22.782608 | 73 | /splitter/migrations/0002_auto_20201007_2310.py | 0.559415 | 0.517367 |
jlamonade/splitteroni | refs/heads/master | # Generated by Django 3.1.2 on 2020-10-16 21:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('splitter', '0011_bill_tip_percent'),
]
operations = [
migrations.AddField(
model_name='bill',
name='session',
... | Python | 18 | 21.5 | 73 | /splitter/migrations/0012_bill_session.py | 0.590123 | 0.538272 |
jlamonade/splitteroni | refs/heads/master | from decimal import Decimal
def _check_tip_tax_then_add(self):
# Checks to see if tip or tax is null before adding them to total else it returns 0
total = 0
tip = self.get_tip_amount()
tax = self.get_tax_amount()
if tip:
total += tip
if tax:
total += tax
return Decimal(tota... | Python | 13 | 23.846153 | 87 | /splitter/utils.py | 0.622291 | 0.616099 |
jlamonade/splitteroni | refs/heads/master | from django.apps import AppConfig
class SplitterConfig(AppConfig):
name = 'splitter'
| Python | 5 | 17.200001 | 33 | /splitter/apps.py | 0.758242 | 0.758242 |
jlamonade/splitteroni | refs/heads/master | # Generated by Django 3.1.2 on 2020-10-12 14:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('splitter', '0009_merge_20201012_2025'),
]
operations = [
migrations.AddField(
model_name='bill',
name='tax_percent',... | Python | 18 | 23.055555 | 94 | /splitter/migrations/0010_bill_tax_percent.py | 0.605081 | 0.526559 |
jlamonade/splitteroni | refs/heads/master | # Generated by Django 3.1.2 on 2020-10-08 02:57
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | Python | 51 | 43.313725 | 158 | /splitter/migrations/0001_initial.py | 0.591593 | 0.576991 |
jlamonade/splitteroni | refs/heads/master | # Generated by Django 3.1.2 on 2020-10-09 16:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('splitter', '0005_merge_20201009_1438'),
]
operations = [
migrations.AddIndex(
model_name='bill',
index=models.Index(... | Python | 17 | 20.764706 | 63 | /splitter/migrations/0006_auto_20201009_1603.py | 0.589189 | 0.505405 |
jlamonade/splitteroni | refs/heads/master | from django.views.generic import CreateView, DetailView, DeleteView, ListView, UpdateView
from django.shortcuts import get_object_or_404
from django.urls import reverse_lazy
from django.http import Http404
from decimal import Decimal
from .models import Bill, Person, Item
from .forms import (BillCreateForm,
... | Python | 189 | 30.703703 | 104 | /splitter/views.py | 0.651202 | 0.643858 |
jlamonade/splitteroni | refs/heads/master | from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse, resolve
from .forms import CustomUserCreationForm, CustomUserChangeForm
# Create your tests here.
class CustomUserTests(TestCase):
def test_create_user(self):
User = get_user_model()
u... | Python | 62 | 31.951612 | 72 | /users/tests.py | 0.625857 | 0.622919 |
jlamonade/splitteroni | refs/heads/master | # Generated by Django 3.1.2 on 2020-10-09 02:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('splitter', '0003_auto_20201007_2339'),
]
operations = [
migrations.AlterField(
model_name='bill',
name='tax',
... | Python | 23 | 26.826086 | 105 | /splitter/migrations/0004_auto_20201008_2206.py | 0.589063 | 0.528125 |
jlamonade/splitteroni | refs/heads/master | # Generated by Django 3.1.2 on 2020-10-15 04:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('splitter', '0010_bill_tax_percent'),
]
operations = [
migrations.AddField(
model_name='bill',
name='tip_percent',
... | Python | 18 | 22.888889 | 94 | /splitter/migrations/0011_bill_tip_percent.py | 0.602326 | 0.551163 |
jlamonade/splitteroni | refs/heads/master | # Generated by Django 3.1.2 on 2020-10-08 03:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('splitter', '0002_auto_20201007_2310'),
]
operations = [
migrations.AlterField(
model_name='bill',
name='tax',
... | Python | 23 | 25.869566 | 94 | /splitter/migrations/0003_auto_20201007_2339.py | 0.584142 | 0.524272 |
jlamonade/splitteroni | refs/heads/master | class BillUpdateViewMixin(object):
def form_valid(self, form):
bill = get_object_or_404(Bill, id=self.kwargs['pk'])
form.instance.bill = bill
return super().form_valid(form) | Python | 6 | 32.833332 | 60 | /splitter/mixins.py | 0.643564 | 0.628713 |
sergiypotapov/Selenium2 | refs/heads/master | __author__ = 'spotapov'
import unittest
import string
import random
from selenium import webdriver
class HomePageTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
# create a FF window
cls.driver = webdriver.Firefox()
cls.driver.implicitly_wait(30)
cls.driver.maximize_wi... | Python | 32 | 38.90625 | 123 | /separate_tests.py | 0.641347 | 0.63195 |
sergiypotapov/Selenium2 | refs/heads/master | __author__ = 'spotapov'
import string
import random
#makes random string of 129 characters
def big_text():
text = ''
l = 0
for i in range(0,129):
text += random.choice(string.ascii_letters)
print(text)
for k in text:
l = l + 1
print(l)
big_text()
| Python | 18 | 15.166667 | 51 | /text.py | 0.582192 | 0.55137 |
sergiypotapov/Selenium2 | refs/heads/master | __author__ = 'spotapov'
import unittest
import string
import random
from selenium import webdriver
class HomePageTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
# create a FF window
cls.driver = webdriver.Firefox()
cls.driver.implicitly_wait(30)
cls.driver.maximize_wi... | Python | 108 | 40.222221 | 123 | /magento.py | 0.643098 | 0.636588 |
kumarkapil/MyVision | refs/heads/master | from tqdm import tqdm
import torch
import numpy as np
from tabulate import tabulate
from ..utils import Meters
from MyVision import metrics
import os
import time
from itertools import chain
import abc
class Trainer:
def __init__(
self,
train_loader,
val_loader,
test_loader,
... | Python | 137 | 25.007299 | 84 | /MyVision/engine/Engine.py | 0.524277 | 0.520067 |
kumarkapil/MyVision | refs/heads/master | import torch
from torch.utils.data import Dataset
from PIL import Image, ImageFile
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
import albumentations as A
import torchvision.transforms as transforms
import operator
ImageFile.LOAD_TRUNCATED_IMAGES = True
class Dataset... | Python | 158 | 26.810127 | 83 | /MyVision/dataset/Dataset.py | 0.544606 | 0.530496 |
kumarkapil/MyVision | refs/heads/master | import pandas as pd
def make_multiclass_labels(df, label_column, start_from):
"""
Takes in a pandas dataframe, the label column & a start index.
makes the categorical labels into integers
You can specify which index to start labelling from 0 or 1.
returns a dictionary mapping the label to it's int... | Python | 21 | 27.238094 | 71 | /MyVision/utils/LabelUtils.py | 0.666105 | 0.659359 |
kamalbec2005/PyVocabi | refs/heads/master | '''
Project: To build vocabulary.
'''
| Python | 3 | 11.666667 | 29 | /main.py | 0.631579 | 0.631579 |
tia-cima/reverse_shell_it | refs/heads/main | import socket, sys, time
def comandi(s):
while(True):
try:
print('''
Digita un qualsiasi comando.
Per uscire dal server e dal progrmma premi "ctrl + c"
''')
com = input("\n--> ")
s.send(com.encode())
... | Python | 47 | 30.042553 | 142 | /client.py | 0.527224 | 0.510624 |
tia-cima/reverse_shell_it | refs/heads/main | import sys, socket, subprocess, time, os
def ricevi(conn):
while(True):
richiesta = conn.recv(1048000)
cmd = richiesta.decode()
if cmd.startswith("cd "):
os.chdir(cmd)
s.send(b"$ ")
continue
risposta = subprocess.run(cmd, shell... | Python | 31 | 30.419355 | 100 | /server.py | 0.577954 | 0.554121 |
jasondentler/zeus-sensors | refs/heads/master | import os
import time
import math
import pygame, sys
from pygame.locals import *
import RPi.GPIO as GPIO
boardRevision = GPIO.RPI_REVISION
GPIO.setmode(GPIO.BCM) # use real GPIO numbering
GPIO.setup(17,GPIO.IN, pull_up_down=GPIO.PUD_UP)
pygame.init()
VIEW_WIDTH = 0
VIEW_HEIGHT = 0
pygame.display.set_caption('Flow')
... | Python | 119 | 29.226891 | 132 | /flow.py | 0.701862 | 0.671853 |
jasondentler/zeus-sensors | refs/heads/master | import os
import glob
import time
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
base_dir = '/sys/bus/w1/devices/'
def get_devices():
devices = glob.glob(base_dir + '28*')
for device in devices:
yield device + '/w1_slave'
def read_temp_raw():
devices = get_devices()
for device in devices:
f = ... | Python | 42 | 20.357143 | 43 | /therm.py | 0.629176 | 0.601336 |
SSRomanSS/flask_blog | refs/heads/master | from blog import app, db, manager
from blog.models import *
if __name__ == '__main__':
manager.run()
| Python | 5 | 20.200001 | 33 | /manage.py | 0.622642 | 0.622642 |
SSRomanSS/flask_blog | refs/heads/master | from flask import Flask, request
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
from flask_login import LoginManager
from flask_bootstrap import Bootstrap
from flask_moment import Moment
from flask_babel import Babel, lazy_gettext as _l
from fl... | Python | 42 | 25.690475 | 71 | /blog/__init__.py | 0.772848 | 0.772848 |
SSRomanSS/flask_blog | refs/heads/master | """fix create followers relationship
Revision ID: 89b140c56c4d
Revises: 7d84ff36825f
Create Date: 2021-03-30 14:57:47.528704
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '89b140c56c4d'
down_revision = '7d84ff36825f'
branch_labels = None
depends_on = None
d... | Python | 33 | 25.878788 | 65 | /migrations/versions/89b140c56c4d_fix_create_followers_relationship.py | 0.669673 | 0.647125 |
SSRomanSS/flask_blog | refs/heads/master | from blog import app, db
from blog import routes, models, errors, set_logger
@app.shell_context_processor
def make_shell_context():
return {
'db': db,
'User': models.User,
'Post': models.Post
}
if __name__ == '__main__':
app.run(debug=True)
| Python | 15 | 17.733334 | 51 | /run.py | 0.590747 | 0.590747 |
SSRomanSS/flask_blog | refs/heads/master | """Add two new column to User
Revision ID: 5e12ea69ab10
Revises: a89dbfef15cc
Create Date: 2021-03-29 20:46:23.445651
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5e12ea69ab10'
down_revision = 'a89dbfef15cc'
branch_labels = None
depends_on = None
def upgr... | Python | 30 | 25.366667 | 87 | /migrations/versions/5e12ea69ab10_add_two_new_column_to_user.py | 0.672566 | 0.620733 |
SSRomanSS/flask_blog | refs/heads/master | from datetime import datetime
from flask import render_template, flash, redirect, url_for, request
from flask_login import current_user, login_user, logout_user, login_required
from flask_babel import _
from werkzeug.urls import url_parse
from blog import app, db
from blog.forms import LoginForm, RegisterForm, EditPr... | Python | 155 | 38.451614 | 118 | /blog/routes.py | 0.652494 | 0.650041 |
Ren-Roros-Digital/django-admin-export-xlsx | refs/heads/main | from openpyxl import Workbook
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from datetime import datetime, date
from openpyxl.styles import Font
from unidecode import unidecode
class ExportExcelAction:
@classmethod
def generate_header(cls, admin, model, list_display):... | Python | 81 | 34.876545 | 109 | /export_xlsx/actions.py | 0.626635 | 0.622849 |
Ren-Roros-Digital/django-admin-export-xlsx | refs/heads/main | from setuptools import setup
setup(
name='django-admin-export-xlsx',
version='1.0.0',
author='Rune Hansén Steinnes',
author_email='rune.steinnes@renroros.no',
packages=['export_xlsx'],
url='http://github.com/Ren-Roros-Digital/django-admin-export-xlsx',
license='LICENSE.txt',
description... | Python | 18 | 26.388889 | 71 | /setup.py | 0.610548 | 0.596349 |
furotsu/turret_game | refs/heads/master | import pygame
import sys
import math
from random import randint, choice
from constants import *
class Player(pygame.sprite.Sprite):
def __init__(self, pos_x, pos_y, screen):
super(Player, self).__init__()
self.screen = screen
self.original_image = pygame.image.load(player_img).convert_alph... | Python | 221 | 33.710407 | 118 | /player.py | 0.5775 | 0.568505 |
furotsu/turret_game | refs/heads/master | import pygame
from constants import *
class MenuButton:
"""Create a button """
def __init__(self, pos_x, pos_y, image, button_type):
self.button_type = button_type
self.image = pygame.image.load(image).convert_alpha()
self.size = self.image.get_rect().size
self.rect_pos = self... | Python | 27 | 25.74074 | 66 | /menu.py | 0.610803 | 0.610803 |
furotsu/turret_game | refs/heads/master | import pygame
from constants import *
class Terrain:
def __init__(self):
pass | Python | 6 | 14.166667 | 23 | /terrain.py | 0.644444 | 0.644444 |
furotsu/turret_game | refs/heads/master | import pygame
from controller import *
from menu import *
from constants import *
def main():
pygame.init()
screen = pygame.display.set_mode((display_width, display_height))
pygame.display.set_caption("Cannon defend v0.08")
clock = pygame.time.Clock()
controller = Controller(screen, pygame.tim... | Python | 36 | 21.916666 | 69 | /main.py | 0.564848 | 0.56 |
furotsu/turret_game | refs/heads/master | import pygame
from constants import *
class Death_screen:
def __init__(self, screen, *buttons):
self.main_block = pygame.Surface((display_width - 200, display_height - 100))
self.main_block.fill(pygame.Color('sienna2'))
self.screen = screen
self.buttons = buttons
def draw(self... | Python | 20 | 32.549999 | 95 | /death_screen.py | 0.622951 | 0.596125 |
furotsu/turret_game | refs/heads/master | import pygame
import sys
import menu
import player
import leaderboard
import death_screen
import terrain
from constants import *
class Controller:
"""
Class that control all game actions
"""
def __init__(self, screen, clock):
self.screen = screen
self.clock = clock
self.g... | Python | 186 | 33.026882 | 118 | /controller.py | 0.565808 | 0.55854 |
furotsu/turret_game | refs/heads/master | import shelve
import pygame
from constants import *
class Leaderboard:
def __init__(self, filename, screen):
self.file = shelve.open(filename)
self.closed = True
self.screen = screen
self.sorted_leaderboard = []
self.text = []
self.rendered_text = []
self.so... | Python | 45 | 34.777779 | 106 | /leaderboard.py | 0.594041 | 0.58473 |
furotsu/turret_game | refs/heads/master | import os.path
display_height = 600
display_width = 1000
CHARGER_HEIGHT = 60
COOLDOWN_WIDTH = 50
PLAYER_POS_X = 50
PLAYER_POS_Y = 430
START_CANNON_ANGLE = 25
MISSILE_POS_X = 70
MISSILE_POS_Y = 470
ACCELERATION = -2
MAX_SHOT_POWER = 50
POWER_CHARGE = 5
COOLDOWN = 40
ENEMY_VELOCITY_X = 0
ENEMY_VELOCITY_Y = 4
TIME_BE... | Python | 55 | 21.581818 | 71 | /constants.py | 0.658085 | 0.577635 |
BlastTNG/flight | refs/heads/master | #!/usr/bin/env /usr/bin/python
#TODO: can keep UID fixed, but should update the time
#to get time: datetime.utcnow().replace(microsecond=0).isoformat(' ')
UID_UTIME = "1\t2008-08-08 08:08:08" #for spider "sbenton" has UID 1
#UID_UTIME = "23\t2008-08-08 08:08:08" #for BLASTpol "sbenton" has UID 23
class Failure(Exc... | Python | 304 | 40.355263 | 87 | /sedpy/sedobjects.py | 0.597519 | 0.590999 |
BlastTNG/flight | refs/heads/master | from pylab import pi
def from_hours(angle):
return angle*pi/12.
def to_hours(angle):
return angle*12./pi
def from_degrees(angle):
return angle*pi/180.
def to_degrees(angle):
return angle*180./pi
def to_arcmin(angle):
return angle*180./pi*60.
def from_arcmin(angle):
return angle/60.*pi/180.... | Python | 25 | 16.24 | 30 | /stars/utilities/imports/python/angles.py | 0.673611 | 0.594907 |
BlastTNG/flight | refs/heads/master | #! /usr/bin/env python
import os
import pylab as pl
import stars_log_parser as parser
def plot_fluxes(solution):
print "plotting flux for", solution.filename
print "solution had fit %d blobs and ignored %d blobs" \
% (solution.fluxer.num_blobs_fit, solution.fluxer.num_blobs_ignored)
print "solutio... | Python | 32 | 34.75 | 82 | /stars/utilities/fluxer/plot_last_fit.py | 0.668122 | 0.659389 |
BlastTNG/flight | refs/heads/master | import os
from angles import *
def get_last_logname(logs_dirname, logtype):
for date_dirname in reversed(sorted(os.listdir(logs_dirname))):
if os.path.isdir(os.path.join(logs_dirname, date_dirname)):
for filename in reversed(sorted(os.listdir(os.path.join(logs_dirname, date_dirname)))):
... | Python | 209 | 35.555023 | 99 | /stars/utilities/imports/python/stars_log_parsing.py | 0.590499 | 0.582908 |
BlastTNG/flight | refs/heads/master | #!/usr/bin/python
import time
import numpy as np
from datetime import datetime
import pygetdata as gd
import soco
DEVICE_ADDRESS = "192.168.0.140"
DATAFILE = "/data/etc/mole.lnk"
sonos = soco.SoCo(DEVICE_ADDRESS)
#sonos = soco.discovery.any_soco()
df = gd.dirfile(DATAFILE, gd.RDONLY)
# find the tracks
def get_curre... | Python | 152 | 30.657894 | 147 | /scripts_gse/sonos_mon.py | 0.661264 | 0.646301 |
BlastTNG/flight | refs/heads/master | #! /usr/bin/python
header_file = "./blast_config/include/command_list.h"
start = False
header_single_commands = []
for line in open(header_file, 'r'):
if line.startswith("enum singleCommand"):
start = True
if start:
if "}" in line:
break
line = line.replace("\n", '')
... | Python | 83 | 38.421688 | 106 | /check_commanding.py | 0.530868 | 0.530868 |
BlastTNG/flight | refs/heads/master | #! /usr/bin/env python
import os
import pylab
import pyfits
image_width = 1536
image_height = 1024
def convert(infilename):
infile = open(infilename, "r")
contents = infile.read()
infile.close()
flat_data = pylab.fromstring(contents, "uint16")
if len(flat_data) != image_width*image_height:
... | Python | 33 | 26.575758 | 103 | /stars/utilities/ebex_images/convert_raw_to_fits.py | 0.636663 | 0.622393 |
BlastTNG/flight | refs/heads/master | #!/usr/bin/env /usr/bin/python
import re
from sedobjects import *
#LABEL -> MATE pins "description" [alpha] [bcd] [M-Mmate] [F-Fmate]
connRE = re.compile(r'^'
r'([A-Z0-9_]{1,16})\s+->\s+' #LABEL
r'([A-Z0-9_]{1,16})\s+' #MATE
r'(\d{1,3})\s+' #pins
r'"([^"]{1,255})"' #description
r'(?:\s*(a... | Python | 119 | 34.941177 | 80 | /sedpy/lineparser.py | 0.55553 | 0.509937 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.