repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
hoffmangroup/cla | claweb/bin/claweb_make_website.py | <filename>claweb/bin/claweb_make_website.py
#!/usr/bin/env python
import multiprocessing
from functools import partial
import sys
import os
import shutil
import argparse
import pandas as pd
from claweb import extra
from claweb.controller import genes
from claweb.controller import groups
from claweb.controller import ... |
hoffmangroup/cla | claweb/claweb/main.py | <filename>claweb/claweb/main.py
__author__ = 'mickael'
import argparse
import yaml
import sys
def run(config_file, comp_file):
with open(config_file) as yaml_file:
cfg = yaml.load(yaml_file)
with open(comp_file) as yaml_file:
group_and_comparisons = yaml.load(yaml_file)
if __name__ == '__... |
hoffmangroup/cla | claweb/claweb/controller/master.py | #!/usr/bin/env python
import argparse
import multiprocessing
import os
import shutil
import sys
from functools import partial
import pandas as pd
from . import genes
from . import groups
from . import index
from .comparisons import comparison_list
from .comparisons import comparisons
from .. import extra
def make_i... |
hoffmangroup/cla | claweb/claweb/view/__init__.py | <reponame>hoffmangroup/cla
__author__ = 'mickael'
|
hoffmangroup/cla | claweb/claweb/model/gene_dist.py | __author__ = 'mickael'
import base64
import matplotlib.pyplot as plt
from io import StringIO
import pandas as pd
import seaborn as sns
from ..extra import sort_samples_by_correlation
def plot_gene_distribution(gene, exp_table, group_orders, groups):
results = []
for name in group_orders:
group = [g... |
hoffmangroup/cla | claweb/claweb/f5clonto_helper/parse_20170801.py | <filename>claweb/claweb/f5clonto_helper/parse_20170801.py
#!/usr/bin env python3
import argparse
import sys
from collections import defaultdict
from collections.abc import MutableMapping
from itertools import combinations
from typing import List, Dict
import yaml
from .terms import CLTerm
from .terms import Term
d... |
hoffmangroup/cla | claweb/claweb/model/groups.py | """
Created on Oct 7, 2013
@author: mmendez
"""
import pandas as pd
import os
def group(config_file, group_and_comparisons, group_id):
header = []
genes_counts = []
group = [group
for group in group_and_comparisons['group_definitions']
if group_id == group['id']][0]
for d... |
hoffmangroup/cla | claweb/bin/claweb_make_website_gene.py | <gh_stars>0
#!/usr/bin/env python
import sys
import os
import shutil
import argparse
import pandas as pd
from claweb import extra
from claweb.controller import genes
from claweb.controller import groups
from claweb.controller import index
from claweb.controller.comparisons import comparison_list
from claweb.controll... |
hoffmangroup/cla | claweb/claweb/controller/index.py | <filename>claweb/claweb/controller/index.py
import os
from ..model import summary
from jinja2 import Environment, FileSystemLoader
def main(config_file):
template_folder = os.path.join(os.path.dirname(__file__), '..', 'view')
env = Environment(loader=FileSystemLoader(template_folder))
template = env.get... |
hoffmangroup/cla | claweb/claweb/f5clonto_helper/make_ontoviewer_coords.py | import argparse
import json
import sys
from . cytoscape_utils import get_node_attr_from_cytoscape
def main(cytoscape_file, output_graph):
nodes, edges = get_node_attr_from_cytoscape(cytoscape_file)
for node in nodes:
if nodes[node]["name"] == "sac":
nodes[node]["color"] = "orange"
... |
hoffmangroup/cla | claweb/claweb/controller/comparisons/comparison_list.py | <gh_stars>0
__author__ = 'mickael'
import os
from jinja2 import Environment, FileSystemLoader
from ...model import comparisons
def comparison_list(cfg, group_and_comparisons):
template_folder = os.path.join(os.path.dirname(__file__), '..', '..', 'view')
env = Environment(loader=FileSystemLoader(template_fold... |
hoffmangroup/cla | skrrf/setup.py | from setuptools import setup, Extension
from Cython.Build import cythonize
import numpy
exts = [Extension(name='skrrf.tree._tree', sources=['skrrf/tree/_tree.pyx']),
Extension(name='skrrf.tree._criterion', sources=['skrrf/tree/_criterion.pyx']),
Extension(name='skrrf.tree._splitter', sources=['skrrf/tr... |
maayanhd/safeTube | scoring_videos/Video_Scoring_System_metadata/Video_Scoring_System_metadata.py | import json
from http.server import BaseHTTPRequestHandler, HTTPServer
import requests
import simplejson
from pyspark.sql import SparkSession
import pickle
import re
filename = 'trained_video_classifier.sav'
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_respons... |
mathigatti/midi2voice | midi2voice/__init__.py | <gh_stars>100-1000
import os
import sys
import urllib.request
import requests
from .midi2xml import midi2xml
def renderize_voice(lyrics, midi_path, sex="female", tempo=80, out_folder="."):
VOICE_XML_PATH = os.path.join(out_folder,"voice.xml")
VOICE_WAV_PATH = os.path.join(out_folder,"voice.wav")
midi2xml(lyrics,m... |
kdfwow64/yoyo | locations/urls.py | from django.urls import path
from . import views
urlpatterns = [
path(
"<city>/",
views.RetrieveTemperatureData.as_view(),
name="retrieve_temperature_data",
)
]
|
kdfwow64/yoyo | temperature/urls.py | <reponame>kdfwow64/yoyo
from django.conf.urls import url
from django.contrib import admin
from django.urls import include, path
from rest_framework_swagger.views import get_swagger_view
schema_view = get_swagger_view(title='API Documentation')
# urls
urlpatterns = [
url(r'^api-auth/', include('rest_framework.urls... |
kdfwow64/yoyo | locations/request_object.py | <filename>locations/request_object.py
from dataclasses import field
from locations.utils.convertible import convertibleclass, meta
from locations.utils.validators import validate_range
@convertibleclass
class RetrieveTemperatureDataRequestObject:
"""Retrieve Temperature Data request object."""
CITY = "city"... |
kdfwow64/yoyo | locations/tests/request_object_tests.py | <gh_stars>0
from django.core.exceptions import ValidationError
from django.test import TestCase
from locations.request_object import RetrieveTemperatureDataRequestObject
from locations.utils.convertible import ConvertibleClassValidationError
class RetrieveTemperatureDataTestCase(TestCase):
def test_failure_reque... |
kdfwow64/yoyo | locations/utils/convertible.py | <reponame>kdfwow64/yoyo
import json
import logging
import typing
from dataclasses import dataclass, fields
from datetime import datetime
from decimal import Decimal
from enum import EnumMeta, Enum
from typing import Union
import aenum
from locations.exceptions import DetailedException, ErrorCodes
from locations.util... |
kdfwow64/yoyo | locations/migrations/0001_initial.py | from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
|
kdfwow64/yoyo | locations/views.py | <reponame>kdfwow64/yoyo<filename>locations/views.py
import requests
from django.conf import settings
from django.http import JsonResponse
from rest_framework.permissions import IsAuthenticated
from rest_framework.views import APIView
from locations.request_object import RetrieveTemperatureDataRequestObject
def retri... |
kdfwow64/yoyo | locations/exceptions.py | import logging
class ErrorCodes:
INVALID_REQUEST = 100001
class DetailedException(Exception):
status_code = 400
def __init__(
self,
code,
debug_message,
status_code=None,
payload=None,
log_level: int = logging.ERROR,
):
Exception.__init__(sel... |
kdfwow64/yoyo | locations/utils/validators.py | <filename>locations/utils/validators.py
from typing import Union
def _value_to_int(value: Union[int, str]) -> int:
"""String value to int."""
try:
return int(value)
except ValueError as error:
raise Exception("The value is not integer")
def validate_range(min_: Union[int, float] = None, ... |
indykish/chef-repo | cookbooks/megam_ganglia/templates/default/rabbitmq.py | <filename>cookbooks/megam_ganglia/templates/default/rabbitmq.py
#!/usr/bin/python2.4
import sys
import os
#import simplejson as json
import json
import urllib2
import time
from string import Template
import itertools
import threading
global url, descriptors, last_update, vhost, username, password, url_template, result... |
indykish/chef-repo | cookbooks/megam_ganglia/templates/default/nginx_status.py | ### This script reports nginx status stub metrics to ganglia.
### License to use, modify, and distribute under the GPL
### http://www.gnu.org/licenses/gpl.txt
import logging
import os
import re
import subprocess
import sys
import threading
import time
import traceback
import urllib2
logging.basicConfig(level=logging.... |
ilizol/kassia | font_reader.py | #!/usr/bin/python
import logging
import os
from pathlib import Path
from typing import Dict
from reportlab import rl_settings
from reportlab.lib import fontfinder
from reportlab.lib.fonts import addMapping
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFError, TTFont
from ruamel.yaml ... |
ilizol/kassia | syllable_line.py | <filename>syllable_line.py
from collections.abc import MutableSequence
from typing import List
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfgen.canvas import Canvas
from reportlab.platypus import Flowable
from coord import Coord
from lyric import Lyric
from syllable import Syllable
class SyllableLine(... |
Vahagn-Zaqaryan/fetch-text-python | words.py | #!/usr/bin/env python3
'''Retrivate and print words from a URL.
Usage:
python3 words.ph <URL>
'''
import sys
from urllib.request import urlopen
def fetch_words(url):
'''Fetch a list of words from URL.
Args:
url: The URL of UTF-8 text documnet.
Returns:
A list of st... |
Keith234/python_training | model/contact.py | <reponame>Keith234/python_training
from sys import maxsize
class Contact:
def __init__(self, first_name=None, middlename=None, lastname=None, nicknam=None, title=None, company=None,
address=None, home=None, mobile=None, work=None, fax=None,
email=None, email2=None, email3=None, ... |
Keith234/python_training | test/test_modify_contact.py | import random
from model.contact import Contact
def test_modify_contact_by_id(app, db, check_ui):
app.open_home_page()
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(first_name="Nana", middlename="Ver", lastname="Ko"))
old_contacts = db.get_contact_list()
contact = random.choi... |
Keith234/python_training | data/contacts.py | from model.contact import Contact
testdata = [
Contact(first_name="Nick", middlename="Toro", lastname="Delever", nicknam="Op",
title="Redsa", company="Ytggg", address="htfvv 56 8", home="887654456",
mobile="876567", work="87654567", fax="7656", secondaryphone="45678",
email="<EM... |
Keith234/python_training | test/test_information_comparison.py | <gh_stars>0
import re
from random import randrange
from model.contact import Contact
def test_information_comparison_between_homepage_and_edit_page(app):
contact_list = app.contact.get_contact_list()
index = randrange(len(contact_list))
contact_from_home_page = app.contact.get_contact_list()[index]
c... |
Keith234/python_training | fixture/db.py | import pymysql
from model.contact import Contact
from model.group import Group
class DbFixture:
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
self.password = password
self.connection = pymysql.connect(host=host, database... |
Keith234/python_training | test/test_add_contact_to_group.py | <reponame>Keith234/python_training
from fixture.orm import ORMFixture
from model.contact import Contact
import random
from model.group import Group
db = ORMFixture(host="127.0.0.1", name="addressbook", user="root", password="")
def test_add_contact_to_group(app):
if len(db.get_contact_list()) == 0:
app.... |
Keith234/python_training | test/test_delete_contact_from_group.py | from fixture.orm import ORMFixture
from model.contact import Contact
import random
from model.group import Group
db = ORMFixture(host="127.0.0.1", name="addressbook", user="root", password="")
def test_delete_contact_to_group(app):
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(first_nam... |
yogeshwarreddy13/local_server | src/csv_to_db_package/crud_operations_db.py | <filename>src/csv_to_db_package/crud_operations_db.py<gh_stars>0
"""
This module contains useful CRUD operation functions that
can be used for database table.
"""
import logging
from mysql.connector import connect, errors
import pymysql
import pandas
import boto3
import os
import csv
import requests
import json
loggin... |
yogeshwarreddy13/local_server | create_database.py | """
This module is to create a database
"""
from mysql.connector import connect, Error
try:
conn = connect(host='localhost', user='root',
password='<PASSWORD>')
if conn.is_connected():
cursor = conn.cursor()
cursor.execute("CREATE DATABASE fake_db")
print("Database cr... |
yogeshwarreddy13/local_server | test_fakeDB.py | from unittest import TestCase
from unittest.mock import patch
import sys
import os
import mysql.connector
from mysql.connector import errorcode
import csv_to_db_package.crud_operations_db
MYSQL_HOST = "localhost"
MYSQL_DB = "fake_db"
MYSQL_USER = "root"
MYSQL_PASSWORD = "<PASSWORD>"
class MockDB(TestCase):
@cla... |
yogeshwarreddy13/local_server | src/csv_to_db_package/csv_to_db.py | <gh_stars>0
"""
This module is to upload csv file to DataBase
"""
import logging
import pandas as pd
from mysql.connector import connect, errors
logging.basicConfig(filename="server_info.log", level=logging.INFO,
format='%(asctime)s:%(levelname)s:%(message)s')
CREATE_TABLE_QUERY = """CREATE TABLE... |
yogeshwarreddy13/local_server | local_server.py | <gh_stars>0
#!c:\users\yogeshwar\anaconda3\python.exe
from http.server import HTTPServer, BaseHTTPRequestHandler
import cgi
import logging
import pandas as pd
import json
from src.csv_to_db_package.csv_to_db import csv_to_db_func
from src.csv_to_db_package.crud_operations_db import view_db_data, delete_db_row, insert_d... |
yogeshwarreddy13/local_server | request_to_restapi.py | import requests
import json
data = requests.get( "https://w101gqjv56.execute-api.ap-south-1.amazonaws.com/test/s3-json-data")
data=json.loads(data.text)
# print(tuple(data["body"][0].keys()))
list1 = []
for i in data["body"]:
list1.append(tuple(i.values()))
print(list1) |
yogeshwarreddy13/local_server | test_CRUD.py | from mysql.connector.errors import ProgrammingError, DatabaseError
from csv_to_db_package.crud_operations_db import view_db_data, delete_db_row, insert_db_row, \
update_db_row, select_db_row
from fake_data import value1, value2, value3, value4, value5, value6, value7
from test_fakeDB import MockDB, MYSQL_DB
empty... |
yogeshwarreddy13/local_server | fake_data.py | value1 = {
"objectID": 1,
"isHighlight": 0,
"accessionNumber": "1979.486.1",
"accessionYear": 1979,
"isPublicDomain": 0,
"primaryImage": '0',
"primaryImageSmall": '0',
"additionalImages": "[]",
"department": "The American Wing",
"objectName": "Coin",
"title": "One-dollar Libe... |
jve2kor/Titanic_Machine_Learning | Titanic_disaster_v3.py | import pandas as pd
import seaborn as sb
from sklearn import cross_validation
from sklearn import tree
from sklearn import ensemble
from sklearn.cross_validation import StratifiedKFold
sb.set
file_path_train ="/Users/jvr605/Downloads/kaggle_titanin_dataset/train.csv"
file_path_test="/Users/jvr605/Downloads/kaggle_tit... |
achalpatel/thenewboston-python | src/thenewboston/factories/network_validator.py | from factory import Faker
from .network_node import NetworkNodeFactory
from ..constants.network import ACCOUNT_FILE_HASH_LENGTH, BLOCK_IDENTIFIER_LENGTH, MAX_POINT_VALUE, MIN_POINT_VALUE
from ..models.network_validator import NetworkValidator
class NetworkValidatorFactory(NetworkNodeFactory):
daily_confirmation_... |
achalpatel/thenewboston-python | tests/helpers.py | <reponame>achalpatel/thenewboston-python
from thenewboston.accounts.manage import create_account
from thenewboston.verify_keys.verify_key import encode_verify_key
def random_encoded_account_number():
signing_key, account_number = create_account()
return encode_verify_key(verify_key=account_number)
|
achalpatel/thenewboston-python | src/thenewboston/base_classes/fetch_primary_validator_config.py | <reponame>achalpatel/thenewboston-python
from django.core.exceptions import ValidationError
from django.core.management import CommandParser
from thenewboston.argparser.validators import decimal_validator
from thenewboston.base_classes.initialize_node import InitializeNode
from thenewboston.constants.network import PR... |
achalpatel/thenewboston-python | setup.py | # -*- coding: utf-8 -*-
import re
from setuptools import find_packages, setup
with open('README.md', encoding='utf-8') as f:
long_description = f.read()
with open('requirements.txt', encoding='utf-8') as f:
requirements = f.read().splitlines()
with open('src/thenewboston/__init__.py', encoding='utf8') as f:... |
achalpatel/thenewboston-python | src/thenewboston/factories/created_modified.py | from factory import Faker
from factory.django import DjangoModelFactory
from ..models.created_modified import CreatedModified
class CreatedModifiedFactory(DjangoModelFactory):
created_date = Faker('date')
modified_date = Faker('date')
class Meta:
model = CreatedModified
abstract = True
|
achalpatel/thenewboston-python | src/thenewboston/utils/format.py | <reponame>achalpatel/thenewboston-python
def format_address(*, ip_address, port, protocol):
"""Format address"""
port = f':{port}' if port else ''
return f'{protocol}://{ip_address}{port}'
|
achalpatel/thenewboston-python | src/thenewboston/third_party/factory/utils.py | import factory
def build_json(factory_class, **kwargs):
"""Build json representation for object using factory."""
return factory.build(
dict,
FACTORY_CLASS=factory_class,
**kwargs,
)
|
achalpatel/thenewboston-python | src/thenewboston/models/network_node.py | from uuid import uuid4
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from thenewboston.constants.network import MAX_POINT_VALUE, MIN_POINT_VALUE, PROTOCOL_CHOICES, VERIFY_KEY_LENGTH
class NetworkNode(models.Model):
id = models.UUIDField(default=uuid4, edita... |
achalpatel/thenewboston-python | src/thenewboston/constants/errors.py | <reponame>achalpatel/thenewboston-python
ERROR = 'ERROR'
# Error types
BAD_SIGNATURE = 'BAD_SIGNATURE'
UNKNOWN = 'UNKNOWN'
|
achalpatel/thenewboston-python | src/thenewboston/factories/network_node.py | <reponame>achalpatel/thenewboston-python<gh_stars>100-1000
from factory import Faker
from factory.django import DjangoModelFactory
from factory.fuzzy import FuzzyChoice
from ..constants.network import MAX_POINT_VALUE, MIN_POINT_VALUE, PROTOCOL_CHOICES, VERIFY_KEY_LENGTH
from ..models.network_node import NetworkNode
... |
achalpatel/thenewboston-python | src/thenewboston/utils/serializers.py | from rest_framework import serializers
def validate_keys(serializer_instance, data):
"""Check that there are no additional keys included in the data"""
invalid_keys = {k for k in data.keys() if k not in serializer_instance.fields.keys()}
if invalid_keys:
raise serializers.ValidationError(f'Invali... |
achalpatel/thenewboston-python | src/thenewboston/utils/signed_requests.py | from thenewboston.blocks.signatures import generate_signature
from thenewboston.utils.tools import sort_and_encode
from thenewboston.verify_keys.verify_key import encode_verify_key, get_verify_key
def generate_signed_request(*, data, nid_signing_key):
"""Generate and return signed request"""
node_identifier =... |
achalpatel/thenewboston-python | src/thenewboston/third_party/pytest/client.py | from rest_framework.status import HTTP_200_OK, HTTP_201_CREATED, HTTP_204_NO_CONTENT
from rest_framework.test import APIClient
class APIError(Exception):
def __init__(self, *args, resp, expected):
"""Inits APIError which includes the response and the expected response"""
super().__init__(*args)
... |
achalpatel/thenewboston-python | src/thenewboston/utils/fields.py | def all_field_names(model):
"""Return list of all field names for model"""
return [f.name for f in model._meta.get_fields()]
def common_field_names(a, b):
"""Return field names that are common between different models"""
field_names_a = standard_field_names(a)
field_names_b = standard_field_names(... |
achalpatel/thenewboston-python | src/thenewboston/serializers/account_balance.py | from rest_framework import serializers
from thenewboston.constants.network import MAX_POINT_VALUE, VERIFY_KEY_LENGTH
class AccountBalanceSerializer(serializers.Serializer):
account_number = serializers.CharField(max_length=VERIFY_KEY_LENGTH)
balance = serializers.IntegerField(min_value=0, max_value=MAX_POINT... |
achalpatel/thenewboston-python | src/thenewboston/utils/files.py | <reponame>achalpatel/thenewboston-python<filename>src/thenewboston/utils/files.py
import json
from hashlib import sha3_256 as sha3
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
def get_file_hash(file):
"""Return hash value of file"""
h = sha3()
with... |
achalpatel/thenewboston-python | src/thenewboston/serializers/network_transaction.py | <reponame>achalpatel/thenewboston-python
from rest_framework import serializers
from thenewboston.constants.network import ACCEPTED_FEE_LIST, MAX_POINT_VALUE, MIN_POINT_VALUE, VERIFY_KEY_LENGTH
from thenewboston.utils.serializers import validate_keys
class NetworkTransactionSerializer(serializers.Serializer):
am... |
achalpatel/thenewboston-python | src/thenewboston/constants/crawl.py | CRAWL_COMMAND_START = 'start'
CRAWL_COMMAND_STOP = 'stop'
CRAWL_STATUS_CRAWLING = 'crawling'
CRAWL_STATUS_NOT_CRAWLING = 'not_crawling'
CRAWL_STATUS_STOP_REQUESTED = 'stop_requested'
|
achalpatel/thenewboston-python | src/thenewboston/argparser/validators.py | <filename>src/thenewboston/argparser/validators.py
# -*- coding: utf-8 -*-
import argparse
import decimal
import math
from pathlib import Path
from django.core.exceptions import ValidationError
from django.core.validators import URLValidator, validate_ipv4_address, validate_ipv6_address
def str_length_validator(leng... |
achalpatel/thenewboston-python | src/thenewboston/transactions/validation.py | def validate_transaction_exists(*, amount, fee, error, recipient, txs):
"""Check for the existence of a Tx"""
tx = next(
(
tx for tx in txs if
tx.get('amount') >= amount
and tx.get('fee') == fee
and tx.get('recipient') == recipient
),
None
... |
achalpatel/thenewboston-python | src/thenewboston/serializers/network_block.py | from rest_framework import serializers
from thenewboston.blocks.signatures import verify_signature
from thenewboston.constants.network import BANK, PRIMARY_VALIDATOR, SIGNATURE_LENGTH, VERIFY_KEY_LENGTH
from thenewboston.serializers.message import MessageSerializer
from thenewboston.utils.serializers import validate_k... |
achalpatel/thenewboston-python | src/thenewboston/serializers/confirmation_block_message.py | <filename>src/thenewboston/serializers/confirmation_block_message.py
from rest_framework import serializers
from thenewboston.constants.network import BLOCK_IDENTIFIER_LENGTH
from thenewboston.serializers.account_balance import AccountBalanceSerializer
from thenewboston.serializers.network_block import NetworkBlockSer... |
achalpatel/thenewboston-python | src/thenewboston/constants/clean.py | <gh_stars>100-1000
CLEAN_COMMAND_START = 'start'
CLEAN_COMMAND_STOP = 'stop'
CLEAN_STATUS_CLEANING = 'cleaning'
CLEAN_STATUS_NOT_CLEANING = 'not_cleaning'
CLEAN_STATUS_STOP_REQUESTED = 'stop_requested'
|
achalpatel/thenewboston-python | src/thenewboston/utils/tools.py | <reponame>achalpatel/thenewboston-python
import json
def sort_and_encode(dictionary):
"""Sort dictionary and return encoded data"""
return json.dumps(dictionary, separators=(',', ':'), sort_keys=True).encode('utf-8')
|
achalpatel/thenewboston-python | src/thenewboston/serializers/message.py | <gh_stars>100-1000
from rest_framework import serializers
from thenewboston.constants.network import BALANCE_LOCK_LENGTH
from thenewboston.serializers.network_transaction import NetworkTransactionSerializer
from thenewboston.utils.serializers import validate_keys
class MessageSerializer(serializers.Serializer):
... |
achalpatel/thenewboston-python | src/thenewboston/utils/messages.py | from hashlib import sha3_256 as sha3
from thenewboston.utils.tools import sort_and_encode
def get_message_hash(*, message):
"""Return has of given message"""
return sha3(sort_and_encode(message)).digest().hex()
|
achalpatel/thenewboston-python | src/thenewboston/factories/confirmation_service.py | <filename>src/thenewboston/factories/confirmation_service.py
import pytz
from factory import Faker
from .created_modified import CreatedModifiedFactory
from ..models.confirmation_service import ConfirmationService
class ConfirmationServiceFactory(CreatedModifiedFactory):
end = Faker('date_time', tzinfo=pytz.utc)... |
achalpatel/thenewboston-python | src/thenewboston/factories/network_transaction.py | from factory import Faker, Iterator
from factory.django import DjangoModelFactory
from ..constants.network import ACCEPTED_FEE_LIST, MAX_POINT_VALUE, MIN_POINT_VALUE, VERIFY_KEY_LENGTH
from ..models.network_transaction import NetworkTransaction
class NetworkTransactionFactory(DjangoModelFactory):
amount = Faker(... |
achalpatel/thenewboston-python | src/thenewboston/models/network_transaction.py | from uuid import uuid4
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from thenewboston.constants.network import ACCEPTED_FEE_CHOICES, MAX_POINT_VALUE, MIN_POINT_VALUE, VERIFY_KEY_LENGTH
class NetworkTransaction(models.Model):
id = models.UUIDField(default=u... |
achalpatel/thenewboston-python | src/thenewboston/utils/exceptions.py | <gh_stars>100-1000
class NetworkException(Exception):
pass
|
rymurr/q | q/__init__.py | from parser import parse
from unparser import format_bits
from conn import connect
|
rymurr/q | tickerplant.py | <filename>tickerplant.py<gh_stars>0
from gevent import monkey; monkey.patch_all()
import gevent
import socket
import array
import time
import cStringIO
import bitstring
from q.unparser import format_bits
from q.utils import get_header
from q.parser import parse
def foo():
sock = socket.socket(socket.AF_INET, socke... |
rymurr/q | q/utils.py | import datetime
import itertools
from protocol import types, inv_types, header_format, MILLIS, Y2KDAYS, NULL, BYTE, INT
class iter_char(object):
def __init__(self, bstream, endianness):
self.bstream = bstream
self.endianness = endianness
def __iter__(self):
while self.bstream.pos < sel... |
rymurr/q | q/conn.py | <filename>q/conn.py
'''
TODO sort out send and recieve in cursor function! Lots of mess there
'''
import socket
import array
import cStringIO
from bitstring import ConstBitStream
from parser import parse
from unparser import format_bits
from utils import get_header
def connect(host = 'localhost', port = 5000, user =... |
rymurr/q | q/tests/test_protocol.py | <reponame>rymurr/q
'''
tests come from examples given here:
http://code.kx.com/wiki/Reference/ipcprotocol
types are found here:
http://www.kx.com/q/d/q1.htm
'''
import pandas
import datetime
import numpy as np
from collections import OrderedDict
from nose.tools import assert_almost_equal, assert_items_equal
f... |
rymurr/q | rubbish/translate.py | <reponame>rymurr/q<filename>rubbish/translate.py
import ast
import astunparse
from cStringIO import StringIO
class Transformer(ast.NodeTransformer):
def __init__(self):
super(Transformer, self).__init__()
def visit_Call(self, node):
child = self.visit(node.func)
if isinstance(child.val... |
rymurr/q | kernel.py | <reponame>rymurr/q<gh_stars>0
from IPython.kernel.zmq.kernelbase import Kernel
import json
import pandas
import q
class KdbKernel(Kernel):
implementation = 'Kdb'
implementation_version = '0.1'
language = 'kdb-q'
language_version = '3.1'
language_info = {'mimetype': 'text/plain'}
banner = "Kdb+ ... |
rymurr/q | q/unparser.py | from bitstring import pack, ConstBitStream
import pandas
import numpy as np
import datetime
from protocol import types, inv_types, header_format, MILLIS, Y2KDAYS, NULL, BYTE, INT
from utils import str_convert, format, format_list, get_header, get_date_from_q, get_hour, format_raw_list
from collections import OrderedDi... |
rymurr/q | q/parser.py | import pandas
import numpy as np
import datetime
from bitstring import ConstBitStream
from protocol import types, inv_types, header_format, MILLIS, Y2KDAYS, NULL, BYTE, INT, Y2KMILLIS
from utils import str_convert, format, format_list, get_header, get_date_from_q, get_hour, format_raw_list
from collections import Orde... |
rymurr/q | q/protocol.py | <reponame>rymurr/q<gh_stars>0
'''
Primary source of kdb ipc protocol definitions
here we define all the q data types and their on the wire form
A parser is used to convert between the python format and kdb/q format
types are found here:
http://www.kx.com/q/d/q1.htm
Note on dates and times
dates are number of ... |
CodySchluenz/CTFd | serve.py | import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--port", help="Port for debug server to listen on", default=4000)
parser.add_argument(
"--profile", help="Enable flask_profiler profiling", action="store_true"
)
# parser.add_argument(
# "--disable-gevent",
# help="Disable importing ge... |
CosmicElysium/GmailClientExtractor | clientextractor.py | <filename>clientextractor.py
'''
Note: This module uses source code provided by Google Inc.
The original oauth2.py script can be found at:
https://github.com/google/gmail-oauth2-tools/blob/master/python/oauth2.py
'''
import imaplib
import email
import lxml
import sys
import urllib
import json
import re
import da... |
masantiago/shaka-packager | packager/app/test/packager_test.py | <filename>packager/app/test/packager_test.py
#!/usr/bin/python
#
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Tests utilizing the sample packager ... |
gregzajac/MyRent | MyRent/migrations/0002_auto_20200301_1531.py | <reponame>gregzajac/MyRent
# Generated by Django 3.0.3 on 2020-03-01 15:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('MyRent', '0001_initial'),
]
operations = [
migrations.CreateModel(
n... |
gregzajac/MyRent | MyRent/urls.py | from django.urls import path
from MyRent import views
urlpatterns = [
path('', views.FlatListView.as_view(), name="flat-list"),
path('add_flat/', views.CreateFlatView.as_view(), name="add-flat"),
path('agreement/', views.AgreementListView.as_view(), name="agreement-list"),
path('add_agreement/', views... |
gregzajac/MyRent | MyRent/migrations/0003_operation_operationdict.py | # Generated by Django 3.0.3 on 2020-03-01 20:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('MyRent', '0002_auto_20200301_1531'),
]
operations = [
migrations.CreateModel(
name='OperationDi... |
gregzajac/MyRent | MyRent/admin.py | from django.contrib import admin
from django.utils.safestring import mark_safe
from MyRent.models import Flat, Tenant, Agreement, Operation, OperationDict, Landlord, Image
class FlatAdmin(admin.ModelAdmin):
model = Flat
list_display = ('__str__', 'is_for_rent', 'info')
class TenantAdmin(admin.ModelAdmin):
... |
gregzajac/MyRent | MyRent/apps.py | <reponame>gregzajac/MyRent
from django.apps import AppConfig
class MyrentConfig(AppConfig):
name = 'MyRent'
|
gregzajac/MyRent | MyRent/migrations/0005_auto_20200302_1135.py | # Generated by Django 3.0.3 on 2020-03-02 10:35
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('MyRent', '0004_tenant_us... |
gregzajac/MyRent | MyRent/views.py | <gh_stars>0
from datetime import datetime, timedelta
from django.contrib.auth.mixins import UserPassesTestMixin
from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.urls import reverse_lazy
from django.views import View
from django.views.generic import ListView, DetailView, Cr... |
gregzajac/MyRent | MyRent/migrations/0008_auto_20200304_1150.py | # Generated by Django 3.0.3 on 2020-03-04 10:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('MyRent', '0007_auto_20200303_1439'),
]
operations = [
migrations.AlterModelOptions(
name='agree... |
gregzajac/MyRent | FinalProject/urls.py | """FinalProject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-... |
gregzajac/MyRent | MyRent/migrations/0010_auto_20200304_1229.py | <reponame>gregzajac/MyRent
# Generated by Django 3.0.3 on 2020-03-04 11:29
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('MyRent', '0009_auto_20200304_1225'),
]
operations = [
migrations.RemoveField(
... |
gregzajac/MyRent | MyRent/migrations/0009_auto_20200304_1225.py | <filename>MyRent/migrations/0009_auto_20200304_1225.py
# Generated by Django 3.0.3 on 2020-03-04 11:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('MyRent', '0008_auto_20200304_1150'),
]
operations = [
migrations.AlterField(
... |
gregzajac/MyRent | MyRent/migrations/0007_auto_20200303_1439.py | # Generated by Django 3.0.3 on 2020-03-03 13:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('MyRent', '0006_auto_20200303_0943'),
]
operations = [
migrations.AddField(
model_name='flat',
name='is_for_rent',
... |
gregzajac/MyRent | MyRent/forms.py | from django.forms import ModelForm
from MyRent.models import Operation, Image
class OperationAgreementForm(ModelForm):
class Meta:
model = Operation
exclude = ["agreement"]
class ImageFlatForm(ModelForm):
class Meta:
model = Image
exclude = ["flat"]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.