repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
ecanzonieri/kafka-python | kafka/consumer/simple.py | <reponame>ecanzonieri/kafka-python
from __future__ import absolute_import
try:
from itertools import zip_longest as izip_longest, repeat # pylint: disable-msg=E0611
except ImportError: # python 2
from itertools import izip_longest as izip_longest, repeat
import logging
import time
import six
import sys
try... |
ecanzonieri/kafka-python | kafka/common.py | import inspect
import sys
from collections import namedtuple
###############
# Structs #
###############
# Request payloads
ProduceRequest = namedtuple("ProduceRequest",
["topic", "partition", "messages"])
FetchRequest = namedtuple("FetchRequest",
["topic", "... |
ecanzonieri/kafka-python | test/test_conn.py | <filename>test/test_conn.py
import socket
import struct
from threading import Thread
import mock
from . import unittest
from kafka.common import ConnectionError
from kafka.conn import KafkaConnection, collect_hosts, DEFAULT_SOCKET_TIMEOUT_SECONDS
class ConnTest(unittest.TestCase):
def setUp(self):
self.c... |
lpraz/Punxsutawney | examples/__main__.py | <gh_stars>0
import punxsutawney
def main():
"""
Main method for the program. The server is created, built and
started here.
"""
gs = punxsutawney.GopherServer()
gs.run()
if __name__ == '__main__':
main()
|
lpraz/Punxsutawney | __init__.py | <filename>__init__.py
from Punxsutawney import *
|
lpraz/Punxsutawney | punxsutawney/menu.py | from enum import Enum
class MenuItemType(Enum):
"""
The type of content that a MenuItem leads to.
"""
TEXT = '0',
MENU = '1',
CCSO_NAMESERVER = '2',
ERROR = '3',
BINHEX = '4',
DOS = '5',
UUENCODE = '6',
SEARCH = '7',
TELNET = '8',
BINARY = '9',
MIRROR = '+',
... |
lpraz/Punxsutawney | punxsutawney/server.py | import socket
from .menu import *
class GopherServer:
"""
Serves Gopher directories and files.
"""
def run(self):
"""
Starts the server listening for connections.
"""
server_socket = socket.socket()
server_socket.bind(('', 70))
server_socket.listen(5)
... |
lpraz/Punxsutawney | setup.py | from setuptools import setup
setup(name='punxsutawney',
version='0.1',
description='Server/framework for the Gopher protocol',
url='http://github.com/lpraz/punxsutawney',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['punxsutawney'],
zip_safe=False)
|
Alpha-Worker/Emailattacker | main.py | import smtplib
import random
import os
import time
SUBJECT = str(random.randint(1,1000))
TEXT = str(random.randint(1,1000))
server = smtplib.SMTP('smtp.gmail.com',587)
server.starttls()
server.login(input("Email:"),input("Password:"))
os.system("clear")
TO = input("Attack:")
while True:
time.sleep(0.25)
serv... |
andrewtgomez96/ArticlesMicroservicesV2 | user.py | #user
#1 create a new user
#2 delete an existing user
#3 update existing user's password
from flask import Flask, request, jsonify
import click, json
from flask_sqlalchemy import SQLAlchemy
from flask.cli import with_appcontext
from dbConfig import db
from sqlalchemy import create_engine
from sqlalchemy.orm import ses... |
andrewtgomez96/ArticlesMicroservicesV2 | articles.py | #article
#1 posting a new article
#2 retrieve an existing article
#3 edit an existing article (update TIMESTAMP)
#4 delete an existing article
#5 retrieve contents of n most recent getArticles
#6 retrieve metadata for an article
from flask import Flask, request, jsonify
import click, json
from flask_sqlalchemy import ... |
andrewtgomez96/ArticlesMicroservicesV2 | dbConfig.py | <reponame>andrewtgomez96/ArticlesMicroservicesV2
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
#from app import db
from sqlalchemy import Column, Integer, String, DateTime
from datetime import datetime
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///usersDB.db'
app.config['SQ... |
andrewtgomez96/ArticlesMicroservicesV2 | syndication.py | from flask import Flask, request, jsonify
#import sqlite3
import datetime
from rfeed import *
import requests
#Create the flask app
app = Flask(__name__)
#Max Number of articles the RSS feed will return
COUNT = 10
#RSS MicroService to fetch the 10 most recent articles
@app.route("/articles/rss")
def rss():
#List... |
andrewtgomez96/ArticlesMicroservicesV2 | comments.py | <filename>comments.py
#comments
# 1 Post a new comment on an article
# 2 Delete an individual comment
# 3 Retrieve the number of comments on a given article
# 4 Retrieve the n most recent comments on a URL
from flask import Flask, request, jsonify
import click, json
from flask_sqlalchemy import SQLAlchemy
fro... |
andrewtgomez96/ArticlesMicroservicesV2 | tag.py | #tag
# 1 Add an article with a new tag# 4 Delete one or more of the tags from the article
# 5 List all articles with the new tag
# 6 Retrieve the tags for an individual URL
from flask import Flask, request, jsonify
import click, json
from flask_sqlalchemy import SQLAlchemy
from flask.cli import with_appconte... |
parthrjpt/CSE573_Projects | Project1/task1.py | <filename>Project1/task1.py<gh_stars>0
"""
Character Detection
The goal of this task is to implement an optical character recognition system consisting of Enrollment, Detection and Recognition sub tasks
Please complete all the functions that are labelled with '# TODO'. When implementing the functions,
comment the lin... |
parthrjpt/CSE573_Projects | Project3/FaceCluster.py | # -*- coding: utf-8 -*-
"""
Created on Mon May 3 18:21:56 2021
@author: parth
"""
import FaceDetector as fd
import face_recognition
import numpy as np
import matplotlib.pyplot as plt
import cv2
import pandas as pd
import glob
import os
import json
def Kmeans_learn(X,centers):
cluster_labels=[]
for i in ran... |
parthrjpt/CSE573_Projects | project2/t1.py | <filename>project2/t1.py<gh_stars>0
#Only add your code inside the function (including newly improted packages)
# You can design a new function and call the new function in the given functions.
# Not following the project guidelines will result in a 10% reduction in grades
import cv2
import numpy as np
import matplot... |
parthrjpt/CSE573_Projects | Project3/FaceDetector.py | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 20 14:56:33 2021
@author: parth
"""
import cv2
import numpy as np
import glob
import matplotlib.pyplot as plt
import json
import pandas as pd
import os
import sys
def read_images(imgpath):
imgpath = glob.glob(imgpath)
imgs = []
for ipath in imgpath:
... |
parthrjpt/CSE573_Projects | project2/t2.py | # 1. Only add your code inside the function (including newly improted packages).
# You can design a new function and call the new function in the given functions.
# 2. For bonus: Give your own picturs. If you have N pictures, name your pictures such as ["t3_1.png", "t3_2.png", ..., "t3_N.png"], and put them inside t... |
brauls/ingredients-service | app/endpoints/common/dtos/ingredient.py | <reponame>brauls/ingredients-service
"""Ingredient dto.
"""
class Ingredient():
"""Class to represent an ingredient.
"""
def __init__(self, name, availability_per_month):
self.name = name
self.availability_per_month = availability_per_month
def __repr__(self):
return """{} is t... |
brauls/ingredients-service | test/api_test/ingredients_api_test.py | """Tests for the ingredients endpoint.
"""
import json
from app.endpoints.v1.payload.ingredient import IngredientSchema
from app.endpoints.common.dtos.availability import Availability
API_PATH = "/api/v1/ingredients/"
CONTENT_TYPE = "application/json"
# create test data
INGREDIENT_NAME = "pear"
AVAILABILITY_PER_MON... |
brauls/ingredients-service | app/endpoints/v1/__init__.py | """Create the blueprint for version 1 of the ingredients API and assign the API to the blueprint.
"""
from flask import Blueprint
from .api import init_api
API_V1 = Blueprint("ingredients_api_v1", __name__, url_prefix="/api/v1")
init_api(API_V1)
|
brauls/ingredients-service | test/template_test/api_overview_test.py | <filename>test/template_test/api_overview_test.py<gh_stars>0
"""Tests for the rendering of the API overview page.
"""
def test_api_overview_status_and_content_type(test_client):
"""Test rendering of the API overview page.
Args:
test_client (FlaskClient): The test client.
"""
response = test_cl... |
brauls/ingredients-service | app/endpoints/common/converter/ingredient_converter.py | """Converts between ingredient entities and dtos.
"""
from ..dtos.ingredient import Ingredient as IngredientDto
from ..models.ingredient import Ingredient as IngredientEntity
from ..models.ingredient_availability import IngredientAvailability
def ingredient_entity_to_dto(ingredient_entity, ingredient_availability):
... |
brauls/ingredients-service | app/__init__.py | """Create the flask app instance.
"""
from .app import create_app
APP = create_app()
|
brauls/ingredients-service | test/converter_test/ingredient_dto_entity_test.py | <reponame>brauls/ingredients-service<filename>test/converter_test/ingredient_dto_entity_test.py<gh_stars>0
"""Test the conversion between ingredient dtos and entities.
"""
from app.endpoints.common.models.ingredient import Ingredient as IngredientEntity
from app.endpoints.common.models.ingredient_availability import I... |
brauls/ingredients-service | wsgi.py | """Entry point for the ingredients api for wsgi server.
"""
from flask_migrate import Migrate
from app import APP
from app.app import init_app
APP.config.from_object("app.config.ProductionConfig")
DB = init_app(APP)
MIGRATE = Migrate(APP, DB)
|
brauls/ingredients-service | app/endpoints/common/models/__init__.py | """Initialize the SQLAlchemy object.
"""
from flask_sqlalchemy import SQLAlchemy
DB = SQLAlchemy()
|
brauls/ingredients-service | app/endpoints/v1/register_error_handler.py | <reponame>brauls/ingredients-service
"""Register error handlers to an api
"""
def register_error_handler(api):
"""Register error handlers to the passed api.
Args:
api (flask_restplus.Namespace): The namespace to which the error handlers
shall be registered
"""
@api.errorhandler(Valu... |
brauls/ingredients-service | app/endpoints/common/models/ingredient_availability.py | <reponame>brauls/ingredients-service<gh_stars>0
"""Ingredient's availability database entity class.
"""
from . import DB
class IngredientAvailability(DB.Model):
"""The IngredientAvailability entity class.
Defines the availability for one ingredient in one month.
"""
__tablename__ = "INGREDIENT_AVAILAB... |
brauls/ingredients-service | app/endpoints/common/dtos/availability.py | """Availability of fruit and vegetables.
"""
from enum import IntEnum
class Availability(IntEnum):
"""Enum to define that availability of fruit and vegetables.
"""
# fruit and vegetables that are beeing harvestet at a time
FRESH = 1
# fruit and vegetables that have been harvestet in the past and... |
brauls/ingredients-service | app/register_templates.py | <filename>app/register_templates.py
"""Register HTML templates on specific urls.
"""
from flask import render_template, url_for
def register_api_overview(flask_app):
"""Register an overview page of all available API versions.
"""
registered_blueprints = [api_version for api_version in flask_app.iter_blue... |
brauls/ingredients-service | test/conftest.py | <gh_stars>0
"""Fixture to yield a test client used in all tests that need one.
"""
import pytest
from app import APP
from app.app import init_app
@pytest.fixture(scope="session")
def test_client():
"""Create a test api client to use for the test cases.
Returns:
FlaskClient: The test client.
"""
... |
brauls/ingredients-service | test/converter_test/ingredient_rto_dto_v1_test.py | """Test the conversion between ingredient rtos and dtos.
"""
import pytest
from app.endpoints.v1.payload.ingredient import Ingredient as IngredientRto
from app.endpoints.common.dtos.ingredient import Ingredient as IngredientDto
from app.endpoints.common.dtos.availability import Availability
# create test data
INGRED... |
brauls/ingredients-service | main.py | <reponame>brauls/ingredients-service
"""Entry point for the ingredients api during development.
"""
from flask_migrate import Migrate
from app import APP
from app.app import init_app
APP.config.from_object("app.config.DevelopmentConfig")
DB = init_app(APP)
MIGRATE = Migrate(APP, DB)
if __name__ == "__main__":
A... |
brauls/ingredients-service | app/endpoints/v1/payload/ingredient.py | <reponame>brauls/ingredients-service<filename>app/endpoints/v1/payload/ingredient.py<gh_stars>0
"""Ingredient rto and schema.
"""
from marshmallow import Schema, fields, post_load
from ...common.dtos.ingredient import Ingredient as IngredientDto
from ...common.dtos.availability import Availability
class Ingredient()... |
brauls/ingredients-service | app/endpoints/common/services/ingredient_store.py | """CRUD operations for ingredients.
"""
from ..models.ingredient import Ingredient as IngredientEntity
from ..models.ingredient_availability import IngredientAvailability
from ..converter.ingredient_converter import ingredient_entity_to_dto, ingredient_dto_to_entity
from ..models import DB
def get_ingredients():
... |
brauls/ingredients-service | app/endpoints/v1/api.py | """API initialization module for Ingredients v1.
"""
from flask_restplus import Api
from .ingredients_api import API as ingredients_api
def init_api(blueprint):
"""Create the api along with the available namespaces.
Returns:
Api: The initialized api object
"""
api = Api(
blueprint,
... |
brauls/ingredients-service | app/endpoints/v1/ingredients_api.py | <reponame>brauls/ingredients-service<gh_stars>0
"""REST interface module for posting new ingredients and requesting existing ones.
"""
from flask import request, jsonify
from flask_restplus import Namespace, Resource, fields
from werkzeug.exceptions import BadRequest
from ..common.services.ingredient_store import get... |
brauls/ingredients-service | app/endpoints/common/models/ingredient.py | """Ingredient database entity class.
"""
from . import DB
class Ingredient(DB.Model):
"""The Ingredient entity class.
Defines ingredient as it is stored inside the database.
"""
__tablename__ = "INGREDIENT"
id = DB.Column(DB.Integer, primary_key=True)
name = DB.Column(DB.String(80), unique=Tr... |
brauls/ingredients-service | app/app.py | """Entry module that inits the flask app.
"""
from flask import Flask
from .endpoints.common.models import DB
from .register_templates import register_api_overview
from .endpoints.v1 import API_V1
def create_app():
"""Create the flask app.
Returns:
Flask: The initialized flask app
"""
flask_... |
brauls/ingredients-service | app/config.py | <filename>app/config.py
"""Config module that contains configs for the different application environments
"""
import os
class Config(object):
"""The base application configuration
"""
ENV = ""
DEBUG = False
TESTING = False
CSRF_ENABLED = True
SQLALCHEMY_DATABASE_URI = ""
SQLALCHEMY_TRA... |
brauls/ingredients-service | migrations/versions/f0ddbf9cdd26_add_ingredient_availability_table.py | """add ingredient availability table
Revision ID: f0ddbf9cdd26
Revises: 7cf38c4ce08a
Create Date: 2019-06-28 21:34:49.780023
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f0ddbf9cdd26'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def... |
simon04/py3status | setup.py | <filename>setup.py
"""
py3status
"""
import os
import sys
from setuptools import find_packages, setup
from setuptools.command.develop import develop
from setuptools.command.install import install
from setuptools.command.easy_install import _to_ascii, ScriptWriter
module_path = os.path.join(
os.path.dirname(os.pat... |
simon04/py3status | py3status/modules/cmus.py | <reponame>simon04/py3status
# -*- coding: utf-8 -*-
"""
Display song currently playing in cmus.
cmus (C* Music Player) is a small, fast and powerful console audio player
which supports most major audio formats. Various features include gapless
playback, ReplayGain support, MP3 and Ogg streaming, live filtering, instan... |
simon04/py3status | py3status/composite.py | # basestring does not exist in python3
try:
basestring
except NameError:
basestring = str
class Composite:
"""
Helper class to identify a composite and store its content
A Composite is essentially a wrapped list containing response items.
"""
def __init__(self, content=None):
# tr... |
simon04/py3status | py3status/modules/online_status.py | # -*- coding: utf-8 -*-
"""
Determine if you have an Internet Connection.
Configuration parameters:
cache_timeout: refresh interval for this module (default 10)
format: display format for this module (default '{icon}')
icon_off: show when connection is offline (default '■')
icon_on: show when connectio... |
simon04/py3status | tests/test_py3.py | from pprint import pformat
from py3status.py3 import Py3
py3 = Py3()
def test_format_units():
tests = [
# basic unit guessing
(dict(value=100), (100, 'B')),
(dict(value=999), (999, 'B')),
(dict(value=1000), (0.977, 'KiB')),
(dict(value=1024), (1.0, 'KiB')),
(dic... |
simon04/py3status | py3status/modules/deadbeef.py | <filename>py3status/modules/deadbeef.py
# -*- coding: utf-8 -*-
"""
Display song currently playing in deadbeef.
Configuration parameters:
cache_timeout: refresh interval for this module (default 5)
format: display format for this module (default '[{artist} - ][{title}]')
sleep_timeout: when deadbeef is not... |
simon04/py3status | py3status/modules/xscreensaver.py | <reponame>simon04/py3status
# -*- coding: utf-8 -*-
"""
Control Xscreensaver.
This script is useful for people who let Xscreensaver manage DPMS settings.
Xscreensaver has its own DPMS variables separate from xset. DPMS can be
safely turned off in xset as long as Xscreensaver is running.
Settings can be managed using "... |
simon04/py3status | py3status/modules/twitch.py | <reponame>simon04/py3status<gh_stars>0
# -*- coding: utf-8 -*-
"""
Display status on a given Twitch streamer.
Checks if a streamer is online using the Twitch Kraken API to see
if a channel is currently streaming or not.
Configuration parameters:
cache_timeout: how often we refresh this module in seconds
(... |
simon04/py3status | py3status/modules/file_status.py | # -*- coding: utf-8 -*-
"""
Display if a file or directory exists.
Configuration parameters:
cache_timeout: how often to run the check (default 10)
format: format of the output. (default '{icon}')
icon_available: icon to display when available (default '●')
icon_unavailable: icon to display when unavai... |
simon04/py3status | py3status/modules/diskdata.py | <reponame>simon04/py3status
# -*- coding: utf-8 -*-
"""
Display disk information.
Configuration parameters:
cache_timeout: refresh interval for this module. (default 10)
disk: show stats for disk or partition, i.e. `sda1`. None for all disks.
(default None)
format: display format for this module.
... |
simon04/py3status | py3status/storage.py | <gh_stars>0
from __future__ import with_statement
import os
from collections import Iterable, Mapping
from pickle import dump, load
from tempfile import NamedTemporaryFile
from time import time
class Storage:
data = {}
initialized = False
def init(self, py3_wrapper, is_python_2):
self.is_pytho... |
simon04/py3status | py3status/private.py | import base64
import inspect
class Private(object):
"""
This class attempts to keep private information.
Clearly this is python so we cannot actually achieve that aim.
Any attacker could easily monkey patch out any of this code rendering it
useless.
The point of this is to make the code less... |
simon04/py3status | py3status/exceptions.py | class Py3Exception(Exception):
"""
Base Py3 exception class. All custom Py3 exceptions derive from this
class.
"""
class CommandError(Py3Exception):
"""
An error occurred running the given command.
This exception provides some additional attributes
``error_code``: The error code ret... |
simon04/py3status | py3status/modules/imap.py | <reponame>simon04/py3status
# -*- coding: utf-8 -*-
"""
Display number of unread messages from IMAP account.
Configuration parameters:
allow_urgent: display urgency on unread messages (default False)
cache_timeout: refresh interval for this module (default 60)
criterion: status of emails to check for (defa... |
simon04/py3status | py3status/util.py | # -*- coding: utf-8 -*-
from __future__ import division
import re
from colorsys import rgb_to_hsv, hsv_to_rgb
from math import modf
class Gradiants:
"""
Create color gradients
"""
RE_HEX = re.compile('#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})')
_gradients_cache = {}
def hex_2_rgb(self, color):
... |
simon04/py3status | py3status/modules/moc.py | <reponame>simon04/py3status<gh_stars>0
# -*- coding: utf-8 -*-
"""
Display song currently playing in moc.
MOC (music on console) is a console audio player for Linux/Unix designed to be
powerful and easy to use. It consists of two parts, a server (moc) and a
player/interface (mocp). It supports OGG, WAV, MP3 and other ... |
simon04/py3status | py3status/modules/dropboxd_status.py | # -*- coding: utf-8 -*-
"""
Display status of Dropbox daemon.
Configuration parameters:
cache_timeout: refresh interval for this module (default 10)
format: display format for this module (default "Dropbox: {status}")
status_busy: text for placeholder {status} when Dropbox is busy (default None)
status... |
simon04/py3status | py3status/command.py | <filename>py3status/command.py
import argparse
import glob
import json
import os
import socket
import sys
import threading
from py3status.version import version
SERVER_ADDRESS = '/tmp/py3status_uds'
MAX_SIZE = 1024
BUTTONS = {
'leftclick': 1,
'middleclick': 2,
'rightclick': 3,
'scrollup': 4,
'scr... |
simon04/py3status | py3status/version.py | version = '3.11_rc0'
|
lstout/2048-AI | Training/train.py | # ******************************** #
# Double pole balancing experiment #
# ******************************** #
import math
import random
from neat import config, population, chromosome, genome, visualize
from simulator import Simulator
def evaluate_population(population):
#evaluation function for the population
sim... |
lstout/2048-AI | Training/term2048/ia.py | <gh_stars>1-10
from term2048.board import Board
import random
import copy
class IA(object):
def __str__(self, margins={}):
return ""
@staticmethod
def randomNextMove(board):
'''
It's just a test for the validMove function
'''
if board.validMove(Board.UP):
... |
lstout/2048-AI | Training/simulator.py | <reponame>lstout/2048-AI<filename>Training/simulator.py
from term2048.game import Game
from neat import nn
from math import log
import copy
import sys
from multiprocessing.dummy import Pool
MOVES = [1,2,3,4]
class Simulator(object):
def __init__(self,population):
self.population = population
def run(self):
def... |
lstout/2048-AI | Training/term2048/game.py | <filename>Training/term2048/game.py
# -*- coding: UTF-8 -*-
from __future__ import print_function
import os
import os.path
import math
import time
from colorama import init, Fore, Style
init(autoreset=True)
from term2048 import keypress
from term2048.board import Board
from term2048.ia import IA
class Game(object)... |
CIA-CCTB/pythrahyper_net | Start_Conditions/StartCondition_Maker.py | <filename>Start_Conditions/StartCondition_Maker.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 10 08:39:19 2019
@author: top40ub
"""
#import numpy
import numpy as np
import csv
import os
from pathlib import Path
"""
from the Math_and_Simulation folder to .py-files are loaded containing
functi... |
CIA-CCTB/pythrahyper_net | Math_and_Simulation/Quaternions.py | <reponame>CIA-CCTB/pythrahyper_net
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 21 14:05:55 2018
@author: top40ub
"""
"""
Navigation in 3D is a non-trivial task. Due to the anisotropic definition of spherical coordinate
systems, rotations and movement along isolines or fixed points ... |
CIA-CCTB/pythrahyper_net | run_growth.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
simdir = sys.argv[1]
run = sys.argv[2]
home = os.getcwd();
#basedir = "/Examples/Osteocytes/";
#simdir = "memory/20/";
#rundir = "1/";
import numpy as np
from time import time as timet
import concurrent.futures
import os
import itertools
import mul... |
CIA-CCTB/pythrahyper_net | Math_and_Simulation/Step_Maker.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 6 16:55:52 2017
@author: top40ub
"""
#import numpy as np
import numpy as np
from random import shuffle
import multiprocessing
"""
The python file containing all needed self writen functions to deciced the
actions a growth cone can do in one gr... |
CIA-CCTB/pythrahyper_net | Growth_Classes/Cone_Classes.py | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 15 17:22:01 2017
@author: <NAME>
"""
import numpy as np
from scipy.interpolate import splprep, splev
"""
Class name : ConeClass
***Description***
The main ConeClass class, all further GrowthCone class objects are subclasses
of the clas... |
palrohitg/XMeme | app.py | <gh_stars>0
from pymongo import MongoClient
import urllib.parse
from flask import Flask, render_template, request, jsonify, Response, redirect, url_for
import json
import os
import ast
from flask_cors import CORS, cross_origin
from flask_pymongo import PyMongo
app = Flask(__name__)
# Local Data-Base Connection
app.co... |
Triple60/telepath | telepath.py | """
@author <NAME>, January 2020
@source Hivemind, https://github.com/compserv/hivemind
@dataSource Open Computing Facility, https://www.ocf.berkeley.edu/
@dataMaintainers HKN's Computing Services Committee, https://hkn.eecs.berkeley.edu/about/officers
"""
import urllib.request, json, sys
# To get extended o... |
raamb/erc20_transfer_tracker | lambda_handler.py | import json
import traceback
from config import INFURA_URL_HTTPS, NET_ID, INFURA_URL_HTTPS_1
from repository import Repository
from transfers_handler import TransfersHandler
from staking_handler import StakingHandler, UnBondedStakingHandler
from uniswap_event_handler import UniswapV2TransfersHandler
processor_map = {... |
raamb/erc20_transfer_tracker | transfers_handler.py | import time
from erc20_transfer_handler import ERC20TokenHandler
from config import BATCHES_IN_A_RUN, STARTING_BLOCK_NUMBER
from contract_details import DETAILS
select_contracts = 'select wallet_address, is_contract from {TABLE_NAME} where is_contract = 1'
insert_balances = 'INSERT INTO {TABLE_NAME} ' + \
'(walle... |
raamb/erc20_transfer_tracker | blockchain_util.py | <gh_stars>0
import json
import uuid
import math
import web3
from eth_account.messages import defunct_hash_message
from web3 import Web3
from websockets.exceptions import ConnectionClosed
from config import GAS_PRICE_MULTIPLE,LOW_GAS_THRESHOLD, LOW_GAS_DEFAULT
class BlockChainUtil(object):
def __init__(self, provi... |
raamb/erc20_transfer_tracker | contract_details.py | <reponame>raamb/erc20_transfer_tracker<gh_stars>0
import os
DETAILS = {
"AGIX_TRANSFER": {
"contract_file_name": "SingularityNetToken.json",
"contract_path": os.path.abspath(
os.path.join(os.path.dirname(__file__), "node_modules", "singularitynet-token-contracts")),
"balances_ta... |
raamb/erc20_transfer_tracker | test_scenarios.py |
from lambda_handler import lambda_handler
payload1 = {"token": "AGIX","type": "BALANCE"}
payload2 = {"token": "AGIX1","type": "BALANCE"}
payload3 = {"token1": "AGIX","type1": "TRANSFER"}
payload4 = {"token": "AGIX","type1": "STAKE1"}
payload5 = {"token1": "AGIX","type": "STAKE1"}
payload6 = {"token": "SDAO","type"... |
raamb/erc20_transfer_tracker | staking_handler.py | <gh_stars>0
import time
from decimal import Decimal
from web3 import Web3
from erc20_transfer_handler import ERC20TokenHandler
from contract_details import DETAILS
from config import BATCHES_IN_A_RUN
insert_balances = 'INSERT INTO {TABLE_NAME} ' + \
'(wallet_address, amount, balance_type, balance_sub_type, block_numb... |
raamb/erc20_transfer_tracker | erc20_transfer_handler.py | import time
from web3 import Web3
from blockchain_util import BlockChainUtil
insert_events = 'INSERT INTO raw_events ' + \
'(block_number, transaction_hash, contract_address, log_index, transaction_index, event_name, raw_event, row_created, row_updated) ' + \
'VALUES (%s, %s, %s, %s, %s, %s, %s, current_timestamp, cu... |
raamb/erc20_transfer_tracker | config.py | <reponame>raamb/erc20_transfer_tracker<gh_stars>0
DB = {
"HOST":"localhost",
"USER":"",
"PASSWORD":"",
"NAME":"",
"PORT":3306
}
INFURA_URL = "wss://mainnet.infura.io/ws/v3/"
INFURA_URL_HTTPS="https://mainnet.infura.io/v3/"
INFURA_URL_HTTPS_1="https://mainnet.infura.io/v3/"
STARTING_BLOCK_NUMBER=12... |
raamb/erc20_transfer_tracker | repository.py | import pymysql
from config import DB
class Repository:
connection = None
def __init__(self):
self.DB_HOST = DB['HOST']
self.DB_USER = DB['USER']
self.DB_PASSWORD = DB['PASSWORD']
self.DB_NAME = DB['NAME']
self.DB_PORT = DB['PORT']
self.connection = self.__get_co... |
raamb/erc20_transfer_tracker | uniswap_event_handler.py | <gh_stars>0
import time
from web3 import Web3
from decimal import Decimal
from erc20_transfer_handler import ERC20TokenHandler
from config import BATCHES_IN_A_RUN
from contract_details import DETAILS
class UniswapV2TransfersHandler(ERC20TokenHandler):
BATCH_SIZE = 200
def __init__(self,ws_provider, net_id, t... |
bikramlmsl/epiphany | core/src/epicli/cli/engine/providers/any/InfrastructureBuilder.py | from cli.helpers.Step import Step
from cli.helpers.doc_list_helpers import select_single, select_all
from cli.version import VERSION
class InfrastructureBuilder(Step):
def __init__(self, docs):
super().__init__(__name__)
self.cluster_model = select_single(docs, lambda x: x.kind == 'epiphany-cluster... |
bikramlmsl/epiphany | core/src/epicli/cli/helpers/Log.py | <filename>core/src/epicli/cli/helpers/Log.py
import logging
import logging.handlers
import threading
import os
from pythonjsonlogger import jsonlogger
from cli.helpers.build_saver import get_output_path
from cli.helpers.Config import Config
class Log:
class __LogBase:
json_file_handler = None
json... |
bikramlmsl/epiphany | core/src/epicli/cli/helpers/yaml_helpers.py | <reponame>bikramlmsl/epiphany
from ruamel.yaml import YAML
from cli.helpers.objdict_helpers import objdict_to_dict, dict_to_objdict
def safe_load_all(stream):
yaml = YAML()
yaml.default_flow_style = False
docs = list(yaml.load_all(stream))
conv_docs = []
for doc in docs:
conv_docs.app... |
bikramlmsl/epiphany | core/src/epicli/cli/engine/BuildEngine.py | import os
from cli.helpers.Step import Step
from cli.helpers.doc_list_helpers import select_single
from cli.helpers.build_saver import save_manifest
from cli.helpers.yaml_helpers import safe_load_all
from cli.helpers.Log import Log
from cli.engine.providers.provider_class_loader import provider_class_loader
from cli.e... |
bikramlmsl/epiphany | core/src/epicli/cli/helpers/objdict_helpers.py | from cli.helpers.ObjDict import ObjDict
from copy import deepcopy
def nested_dict_to_objdict(d):
for k, v in d.items():
if isinstance(v, dict):
nested_dict_to_objdict(v)
d[k] = ObjDict(v)
def dict_to_objdict(d):
dc = deepcopy(d)
nested_dict_to_objdict(dc)
return ObjDi... |
bikramlmsl/epiphany | core/src/epicli/cli/engine/schema/DefaultMerger.py | from cli.helpers.data_loader import load_all_yaml_objs, types
from cli.helpers.objdict_helpers import merge_objdict
from cli.helpers.doc_list_helpers import select_first
from cli.helpers.Step import Step
from cli.version import VERSION
class DefaultMerger(Step):
def __init__(self, docs):
super().__init__(... |
bikramlmsl/epiphany | core/src/epicli/cli/helpers/doc_list_helpers.py | def select_first(documents, query):
if documents is not None:
for x in documents:
if query(x):
return x
return None
def select_all(documents, query):
if documents is not None:
result = []
for x in documents:
if query(x):
resul... |
bikramlmsl/epiphany | core/src/epicli/tests/cli/helpers/test_doc_list_helpers.py | <filename>core/src/epicli/tests/cli/helpers/test_doc_list_helpers.py
from cli.helpers.doc_list_helpers import select_first, select_all
from cli.helpers.ObjDict import ObjDict
DATA = [ObjDict({'index': 1, 'name': 'test-name-1'}),
ObjDict({'index': 2, 'name': 'test-name23'}),
ObjDict({'index': 3, 'name':... |
bikramlmsl/epiphany | core/src/epicli/cli/version.py | <gh_stars>1-10
import os
VERSION = open(os.path.join( os.path.dirname(__file__), 'version.txt.py'), 'r').read() |
bikramlmsl/epiphany | core/src/epicli/tests/cli/helpers/test_objdict_helpers.py | <filename>core/src/epicli/tests/cli/helpers/test_objdict_helpers.py
from cli.helpers.objdict_helpers import merge_objdict, dict_to_objdict, objdict_to_dict
from cli.helpers.ObjDict import ObjDict
def test_dict_to_objdict():
base = {
'field1': {
'field2': {
'field3': {
... |
bikramlmsl/epiphany | core/src/epicli/tests/cli/engine/providers/aws/test_AWSConfigBuilder.py | <filename>core/src/epicli/tests/cli/engine/providers/aws/test_AWSConfigBuilder.py
from cli.engine.providers.aws.InfrastructureBuilder import InfrastructureBuilder
from cli.helpers.objdict_helpers import dict_to_objdict
import pytest
def test_get_vpc_config_should_set_proper_values_to_model():
cluster_model = get_c... |
bikramlmsl/epiphany | core/src/epicli/cli/helpers/input_query.py | <filename>core/src/epicli/cli/helpers/input_query.py
import getpass
def prompt_for_value(prompt):
input_text = ''
while input_text == '':
input_text = input(prompt)
return input_text
def prompt_for_password(prompt):
password = ''
while password == '':
password = getpass.getpass(pro... |
bikramlmsl/epiphany | examples/keycloak/authorization/python/main.py | #!/usr/bin/env python
import os
import json
import logging
from functools import wraps
from base64 import b64decode
from flask import Flask, g, redirect, abort
from flask_oidc import OpenIDConnect
logging.basicConfig(level=logging.DEBUG)
realm = os.environ['realm']
clientId = os.environ['clientid']
clientSecret = os.... |
bikramlmsl/epiphany | core/src/epicli/run-tests.py | <filename>core/src/epicli/run-tests.py
#!/usr/bin/env py
import sys
import argparse
import json
import os
import subprocess
def main():
parser = argparse.ArgumentParser(
description=__doc__,
usage='''test <command> [<args>]''',
formatter_class=argparse.RawDescriptionHelpFormatter)
subp... |
bikramlmsl/epiphany | core/src/epicli/cli/models/AnsibleHostModel.py | class AnsibleHostModel:
def __init__(self, name, ip):
self.name = name
self.ip = ip
|
bikramlmsl/epiphany | examples/keycloak/implicit/python/main.py | <filename>examples/keycloak/implicit/python/main.py<gh_stars>1-10
#!/usr/bin/env python
import os
import json
import logging
from jose import jwt
from base64 import b64decode
from flask import Flask, request, abort
from functools import wraps
from json import dumps
logging.basicConfig(level=logging.DEBUG)
app = Flask... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.