repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
TianyuWu1990/ChatterBot
NLP_test.py
import nltk text = 'Mary has a little lamb. Here fleece was white as snow'
TianyuWu1990/ChatterBot
predict_model.py
import json import tensorflow as tf from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.layers import Embedding, LSTM, Dense, Bidirectional from tensorflow.keras.models import Sequential from tensorflow.keras.optimizers import...
TianyuWu1990/ChatterBot
NLP_Practice.py
import tensorflow as tf from tensorflow import keras from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences import nltk from nltk.stem.lancaster import LancasterStemmer import json with open('intents.json', 'r') as file: data = json.load(file) ...
TianyuWu1990/ChatterBot
AI_Classification.py
<filename>AI_Classification.py import tensorflow as tf # tensorflow==2.0 from tensorflow import keras import numpy as np import matplotlib.pyplot as plt # SSL issue fix import ssl try: _create_unverified_https_context = ssl._create_unverified_context except AttributeError: pass else: ssl._create_default_h...
TianyuWu1990/ChatterBot
test.py
<reponame>TianyuWu1990/ChatterBot from chatterbot import ChatBot from chatterbot.trainers import ListTrainer # Create a new chat bot named Charlie chatbot = ChatBot('Piggy', database_url = r'mysql://localhost:8889/test') # print(chatbot.name) trainer = ListTrainer(chatbot) # # trainer.train([ # ...
TianyuWu1990/ChatterBot
Bot_Training.py
<reponame>TianyuWu1990/ChatterBot """ AI Neural Network Training For Captain Pi Created By: <NAME> """ import tensorflow as tf from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.layers import Embedding, LSTM, Dense, Bidirecti...
GA-17a/crnn.pytorch
demo_gt.py
<reponame>GA-17a/crnn.pytorch<filename>demo_gt.py # This Python file uses the following encoding: utf-8 import sys reload(sys) sys.setdefaultencoding('utf-8') import torch from torch.autograd import Variable import utils import dataset from PIL import Image import os #import chardet import models.crnn as crnn mo...
GA-17a/crnn.pytorch
alphabet.py
<reponame>GA-17a/crnn.pytorch # encoding: utf-8 alphabet='0123456789-.:元km#¥公里/年月日()'
GA-17a/crnn.pytorch
test_zj.py
# This Python file uses the following encoding: utf-8 import sys reload(sys) sys.setdefaultencoding('utf-8') import torch from torch.autograd import Variable import utils import dataset from PIL import Image import os #import chardet import models.crnn as crnn model_path = './models/ModelsAndLog_zj_64/netCRNN_2_...
davidalves1/api-projeto-ifes
thingspeak.py
from datetime import datetime import requests class ThingSpeak(object): def __init__(self, temperature, humidity, rain): self.url = 'https://api.thingspeak.com/update' self.headers = {'Content-Type': 'application/x-www-form-urlencoded'} self.data = { 'api_key': '<KEY>', ...
davidalves1/api-projeto-ifes
env.example.py
# DB DB_HOST = '' DB_NAME = '' DB_USER = '' DB_PASS = '' # Facebook FACEBOOK_APP_KEY = '' FACEBOOK_VERIFY_TOKEN = '' # Twitter TWITTER_CONSUMER_KEY = '' TWITTER_CONSUMER_SECRET = '' TWITTER_ACCESS_TOKEN = '' TWITTER_ACCESS_TOKEN_SECRET = ''
davidalves1/api-projeto-ifes
weather.py
import mysql.connector import env class Weather(object): def __init__(self, temperature, humidity, rain): self.table = 'weather' self.has_error = False self.error = '' self.temperature = float(temperature) self.humidity = float(humidity) self.rain = int(rain) d...
davidalves1/api-projeto-ifes
twitter_api.py
<reponame>davidalves1/api-projeto-ifes import env import twitter class TwitterApi(object): def __init__(self): self.api = twitter.Api( consumer_key=env.TWITTER_CONSUMER_KEY, consumer_secret=env.TWITTER_CONSUMER_SECRET, access_token_key=env.TWITTER_ACCESS_TOKEN, ...
davidalves1/api-projeto-ifes
app.py
# -*- coding: utf-8 -*- from flask import Flask, jsonify, request, render_template from jsonschema import validate from twitter_api import TwitterApi from weather import Weather from thingspeak import ThingSpeak import env import json import requests app = Flask(__name__) @app.route('/') def dashboard(): return...
quan-dao/RoboND-Perception-Project
pr2_robot/scripts/project_template.py
#!/usr/bin/env python # Import modules import numpy as np import sklearn from sklearn.preprocessing import LabelEncoder import pickle from sensor_stick.srv import GetNormals from sensor_stick.features import compute_color_histograms from sensor_stick.features import compute_normal_histograms from visualization_msgs.ms...
divyagar/pycasbin
casbin/__init__.py
from .enforcer import * from .synced_enforcer import SyncedEnforcer from .distributed_enforcer import DistributedEnforcer from . import util
SeaFalcon/Musicool_Pr
apps/models.py
<gh_stars>1-10 # -*- coding: utf-8 -*- """ models.py """ from apps import db class User(db.Model): email = db.Column(db.String(255),primary_key=True) password=db.Column(db.String(255)) join_date=db.Column(db.DateTime(), default=db.func.now()) user_nick= db.Column(db.String(20))
SeaFalcon/Musicool_Pr
apps/settings.py
""" settings.py Configuration for Flask app """ import os from datetime import timedelta class Config(object): # Set secret key to use session SECRET_KEY = "musicool123890" debug = False PERMANENT_SESSION_LIFETIME = timedelta(minutes=10) class Production(Config): debug = True CSRF_ENABLED =...
SeaFalcon/Musicool_Pr
apps/controllers.py
# -*- coding: utf-8 -*- # all the imports from flask import request, redirect, url_for, render_template, flash, session, g, jsonify from apps import app, db # , db # db는 왜 있냐? # from sqlalchemy import desc, asc # 오름차순 내림차순 정렬 from sqlalchemy import desc, asc from apps.models import User from werkzeug.security imp...
SeaFalcon/Musicool_Pr
apps/music_database.py
# -*- coding: utf-8 -*- # [{time: value(button)}{}] #time 함수 해서time 저장 class Database(object): def __init__(self): self.music_database = [] #button은 키코드, timing은 현재시간. def start_music(self,button, timing): self.music_database.append({timing: button}) def put(self, storage): self....
SeaFalcon/Musicool_Pr
apps/__init__.py
""" Initialize Flask app """ from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.migrate import Migrate, MigrateCommand from flask.ext.script import Manager app = Flask('apps') app.config.from_object('apps.settings.Production') db = SQLAlchemy(app) manager = Manager(app) migrate = Mi...
SeaFalcon/Musicool_Pr
manager.py
from apps import manager manager.run()
SeaFalcon/Musicool_Pr
lib/alembic/script.py
<reponame>SeaFalcon/Musicool_Pr import datetime import os import re import shutil from . import util _sourceless_rev_file = re.compile(r'(?!__init__)(.*\.py)(c|o)?$') _only_source_rev_file = re.compile(r'(?!__init__)(.*\.py)$') _legacy_rev = re.compile(r'([a-f0-9]+)\.py$') _mod_def_re = re.compile(r'(upgrade|downgrade...
security-geeks/SimpleEmailSpoofer
libs/PrettyOutput.py
<reponame>security-geeks/SimpleEmailSpoofer from colorama import Fore, Back, Style from colorama import init as color_init def output_good(line): print Fore.GREEN + Style.BRIGHT + "[+]" + Style.RESET_ALL, line def output_indifferent(line): print Fore.BLUE + Style.BRIGHT + "[*]" + Style.RESET_ALL, line def ou...
src-d/tech-mapping
test_base.py
<filename>test_base.py<gh_stars>0 import tm def test_make_snapshots(): base = tm._utc_iso("2013-01-01") lower = tm._utc_iso("2013-01-01") upper = tm._utc_iso("2013-02-01") period = tm._timedelta_days(7) assert [ tm._utc_iso("2013-01-01"), tm._utc_iso("2013-01-08"), tm._utc_...
src-d/tech-mapping
tm.py
import argparse import datetime import git import zqx_git class _SnapshotTracker: def __init__(self, snapshots): self.snapshots = sorted(snapshots) self.last_call = None def _peek_next_snapshot(self): return self.snapshots[-1] if self.snapshots else None def _pop_next_snapshot(...
src-d/tech-mapping
zqx_git.py
import itertools def head_iterator(repo): commit = repo.head.commit while True: yield commit if not commit.parents: break commit = commit.parents[0] def filter_descending_iterator_dates(iter, lower, upper): drop_greater_upper = itertools.dropwhile( lambda comm...
mhucka/zoinks
dev/unused-code/zoinks-pyzotero/main_body.py
''' Zoinks: a program to retrieve field values from Zotero records Authors ------- <NAME> <<EMAIL>> -- Caltech Library Copyright --------- Copyright (c) 2020 by <NAME> and the California Institute of Technology. This code is open-source software released under a 3-clause BSD license. Please see the file "LICENSE" f...
mhucka/zoinks
dev/unused-code/zoinks-pyzotero/__main__.py
<gh_stars>1-10 ''' Zoinks: a program to print specific field values from Zotero records Authors ------- <NAME> <<EMAIL>> -- Caltech Library Copyright --------- Copyright (c) 2020 by <NAME> and the California Institute of Technology. This code is open-source software released under a 3-clause BSD license. Please see...
mhucka/zoinks
zoinks/__init__.py
''' Zoinks: retrieve field values for Zotero records Authors ------- <NAME> <<EMAIL>> -- Caltech Library Copyright --------- Copyright (c) 2022 by <NAME> and the California Institute of Technology. This code is open-source software released under the MIT license. Please see the file "LICENSE" for more information....
mhucka/zoinks
zoinks/exceptions.py
<filename>zoinks/exceptions.py<gh_stars>1-10 ''' exceptions.py: exceptions defined by Zoinks Authors ------- <NAME> <<EMAIL>> -- Caltech Library Copyright --------- Copyright (c) 2022 by <NAME> and the California Institute of Technology. This code is open-source software released under a 3-clause BSD license. Pleas...
mhucka/zoinks
dev/unused-code/unused.py
''' unused.py: currently unused code, kept in case it becomes useful in the future ''' def bbt_export(ckey): '''Call the BBT export interface and return the results. This takes a single BBT citation key. It returns a tuple: (json dict, error). The value of error will be None if no error occurred, else...
mhucka/zoinks
zoinks/__main__.py
<gh_stars>1-10 ''' Zoinks: a program to print field values from Zotero records Authors ------- <NAME> <<EMAIL>> -- Caltech Library Copyright --------- Copyright (c) 2022 by <NAME> and the California Institute of Technology. This code is open-source software released under a 3-clause BSD license. Please see the file...
dustinpianalto/geeksbot_web
geeksbot_web/rcon/utils.py
<filename>geeksbot_web/rcon/utils.py from rest_framework.response import Response from rest_framework import status def create_error_response(msg, status=status.HTTP_404_NOT_FOUND): return Response({'details': msg}, status=status) def create_success_response(rcon_data, status, many: bool = F...
dustinpianalto/geeksbot_web
geeksbot_web/patreon/models.py
<gh_stars>0 from django.db import models from django.core.exceptions import ObjectDoesNotExist from rest_framework import status from guilds.models import Guild from guilds.models import Role from .utils import create_error_response from .utils import create_success_creator_response from .utils import create_success_t...
dustinpianalto/geeksbot_web
geeksbot_web/rcon/rcon_lib/rcon.py
<reponame>dustinpianalto/geeksbot_web<filename>geeksbot_web/rcon/rcon_lib/rcon.py import logging import itertools import struct import socket import time # Packet types SERVERDATA_AUTH = 3 SERVERDATA_AUTH_RESPONSE = 2 SERVERDATA_EXECCOMMAND = 2 SERVERDATA_RESPONSE_VALUE = 0 __all__ = ['RCONPacket', 'RCONConnection'] ...
dustinpianalto/geeksbot_web
geeksbot_web/channels/apps.py
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class ChannelsConfig(AppConfig): name = 'channels' verbose_name = _("Channels")
dustinpianalto/geeksbot_web
geeksbot_web/users/validators.py
<reponame>dustinpianalto/geeksbot_web from django.contrib.auth.validators import UnicodeUsernameValidator class CustomUsernameValidator(UnicodeUsernameValidator): regex = r'^.+$'
dustinpianalto/geeksbot_web
geeksbot_web/dmessages/api_urls.py
from django.urls import path from .views import MessageDetailAPI, MessagesAPI from .views import RequestDetailAPI, RequestsAPI from .views import CommentDetailAPI, CommentsAPI, CommentsCountAPI from .views import WaitForMessageAPI from .views import UserRequestsAPI app_name = "messages_api" urlpatterns = [ path("...
dustinpianalto/geeksbot_web
geeksbot_web/channels/utils.py
from rest_framework.response import Response from rest_framework import status def create_error_response(msg, status=status.HTTP_404_NOT_FOUND): return Response({'details': msg}, status=status) def create_success_response(channel_data, status, many: bool = False): from .serializers impor...
dustinpianalto/geeksbot_web
geeksbot_web/shared_libs/TicTacToe/board.py
<filename>geeksbot_web/shared_libs/TicTacToe/board.py from src.shared_libs.guid import Guid from src.shared_libs.TicTacToe.player import Player class Board: def __init__(self): self.id = Guid() self.board = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', '...
dustinpianalto/geeksbot_web
geeksbot_web/patreon/admin.py
from django.contrib import admin from .models import PatreonCreator from .models import PatreonTier # Register your models here. admin.site.register(PatreonCreator) admin.site.register(PatreonTier)
dustinpianalto/geeksbot_web
geeksbot_web/guilds/views.py
from rest_framework.views import APIView from rest_framework import status from rest_framework.permissions import IsAuthenticated from django.core.exceptions import ObjectDoesNotExist from utils.api_utils import PaginatedAPIView from .models import Guild from .models import Role from .utils import create_error_respons...
dustinpianalto/geeksbot_web
geeksbot_web/rcon/serializers.py
<filename>geeksbot_web/rcon/serializers.py from rest_framework import serializers from rcon.models import RconServer class RconServerSerializer(serializers.ModelSerializer): class Meta: model = RconServer fields = "__all__"
dustinpianalto/geeksbot_web
geeksbot_web/rcon/api_urls.py
from django.urls import path from .views import RCONServersAPI, RCONServerDetailAPI, ListPlayers, WhitelistAPI, BroadcastAPI app_name = "rcon_api" urlpatterns = [ path("<str:guild_id>/", view=RCONServersAPI.as_view(), name='guild_servers'), path("<str:guild_id>/<str:name>/", view=RCONServerDetailAPI.as_view()...
dustinpianalto/geeksbot_web
geeksbot_web/rcon/models.py
from django.db import models from django.core.exceptions import ObjectDoesNotExist from rest_framework import status from guilds.models import Guild from dmessages.models import Message from users.models import User from channels.models import Channel from .utils import create_error_response from .utils import create_...
dustinpianalto/geeksbot_web
geeksbot_web/shared_libs/TicTacToe/player.py
from src.shared_libs.guid import Guid import random from copy import deepcopy __all__ = ['Player', 'AIPlayer'] class Player: def __init__(self, token: str, *, name: str=None, id: str=None, discord_id: int=None): if len(token) != 1: raise Warning('Token must be exactly one character long.') ...
dustinpianalto/geeksbot_web
geeksbot_web/channels/api_urls.py
<reponame>dustinpianalto/geeksbot_web<filename>geeksbot_web/channels/api_urls.py from django.urls import path from .views import ChannelsAPI, ChannelDetail, AdminChannelAPI app_name = "channels_api" urlpatterns = [ path("", view=ChannelsAPI.as_view(), name="list"), path("<str:id>/", view=ChannelDetail.as_view...
dustinpianalto/geeksbot_web
geeksbot_web/users/utils.py
from rest_framework.response import Response from rest_framework import status def create_error_response(msg, status=status.HTTP_404_NOT_FOUND): return Response({'details': msg}, status=status) def create_success_response(user_data, status, many: bool = False): from .serializers import U...
dustinpianalto/geeksbot_web
geeksbot_web/patreon/apps.py
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class PatreonConfig(AppConfig): name = 'patreon' verbose_name = _("Patreon")
dustinpianalto/geeksbot_web
geeksbot_web/rcon/admin.py
<gh_stars>0 from django.contrib import admin from .models import RconServer # Register your models here. admin.site.register(RconServer)
dustinpianalto/geeksbot_web
geeksbot_web/channels/views.py
<gh_stars>0 from rest_framework.views import APIView from rest_framework import status from rest_framework.permissions import IsAuthenticated from django.core.exceptions import ObjectDoesNotExist from utils.api_utils import PaginatedAPIView from .models import Channel from .utils import create_error_response from .uti...
dustinpianalto/geeksbot_web
geeksbot_web/channels/serializers.py
from rest_framework import serializers from .models import Channel class ChannelSerializer(serializers.ModelSerializer): class Meta: model = Channel fields = "__all__"
dustinpianalto/geeksbot_web
geeksbot_web/users/serializers.py
<reponame>dustinpianalto/geeksbot_web<gh_stars>0 from rest_framework import serializers from users.models import User from users.models import UserLog class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User fields = [ 'id', 'username', ...
dustinpianalto/geeksbot_web
geeksbot_web/patreon/serializers.py
<reponame>dustinpianalto/geeksbot_web from rest_framework import serializers from patreon.models import PatreonCreator from patreon.models import PatreonTier class PatreonCreatorSerializer(serializers.ModelSerializer): class Meta: model = PatreonCreator fields = "__all__" class PatreonTierSeria...
dustinpianalto/geeksbot_web
geeksbot_web/dmessages/serializers.py
<reponame>dustinpianalto/geeksbot_web<filename>geeksbot_web/dmessages/serializers.py from rest_framework import serializers from .models import Message from .models import GuildInfo from .models import AdminRequest from .models import AdminComment class MessageSerializer(serializers.ModelSerializer): class Meta:...
dustinpianalto/geeksbot_web
geeksbot_web/users/api_urls.py
from django.urls import path from users.views import UsersAPI, UserDetail, UserLogList, UserLogDetail app_name = "users_api" urlpatterns = [ path("", view=UsersAPI.as_view(), name="list"), path("<str:id>/", view=UserDetail.as_view(), name="detail"), path("<str:id>/logs/", view=UserLogList.as_view(), name=...
dustinpianalto/geeksbot_web
geeksbot_web/users/adapters.py
<gh_stars>0 from typing import Any from allauth.account.adapter import DefaultAccountAdapter from allauth.socialaccount.adapter import DefaultSocialAccountAdapter from allauth.account.utils import user_email, user_username, user_field from allauth.utils import valid_email_or_none from django.conf import settings from ...
dustinpianalto/geeksbot_web
geeksbot_web/users/views.py
from django.contrib.auth.mixins import LoginRequiredMixin from django.urls import reverse from django.views.generic import DetailView, RedirectView, UpdateView from django.contrib import messages from django.utils.translation import ugettext_lazy as _ from rest_framework.views import APIView from rest_framework import ...
dustinpianalto/geeksbot_web
geeksbot_web/guilds/models.py
import os from django.db import models from django.contrib.postgres.fields import ArrayField from django.core.exceptions import ObjectDoesNotExist from rest_framework import status from .utils import create_error_response from .utils import create_success_response from .utils import create_role_success_response # C...
dustinpianalto/geeksbot_web
geeksbot_web/guilds/api_urls.py
<reponame>dustinpianalto/geeksbot_web from django.urls import path from .views import GuildsAPI, GuildDetail from .views import RolesAPI, RoleDetailAPI from .views import AdminRolesAPI, ModeratorRolesAPI app_name = "guilds_api" urlpatterns = [ path("", view=GuildsAPI.as_view(), name="list"), path("<str:id>/",...
dustinpianalto/geeksbot_web
geeksbot_web/guilds/apps.py
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class GuildsConfig(AppConfig): name = 'guilds' verbose_name = _("Guilds")
dustinpianalto/geeksbot_web
geeksbot_web/dmessages/models.py
<filename>geeksbot_web/dmessages/models.py from datetime import datetime, timezone from django.db import models from django.core.exceptions import ObjectDoesNotExist from django.contrib.postgres.fields import ArrayField from rest_framework import status from guilds.models import Guild from guilds.models import Role f...
dustinpianalto/geeksbot_web
geeksbot_web/rcon/rcon_lib/arcon.py
from . import rcon import asyncio from typing import Union import logging arcon_log = logging.getLogger('arcon_lib') class ARKServer(rcon.RCONConnection): def __init__(self, *args, monitor_chat: bool = False, server_chat_channel: int = None, server_messages_channel: int = None, **kwargs): ...
dustinpianalto/geeksbot_web
geeksbot_web/users/models.py
from django.contrib.auth.models import AbstractUser from django.db.models import CharField from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django.db import models from django.contrib.postgres.fields import ArrayField from django.conf import settings from django.db.models.sig...
dustinpianalto/geeksbot_web
geeksbot_web/rcon/views.py
<gh_stars>0 import asyncio from rest_framework.views import APIView from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework import status from .rcon_lib import arcon from .models import RconServer from .utils import create_error_response, create_success_...
dustinpianalto/geeksbot_web
geeksbot_web/channels/models.py
<gh_stars>0 from django.db import models from django.core.exceptions import ObjectDoesNotExist from rest_framework import status from guilds.models import Guild from .utils import create_error_response from .utils import create_success_response # Create your models here. class Channel(models.Model): id = models...
dustinpianalto/geeksbot_web
geeksbot_web/patreon/utils.py
from rest_framework.response import Response from rest_framework import status def create_error_response(msg, status=status.HTTP_404_NOT_FOUND): return Response({'details': msg}, status=status) def create_success_creator_response(creator_data, status, many: bool = False): from .serialize...
dustinpianalto/geeksbot_web
geeksbot_web/users/forms.py
from django.contrib.auth import forms from django.forms import CharField from allauth.account.forms import SignupForm from .models import User class UserCreateForm(SignupForm): id = CharField(max_length=30, label='Discord ID') def save(self, request): user = super(UserCreateForm, self).save(request)...
dustinpianalto/geeksbot_web
geeksbot_web/dmessages/utils.py
from rest_framework.response import Response from rest_framework import status def create_error_response(msg, status=status.HTTP_404_NOT_FOUND): return Response({'details': msg}, status=status) def create_success_response(message_data, status, many: bool = False): from .serializers impor...
dustinpianalto/geeksbot_web
geeksbot_web/dmessages/views.py
from time import sleep from datetime import datetime from rest_framework.views import APIView from rest_framework import status from rest_framework.permissions import IsAuthenticated from django.core.exceptions import ObjectDoesNotExist from rest_framework.response import Response from rest_framework import status f...
dustinpianalto/geeksbot_web
geeksbot_web/users/admin.py
from django.contrib import admin from django.contrib.auth import admin as auth_admin from .forms import UserChangeForm, UserCreateForm from .models import User class UserAdmin(auth_admin.UserAdmin): model = User form = UserChangeForm add_form = UserCreateForm add_fieldsets = auth_admin.UserAdmin.add_...
dustinpianalto/geeksbot_web
geeksbot_web/guilds/permissions.py
from rest_framework.permissions import BasePermission class GuildPermissions(BasePermission): def has_permission(self, request, view): return super().has_permission(request, view) def has_object_permission(self, request, view, obj): return super().has_object_permission(request, view, obj)
dustinpianalto/geeksbot_web
geeksbot_web/guilds/utils.py
<filename>geeksbot_web/guilds/utils.py from rest_framework.response import Response from rest_framework import status def create_error_response(msg, status=status.HTTP_404_NOT_FOUND): return Response({'details': msg}, status=status) def create_success_response(guild_data, status, many: bool ...
dustinpianalto/geeksbot_web
geeksbot_web/config/middleware.py
<filename>geeksbot_web/config/middleware.py from django.http import HttpResponse from django.utils.deprecation import MiddlewareMixin class AWSELBHealthCheckMiddleware(MiddlewareMixin): def process_request(self, request): if request.META["PATH_INFO"] == '/hostcheck/': return HttpResponse("It's...
dustinpianalto/geeksbot_web
geeksbot_web/guilds/serializers.py
from rest_framework import serializers from guilds.models import Guild from guilds.models import Role class GuildSerializer(serializers.ModelSerializer): class Meta: model = Guild fields = "__all__" class RoleSerializer(serializers.ModelSerializer): class Meta: model = Role ...
dustinpianalto/geeksbot_web
geeksbot_web/patreon/patron.py
<gh_stars>0 import discord import gspread from oauth2client.service_account import ServiceAccountCredentials class Patron: def __init__(self, *, discord_name: str=None, steam_id: int=None, patreon_tier: str=None, patron_of: str=None, discord_discrim: int=None, discord_id: int=None, patreon_name: ...
dustinpianalto/geeksbot_web
geeksbot_web/dmessages/admin.py
<filename>geeksbot_web/dmessages/admin.py from django.contrib import admin from .models import Message from .models import GuildInfo from .models import AdminRequest # Register your models here. admin.site.register(Message) admin.site.register(GuildInfo) admin.site.register(AdminRequest)
dustinpianalto/geeksbot_web
geeksbot_web/dmessages/apps.py
<gh_stars>0 from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class MessagesConfig(AppConfig): name = 'dmessages' verbose_name = _("DMessages")
dustinpianalto/geeksbot_web
geeksbot_web/guilds/admin.py
<reponame>dustinpianalto/geeksbot_web from django.contrib import admin from guilds.models import Guild from guilds.models import Role # Register your models here. admin.site.register(Guild) admin.site.register(Role)
aanjkyks/whisper-bot
whisper-bot.py
import asyncio import urllib.parse from discord.ext import commands, tasks from discord.utils import get from fortnite_python import Fortnite from fortnite_python.exceptions import UnknownPlayerError from twitch import TwitchClient def file_reader(filename): file = open(filename) content = file.read() re...
hartle/netrd
netrd/dynamics/__init__.py
<reponame>hartle/netrd<filename>netrd/dynamics/__init__.py from .base import BaseDynamics from .sherrington_kirkpatrick import SherringtonKirkpatrickIsing from .single_unbiased_random_walker import SingleUnbiasedRandomWalker from .kuramoto import Kuramoto from .lotka_volterra import LotkaVolterra from .ising_glauber im...
hartle/netrd
netrd/dynamics/kuramoto.py
<filename>netrd/dynamics/kuramoto.py """ kuramoto.py --------------------- author: <NAME> """ from .base import BaseDynamics import networkx as nx import numpy as np import scipy.integrate as it class Kuramoto(BaseDynamics): def __init__(self): self.results={} def simulate(self, G, L, dt=0.01, K=1, I...
hartle/netrd
netrd/utilities/__init__.py
from .threshold import threshold from .graph import create_graph from .read import * from .cluster import * from .standardize import * __all__ = []
hartle/netrd
netrd/distance/resistance_perturbation.py
<gh_stars>0 """ resistance_perturbation.py -------------- Graph distance based on resistance perturbation (https://arxiv.org/abs/1605.01091v2) author: <NAME> & <NAME> email: Submitted as part of the 2019 NetSI Collabathon. """ import warnings import numpy as np import networkx as nx import scipy.sparse as ss from .ba...
hartle/netrd
netrd/reconstruction/correlation_spanning_tree.py
<filename>netrd/reconstruction/correlation_spanning_tree.py """ correlation_spanning_tree.py -------------- Graph reconstruction algorithm based on <NAME>. (1999). Hierarchical structure in financial markets. The European Physical Journal B-Condensed Matter and Complex Systems, 11(1), 193-197. DOI https://doi.org/10...
CDBiddulph/anki_add_pitch_plugin
__init__.py
<reponame>CDBiddulph/anki_add_pitch_plugin """ Anki plugin to add pitch accent indicators to cards. This plugin makes use of data from Wadoku by <NAME>. (See file wadoku_parse.py for more details.) Wadoku license information is available on the web: http://www.wadoku.de/wiki/display/WAD/Wörterbuch+Liz...
smontanaro/mpo
scripts/log2csv.py
#!/usr/bin/env python """Process mpo-smtpd.log file from stdin, write to stdout as CSV. Output is a CSV file with the following fields: sender - sender email (left of '@') sender-domain sender email domain (right of '@') sender-host recipient - recipient email (left of '@') recipient-domain - recipient domain (right...
smontanaro/mpo
scripts/dups.py
#!/usr/bin/env python """List duplicate message numbers. Usage looks something like this: egrep -i '^message-id:' ham.mbox.cull \\ | awk '{printf("%s %d\\n", $2, NR)}' \\ | python dups.py \\ | sort -r -n The resulting message numbers give a list of messages in reverse order to delete from ham.mbox.cull. """ impor...
smontanaro/mpo
scripts/classify.py
#!/usr/bin/env python """Classify message actions for logfile(s) on command line. There are several possible action messages: 553 rejected, executable attachment. 553 rejected, message looks like spam. 553 rejected (put NOTSPAM in message subject to bypass spam filter) message accepted message accepted (filters bypa...
WPAUL2020/AppTransaccional-v4.2rc
public/ScriptScrap/Api.py
##################Importación de Modulo necesarios############################ import requests #Request para peticiones htlm from lxml import etree #etree para manejo de xml import ast # Paquete para la procesar árboles de la gramática de sintaxis abstracta import json # Paquete para manejo convertir a JSON from flask ...
5703863336/electriity
meiduo_mall/apps/carts/urls.py
<reponame>5703863336/electriity from django.conf.urls import url from . import views urlpatterns = [ url(r'^carts/$',views.CartsView.as_view(),name='carts'), ]
5703863336/electriity
meiduo_mall/apps/users/utils.py
import re from django.contrib.auth.backends import ModelBackend from itsdangerous import BadData from itsdangerous import TimedJSONWebSignatureSerializer as Serializer from apps.users.models import User from meiduo_mall import settings class UsernameMobileModelBackend(ModelBackend): def authenticate(self, reque...
5703863336/electriity
meiduo_mall/utils/storage.py
<gh_stars>0 from django.core.files.storage import Storage class MyStorage(Storage): def _open(self,name,mode='rb'): pass def _save(self,name,content,max_length=None): pass def url(self,name): return "http://192.168.203.130:8888/" + name
5703863336/electriity
meiduo_mall/celery_tasks/config.py
# 让中间人连接redis的 14号库 broker_url = "redis://127.0.0.1/14" # 任务执行结果保存在 15号库 result_backend = "redis://127.0.0.1/15" # broker_url = "redis://127.0.0.1/14" # # result_backend = "redis://127.0.0.1/15"
5703863336/electriity
meiduo_mall/apps/areas/views.py
<reponame>5703863336/electriity from django.http import JsonResponse from django.core.cache import cache from django.shortcuts import render from django.views import View from apps.areas.models import Area from utils.response_code import RETCODE import logging logger = logging.getLogger('django') class AreasView(View)...
5703863336/electriity
meiduo_mall/apps/verifications/urls.py
<filename>meiduo_mall/apps/verifications/urls.py from django.conf.urls import url from . import views urlpatterns = [ # 图形验证码 url(r'^image_codes/(?P<uuid>[\w-]+)/$', views.ImageCodeView.as_view()), url(r'^sms_codes/(?P<mobile>1[3-9]\d{9})/$', views.SmsCodeView.as_view()), url(r'^smscodes/(?P<mobile>1[3-...
5703863336/electriity
meiduo_mall/apps/carts/views.py
<filename>meiduo_mall/apps/carts/views.py from django.shortcuts import render # Create your views here. import base64 import json import pickle from django.http import JsonResponse from django.shortcuts import render # Create your views here. from django.views import View from django_redis import get_redis_connectio...
5703863336/electriity
meiduo_mall/apps/orders/views.py
import json from django.contrib.auth.mixins import LoginRequiredMixin from django.http import JsonResponse from django.shortcuts import render # Create your views here. from django.views import View from django_redis import get_redis_connection from apps.goods.models import SKU from apps.orders.models import OrderIn...
5703863336/electriity
meiduo_mall/apps/oauth/utils.py
<reponame>5703863336/electriity from itsdangerous import TimedJSONWebSignatureSerializer as Serializer from meiduo_mall import settings from itsdangerous import BadSignature,BadTimeSignature,BadData def serect_openid(openid): s = Serializer(secret_key=settings.SECRET_KEY,expires_in=3600) data = { 'open...