index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
53,015 | daldal-Mango/Miracle30 | refs/heads/main | /main/views.py | from django.shortcuts import render, redirect
from django.utils import *
from .models import Goal
from datetime import datetime
import datetime
def main_login(request):
return render(request, 'main/main_login.html')
def main_logout(request):
return render(request, 'main/main_logout.html')
def goal_main(re... | {"/groups/admin.py": ["/groups/models.py"], "/groups/views.py": ["/main/models.py", "/groups/models.py"], "/groups/models.py": ["/main/models.py"], "/main/admin.py": ["/main/models.py"], "/users/views.py": ["/main/models.py"], "/main/views.py": ["/main/models.py"]} |
53,016 | daldal-Mango/Miracle30 | refs/heads/main | /main/migrations/0001_initial.py | # Generated by Django 3.2.5 on 2021-08-02 02:40
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | {"/groups/admin.py": ["/groups/models.py"], "/groups/views.py": ["/main/models.py", "/groups/models.py"], "/groups/models.py": ["/main/models.py"], "/main/admin.py": ["/main/models.py"], "/users/views.py": ["/main/models.py"], "/main/views.py": ["/main/models.py"]} |
53,017 | daldal-Mango/Miracle30 | refs/heads/main | /groups/migrations/0003_auto_20210809_2345.py | # Generated by Django 3.2.5 on 2021-08-09 23:45
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('main', '0002_alter_goal_value'),
migrations.swappable_dependency(settings.AUTH_USER... | {"/groups/admin.py": ["/groups/models.py"], "/groups/views.py": ["/main/models.py", "/groups/models.py"], "/groups/models.py": ["/main/models.py"], "/main/admin.py": ["/main/models.py"], "/users/views.py": ["/main/models.py"], "/main/views.py": ["/main/models.py"]} |
53,018 | daldal-Mango/Miracle30 | refs/heads/main | /main/urls.py | from django.urls import path
from . import views
app_name = 'main'
urlpatterns = [
path('', views.main_logout, name="main_logout"),
path('login/', views.main_login, name="main_login"),
path('goal_main/', views.goal_main, name="goal_main"),
path('goal_detail/<int:goal_id>', views.goal_detail, name="goal... | {"/groups/admin.py": ["/groups/models.py"], "/groups/views.py": ["/main/models.py", "/groups/models.py"], "/groups/models.py": ["/main/models.py"], "/main/admin.py": ["/main/models.py"], "/users/views.py": ["/main/models.py"], "/main/views.py": ["/main/models.py"]} |
53,019 | daldal-Mango/Miracle30 | refs/heads/main | /groups/templatetags/index.py | from django import template
register = template.Library()
@register.filter
def index_1(indexable, i):
return indexable[i]
@register.filter
def index_2(indexable, i):
return indexable[i+10]
@register.filter
def index_3(indexable, i):
return indexable[i+20]
| {"/groups/admin.py": ["/groups/models.py"], "/groups/views.py": ["/main/models.py", "/groups/models.py"], "/groups/models.py": ["/main/models.py"], "/main/admin.py": ["/main/models.py"], "/users/views.py": ["/main/models.py"], "/main/views.py": ["/main/models.py"]} |
53,020 | mi-magda/WebMonitor | refs/heads/master | /components/logger.py | import logging
class Logger:
# Log format
FORMAT = '%(asctime)-15s %(message)s'
def __init__(self):
logging.basicConfig(level=logging.INFO)
self.log_operator = logging.getLogger(__name__)
self.log_operator.propagate = False
self.handler = logging.FileHandler('log_file.log... | {"/components/scrap_handler.py": ["/components/logger.py"], "/app.py": ["/components/CONFIG.py", "/components/scrap_handler.py"]} |
53,021 | mi-magda/WebMonitor | refs/heads/master | /components/scrap_handler.py | from bs4 import BeautifulSoup
from components.logger import Logger
import urllib.request
from time import time
"""
Class which is responsible for performing operations connected with site status management.
"""
class ScrapOperator(Logger):
START = None
END = None
URL = None
def __init__(self, sites):... | {"/components/scrap_handler.py": ["/components/logger.py"], "/app.py": ["/components/CONFIG.py", "/components/scrap_handler.py"]} |
53,022 | mi-magda/WebMonitor | refs/heads/master | /app.py | from flask import Flask, render_template
import time
import sys
import _thread
from components.CONFIG import CONTENT_REQUIREMENTS, REFRESH_RATE
from components.scrap_handler import ScrapOperator
scrap_operator = ScrapOperator(CONTENT_REQUIREMENTS.keys())
'''
A function which is responsible of looping through all sit... | {"/components/scrap_handler.py": ["/components/logger.py"], "/app.py": ["/components/CONFIG.py", "/components/scrap_handler.py"]} |
53,023 | mi-magda/WebMonitor | refs/heads/master | /components/CONFIG.py | # Checking sites interval
REFRESH_RATE = 5
"""
MANUAL
CONTENT_REQUIREMENTS = {
#search using element#
"SITE_URL": ("ELEMENT", "CLASS", "EXPECTED_VALUE"},
#search by text#
"SITE_URL": ("TEXT", "EMPTY_STRING", "EXPECTED_VALUE")
}
"""
CONTENT_REQUIREMENTS = {
"https://b3ta.com/404": ("a", "clas... | {"/components/scrap_handler.py": ["/components/logger.py"], "/app.py": ["/components/CONFIG.py", "/components/scrap_handler.py"]} |
53,024 | faridi2017/django241018 | refs/heads/master | /victorcalls/victorjango/crm/serializers.py | from rest_framework import serializers
from .models import Documents, Company, Aspnetusers, Leads, Project, Integrations,\
Leaditems, Aspnetroles, Location, Attendance, Refreshtokens, Companytype
class DocumentsSerializer(serializers.ModelSerializer):
class Meta:
model = Documents
fields = '__a... | {"/victorcalls/victorjango/crm/views.py": ["/victorcalls/victorjango/crm/serializers.py"]} |
53,025 | faridi2017/django241018 | refs/heads/master | /victorcalls/victorjango/crm/urls.py | from django.conf.urls import url
from . import views
from django.urls import path
from rest_framework import routers
from rest_framework.urlpatterns import format_suffix_patterns
router = routers.DefaultRouter()
urlpatterns = [
path('companies/', views.CompanyList.as_view()), # get all , post one
path('com... | {"/victorcalls/victorjango/crm/views.py": ["/victorcalls/victorjango/crm/serializers.py"]} |
53,026 | faridi2017/django241018 | refs/heads/master | /victorcalls/victorjango/crm/views.py | from django.shortcuts import render
import flask_excel as excel
from werkzeug.utils import secure_filename
from flask import Flask, request
import pyexcel
import pandas as pd
from rest_framework.response import Response
from rest_framework.views import APIView
from .models import *
from .serializers import *
from djang... | {"/victorcalls/victorjango/crm/views.py": ["/victorcalls/victorjango/crm/serializers.py"]} |
53,045 | roybaroes/PorePressurePrediction | refs/heads/master | /porepressureprediction/velocity/basic/survey.py | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 11 20:24:38 2015
@author: yuhao
"""
from __future__ import division, print_function
import numpy as np
class Survey(object):
"""a survey is a combination of seismic and well logs
"""
def __init__(self, cube):
self.wells = list()
... | {"/porepressureprediction/__init__.py": ["/porepressureprediction/velocity/basic/laSQL.py", "/porepressureprediction/velocity/basic/seiSQL.py", "/porepressureprediction/velocity/basic/survey.py", "/porepressureprediction/velocity/reader.py", "/porepressureprediction/stochastic/krig.py", "/porepressureprediction/velocit... |
53,046 | roybaroes/PorePressurePrediction | refs/heads/master | /porepressureprediction/velocity/basic/laSQL.py | # -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
from las import LASReader
import json
import sqlite3
import os
class Well(object):
"""class for storing well log data with database file
This Well class stores the well log data in associated database files,
stores th... | {"/porepressureprediction/__init__.py": ["/porepressureprediction/velocity/basic/laSQL.py", "/porepressureprediction/velocity/basic/seiSQL.py", "/porepressureprediction/velocity/basic/survey.py", "/porepressureprediction/velocity/reader.py", "/porepressureprediction/stochastic/krig.py", "/porepressureprediction/velocit... |
53,047 | roybaroes/PorePressurePrediction | refs/heads/master | /porepressureprediction/velocity/conversion.py | from __future__ import division
import numpy as np
from scipy import interpolate
def rms2int(twt, rms):
"""
Convert rms velocity to interval velocity
Parameters
----------
twt : 1-d ndarray
input two-way-time array
rms : 1-d nadarray
rms velocity array
Ret... | {"/porepressureprediction/__init__.py": ["/porepressureprediction/velocity/basic/laSQL.py", "/porepressureprediction/velocity/basic/seiSQL.py", "/porepressureprediction/velocity/basic/survey.py", "/porepressureprediction/velocity/reader.py", "/porepressureprediction/stochastic/krig.py", "/porepressureprediction/velocit... |
53,048 | roybaroes/PorePressurePrediction | refs/heads/master | /porepressureprediction/velocity/basic/seiSQL.py | # -*- coding: utf-8 -*-
from __future__ import division, print_function
import sqlite3
import os
import json
import numpy as np
class SeisCube():
def __init__(self, db, js):
self.db_file = db
self.json_file = js
if self.json_file is not None:
self._readJSON()
... | {"/porepressureprediction/__init__.py": ["/porepressureprediction/velocity/basic/laSQL.py", "/porepressureprediction/velocity/basic/seiSQL.py", "/porepressureprediction/velocity/basic/survey.py", "/porepressureprediction/velocity/reader.py", "/porepressureprediction/stochastic/krig.py", "/porepressureprediction/velocit... |
53,049 | roybaroes/PorePressurePrediction | refs/heads/master | /porepressureprediction/stochastic/FFT_MA.py | '''
1. Building of the sampled covariance C (Fig. 1).
2. Generation of the normal deviates z on the grid.
3. Calculation of the Fourier transforms of z and C, giving Z and the power
spectrum S, respectively.
4. Derivation of G from S.
5. Multiplication of G by Z.
6. Inverse Fourier transform of (G * Z) giving... | {"/porepressureprediction/__init__.py": ["/porepressureprediction/velocity/basic/laSQL.py", "/porepressureprediction/velocity/basic/seiSQL.py", "/porepressureprediction/velocity/basic/survey.py", "/porepressureprediction/velocity/reader.py", "/porepressureprediction/stochastic/krig.py", "/porepressureprediction/velocit... |
53,050 | roybaroes/PorePressurePrediction | refs/heads/master | /porepressureprediction/__init__.py | from porepressureprediction.velocity.basic.laSQL import Well
from porepressureprediction.velocity.basic.seiSQL import SeisCube
from porepressureprediction.velocity.basic.survey import Survey
from porepressureprediction.velocity.reader import Reader
from porepressureprediction.velocity.smoothing import smooth, smoot... | {"/porepressureprediction/__init__.py": ["/porepressureprediction/velocity/basic/laSQL.py", "/porepressureprediction/velocity/basic/seiSQL.py", "/porepressureprediction/velocity/basic/survey.py", "/porepressureprediction/velocity/reader.py", "/porepressureprediction/stochastic/krig.py", "/porepressureprediction/velocit... |
53,051 | roybaroes/PorePressurePrediction | refs/heads/master | /porepressureprediction/stochastic/krig.py | # -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
from scipy.spatial.distance import pdist, squareform
from scipy.optimize import leastsq
import matplotlib.pyplot as plt
import matplotlib
class Krig(object):
def __init__(self, mesh, points, model='spherical', bw=500, info=None... | {"/porepressureprediction/__init__.py": ["/porepressureprediction/velocity/basic/laSQL.py", "/porepressureprediction/velocity/basic/seiSQL.py", "/porepressureprediction/velocity/basic/survey.py", "/porepressureprediction/velocity/reader.py", "/porepressureprediction/stochastic/krig.py", "/porepressureprediction/velocit... |
53,052 | roybaroes/PorePressurePrediction | refs/heads/master | /porepressureprediction/stochastic/autocorrelation.py | '''
different kind of autocorrelation functions
'''
import numpy as np
def autocorrelation_fuction(x, z, a, b, r):
return np.exp(-(x**2/a**2+z**2/b**2)**(1.0/(r+1)))
def exponential(x, z, a, b):
return np.exp(-(x**2/a**2+z**2/b**2)**(1./2.))
def gaussian(x, z, a, b):
return np.exp(-(x**2/a**2+z**2... | {"/porepressureprediction/__init__.py": ["/porepressureprediction/velocity/basic/laSQL.py", "/porepressureprediction/velocity/basic/seiSQL.py", "/porepressureprediction/velocity/basic/survey.py", "/porepressureprediction/velocity/reader.py", "/porepressureprediction/stochastic/krig.py", "/porepressureprediction/velocit... |
53,053 | roybaroes/PorePressurePrediction | refs/heads/master | /porepressureprediction/velocity/basic/__init__.py | __all__ = ['laSQL', 'seiSQL', 'survey']
| {"/porepressureprediction/__init__.py": ["/porepressureprediction/velocity/basic/laSQL.py", "/porepressureprediction/velocity/basic/seiSQL.py", "/porepressureprediction/velocity/basic/survey.py", "/porepressureprediction/velocity/reader.py", "/porepressureprediction/stochastic/krig.py", "/porepressureprediction/velocit... |
53,054 | roybaroes/PorePressurePrediction | refs/heads/master | /porepressureprediction/velocity/reader.py | import sqlite3
class Reader(object):
"""class to create sqlite database with text file
"""
def __init__(self, db_name=None):
self.db_file = str(db_name) + ".db" if db_name is not None \
else "new_db.db"
self._create_db()
def _create_db(self):
f = open(s... | {"/porepressureprediction/__init__.py": ["/porepressureprediction/velocity/basic/laSQL.py", "/porepressureprediction/velocity/basic/seiSQL.py", "/porepressureprediction/velocity/basic/survey.py", "/porepressureprediction/velocity/reader.py", "/porepressureprediction/stochastic/krig.py", "/porepressureprediction/velocit... |
53,055 | roybaroes/PorePressurePrediction | refs/heads/master | /porepressureprediction/pressure/pore_pressure.py | """routines to assist velocity data processing.
"""
import numpy as np
def bowers(v, obp, v0=5000, a=9.18448, b=0.764984):
"""
Compute pressure using Bowers equation.
Parameters
----------
v : 1-d ndarray
velocity array whose unit is m/s.
obp : 1-d ndarray
Overbu... | {"/porepressureprediction/__init__.py": ["/porepressureprediction/velocity/basic/laSQL.py", "/porepressureprediction/velocity/basic/seiSQL.py", "/porepressureprediction/velocity/basic/survey.py", "/porepressureprediction/velocity/reader.py", "/porepressureprediction/stochastic/krig.py", "/porepressureprediction/velocit... |
53,056 | OverYoung/WidebandSatelliteFlowMonitor | refs/heads/master | /mail.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2018-11-09 11:18
# @Author : Yangzan
# @File : main.py
from email import encoders
from email.header import Header
from email.mime.text import MIMEText
from email.utils import parseaddr, formataddr
import smtplib
import os
import traceback
import configparser
... | {"/main.py": ["/log.py", "/configLoad.py", "/satelliteFlow.py", "/database.py"], "/satelliteFlow.py": ["/log.py"]} |
53,057 | OverYoung/WidebandSatelliteFlowMonitor | refs/heads/master | /log.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2018-11-07 10:58
# @Author : Yangzan
# @File : log.py
import logging
import datetime
import logging.handlers
class myLogger():
#-----------------初始化日志类------------------#
def __init__(self, loggerName):
#创建一个logger
self.logger = loggin... | {"/main.py": ["/log.py", "/configLoad.py", "/satelliteFlow.py", "/database.py"], "/satelliteFlow.py": ["/log.py"]} |
53,058 | OverYoung/WidebandSatelliteFlowMonitor | refs/heads/master | /configLoad.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2018-11-08 11:46
# @Author : Yangzan
# @File : configLoad.py
import os
import configparser
import traceback
def getConfig(logger):
# --------------------------读取配置文件------------------------#
# 拼接配置文件路径
logger.info('开始读取配置文件信息')
localPath = os... | {"/main.py": ["/log.py", "/configLoad.py", "/satelliteFlow.py", "/database.py"], "/satelliteFlow.py": ["/log.py"]} |
53,059 | OverYoung/WidebandSatelliteFlowMonitor | refs/heads/master | /main.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2018-11-08 11:18
# @Author : Yangzan
# @File : main.py
import time
import log
import traceback
import configLoad
import satelliteFlow
import database
#初始化log对象
logger = log.myLogger('log')
logger.info('程序启动')
localtime = time.localtime(time.time())
localhou... | {"/main.py": ["/log.py", "/configLoad.py", "/satelliteFlow.py", "/database.py"], "/satelliteFlow.py": ["/log.py"]} |
53,060 | OverYoung/WidebandSatelliteFlowMonitor | refs/heads/master | /database.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2018-11-07 9:59
# @Author : Yangzan
# @File : database.py
import pymysql
import traceback
import configparser
def DBconnect(host, user, passwd, db, port, charset):
conn = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=port,
... | {"/main.py": ["/log.py", "/configLoad.py", "/satelliteFlow.py", "/database.py"], "/satelliteFlow.py": ["/log.py"]} |
53,061 | OverYoung/WidebandSatelliteFlowMonitor | refs/heads/master | /satelliteFlow.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2018-11-06 11:08
# @Author : Yangzan
# @File : satelliteFlow.py
import time
import pytesseract
from selenium import webdriver
from PIL import Image
import configparser
import os
import traceback
import log
def startBrowser(url, logger):
# 浏览器设置
logge... | {"/main.py": ["/log.py", "/configLoad.py", "/satelliteFlow.py", "/database.py"], "/satelliteFlow.py": ["/log.py"]} |
53,171 | pyarun/djsaas | refs/heads/master | /code/dbmail/mail.py | '''
Created on 07-May-2012
@author: arun
'''
from django.core.mail import EmailMultiAlternatives, mail_admins, mail_managers
from django.template.loader import get_template
from django.template import Context, Template
from django.conf import settings
from models import MailTemplate
class DbSendMail:
"""
... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,172 | pyarun/djsaas | refs/heads/master | /code/saas/middleware.py | '''
Created on 24-Jun-2013
@author: arun
'''
from django.utils.functional import SimpleLazyObject
from django.contrib.sites.models import RequestSite
from saas.models import Tenant
class OrganizationMiddleware(object):
def process_request(self, request):
request.tenant = SimpleLazyObjec... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,173 | pyarun/djsaas | refs/heads/master | /code/registration/views.py | # Create your views here.
from django.views.generic import FormView, TemplateView
from .forms import RegistrationForm
from django.core.urlresolvers import reverse_lazy
from django.contrib.auth import get_user_model
User = get_user_model()
class RegistrationView(FormView):
template_name = "registration_form.html"
... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,174 | pyarun/djsaas | refs/heads/master | /code/dbmail/models.py | from django.db import models
# Create your models here.
class MailTemplate( models.Model ):
"""
Templates for Mails
--fields--
code: unique string-value to access the record.
title: human readable name for the mail template
subject: Subject for the mail
plain_conten... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,175 | pyarun/djsaas | refs/heads/master | /code/registration/models.py | from django.db import models
from django.contrib.auth import get_user_model
# Create your models here.
import hashlib, random
User = get_user_model()
class RegistrationProfileManager(models.Manager):
def create_profile(self, user):
"""
"""
salt = hashlib.sha1(str(random.random())).hexdiges... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,176 | pyarun/djsaas | refs/heads/master | /code/registration/forms.py | '''
Created on 26-Jun-2013
@author: arun
'''
from django import forms
from django.utils.translation import ugettext, ugettext_lazy as _
from saas.models import Tenant, User
from django.core.exceptions import ValidationError
from .models import RegistrationProfile
from django.conf import settings
def unique_domain_na... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,177 | pyarun/djsaas | refs/heads/master | /code/registration/urls.py | '''
Created on 24-Jun-2013
@author: arun
'''
from django.conf.urls import patterns, include, url
from .views import RegistrationView, RegistrationThankyouTemplateView
urlpatterns = patterns("",
url('^register$', RegistrationView.as_view(), name="tenant_registration_form"),
url('^register/thanks/(... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,178 | pyarun/djsaas | refs/heads/master | /code/dbmail/migrations/0001_initial.py | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'MailTemplate'
db.create_table(u'dbmail_mailtemplate', (
(u'id', self.gf('django.... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,179 | pyarun/djsaas | refs/heads/master | /code/saas/views.py | # Create your views here.
from django.views.decorators.debug import sensitive_post_parameters
from django.views.decorators.csrf import csrf_protect
from django.views.decorators.cache import never_cache
from django.contrib.auth import REDIRECT_FIELD_NAME , login as auth_login
from django.shortcuts import resolve_url
f... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,180 | pyarun/djsaas | refs/heads/master | /code/saas/admin.py | '''
Created on 19-Jun-2013
@author: arun
'''
from django.contrib import admin, auth
from django.utils.translation import ugettext, ugettext_lazy as _
from django import forms
from django.db import models
from saas.models import User, Tenant, TenantAccountManager
from django.contrib.admin.options import TabularInline
f... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,181 | pyarun/djsaas | refs/heads/master | /code/accounts/views.py | # Create your views here.
from django.shortcuts import render
from django.contrib.sites.models import RequestSite
def user_home(request):
"""
Renders Users home page. Content will be based on the permissions users have on the tenant data
"""
context = dict()
return render(request, 'user_home.... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,182 | pyarun/djsaas | refs/heads/master | /code/saas/models.py | from django.db import models
# Create your models here.
from django.contrib import auth
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
import string, random
from django.utils import timezone
from django.core.mail imp... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,183 | pyarun/djsaas | refs/heads/master | /code/dbmail/admin.py |
from django.contrib import admin
from models import MailTemplate
class MailTemplateAdmin(admin.ModelAdmin):
list_display = ("code", "title", "sender")
# fields = ('code', 'title', 'sender', 'subject', 'context', 'plain_content', 'html_content')
# field_options = {
# "fields": (('code', 'title'), 's... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,184 | pyarun/djsaas | refs/heads/master | /code/accounts/urls.py | '''
Created on 24-Jun-2013
@author: arun
'''
from django.conf.urls import patterns, include, url
urlpatterns = patterns("",
url("^home$", "accounts.views.user_home", name="user_home_page"),
# url("^login$", "accounts.views.client_login", name="client_login"),
#
# url("^d... | {"/code/registration/views.py": ["/code/registration/forms.py"], "/code/registration/forms.py": ["/code/registration/models.py"], "/code/registration/urls.py": ["/code/registration/views.py"]} |
53,186 | initrc/myhadoop | refs/heads/master | /MyHadoop/myhadoop/utils/hadoopfile.py | '''
Created on Dec 10, 2011
@author: david
'''
import os
import tempfile
import shutil
import subprocess
import time
from django.conf import settings
class HadoopFile(object):
'''
upload files
'''
def __init__(self, source):
'''
constructor
'''
self.source = source
... | {"/MyHadoop/myhadoop/views.py": ["/MyHadoop/myhadoop/utils/hadoopfile.py"]} |
53,187 | initrc/myhadoop | refs/heads/master | /MyHadoop/myhadoop/urls.py | from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('myhadoop.views',
url(r'^$', 'index'),
url(r'^upload/$', 'upload'),
url(r'^result/$', 'result'),
) | {"/MyHadoop/myhadoop/views.py": ["/MyHadoop/myhadoop/utils/hadoopfile.py"]} |
53,188 | initrc/myhadoop | refs/heads/master | /MyHadoop/myhadoop/views.py | from django.shortcuts import render_to_response
from MyHadoop.myhadoop.utils.hadoopfile import HadoopFile
from django.template.context import RequestContext
from django.http import Http404
def index(request):
return render_to_response('myhadoop/index.html', context_instance=RequestContext(request))
def upload(req... | {"/MyHadoop/myhadoop/views.py": ["/MyHadoop/myhadoop/utils/hadoopfile.py"]} |
53,192 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /browser_automation/pages/contact_page.py | from browser_automation.pages.base_page import BasePage
from browser_automation.pages.base_element import BaseElement
from selenium.webdriver.common.by import By
from browser_automation.pages.locator import Locator
class ContactPage(BasePage):
url = "https://www.abhishekpednekar.com/contact"
@property
de... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,193 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /browser_automation/__init__.py | import random
# Test data for the contact page
first_names = [
"Hilary",
"Alfie",
"Elna",
"Emalia",
"Hermine",
"Pansie",
"Brigitte",
"Vanda",
"Chalmers",
"Maurine",
"Lazar",
"Jilly",
"Lenore",
"Waylen",
"Daphne",
"Corri",
"Ody",
"Skippy",
"Fe... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,194 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /models/blog.py | from extensions import db
from sqlalchemy.dialects.postgresql import TSVECTOR
class Blog(db.Model):
__tablename__ = "blog"
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(100))
url = db.Column(db.String(100))
description = db.Column(db.String(1000))
description_token ... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,195 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /browser_automation/pages/home_page.py | from browser_automation.pages.base_page import BasePage
from browser_automation.pages.base_element import BaseElement
from selenium.webdriver.common.by import By
from browser_automation.pages.locator import Locator
class HomePage(BasePage):
url = "https://abhishekpednekar.com"
@property
def click_nav_bar... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,196 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /browser_automation/pages/base_page.py | class BasePage(object):
url = None
def __init__(self, driver):
self.driver = driver
def go(self):
self.driver.get(self.url)
def scroll(self, x: int, y: int):
script = f"window.scrollTo({x}, {y})"
self.driver.execute_script(script)
def switch(self, tab: int):
... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,197 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /views/main.py | from flask import Blueprint, render_template
main_blueprint = Blueprint("main", __name__, template_folder="templates")
@main_blueprint.route("/")
@main_blueprint.route("/main")
def main():
"""
View method to render the home.html page - https://www.abhishekpednekar.com/
Returns
-------
home.html:... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,198 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /views/blog.py | from flask import Blueprint, render_template, request
from extensions import db
from models.blog import Blog
from app import get_current_year
blog_blueprint = Blueprint("blog", __name__, template_folder="templates")
@blog_blueprint.route("/blog")
def blog():
"""
View method to render the blog.html page - ht... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,199 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /migrations/versions/1c581a07c81f_.py | """empty message
Revision ID: 1c581a07c81f
Revises:
Create Date: 2019-11-25 14:58:22.016437
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "1c581a07c81f"
down_revision = None
branch_labels = None
depends_on = None
de... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,200 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /celery_app.py | from flask import Flask
from utilities.factory import make_celery
def create_celery_app():
"""
Returns a celery instance
Returns
-------
celery: object
"""
app = Flask(__name__)
celery = make_celery(app)
return celery
| {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,201 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /browser_automation/pages/locator.py | from collections import namedtuple
Locator = namedtuple("Locator", ["by", "value"])
| {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,202 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /forms/search.py | from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired
class Search(FlaskForm):
search_post = StringField("Search Post", validators=[DataRequired()])
submit = SubmitField("Search")
def __repr__(self):
return f"Search(Search Post: {... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,203 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /browser_automation/pages/portfolio_page.py | from browser_automation.pages.base_element import BaseElement
from browser_automation.pages.base_page import BasePage
from selenium.webdriver.common.by import By
from browser_automation.pages.locator import Locator
class PortfolioPage(BasePage):
url = "https://www.abhishekpednekar.com/portfolio"
@property
... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,204 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /utilities/tasks.py | import os
import smtplib
import ssl
from email.message import EmailMessage
from celery_app import create_celery_app
celery = create_celery_app()
@celery.task
def send_email(caller_name, caller_email, caller_subject, caller_message):
"""
Method to send an email based on the details provided on the contact me ... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,205 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /app.py | from flask import Flask
from flask_migrate import Migrate
from config import Config
from extensions import db
from datetime import datetime
def create_app(config_class=Config):
"""
Returns the flask application instance
Parameters
----------
config_class: class
Returns
-------
app: o... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,206 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /config.py | import os
import dotenv
dotenv.load_dotenv()
class Config:
SECRET_KEY = os.getenv("SECRET_KEY")
SQLALCHEMY_DATABASE_URI = os.getenv("SQLALCHEMY_DATABASE_URI")
SQLALCHEMY_TRACK_MODIFICATIONS = True
RESTPLUS_MASK_SWAGGER = False
CELERY_BROKER_URL = os.getenv("CELERY_BROKER_URL")
class TestConfig(... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,207 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /views/contact.py | from flask import Blueprint, flash, redirect, url_for, render_template
from forms.contact import ContactForm
from utilities.tasks import send_email
from app import get_current_year
contact_blueprint = Blueprint("contact", __name__, template_folder="templates")
@contact_blueprint.route("/contact", methods=["GET", "PO... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,208 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /browser_automation/pages/base_element.py | import selenium.webdriver.support.expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
class BaseElement(object):
def __init__(self, driver, locator):
self.driver = driver
self.locator = locator
self.web_element = None
self.find()
def find(self):... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,209 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /views/portfolio.py | from flask import Blueprint, render_template
from app import get_current_year
portfolio_blueprint = Blueprint(
"portfolio", __name__, template_folder="templates"
)
@portfolio_blueprint.route("/portfolio")
def portfolio():
"""
View method to render the portfolio.html page - https://www.abhishekpednekar.co... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,210 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /views/sitemap.py | from flask import Blueprint, send_from_directory
sitemap_blueprint = Blueprint("sitemap", __name__)
@sitemap_blueprint.route("/sitemap.xml")
def sitemap_xml():
return send_from_directory(directory="static", filename="sitemap.xml")
| {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,211 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /browser_automation/automation_tests.py | from selenium import webdriver
from browser_automation.pages.home_page import HomePage
from browser_automation.pages.portfolio_page import PortfolioPage
from browser_automation.pages.contact_page import ContactPage
from browser_automation import name, email, message
browser = webdriver.Chrome()
# Tests for the home pa... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,212 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /forms/contact.py | from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextAreaField
from wtforms.validators import DataRequired, Length, Email
class ContactForm(FlaskForm):
username = StringField(
"Your Name", validators=[DataRequired(), Length(min=2, max=25)]
)
email = StringField("Your E... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,213 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /tests/test_app.py | import unittest
from extensions import db
from models.blog import Blog
from app import create_app
from config import TestConfig
app = create_app(config_class=TestConfig)
app.config.from_object(TestConfig)
client = app.test_client()
class BaseTestCase(unittest.TestCase):
def setUp(self) -> None:
ctx = ap... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,214 | AbhishekPednekar84/personal-portfolio | refs/heads/master | /api/search.py | import string
from flask import request, abort, Blueprint
from flask_restplus import Api, Resource, fields
from extensions import db
from models.blog import Blog
from sqlalchemy.exc import ProgrammingError, OperationalError
search_blueprint = Blueprint("search_api", __name__)
api = Api(
search_blueprint,
doc=... | {"/browser_automation/pages/contact_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_automation/pages/locator.py"], "/browser_automation/pages/home_page.py": ["/browser_automation/pages/base_page.py", "/browser_automation/pages/base_element.py", "/browser_autom... |
53,215 | wahahahaya/CycleGAN-Male2Female | refs/heads/main | /train.py | import torchvision.transforms as transforms
from torchvision.utils import save_image, make_grid
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch
from model import ResNetGenerator... | {"/train.py": ["/model.py"]} |
53,216 | wahahahaya/CycleGAN-Male2Female | refs/heads/main | /model.py | import torch
import numpy as np
class ResidualBlock(torch.nn.Module):
def __init__(self, in_channel):
super(ResidualBlock, self).__init__()
self.conv1 = torch.nn.Conv2d(
in_channels=in_channel,
out_channels=in_channel,
kernel_size=3,
strid... | {"/train.py": ["/model.py"]} |
53,218 | montlebalm/BlackjackStrategies | refs/heads/master | /tests/strategies/test_HiLowCardCounter.py | from strategies import HiLowCardCounter
from models import Card
def test_hits_if_low_score():
s = HiLowCardCounter()
hole_cards = [Card(11)]
assert s.hit_on(hole_cards, [], None) == True
def test_hits_if_high_score_and_low_deck():
s = HiLowCardCounter()
hole_cards = [Card(14)]
remaining_cards = [Card(2, "2")]
... | {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,219 | montlebalm/BlackjackStrategies | refs/heads/master | /tests/strategies/test_HitBelow.py | from strategies import HitBelow
from models import Card
def test_hits_below_limit():
s = HitBelow(10)
cards = [Card([1]), Card([1])]
assert s.hit_on(cards, [], None) == True
def test_stays_above_limit():
s = HitBelow(10)
cards = [Card([6]), Card([6])]
assert s.hit_on(cards, [], None) == False
| {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,220 | montlebalm/BlackjackStrategies | refs/heads/master | /strategies/HitBelow.py | from strategies import Strategy
from helpers.cards import card_total
class HitBelow(Strategy):
name = "HitBelow"
def __init__(self, limit):
self.limit = limit
self.name += str(limit)
def hit_on(self, cards, remaining_cards, dealer_card):
return card_total(cards) < self.limit
| {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,221 | montlebalm/BlackjackStrategies | refs/heads/master | /tests/models/test_Card.py | from models.Card import Card
def test_stores_values_as_list():
c = Card(1, "Test")
assert c.values.pop
| {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,222 | montlebalm/BlackjackStrategies | refs/heads/master | /strategies/Strategy.py | class Strategy(object):
name = "None"
def hit_on(self, cards, remaining_cards, dealer_card):
raise
def __str__(self):
return self.name
| {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,223 | montlebalm/BlackjackStrategies | refs/heads/master | /models/Card.py | class Card(object):
def __init__(self, values, name=""):
self.name = name
try:
# Try to treat the value as a list first
self.values = list(values)
except:
self.values = [values]
| {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,224 | montlebalm/BlackjackStrategies | refs/heads/master | /strategies/Psychic.py | from strategies import Strategy
from helpers.cards import card_total
class Psychic(Strategy):
name = "Psychic"
def hit_on(self, cards, remaining_cards, dealer_card):
# Cheat by looking at the next card to see if we'll bust
return card_total(cards + [remaining_cards[-1]]) <= 21
| {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,225 | montlebalm/BlackjackStrategies | refs/heads/master | /tests/models/test_Deck.py | from models.Deck import Deck
def test_contains_52_cards():
d = Deck()
assert len(d.cards) == 52
def test_cards_are_shuffled():
d1 = Deck()
d2 = Deck()
# Find all the indexes where cards from d1 and d2 are identical
dupes = [c.values == d2.cards[i] for i, c in enumerate(d1.cards)]
# all() should return False ... | {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,226 | montlebalm/BlackjackStrategies | refs/heads/master | /strategies/__init__.py | from strategies.Strategy import *
from strategies.Dealer import *
from strategies.HitBelow import *
from strategies.Psychic import *
from strategies.HiLowCardCounter import *
| {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,227 | montlebalm/BlackjackStrategies | refs/heads/master | /models/__init__.py | from models.Card import *
from models.Deck import *
from models.Game import *
| {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,228 | montlebalm/BlackjackStrategies | refs/heads/master | /tests/strategies/test_Dealer.py | from strategies import Dealer
from models import Card
def test_hits_below_limit():
s = Dealer()
cards = [Card([16])]
assert s.hit_on(cards, [], None) == True
def test_stays_at_limit():
s = Dealer()
cards = [Card([17])]
assert s.hit_on(cards, [], None) == False
def test_stays_above_limit():
s = Dealer()
ca... | {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,229 | montlebalm/BlackjackStrategies | refs/heads/master | /helpers/cards.py | def card_total(cards):
return sum([c.values[0] for c in cards])
| {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,230 | montlebalm/BlackjackStrategies | refs/heads/master | /tests/models/test_Game.py | from nose.tools import raises
from models import Deck, Game
from strategies import Dealer, HitBelow
@raises(Exception)
def test_raises_with_no_dealer():
gamblers = [HitBelow(1)]
Game(None, gamblers, Deck)
@raises(Exception)
def test_raises_with_no_gamblers():
Game(Dealer(), [], Deck)
@raises(Exception)
def te... | {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,231 | montlebalm/BlackjackStrategies | refs/heads/master | /tests/strategies/test_Psychic.py | from strategies import Psychic
from models import Card
def test_hits_if_wont_bust():
s = Psychic()
cards = [Card([19])]
assert s.hit_on(cards, [Card(2)], None) == True
def test_stays_if_will_bust():
s = Psychic()
cards = [Card([20])]
assert s.hit_on(cards, [Card(2)], None) == False
| {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,232 | montlebalm/BlackjackStrategies | refs/heads/master | /models/Deck.py | from models.Card import Card
from random import shuffle
class Deck(object):
def __init__(self):
suit = [
Card(2, "2"),
Card(3, "3"),
Card(4, "4"),
Card(5, "5"),
Card(6, "6"),
Card(7, "7"),
Card(8, "8"),
Card(9, "9"),
Card(10, "10"),
Card(10, "J"),
Card(10, "K"),
Card(10, "Q"),
... | {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,233 | montlebalm/BlackjackStrategies | refs/heads/master | /main.py | from models import Deck, Game
from strategies import Dealer, HitBelow, Psychic, HiLowCardCounter
def report(player, wins, rounds):
pct = game.wins[player] * 100 // rounds
print("%s: %d%%" % (player.name, pct))
if __name__ == "__main__":
rounds = 10000
dealer = Dealer()
strats = [
HitBelow(17),
HiLowCardCou... | {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,234 | montlebalm/BlackjackStrategies | refs/heads/master | /models/Game.py | from helpers.cards import card_total
class Game(object):
def __init__(self, dealer, gambler, deck_factory):
if dealer is None:
raise Exception("You must have a dealer")
if gambler is None:
raise Exception("You must have a gambler")
if deck_factory is None:
raise Exception("You must have a deck fact... | {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,235 | montlebalm/BlackjackStrategies | refs/heads/master | /strategies/HiLowCardCounter.py | from strategies import Strategy
from helpers.cards import card_total
class HiLowCardCounter(Strategy):
name = "HiLowCardCounter"
# http://www.blackjackinfo.com/blackjack-school/blackjack-lesson-04.php
pluses = ["2", "3", "4", "5", "6"]
minuses = ["10", "J", "Q", "K", "A"]
def hit_on(self, cards, remaining_car... | {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,236 | montlebalm/BlackjackStrategies | refs/heads/master | /strategies/Dealer.py | from strategies import Strategy
from helpers.cards import card_total
class Dealer(Strategy):
name = "Dealer"
def hit_on(self, cards, remaining_cards, dealer_card=None):
return card_total(cards) < 17
| {"/tests/strategies/test_HiLowCardCounter.py": ["/strategies/__init__.py", "/models/__init__.py"], "/tests/strategies/test_HitBelow.py": ["/strategies/__init__.py", "/models/__init__.py"], "/strategies/HitBelow.py": ["/strategies/__init__.py", "/helpers/cards.py"], "/tests/models/test_Card.py": ["/models/Card.py"], "/s... |
53,260 | alexdy2007/reidentification_hacky | refs/heads/master | /model/crop_face_from_image.py |
from PIL import Image
import face_recognition
def crop_face_from_image(image_path):
if isinstance(image_path, str):
image = face_recognition.load_image_file(image_path)
else:
image = image_path
faces_location = _get_face_locations_from_image(image_path)
if len(faces_location) != 0:
... | {"/tests/db_tests/crud_test.py": ["/db_connection/PeopleDB.py"], "/tests/db_tests/test_insert_person_seen_from_camera.py": ["/sockets/PictureRecSocket.py", "/db_connection/Crud.py", "/model/compare_single_to_known_faces.py", "/model/get_feature_encoded_list.py"], "/webserver/main.py": ["/webserver/person/person.py", "/... |
53,261 | alexdy2007/reidentification_hacky | refs/heads/master | /tests/db_tests/crud_test.py | from unittest import TestCase
from db_connection.PeopleDB import PeopleDB
class TestDB(TestCase):
def setUp(self):
self.crud = PeopleDB()
def test_insert_testdata(self):
number_inserted = self.crud.insert_test_data()
self.assertEqual(number_inserted, 5, "5 people should have been inser... | {"/tests/db_tests/crud_test.py": ["/db_connection/PeopleDB.py"], "/tests/db_tests/test_insert_person_seen_from_camera.py": ["/sockets/PictureRecSocket.py", "/db_connection/Crud.py", "/model/compare_single_to_known_faces.py", "/model/get_feature_encoded_list.py"], "/webserver/main.py": ["/webserver/person/person.py", "/... |
53,262 | alexdy2007/reidentification_hacky | refs/heads/master | /tests/db_tests/test_data.py |
TEST_DATA = [
{
"name": "Alex Young",
"title": "Data Scientist",
"photo_location":"Alex_Young.jpg"
},
{
"name": "Gary",
"title": "Boss Man",
"photo_location": "Gary.jpg"
},
{
"name": "Rishabh",
"title": "Architect",
"photo_loca... | {"/tests/db_tests/crud_test.py": ["/db_connection/PeopleDB.py"], "/tests/db_tests/test_insert_person_seen_from_camera.py": ["/sockets/PictureRecSocket.py", "/db_connection/Crud.py", "/model/compare_single_to_known_faces.py", "/model/get_feature_encoded_list.py"], "/webserver/main.py": ["/webserver/person/person.py", "/... |
53,263 | alexdy2007/reidentification_hacky | refs/heads/master | /tests/db_tests/test_insert_person_seen_from_camera.py | from unittest import TestCase
from sockets.PictureRecSocket import SocketClient
from sockets.PictureRecSocket import SocketClient
from db_connection.Crud import Crud
from model.compare_single_to_known_faces import compare_face_to_known
from model.get_feature_encoded_list import get_feature_encoding_list
import os
clas... | {"/tests/db_tests/crud_test.py": ["/db_connection/PeopleDB.py"], "/tests/db_tests/test_insert_person_seen_from_camera.py": ["/sockets/PictureRecSocket.py", "/db_connection/Crud.py", "/model/compare_single_to_known_faces.py", "/model/get_feature_encoded_list.py"], "/webserver/main.py": ["/webserver/person/person.py", "/... |
53,264 | alexdy2007/reidentification_hacky | refs/heads/master | /webserver/main.py | from flask import Flask, request, jsonify, Response
import os
from webserver.person.person import Person
from flask_restful import Api
import threading
from werkzeug.utils import secure_filename
from webserver.take_pictures.take_pictures import take_pictures
from db_connection.PeopleDB import PeopleDB
from db_connectio... | {"/tests/db_tests/crud_test.py": ["/db_connection/PeopleDB.py"], "/tests/db_tests/test_insert_person_seen_from_camera.py": ["/sockets/PictureRecSocket.py", "/db_connection/Crud.py", "/model/compare_single_to_known_faces.py", "/model/get_feature_encoded_list.py"], "/webserver/main.py": ["/webserver/person/person.py", "/... |
53,265 | alexdy2007/reidentification_hacky | refs/heads/master | /model/montage/check_person_in_photo.py | import face_recognition
def is_in_photo(encoded_face, encoded_faces_in_photo):
face_distances = face_recognition.face_distance(encoded_faces_in_photo, encoded_face)
for idx, distance in enumerate(face_distances):
if distance<0.55:
return distance
return None
| {"/tests/db_tests/crud_test.py": ["/db_connection/PeopleDB.py"], "/tests/db_tests/test_insert_person_seen_from_camera.py": ["/sockets/PictureRecSocket.py", "/db_connection/Crud.py", "/model/compare_single_to_known_faces.py", "/model/get_feature_encoded_list.py"], "/webserver/main.py": ["/webserver/person/person.py", "/... |
53,266 | alexdy2007/reidentification_hacky | refs/heads/master | /webserver/apis/montage_api.py | from flask import Blueprint, request, Response
from model.montage.montage import Montage
from werkzeug.utils import secure_filename
import os
from model.montage.create_montage_from_photos import create_montage
montage_page = Blueprint('montage', __name__,
template_folder='templates')
CURRENT_D... | {"/tests/db_tests/crud_test.py": ["/db_connection/PeopleDB.py"], "/tests/db_tests/test_insert_person_seen_from_camera.py": ["/sockets/PictureRecSocket.py", "/db_connection/Crud.py", "/model/compare_single_to_known_faces.py", "/model/get_feature_encoded_list.py"], "/webserver/main.py": ["/webserver/person/person.py", "/... |
53,267 | alexdy2007/reidentification_hacky | refs/heads/master | /model/compare_single_to_known_faces.py | import face_recognition
from model.encode_image import encode_image
from db_connection.Crud import Crud
def compare_face_to_known(face_to_match, known_face_list, to_match_top=1):
# Load a test image and get encondings for it
encode_face_to_match = encode_image(face_to_match)
encoded_known_faces = known_fac... | {"/tests/db_tests/crud_test.py": ["/db_connection/PeopleDB.py"], "/tests/db_tests/test_insert_person_seen_from_camera.py": ["/sockets/PictureRecSocket.py", "/db_connection/Crud.py", "/model/compare_single_to_known_faces.py", "/model/get_feature_encoded_list.py"], "/webserver/main.py": ["/webserver/person/person.py", "/... |
53,268 | alexdy2007/reidentification_hacky | refs/heads/master | /tests/model_tests/test_match_person.py | from unittest import TestCase
from db_connection.Crud import Crud
import os
from model.get_feature_encoded_list import get_feature_encoding_list
from model.compare_single_to_known_faces import compare_face_to_known
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
PICTURE_DIR = CURRENT_DIR + os.sep + ".." + os... | {"/tests/db_tests/crud_test.py": ["/db_connection/PeopleDB.py"], "/tests/db_tests/test_insert_person_seen_from_camera.py": ["/sockets/PictureRecSocket.py", "/db_connection/Crud.py", "/model/compare_single_to_known_faces.py", "/model/get_feature_encoded_list.py"], "/webserver/main.py": ["/webserver/person/person.py", "/... |
53,269 | alexdy2007/reidentification_hacky | refs/heads/master | /db_connection/PeopleDB.py | from db_connection.Crud import Crud
import os
class PeopleDB(Crud):
def __init__(self):
super().__init__()
self.target_db = self.db.person
def get_person(self, query):
persons_found = self.target_db.find(query)
return list(persons_found)
def insert_person(self, person):
... | {"/tests/db_tests/crud_test.py": ["/db_connection/PeopleDB.py"], "/tests/db_tests/test_insert_person_seen_from_camera.py": ["/sockets/PictureRecSocket.py", "/db_connection/Crud.py", "/model/compare_single_to_known_faces.py", "/model/get_feature_encoded_list.py"], "/webserver/main.py": ["/webserver/person/person.py", "/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.