index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
20,873 | chshaiiith/PySimulator | refs/heads/master | /simulator.py | import Queue
import stats
# XXX: Override the comparator of priority queue to support our functionality
Q = Queue.PriorityQueue()
time = 0
required_request_count = 0
def schedule(event):
Q.put((event["time"], event))
def run(no_of_request = None):
global time
global required_request_count
req... | {"/request_stream.py": ["/distribution.py", "/arrival.py", "/request.py", "/request_handler.py", "/simulator.py"], "/request_handler.py": ["/request_handler_fifo.py", "/request_handler_priority.py"], "/distribution.py": ["/deterministic.py", "/possion.py"], "/simulator.py": ["/stats.py", "/request_handler_fifo.py"], "/... |
20,874 | chshaiiith/PySimulator | refs/heads/master | /request_handler_priority.py | import Queue
import json
import random
import simulator
from allocation_policy import AllocationPolicy
from stats import Stats
from arrival import Arrival
from distribution import Distribution
event_map = {}
class RequesthandlerPriority:
def __init__(self):
with open("properties.json") as fp:
c... | {"/request_stream.py": ["/distribution.py", "/arrival.py", "/request.py", "/request_handler.py", "/simulator.py"], "/request_handler.py": ["/request_handler_fifo.py", "/request_handler_priority.py"], "/distribution.py": ["/deterministic.py", "/possion.py"], "/simulator.py": ["/stats.py", "/request_handler_fifo.py"], "/... |
20,875 | chshaiiith/PySimulator | refs/heads/master | /shortest_job_first_policy.py | import random
import json
from operator import itemgetter
# Ideally it should be request handler .
# XXX: Move all global variables to request_handler than RequestFiFo Handler
import request_handler_fifo
class SJF:
def __init__(self):
with open("properties.json") as fp:
config = json.load(fp)
... | {"/request_stream.py": ["/distribution.py", "/arrival.py", "/request.py", "/request_handler.py", "/simulator.py"], "/request_handler.py": ["/request_handler_fifo.py", "/request_handler_priority.py"], "/distribution.py": ["/deterministic.py", "/possion.py"], "/simulator.py": ["/stats.py", "/request_handler_fifo.py"], "/... |
20,876 | chshaiiith/PySimulator | refs/heads/master | /arrival.py | from distribution import Distribution
import simulator
import json
class Arrival:
def __init__(self):
with open("properties.json") as fp:
config = json.load(fp)
rate = config["arrival"]["rate"]
self.distribution = Distribution.get_distribution(config["arrival"]["distribution"]... | {"/request_stream.py": ["/distribution.py", "/arrival.py", "/request.py", "/request_handler.py", "/simulator.py"], "/request_handler.py": ["/request_handler_fifo.py", "/request_handler_priority.py"], "/distribution.py": ["/deterministic.py", "/possion.py"], "/simulator.py": ["/stats.py", "/request_handler_fifo.py"], "/... |
20,877 | chshaiiith/PySimulator | refs/heads/master | /request_handler_fifo.py | import Queue
import json
import simulator
from allocation_policy import AllocationPolicy
from stats import Stats
import sys
from distribution import Distribution
event_map = {}
request_to_server_map = {}
completion_time = []
class RequesthandlerFiFo:
def __init__(self):
global completion_time
wit... | {"/request_stream.py": ["/distribution.py", "/arrival.py", "/request.py", "/request_handler.py", "/simulator.py"], "/request_handler.py": ["/request_handler_fifo.py", "/request_handler_priority.py"], "/distribution.py": ["/deterministic.py", "/possion.py"], "/simulator.py": ["/stats.py", "/request_handler_fifo.py"], "/... |
20,878 | dougsc/gp | refs/heads/master | /engine/terminals/basic.py | from terminal_set import TerminalSet
from random import randint
def t_basic_terminals():
ts = TerminalSet(__name__)
ts.add_terminal_function(name='rand_int', func_ref=t_basic_rand_int, value_type='int', args=[0,9])
return ts
def t_basic_rand_int(lower_bound, upper_bound):
return randint(lower_bound, upper_bou... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,879 | dougsc/gp | refs/heads/master | /engine/utils/stats.py | from redis import Redis
class RedisWrap:
def __init__(self):
try:
self.redis_cli = Redis()
self.redis_cli.info()
except Exception, e:
print 'failed to connect to redis: %s' % (str(e))
self.redis_cli = None
def append(self, key, value, timestamp=False):
if self.redis_cli:
... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,880 | dougsc/gp | refs/heads/master | /engine/terminal_set.py |
class TerminalSet:
NODE_TYPE = 'terminal'
@classmethod
def is_terminal_value(cls, node):
return node['node_type'] == cls.NODE_TYPE and node.has_key('value') and (node['type'] in ['int', 'float'])
@classmethod
def terminal_value(cls, value):
return {'node_type': cls.NODE_TYPE, 'name': str(value), 'va... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,881 | dougsc/gp | refs/heads/master | /run_gp.py | import importlib
from engine.individual import Individual
from engine.runner import Runner
import argparse
def run(cls_path, cls_args, tree_depth, pop_size, max_gen, tourny_size, error_threshold):
print "debug with: run('%s', '%s', %d, %d, %d, %d, %f)" % (cls_path, cls_args, tree_depth, pop_size, max_gen, tourny_siz... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,882 | dougsc/gp | refs/heads/master | /exp/line.py |
# def get_terminal_set(self):
# def get_function_set(self):
# def initialize(self):
# def next(self):
# def function_lookup(self):
# def error(self, value):
from engine import *
from random import randint
from os import path
import csv
from engine.function_set import FunctionSet
import engine.functions.signs as... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,883 | dougsc/gp | refs/heads/master | /engine/functions/trig.py |
from math import tan,sin,cos
def add_functions(function_set):
function_set.add_function(name='tan', func_ref=f_trig_tan, arity=1)
function_set.add_function(name='sin', func_ref=f_trig_sin, arity=1)
function_set.add_function(name='cos', func_ref=f_trig_cos, arity=1)
def f_trig_tan(a):
return tan(a)
def f_... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,884 | dougsc/gp | refs/heads/master | /engine/individual.py | from tree import Tree
import numpy
class Individual:
STANDING_LIMITS = {'min': 1, 'max': 10, 'starting': 5}
def __init__(self, exp_class, exp_args=[]):
self.exp_class = exp_class
self.exp_args = exp_args
self._error = 0
self._standing = None
@property
def error(self):
return self._error
... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,885 | dougsc/gp | refs/heads/master | /engine/runner.py |
import numpy
import bisect
import random
import sys
from pprint import pformat
from utils.logger import GP_Logger
from utils.stats import Stats
class Runner:
NEW_GEN_DIST = {'mutate': 0.05, 'reproduce': 0.5}
# Stats Keys:
SK_LOWEST_ERROR = 'lowest_error'
SK_BEST_INDIVIDUAL = 'best_individual'
SK_TARGET_SAMP... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,886 | dougsc/gp | refs/heads/master | /viewer/app/utils/stats.py | from datetime import datetime as dt
from redis import Redis
def convert_sample(raw_sample):
sample = eval(raw_sample)
if sample.has_key('ts'):
sample['ts'] = dt.fromtimestamp(float('%d.%d' % (sample['ts'])))
return sample
def get_data(key):
r = Redis()
return map(lambda x:convert_sample(x), r.lrange(key... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,887 | dougsc/gp | refs/heads/master | /engine/functions/__init__.py | # Module definition
import signs
import trig
| {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,888 | dougsc/gp | refs/heads/master | /viewer/app/utils/__init__.py | # module def
| {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,889 | dougsc/gp | refs/heads/master | /engine/experiment.py |
class Experiment:
function_set = None
terminal_set = None
@classmethod
def get_terminal_set(cls):
return cls.terminal_set.get()
@classmethod
def get_function_set(cls):
return cls.function_set.get()
def function_lookup(self, name):
return getattr(self, name)
def index(self):
return N... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,890 | dougsc/gp | refs/heads/master | /viewer/app/utils/tree_render.py |
import pydot
import tempfile
class TreeRender:
def __init__(self, tree_data):
self.tree_data = tree_data
self.dot_index = 0
self.data = None
def _create_dot_node(self, layer, name):
print 'add node: ix: %d, lyr: %d, name: %s' % (self.dot_index, layer, name)
dot_node = pydot.Node('index_%d_lay... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,891 | dougsc/gp | refs/heads/master | /viewer/app/views.py | from flask import render_template, jsonify
from app import app
from utils import stats
from utils.tree_render import TreeRender
def _tree_render(index):
resp_data = {'index': index, 'tree': 'tree index %s not found' % (index)}
tree_data = stats.get_data('Runner:best_tree')
tree_render = TreeRender(tree_data[ind... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,892 | dougsc/gp | refs/heads/master | /exp/test.py |
# def get_terminal_set(self):
# def get_function_set(self):
# def initialize(self):
# def next(self):
# def function_lookup(self):
# def error(self, value):
from engine import *
from random import randint
from engine.function_set import FunctionSet
import engine.functions.signs as gp_f_signs
from engine.experim... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,893 | dougsc/gp | refs/heads/master | /engine/function_set.py |
class FunctionSet:
NODE_TYPE = 'function'
def __init__(self):
self.function_set = []
def add_function(self, name, func_ref, arity):
self.function_set.append({'node_type': self.NODE_TYPE, 'name': name, 'function': func_ref, 'arity': arity})
def get(self):
return self.function_set
| {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,894 | dougsc/gp | refs/heads/master | /engine/utils/logger.py |
import logging
import os
class GP_Logger:
LOG_DIR = '/Users/dclark/code/logs'
@classmethod
def logger(cls, name):
logger = logging.getLogger(name)
if len(logger.handlers) == 0:
# initialize the logger
print 'creating new logger for: %s' % (name)
logger.setLevel(logging.DEBUG)
fi... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,895 | dougsc/gp | refs/heads/master | /engine/functions/basic_ops.py | from numpy import product, average
def add_functions(function_set, arity):
function_set.add_function(name='max<%d>' % arity, func_ref=f_max, arity=arity)
function_set.add_function(name='min<%d>' % arity, func_ref=f_min, arity=arity)
function_set.add_function(name='sum<%d>' % arity, func_ref=f_sum, arity=arity)... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,896 | dougsc/gp | refs/heads/master | /engine/functions/signs.py |
def add_functions(function_set):
function_set.add_function(name='add', func_ref=f_math_add, arity=2)
function_set.add_function(name='subtract', func_ref=f_math_sub, arity=2)
function_set.add_function(name='multiply', func_ref=f_math_times, arity=2)
function_set.add_function(name='divide', func_ref=f_math_di... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,897 | dougsc/gp | refs/heads/master | /engine/terminals/__init__.py | # Module definition
| {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,898 | dougsc/gp | refs/heads/master | /engine/__init__.py | # Module definition
# Expose the basic interfaces
from individual import Individual
from runner import Runner
from terminal_set import TerminalSet
from function_set import FunctionSet
| {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,899 | dougsc/gp | refs/heads/master | /engine/tree.py | import random
from pprint import pformat
from copy import deepcopy
from utils.logger import GP_Logger
from terminal_set import TerminalSet
class Tree:
@classmethod
def log(cls):
return GP_Logger.logger(cls.__name__)
def __init__(self):
self.terminal_set=None
self.function_set=None
self.function_... | {"/exp/line.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/functions/trig.py", "/engine/experiment.py"], "/exp/test.py": ["/engine/__init__.py", "/engine/function_set.py", "/engine/functions/signs.py", "/engine/experiment.py"]} |
20,955 | Arsha-Meenu/2021_Project_django_river_fakejira | refs/heads/master | /dj_river_app/apps.py | from django.apps import AppConfig
class DjRiverAppConfig(AppConfig):
name = 'dj_river_app'
| {"/dj_river_app/views.py": ["/dj_river_app/models.py"], "/dj_river_app/admin.py": ["/dj_river_app/models.py"]} |
20,956 | Arsha-Meenu/2021_Project_django_river_fakejira | refs/heads/master | /dj_river_app/migrations/0001_initial.py | # Generated by Django 2.2.13 on 2021-02-23 03:24
from django.db import migrations, models
import django.db.models.deletion
import river.models.fields.state
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('river', '0002_auto_20210222_1224'),
]
... | {"/dj_river_app/views.py": ["/dj_river_app/models.py"], "/dj_river_app/admin.py": ["/dj_river_app/models.py"]} |
20,957 | Arsha-Meenu/2021_Project_django_river_fakejira | refs/heads/master | /dj_river_app/migrations/0004_mymodel.py | # Generated by Django 2.2.13 on 2021-03-01 04:51
from django.db import migrations, models
import django.db.models.deletion
import river.models.fields.state
class Migration(migrations.Migration):
dependencies = [
('river', '0002_auto_20210222_1224'),
('dj_river_app', '0003_auto_2021022... | {"/dj_river_app/views.py": ["/dj_river_app/models.py"], "/dj_river_app/admin.py": ["/dj_river_app/models.py"]} |
20,958 | Arsha-Meenu/2021_Project_django_river_fakejira | refs/heads/master | /dj_river_app/models.py | from django.db import models
# Create your models here.
import uuid
# Create your models here.
from river.models.fields.state import StateField
class Ticket(models.Model):
no = models.CharField("Ticket Number", max_length=50, default=uuid.uuid4, null=False, blank=False, editable=False,
... | {"/dj_river_app/views.py": ["/dj_river_app/models.py"], "/dj_river_app/admin.py": ["/dj_river_app/models.py"]} |
20,959 | Arsha-Meenu/2021_Project_django_river_fakejira | refs/heads/master | /dj_river_app/views.py | from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def Sample(request):
return HttpResponse(' Django River Example')
# django river
from django.urls import reverse
from django.shortcuts import get_object_or_404, redirect
from river.models import Stat... | {"/dj_river_app/views.py": ["/dj_river_app/models.py"], "/dj_river_app/admin.py": ["/dj_river_app/models.py"]} |
20,960 | Arsha-Meenu/2021_Project_django_river_fakejira | refs/heads/master | /dj_river_app/admin.py | from django.contrib import admin
import river_admin
# Register your models here.
from django.urls import reverse
from django.utils.safestring import mark_safe
from dj_river_app.models import Ticket
# here shows the river action functionality ie, what will happen after click on each button in the given act... | {"/dj_river_app/views.py": ["/dj_river_app/models.py"], "/dj_river_app/admin.py": ["/dj_river_app/models.py"]} |
20,961 | Arsha-Meenu/2021_Project_django_river_fakejira | refs/heads/master | /dj_river_app/migrations/0003_auto_20210223_1217.py | # Generated by Django 2.2.13 on 2021-02-23 06:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('dj_river_app', '0002_auto_20210223_1157'),
]
operations = [
migrations.RenameField(
model_name='ticket',
old_... | {"/dj_river_app/views.py": ["/dj_river_app/models.py"], "/dj_river_app/admin.py": ["/dj_river_app/models.py"]} |
20,962 | Arsha-Meenu/2021_Project_django_river_fakejira | refs/heads/master | /dj_river_app/migrations/0005_delete_mymodel.py | # Generated by Django 2.2.13 on 2021-03-01 08:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('dj_river_app', '0004_mymodel'),
]
operations = [
migrations.DeleteModel(
name='MyModel',
),
]
| {"/dj_river_app/views.py": ["/dj_river_app/models.py"], "/dj_river_app/admin.py": ["/dj_river_app/models.py"]} |
20,986 | nhlinh99/SSD | refs/heads/master | /ssd/utils/misc.py | import errno
import os
from PIL import Image
def str2bool(s):
return s.lower() in ('true', '1')
def mkdir(path):
try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST:
raise
def reorient_image(im):
try:
image_exif = im._getexif()
image_or... | {"/ssd/data/datasets/my_dataset.py": ["/ssd/utils/misc.py"]} |
20,987 | nhlinh99/SSD | refs/heads/master | /convert_pascalvoc_dataset/data_preprocess.py | from argparse import ArgumentParser
from tqdm import tqdm
import numpy as np
import random
import json
import math
import os
ALLOWED_EXTENSIONS = [".jpg", ".jpeg", ".png", ".gif"]
def parse_inputs():
""" Parser function to take care of the inputs """
parser = ArgumentParser(description='Argument: python dat... | {"/ssd/data/datasets/my_dataset.py": ["/ssd/utils/misc.py"]} |
20,988 | nhlinh99/SSD | refs/heads/master | /convert_pascalvoc_dataset/pascal_voc/pascal_voc.py | #! -*- coding: utf-8 -*-
import os
from PIL import Image
from utils.file_utils import create_if_not_exists, copy_file
from utils.xml_utils import create_xml_file
from tqdm import tqdm
import json
def reorient_image(im):
try:
image_exif = im._getexif()
image_orientation = image_exif[274]
... | {"/ssd/data/datasets/my_dataset.py": ["/ssd/utils/misc.py"]} |
20,989 | nhlinh99/SSD | refs/heads/master | /convert_pascalvoc_dataset/transform_images.py | # import cv2
# import os
# from tqdm import tqdm
# import json
# import numpy as np
# from argparse import ArgumentParser
# import math
# import random
# ALLOWED_EXTENSIONS = [".jpg", ".jpeg", ".png", ".gif"]
# pixel_border = 40
# def parse_inputs():
# """ Parser function to take care of the inputs """
# pa... | {"/ssd/data/datasets/my_dataset.py": ["/ssd/utils/misc.py"]} |
20,990 | nhlinh99/SSD | refs/heads/master | /demo.py | from vizer.draw import draw_boxes
from PIL import Image
import numpy as np
import collections
import argparse
import torch
import glob
import time
import cv2
import os
from ssd.config import cfg
from ssd.data.datasets import COCODataset, VOCDataset, MyDataset
from ssd.data.transforms import build_transforms
from ssd.m... | {"/ssd/data/datasets/my_dataset.py": ["/ssd/utils/misc.py"]} |
20,991 | nhlinh99/SSD | refs/heads/master | /ssd/data/datasets/my_dataset.py | import os
import torch.utils.data
import numpy as np
import xml.etree.ElementTree as ET
from PIL import Image
from ssd.utils.misc import reorient_image
from ssd.structures.container import Container
class MyDataset(torch.utils.data.Dataset):
class_names_5_labels = ('__background__', 'top_left', 'top_right', 'b... | {"/ssd/data/datasets/my_dataset.py": ["/ssd/utils/misc.py"]} |
20,992 | nhlinh99/SSD | refs/heads/master | /ssd/engine/inference.py | import logging
import os
import torch
import torch.utils.data
from tqdm import tqdm
from ssd.data.build import make_data_loader
from ssd.data.datasets.evaluation import evaluate
from ssd.utils import dist_util, mkdir
from ssd.utils.dist_util import synchronize, is_main_process
import cv2
def _accumulate_predictions... | {"/ssd/data/datasets/my_dataset.py": ["/ssd/utils/misc.py"]} |
20,993 | nhlinh99/SSD | refs/heads/master | /convert_pascalvoc_dataset/build.py | #! -*- coding: utf-8 -*-
import os
import sys
from argparse import ArgumentParser
from easydict import EasyDict as edict
from pascal_voc.pascal_voc import PASCALVOC07
config = edict()
config.author = "Sunshine Tech"
config.root = "annotation"
config.folder = "VOC2007"
config.annotation = "PASCAL VOC2007"
config.seg... | {"/ssd/data/datasets/my_dataset.py": ["/ssd/utils/misc.py"]} |
20,994 | akashkulkarni1192/Project-Text-Classification-using-RNN | refs/heads/master | /rnn_momentum_poetry_classifier.py | import theano
import theano.tensor as T
import numpy as np
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
import util as myutil
class RNN_class:
def __init__(self, hidden_layer_size, vocab_size):
self.M = hidden_layer_size
self.V = vocab_size
def fit(self, X, Y, learning_ra... | {"/rnn_momentum_poetry_classifier.py": ["/util.py"]} |
20,995 | akashkulkarni1192/Project-Text-Classification-using-RNN | refs/heads/master | /util.py | import string
import nltk
import numpy as np
from sklearn.utils import shuffle
def init_weights(fi, fo):
return np.random.randn(fi, fo) / np.sqrt(fi + fo)
def remove_punctuation(s):
return s.translate(string.punctuation)
def get_poetry_classifier_data(samples_per_class=700):
rf_data = open('robert_fros... | {"/rnn_momentum_poetry_classifier.py": ["/util.py"]} |
20,997 | swiich/face_recognize | refs/heads/master | /opencv.py | import cv2
vc = cv2.VideoCapture('test.avi')
c = 1
if vc.isOpened():
rval, frame = vc.read()
else:
rval = False
timF = 1000
while rval:
rval,frame = vc.read()
if(c%timF == 0):
cv2.imwrite('image/'+ str(c) + '.jpg', frame)
c += 1
cv2.waitKey(1)
vc.release() | {"/main.py": ["/avHash.py", "/hamming.py"]} |
20,998 | swiich/face_recognize | refs/heads/master | /main.py | import avHash
import hamming
img_path = ('.\img\\timg1.jpg', '.\img\\timg0.jpg')
if __name__ == '__main__':
ham = hamming.hamming(avHash.get_hash(img_path[0]), avHash.get_hash(img_path[1]))
print(avHash.get_hash(img_path[0]))
print(avHash.get_hash(img_path[1]))
print(ham)
if ham == 0:
prin... | {"/main.py": ["/avHash.py", "/hamming.py"]} |
20,999 | swiich/face_recognize | refs/heads/master | /faceDetection.py | #-*-coding:utf8-*-#
import cv2
from PIL import Image, ImageDraw
import numpy as np
def detectFaces(image_name):
#img = cv2.imread(image_name)
img = Image.open(image_name)
# face_cascade = cv2.CascadeClassifier("C:\\Users\Asshole\Anaconda3\pkgs\opencv-3.2.0-np112py36_203\Library\etc\haarcascades\haarcascad... | {"/main.py": ["/avHash.py", "/hamming.py"]} |
21,000 | swiich/face_recognize | refs/heads/master | /recognition.py | import dlib, os, glob, numpy
from skimage import io
from tkinter import filedialog, messagebox
def descriptor(path):
detector = dlib.get_frontal_face_detector()
shape = dlib.shape_predictor('..\shape_predictor_68_face_landmarks.dat')
faceRecog = dlib.face_recognition_model_v1('..\dlib_face_recognition_res... | {"/main.py": ["/avHash.py", "/hamming.py"]} |
21,001 | swiich/face_recognize | refs/heads/master | /PCAfail.py | import os, glob, cv2
import numpy as np
from PIL import Image
folder = 'E:\\Python\\PycharmProjects\\ImgHash\\img\\ma'
def pca(data, k):
data = np.float32(np.mat(data))
rows, cols = data.shape #图像大小
data_mean = np.mean(data, 0) #均值
Z = data - np.tile(data_mean,... | {"/main.py": ["/avHash.py", "/hamming.py"]} |
21,002 | swiich/face_recognize | refs/heads/master | /hamming.py | def hamming(str, str1):
ham = 0
for i in range(0, 15):
if str[i] != str1[i]:
ham += 1
return ham
| {"/main.py": ["/avHash.py", "/hamming.py"]} |
21,003 | swiich/face_recognize | refs/heads/master | /ffmpeg.py | import subprocess
ffmpegPath = "E:\Python\PycharmProjects\ImgHash\\ffmpeg-20170605-4705edb-win64-static\\bin\\ffplay.exe "
curMediaPath = "E:\Python\PycharmProjects\ImgHash\\img\\test.mp4"
cmd = ffmpegPath + curMediaPath
# os.popen(cmd)
# os.system(cmd)
subprocess.call(cmd)
| {"/main.py": ["/avHash.py", "/hamming.py"]} |
21,004 | swiich/face_recognize | refs/heads/master | /recognitionFail.py | import numpy as np
import cv2, os
def loadImg(path):
matrix = np.mat(np.zeros((9, 64*64)))
j = 0
for i in os.listdir(path):
if i.split('.')[1] == 'jpg':
try:
img = cv2.imread(path+i, 0)
except:
print('load %s failed' % i)
matrix[j... | {"/main.py": ["/avHash.py", "/hamming.py"]} |
21,005 | swiich/face_recognize | refs/heads/master | /avHash.py | #coding:utf-8
'''
第一步,缩小尺寸。
将图片缩小到8×8的尺寸,总共64个像素。这一步的作用是去除图片的细节,只保留结构、明暗等基本信息,摒弃不同尺寸、比例带来的图片差异。
第二步,简化色彩。
将缩小后的图片,转为64级灰度。也就是说,所有像素点总共只有64种颜色。
第三步,计算平均值。
计算所有64个像素的灰度平均值。
第四步,比较像素的灰度。
将每个像素的灰度,与平均值进行比较。大于或等于平均值,记为1;小于平均值,记为0。
第五步,计算哈希值。
将上一步的比较结果,组合在一起,就构成了一个64位的整数,这就是这张图片的指纹。组合的次序并不重要,只要保证所有图片都采用同样次序就行了。
得到指纹以后,就可以对比... | {"/main.py": ["/avHash.py", "/hamming.py"]} |
21,023 | havy-nguyen/FLASK-Book-Search | refs/heads/master | /project/routes.py | import os
import requests
from project.forms import RegistrationForm, LoginForm, SearchForm, ReviewForm
from project.models import User, Book, Review
from flask_sqlalchemy import SQLAlchemy
from project import app, db, bcrypt
from sqlalchemy import and_
from flask import render_template, url_for, flash, redirect, reque... | {"/project/routes.py": ["/project/forms.py", "/project/models.py", "/project/__init__.py"], "/project/forms.py": ["/project/models.py"], "/project/models.py": ["/project/__init__.py"]} |
21,024 | havy-nguyen/FLASK-Book-Search | refs/heads/master | /project/__init__.py | import os
from flask import Flask, session
from flask_session import Session
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from email_validator import *
from flask_login import LoginManager
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
app = Fla... | {"/project/routes.py": ["/project/forms.py", "/project/models.py", "/project/__init__.py"], "/project/forms.py": ["/project/models.py"], "/project/models.py": ["/project/__init__.py"]} |
21,025 | havy-nguyen/FLASK-Book-Search | refs/heads/master | /project/forms.py | from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from flask_login import current_user
from wtforms import StringField, PasswordField, SubmitField, BooleanField, TextAreaField, RadioField
from wtforms.validators import DataRequired, Length, Email, EqualTo, ValidationError
from project.mo... | {"/project/routes.py": ["/project/forms.py", "/project/models.py", "/project/__init__.py"], "/project/forms.py": ["/project/models.py"], "/project/models.py": ["/project/__init__.py"]} |
21,026 | havy-nguyen/FLASK-Book-Search | refs/heads/master | /project/models.py | from project import db, login_manager
from datetime import datetime
from email_validator import *
from flask_login import UserMixin
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
userna... | {"/project/routes.py": ["/project/forms.py", "/project/models.py", "/project/__init__.py"], "/project/forms.py": ["/project/models.py"], "/project/models.py": ["/project/__init__.py"]} |
21,027 | voonshunzhi/world | refs/heads/master | /migrations/versions/398de4f723c4_.py | """empty message
Revision ID: 398de4f723c4
Revises: b6a4b6f45fc8
Create Date: 2019-04-12 09:37:07.818252
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '398de4f723c4'
down_revision = 'b6a4b6f45fc8'
branch_labels = None
depends_on = None
def upgrade():
# ... | {"/world/models/seed/seedCountry.py": ["/world/models/models.py"], "/app.py": ["/world/models/models.py"], "/world/models/seed/seedLanguage.py": ["/world/models/models.py"], "/world/models/seed/seedCity.py": ["/world/models/models.py"]} |
21,028 | voonshunzhi/world | refs/heads/master | /migrations/versions/7cdfe2d4f328_.py | """empty message
Revision ID: 7cdfe2d4f328
Revises: 5409c24fd08e
Create Date: 2019-04-15 13:06:21.520423
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7cdfe2d4f328'
down_revision = '5409c24fd08e'
branch_labels = None
depends_on = None
def upgrade():
# ... | {"/world/models/seed/seedCountry.py": ["/world/models/models.py"], "/app.py": ["/world/models/models.py"], "/world/models/seed/seedLanguage.py": ["/world/models/models.py"], "/world/models/seed/seedCity.py": ["/world/models/models.py"]} |
21,029 | voonshunzhi/world | refs/heads/master | /world/models/seed/seedCountry.py | import csv
from world.models.models import Country;
from world import db;
f = open('../country.csv')
csv_f = csv.reader(f)
for _ in range(1):
next(csv_f)
for row in csv_f:
print(row)
row[4] = None if row[4] == 'NULL' or row[4] == '' else int(row[4])
row[5] = None if row[5] == 'NULL' or row[5] == '' ... | {"/world/models/seed/seedCountry.py": ["/world/models/models.py"], "/app.py": ["/world/models/models.py"], "/world/models/seed/seedLanguage.py": ["/world/models/models.py"], "/world/models/seed/seedCity.py": ["/world/models/models.py"]} |
21,030 | voonshunzhi/world | refs/heads/master | /migrations/versions/d4c7203bf19c_.py | """empty message
Revision ID: d4c7203bf19c
Revises:
Create Date: 2019-04-10 19:34:28.957803
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd4c7203bf19c'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | {"/world/models/seed/seedCountry.py": ["/world/models/models.py"], "/app.py": ["/world/models/models.py"], "/world/models/seed/seedLanguage.py": ["/world/models/models.py"], "/world/models/seed/seedCity.py": ["/world/models/models.py"]} |
21,031 | voonshunzhi/world | refs/heads/master | /world/models/models.py | from world import db;
CountryLanguage = db.Table('CountryLanguage',
db.Column('language_id', db.Integer, db.ForeignKey('language.id'), primary_key=True),
db.Column('country_code', db.String(128), db.ForeignKey('country.country_code'), primary_key=True),
)
class Country(db.Model):
__tablename__ = "country... | {"/world/models/seed/seedCountry.py": ["/world/models/models.py"], "/app.py": ["/world/models/models.py"], "/world/models/seed/seedLanguage.py": ["/world/models/models.py"], "/world/models/seed/seedCity.py": ["/world/models/models.py"]} |
21,032 | voonshunzhi/world | refs/heads/master | /migrations/versions/b6a4b6f45fc8_.py | """empty message
Revision ID: b6a4b6f45fc8
Revises: d4c7203bf19c
Create Date: 2019-04-12 09:34:23.479972
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b6a4b6f45fc8'
down_revision = 'd4c7203bf19c'
branch_labels = None
depends_on = None
def upgrade():
# ... | {"/world/models/seed/seedCountry.py": ["/world/models/models.py"], "/app.py": ["/world/models/models.py"], "/world/models/seed/seedLanguage.py": ["/world/models/models.py"], "/world/models/seed/seedCity.py": ["/world/models/models.py"]} |
21,033 | voonshunzhi/world | refs/heads/master | /app.py | from world import app;
from world.models.models import Language,CountryLanguage,City,Country;
from flask import render_template,request,redirect,url_for,abort;
import csv
from world import db;
@app.route("/")
def index():
return render_template("index.html")
@app.route("/search")
def search():
search = reques... | {"/world/models/seed/seedCountry.py": ["/world/models/models.py"], "/app.py": ["/world/models/models.py"], "/world/models/seed/seedLanguage.py": ["/world/models/models.py"], "/world/models/seed/seedCity.py": ["/world/models/models.py"]} |
21,034 | voonshunzhi/world | refs/heads/master | /world/models/seed/seedLanguage.py | import csv
from world.models.models import Language;
from world import db;
f = open('../language.csv')
csv_f = csv.reader(f)
for _ in range(1):
next(csv_f)
for row in csv_f:
print(row)
if row[2] == 'T':
row[2] = True
else:
row[2] = False
row[3] = float(row[3])
language = Lang... | {"/world/models/seed/seedCountry.py": ["/world/models/models.py"], "/app.py": ["/world/models/models.py"], "/world/models/seed/seedLanguage.py": ["/world/models/models.py"], "/world/models/seed/seedCity.py": ["/world/models/models.py"]} |
21,035 | voonshunzhi/world | refs/heads/master | /world/models/seed/seedCity.py | import csv
from world.models.models import City;
from world import db;
f = open('../city.csv')
csv_f = csv.reader(f)
for _ in range(1):
next(csv_f)
for row in csv_f:
print(row)
city = City(row[1],row[2],row[3],row[4])
db.session.add(city);
db.session.commit();
| {"/world/models/seed/seedCountry.py": ["/world/models/models.py"], "/app.py": ["/world/models/models.py"], "/world/models/seed/seedLanguage.py": ["/world/models/models.py"], "/world/models/seed/seedCity.py": ["/world/models/models.py"]} |
21,049 | Rnazx/Assignment-08 | refs/heads/main | /Q1.py | import library as rands
import matplotlib.pyplot as plt
import math
figure, axes = plt.subplots(nrows=3, ncols=2)#define no. of rows and collumns
RMS = []
Nroot = []
l = 100# no. of iterations
N = 250# start from N=250
i=1
while (i<=5):
print("**************************************************************... | {"/Q1.py": ["/library.py"], "/Q2.py": ["/library.py"]} |
21,050 | Rnazx/Assignment-08 | refs/heads/main | /Q2.py | import matplotlib.pyplot as plt
import library as lib
n = []
V = []
error = []
anavol = 12.56637#Analytical volume
a=1#dimensions of the ellipsoid
b=1.5
c=2
def elip(x,y,z):#equation of the ellipsoid
return ((x**2)/(a**2))+((y**2)/(b**2))+((z**2)/(c**2))
N = 45000
i = 0
while i < N:
i +=100
X... | {"/Q1.py": ["/library.py"], "/Q2.py": ["/library.py"]} |
21,051 | Rnazx/Assignment-08 | refs/heads/main | /library.py | import math
import random
import time
import matplotlib.pyplot as plt
def randomwalk(iterations, steps):
random.seed(None)
dis = 0
X = []
Y = []
sumdis = 0
for j in range(0, iterations):
X = []
Y = []
x = 0.0
y = 0.0
dis = 0.0
X.a... | {"/Q1.py": ["/library.py"], "/Q2.py": ["/library.py"]} |
21,054 | ShipraShalini/social_connect | refs/heads/main | /post/models.py | import uuid
from django.contrib.auth.models import User
from django.db.models import (
CASCADE,
PROTECT,
CharField,
DateTimeField,
ForeignKey,
Model,
TextField,
UUIDField,
)
class Post(Model):
uuid = UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
user = Foreig... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,055 | ShipraShalini/social_connect | refs/heads/main | /social_connect/utils.py | from user_agents import parse
def get_user_agent(headers):
"""Get user agent from the request."""
raw_agent = headers.get("HTTP_USER_AGENT") or ""
pretty_agent = str(parse(raw_agent))
return raw_agent, pretty_agent
def get_ip(headers):
"""Get IP from the request headers."""
return headers.ge... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,056 | ShipraShalini/social_connect | refs/heads/main | /post/v1/urls.py | from django.urls import path
from post.v1.views import AdminPostViewSet, PostViewSet
app_name = "post"
post_list = PostViewSet.as_view({"get": "list", "post": "create"})
post_detail = PostViewSet.as_view(
{"get": "retrieve", "put": "update", "patch": "partial_update", "delete": "destroy"}
)
admin_post_list = Adm... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,057 | ShipraShalini/social_connect | refs/heads/main | /post/v1/views.py | from rest_framework.permissions import IsAuthenticated
from post.serializers import PostSerializer
from social_connect.admin_override_views import AbstractAdminOverrideViewSet
from social_connect.custom_views import CustomModelViewSet
class PostViewSet(CustomModelViewSet):
"""A simple ViewSet for Post CRUD"""
... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,058 | ShipraShalini/social_connect | refs/heads/main | /social_connect/exception_handler.py | import logging
from datetime import datetime
from urllib.parse import quote
from django.views.defaults import page_not_found, permission_denied
from rest_framework import status
from social_connect.api_response import APIResponse
from social_connect.constants import BUILTIN_ERROR_MESSAGE, CLIENT_ERROR_SET
from social... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,059 | ShipraShalini/social_connect | refs/heads/main | /social_connect/admin_override_views.py | from django.db import transaction
from rest_framework.exceptions import PermissionDenied, ValidationError
from rest_framework.permissions import IsAdminUser, IsAuthenticated
from access.access_request_handler import AccessRequestHandler
from access.constants import STATUS_APPROVED, STATUS_IN_USE, STATUS_USED
from soci... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,060 | ShipraShalini/social_connect | refs/heads/main | /access/utils.py | from datetime import datetime, timedelta
from access.constants import ACCESS_REQUEST_VALID_DAYS
def get_last_valid_access_req_date():
"""Returns the last valid date for access request."""
return datetime.utcnow() - timedelta(days=ACCESS_REQUEST_VALID_DAYS)
| {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,061 | ShipraShalini/social_connect | refs/heads/main | /access/migrations/0001_initial.py | # Generated by Django 3.1.7 on 2021-03-20 10:32
import uuid
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,062 | ShipraShalini/social_connect | refs/heads/main | /social_connect/api_response.py | from rest_framework import status as http_status
from rest_framework.response import Response
from social_connect.constants import (
CONTENT_TYPE_JSON,
RESPONSE_KEY_DATA,
RESPONSE_KEY_ERROR,
RESPONSE_KEY_IS_SUCCESS,
)
class APIResponse(Response):
"""Custom API Response class."""
def __init__... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,063 | ShipraShalini/social_connect | refs/heads/main | /social_connect/constants.py | HTTP_HEADER_LIST = [
"REMOTE_ADDR",
"REMOTE_HOST",
"X_FORWARDED_FOR",
"TZ",
"QUERY_STRING",
"CONTENT_LENGTH",
"CONTENT_TYPE",
"LC_CTYPE",
"SERVER_PROTOCOL",
"SERVER_SOFTWARE",
]
MASKED_DATA = "XXXXXXXXX"
CONTENT_TYPE_JSON = "application/json"
CONTENT_TYPE_METHOD_MAP = {CONTENT_... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,064 | ShipraShalini/social_connect | refs/heads/main | /access/models.py | import uuid
from django.contrib.auth.models import User
from django.db import models
from django.db.models import (
CASCADE,
PROTECT,
CharField,
DateTimeField,
ForeignKey,
TextField,
UUIDField,
)
from access.constants import (
ACCESS_REQUEST_STATUS_CHOICES,
STATUS_EXPIRED,
STAT... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,065 | ShipraShalini/social_connect | refs/heads/main | /social_connect/urls.py | """social_connect URL Configuration"""
from django.contrib import admin
from django.urls import include, path
from drf_spectacular.views import (
SpectacularAPIView,
SpectacularRedocView,
SpectacularSwaggerView,
)
from rest_framework.decorators import api_view
from rest_framework_simplejwt.views import (
... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,066 | ShipraShalini/social_connect | refs/heads/main | /access/serializers.py | from rest_framework.serializers import ModelSerializer
from access.models import AccessRequest
from social_connect.serializers import MinimalUserSerializer
class AccessRequestSerializer(ModelSerializer):
admin = MinimalUserSerializer()
superadmin = MinimalUserSerializer()
user = MinimalUserSerializer()
... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,067 | ShipraShalini/social_connect | refs/heads/main | /social_connect/serializers.py | from django.contrib.auth.models import User
from rest_framework.serializers import ModelSerializer
class UserSerializer(ModelSerializer):
"""DRF Serializer for User model"""
class Meta:
model = User
exclude = ["password"]
class MinimalUserSerializer(ModelSerializer):
"""DRF Serializer f... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,068 | ShipraShalini/social_connect | refs/heads/main | /access/v1/urls.py | from django.urls import path
from access.v1.views import (
AdminAccessRequestView,
SuperAdminAccessRequestDecisionView,
SuperAdminAccessRequestListView,
)
app_name = "access"
urlpatterns = [
path("admin/", AdminAccessRequestView.as_view(), name="admin-access"),
path(
"superadmin/",
... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,069 | ShipraShalini/social_connect | refs/heads/main | /social_connect/custom_views.py | from rest_framework import mixins
from rest_framework.viewsets import GenericViewSet
from social_connect.api_response import APIResponse
def get_status_code(response):
"""Get Status code from the response."""
for attr in ["status", "status_code"]:
code = getattr(response, attr, None)
if code:... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,070 | ShipraShalini/social_connect | refs/heads/main | /access/v1/views.py | from rest_framework.permissions import IsAdminUser, IsAuthenticated
from rest_framework.views import APIView
from access.access_request_handler import AccessRequestHandler
from social_connect.api_response import APIResponse
from social_connect.permissions import IsSuperAdminUser
class AdminAccessRequestView(APIView)... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,071 | ShipraShalini/social_connect | refs/heads/main | /social_connect/middlewares.py | import json
import logging
from datetime import datetime
from urllib.parse import parse_qs
from django.core.serializers.json import DjangoJSONEncoder
from rest_framework.status import is_success
from social_connect.api_response import APIResponse
from social_connect.constants import (
CONTENT_TYPE_METHOD_MAP,
... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,072 | ShipraShalini/social_connect | refs/heads/main | /social_connect/permissions.py | from rest_framework.permissions import BasePermission
class IsSuperAdminUser(BasePermission):
"""Allows access only to SuperAdmin users."""
def has_permission(self, request, view):
"""Check condition for the permission."""
return bool(request.user and request.user.is_superuser)
| {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,073 | ShipraShalini/social_connect | refs/heads/main | /access/access_request_handler.py | from rest_framework.exceptions import ValidationError
from access.constants import (
STATUS_APPROVED,
STATUS_DECLINED,
STATUS_EXPIRED,
STATUS_IN_USE,
STATUS_PENDING,
STATUS_USED,
)
from access.models import AccessRequest
from access.serializers import AccessRequestSerializer
from access.utils i... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,074 | ShipraShalini/social_connect | refs/heads/main | /access/admin.py | from django.contrib import admin
from access.models import AccessRequest
admin.site.register(AccessRequest)
| {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,075 | ShipraShalini/social_connect | refs/heads/main | /access/constants.py | ACCESS_REQUEST_VALID_DAYS = 5 # In number of days
STATUS_PENDING = "pending"
STATUS_APPROVED = "approved"
STATUS_DECLINED = "declined"
STATUS_IN_USE = "in_use" # solely for acquiring lock.
STATUS_USED = "used"
STATUS_EXPIRED = "expired"
ACCESS_REQUEST_STATUS_CHOICES = (
(STATUS_PENDING, "Pending"),
(STATUS_... | {"/post/v1/urls.py": ["/post/v1/views.py"], "/post/v1/views.py": ["/social_connect/admin_override_views.py", "/social_connect/custom_views.py"], "/social_connect/exception_handler.py": ["/social_connect/api_response.py", "/social_connect/constants.py", "/social_connect/utils.py"], "/social_connect/admin_override_views.... |
21,103 | ShafigullinIK/python-project-lvl1 | refs/heads/master | /brain_games/games/prime.py | import random
import math
from brain_games.utils import is_even, convert_to_yes_no
GAME_DESCRIPTION = (
'Answer "yes" if given number is prime.'
'Otherwise answer "no".'
)
MAX_INT = 100
MIN_INT = 0
def create_question():
number = random.randint(MIN_INT, MAX_INT)
question = "{}".format(number)
co... | {"/brain_games/games/prime.py": ["/brain_games/utils.py"], "/brain_games/games/even.py": ["/brain_games/utils.py"]} |
21,104 | ShafigullinIK/python-project-lvl1 | refs/heads/master | /brain_games/games/progression.py | import random
GAME_DESCRIPTION = 'What number is missing in the progression?'
MAX_INT = 10
MIN_STEP = 1
MAX_STEP = 10
PROGRESSION_LENGTH = 10
def create_question():
number = random.randint(0, MAX_INT)
step = random.randint(MIN_STEP, MAX_STEP)
position = random.randint(0, PROGRESSION_LENGTH-1)
counte... | {"/brain_games/games/prime.py": ["/brain_games/utils.py"], "/brain_games/games/even.py": ["/brain_games/utils.py"]} |
21,105 | ShafigullinIK/python-project-lvl1 | refs/heads/master | /brain_games/games/even.py | import random
from brain_games.utils import is_even, convert_to_yes_no
GAME_DESCRIPTION = 'Answer "yes" if number even otherwise answer "no"'
MAX_INT = 100
MIN_INT = 0
def create_question():
number = random.randint(MIN_INT, MAX_INT)
correct_answer = convert_to_yes_no(is_even(number))
return (str(number),... | {"/brain_games/games/prime.py": ["/brain_games/utils.py"], "/brain_games/games/even.py": ["/brain_games/utils.py"]} |
21,106 | ShafigullinIK/python-project-lvl1 | refs/heads/master | /brain_games/games/gcd.py | import random
GAME_DESCRIPTION = 'Find the greatest common divisor of given numbers.'
MAX_INT = 100
MIN_INT = 0
def create_question():
number1 = random.randint(MIN_INT, MAX_INT)
number2 = random.randint(MIN_INT, MAX_INT)
question = "{} {}".format(number1, number2)
correct_answer = str(find_gcd(numbe... | {"/brain_games/games/prime.py": ["/brain_games/utils.py"], "/brain_games/games/even.py": ["/brain_games/utils.py"]} |
21,107 | ShafigullinIK/python-project-lvl1 | refs/heads/master | /brain_games/games/calc.py | import random
import operator
GAME_DESCRIPTION = 'What is the result of the expression?'
MAX_INT = 100
MIN_INT = 0
def create_question():
number1 = random.randint(MIN_INT, MAX_INT)
number2 = random.randint(MIN_INT, MAX_INT)
operations = [
(operator.add, "+"), (operator.sub, "-"), (operator.mul, ... | {"/brain_games/games/prime.py": ["/brain_games/utils.py"], "/brain_games/games/even.py": ["/brain_games/utils.py"]} |
21,108 | ShafigullinIK/python-project-lvl1 | refs/heads/master | /brain_games/engine.py | import brain_games.cli as cli
WIN_MESSAGE = "Congratulations, {}!"
LOSE_MESSAGE = "Let's try again, {}!"
WRONG_ANSWER_MESSAGE = (
"'{}' is wrong answer ;(. Correct answer was '{}'"
)
def run(game):
cli.greet(game.GAME_DESCRIPTION)
name = cli.ask_name()
player_won = True
counter = 0
while cou... | {"/brain_games/games/prime.py": ["/brain_games/utils.py"], "/brain_games/games/even.py": ["/brain_games/utils.py"]} |
21,109 | ShafigullinIK/python-project-lvl1 | refs/heads/master | /brain_games/games/__init__.py | from brain_games.games import calc, even, gcd, prime, progression # noqa
| {"/brain_games/games/prime.py": ["/brain_games/utils.py"], "/brain_games/games/even.py": ["/brain_games/utils.py"]} |
21,110 | ShafigullinIK/python-project-lvl1 | refs/heads/master | /brain_games/utils.py | def is_even(number):
return not (number % 2)
def convert_to_yes_no(val):
if val:
return "yes"
return "no"
| {"/brain_games/games/prime.py": ["/brain_games/utils.py"], "/brain_games/games/even.py": ["/brain_games/utils.py"]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.