index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
93,017 | MaliYudina/AdPY | refs/heads/master | /HW4/Accounting/application/salary.py | def calculate_salary():
print('Your salary is being calculated...')
| {"/HW5/main.py": ["/HW5/original.py"], "/HW2/hash_coding.py": ["/HW2/countries_parser.py"]} |
93,018 | MaliYudina/AdPY | refs/heads/master | /HW4/Accounting/__init__.py | print('This is an accounting project', __name__) | {"/HW5/main.py": ["/HW5/original.py"], "/HW2/hash_coding.py": ["/HW2/countries_parser.py"]} |
93,019 | MaliYudina/AdPY | refs/heads/master | /HW5/main.py | from .original import EmailManager
# it may also be Yandex or Mail.Ru
SMTP_HOST = 'smtp.gmail.com'
IMAP_HOST = 'imap.gmail.com'
LOGIN = 'login@gmail.com'
PASSWORD = 'qwerty'
SUBJECT = 'Subject'
MESSAGE = 'Message'
RCPTTO = ['vasya@email.com', 'petya@email.com']
HEADER = None
def _main():
email = EmailManager(
... | {"/HW5/main.py": ["/HW5/original.py"], "/HW2/hash_coding.py": ["/HW2/countries_parser.py"]} |
93,020 | MaliYudina/AdPY | refs/heads/master | /HW8_PostgreSQL/postgresql.py | """
Create 2 separate charts for student data and course data:
student:
add id
name
gpa
birth
course:
id
name
"""
import psycopg2 as pg
CONNSTR = 'host=192.168.99.100 port=15432 dbname=netologydb user=postgres'
def create_db(): # create table
# Password is provided by .pgpass
w... | {"/HW5/main.py": ["/HW5/original.py"], "/HW2/hash_coding.py": ["/HW2/countries_parser.py"]} |
93,021 | MaliYudina/AdPY | refs/heads/master | /HW4/Accounting/application/db/people.py | def get_employees():
print('The employees number is being checked...')
| {"/HW5/main.py": ["/HW5/original.py"], "/HW2/hash_coding.py": ["/HW2/countries_parser.py"]} |
93,022 | MaliYudina/AdPY | refs/heads/master | /HW2/countries_parser.py | import json
SOURCE_FILE = 'countries.json'
FILE_TO_WRITE = 'countries_link.txt'
"""
Написать класс итератора, который по каждой стране из файла countries.json
ищет страницу из википедии.
Записывает в файл пару: страна – ссылка.
"""
class WikipediaData:
def __init__(self, FILE_TO_WRITE, output):
self.cou... | {"/HW5/main.py": ["/HW5/original.py"], "/HW2/hash_coding.py": ["/HW2/countries_parser.py"]} |
93,023 | MaliYudina/AdPY | refs/heads/master | /HW4/utils/1.1_Function/Advance_print.py | """
Advanced printing with 3 non-obligatory arguments:
Printing starts with "start". Default - empty;
max_line - maximum length when printing. If more than maximum, start with a new line;
in_file - print in file or not.
"""
def adv_print(*args, start='', max_line=0, in_file=False):
result = str(start)
text = ... | {"/HW5/main.py": ["/HW5/original.py"], "/HW2/hash_coding.py": ["/HW2/countries_parser.py"]} |
93,024 | MaliYudina/AdPY | refs/heads/master | /HW2/hash_coding.py | import hashlib
from HW2.countries_parser import FILE_TO_WRITE
"""
Написать генератор, который принимает путь к файлу.
При каждой итерации возвращает md5 хеш каждой строки файла.
"""
def hash_encode(link):
return hashlib.md5(link.encode('utf-8')).hexdigest()
def hash_data(path):
with open(path, 'r', encod... | {"/HW5/main.py": ["/HW5/original.py"], "/HW2/hash_coding.py": ["/HW2/countries_parser.py"]} |
93,025 | MaliYudina/AdPY | refs/heads/master | /HW7_Regex/normalize_phonebook.py | from pprint import pprint
import csv
import re
SOURCE_FILE = 'phonebook_raw.csv'
PHONE_REGEX = '(\+7|8)(\s?)(\(?)(' \
'[0-9]{3})(\)?)(\s?)(\-?)(' \
'[0-9]{3})(\-?)([0-9]{2})(\-?)([0-9]{2})(\s?)(\(?)([а-яё]*)(\.?)' \
'(\s?)([0-9]*)(\)?)'
with open(SOURCE_FILE, encoding='UTF-8'... | {"/HW5/main.py": ["/HW5/original.py"], "/HW2/hash_coding.py": ["/HW2/countries_parser.py"]} |
93,026 | MaliYudina/AdPY | refs/heads/master | /HW1/Phone.py | """
Class definition for a Contact
"""
class Contact:
def __init__(self, name, surname, number, favourite=False, *args, **kwargs):
self.name = name
self.surname = surname
self.number = number
self.favourite = favourite
self.tuple = args
self.dict = kwargs
def _... | {"/HW5/main.py": ["/HW5/original.py"], "/HW2/hash_coding.py": ["/HW2/countries_parser.py"]} |
93,027 | brightLLer/DL-recommender-system | refs/heads/master | /nn_model.py | import tensorflow as tf
import time
import numpy as np
class AutoEncoder(object):
def __init__(self, sess, input_size, hidden_size, epochs, batch_size, start_lr, f_act, g_act, optimizer):
self.sess = sess
self.input_size = input_size
self.hidden_size = hidden_size
self.epochs = epoc... | {"/AutoRec.py": ["/data_processing.py", "/nn_model.py"], "/NeuCfRec.py": ["/data_processing.py"]} |
93,028 | brightLLer/DL-recommender-system | refs/heads/master | /AutoRec.py | import argparse
import tensorflow as tf
import matplotlib.pyplot as plt
from data_processing import read_movielens_data, create_user_item_matrix
from nn_model import AutoEncoder
import os, time
def parse_args():
parser = argparse.ArgumentParser(description="An autoencoder to process recommmender system")
par... | {"/AutoRec.py": ["/data_processing.py", "/nn_model.py"], "/NeuCfRec.py": ["/data_processing.py"]} |
93,029 | brightLLer/DL-recommender-system | refs/heads/master | /data_processing.py | import pandas as pd
from sklearn.model_selection import train_test_split
import numpy as np
def read_movielens_data(path='./ml-1m/ratings.dat', test_size=0.1, random_state=42):
r_cols = ['user_id', 'movie_id', 'rating', 'unix_timestamp']
ratings = pd.read_table(path, names=r_cols, sep = '::', engine = 'python'... | {"/AutoRec.py": ["/data_processing.py", "/nn_model.py"], "/NeuCfRec.py": ["/data_processing.py"]} |
93,030 | brightLLer/DL-recommender-system | refs/heads/master | /NeuCfRec.py | import keras
from keras.layers import Embedding, Dense, Concatenate, Multiply, Input, Reshape, Flatten, Dropout
from keras.models import Model
from keras.callbacks import ModelCheckpoint, TensorBoard
from keras import backend as K
from data_processing import read_movielens_data
import numpy as np
import argparse
import... | {"/AutoRec.py": ["/data_processing.py", "/nn_model.py"], "/NeuCfRec.py": ["/data_processing.py"]} |
93,040 | sonjoonho/flask-wii | refs/heads/master | /run.py | from flask.helpers import get_debug_flag
from flask_wii import create_app, socketio
from flask_wii.settings import DevelopmentConfig, ProductionConfig
import os
if __name__ == "__main__":
import eventlet
eventlet.monkey_patch()
CONFIG = DevelopmentConfig if get_debug_flag() else ProductionConfig
app =... | {"/run.py": ["/flask_wii/__init__.py", "/flask_wii/settings.py"], "/flask_wii/client/routes.py": ["/flask_wii/client/forms.py"], "/flask_wii/server/events.py": ["/flask_wii/server/utils.py", "/flask_wii/__init__.py"], "/flask_wii/server/routes.py": ["/flask_wii/__init__.py"], "/flask_wii/__init__.py": ["/flask_wii/sett... |
93,041 | sonjoonho/flask-wii | refs/heads/master | /flask_wii/client/forms.py | from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import InputRequired
class room_form(FlaskForm):
room = StringField("Room", validators=[InputRequired()])
| {"/run.py": ["/flask_wii/__init__.py", "/flask_wii/settings.py"], "/flask_wii/client/routes.py": ["/flask_wii/client/forms.py"], "/flask_wii/server/events.py": ["/flask_wii/server/utils.py", "/flask_wii/__init__.py"], "/flask_wii/server/routes.py": ["/flask_wii/__init__.py"], "/flask_wii/__init__.py": ["/flask_wii/sett... |
93,042 | sonjoonho/flask-wii | refs/heads/master | /flask_wii/client/routes.py | from flask import render_template, redirect, url_for
from flask_socketio import emit
from . import client
from .forms import room_form
@client.route("/controller", methods=["GET", "POST"])
def controller():
form = room_form()
if form.validate_on_submit():
room = form.room.data
print("Request t... | {"/run.py": ["/flask_wii/__init__.py", "/flask_wii/settings.py"], "/flask_wii/client/routes.py": ["/flask_wii/client/forms.py"], "/flask_wii/server/events.py": ["/flask_wii/server/utils.py", "/flask_wii/__init__.py"], "/flask_wii/server/routes.py": ["/flask_wii/__init__.py"], "/flask_wii/__init__.py": ["/flask_wii/sett... |
93,043 | sonjoonho/flask-wii | refs/heads/master | /flask_wii/server/events.py | from flask import request
from flask_socketio import emit, join_room, leave_room
from .utils import calculate_pos
from .. import socketio
@socketio.on("join", namespace="/wii")
def on_join(data):
room = data["room"]
sid = request.sid
join_room(room)
print("Server Connected to " + room + " from " + sid... | {"/run.py": ["/flask_wii/__init__.py", "/flask_wii/settings.py"], "/flask_wii/client/routes.py": ["/flask_wii/client/forms.py"], "/flask_wii/server/events.py": ["/flask_wii/server/utils.py", "/flask_wii/__init__.py"], "/flask_wii/server/routes.py": ["/flask_wii/__init__.py"], "/flask_wii/__init__.py": ["/flask_wii/sett... |
93,044 | sonjoonho/flask-wii | refs/heads/master | /flask_wii/settings.py | class Config(object):
DEBUG = False
TESTING = False
class DevelopmentConfig(Config):
ENV = "development"
DEBUG = True
TESTING = True
SECRET_KEY = "super secret"
class ProductionConfig(Config):
ENV = "production"
TESTING = False
# Changed in production
SECRET_KEY = "really sup... | {"/run.py": ["/flask_wii/__init__.py", "/flask_wii/settings.py"], "/flask_wii/client/routes.py": ["/flask_wii/client/forms.py"], "/flask_wii/server/events.py": ["/flask_wii/server/utils.py", "/flask_wii/__init__.py"], "/flask_wii/server/routes.py": ["/flask_wii/__init__.py"], "/flask_wii/__init__.py": ["/flask_wii/sett... |
93,045 | sonjoonho/flask-wii | refs/heads/master | /flask_wii/server/utils.py | from math import tan, radians
# Distance from the monitor in terms of number of monitor widths
DISTANCE_FROM_MONITOR = 2
def calculate_pos(alpha, beta):
x_pos = -tan(radians(alpha)) * 2 * DISTANCE_FROM_MONITOR
y_pos = -tan(radians(beta)) * 2 * DISTANCE_FROM_MONITOR
return {"x": x_pos, "y": y_pos}
| {"/run.py": ["/flask_wii/__init__.py", "/flask_wii/settings.py"], "/flask_wii/client/routes.py": ["/flask_wii/client/forms.py"], "/flask_wii/server/events.py": ["/flask_wii/server/utils.py", "/flask_wii/__init__.py"], "/flask_wii/server/routes.py": ["/flask_wii/__init__.py"], "/flask_wii/__init__.py": ["/flask_wii/sett... |
93,046 | sonjoonho/flask-wii | refs/heads/master | /flask_wii/server/routes.py | from flask import render_template, Blueprint, request, redirect, url_for
from . import server
import flask_wii
from random import randint
@server.route("/")
def index():
if request.user_agent.platform == "android":
return redirect(url_for("client.controller"))
else:
# FIXME: -- Need t... | {"/run.py": ["/flask_wii/__init__.py", "/flask_wii/settings.py"], "/flask_wii/client/routes.py": ["/flask_wii/client/forms.py"], "/flask_wii/server/events.py": ["/flask_wii/server/utils.py", "/flask_wii/__init__.py"], "/flask_wii/server/routes.py": ["/flask_wii/__init__.py"], "/flask_wii/__init__.py": ["/flask_wii/sett... |
93,047 | sonjoonho/flask-wii | refs/heads/master | /flask_wii/__init__.py | from flask import Flask
from flask_socketio import SocketIO
from flask_wii.settings import ProductionConfig
socketio = SocketIO()
def create_app(config_object=ProductionConfig):
app = Flask(__name__)
app.config.from_object(config_object)
from flask_wii.server import server as server_blueprint
from f... | {"/run.py": ["/flask_wii/__init__.py", "/flask_wii/settings.py"], "/flask_wii/client/routes.py": ["/flask_wii/client/forms.py"], "/flask_wii/server/events.py": ["/flask_wii/server/utils.py", "/flask_wii/__init__.py"], "/flask_wii/server/routes.py": ["/flask_wii/__init__.py"], "/flask_wii/__init__.py": ["/flask_wii/sett... |
93,049 | Vilperi27/verkkokauppa-projekti | refs/heads/master | /homepage/views.py | from django.shortcuts import render, HttpResponse
from homepage.models import Tuote
def home(request):
if request.method == "POST":
term = request.POST.get('search')
tuotteet = Tuote.objects.filter(product_name__contains=term) | Tuote.objects.filter(id__contains=term)
return render(r... | {"/homepage/views.py": ["/homepage/models.py"], "/homepage/admin.py": ["/homepage/models.py"]} |
93,050 | Vilperi27/verkkokauppa-projekti | refs/heads/master | /homepage/admin.py | from django.contrib import admin
from .models import Tuote
# Register your models here.
admin.site.register(Tuote) | {"/homepage/views.py": ["/homepage/models.py"], "/homepage/admin.py": ["/homepage/models.py"]} |
93,051 | Vilperi27/verkkokauppa-projekti | refs/heads/master | /homepage/models.py | from django.db import models
# Create your models here.
class Tuote(models.Model):
product_name = models.CharField(max_length=150)
product_description = models.CharField(max_length=1000)
product_image = models.CharField(max_length=2000)
product_price = models.DecimalField(max_digits=65, decimal_places=... | {"/homepage/views.py": ["/homepage/models.py"], "/homepage/admin.py": ["/homepage/models.py"]} |
93,052 | Vilperi27/verkkokauppa-projekti | refs/heads/master | /homepage/forms.py | from django import forms
#class SortForm(forms.Form):
#sort_dir = forms.ChoiceField(widget=forms.RadioSelect, ['Tuotekoodi', 'Nimi', 'Hinta'])
| {"/homepage/views.py": ["/homepage/models.py"], "/homepage/admin.py": ["/homepage/models.py"]} |
93,053 | Vilperi27/verkkokauppa-projekti | refs/heads/master | /homepage/urls.py | from django.urls import path
from . import views
urlpatterns = [
path("", views.home, {}),
path("sort/<term>", views.sort_products),
] | {"/homepage/views.py": ["/homepage/models.py"], "/homepage/admin.py": ["/homepage/models.py"]} |
93,054 | Vilperi27/verkkokauppa-projekti | refs/heads/master | /homepage/migrations/0001_initial.py | # Generated by Django 3.1.4 on 2021-01-10 10:05
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Tuote',
fields=[
('id', models.AutoField(au... | {"/homepage/views.py": ["/homepage/models.py"], "/homepage/admin.py": ["/homepage/models.py"]} |
93,063 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/database/models.py | '''
Created on 16/11/2015
@author: Joao Pimentel
'''
from sqlalchemy import Table, Column
from sqlalchemy import Integer, String, DateTime, Boolean, LargeBinary
from sqlalchemy import ForeignKeyConstraint
from .connection import metadata, connect
types = Table(
'types', metadata,
Column('type_id', Integer, ... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,064 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/datahub/__init__.py | import json
from ..utils import limit
from .load_list import load_datahub_list
def _sync(args, names):
from .sync_crawler import SyncCrawler
crawler = SyncCrawler()
crawler(names)
return crawler
def _async(args, names):
import asyncio
from .async_crawler import AsyncCrawler
loop = asynci... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,065 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/utils.py | '''
Created on 20/11/2015
@author: Joao Pimentel
'''
import tqdm
def limit(collection, first, last):
last = last if last != -1 else len(collection)
if last < first:
first = first - 1 if first else None
last = last - 1
collection = collection[last:first:-1]
else:
collection ... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,066 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/resources/__init__.py | from functools import partial
from .cache_voids import update_description, crawler, void_resources
def cache(args):
voids = void_resources()
crawler(voids)
def resources_func(parser, args):
if hasattr(args, 'rfunc'):
args.rfunc(args)
else:
parser.print_help()
def create_subparser(s... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,067 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/database/__init__.py | from functools import partial
from .connection import create_database, connect
from .models import create_schema
from .queries import q_delete_empty_check_voids
def delete_empty_check_voids(args):
with connect as conn:
conn.execute(q_delete_empty_check_voids)
def database_func(parser, args):
if hasa... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,068 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/void/void_url.py | '''
Created on 19/11/2015
@author: Joao Pimentel
'''
from urllib.parse import urlparse
from itertools import groupby
from collections import OrderedDict
from ..database.connection import connect
from ..database.queries import q_urls
class Url:
def __init__(self, fid, url, source, content_type=None):
se... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,069 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/void/__init__.py | from ..utils import limit
from .void_url import void_list
def _sync(args, voids_groups):
from .void_crawler import VoidCrawler
crawler = VoidCrawler()
crawler(voids_groups)
return crawler
def _async(args, voids_groups):
import asyncio
from .async_void_crawler import AsyncVoidCrawler
loop... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,070 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/datahub/async_crawler.py | '''
Created on 17/11/2015
@author: Joao Pimentel
'''
import asyncio
import aiohttp
from ..async_utils import wait_with_progress
from ..database.async_connection import engine
from ..database.queries import load_types, first
from ..database.queries import min_created_date, max_modified_date
from ..database.queries i... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,071 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/database/async_connection.py | '''
Created on 20/11/2015
@author: Joao Pimentel
'''
import asyncio
from aiopg.sa import create_engine
from .connection import USER, PASSWORD, HOST, DATABASE
@asyncio.coroutine
def engine():
return (yield from create_engine(
user=USER, database=DATABASE, host=HOST, password=PASSWORD))
| {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,072 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/async_utils.py | '''
Created on 20/11/2015
@author: Joao Pimentel
'''
import asyncio
import tqdm
@asyncio.coroutine
def wait_with_progress(coros):
for f in tqdm.tqdm(asyncio.as_completed(coros), total=len(coros)):
yield from f
| {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,073 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/datahub/shared.py | '''
Created on 20/11/2015
@author: Joao Pimentel
'''
def extra_links(extras):
for key, value in extras.items():
if key.startswith('links:'):
yield (key[6:], value)
def relationships(relations):
for relationship in relations:
if relationship['type'] == 'links_to':
yield... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,074 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/datahub/sync_crawler.py | '''
Created on 16/11/2015
@author: Joao Pimentel
'''
import requests
from ..utils import progress
from ..database.connection import connect
from ..database.queries import load_types, first
from ..database.queries import min_created_date, max_modified_date
from ..database.queries import (
fq_dataset_by_name, fq_... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,075 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/database/connection.py | '''
Created on 20/11/2015
@author: Joao Pimentel
'''
from sqlalchemy import create_engine, MetaData
USER = "postgres"
PASSWORD = "postgres"
HOST = "127.0.0.1"
DATABASE = "swlab"
engine = create_engine(
"postgresql+psycopg2://{}:{}@{}/{}".format(USER, PASSWORD, HOST, DATABASE),
client_encoding="utf8")
met... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,076 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/crawl_datasets.py | '''
Created on 03/11/2015
@author: Luiz Leme
'''
import argparse
from . import datahub
from . import database
from . import void
from . import resources
def main():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
datahub.create_subparser(subparsers)
database.create_subparse... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,077 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/main.py | '''
Created on 17/11/2015
@author: Joao Pimentel
'''
from tasks.crawl_datasets import main
if __name__ == '__main__':
main() | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,078 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/void/void_crawler.py | '''
Created on 19/11/2015
@author: Joao Pimentel
'''
import requests
from collections import defaultdict
from ..utils import progress
from ..database.connection import connect
from ..database.queries import first
from ..database.queries import fq_insert_check_void, fq_select_check_void
class VoidCrawler:
def... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,079 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/resources/cache_voids.py | '''
Created on 20/11/2015
@author: Joao Pimentel
'''
import requests
from ..utils import progress
from ..database.connection import connect
from ..database.queries import first
from ..database.queries import q_select_void, q_update_void
from ..database.queries import fq_select_resource_cache
from ..database.querie... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,080 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/void/async_void_crawler.py | '''
Created on 19/11/2015
@author: Joao Pimentel
'''
import asyncio
import aiohttp
from collections import defaultdict
from ..async_utils import wait_with_progress
from ..database.async_connection import engine
from ..database.queries import first
from ..database.queries import fq_insert_check_void, fq_select_chec... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,081 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/database/queries.py | '''
Created on 20/11/2015
@author: Joao Pimentel
'''
import chardet
from datetime import datetime as dt
from hashlib import sha1
from sqlalchemy import select, and_, or_
from .models import check_voids, datasets, dataset_features, features, types
from .models import resources, resource_cache
from .connection import co... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,082 | pedroribeirorj/SWLab | refs/heads/master | /Crawler/src/tasks/datahub/load_list.py | '''
Created on 16/11/2015
@author: Joao Pimentel
'''
import requests
import os
import json
def load_datahub_list(cache='.list_cache.json'):
if cache and os.path.exists(cache):
with open(cache, 'r') as cachef:
return json.load(cachef)
resp = requests.get('http://datahub.io/api/rest/dataset... | {"/Crawler/src/tasks/database/models.py": ["/Crawler/src/tasks/database/connection.py"], "/Crawler/src/tasks/resources/__init__.py": ["/Crawler/src/tasks/resources/cache_voids.py"], "/Crawler/src/tasks/database/__init__.py": ["/Crawler/src/tasks/database/connection.py", "/Crawler/src/tasks/database/models.py", "/Crawle... |
93,086 | apewithacomputer/ToDo | refs/heads/main | /ToDo/Todo/Todo/urls.py | from django.contrib import admin
from django.urls import path, include
from api import views
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('api.urls')),
path('', include('accounts.urls')),
path('tasks/', views.getTasks),
path('tasks/<str:pk>/', views.getTask),
path('tasks/c... | {"/ToDo/Todo/api/views.py": ["/ToDo/Todo/api/models.py"]} |
93,087 | apewithacomputer/ToDo | refs/heads/main | /ToDo/Todo/accounts/urls.py | from django.urls import path
from accounts.views import registration_view
app_name = "accounts"
urlpatterns = [
path('register/', registration_view),
]
| {"/ToDo/Todo/api/views.py": ["/ToDo/Todo/api/models.py"]} |
93,088 | apewithacomputer/ToDo | refs/heads/main | /ToDo/Todo/accounts/models.py | from django.db import models
class Accounts(models.Model):
username = models.TextField(max_length=125)
password = models.TextField(max_length=125)
def __self__(self):
return self.tasks
| {"/ToDo/Todo/api/views.py": ["/ToDo/Todo/api/models.py"]} |
93,089 | apewithacomputer/ToDo | refs/heads/main | /ToDo/Todo/accounts/views.py | from re import I
from rest_framework import serializers, status
from rest_framework.response import Response
from rest_framework.decorators import api_view
from accounts.serializers import RegistrationSerializer
@api_view(['POST'])
def registration_view(request):
serializer = RegistrationSerializer(data=request.d... | {"/ToDo/Todo/api/views.py": ["/ToDo/Todo/api/models.py"]} |
93,090 | apewithacomputer/ToDo | refs/heads/main | /ToDo/Todo/accounts/serializers.py | from django.db import models
from django.db.models import fields
from rest_framework import serializers
from accounts.models import Accounts
class RegistrationSerializer(serializers.ModelSerializer):
# password = serializers.CharField(style={'input_type': 'password', write_only = True})
class Meta:
mo... | {"/ToDo/Todo/api/views.py": ["/ToDo/Todo/api/models.py"]} |
93,091 | apewithacomputer/ToDo | refs/heads/main | /ToDo/Todo/api/views.py | from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.serializers import Serializer
from .serializers import TodoSerializer
from .models import Todo
from rest_framework.authentication import TokenAuthentication
from rest_framework.permissions import IsAuthentica... | {"/ToDo/Todo/api/views.py": ["/ToDo/Todo/api/models.py"]} |
93,092 | apewithacomputer/ToDo | refs/heads/main | /ToDo/Todo/api/models.py | from django.db import models
class Todo(models.Model):
tasks = models.TextField(max_length=125)
created = models.DateTimeField(auto_now=True)
updated = models.DateTimeField(auto_now_add=True)
def __self__(self):
return self.tasks
class Meta:
ordering = ['-created']
| {"/ToDo/Todo/api/views.py": ["/ToDo/Todo/api/models.py"]} |
93,123 | sirajyesuf/webscraper_bot | refs/heads/master | /handlers/registration.py | from typing import Text
from telegram import ext
import telegram
from telegram.ext import MessageHandler, Filters
from models.channel import update_channel
import time
def addChannel(update, context):
channel = update.message.forward_from_chat
if(check_for_the_bot_is_administorator(channel, context)):
... | {"/handlers/registration.py": ["/models/channel.py"], "/bot.py": ["/handlers/start.py", "/handlers/registration.py", "/handlers/startnow.py"], "/handlers/startnow.py": ["/models/channel.py", "/services/voa_scraper.py"], "/handlers/start.py": ["/services/voa_scraper.py"]} |
93,124 | sirajyesuf/webscraper_bot | refs/heads/master | /bot.py | from handlers.start import start_command_handler
from handlers.registration import add_channel_message_handler
from telegram.ext import Updater, updater
from handlers.startnow import start_now_command_handler
from dotenv import load_dotenv
import os
load_dotenv()
load_dotenv()
token = os.getenv('token')
def main():... | {"/handlers/registration.py": ["/models/channel.py"], "/bot.py": ["/handlers/start.py", "/handlers/registration.py", "/handlers/startnow.py"], "/handlers/startnow.py": ["/models/channel.py", "/services/voa_scraper.py"], "/handlers/start.py": ["/services/voa_scraper.py"]} |
93,125 | sirajyesuf/webscraper_bot | refs/heads/master | /services/voa_scraper.py | from requests.sessions import session
from requests_html import HTMLSession
class Voa:
BASE_URL = "https://www.voanews.com/silicon-valley-technology"
BASE_URL1 = "https://www.voanews.com"
asession = HTMLSession()
def today(self):
return self.asession.get(self.BASE_URL).html
| {"/handlers/registration.py": ["/models/channel.py"], "/bot.py": ["/handlers/start.py", "/handlers/registration.py", "/handlers/startnow.py"], "/handlers/startnow.py": ["/models/channel.py", "/services/voa_scraper.py"], "/handlers/start.py": ["/services/voa_scraper.py"]} |
93,126 | sirajyesuf/webscraper_bot | refs/heads/master | /handlers/startnow.py | from telegram import ext
from telegram.ext import CommandHandler
from telegram.ext import(commandhandler, Filters)
from models.channel import store_time_interval_delay_time, get_channel, get_urls, store_url
from services.voa_scraper import Voa
import time
def startNow(update, context):
l = context.args
try:
... | {"/handlers/registration.py": ["/models/channel.py"], "/bot.py": ["/handlers/start.py", "/handlers/registration.py", "/handlers/startnow.py"], "/handlers/startnow.py": ["/models/channel.py", "/services/voa_scraper.py"], "/handlers/start.py": ["/services/voa_scraper.py"]} |
93,127 | sirajyesuf/webscraper_bot | refs/heads/master | /handlers/start.py | from telegram.ext import (
MessageHandler,
CommandHandler,
Filters
)
from services.voa_scraper import Voa
import time
import telegram
def start(update, context):
start_msg = '''
welcome to voawebscraper bot.this bot help you to post news from voa to your channel or group\n\n
pls first add the... | {"/handlers/registration.py": ["/models/channel.py"], "/bot.py": ["/handlers/start.py", "/handlers/registration.py", "/handlers/startnow.py"], "/handlers/startnow.py": ["/models/channel.py", "/services/voa_scraper.py"], "/handlers/start.py": ["/services/voa_scraper.py"]} |
93,128 | sirajyesuf/webscraper_bot | refs/heads/master | /models/channel.py | import json
import re
def read():
with open("models/channel.json", 'r') as f:
data = json.load(f)
return data
def write(payload):
with open("models/channel.json", 'w') as f:
json.dump(payload, f, indent=3)
def update_channel(channel):
if(not get_channel()):
store_channe... | {"/handlers/registration.py": ["/models/channel.py"], "/bot.py": ["/handlers/start.py", "/handlers/registration.py", "/handlers/startnow.py"], "/handlers/startnow.py": ["/models/channel.py", "/services/voa_scraper.py"], "/handlers/start.py": ["/services/voa_scraper.py"]} |
93,132 | gnuoy/charm-squid-ingress-cache | refs/heads/main | /tests/test_charm.py | # Copyright 2021 Canoncial
# See LICENSE file for licensing details.
#
# Learn more about testing at: https://juju.is/docs/sdk/testing
import unittest
# from unittest.mock import Mock
import json
from charm import SquidIngressCacheCharm
from ops.model import ActiveStatus
from ops.testing import Harness
import tests.... | {"/tests/test_charm.py": ["/tests/test_data.py"]} |
93,133 | gnuoy/charm-squid-ingress-cache | refs/heads/main | /tests/test_data.py | SQUID_CONFIG1 = """
acl localnet src 0.0.0.1-0.255.255.255 # RFC 1122 "this" network (LAN)
acl localnet src 10.0.0.0/8 # RFC 1918 local private network (LAN)
acl localnet src 100.64.0.0/10 # RFC 6598 shared address space (CGN)
acl localnet src 169.254.0.0/16 # RFC 3927 link-local (directly plugged) machines
acl loca... | {"/tests/test_charm.py": ["/tests/test_data.py"]} |
93,134 | gnuoy/charm-squid-ingress-cache | refs/heads/main | /src/charm.py | #!/usr/bin/env python3
# Copyright 2021 Canonical
# See LICENSE file for licensing details.
#
# Learn more at: https://juju.is/docs/sdk
"""Charm for deploying squid-ingress-cache"""
import jinja2
import json
import logging
# from typing import Union
from ops.charm import CharmBase
from ops.framework import StoredSt... | {"/tests/test_charm.py": ["/tests/test_data.py"]} |
93,135 | gnuoy/charm-squid-ingress-cache | refs/heads/main | /src/squid_templates.py | SQUID_TEMPLATE = """
acl localnet src 0.0.0.1-0.255.255.255 # RFC 1122 "this" network (LAN)
acl localnet src 10.0.0.0/8 # RFC 1918 local private network (LAN)
acl localnet src 100.64.0.0/10 # RFC 6598 shared address space (CGN)
acl localnet src 169.254.0.0/16 # RFC 3927 link-local (directly plugged) machines
acl loc... | {"/tests/test_charm.py": ["/tests/test_data.py"]} |
93,159 | kevin-d-omara/Heroes-System-Image-Cropper | refs/heads/master | /test/image_cropper/test_remove_border_integration.py | from collections import namedtuple
import pytest
from PIL import Image
from src.image_cropper.remove_border import remove_border, transparent_edge, bad_pixels_edge
ImageStates = namedtuple('ImageStates', ['base', 'crop_1', 'crop_2'])
def test_m8_scout_frontside():
"""
This image has transparency and bad pi... | {"/test/image_cropper/test_remove_border_integration.py": ["/src/image_cropper/remove_border.py"], "/src/image_cropper/remove_border.py": ["/src/image_cropper/scanline.py", "/src/image_cropper/statistics_extension.py"], "/src/image_cropper/image_extensions.py": ["/src/image_cropper/pixel.py"]} |
93,160 | kevin-d-omara/Heroes-System-Image-Cropper | refs/heads/master | /test/image_cropper/test_pixel.py | from src.image_cropper import pixel
def test_subtract():
a = (5, 1, 500, -15)
b = (2, 6, 1, -16)
c = pixel.subtract(a, b)
assert c == (3, -5, 499, 1)
def test_get_intensity():
px = (1, 2, 3, 4)
intensity = pixel.get_intensity(px)
assert intensity == px[0] + px[1] + px[2] + px[3]
| {"/test/image_cropper/test_remove_border_integration.py": ["/src/image_cropper/remove_border.py"], "/src/image_cropper/remove_border.py": ["/src/image_cropper/scanline.py", "/src/image_cropper/statistics_extension.py"], "/src/image_cropper/image_extensions.py": ["/src/image_cropper/pixel.py"]} |
93,161 | kevin-d-omara/Heroes-System-Image-Cropper | refs/heads/master | /test/image_cropper/test_statistics_extension.py | from src.image_cropper import statistics_extension
def test_multimode_single_mode():
# Arrange
data = 'aabbbbbbbbcc'
# Act
modes = statistics_extension.multimode(data)
# Assert
assert len(modes) == 1
assert modes[0] == 'b'
def test_multimode_multiple_modes():
# Arrange
data = '... | {"/test/image_cropper/test_remove_border_integration.py": ["/src/image_cropper/remove_border.py"], "/src/image_cropper/remove_border.py": ["/src/image_cropper/scanline.py", "/src/image_cropper/statistics_extension.py"], "/src/image_cropper/image_extensions.py": ["/src/image_cropper/pixel.py"]} |
93,162 | kevin-d-omara/Heroes-System-Image-Cropper | refs/heads/master | /src/image_cropper/scanline.py | """
Methods to retrieve a scanline from an image. A scanline is a horizontal or vertical line of pixel coordinates.
"""
from typing import Tuple, List
from PIL import Image
def get_scanlines_left_to_right(image: Image, num_lines=1) -> List[List[Tuple[int, int]]]:
"""
Return N scanlines spread evenly apart on... | {"/test/image_cropper/test_remove_border_integration.py": ["/src/image_cropper/remove_border.py"], "/src/image_cropper/remove_border.py": ["/src/image_cropper/scanline.py", "/src/image_cropper/statistics_extension.py"], "/src/image_cropper/image_extensions.py": ["/src/image_cropper/pixel.py"]} |
93,163 | kevin-d-omara/Heroes-System-Image-Cropper | refs/heads/master | /src/image_cropper/find_edges.py | """
Strategies for finding edges along a scanline.
All methods return a nested tuple of (index, (x, y)) for each pixel identified as an "edge".
The edge pixels are always on the "other side of the fence".
If used for cropping, all pixels in the scanline before this pixel should be cropped out.
"""
from . import pixel... | {"/test/image_cropper/test_remove_border_integration.py": ["/src/image_cropper/remove_border.py"], "/src/image_cropper/remove_border.py": ["/src/image_cropper/scanline.py", "/src/image_cropper/statistics_extension.py"], "/src/image_cropper/image_extensions.py": ["/src/image_cropper/pixel.py"]} |
93,164 | kevin-d-omara/Heroes-System-Image-Cropper | refs/heads/master | /src/image_cropper/statistics_extension.py | """
Extension methods for the 'statistics' library:
https://docs.python.org/3/library/statistics.html#module-statistics
"""
def multimode(data):
"""
Quick implementation of the 'statistics.multimode' method introduced in Python 3.8:
https://docs.python.org/3/library/statistics.html#statistics.multimode
... | {"/test/image_cropper/test_remove_border_integration.py": ["/src/image_cropper/remove_border.py"], "/src/image_cropper/remove_border.py": ["/src/image_cropper/scanline.py", "/src/image_cropper/statistics_extension.py"], "/src/image_cropper/image_extensions.py": ["/src/image_cropper/pixel.py"]} |
93,165 | kevin-d-omara/Heroes-System-Image-Cropper | refs/heads/master | /src/image_cropper/_hardcode.py | IMAGES_ROOT = '../../test/images'
BASE = 'image.png'
CROP_1 = 'image-crop-1.png'
CROP_2 = 'image-crop-1.png'
# Images with all states:
BUILDING_BREACH = 'building-breach'
HOUSE_WITH_GAP = 'house-with-gap'
HOUSE_WITH_VARIETY = 'house-with-variety'
M8_SCOUT = 'm8-scout'
M8_SCOUT_BACKSIDE = 'm8-scout-backside'
PANZERSH... | {"/test/image_cropper/test_remove_border_integration.py": ["/src/image_cropper/remove_border.py"], "/src/image_cropper/remove_border.py": ["/src/image_cropper/scanline.py", "/src/image_cropper/statistics_extension.py"], "/src/image_cropper/image_extensions.py": ["/src/image_cropper/pixel.py"]} |
93,166 | kevin-d-omara/Heroes-System-Image-Cropper | refs/heads/master | /src/image_cropper/main.py | """
Entry point to the Heroes System Image Cropper program.
"""
import os
import sys
from pathlib import Path
from PIL import Image
from image_cropper.image_extensions import has_alpha_channel
from image_cropper.remove_border import remove_border, transparent_edge, white_edge, bad_pixels_edge
from image_cropper impor... | {"/test/image_cropper/test_remove_border_integration.py": ["/src/image_cropper/remove_border.py"], "/src/image_cropper/remove_border.py": ["/src/image_cropper/scanline.py", "/src/image_cropper/statistics_extension.py"], "/src/image_cropper/image_extensions.py": ["/src/image_cropper/pixel.py"]} |
93,167 | kevin-d-omara/Heroes-System-Image-Cropper | refs/heads/master | /src/image_cropper/pixel.py | """
Methods for operating on pixels of an image.
A pixel is a 4-tuple with channels ['R', 'G', 'B', 'A'], or a 3-tuple if missing the Alpha channel.
"""
import operator
def is_fully_transparent(pixel):
return pixel[3] == 0
def is_partly_transparent(pixel):
return pixel[3] < 255
def is_white(pixel):
r... | {"/test/image_cropper/test_remove_border_integration.py": ["/src/image_cropper/remove_border.py"], "/src/image_cropper/remove_border.py": ["/src/image_cropper/scanline.py", "/src/image_cropper/statistics_extension.py"], "/src/image_cropper/image_extensions.py": ["/src/image_cropper/pixel.py"]} |
93,168 | kevin-d-omara/Heroes-System-Image-Cropper | refs/heads/master | /src/image_cropper/remove_border.py | from PIL import Image
from . import find_edges, pick_edge
from .scanline import get_scanlines_left_to_right, get_scanlines_right_to_left
from .scanline import get_scanlines_top_to_bottom, get_scanlines_bottom_to_top
from .statistics_extension import multimode
def remove_border(image: Image, get_edge_coordinates, num... | {"/test/image_cropper/test_remove_border_integration.py": ["/src/image_cropper/remove_border.py"], "/src/image_cropper/remove_border.py": ["/src/image_cropper/scanline.py", "/src/image_cropper/statistics_extension.py"], "/src/image_cropper/image_extensions.py": ["/src/image_cropper/pixel.py"]} |
93,169 | kevin-d-omara/Heroes-System-Image-Cropper | refs/heads/master | /src/image_cropper/image_extensions.py | """
Extension methods for working with Images from the Pillow library:
https://pillow.readthedocs.io/en/stable/index.html
"""
from .pixel import has_alpha_channel as has_alpha
def has_alpha_channel(image):
upper_left_pixel = image.getpixel((0, 0))
return has_alpha(upper_left_pixel)
| {"/test/image_cropper/test_remove_border_integration.py": ["/src/image_cropper/remove_border.py"], "/src/image_cropper/remove_border.py": ["/src/image_cropper/scanline.py", "/src/image_cropper/statistics_extension.py"], "/src/image_cropper/image_extensions.py": ["/src/image_cropper/pixel.py"]} |
93,170 | kevin-d-omara/Heroes-System-Image-Cropper | refs/heads/master | /src/image_cropper/pick_edge.py | """
Strategies for picking a single edge to crop to from a list of edges along a scanline.
All methods take a list of edges as the first parameter and return the coordinates of one edge.
"""
import math
def first_edge(edges):
"""
Return the coordinates of the first edge, or None if there are no edges.
""... | {"/test/image_cropper/test_remove_border_integration.py": ["/src/image_cropper/remove_border.py"], "/src/image_cropper/remove_border.py": ["/src/image_cropper/scanline.py", "/src/image_cropper/statistics_extension.py"], "/src/image_cropper/image_extensions.py": ["/src/image_cropper/pixel.py"]} |
93,176 | aikolynn/fypos | refs/heads/master | /fyposselect/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
from oldfypos.views import *
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^exportxls/',export_xls,name='exportxls'),
url(r'^$',sale_flow,name='saleflow')
)
| {"/fyposselect/urls.py": ["/oldfypos/views.py"]} |
93,177 | aikolynn/fypos | refs/heads/master | /oldfypos/views.py | #coding=utf-8
import sys
import xlwt
from django.shortcuts import render,HttpResponse
from django.template.loader import get_template
import pymssql
from django.core.paginator import *
def sale_flow(request):
#重载sys
reload(sys)
#设置默认编码为utf-8
sys.setdefaultencoding('utf-8')
#获取查询日期
global cx_sta... | {"/fyposselect/urls.py": ["/oldfypos/views.py"]} |
93,178 | aikolynn/fypos | refs/heads/master | /oldfypos/models.py | # #coding=utf-8
from django.db import models
#
# # Create your models here.
# class PosTSaleman(models.Model):
# sale_id = models.CharField(max_length=4,verbose_name='序号',primary_key=True)
# sale_name = models.CharField(max_length=10,verbose_name='姓名')
# sale_status = models.CharField(max_length=4,verbose_n... | {"/fyposselect/urls.py": ["/oldfypos/views.py"]} |
93,179 | aikolynn/fypos | refs/heads/master | /fyposselect/createxls.py | #coding=utf-8
import pymssql
import xlwt
import os
import StringIO
import datetime,time
def set_style(name,height,color=0,bold=False,borderleft=0,borderright=0,top=0,bottom=0):
style = xlwt.XFStyle() # 初始化样式#
font = xlwt.Font() # 为样式创建字体
font.name = name # 'Times New Roman'
font.bold = bold
font.co... | {"/fyposselect/urls.py": ["/oldfypos/views.py"]} |
93,187 | nirmal495/rasa-dx | refs/heads/master | /bot_trainer/api/app/main.py | import logging
from fastapi import FastAPI, HTTPException
from fastapi.exceptions import RequestValidationError
from fastapi.responses import JSONResponse
from mongoengine import connect, disconnect
from mongoengine.errors import DoesNotExist, ValidationError
from starlette.exceptions import HTTPException as Starlette... | {"/bot_trainer/api/app/main.py": ["/bot_trainer/api/models.py"], "/bot_trainer/api/app/routers/history.py": ["/bot_trainer/api/models.py"], "/tests/unit_test/augmentation/question_generation_test.py": ["/augmentation/generator.py"]} |
93,188 | nirmal495/rasa-dx | refs/heads/master | /tests/unit_test/data_processor/history_test.py | import pytest
from mongoengine import connect
from bot_trainer.utils import Utility
class TestHistory:
@pytest.fixture(autouse=True)
def init_connection(self):
Utility.load_evironment()
connect(Utility.environment["mongo_db"], host=Utility.environment["mongo_url"])
| {"/bot_trainer/api/app/main.py": ["/bot_trainer/api/models.py"], "/bot_trainer/api/app/routers/history.py": ["/bot_trainer/api/models.py"], "/tests/unit_test/augmentation/question_generation_test.py": ["/augmentation/generator.py"]} |
93,189 | nirmal495/rasa-dx | refs/heads/master | /bot_trainer/api/models.py | from pydantic import BaseModel, validator, ValidationError
from typing import List, Any
from enum import Enum
from bot_trainer.utils import Utility
class Token(BaseModel):
access_token: str
token_type: str
class TokenData(BaseModel):
username: str
class User(BaseModel):
email: str
first_name: ... | {"/bot_trainer/api/app/main.py": ["/bot_trainer/api/models.py"], "/bot_trainer/api/app/routers/history.py": ["/bot_trainer/api/models.py"], "/tests/unit_test/augmentation/question_generation_test.py": ["/augmentation/generator.py"]} |
93,190 | nirmal495/rasa-dx | refs/heads/master | /augmentation/generator.py | import itertools
import spacy
from nltk.corpus import wordnet
from scipy.spatial.distance import cosine
from sentence_transformers import SentenceTransformer
class QuestionGenerator:
nlp = spacy.load("en_core_web_sm")
sentence_transformer = SentenceTransformer('bert-large-nli-stsb-mean-tokens')
fastText ... | {"/bot_trainer/api/app/main.py": ["/bot_trainer/api/models.py"], "/bot_trainer/api/app/routers/history.py": ["/bot_trainer/api/models.py"], "/tests/unit_test/augmentation/question_generation_test.py": ["/augmentation/generator.py"]} |
93,191 | nirmal495/rasa-dx | refs/heads/master | /bot_trainer/api/processor.py | from bot_trainer.api.data_objects import *
from bot_trainer.utils import Utility
from mongoengine.errors import DoesNotExist
class AccountProcessor:
@staticmethod
def add_account(name: str, user: str):
Utility.is_exist(
Account, query={"name": name}, exp_message="Account name already exist... | {"/bot_trainer/api/app/main.py": ["/bot_trainer/api/models.py"], "/bot_trainer/api/app/routers/history.py": ["/bot_trainer/api/models.py"], "/tests/unit_test/augmentation/question_generation_test.py": ["/augmentation/generator.py"]} |
93,192 | nirmal495/rasa-dx | refs/heads/master | /bot_trainer/api/app/routers/history.py | from fastapi import APIRouter
from bot_trainer.api.auth import Authentication
from bot_trainer.data_processor.history import ChatHistory
from bot_trainer.api.models import Response, User
from fastapi import Depends
from typing import Text
router = APIRouter()
auth = Authentication()
@router.get("/users", response_m... | {"/bot_trainer/api/app/main.py": ["/bot_trainer/api/models.py"], "/bot_trainer/api/app/routers/history.py": ["/bot_trainer/api/models.py"], "/tests/unit_test/augmentation/question_generation_test.py": ["/augmentation/generator.py"]} |
93,193 | nirmal495/rasa-dx | refs/heads/master | /tests/unit_test/augmentation/question_generation_test.py | import asyncio
from augmentation.generator import QuestionGenerator
class TestQuestionGeneration:
def test_generate_questions(self):
expected = [
"where is digite located ?",
"where is digite set ?",
"where is digite situated ?",
"where is digite placed ?",... | {"/bot_trainer/api/app/main.py": ["/bot_trainer/api/models.py"], "/bot_trainer/api/app/routers/history.py": ["/bot_trainer/api/models.py"], "/tests/unit_test/augmentation/question_generation_test.py": ["/augmentation/generator.py"]} |
93,198 | djfoote/bathed-in-the-aura | refs/heads/master | /create_character.py | import battle_engine
import grid_cells
import abilities
import items
import weapons
DEFAULT_STATS = {
(battle_engine.MAX_HP): 10,
(battle_engine.MAX_MANA): 10,
(battle_engine.SPEED): 10,
(battle_engine.PHYSICAL, battle_engine.POWER): 0,
(battle_engine.PHYSICAL, battle_engine.STRENGTH): 1,
(ba... | {"/create_character.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py", "/items.py", "/weapons.py"], "/demo_fight.py": ["/battle_engine.py", "/abilities.py", "/enemies.py", "/items.py", "/weapons.py"], "/enemies.py": ["/battle_engine.py"], "/grid.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py"], ... |
93,199 | djfoote/bathed-in-the-aura | refs/heads/master | /demo_fight.py | import battle_engine
import abilities
import enemies
import items
import weapons
def main():
sword = weapons.Sword('Sword', 2)
magic_wand = weapons.MagicWand('Magic wand', 2)
anzacel = battle_engine.Player(
name='Anzacel',
max_hp=10,
stat_dict={
(battle_engine.PHYSICAL, battle_engin... | {"/create_character.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py", "/items.py", "/weapons.py"], "/demo_fight.py": ["/battle_engine.py", "/abilities.py", "/enemies.py", "/items.py", "/weapons.py"], "/enemies.py": ["/battle_engine.py"], "/grid.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py"], ... |
93,200 | djfoote/bathed-in-the-aura | refs/heads/master | /enemies.py | import random
import battle_engine
class PapaRoach(battle_engine.Enemy):
def __init__(self):
battle_engine.Enemy.__init__(
self,
name='Papa Roach',
stat_dict={
(battle_engine.MAX_HP): 20,
(battle_engine.SPEED): 5,
(battle_engine.PHYSICAL, battle_engin... | {"/create_character.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py", "/items.py", "/weapons.py"], "/demo_fight.py": ["/battle_engine.py", "/abilities.py", "/enemies.py", "/items.py", "/weapons.py"], "/enemies.py": ["/battle_engine.py"], "/grid.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py"], ... |
93,201 | djfoote/bathed-in-the-aura | refs/heads/master | /grid.py | try:
import networkx as nx
import matplotlib.pyplot as plt
except ImportError:
nx = None
plt = None
import battle_engine
import grid_cells
import abilities
class Node():
def __init__(self, grid_cell):
self.grid_cell = grid_cell
self.children = []
def __repr__(self):
return repr(self.grid_ce... | {"/create_character.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py", "/items.py", "/weapons.py"], "/demo_fight.py": ["/battle_engine.py", "/abilities.py", "/enemies.py", "/items.py", "/weapons.py"], "/enemies.py": ["/battle_engine.py"], "/grid.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py"], ... |
93,202 | djfoote/bathed-in-the-aura | refs/heads/master | /items.py | import battle_engine
class Potion(battle_engine.Item):
def get_valid_targets(self, user, battle):
return battle.players
def use(self, user, target):
target.heal(5)
user.inventory.remove(self)
def __repr__(self):
return 'Potion'
class BerserkerPotion(Potion):
def use(self, user, target):
... | {"/create_character.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py", "/items.py", "/weapons.py"], "/demo_fight.py": ["/battle_engine.py", "/abilities.py", "/enemies.py", "/items.py", "/weapons.py"], "/enemies.py": ["/battle_engine.py"], "/grid.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py"], ... |
93,203 | djfoote/bathed-in-the-aura | refs/heads/master | /weapons.py | import battle_engine
class Weapon(battle_engine.Item):
def __init__(self, name):
self.name = name
def get_damage(self, damage_type):
raise NotImplementedError
def get_valid_targets(self, user, battle):
return [user]
def use(self, user, target):
print('%s equipped %s' % (user.name, self.name... | {"/create_character.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py", "/items.py", "/weapons.py"], "/demo_fight.py": ["/battle_engine.py", "/abilities.py", "/enemies.py", "/items.py", "/weapons.py"], "/enemies.py": ["/battle_engine.py"], "/grid.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py"], ... |
93,204 | djfoote/bathed-in-the-aura | refs/heads/master | /grid_cells.py | class GridCell():
def __init__(self, name):
self.name = name
def __repr__(self):
return self.name
class AddStats(GridCell):
def __init__(self, name, stats_dict):
GridCell.__init__(self, name)
self.stats_dict = stats_dict
class MultiplyStats(GridCell):
def __init__(self, name, stats_dict):
... | {"/create_character.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py", "/items.py", "/weapons.py"], "/demo_fight.py": ["/battle_engine.py", "/abilities.py", "/enemies.py", "/items.py", "/weapons.py"], "/enemies.py": ["/battle_engine.py"], "/grid.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py"], ... |
93,205 | djfoote/bathed-in-the-aura | refs/heads/master | /battle_engine.py | import collections
import random
MAX_ACTION_POINTS = 3
CRIT_PROBABILITY = 1/8
CRIT_MULTIPLIER = 2
# Placeholder stat system: multipliers are `STAT_EXPONENT_BASE ** stat_value`.
STAT_EXPONENT_BASE = 1.1
# Damage types
PHYSICAL = 'physical'
SPECIAL = 'special'
DAMAGE_TYPES = [PHYSICAL, SPECIAL]
# Stats
POWER = 'powe... | {"/create_character.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py", "/items.py", "/weapons.py"], "/demo_fight.py": ["/battle_engine.py", "/abilities.py", "/enemies.py", "/items.py", "/weapons.py"], "/enemies.py": ["/battle_engine.py"], "/grid.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py"], ... |
93,206 | djfoote/bathed-in-the-aura | refs/heads/master | /boss_crawl.py | import collections
import battle_engine
import choose_grid
import create_character
import abilities
import enemies
import items
import weapons
DIFFICULTY = 'easy'
BOSSES = {
'papa roach': enemies.PapaRoach,
'horn dog': enemies.HornDog,
}
def create_battle(anzacel, encounter):
battle_enemies = []
if not e... | {"/create_character.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py", "/items.py", "/weapons.py"], "/demo_fight.py": ["/battle_engine.py", "/abilities.py", "/enemies.py", "/items.py", "/weapons.py"], "/enemies.py": ["/battle_engine.py"], "/grid.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py"], ... |
93,207 | djfoote/bathed-in-the-aura | refs/heads/master | /choose_grid.py | import battle_engine
import grid
DEFAULT_NUM_POINTS = 5
def choose_grid(num_points=DEFAULT_NUM_POINTS):
cells = []
options = grid.grid.children
while num_points and options:
cell = battle_engine.choose_option(options)
cells.append(cell.grid_cell)
options.remove(cell)
options.extend(cell.childre... | {"/create_character.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py", "/items.py", "/weapons.py"], "/demo_fight.py": ["/battle_engine.py", "/abilities.py", "/enemies.py", "/items.py", "/weapons.py"], "/enemies.py": ["/battle_engine.py"], "/grid.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py"], ... |
93,208 | djfoote/bathed-in-the-aura | refs/heads/master | /abilities.py | import itertools
import numpy as np
import battle_engine
class Heal(battle_engine.Ability):
def __init__(self, amount, ap_cost=1, mana_cost=1):
battle_engine.Ability.__init__(self, 'Heal %d' % amount, ap_cost, mana_cost)
self.amount = amount
def use(self, user, battle):
user.heal(self.amount)
cla... | {"/create_character.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py", "/items.py", "/weapons.py"], "/demo_fight.py": ["/battle_engine.py", "/abilities.py", "/enemies.py", "/items.py", "/weapons.py"], "/enemies.py": ["/battle_engine.py"], "/grid.py": ["/battle_engine.py", "/grid_cells.py", "/abilities.py"], ... |
93,209 | joostgp/ml_toolbox | refs/heads/master | /dataset.py | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 18 19:12:44 2016
@author: joostbloom
"""
import os
from collections import namedtuple
import pandas as pd
class SourceDataSet:
DataFiles = namedtuple('DataFiles','train test target')
datafiles = DataFiles(train='filename_train.csv',
... | {"/runner.py": ["/kaggle.py"]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.