index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
57,536 | juliendurand/pricing-tool | refs/heads/master | /gui/pricing/migrations/0002_auto_20181218_2231.py | # Generated by Django 2.1.4 on 2018-12-18 22:31
from django.db import migrations, models
import pricing.models
class Migration(migrations.Migration):
dependencies = [
('pricing', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='feature',
name=... | {"/gui/pricing/views.py": ["/gui/pricing/models.py"], "/gui/pricing/admin.py": ["/gui/pricing/models.py"]} |
57,537 | juliendurand/pricing-tool | refs/heads/master | /src/pypricing/documentation.py | import os
import subprocess
import sys
import markdown
import numpy as np
import jinja2
import config
import result
def euro(n):
return '{:,.0f}'.format(n).replace(',', ' ') + " €"
def thsep(n):
return '{:,.0f}'.format(n).replace(',', ' ') + ' '
def percent(p):
return '{:,.2f}'... | {"/gui/pricing/views.py": ["/gui/pricing/models.py"], "/gui/pricing/admin.py": ["/gui/pricing/models.py"]} |
57,538 | juliendurand/pricing-tool | refs/heads/master | /gui/pricing/views.py | from django.forms import modelform_factory, modelformset_factory, formset_factory, inlineformset_factory, ModelForm
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse, reverse_lazy
from django.views import generic
from .models import Dataset, Feature, Featu... | {"/gui/pricing/views.py": ["/gui/pricing/models.py"], "/gui/pricing/admin.py": ["/gui/pricing/models.py"]} |
57,539 | juliendurand/pricing-tool | refs/heads/master | /gui/pricing/admin.py | from django.contrib import admin
from .models import Dataset, Model, Feature, Modality, Run
admin.site.register(Dataset)
admin.site.register(Model)
admin.site.register(Feature)
admin.site.register(Modality)
admin.site.register(Run)
| {"/gui/pricing/views.py": ["/gui/pricing/models.py"], "/gui/pricing/admin.py": ["/gui/pricing/models.py"]} |
57,540 | juliendurand/pricing-tool | refs/heads/master | /gui/pricing/migrations/0001_initial.py | # Generated by Django 2.1.4 on 2018-12-18 22:11
from django.db import migrations, models
import django.db.models.deletion
import pricing.models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Dataset',
... | {"/gui/pricing/views.py": ["/gui/pricing/models.py"], "/gui/pricing/admin.py": ["/gui/pricing/models.py"]} |
57,541 | juliendurand/pricing-tool | refs/heads/master | /gui/pricing/migrations/0005_auto_20190108_1301.py | # Generated by Django 2.1.4 on 2019-01-08 13:01
from django.db import migrations, models
import django.db.models.functions.text
import pricing.models
class Migration(migrations.Migration):
dependencies = [
('pricing', '0004_auto_20181231_1013'),
]
operations = [
migrations.AlterModelOpt... | {"/gui/pricing/views.py": ["/gui/pricing/models.py"], "/gui/pricing/admin.py": ["/gui/pricing/models.py"]} |
57,542 | juliendurand/pricing-tool | refs/heads/master | /gui/pricing/tasks.py | import subprocess
from background_task import background
from . import models
import pypricing.dataset as ds
@background
def process_dataset(dataset_id):
try:
dataset = models.Dataset.objects.get(pk=dataset_id)
print('Start Processing Dataset : ' + str(dataset))
config = dataset.get_con... | {"/gui/pricing/views.py": ["/gui/pricing/models.py"], "/gui/pricing/admin.py": ["/gui/pricing/models.py"]} |
57,543 | juliendurand/pricing-tool | refs/heads/master | /gui/pricing/migrations/0010_auto_20190108_2231.py | # Generated by Django 2.1.4 on 2019-01-08 22:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('pricing', '0009_auto_20190108_2220'),
]
operations = [
migrations.AlterField(
model_name='model... | {"/gui/pricing/views.py": ["/gui/pricing/models.py"], "/gui/pricing/admin.py": ["/gui/pricing/models.py"]} |
57,544 | juliendurand/pricing-tool | refs/heads/master | /gui/pricing/models.py | from enum import Enum
import io
from django.db import models
from django.urls import reverse
from django.utils.text import slugify
import pypricing.dataset as ds
class FeatureStatus(Enum):
Input = "Input"
Target = "Target"
Ignore = "Ignore"
def __str__(self):
return self.value
class LossF... | {"/gui/pricing/views.py": ["/gui/pricing/models.py"], "/gui/pricing/admin.py": ["/gui/pricing/models.py"]} |
57,545 | juliendurand/pricing-tool | refs/heads/master | /src/pypricing/config.py | import os
class Config:
'''
Configuration for a glm regression.
'''
def __init__(self, config_filename):
self.filename = config_filename
with open(config_filename) as config_file:
self.label = config_file.readline().strip()
self.dataset_filename = config_file.r... | {"/gui/pricing/views.py": ["/gui/pricing/models.py"], "/gui/pricing/admin.py": ["/gui/pricing/models.py"]} |
57,546 | ColeFMeldorf/KNC-Live | refs/heads/main | /knc/utils.py | """
Utility functions for KNC-Live
"""
import numpy as np
def sigmoid(x : np.ndarray, a : float, b : float, c : float) -> np.ndarray :
"""
A parameterized sigmoid curve
Args:
x (np.ndarray or float): x values to evaluate the sigmoid
a (float): vertical stretch parameter
b (float):... | {"/run_knc.py": ["/knc/__init__.py", "/knc/utils.py"], "/make_training_data.py": ["/knc/__init__.py", "/knc/utils.py"]} |
57,547 | ColeFMeldorf/KNC-Live | refs/heads/main | /run_knc.py | """
Run KN-Classify Live
"""
import os
import argparse
from knc import process
from knc import classify
from knc.utils import ArgumentError
def parse_args() -> argparse.ArgumentParser:
"""
Parse command line arguments to enable script-like running of KNC-Live
Returns:
arrgparser object
"""
... | {"/run_knc.py": ["/knc/__init__.py", "/knc/utils.py"], "/make_training_data.py": ["/knc/__init__.py", "/knc/utils.py"]} |
57,548 | ColeFMeldorf/KNC-Live | refs/heads/main | /knc/train.py | """
Train a Random Forest Classifier
"""
import sys
sys.path.append('knc')
import numpy as np
import pandas as pd
pd.set_option('use_inf_as_na', True)
from scipy.optimize import curve_fit
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import roc_curve
from sklearn.metrics import roc_auc_score... | {"/run_knc.py": ["/knc/__init__.py", "/knc/utils.py"], "/make_training_data.py": ["/knc/__init__.py", "/knc/utils.py"]} |
57,549 | ColeFMeldorf/KNC-Live | refs/heads/main | /knc/features.py | """
KN-Classify hand-engineered lightcurve features
"""
import numpy as np
import pandas as pd
class FeatureExtractor():
"""
Class to contain all feature extraction methods
"""
def __init__(self):
# Establish feature families
self.features = [x for x in dir(self) if x[0:1] != '_']
... | {"/run_knc.py": ["/knc/__init__.py", "/knc/utils.py"], "/make_training_data.py": ["/knc/__init__.py", "/knc/utils.py"]} |
57,550 | ColeFMeldorf/KNC-Live | refs/heads/main | /knc/__init__.py | """
KN-Classify Live
"""
__version__ = '0.0.1'
| {"/run_knc.py": ["/knc/__init__.py", "/knc/utils.py"], "/make_training_data.py": ["/knc/__init__.py", "/knc/utils.py"]} |
57,551 | ColeFMeldorf/KNC-Live | refs/heads/main | /make_training_data.py | """
Generate training data for KNC-Live
"""
import argparse
import glob
import pandas as pd
from knc import feature_extraction as fe
from knc import process
from knc.utils import load, ArgumentError
# Handle command line arguments
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--force_pho... | {"/run_knc.py": ["/knc/__init__.py", "/knc/utils.py"], "/make_training_data.py": ["/knc/__init__.py", "/knc/utils.py"]} |
57,552 | ColeFMeldorf/KNC-Live | refs/heads/main | /knc/process.py | """
Functionalities to process a lightcurve file for KN-Classify
"""
import argparse
import os
import sys
sys.path.append('knc')
import numpy as np
import pandas as pd
import feature_extraction
from utils import ArgumentError, load, save
def trim_lcs(lcs : dict, cut_requirement : int = 0) -> dict :
"""
Remo... | {"/run_knc.py": ["/knc/__init__.py", "/knc/utils.py"], "/make_training_data.py": ["/knc/__init__.py", "/knc/utils.py"]} |
57,553 | ColeFMeldorf/KNC-Live | refs/heads/main | /knc/feature_extraction.py | """
Extract features from lightcurves
"""
import sys
sys.path.append('knc')
import pandas as pd
from features import FeatureExtractor
def extract(lc : pd.DataFrame,
extractor : FeatureExtractor,
flts : str ="griz") -> dict :
"""
Extract features from a single lightcurve
Args:
... | {"/run_knc.py": ["/knc/__init__.py", "/knc/utils.py"], "/make_training_data.py": ["/knc/__init__.py", "/knc/utils.py"]} |
57,554 | ColeFMeldorf/KNC-Live | refs/heads/main | /knc/classify.py | """
Classify datasets
"""
import argparse
import os
import sys
sys.path.append('knc')
import numpy as np
import pandas as pd
import train
from utils import sigmoid, ArgumentError, load, save
def calibrate(scores: np.ndarray, popt : list) -> np.ndarray :
"""
Transform output scores into probabilities
Ar... | {"/run_knc.py": ["/knc/__init__.py", "/knc/utils.py"], "/make_training_data.py": ["/knc/__init__.py", "/knc/utils.py"]} |
57,555 | purdue-nrl/hybrid-snn-conversion | refs/heads/master | /ann.py | #############################
# @author: Nitin Rathi #
#############################
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms, models
from torchviz import make_dot
from matplotlib import pyplot as plt... | {"/ann.py": ["/self_models/__init__.py"]} |
57,556 | purdue-nrl/hybrid-snn-conversion | refs/heads/master | /self_models/__init__.py | from .spiking_model import *
from .vgg import *
| {"/ann.py": ["/self_models/__init__.py"]} |
57,568 | sseaver/BaseballAPI | refs/heads/master | /app/admin.py | from django.contrib import admin
from app.models import Batting, Fielding, Master, Pitching
# Register your models here.
admin.site.register([Batting, Fielding, Master, Pitching])
| {"/app/admin.py": ["/app/models.py"], "/BaseballAPI/urls.py": ["/app/views.py"], "/app/serializers.py": ["/app/models.py"], "/app/views.py": ["/app/models.py", "/app/serializers.py"]} |
57,569 | sseaver/BaseballAPI | refs/heads/master | /app/models.py | from django.db import models
# Create your models here.
class Master(models.Model):
playerID = models.CharField(max_length=10, null=True, blank=True)
birthYear = models.CharField(max_length=50, null=True, blank=True)
birthMonth = models.CharField(max_length=50, null=True, blank=True)
birthDay = model... | {"/app/admin.py": ["/app/models.py"], "/BaseballAPI/urls.py": ["/app/views.py"], "/app/serializers.py": ["/app/models.py"], "/app/views.py": ["/app/models.py", "/app/serializers.py"]} |
57,570 | sseaver/BaseballAPI | refs/heads/master | /BaseballAPI/urls.py | """BaseballAPI URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | {"/app/admin.py": ["/app/models.py"], "/BaseballAPI/urls.py": ["/app/views.py"], "/app/serializers.py": ["/app/models.py"], "/app/views.py": ["/app/models.py", "/app/serializers.py"]} |
57,571 | sseaver/BaseballAPI | refs/heads/master | /app/migrations/0003_auto_20161026_2107.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-26 21:07
from __future__ import unicode_literals
import csv
from django.db import migrations
def add_info(apps, schema_editor):
Master = apps.get_model("app", "Master")
Batting = apps.get_model("app", "Batting")
Pitching = apps.get_model("app... | {"/app/admin.py": ["/app/models.py"], "/BaseballAPI/urls.py": ["/app/views.py"], "/app/serializers.py": ["/app/models.py"], "/app/views.py": ["/app/models.py", "/app/serializers.py"]} |
57,572 | sseaver/BaseballAPI | refs/heads/master | /app/migrations/0002_auto_20161026_2145.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-26 21:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
operations = [
mi... | {"/app/admin.py": ["/app/models.py"], "/BaseballAPI/urls.py": ["/app/views.py"], "/app/serializers.py": ["/app/models.py"], "/app/views.py": ["/app/models.py", "/app/serializers.py"]} |
57,573 | sseaver/BaseballAPI | refs/heads/master | /app/serializers.py | from rest_framework import serializers
from app.models import Batting, Fielding, Master, Pitching
class MasterSerializer(serializers.ModelSerializer):
class Meta:
model = Master
fields = '__all__'
class BattingSerializer(serializers.ModelSerializer):
class Meta:
model = Batting
... | {"/app/admin.py": ["/app/models.py"], "/BaseballAPI/urls.py": ["/app/views.py"], "/app/serializers.py": ["/app/models.py"], "/app/views.py": ["/app/models.py", "/app/serializers.py"]} |
57,574 | sseaver/BaseballAPI | refs/heads/master | /app/views.py | from django.shortcuts import render
from app.models import Batting, Fielding, Master, Pitching
from app.serializers import MasterSerializer, BattingSerializer, FieldingSerializer, PitchingSerializer
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView
# Create your views here.
class Mas... | {"/app/admin.py": ["/app/models.py"], "/BaseballAPI/urls.py": ["/app/views.py"], "/app/serializers.py": ["/app/models.py"], "/app/views.py": ["/app/models.py", "/app/serializers.py"]} |
57,583 | ocolisanrares97/Equation-System-Solver-with-Python | refs/heads/master | /helperFunctions.py | import numpy as np
import random
from parsing_functions import *
#global_filename = "sistem.txt"
# equations = getFileContent(global_filename)
#
# coefficients, freeTerms = getCoefficientsAndFreeTerms(equations)
#
# population_size = 8
# no_of_variables = len(coefficients[0])
'''
- calcFitness calcul... | {"/helperFunctions.py": ["/parsing_functions.py"], "/main.py": ["/helperFunctions.py", "/generator.py"], "/gui.py": ["/main.py"]} |
57,584 | ocolisanrares97/Equation-System-Solver-with-Python | refs/heads/master | /parsing_functions.py |
''' PARSING STAGE '''
#function that returns a list of strings, each one representing an equation
#read contents of the file
def getFileContent(filename):
# equations[] will contatin the raw equations from the file as strings
equations = []
try:
with open(filename) as file:
... | {"/helperFunctions.py": ["/parsing_functions.py"], "/main.py": ["/helperFunctions.py", "/generator.py"], "/gui.py": ["/main.py"]} |
57,585 | ocolisanrares97/Equation-System-Solver-with-Python | refs/heads/master | /main.py | from helperFunctions import *
from generator import *
import time
#++++++++++++++++++++++++++++++++++++++++ IMPROVED GENETIC ALGORITHM PROCEDURE++++++++++++++++++++++++++++++++++
def bootImproved(filename,pop_size,crossRate,mutationRate,fitTreshold,prec ):
startTime = time.time() #get the starting time o... | {"/helperFunctions.py": ["/parsing_functions.py"], "/main.py": ["/helperFunctions.py", "/generator.py"], "/gui.py": ["/main.py"]} |
57,586 | ocolisanrares97/Equation-System-Solver-with-Python | refs/heads/master | /gui.py | from main import *
from tkinter import *
import threading
dead = False
thread = threading.Thread()
#____BUTTON COMMANDS________
def startComputation():
str = ""
filename = inputTextField.get("1.0", END)
str = filename.strip()
#If the "Use default values" box is checked we set the def... | {"/helperFunctions.py": ["/parsing_functions.py"], "/main.py": ["/helperFunctions.py", "/generator.py"], "/gui.py": ["/main.py"]} |
57,587 | ocolisanrares97/Equation-System-Solver-with-Python | refs/heads/master | /generator.py | import random
class Generator:
def __init__(self):
self.n= int(input("Give number of equations/unknowns"))
self.solutions = []
self.coef = []
self.results = []
self.boot()
def boot(self):
for i in range(self.n):
self.solutions.append(ra... | {"/helperFunctions.py": ["/parsing_functions.py"], "/main.py": ["/helperFunctions.py", "/generator.py"], "/gui.py": ["/main.py"]} |
57,590 | Eugene208029488/FullStackProject-Movie-Trailer | refs/heads/master | /media.py | class Movie():
def __init__(self, movie_title, movie_storyline, poster_image
, trailer_youtube):
self.title=movie_title
self.sotryline=movie_storyline
self.poster_image_url = poster_image
self.trailer_youtube_url = trailer_youtube
| {"/entertainment_center.py": ["/media.py"]} |
57,591 | Eugene208029488/FullStackProject-Movie-Trailer | refs/heads/master | /entertainment_center.py | import media
import fresh_tomatoes
toy_story = media.Movie("Toy Story",
"A story about a toy",
"http://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg",
"https://www.youtube.com/watch?v=vwyZH85NQC4")
avatar = media.Movie("Avatar",
... | {"/entertainment_center.py": ["/media.py"]} |
57,592 | matrixalex/DemoDjango | refs/heads/master | /src/apps/core/models/abstract_model.py | import uuid as uuid
from django.utils import timezone
from django.db import models
from django.utils.translation import gettext_lazy as _
class AbstractModelManager(models.Manager):
"""
Менеджер абстрактной модели
"""
def get_queryset(self):
return super(AbstractModelManager, self).get_queryse... | {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,593 | matrixalex/DemoDjango | refs/heads/master | /src/apps/core/models/log.py | from .abstract_model import AbstractModel
from django.db import models
from django.utils.translation import gettext_lazy as _
class Log(AbstractModel):
text = models.TextField(verbose_name=_(u'Текст'))
user = models.ForeignKey('users.User', on_delete=models.CASCADE, related_name='log_user',
... | {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,594 | matrixalex/DemoDjango | refs/heads/master | /src/apps/users/models/user.py | from django.contrib.auth.models import AbstractUser, BaseUserManager, Permission
from src.apps.core.models import AbstractModel, AbstractModelManager
from django.db import models
from typing import List
class UserManager(AbstractModelManager, BaseUserManager):
"""
Менеджер создания
"""
def create_user... | {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,595 | matrixalex/DemoDjango | refs/heads/master | /src/apps/core/apps.py | from django.apps import AppConfig
class Config(AppConfig):
name = 'src.apps.core'
label = 'core'
def ready(self):
self.verbose_name = 'Ядро'
| {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,596 | matrixalex/DemoDjango | refs/heads/master | /src/apps/debts/views.py | from django.shortcuts import render, redirect
from django.views import View
from . import services
class MyDebtsView(View):
"""
Контроллер получения, добавления долга
"""
def get(self, request):
if not request.user.is_authenticated:
return redirect('/auth/login')
data = {'... | {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,597 | matrixalex/DemoDjango | refs/heads/master | /src/apps/core/admin/models/__init__.py | from .base_admin import BaseModelAdmin
from .log_admin import LogAdmin
| {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,598 | matrixalex/DemoDjango | refs/heads/master | /src/apps/core/models/__init__.py | from .abstract_model import AbstractModel, AbstractModelManager
from .log import Log
| {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,599 | matrixalex/DemoDjango | refs/heads/master | /src/apps/users/admin/__init__.py | from django.contrib.admin import site
from django.contrib.auth.models import Group
from ..models import User
from .models import UserAdmin
site.register(User, UserAdmin)
site.unregister(Group)
| {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,600 | matrixalex/DemoDjango | refs/heads/master | /src/apps/debts/admin/models/__init__.py | from .debt_admin import DebtAdmin
| {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,601 | matrixalex/DemoDjango | refs/heads/master | /src/apps/debts/models/__init__.py | from .debt import Debt
| {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,602 | matrixalex/DemoDjango | refs/heads/master | /src/apps/users/services.py | from typing import Union, Optional, NamedTuple
from .models import User
from django.contrib.auth import authenticate as auth, login
from ..core.errors import ErrorMessages
class UserAuthData(NamedTuple):
status: bool
message: str
user: Optional[User]
def get_user_by_unique_field(user_id: Union[str, int... | {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,603 | matrixalex/DemoDjango | refs/heads/master | /src/apps/debts/admin/models/debt_admin.py | from src.apps.core.admin import BaseModelAdmin
from src.apps.debts.models import Debt
from django import forms
class DebtChangeForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(DebtChangeForm, self).__init__(*args, **kwargs)
class Meta:
model = Debt
fields = ['text', '... | {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,604 | matrixalex/DemoDjango | refs/heads/master | /src/apps/core/admin/models/log_admin.py | from .base_admin import BaseModelAdmin
class LogAdmin(BaseModelAdmin):
list_display = ('user', 'text', 'created_at')
| {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,605 | matrixalex/DemoDjango | refs/heads/master | /src/apps/core/errors.py | from django.utils.translation import gettext_lazy as _
class ErrorMessages:
WRONG_EMAIL_OR_PASSWORD = _(u'Неправильно введен email или пароль')
| {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,606 | matrixalex/DemoDjango | refs/heads/master | /src/apps/debts/services.py | from .models import Debt
from src.apps.users.models import User
from django.db.models import Q
class DebtData:
def __init__(self, debt: Debt, is_positive: bool):
self.text = debt.text
self.price = debt.price
self.is_positive = is_positive
self.created_at = debt.created_at
class ... | {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,607 | matrixalex/DemoDjango | refs/heads/master | /src/apps/users/views.py | from django.contrib.auth import logout
from django.views import View
from django.shortcuts import render, redirect
from . import services as user_services
class LoginView(View):
"""
Аторизация пользователя
"""
def get(self, request):
if request.user.is_authenticated:
return redire... | {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,608 | matrixalex/DemoDjango | refs/heads/master | /src/apps/urls.py | from django.urls import path, include
urlpatterns = [
path('', include('src.apps.core.urls')),
path('auth/', include('src.apps.users.urls')),
path('debts', include('src.apps.debts.urls')),
]
| {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,609 | matrixalex/DemoDjango | refs/heads/master | /src/apps/debts/models/debt.py | from django.db.models import Q
from src.apps.core.models import AbstractModel, AbstractModelManager
from django.db import models
from django.utils.translation import gettext_lazy as _
class DebtManager(AbstractModelManager):
def filter_by_user(self, user):
"""
Фильтрует долги по пользователю
... | {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,610 | matrixalex/DemoDjango | refs/heads/master | /src/apps/core/views.py | from django.shortcuts import redirect
def index(request):
"""
Корневой url сайта
:param request: мета данные
:return: HttpResponse
"""
user = request.user
if not user.is_authenticated:
return redirect('/auth/login')
if user.is_superuser:
return redirect('/admin')
re... | {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,611 | matrixalex/DemoDjango | refs/heads/master | /src/apps/core/admin/actions.py | from ..models import Log
def delete_selected(modeladmin, request, queryset):
for obj in queryset:
if str(type(obj)) == "<class 'src.apps.users.models.user.User'>" and obj.id == request.user.id:
continue
obj.is_deleted = True
obj.save()
Log.objects.create(user=request.us... | {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,612 | matrixalex/DemoDjango | refs/heads/master | /src/apps/core/admin/__init__.py | from .models import BaseModelAdmin, LogAdmin
from django.contrib.admin import site
from ..models import Log
site.register(Log, LogAdmin)
| {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,613 | matrixalex/DemoDjango | refs/heads/master | /src/apps/debts/__init__.py | default_app_config = 'src.apps.debts.apps.Config'
| {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,614 | matrixalex/DemoDjango | refs/heads/master | /src/apps/users/urls.py | from django.urls import path, include
from . import views
urlpatterns = [
path('login', views.LoginView.as_view()),
path('logout', views.LogoutView.as_view())
]
| {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,615 | matrixalex/DemoDjango | refs/heads/master | /src/apps/debts/admin/__init__.py | from ..models import Debt
from .models import DebtAdmin
from django.contrib.admin import site
site.register(Debt, DebtAdmin)
| {"/src/apps/core/models/log.py": ["/src/apps/core/models/abstract_model.py"], "/src/apps/users/models/user.py": ["/src/apps/core/models/__init__.py"], "/src/apps/debts/views.py": ["/src/apps/debts/__init__.py"], "/src/apps/core/admin/models/__init__.py": ["/src/apps/core/admin/models/log_admin.py"], "/src/apps/core/mod... |
57,616 | grobalex/msgraph | refs/heads/main | /config.py | CLIENT_ID = ''
CLIENT_SECRET = ''
REDIRECT_URI = 'http://localhost:5000/login/authorized'
AUTHORITY_URL = 'https://login.microsoftonline.com/common'
AUTH_ENDPOINT = '/oauth2/v2.0/authorize'
TOKEN_ENDPOINT = '/oauth2/v2.0/token'
RESOURCE = 'https://graph.microsoft.com/'
API_VERSION = 'v1.0'
SCOPES = ['User.Read'] # Ad... | {"/app.py": ["/config.py"]} |
57,617 | grobalex/msgraph | refs/heads/main | /app.py | import os
import uuid
import bottle
import requests_oauthlib
import config
MSGRAPH = requests_oauthlib.OAuth2Session(config.CLIENT_ID,
scope=config.SCOPES,
redirect_uri=config.REDIRECT_URI)
# Enable non-HTTPS redirect URI for devel... | {"/app.py": ["/config.py"]} |
57,623 | venglov/forta-utilization-rate-agent | refs/heads/master | /src/agent.py | import json
from forta_agent import Finding, FindingType, FindingSeverity, get_json_rpc_url
from web3 import Web3
from src.constants import CTOKEN_CONTRACTS, ABI, TIME_WINDOW, UTILIZATION_RATE_TH
class UtilizationRate:
def __init__(self, token):
self.token = token
self.rates = []
def add_rate... | {"/src/agent.py": ["/src/constants.py"], "/src/agent_test.py": ["/src/agent.py"]} |
57,624 | venglov/forta-utilization-rate-agent | refs/heads/master | /src/constants.py | CTOKEN_CONTRACTS = {
"cAAVE": "0xe65cdb6479bac1e22340e4e755fae7e509ecd06c",
"cBAT": "0x6c8c6b02e7b2be14d4fa6022dfd6d75921d90e4e",
"cCOMP": "0x70e36f6bf80a52b3b46b3af8e106cc0ed743e8e4",
"cDAI": "0x5d3a536e4d6dbd6114cc1ead35777bab948e3643",
"cETH": "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5",
"cL... | {"/src/agent.py": ["/src/constants.py"], "/src/agent_test.py": ["/src/agent.py"]} |
57,625 | venglov/forta-utilization-rate-agent | refs/heads/master | /src/agent_test.py | from src.agent import UtilizationRate
class TestUtilizationRate:
def test_removes_old_logs(self):
ur = UtilizationRate("SMILE")
ur.add_rate(0.1, 50)
ur.add_rate(0.1, 100)
ur.add_rate(0.11, 120)
ur.add_rate(0.12, 140)
ur.add_rate(0.12, 160)
ur.add_rate(0.12, ... | {"/src/agent.py": ["/src/constants.py"], "/src/agent_test.py": ["/src/agent.py"]} |
57,626 | niki4smirn/test | refs/heads/master | /main.py | import numpy as np
import cv2
import trajectory_builder as tb
class Nail:
def __init__(self, x, y, idx, param):
self._x = x
self._y = y
self._idx = idx
self._r = param["r"]
self._head_r = param["head_r"]
self._length = param["length"]
self._depth = param[... | {"/main.py": ["/trajectory_builder.py"]} |
57,627 | niki4smirn/test | refs/heads/master | /trajectory_builder.py | def dist(x1, y1, x2, y2):
return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
def circles_intersection(x1, y1, r1, x2, y2, r2):
d = dist(x1, y1, x2, y2)
if d > r1 + r2 or d < r1 - r2 or not d:
return None
a = (r1 ** 2 - r2 ** 2 + d ** 2) / (2 * d)
h = (r1 ** 2 - a ** 2) ** 0.5
x3 = x1 + a... | {"/main.py": ["/trajectory_builder.py"]} |
57,669 | dreipoe/RecipeBook | refs/heads/master | /app/main/admin.py | from django.contrib import admin
# Register your models here.
from main.models import *
admin.site.register(Measure)
admin.site.register(Ingredient)
admin.site.register(Receipt)
admin.site.register(ReceiptItem)
| {"/app/main/views.py": ["/app/main/models.py"]} |
57,670 | dreipoe/RecipeBook | refs/heads/master | /app/main/models.py | from django.core.paginator import Paginator, Page
from django.db import models
class NamedModel(models.Model):
"""Абстрактный класс модели с полем name"""
class Meta:
abstract = True
name = None
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
assert(is... | {"/app/main/views.py": ["/app/main/models.py"]} |
57,671 | dreipoe/RecipeBook | refs/heads/master | /app/main/views.py | from django.db.models import Q
from django.core.handlers.wsgi import WSGIRequest
from django.shortcuts import render, get_object_or_404
from .models import Receipt, ReceiptItem, Ingredient
def index(request: WSGIRequest):
receipt_name = request.GET.get("receipt")
ingredient_name = request.GET.get("ingredient... | {"/app/main/views.py": ["/app/main/models.py"]} |
57,672 | dreipoe/RecipeBook | refs/heads/master | /app/main/migrations/0003_auto_20211104_1439.py | # Generated by Django 3.2.9 on 2021-11-04 09:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0002_auto_20211102_1305'),
]
operations = [
migrations.AddField(
model_name='measure',
name='name_genitive',... | {"/app/main/views.py": ["/app/main/models.py"]} |
57,673 | TheoKlein/snake-core | refs/heads/master | /snake/core/route_support.py | """The module containing support for router modules.
This contains functions that are shared between the routes modules.
"""
import asyncio
import os
import shutil
import zipfile
from datetime import datetime
from snake import db
from snake import enums
from snake import error
from snake import schema
from snake imp... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,674 | TheoKlein/snake-core | refs/heads/master | /tests/core/test_route_support.py | # pylint: disable=missing-docstring
import pytest
from snake import error
from snake import schema
from snake.config import snake_config
from snake.core import route_support
@pytest.mark.asyncio
async def test_execute_autoruns(mocker):
"""
Test execute_autoruns function
"""
state = {
'queue... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,675 | TheoKlein/snake-core | refs/heads/master | /snake/managers.py | """The managers module.
This contains all instantiated managers for uses around snake.
Attributes:
scale_manager (:obj:`ScaleManager`): The scale manager.
"""
from snake.core import scale_manager
scale_manager = scale_manager.ScaleManager() # pylint: disable=invalid-name
| {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,676 | TheoKlein/snake-core | refs/heads/master | /snake/snaked.py | #!/usr/bin/python3
"""The snake daemon.
This is snake. This is how snake is loaded, usually this file is called through
a service but it can also be called from the command line (usually for
debug/development purposes).
Examples:
snaked # Run snake (if installed with pip).
python -m snake.snaked -d # Run sn... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,677 | TheoKlein/snake-core | refs/heads/master | /snake/routes/memory.py | """ The memory route module.
Attributes:
MemoryRoute (tuple): The MemoryRoute.
MemoriesRoute (tuple): The MemoriesRoute.
"""
from tornado import escape
from webargs import tornadoparser
from snake import db
from snake import enums
from snake import error
from snake import fields
from snake import schema
from... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,678 | TheoKlein/snake-core | refs/heads/master | /snake/routes/download.py | """ The download route module.
Attributes:
DownloadRoute (tuple): The DownloadRoute.
"""
from snake.core import snake_handler
from snake.db import async_file_collection
from snake.utils import file_storage as fs
from urllib.parse import quote
# pylint: disable=abstract-method
# pylint: disable=arguments-differ
... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,679 | TheoKlein/snake-core | refs/heads/master | /snake/db.py | """The database module.
This contains all the databse objects leveraging the engines.
Attributes:
command_collection (:obj:`CommandCollection`): The synchronous command collection.
file_collection (:obj:`FileCollection`): The synchronous file collection.
note_collection (:obj:`NoteCollection`)... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,680 | TheoKlein/snake-core | refs/heads/master | /snake/core/route_manager.py | """The module that supplies router management.
Currently this only hosts one function that is used to centralise the
generation of routes.
"""
def generate_routes(): # pylint: disable=too-many-locals
"""Generate a list of routes.
Returns:
list: The list of API routes.
"""
# Only load them o... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,681 | TheoKlein/snake-core | refs/heads/master | /snake/enums.py | """The enums module.
This contains all the enums used in snake.
"""
# pylint: disable=too-few-public-methods
class IterableType(type):
"""Base enum class.
This allows for iteration through the class variables. A little crude but
works for what is required.
"""
def __iter__(cls):
for a... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,682 | TheoKlein/snake-core | refs/heads/master | /snake/core/scale_manager.py | """The scale manager module.
This module provides scale management, it does all things scales. i.e. it is
responsible for loading, storing and providing access to scales.
"""
import logging
import os
import pkgutil
import sys
from importlib import util
import pkg_resources
from snake import enums
from snake import ... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,683 | TheoKlein/snake-core | refs/heads/master | /tests/test_scale.py | import pytest
from snake import scale
from snake.error import ScaleError
def test_command_decorator():
"""
Test the command decorator
"""
def f(args, file, opts): # pylint: disable=unused-argument
return 'abcd'
# Check no cmd_opts
cmd = scale.command()(f)
assert cmd.__command__... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,684 | TheoKlein/snake-core | refs/heads/master | /snake/utils/submitter.py | """The submitter module.
This is used to submit new samples to snake without using the API. This is
useful for scales that wish to upload as part of their workflow.
"""
from datetime import datetime
from snake import db
from snake import error
from snake import schema
from snake.utils import file_storage as fs
def... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,685 | TheoKlein/snake-core | refs/heads/master | /snake/scales/strings/__init__.py | # pylint: disable=missing-docstring
from snake.config import constants
from snake.scale import scale, FileType
__scale__ = scale(
name='strings',
description='a module to extract strings from files',
version=constants.VERSION,
author="Countercept",
supports=[
FileType.FILE
]
)
| {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,686 | TheoKlein/snake-core | refs/heads/master | /snake/utils/markdown.py | """The markdown module."""
# pylint: disable=invalid-name
def bold(text):
"""Bold.
Args:
text (str): text to make bold.
Returns:
str: bold text.
"""
return '**' + text + '**'
def code(text, inline=False, lang=''):
"""Code.
Args:
text (str): text to make code.
... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,687 | TheoKlein/snake-core | refs/heads/master | /snake/snake_utility.py | #!/usr/bin/python3
"""The snake command line utility.
This file exists to try and make the management of Snake easier. Currently its
only capability is to try and ease installation of Scales. But it will probably
do more at some point.
Examples:
snake install SCALE_NAME
snake install https://pypi.python.org/p... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,688 | TheoKlein/snake-core | refs/heads/master | /snake/utils/file_storage.py | """The file storage module."""
import hashlib
import os
from os import path
import shutil
import string
import magic
from snake import error
from snake.config import snake_config
class FileStorage():
"""File storage, used to manage files through snake.
Attributes:
sha256_digest (str): The hash of ... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,689 | TheoKlein/snake-core | refs/heads/master | /tests/test_error.py | import pytest
from snake import error
def test_snake_error():
"""
Test the class SnakeError
"""
with pytest.raises(TypeError):
error.SnakeError() # pylint: disable=no-value-for-parameter
err = error.SnakeError('hello')
assert 'hello' in err.message
assert None is err.status_code... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,690 | TheoKlein/snake-core | refs/heads/master | /snake/config/config.py | """The configuration module.
This module contains all the classes and code in order to share configuration
information across snake.
"""
import sys
from os import path
import pkg_resources
import yaml
from snake import error
from snake.config import constants
class Config:
"""The config class passed around sn... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,691 | TheoKlein/snake-core | refs/heads/master | /snake/routes/upload.py | """ The file route module.
Attributes:
UploadFileRoute (tuple): The UploadFileRoute.
UploadFilesRoute (tuple): The UploadFilesRoute.
UploadMemoryRoute (tuple): The UploadMemoryRoute.
"""
import hashlib
from os import path
from tornado import escape
from webargs import tornadoparser
from snake import db
... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,692 | TheoKlein/snake-core | refs/heads/master | /snake/core/celery.py | """All things celery.
This module contains everything needed for snake to communicate with celery.
This means that there are functions that will be shared by snake along with the
snake workers in the snake_pit.
Notes:
* The code in this file is a bit messy due to some issues that were met
when using celer... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,693 | TheoKlein/snake-core | refs/heads/master | /snake/scales/hashes/commands.py | # pylint: disable=missing-docstring
# pylint: disable=no-self-use
# pylint: disable=unused-argument
import hashlib
import logging
import shutil
from snake import db
from snake import enums
from snake import error
from snake import scale
from snake.utils import markdown as md
app_log = logging.getLogger("tornado.app... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,694 | TheoKlein/snake-core | refs/heads/master | /snake/scales/strings/commands.py | # pylint: disable=missing-docstring
# pylint: disable=no-self-use
# pylint: disable=unused-argument
import shutil
import subprocess
from snake import error
from snake import fields
from snake import scale
from snake.scales.strings import regex
SPECIAL_CHARS = [" ", "'", '(', '"', '|', '&', '<', '`', '!', '>', ';', ... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,695 | TheoKlein/snake-core | refs/heads/master | /snake/routes/file.py | """ The file route module.
Attributes:
FileHexRoute (tuple): The FileHexRoute.
FileRoute (tuple): The FileRoute.
FilesRoute (tuple): The FilesRoute.
"""
from tornado import escape
from webargs import tornadoparser
from snake import db
from snake import enums
from snake import error
from snake import fiel... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,696 | TheoKlein/snake-core | refs/heads/master | /snake/config/__init__.py | """This module exposes the initialised config object.
Attributes:
config_parser (:obj:`Config`): The configuration parser for snake.
scale_configs (dict): Convenient access to the scale_configs dictionary.
snake_config (dict): Convenient access to the snake_config dictionary.
"""
from snake.config import c... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,697 | TheoKlein/snake-core | refs/heads/master | /snake/routes/api.py | """ The API route module.
Attributes:
APIRoute (tuple): The APIRoute.
"""
from snake.config import constants
from snake.core import snake_handler
# pylint: disable=abstract-method
# pylint: disable=arguments-differ
class APIHandler(snake_handler.SnakeHandler):
"""Extends `SnakeHandler`."""
async def ... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,698 | TheoKlein/snake-core | refs/heads/master | /snake/scale.py | """The scale module.
This contains most if not all the code required to create a scale for snake.
"""
import abc
import copy
import functools
import importlib
import json as j
import logging
import pkgutil
import sys
from snake import enums
from snake import error
from snake import schema
from snake import utils
fro... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,699 | TheoKlein/snake-core | refs/heads/master | /tests/utils/test_markdown.py | from snake.utils import markdown as md
def test_bold():
"""
Test bold function
"""
output = md.bold('abcd')
assert output == '** abcd **'
def test_code():
"""
Test code function
"""
output = md.code('abcd')
assert output == '```\r\nabcd\r\n```'
def test_cr():
"""
... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,700 | TheoKlein/snake-core | refs/heads/master | /snake/engines/mongo/command.py | """The Mongo Command Collection Module.
This module provides everything required to communicate with the Mongo CommandCollection.
"""
import bson
import gridfs
from motor import motor_asyncio
import pymongo
from pymongo import collation
from snake import enums
class CommandCollection():
"""Synchronous Command... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,701 | TheoKlein/snake-core | refs/heads/master | /tests/config/test_config.py | import pytest
from snake import error
from snake.config import config
from snake.config import constants
# pylint: disable=too-many-statements
def test_config(mocker):
"""
Test the Config class
"""
def blank_file(*args, **kwargs): # pylint: disable=unused-argument
return './tests/files/bl... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
57,702 | TheoKlein/snake-core | refs/heads/master | /snake/config/constants.py | """The constants used throughout snake
Attributes:
API_VERSION (str): The API version number.
USER_AGENT (str): The User Agent string. This should be used whenever snake
performs requests.
VERSION (str): The snake version number.
ETC_DIR (str): The path to the etc folder for snake.
"""
API_VE... | {"/snake/core/route_support.py": ["/snake/config/__init__.py", "/snake/managers.py"], "/tests/core/test_route_support.py": ["/snake/config/__init__.py"], "/snake/snaked.py": ["/snake/config/__init__.py", "/snake/core/celery.py", "/snake/core/route_manager.py", "/snake/core/snake_handler.py"], "/snake/routes/download.py... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.