index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
17,234 | hybby/sreport | refs/heads/main | /tests/test_summary.py | """
Unit tests for the sreport.py utility relating to summary report generation
"""
import pytest
from sreport import generate_summary
def test_summary_report_output():
"""
Tests that given a summary dict of response codes and response counts,
we produce a report in the format that we expect
"""
s... | {"/tests/test_urls.py": ["/sreport.py"], "/tests/test_io.py": ["/sreport.py"], "/tests/test_summary.py": ["/sreport.py"]} |
17,235 | GreyZmeem/habr-proxy | refs/heads/master | /main.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
from typing import Final
from aiohttp import web
from app.application import AppConfig, create_app
from app.proxy import const
_host: Final[str] = "0.0.0.0"
_port: Final[int] = 8080
def get_parser() -> ArgumentParser:
"""Build a... | {"/main.py": ["/app/application.py"], "/app/application.py": ["/app/proxy/config.py", "/app/proxy/patcher_ivelum.py", "/app/proxy/proxy.py", "/app/proxy/req_resp.py"], "/app/proxy/patcher_ivelum.py": ["/app/proxy/config.py", "/app/proxy/patcher_default.py"], "/app/proxy/patcher_default.py": ["/app/proxy/config.py", "/a... |
17,236 | GreyZmeem/habr-proxy | refs/heads/master | /app/application.py | # -*- coding: utf-8 -*-
import dataclasses
from aiohttp import web
from app.proxy.config import Config, Patcher
from app.proxy.patcher_ivelum import IVelumPatcher, IVelumPatcherConfig
from app.proxy.proxy import Proxy
from app.proxy.req_resp import Request, Response
@dataclasses.dataclass(frozen=True)
class AppConf... | {"/main.py": ["/app/application.py"], "/app/application.py": ["/app/proxy/config.py", "/app/proxy/patcher_ivelum.py", "/app/proxy/proxy.py", "/app/proxy/req_resp.py"], "/app/proxy/patcher_ivelum.py": ["/app/proxy/config.py", "/app/proxy/patcher_default.py"], "/app/proxy/patcher_default.py": ["/app/proxy/config.py", "/a... |
17,237 | GreyZmeem/habr-proxy | refs/heads/master | /app/proxy/patcher_ivelum.py | # -*- coding: utf-8 -*-
import dataclasses
import itertools
import unicodedata
from typing import Iterable, Optional, Set
from app.proxy.config import ReqResp, SrcDst
from app.proxy.patcher_default import DefaultPatcher
from bs4 import BeautifulSoup
from bs4.element import NavigableString, Tag
from nltk import wordpu... | {"/main.py": ["/app/application.py"], "/app/application.py": ["/app/proxy/config.py", "/app/proxy/patcher_ivelum.py", "/app/proxy/proxy.py", "/app/proxy/req_resp.py"], "/app/proxy/patcher_ivelum.py": ["/app/proxy/config.py", "/app/proxy/patcher_default.py"], "/app/proxy/patcher_default.py": ["/app/proxy/config.py", "/a... |
17,238 | GreyZmeem/habr-proxy | refs/heads/master | /app/proxy/patcher_default.py | # -*- coding: utf-8 -*-
import dataclasses
from http import HTTPStatus
from typing import List, Optional, overload
from urllib.parse import ParseResult, urlparse
from app.proxy import const
from app.proxy.config import Patcher, ReqResp, SrcDst
from app.proxy.req_resp import Header, Headers, Request, Response
from mul... | {"/main.py": ["/app/application.py"], "/app/application.py": ["/app/proxy/config.py", "/app/proxy/patcher_ivelum.py", "/app/proxy/proxy.py", "/app/proxy/req_resp.py"], "/app/proxy/patcher_ivelum.py": ["/app/proxy/config.py", "/app/proxy/patcher_default.py"], "/app/proxy/patcher_default.py": ["/app/proxy/config.py", "/a... |
17,239 | GreyZmeem/habr-proxy | refs/heads/master | /app/proxy/req_resp.py | # -*- coding: utf-8 -*-
from dataclasses import dataclass, field
from http import HTTPStatus
from typing import Optional, Set, Tuple
Header = Tuple[str, str]
Headers = Tuple[Header, ...]
HeaderNames = Set[str]
@dataclass(frozen=True)
class Request(object):
"""HTTP request."""
#: Requested URL.
url: str... | {"/main.py": ["/app/application.py"], "/app/application.py": ["/app/proxy/config.py", "/app/proxy/patcher_ivelum.py", "/app/proxy/proxy.py", "/app/proxy/req_resp.py"], "/app/proxy/patcher_ivelum.py": ["/app/proxy/config.py", "/app/proxy/patcher_default.py"], "/app/proxy/patcher_default.py": ["/app/proxy/config.py", "/a... |
17,240 | GreyZmeem/habr-proxy | refs/heads/master | /app/proxy/config.py | # -*- coding: utf-8 -*-
import abc
from dataclasses import dataclass
from typing import Tuple, Union, overload
from app.proxy import const
from app.proxy.req_resp import Request, Response
SrcDst = Tuple[str, str]
ReqResp = Union[Request, Response]
class Patcher(abc.ABC):
"""Protocol describes methods for patch... | {"/main.py": ["/app/application.py"], "/app/application.py": ["/app/proxy/config.py", "/app/proxy/patcher_ivelum.py", "/app/proxy/proxy.py", "/app/proxy/req_resp.py"], "/app/proxy/patcher_ivelum.py": ["/app/proxy/config.py", "/app/proxy/patcher_default.py"], "/app/proxy/patcher_default.py": ["/app/proxy/config.py", "/a... |
17,241 | GreyZmeem/habr-proxy | refs/heads/master | /app/proxy/const.py | # -*- coding: utf-8 -*-
from typing import Final, Set
# =======
# General
# =======
#: Default upstream.
upstream: Final[str] = "https://habr.com"
#: List of headers to remove from HTTP requests / responses.
remove_headers: Final[Set[str]] = {
"accept-encoding",
"content-encoding",
"keep-alive",
"p3p... | {"/main.py": ["/app/application.py"], "/app/application.py": ["/app/proxy/config.py", "/app/proxy/patcher_ivelum.py", "/app/proxy/proxy.py", "/app/proxy/req_resp.py"], "/app/proxy/patcher_ivelum.py": ["/app/proxy/config.py", "/app/proxy/patcher_default.py"], "/app/proxy/patcher_default.py": ["/app/proxy/config.py", "/a... |
17,242 | GreyZmeem/habr-proxy | refs/heads/master | /app/proxy/proxy.py | # -*- coding: utf-8 -*-
import aiohttp
from app.proxy.config import Config
from app.proxy.req_resp import Headers, Request, Response
class Proxy(object):
"""Asd."""
def __init__(self, config: Config):
self.config: Config = config
async def dispatch(self, request: Request) -> Response:
"... | {"/main.py": ["/app/application.py"], "/app/application.py": ["/app/proxy/config.py", "/app/proxy/patcher_ivelum.py", "/app/proxy/proxy.py", "/app/proxy/req_resp.py"], "/app/proxy/patcher_ivelum.py": ["/app/proxy/config.py", "/app/proxy/patcher_default.py"], "/app/proxy/patcher_default.py": ["/app/proxy/config.py", "/a... |
17,245 | redwingsdan/python-tests | refs/heads/master | /diceroll.py | import random
def start_dice_roll():
min = 1
max = 6
roll_again = 'yes'
while roll_again == 'y' or roll_again == 'yes':
diceroll = random.randint(min, max)
print('Roll 1: ' + str(diceroll))
diceroll = random.randint(min, max)
print('Roll 2: ' + str(diceroll))
rol... | {"/menu.py": ["/numbergame.py", "/rockpaperscissors.py", "/passwordgenerator.py", "/diceroll.py", "/ciphers.py"]} |
17,246 | redwingsdan/python-tests | refs/heads/master | /filemanipulation.py | import os
import shutil
#w = write permissions (create if not exists)
#r = read permissions
#a = append to end of file
myFile = open('filemanipulationtest.txt', 'w+')
myFile.write('This is a test string')
myFile.close()
os.rename('D:/Python/filemanipulationtest.txt', 'D:/Python/filedir1/filemanipulationtest.txt')
shuti... | {"/menu.py": ["/numbergame.py", "/rockpaperscissors.py", "/passwordgenerator.py", "/diceroll.py", "/ciphers.py"]} |
17,247 | redwingsdan/python-tests | refs/heads/master | /passwordgenerator.py | import random
def shuffle(string):
tempPass = list(string)
random.shuffle(tempPass)
return ''.join(tempPass)
def generate_char():
number = random.randint(0,3)
if number == 0:
return chr(random.randint(65,90)) #uppercase
elif number == 1:
return chr(random.randint(97,122)) #l... | {"/menu.py": ["/numbergame.py", "/rockpaperscissors.py", "/passwordgenerator.py", "/diceroll.py", "/ciphers.py"]} |
17,248 | redwingsdan/python-tests | refs/heads/master | /cryptochallenge.py | import codecs
from binascii import hexlify, unhexlify
class InvalidMessageException(Exception):
pass
#read in a file name and return the contents as a string
def read_file_data(file_name):
file = open(file_name, 'r')
return file.read()
#decode the hex string data into bytes (equivalent to unhexlify)
def c... | {"/menu.py": ["/numbergame.py", "/rockpaperscissors.py", "/passwordgenerator.py", "/diceroll.py", "/ciphers.py"]} |
17,249 | redwingsdan/python-tests | refs/heads/master | /fixedvsfloatingdecimals.py | def rec(y, z):
return 108 - ((815-1500/z)/y)
def floatpt(N):
x = [4, 4.25]
for i in range(2, N+1):
x.append(rec(x[i-1], x[i-2]))
return x
def fixedpt(N):
x = [Decimal(4), Decimal(17)/Decimal(4)]
for i in range(2, N+1):
x.append(rec(x[i-1], x[i-2]))
return x
N = 20
flt = floatpt(N)
fxd = fixedpt(N)
for i... | {"/menu.py": ["/numbergame.py", "/rockpaperscissors.py", "/passwordgenerator.py", "/diceroll.py", "/ciphers.py"]} |
17,250 | redwingsdan/python-tests | refs/heads/master | /menu.py | import numbergame
import rockpaperscissors
import passwordgenerator
import diceroll
import ciphers
selection = input("Select Program:\n" +
"1. Number Guessing\n" +
"2. Rock, Paper, Scissors\n" +
"3. Password Generator\n" +
"4. Dice Rolling\n" +
"5. Ciphers\n" +
"")
if selection == str(1):
numbergame.start_numb... | {"/menu.py": ["/numbergame.py", "/rockpaperscissors.py", "/passwordgenerator.py", "/diceroll.py", "/ciphers.py"]} |
17,251 | redwingsdan/python-tests | refs/heads/master | /numbergame.py | import random
def start_number_game():
number = random.randint(1, 10)
user_name = input('What is your name?')
number_guesses = 0;
print('Alright, ' + user_name + ' I guessed a number: ')
while number_guesses < 5:
guess = int(input())
number_guesses += 1
if guess < number... | {"/menu.py": ["/numbergame.py", "/rockpaperscissors.py", "/passwordgenerator.py", "/diceroll.py", "/ciphers.py"]} |
17,252 | redwingsdan/python-tests | refs/heads/master | /ciphers.py |
def convert_cipher():
type = input('What type of cipher? ')
if type == 'b':
convert_binary_cipher()
elif type == 'u':
convert_unicode_cipher()
else:
print('Cipher type not supported')
def convert_binary_cipher():
file_content = open('cipher1.txt', 'r')
result_te... | {"/menu.py": ["/numbergame.py", "/rockpaperscissors.py", "/passwordgenerator.py", "/diceroll.py", "/ciphers.py"]} |
17,253 | redwingsdan/python-tests | refs/heads/master | /rockpaperscissors.py | from random import randint
def compare_selections(choices, choice_names, player_selection, ai_selection, total_wins, total_losses):
player_index = choices.index(player_selection)
ai_index = choices.index(ai_selection)
is_player_win = (player_index > ai_index or (player_index == 0 and ai_index == 2)) and no... | {"/menu.py": ["/numbergame.py", "/rockpaperscissors.py", "/passwordgenerator.py", "/diceroll.py", "/ciphers.py"]} |
17,254 | redwingsdan/python-tests | refs/heads/master | /csvmanipulation.py | import csv
def writer (header, data, filename, option):
with open (filename, 'w', newline = '') as csvfile:
if option == 'write':
pizza_places = csv.writer(csvfile)
pizza_places.writerow(header)
for data_row in data:
pizza_places.writerow(data_row)
... | {"/menu.py": ["/numbergame.py", "/rockpaperscissors.py", "/passwordgenerator.py", "/diceroll.py", "/ciphers.py"]} |
17,255 | trunkboy/django-multi-storage | refs/heads/main | /storage/schema/mutation.py | import logging
from django.core.exceptions import ValidationError
from django.contrib.auth import get_user_model
from django.contrib.gis.db import models
from django.db.models import Q
import django_filters
import graphene
from graphene_django import DjangoObjectType
# models defination
from core.models import (
... | {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,256 | trunkboy/django-multi-storage | refs/heads/main | /storage/google_storage.py | # GCP storege functions which is used accross the site
# Imports the Google Cloud client library
from google.cloud import storage
import datetime
# Instantiates a client
storage_client = storage.Client.from_service_account_json('config/gcp_storage.json')
def upload_blob(bucket_name, source_file, destination_blob_name... | {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,257 | trunkboy/django-multi-storage | refs/heads/main | /storage/migrations/0005_auto_20200416_1355.py | # Generated by Django 3.0.5 on 2020-04-16 08:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('storage', '0004_auto_20200416_1353'),
]
operations = [
migrations.RemoveField(
model_name='filestorage',
name='connection_na... | {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,258 | trunkboy/django-multi-storage | refs/heads/main | /storage/helper.py | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
import hashlib
import json
try:
import libcloud
except ImportError:
raise ImproperlyConfigured("Could not load libcloud")
try:
from django.utils.six.moves.urllib.parse import urljoin
except ImportError:
string_t... | {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,259 | trunkboy/django-multi-storage | refs/heads/main | /storage/migrations/0004_auto_20200416_1353.py | # Generated by Django 3.0.5 on 2020-04-16 08:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('storage', '0003_filestorage_server_reply'),
]
operations = [
migrations.RenameField(
model_name='filestorage',
old_n... | {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,260 | trunkboy/django-multi-storage | refs/heads/main | /storage/schema/query.py | import graphene
from graphene_django.filter import DjangoFilterConnectionField
from storage.schema.node import (
ImageNode
)
class Query(graphene.ObjectType):
pass | {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,261 | trunkboy/django-multi-storage | refs/heads/main | /storage/urls.py | '''
storage module URL Configuration
'''
from django.urls import include, path
from storage.views import (
FileDownload,
FileUpload
)
urlpatterns = [
path('upload', FileUpload.as_view(), name='file_upload'),
path('url/<int:fid>', FileDownload.as_view(), name='file_upload'),
]
| {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,262 | trunkboy/django-multi-storage | refs/heads/main | /storage/migrations/0002_auto_20200415_1845.py | # Generated by Django 3.0.5 on 2020-04-15 13:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('storage', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='filestorage',
name='hashed_id',
... | {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,263 | trunkboy/django-multi-storage | refs/heads/main | /storage/migrations/0001_initial.py | # Generated by Django 3.0.5 on 2020-04-14 15:25
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,264 | trunkboy/django-multi-storage | refs/heads/main | /storage/storage.py | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import Storage
class MultiStorage(Storage):
'''
Base Storage class to abstract the storage function accross the multiple service providers
'''
# hold the drive then main connection ... | {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,265 | trunkboy/django-multi-storage | refs/heads/main | /storage/schema/node.py | import json
from django.contrib.auth import get_user_model
from django.contrib.gis.db import models
import django_filters
import graphene
from graphene_django import DjangoObjectType
from graphene_django.converter import convert_django_field
from storage.models import (
FileStorage,
FileTransactionLogs
)
fro... | {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,266 | trunkboy/django-multi-storage | refs/heads/main | /storage/s3_storage.py | # AWS S3 storage functions which is used accross the site
# Imports the AWS Boto3 library
import boto3
from botocore.exceptions import ClientError
import datetime
# Create a client for s3
s3_client = boto3.client('s3')
def upload_to_s3(bucket_name, source_file, destination_name=None):
"""Upload a fi... | {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,267 | trunkboy/django-multi-storage | refs/heads/main | /storage/views.py | from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from storage.helper import Storage
class FileUpload(APIView):
permission_classes = [IsAuthenticated]
def post(self, request):
... | {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,268 | trunkboy/django-multi-storage | refs/heads/main | /storage/models.py | from django.contrib.auth import get_user_model
from django.contrib.gis.db import models
class FileStorage(models.Model):
'''
Stored the data and location related to the files uploaded to the buckets
'''
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now... | {"/storage/helper.py": ["/storage/models.py"], "/storage/schema/query.py": ["/storage/schema/node.py"], "/storage/urls.py": ["/storage/views.py"], "/storage/schema/node.py": ["/storage/models.py", "/storage/helper.py"], "/storage/views.py": ["/storage/helper.py"]} |
17,309 | spking/p-skitakall | refs/heads/master | /main.py | # Sölvi Scheving Pálsson #
# 04/02/2020 #
import botprofile
import classes
| {"/main.py": ["/botprofile.py", "/classes.py"]} |
17,310 | spking/p-skitakall | refs/heads/master | /botprofile.py | # Solvi Scheving Pálsson#
# Bot logic file #
# 03/02/2019 #
class Bot:
def __init__(self, d):
self.deck = d
| {"/main.py": ["/botprofile.py", "/classes.py"]} |
17,311 | spking/p-skitakall | refs/heads/master | /classes.py | # Skítakall - Classes Skrá #
# Sölvi Scheving Pálsson #
# 2. Febrúar 2020 #
import random
import time
from termcolor import cprint
class Deck:
def __init__(self, t, n):
self.tegund = t
self.numer = n
def __str__(self):
return self.tegund + "," + str(self.numer)
def createdeck(t, lis... | {"/main.py": ["/botprofile.py", "/classes.py"]} |
17,317 | mdberkey/Discord_Convo_Bots | refs/heads/master | /MarkovGeneration.py | import random
import ast
# reads dictionary.txt
dictionaryFile = open("dictionary.txt", "r")
contents = dictionaryFile.read()
dictionary = ast.literal_eval(contents)
dictionaryFile.close()
# generates a unique string using the markov chain values
class generation:
def main(self):
lastWord = '3u9fh27d31r'... | {"/DiscordConnection.py": ["/GetRandomEmoji.py", "/GoogleSearch.py", "/MarkovGeneration.py", "/TextToSpeech.py"]} |
17,318 | mdberkey/Discord_Convo_Bots | refs/heads/master | /TextToSpeech.py | from gtts import gTTS
# returns tts file of text
def TTSus(text):
tts = gTTS(text, lang='en-us') # female english American accent
tts.save("audio.mp3")
def TTSau(text):
tts = gTTS(text, lang='en-au') # female english Australian accent
tts.save("audio.mp3")
| {"/DiscordConnection.py": ["/GetRandomEmoji.py", "/GoogleSearch.py", "/MarkovGeneration.py", "/TextToSpeech.py"]} |
17,319 | mdberkey/Discord_Convo_Bots | refs/heads/master | /GoogleSearch.py | # returns the first link in a google search
def googleSearch(query):
try:
from googlesearch import search
except ImportError:
print("No module named 'google' found")
for result in search(query, tld="com", num=1, stop=1, pause=2):
return result
| {"/DiscordConnection.py": ["/GetRandomEmoji.py", "/GoogleSearch.py", "/MarkovGeneration.py", "/TextToSpeech.py"]} |
17,320 | mdberkey/Discord_Convo_Bots | refs/heads/master | /GetRandomEmoji.py | import ast
import random
# reads emoticons.txt
emoticonsFile = open("emoticons.txt", "r")
contentsB = emoticonsFile.read()
emoticons = ast.literal_eval(contentsB)
emoticonsFile.close()
# returns a random emoji from the string
def getRandomEmoji():
self = 0
randNum = random.randint(0, 279) # number of ... | {"/DiscordConnection.py": ["/GetRandomEmoji.py", "/GoogleSearch.py", "/MarkovGeneration.py", "/TextToSpeech.py"]} |
17,321 | mdberkey/Discord_Convo_Bots | refs/heads/master | /DiscordConnection.py | import asyncio
import random
import discord
from discord.ext import commands
from GetRandomEmoji import getRandomEmoji
from GoogleSearch import googleSearch
from MarkovGeneration import generation
from TextToSpeech import TTSau
# Gibs the kangaroo bot
TOKEN = 'NzEzODYyODQxNjY4NzMwOTIw.XsmSlA.WMH33p-HEDf_SiR5ifW2krT1... | {"/DiscordConnection.py": ["/GetRandomEmoji.py", "/GoogleSearch.py", "/MarkovGeneration.py", "/TextToSpeech.py"]} |
17,322 | mdberkey/Discord_Convo_Bots | refs/heads/master | /SetupFiles/LearningDictionary.py |
file = open("Source_Words.txt")
string = file.read()
# creates dictionary of words in Markov Chain fashion
def learn(dict, input):
tokens = input.split(" ")
for i in range(0, len(tokens) - 1):
currentWord = tokens[i]
nextWord = tokens[i + 1]
if currentWord not in dict:
... | {"/DiscordConnection.py": ["/GetRandomEmoji.py", "/GoogleSearch.py", "/MarkovGeneration.py", "/TextToSpeech.py"]} |
17,325 | sjquant/sanic-redis | refs/heads/master | /sanic_redis/__init__.py | from .core import SanicRedis
__all__ = ['SanicRedis']
__version__ = '0.1.0'
| {"/sanic_redis/__init__.py": ["/sanic_redis/core.py"]} |
17,326 | sjquant/sanic-redis | refs/heads/master | /setup.py | from setuptools import setup
setup(
name='sanic-redis',
version='0.1.1',
description='Adds redis support to sanic .',
long_description='sanic-redis is a sanic framework extension which adds support for the redis.',
url='https://github.com/strahe/sanic-redis',
author='strahe',
license='MIT'... | {"/sanic_redis/__init__.py": ["/sanic_redis/core.py"]} |
17,327 | sjquant/sanic-redis | refs/heads/master | /sanic_redis/core.py | from sanic import Sanic
from aioredis import create_redis_pool
class SanicRedis:
def __init__(self, app: Sanic=None, redis_config: dict=None):
self.app = app
self.config = redis_config
self.conn = None
if app:
self.init_app(app=app)
def init_app(self, app: Sanic, ... | {"/sanic_redis/__init__.py": ["/sanic_redis/core.py"]} |
17,335 | lukaskubis/darkskylib | refs/heads/master | /test/__init__.py | import os
import pickle
import unittest
import darksky
import requests
class TestPickle(unittest.TestCase):
""" Forecast pickling """
@classmethod
def setUpClass(cls):
def mock_request_get(*args, **kwargs):
response = type('Response', (object,), {})
response.headers = {}
... | {"/test/__init__.py": ["/darksky/__init__.py"], "/darksky/__init__.py": ["/darksky/forecast.py"], "/darksky/forecast.py": ["/darksky/data.py"]} |
17,336 | lukaskubis/darkskylib | refs/heads/master | /darksky/__init__.py | # __init__.py
from .forecast import Forecast
def forecast(key, latitude, longitude, time=None, timeout=None, **queries):
return Forecast(key, latitude, longitude, time, timeout, **queries)
| {"/test/__init__.py": ["/darksky/__init__.py"], "/darksky/__init__.py": ["/darksky/forecast.py"], "/darksky/forecast.py": ["/darksky/data.py"]} |
17,337 | lukaskubis/darkskylib | refs/heads/master | /setup.py | import os
from setuptools import setup
# use pandoc to convert
with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.rst')) as f:
README = f.read()
setup(name='darkskylib',
version='0.3.91',
description='The Dark Sky API wrapper',
long_description=README,
url='https://... | {"/test/__init__.py": ["/darksky/__init__.py"], "/darksky/__init__.py": ["/darksky/forecast.py"], "/darksky/forecast.py": ["/darksky/data.py"]} |
17,338 | lukaskubis/darkskylib | refs/heads/master | /darksky/forecast.py | # forecast.py
from __future__ import print_function
from builtins import super
import json
import sys
import requests
from .data import DataPoint
_API_URL = 'https://api.darksky.net/forecast'
class Forecast(DataPoint):
def __init__(self, key, latitude, longitude, time=None, timeout=None, **queries):
se... | {"/test/__init__.py": ["/darksky/__init__.py"], "/darksky/__init__.py": ["/darksky/forecast.py"], "/darksky/forecast.py": ["/darksky/data.py"]} |
17,339 | lukaskubis/darkskylib | refs/heads/master | /darksky/data.py | # data.py
class DataPoint(object):
def __init__(self, data):
self._data = data
if isinstance(self._data, dict):
for name, val in self._data.items():
setattr(self, name, val)
if isinstance(self._data, list):
setattr(self, 'data', self._data)
de... | {"/test/__init__.py": ["/darksky/__init__.py"], "/darksky/__init__.py": ["/darksky/forecast.py"], "/darksky/forecast.py": ["/darksky/data.py"]} |
17,342 | jvadebossan/EVA-Editable-Virtual-Assistant | refs/heads/master | /configs.py | import datetime
#padrão ==============================================
version = ('0.1')
creator = str('@jvadebossan')
creator_to_talk = str('@ j v a debossan')
#variaveis de dia e hora
dia1 = datetime.datetime.now()
dia = ('hoje é dia {} do {} de {}'.format(dia1.day, dia1.month, dia1.year))
hr1 = datetim... | {"/main.py": ["/configs.py"]} |
17,343 | jvadebossan/EVA-Editable-Virtual-Assistant | refs/heads/master | /main.py | from configs import *
import speech_recognition as sr
from random import choice
import pyttsx3
import datetime
import sys
from time import sleep as wait
import webbrowser as wb
def intro():
print('=============================================================================================')
print('... | {"/main.py": ["/configs.py"]} |
17,344 | jvadebossan/EVA-Editable-Virtual-Assistant | refs/heads/master | /testes.py | import webbrowser
a = input('say something: ')
if ('open') in a:
if ('google') in a:
webbrowser.open('www.google.com.br', new=2)
elif ('youtube') in a:
webbrowser.open('www.youtube.com', new=2)
elif ('kahoot') in a:
webbrowser.open('kahoot.it', new=2)
else:
pr... | {"/main.py": ["/configs.py"]} |
17,345 | DiegoAscanio/hostnames_provider | refs/heads/master | /hostnames_provider/hostnames/models.py | '''
@file models.py
@lastmod 9/11/2016
'''
# Importacoes
from django.db import models
import django
from django import forms
# Area de criacao de classes
# Classe do Host
class Host(models.Model):
'''
Classe de Host: Armazena um hostname, e seus Enderecos Mac e IP
'''
hostname = model... | {"/hostnames_provider/hostnames/serializers.py": ["/hostnames_provider/hostnames/models.py"]} |
17,346 | DiegoAscanio/hostnames_provider | refs/heads/master | /hostnames_provider/hostnames/HostList.py | '''
@file HostList.py
@lastmod 9/11/2016
'''
from django.http import Http404
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
class HostList(APIView):
"""
List all hosts, or create a new host.
"""
def get(self, req... | {"/hostnames_provider/hostnames/serializers.py": ["/hostnames_provider/hostnames/models.py"]} |
17,347 | DiegoAscanio/hostnames_provider | refs/heads/master | /hostnames_provider/hostnames/apps.py | from django.apps import AppConfig
class HostnamesConfig(AppConfig):
name = 'hostnames'
| {"/hostnames_provider/hostnames/serializers.py": ["/hostnames_provider/hostnames/models.py"]} |
17,348 | DiegoAscanio/hostnames_provider | refs/heads/master | /hostnames_provider/hostnames/urls.py | '''
@file urls.py
@lastmod 8/11/2016
'''
# Importacoes
from django.conf.urls import include, url
from django.contrib import admin
import django.contrib.auth.views
from views import HostDetail
from . import views
from . import models
# Area de criacao de urls
urlpatterns = [
url(r'^$', views.ind... | {"/hostnames_provider/hostnames/serializers.py": ["/hostnames_provider/hostnames/models.py"]} |
17,349 | DiegoAscanio/hostnames_provider | refs/heads/master | /hostnames_provider/convert.py | csv_file = request.FILES['filename'].name
txt_file = 'dados.txt'
text_list = []
with open(csv_file, "r") as my_input_file:
for line in my_input_file:
line = line.split(",", 2)
text_list.append(" ".join(line))
with open(txt_file, "w") as my_output_file:
for line in text_list:
my_output... | {"/hostnames_provider/hostnames/serializers.py": ["/hostnames_provider/hostnames/models.py"]} |
17,350 | DiegoAscanio/hostnames_provider | refs/heads/master | /hostnames_provider/feeder.py | import sys, getopt, csv
import django
def feed(file_name):
django.setup()
from hostnames.models import Host
with open(file_name, 'r') as csvfile:
spamreader = csv.reader(csvfile, delimiter='|')
for h,m,i in spamreader:
#print(hostname,mac_address,ip_address)
h = Host... | {"/hostnames_provider/hostnames/serializers.py": ["/hostnames_provider/hostnames/models.py"]} |
17,351 | DiegoAscanio/hostnames_provider | refs/heads/master | /hostnames_provider/hostnames/views.py | '''
@file views.py
@lastmod 9/11/2016
'''
#Importacoes
from django.db.models import Q
from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader, RequestContext
from django.template.context_processors import csrf
from django.http import HttpResponseRedir... | {"/hostnames_provider/hostnames/serializers.py": ["/hostnames_provider/hostnames/models.py"]} |
17,352 | DiegoAscanio/hostnames_provider | refs/heads/master | /hostnames_provider/hostnames/forms.py | '''
@file forms.py
@lastmod 8/11/2016
'''
# Importacoes
from django import forms
# Area de criacao de forms
#Form de Login (nao utilizado no momento)
class LoginForm(forms.Form):
user = forms.CharField(label='user')
password = forms.CharField(label='password')
#Form de Upload de Arquivo .csv... | {"/hostnames_provider/hostnames/serializers.py": ["/hostnames_provider/hostnames/models.py"]} |
17,353 | DiegoAscanio/hostnames_provider | refs/heads/master | /hostnames_provider/extract.py | #MODULO DE EXTRAÇÃO DE QQ CSV SEPARADO POR |
lines = [line.rstrip('\n') for line in open('dados.txt')]
print(lines)
n = len(lines)
hostname = ""
mac = ""
ip = ""
i = 0
while(i < n-1) :
array = lines[i].split("|");
hostname = array[0]
mac = array[1]
ip = array[2]
print("HOSTNAME = ", hostname, "MAC = ", mac,"IP ... | {"/hostnames_provider/hostnames/serializers.py": ["/hostnames_provider/hostnames/models.py"]} |
17,354 | DiegoAscanio/hostnames_provider | refs/heads/master | /hostnames_provider/hostnames/serializers.py | '''
@file serializers.py
@lastmod 8/11/2016
'''
from rest_framework import serializers
from .models import Host
from django.db import models
# Serializer da Classe Host
class HostSerializer(serializers.ModelSerializer):
'''
Classe Serializadora de Host: Indica a Classe que servira de modelo e ... | {"/hostnames_provider/hostnames/serializers.py": ["/hostnames_provider/hostnames/models.py"]} |
17,358 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习算法原理及推导/其它/第二章——手写线性回归算法/LinearRegression/UnivariateLinearRegression.py | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from linear_regression import LinearRegression
data = pd.read_csv('../data/world-happiness-report-2017.csv') # 导入数据
# 得到训练和测试数据,以8:2切分
train_data = data.sample(frac=0.8)
test_data = data.drop(train_data.index)
input_param_name = 'Economy..GDP.per... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,359 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习算法原理及推导/其它/第二章——手写线性回归算法/util/features/prepare_for_training.py | """Prepares the dataset for training"""
import numpy as np
from .normalize import normalize
from .generate_polynomials import generate_polynomials
from .generate_sinusoids import generate_sinusoids
def prepare_for_training(data, polynomial_degree=0, sinusoid_degree=0, normalize_data=True):
# 计算样本总数
num_examp... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,360 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习竞赛实战_优胜解决方案/ACM SIGSPATIAL 2021 GISCUP/LGB_13700/2_cross_fea_order_id_level.py | #coding=utf-8
"""
Author: Aigege
Code: https://github.com/AiIsBetter
"""
# date 2021.08.01
import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.feature_extraction.text import CountVectorizer
import networkx as nx
import os
import gc
import warnings
from utils import para... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,361 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习算法原理及推导/其它/第二章——手写线性回归算法/util/features/normalize.py | """Normalize features"""
"""数据标准化"""
import numpy as np
def normalize(features):
features_normalized = np.copy(features).astype(float)
# 计算均值
features_mean = np.mean(features, 0)
# 计算标准差
features_deviation = np.std(features, 0)
# 标准化操作
if features.shape[0] > 1:
features_normali... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,362 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习竞赛实战_优胜解决方案/ACM SIGSPATIAL 2021 GISCUP/DCN蒸馏_12953/dcn_model/process.py | import pandas as pd
import numpy as np
import joblib
from sklearn.preprocessing import StandardScaler, LabelEncoder
from tqdm import tqdm
from pandarallel import pandarallel
from sklearn.model_selection import train_test_split
# import random
import gc
import ast
import os
import sys
import warnings
os.environ["TF_CPP... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,363 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习竞赛实战_优胜解决方案/ACM SIGSPATIAL 2021 GISCUP/WD_128544/wd_model/main.py | import pandas as pd
import numpy as np
import gc
import process
import wd_model
import time
RANDOM_SEED = 42
# types of columns of the data_set DataFrame
WIDE_COLS = [
'weather_le', 'hightemp', 'lowtemp', 'dayofweek'
]
if __name__ == '__main__':
t1 = time.time()
print(wd_model.get_available_gpus()) # 返... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,364 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习竞赛实战_优胜解决方案/ACM SIGSPATIAL 2021 GISCUP/WD_128544/wd_model/process.py | import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler, LabelEncoder
from tqdm import tqdm
from pandarallel import pandarallel
from sklearn.model_selection import train_test_split
# import random
import gc
import ast
import os
import warnings
import joblib
warnings.filterwarnings('ign... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,365 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习竞赛实战_优胜解决方案/ACM SIGSPATIAL 2021 GISCUP/DCN蒸馏_12953/dcn_model/main.py | import pandas as pd
import numpy as np
import gc
import tensorflow as tf
import process
import dcn_model
import sys
import random
import os
from sklearn.preprocessing import StandardScaler
from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession
config = ConfigProto()
config.gpu_... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,366 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习竞赛实战_优胜解决方案/ACM SIGSPATIAL 2021 GISCUP/LGB_13700/utils.py | #coding=utf-8
"""
Author: Aigege
Code: https://github.com/AiIsBetter
"""
# date 2021.08.01
import multiprocessing as mp
import numpy as np
import pandas as pd
from tqdm import tqdm
from scipy.stats import kurtosis, iqr, skew
import gc
from sklearn.model_selection import KFold
from sklearn.linear_model import Ridge
impo... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,367 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习竞赛实战_优胜解决方案/ACM SIGSPATIAL 2021 GISCUP/LGB_13700/3_link_fea_order_id_level.py | #coding=utf-8
"""
Author: Aigege
Code: https://github.com/AiIsBetter
"""
# date 2021.08.01
import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.feature_extraction.text import CountVectorizer
import networkx as nx
import os
import gc
import warnings
from utils import par... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,368 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习算法原理及推导/其它/第二章——手写线性回归算法/LinearRegression/MultivariateLinearRegression.py | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import plotly
import plotly.graph_objs as go
from linear_regression import LinearRegression
plotly.offline.init_notebook_mode() # 在线显示图标,更多功能
data = pd.read_csv('../data/world-happiness-report-2017.csv')
train_data = data.sample(frac=0.8)
test_d... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,369 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习竞赛实战_优胜解决方案/ACM SIGSPATIAL 2021 GISCUP/WD_128544/wd_model/wd_model.py | import pandas as pd
import numpy as np
from tensorflow import keras
import tensorflow as tf
from sklearn.preprocessing import StandardScaler, LabelEncoder
import tensorflow.keras.layers as L
# import tensorflow.keras.models as M
import tensorflow.keras.backend as K
from tensorflow.python.client import device_lib
from t... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,370 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习算法原理及推导/其它/第二章——手写线性回归算法/LinearRegression/linear_regression.py | import numpy as np
from util.features import prepare_for_training
class LinearRegression:
def __init__(self, data, labels, polynomial_degree=0, sinusoid_degree=0, normalize_data=True):
""":
1.对数据进行预处理操作
2.先得到所有的特征个数
3.初始化参数矩阵
data:数据
polynomial_degree: 是否做额外变换
... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,371 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习算法原理及推导/其它/第二章——手写线性回归算法/util/features/generate_sinusoids.py | import numpy as np
def generate_sinusoids(dataset, sinusoid_degree):
"""
sin(x).
"""
num_examples = dataset.shape[0]
sinusoids = np.empty((num_examples, 0))
for degree in range(1, sinusoid_degree+1):
sinusoid_features = np.sin(degree * dataset)
sinusoids = np.concatenate((sin... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,372 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习竞赛实战_优胜解决方案/ACM SIGSPATIAL 2021 GISCUP/LGB_13700/4_single_model.py | #coding=utf-8
"""
Author: Aigege
Code: https://github.com/AiIsBetter
"""
# date 2021.08.01
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.model_selection import KFold
import lightgbm as lgb
from utils import reduce_mem_usage,reduce_mem_usage_parallel
import os
... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,373 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习竞赛实战_优胜解决方案/ACM SIGSPATIAL 2021 GISCUP/DCN蒸馏_12953/dcn_model/dcn_model.py | import pandas as pd
import numpy as np
from tensorflow import keras
import tensorflow as tf
from sklearn.preprocessing import StandardScaler, LabelEncoder
import tensorflow.keras.layers as L
# import tensorflow.keras.models as M
import tensorflow.keras.backend as K
from tensorflow.python.client import device_lib
from t... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,374 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习竞赛实战_优胜解决方案/ACM SIGSPATIAL 2021 GISCUP/LGB_13700/1_sdne_embedding_allnext.py | #coding=utf-8
"""
Author: Aigege
Code: https://github.com/AiIsBetter
"""
# date 2021.08.01
import numpy as np
import networkx as nx
import pandas as pd
from gem.embedding.node2vec import node2vec
import os
from utils import parallel_apply
from functools import partial
import gc
def link_id_find(gr):
gr_ = gr.copy()... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,375 | iakirago/AiLearning-Theory-Applying | refs/heads/master | /机器学习竞赛实战_优胜解决方案/ACM SIGSPATIAL 2021 GISCUP/LGB_13700/5_model_final.py | #coding=utf-8
"""
Author: Aigege
Code: https://github.com/AiIsBetter
"""
# date 2021.08.01
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.model_selection import KFold
import lightgbm as lgb
from utils import reduce_mem_usage,reduce_mem_usage_parallel,lgb_score_... | {"/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624b\u5199\u7ebf\u6027\u56de\u5f52\u7b97\u6cd5/util/features/prepare_for_training.py": ["/\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u539f\u7406\u53ca\u63a8\u5bfc/\u5176\u5b83/\u7b2c\u4e8c\u7ae0\u2014\u2014\u624... |
17,427 | seizans/sandbox-django | HEAD | /sandbox/settings/_stg.py | # coding=utf8
# ステージング用の環境で共通の設定
# base系の後で import * されるので、上書きをする挙動になる
ALLOWED_HOSTS = ['ステージング環境で使うホスト名を入れる']
SECRET_KEY = 'n+i_fly3y8v%(hgp#n(9h3@brw6qjiae)$gauqd)mee1t3dp1u'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'dbname',
'USER': 'dbuser',
'PAS... | {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,428 | seizans/sandbox-django | HEAD | /sandbox/api/jsonschemas.py | # coding=utf8
notes_requests = {
}
notes_response = {
'type': 'object',
'required': ['hoge'],
'properties': {
'hoge': {'type': 'string'},
'mado': {
'type': 'array',
'minItems': 1,
'items': {'type': 'integer'},
'uniqueItems': True,
},
... | {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,429 | seizans/sandbox-django | HEAD | /sandbox/core/search_indexes.py | # coding=utf8
from celery_haystack.indexes import CelerySearchIndex
from django.utils import timezone
from haystack import indexes
from .models import Note
class NoteIndex(CelerySearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=False)
title = indexes.CharField(model_attr... | {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,430 | seizans/sandbox-django | HEAD | /sandbox/store/views.py | # coding=utf8
from django.core.urlresolvers import reverse_lazy
from django.shortcuts import render
from django.views.generic.edit import CreateView
from haystack.query import SearchQuerySet
from core.models import Note
from core.search_indexes import NoteIndex
from .tasks import add
def hello(request):
result... | {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,431 | seizans/sandbox-django | HEAD | /sandbox/core/middleware.py | # coding=utf8
from django.core.urlresolvers import resolve
class JsonSchemaValidateMiddleware(object):
def process_request(self, request):
print request.path_info
resolver_match = resolve(request.path_info)
print resolver_match.url_name
print resolver_match.func
print res... | {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,432 | seizans/sandbox-django | HEAD | /sandbox/api/tests.py | # coding=utf8
from django.test import TestCase
import jsonschema
import simplejson as json
from . import jsonschemas
class JsonSchemaTestCase(TestCase):
def assertSchema(self, schema, content):
try:
jsonschema.validate(json.loads(content), schema)
except json.JSONDecodeError as e:
... | {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,433 | seizans/sandbox-django | HEAD | /sandbox/store/urls.py | from django.conf.urls import patterns, url
urlpatterns = patterns(
'store.views',
url(r'^hello$', 'hello'),
url(r'^note$', 'note', name='note'),
url(r'^insert-note$', 'insert_note'),
)
| {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,434 | seizans/sandbox-django | HEAD | /sandbox/api/urls.py | from django.conf.urls import include, patterns, url
from rest_framework import viewsets, routers
from core.models import Note
class NoteViewSet(viewsets.ModelViewSet):
model = Note
router = routers.DefaultRouter()
router.register(r'notes', NoteViewSet)
urlpatterns = patterns(
'api.views',
url('^notes$'... | {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,435 | seizans/sandbox-django | HEAD | /sandbox/settings/_base.py | # coding=utf8
# 全アプリ、全環境に共通の設定
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'haystack',
'elasticstack',
'celery_haystack',
'core',
)
MIDDLEWARE_CLA... | {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,436 | seizans/sandbox-django | HEAD | /sandbox/back/views.py | # coding=utf8
from django.shortcuts import render
def hello(request):
d = {'back_hello_string': 'HELLO BACK APPLICATION'}
return render(request, 'back/hello.html', d)
| {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,437 | seizans/sandbox-django | HEAD | /sandbox/core/models.py | # coding=utf8
from django.db import models
class Note(models.Model):
title = models.CharField(max_length=255, null=False, blank=False)
author = models.CharField(max_length=255, null=False, blank=False)
content = models.TextField(null=False, blank=False)
created = models.DateTimeField(auto_now_add=Tr... | {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,438 | seizans/sandbox-django | HEAD | /sandbox/store/tests/test_01.py | # coding=utf8
from django.test import TestCase
from core.factories import StaffFactory
class FactoryBoyTest(TestCase):
def setUp(self):
pass
def test_factory(self):
staff1 = StaffFactory()
print staff1.name
print staff1.belong.name
print staff1.company_name
... | {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,439 | seizans/sandbox-django | HEAD | /sandbox/settings/store_stg.py | # coding=utf8
# 表側アプリケーションの、ステージング環境用の設定
from ._store_base import * # NOQA
from ._stg import * # NOQA
| {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,440 | seizans/sandbox-django | HEAD | /sandbox/settings/store_dev.py | # coding=utf8
# 表側アプリケーションの、開発環境用の設定
from ._store_base import * # NOQA
from ._dev import * # NOQA
# .dev で定義されている追加分を追加する
INSTALLED_APPS += INSTALLED_APPS_PLUS
| {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,441 | seizans/sandbox-django | HEAD | /sandbox/back/urls.py | # coding=utf8
from django.conf.urls import patterns, url
urlpatterns = patterns(
'back.views',
url(r'^hello$', 'hello'),
)
| {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,442 | seizans/sandbox-django | HEAD | /sandbox/settings/_store_base.py | # coding=utf8
# storeアプリケーション(表側)に共通の設定
from ._base import * # NOQA
ROOT_URLCONF = 'core.store_urls'
SESSION_COOKIE_AGE = 60 * 60 * 24 * 30 # 30日間
INSTALLED_APPS += (
'store',
)
| {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,443 | seizans/sandbox-django | HEAD | /sandbox/api/views.py | # coding=utf8
from django.http import JsonResponse
def notes(request):
content = {
'hoge': 'fuga',
'mado': [1, 3, 5],
}
return JsonResponse(content)
from django.http import HttpResponse
import simplejson as json
def notes2(request):
content = {
'hoge': 'fuga',
'mado... | {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,444 | seizans/sandbox-django | HEAD | /sandbox/settings/_dev.py | # coding=utf8
# 開発用の環境で共通の設定
# base系の後で import * されるので、上書きをする挙動になる
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS ... | {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
17,445 | seizans/sandbox-django | HEAD | /sandbox/settings/_back_base.py | # coding=utf8
# backアプリケーション(管理用)に共通の設定
from ._base import * # NOQA
ROOT_URLCONF = 'core.back_urls'
SESSION_EXPIRE_AT_BROWSER_CLOSE = True # 管理アプリではブラウザ閉じるとセッション期限切れにする
INSTALLED_APPS += (
'django.contrib.admin',
'back',
)
| {"/sandbox/core/search_indexes.py": ["/sandbox/core/models.py"], "/sandbox/settings/store_stg.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_stg.py"], "/sandbox/settings/store_dev.py": ["/sandbox/settings/_store_base.py", "/sandbox/settings/_dev.py"], "/sandbox/settings/_store_base.py": ["/sandbox/settin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.