repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
SanjarbekSaminjonov/payme-integration | order/views.py | from rest_framework.generics import CreateAPIView, RetrieveAPIView
from .models import Order
from .serializers import OrderSerializer
# Create your views here.
class OrderCreateAPIView(CreateAPIView):
queryset = Order.objects.all()
serializer_class = OrderSerializer
class OrderDetailAPIView(RetrieveAPIView... |
SanjarbekSaminjonov/payme-integration | order/models.py | from django.db import models
# Create your models here.
class Order(models.Model):
is_payed = models.BooleanField(default=False, blank=True, null=True)
amount = models.DecimalField(max_digits=50, decimal_places=2, blank=True, null=True)
amount_for_payme = models.DecimalField(max_digits=50, decimal_places... |
SanjarbekSaminjonov/payme-integration | payment/sentMessage.py | <reponame>SanjarbekSaminjonov/payme-integration
from requests import get
from environs import Env
env = Env()
env.read_env()
def sent_message(order):
token = env.str('BOT_TOKEN')
chat_id = env.str('CHAT_ID')
text = f'{order.id} - raqamli to\'lov amalga oshirildi ************ ' \
f'{order.pl... |
SanjarbekSaminjonov/payme-integration | payment/urls.py | <reponame>SanjarbekSaminjonov/payme-integration<filename>payment/urls.py
from django.urls import path
from .views import PaymentView, checkout_view
urlpatterns = [
path('payme/', PaymentView.as_view()),
path('checkout/', checkout_view),
]
|
SanjarbekSaminjonov/payme-integration | order/urls.py | from django.urls import path
from .views import OrderCreateAPIView, OrderDetailAPIView
urlpatterns = [
path('create/', OrderCreateAPIView.as_view()),
path('detail/<str:pk>/', OrderDetailAPIView.as_view())
]
|
SanjarbekSaminjonov/payme-integration | order/migrations/0001_initial.py | # Generated by Django 4.0.2 on 2022-03-03 12:04
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Order',
fields=[
('id', models.BigAutoField... |
SanjarbekSaminjonov/payme-integration | order/migrations/0004_order_amount_for_payme_alter_order_place_id.py | <reponame>SanjarbekSaminjonov/payme-integration
# Generated by Django 4.0.2 on 2022-03-05 05:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('order', '0003_alter_order_amount'),
]
operations = [
migrations.AddField(
model_... |
SanjarbekSaminjonov/payme-integration | order/migrations/0003_alter_order_amount.py | <reponame>SanjarbekSaminjonov/payme-integration<filename>order/migrations/0003_alter_order_amount.py
# Generated by Django 4.0.2 on 2022-03-05 04:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('order', '0002_order_customer_phone_number'),
]
... |
SanjarbekSaminjonov/payme-integration | payment/views.py | from paycomuz.views import MerchantAPIView
from paycomuz import Paycom
from order.models import Order
from rest_framework.response import Response
from rest_framework.decorators import api_view
from decimal import Decimal
from environs import Env
from .sentMessage import sent_message
env = Env()
env.read_env()
cl... |
SanjarbekSaminjonov/payme-integration | payment/admin.py | from django.contrib import admin
from django.contrib.auth.models import Group, User
admin.site.site_header = 'Payment Administration'
admin.site.unregister(Group)
admin.site.unregister(User)
|
thiagosm/API-3.0-Python | cieloApi3/address.py | <filename>cieloApi3/address.py
class Address(object):
def __init__(self):
self.street = None
self.number = None
self.complement = None
self.zip_code = None
self.city = None
self.state = None
self.country = None
|
thiagosm/API-3.0-Python | cieloApi3/creditCard.py |
from .objectJSON import ObjectJSON
class CreditCard(ObjectJSON):
def __init__(self, security_code, brand):
self.card_number = None
self.holder = None
self.expiration_date = None
self.security_code = security_code
self.save_card = None
self.brand = brand
se... |
memorious/awscement | awscement/s3/helper.py | <gh_stars>0
# MIT License
#
# Copyright (c) 2017 memorious
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... |
memorious/awscement | awscement/s3/controller.py | # MIT License
#
# Copyright (c) 2017 memorious
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... |
weskerfoot/tlacli | src/tlacli/tlacli.py | import argparse
from tlacli.tools import tlc, pluscal
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(help="Which TLA+ tool to run")
tlc.setup(subparsers)
pluscal.setup(subparsers)
def main():
try:
args = parser.parse_args()
args.run(args)
except AttributeError:
... |
weskerfoot/tlacli | src/tlacli/cfg.py | """TLC needs to read a .cfg file for invariants etc.
CFG is an internal format with a translatable cfg format.
Terms: "cfg" is short for "config", but "config" includes
TLC tuning, output vals, etc, most not part of .cfg.
"cfg" is the representation JUST the .cfg files
See Specifying Systems, pg ??? for more info on... |
weskerfoot/tlacli | src/tlacli/tools/pluscal.py | <filename>src/tlacli/tools/pluscal.py
import subprocess
import sys
from pkg_resources import resource_filename
from argparse import _SubParsersAction, Namespace
from pathlib import Path
def setup(parser: _SubParsersAction) -> None:
parser_pluscal = parser.add_parser("translate", help="Translate pluscal into TLA+",... |
FDecaYed/apex | apex/__init__.py | <gh_stars>0
from . import RNN
from . import reparameterization
from . import fp16_utils
from . import parallel
|
FDecaYed/apex | tests/raw_ops/test_backward.py | import torch
from torch.autograd import Variable
import apex._C
import numpy as np
from compare import compare
from norm import pt_norm, get_norm_shape
torch.manual_seed(2)
torch.cuda.manual_seed(2)
# torch.cuda.manual_seed_all(2)
torch.set_printoptions(precision=10)
sizes = [
# (3, 512, 1024),
# (3, 512, 1... |
FDecaYed/apex | apex/parallel/distributed.py | <reponame>FDecaYed/apex<filename>apex/parallel/distributed.py
import torch
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
import torch.distributed as dist
from torch.nn.modules import Module
from torch.autograd import Variable
def flat_dist_call(tensors, call, extra_args=None):
flat_dis... |
FDecaYed/apex | tests/distributed/ddp_race_condition_test.py | import torch
import torch.distributed as dist
from torch.nn import Parameter
from torch.nn import Module
from apex.parallel import DistributedDataParallel as DDP
import argparse
parser = argparse.ArgumentParser(description='allreduce hook example')
parser.add_argument('--dist-url', default='tcp://172.16.58.3:23456', ... |
FDecaYed/apex | setup.py | import re
import sys
import os
import shutil
import inspect
import distutils
import distutils.spawn
from distutils.command.clean import clean
from setuptools import setup, Extension, find_packages
from setuptools.command.install import install
import subprocess
import ctypes.util
import torch
def find(path, regex... |
FDecaYed/apex | tests/raw_ops/compare.py | import torch
import numpy as np
def compare(cuda_out, pt_out, pt_out_control, rows):
print( "Pytorch ops in fp16: ", pt_out )
print( "Kernel result: ", cuda_out )
print("Control (Pytorch ops, sticking to fp32): ", pt_out_control)
# Make u... |
FDecaYed/apex | tests/raw_ops/test_forward.py | import torch
import sys
import apex._C
import numpy as np
from compare import compare
from norm import pt_norm, get_norm_shape
torch.manual_seed(2)
torch.cuda.manual_seed(2)
# torch.cuda.manual_seed_all(2)
torch.set_printoptions(precision=10)
sizes = [
# (3, 512, 1024),
# (3, 512, 1536),
# (3, 768, 15... |
mckinziebrandon/seq2seq_projects | chatbot/components/bot_ops.py | <gh_stars>100-1000
"""Custom TF 'ops' as meant in the TensorFlow definition of ops."""
import numpy as np
import tensorflow as tf
from utils import io_utils
from tensorflow.python.util import nest
def dynamic_sampled_softmax_loss(labels, logits, output_projection, vocab_size,
from_sc... |
mckinziebrandon/seq2seq_projects | utils/io_utils.py | <filename>utils/io_utils.py
"""Utilities for downloading data from various datasets, tokenizing, vocabularies."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import re
import sys
import yaml
import copy
import pandas as pd
import logging
impor... |
mckinziebrandon/seq2seq_projects | chatbot/__init__.py | <reponame>mckinziebrandon/seq2seq_projects<gh_stars>100-1000
from chatbot import globals
from chatbot.components.base._rnn import *
from chatbot.components.bot_ops import dynamic_sampled_softmax_loss
from chatbot.components.decoders import *
from chatbot.components.embedder import *
from chatbot.components.encoders im... |
mckinziebrandon/seq2seq_projects | webpage/config.py | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
DEFAULT_THEME = 'lumen'
# Boolean: True if you == <NAME>; False otherwise :)
FLASK_PRACTICE_ADMIN = os.getenv('true')
# Activates the cross-site request forgery prevention.
WTF_CSRF_ENABLED = True
# Used to create cr... |
mckinziebrandon/seq2seq_projects | tests/test_config.py | """Tests for various operations done on config (yaml) dictionaries in project."""
import os
import pydoc
import yaml
import logging
import unittest
import tensorflow as tf
from utils import io_utils
import chatbot
import data
dir = os.path.dirname(os.path.realpath(__file__))
from tests.utils import *
class TestConfi... |
mckinziebrandon/seq2seq_projects | chatbot/_models.py | """Abstract classes."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import copy
import yaml
import random
import subprocess
import numpy as np
import tensorflow as tf
from tensorflow.contrib.tensorboard.plugins import projector
from tensorflo... |
mckinziebrandon/seq2seq_projects | tests/utils.py | <filename>tests/utils.py
"""Utility functions used by test modules."""
import logging
import data
import chatbot
import os
from pydoc import locate
import pdb
from utils import io_utils
import tensorflow as tf
from chatbot.globals import DEFAULT_FULL_CONFIG
from collections import namedtuple
TEST_DIR = os.path.dirna... |
mckinziebrandon/seq2seq_projects | tests/test_dynamic_models.py | <filename>tests/test_dynamic_models.py
"""Trial runs on DynamicBot with the TestData Dataset."""
import time
import logging
import unittest
import numpy as np
import tensorflow as tf
import pydoc
from pydoc import locate
import data
import chatbot
from utils import io_utils, bot_freezer
from tests.utils import *
c... |
mckinziebrandon/seq2seq_projects | data/reddit_preprocessor.py | """Reddit data preprocessing."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
from functools import wraps
from itertools import chain
from collections import Counter, defaultdict
from multiprocessing import Pool
import numpy as np... |
mckinziebrandon/seq2seq_projects | data/data_helper.py | <reponame>mckinziebrandon/seq2seq_projects
"""Provides pre-processing functionality.
Abstracts paths and filenames so we don't have to think about them. Currently,
in use by Brandon, but will extend to general users in the future.
"""
from __future__ import absolute_import
from __future__ import division
from __futur... |
mckinziebrandon/seq2seq_projects | webpage/tests/test_database.py | """Unit tests for the application."""
from flask import current_app
from flask import request
from deepchat import create_app, db
from deepchat.models import User, Conversation, Chatbot, Turn
import sys
import unittest
import sqlite3
import sqlalchemy
class TestDatabase(unittest.TestCase):
def setUp(self):
... |
mckinziebrandon/seq2seq_projects | webpage/deepchat/web_bot.py | <filename>webpage/deepchat/web_bot.py
"""Minimal subset of functions/methods from repo needed to run bot on Heroku.
See the main repository for better docs (all from utils and data directory).
"""
import os
import re
import numpy as np
import tensorflow as tf
import yaml
os.environ['TF_CPP_MIN_LOG_LEVEL']='1'
UNK_ID ... |
mckinziebrandon/seq2seq_projects | webpage/manage.py | <reponame>mckinziebrandon/seq2seq_projects
#!/usr/bin/env python3
"""manage.py: Start up the web server and the application."""
import os
from deepchat import create_app, db
from deepchat.models import User, Chatbot, Conversation, Turn
from flask_script import Manager, Shell
from flask_migrate import Migrate, Migrat... |
mckinziebrandon/seq2seq_projects | webpage/deepchat/main/__init__.py | <filename>webpage/deepchat/main/__init__.py
"""Package constructor file for creating blueprint(s)."""
from flask import Blueprint
from flask_cors import CORS
# Blueprint(<blueprint name>, <module/package where blueprint is located>).
# Note: The <blueprint name> (main for us) defines the blueprint namespace.
main = B... |
mckinziebrandon/seq2seq_projects | webpage/deepchat/main/views.py | <filename>webpage/deepchat/main/views.py
from datetime import datetime
import os
import yaml
import json
from flask import make_response, flash
from werkzeug.exceptions import HTTPException
from flask_admin.contrib import sqla
from . import main
from .. import db, web_bot, admin, basic_auth, api
from flask import re... |
mckinziebrandon/seq2seq_projects | chatbot/components/embedder.py | <reponame>mckinziebrandon/seq2seq_projects
import tensorflow as tf
import logging
import numpy as np
from chatbot._models import Model
from utils import io_utils
import time
class Embedder:
"""Acts on tensors with integer elements, embedding them in a higher-dimensional
vector space. A single Embedder instanc... |
mckinziebrandon/seq2seq_projects | chatbot/legacy/legacy_models.py | """Sequence-to-sequence models."""
# EDIT: Modified inheritance strucutre (see _models.py) so these *should* work again.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import numpy as np
import tensorflow as tf
from tensorflow.contrib.legacy_... |
mckinziebrandon/seq2seq_projects | chatbot/components/input_pipeline.py | import logging
import tensorflow as tf
from utils import io_utils
from tensorflow.contrib.training import bucket_by_sequence_length
LENGTHS = {'encoder_sequence_length': tf.FixedLenFeature([], dtype=tf.int64),
'decoder_sequence_length': tf.FixedLenFeature([], dtype=tf.int64)}
SEQUENCES = {'encoder_sequence'... |
mckinziebrandon/seq2seq_projects | chatbot/legacy/_decode.py | <reponame>mckinziebrandon/seq2seq_projects
"""Used by legacy_models for decoding. Not needed by DynamicBot."""
import tensorflow as tf
import logging
import os
import sys
from utils import io_utils
from utils.io_utils import sentence_to_token_ids, get_vocab_dicts
import numpy as np
def decode(bot, dataset, teacher_... |
mckinziebrandon/seq2seq_projects | utils/__init__.py | <filename>utils/__init__.py
from utils import io_utils
from utils import bot_freezer
|
mckinziebrandon/seq2seq_projects | tests/test_data.py | import logging
import pdb
import sys
sys.path.append("..")
import os
import unittest
import tensorflow as tf
from pydoc import locate
import chatbot
from utils import io_utils
import data
from chatbot.globals import DEFAULT_FULL_CONFIG
dir = os.path.dirname(os.path.realpath(__file__))
from tests.utils import *
class ... |
mckinziebrandon/seq2seq_projects | utils/bot_freezer.py | """Utilities for freezing and unfreezing model graphs and variables on the fly."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from utils import io_utils
import os
import re
from pydoc import locate
def load_... |
mckinziebrandon/seq2seq_projects | chatbot/components/decoders.py | <reponame>mckinziebrandon/seq2seq_projects<gh_stars>100-1000
import logging
import tensorflow as tf
import sys
# Required due to TensorFlow's unreliable naming across versions . . .
try:
# r1.1
from tensorflow.contrib.seq2seq import DynamicAttentionWrapperState \
as AttentionWrapperState
except ImportE... |
mckinziebrandon/seq2seq_projects | webpage/deepchat/main/forms.py | <gh_stars>100-1000
"""apps/forms.py: """
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, \
TextField, TextAreaField, HiddenField
from wtforms.validators import DataRequired, InputRequired
from wtforms.validators import ValidationError
def bad_chars(form, string_field):
for c in ... |
mckinziebrandon/seq2seq_projects | webpage/tests/test_simple.py | """Unit tests for the application."""
import unittest
from flask import current_app
from deepchat import create_app, db
class TestSimple(unittest.TestCase):
"""Simple tests - ensuring the app can open/access database/etc."""
def setUp(self):
"""Called before running a test."""
self.app = cre... |
mckinziebrandon/seq2seq_projects | chatbot/components/__init__.py | <filename>chatbot/components/__init__.py
from chatbot.components.embedder import Embedder
from chatbot.components.input_pipeline import InputPipeline
from chatbot.components.encoders import BasicEncoder, BidirectionalEncoder
from chatbot.components.decoders import BasicDecoder, AttentionDecoder
__all__ = ["InputPipeli... |
mckinziebrandon/seq2seq_projects | chatbot/globals.py | <reponame>mckinziebrandon/seq2seq_projects
"""Place all default/global chatbot variables here."""
import tensorflow as tf
OPTIMIZERS = {
'Adagrad': tf.train.AdagradOptimizer,
'Adam': tf.train.AdamOptimizer,
'SGD': tf.train.GradientDescentOptimizer,
'RMSProp': tf.train.RMSPropOptimizer,
}
#... |
mckinziebrandon/seq2seq_projects | tests/test_legacy_models.py | <filename>tests/test_legacy_models.py
import os
import tensorflow as tf
import unittest
import logging
import sys
from utils import io_utils
import data
import chatbot
from tests.utils import TEST_FLAGS
class TestLegacyModels(unittest.TestCase):
"""Test behavior of tf.contrib.rnn after migrating to r1.0."""
... |
mckinziebrandon/seq2seq_projects | main.py | <filename>main.py
#!/usr/bin/env python3
"""main.py: Train and/or chat with a bot. (work in progress).
Typical use cases:
1. Train a model specified by yaml config file, located at
path_to/my_config.yml, where paths are relative to project root:
./main.py --config path_to/my_config.yml
2... |
mckinziebrandon/seq2seq_projects | setup.py | <filename>setup.py<gh_stars>100-1000
from setuptools import setup
setup(name='DeepChatModels',
description='Conversation Models in TensorFlow',
url='http://github.com/mckinziebrandon/DeepChatModels',
author_email='<EMAIL>',
license='MIT',
install_requires=[
'numpy',
... |
mckinziebrandon/seq2seq_projects | webpage/deepchat/__init__.py | """deepchat/__init__.py: Initialize session objects."""
import os
from flask import Flask
from flask_wtf import CSRFProtect
from flask_moment import Moment
from flask_restful import Resource, Api
from flask_basicauth import BasicAuth
from flask_pagedown import PageDown
from flask_sqlalchemy import SQLAlchemy
from flas... |
mckinziebrandon/seq2seq_projects | webpage/deepchat/main/errors.py | <gh_stars>100-1000
"""Routes for error pages."""
from flask import render_template
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@main.app_errorhandler(500)
def internal_server_error(e):
# TODO
return "Server error. I should really make a ... |
mckinziebrandon/seq2seq_projects | chatbot/components/encoders.py | <gh_stars>100-1000
"""Classes for the dynamic encoders."""
import tensorflow as tf
from tensorflow.contrib.rnn import GRUCell
from tensorflow.contrib.rnn import LSTMStateTuple, LSTMCell
from chatbot.components.base._rnn import RNN
from tensorflow.python.layers import core as layers_core
class BasicEncoder(RNN):
... |
mckinziebrandon/seq2seq_projects | chatbot/legacy/_train.py | """Train seq2seq attention chatbot.
Note: Only used for legacy_models.
For (better) DynamicBot implementation, please see dynamic_models.py and, for saving/restoring ops,
the base class of all models in _models.py.
"""
import time
from utils import *
def train(bot, dataset):
""" Train chatbot using dataset given b... |
mckinziebrandon/seq2seq_projects | chatbot/dynamic_models.py | """Sequence-to-sequence models with dynamic unrolling and faster embedding
techniques.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import time
import logging
import numpy as np
import tensorflow as tf
from chatbot import components
from ... |
mckinziebrandon/seq2seq_projects | data/_dataset.py | """ABC for datasets. """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import logging
import numpy as np
import tensorflow as tf
from utils import io_utils
from abc import ABCMeta, abstractmethod, abstractproperty
from chatbot.globals import DE... |
mckinziebrandon/seq2seq_projects | data/dataset_wrappers.py | """Named data wrapper classes. No added functionality to dataset base class for now,
but preprocessing checks will be incorporated into each when it's time.
"""
import logging
import os
from data._dataset import Dataset
def check_data(abs_path, name):
"""All dataset wrappers call this as a quick sanity check.""... |
mckinziebrandon/seq2seq_projects | data/__init__.py | <reponame>mckinziebrandon/seq2seq_projects
from __future__ import absolute_import
from data import data_helper
from data import _dataset
from data import dataset_wrappers
from data.data_helper import DataHelper
from data._dataset import Dataset
from data.dataset_wrappers import Cornell, Ubuntu, Reddit, TestData
__al... |
mckinziebrandon/seq2seq_projects | chatbot/components/base/_rnn.py | <gh_stars>100-1000
"""Collection of base RNN classes and custom RNNCells.
"""
import tensorflow as tf
from tensorflow.python.util import nest
from tensorflow.python.ops import rnn_cell_impl
from chatbot.components import bot_ops
from tensorflow.contrib.rnn import RNNCell
from tensorflow.contrib.rnn import GRUCell, Mul... |
mckinziebrandon/seq2seq_projects | webpage/migrations/versions/236b966ecd2f_.py | <gh_stars>100-1000
"""empty message
Revision ID: 236b966ecd2f
Revises:
Create Date: 2017-05-03 14:27:37.853971
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '236b966ecd2f'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ###... |
mckinziebrandon/seq2seq_projects | webpage/deepchat/models.py | <gh_stars>100-1000
"""app/models.py: Tutorial IV - Databases.
database models: collection of classes whose purpose is to represent the
data that we will store in our database.
The ORM layer (SQLAlchemy) will do the translations required to map
objects created from these classes into rows in the prope... |
flashjaysan/python | hangman/data.py | # this files contains utility data for the pendu.py file
SCORES_FILE_NAME = "scores"
MAX_TRIES = 8
word_list = [
"roquette",
"paravent",
"coquette",
"immondes",
"colombin",
"langages",
"archiduc",
"informes",
"torturer",
"toscanes",
"distants",
"égout... |
flashjaysan/python | hangman/functions.py | <reponame>flashjaysan/python<filename>hangman/functions.py
# this files contains utility functions for the pendu.py file
import data
import random
import pickle
def game():
scores = load_scores(data.SCORES_FILE_NAME)
player_name = get_player_name()
print("Bonjour {}.".format(player_name))
... |
flashjaysan/python | bissextile.py | <gh_stars>1-10
# This program says if a year is a leap
def is_leap(year):
"""This function takes a year and returns if it is a leap year.
Param: year (positive integer)
Return: boolean
"""
return year % 400 == 0 or year % 4 == 0 and year % 100 != 0
print("Ce programme détermine si une... |
flashjaysan/python | zcasino.py | # This project is a small gambling game in french.
import math
import random
STARTING_MONEY = 50 # the money the player is starting with
def game():
print("Bienvenue dans le ZCasino !\n")
player_money = STARTING_MONEY
want_to_play = want_to_play_question(player_money)
while want_to... |
flashjaysan/python | hangman/pendu.py | <filename>hangman/pendu.py
# this project is a text based hangman game
import functions
def hangman():
print("Le jeu du pendu.")
functions.game()
if __name__ == "__main__":
hangman()
|
jacobmetrick/Perk_CSV | csvfind.py | #!/usr/bin/python
WRITE_FORMAT = ["Date","Time","Name","Gross","From Email Address"]
import io
import csv
def get_payment_amount_from_row(row):
return float(row['Gross'].replace(',', ''))
with io.open('paypal.csv', 'r', encoding='utf-8-sig') as csvfile:
with io.open('filtered_output.csv', 'w', encoding='utf... |
jacobmetrick/Perk_CSV | grouping.py | <reponame>jacobmetrick/Perk_CSV
#!/usr/bin/env python3
import csv
import datetime
import dateutil.parser as dateparser
import io
from nameparser import HumanName
import re
SURVEY_FORMAT = ["submission_date","surveyee_first_name","surveyee_last_name","surveyee_email","surveyee_phone",
"surveyee_address1","surve... |
tcolgate/gracetests | python/setup.py | import os
from setuptools import find_packages, setup
DIR = os.path.dirname(os.path.abspath(__file__))
setup(
name='graceful',
version='1.2.0',
description='test of graceful shutdown',
url='https://github.com/qubitdigital/graceful/python',
author='Infra',
author_email='<EMAIL>',
license='... |
tcolgate/gracetests | python/graceful/main.py | <gh_stars>1-10
import asyncio
import datetime
import logging
import os
from sanic import Sanic
from sanic.exceptions import SanicException
from sanic.response import json
STARTED = datetime.datetime.utcnow().isoformat()
DIR = os.path.dirname(os.path.realpath(__file__))
app = Sanic()
app.config.REQUEST_MAX_SIZE = 100... |
TheTerminator800/facial-recognition-opencv | get_face_data.py | import cv2
import os
name = input("Enter your name: \n")
final_num_pics = 50
num_pics = 50
face_cascade = cv2.CascadeClassifier('cascades/data/haarcascade_frontalface_alt2.xml')
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
img_dir = os.path.join(BASE_DIR, 'faces')
face_dir = os.path.join(img_dir, name.lower... |
TheTerminator800/facial-recognition-opencv | face_recognition.py | import cv2
import pickle
import os
import numpy as np
import tensorflow as tf
#preprocessing function used for tensorflow
def preprocess(img):
resized = tf.image.resize(img, (224, 224))
return resized / 255.
#get labels in .pkl file saved in face_train.py
labels = {}
with open("labels.pkl", 'rb') as f:
og... |
TheTerminator800/facial-recognition-opencv | face_train.py | <filename>face_train.py
import os
from PIL import Image #PythonImageLibrary for working with training images
import numpy as np
import cv2
import pickle #to save labels for use in face_recognition.py
import datetime
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
import tensorflow as tf #for advanced c... |
Ashwani066/Fusion | FusionIIIT/applications/gymkhana/migrations/0002_registration_form.py | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-06-03 21:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gymkhana', '0001_initial'),
]
operations = [
migrations.Cre... |
Ashwani066/Fusion | FusionIIIT/applications/gymkhana/migrations/0004_auto_20200605_0924.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-06-05 09:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gymkhana', '0003_auto_20200604_1737'),
]
operations = [
migrations.AlterFi... |
Ashwani066/Fusion | FusionIIIT/applications/gymkhana/migrations/0005_auto_20200605_0937.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-06-05 09:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gymkhana', '0004_auto_20200605_0924'),
]
operations = [
migrations.AlterFi... |
Ashwani066/Fusion | FusionIIIT/applications/gymkhana/migrations/0003_auto_20200604_1737.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-06-04 17:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gymkhana', '0002_registration_form'),
]
operations = [
migrations.RemoveFi... |
mahiuchun/pyglet | pyglet/util.py | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 <NAME>
# Copyright (c) 2008-2020 pyglet contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following c... |
mahiuchun/pyglet | pyglet/lib.py | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 <NAME>
# Copyright (c) 2008-2020 pyglet contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following c... |
mahiuchun/pyglet | pyglet/media/synthesis.py | <reponame>mahiuchun/pyglet<filename>pyglet/media/synthesis.py
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 <NAME>
# Copyright (c) 2008-2020 pyglet contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or witho... |
mahiuchun/pyglet | pyglet/gui/widgets.py | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 <NAME>
# Copyright (c) 2008-2020 pyglet contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following c... |
AjayNandoriya/ImageDecomposition | src/main/python/layers.py | import os
import tensorflow as tf
import numpy as np
from matplotlib import pyplot as plt
import matplotlib
matplotlib.use('TkAgg')
import cv2
@tf.custom_gradient
def get_gaussian_circular_kernel_2d(r2, sigma, gain):
"""
Returns a 2D Gaussian kernel with a circular shape.
"""
sigma_sign = tf.sign(sigma... |
AjayNandoriya/ImageDecomposition | src/main/python/image_kernels.py | <reponame>AjayNandoriya/ImageDecomposition<gh_stars>0
import numpy as np
import cv2
def get_avg_angular_kernel(kernel_half_width, angle, tight=True):
"""
Get the average angular kernel.
:param kernel_half_width: The half-width of the kernel.
:param angle: The angle of the kernel.
:return: The aver... |
AjayNandoriya/ImageDecomposition | src/unittest/python/image_kernels_tests.py | <filename>src/unittest/python/image_kernels_tests.py
import unittest
import image_kernels
import numpy as np
class TestImageKernels(unittest.TestCase):
def test_get_avg_angular_kernel_0(self):
"""Test the get_avg_angular_kernel() function with 0 degree."""
kernel_half_width = 5
# Get the a... |
AjayNandoriya/ImageDecomposition | src/main/python/poly.py | import os
import numpy as np
import cv2
from matplotlib import pyplot as plt
def create_poly(N_scale=4, N_power=4):
if N_power<=1:
N_power = 1
# N_features = N_power**2
# kernel_size = [2**N_scale-1, 2**N_scale-1]
strides = (2**(N_scale-1), 2**(N_scale-1))
kw = 2**N_scale-1
kh = 2... |
AjayNandoriya/ImageDecomposition | src/unittest/python/poly_tests.py | <gh_stars>0
import unittest
import poly
class TestPoly(unittest.TestCase):
def test_default_create_poly(self):
poly_1 = poly.create_poly()
if __name__ == '__main__':
unittest.main() |
AjayNandoriya/ImageDecomposition | src/main/examples/check_avg_kernels.py | import os
import sys
import cv2
from matplotlib import pyplot as plt
MAIN_PATH = os.path.join(os.path.dirname(__file__),'..','python')
sys.path.append(MAIN_PATH)
import image_kernels
def try_avg_kernel():
img_fname = os.path.join(os.path.dirname(__file__),'..','resources','sem_images','SRAM_22nm.jpg')
img = c... |
AjayNandoriya/ImageDecomposition | src/main/python/sem.py | import os
import cv2
from matplotlib import pyplot as plt
import tensorflow as tf
import numpy as np
def cmae(y_true, y_pred):
diff = tf.square(y_true-y_pred)[:,15:-15,15:-15,:]
full_diff = tf.reduce_mean(diff)
clipped_diff = tf.clip_by_value(diff, clip_value_min=0.064, clip_value_max=100.0)
clipped_lo... |
AjayNandoriya/ImageDecomposition | src/main/python/models.py | <reponame>AjayNandoriya/ImageDecomposition<filename>src/main/python/models.py
import tensorflow as tf
import numpy as np
import os
import sys
# create Gaussian model
class GaussianLayer(tf.keras.layers.Layer):
def __init__(self, half_kernel_size: tuple[int, int] = (5, 5), **kwargs):
super().__init__(**kwa... |
JSRicci/AdvancedPython | MineSweeperServer.py | import socket
import threading
import time
import random
import operator
Players=[]
stop = False
timer = 1
playerNum = 0
score = 0
playerScores = {}
echo_queue = []
minecoord = []
neighborCoord = []
status = ''
neighbor = []
checkcoord = []
NeighborMines = []
up_right, up_left, up, left, right, down... |
JSRicci/AdvancedPython | SimonVoiceGame.py | """Welcome to <NAME>'s Simon Says Game
In this game you can speak to your computer
as your input instead of typing or clicking.
You will see a splash screen with instructions.
Follow the instructions shown on display to play the game.
Another option is that you can enable the Debug mode and the... |
JSRicci/AdvancedPython | Exif.py | import os
from PIL import Image
from PIL.ExifTags import TAGS
path = 'C:\\Users\\Joe\\OneDrive - University of New Haven\\Fall 2016\\Adv Python\\Forensics\\ExifTool\\Images\\'
Lat = []
Lon = []
for root, dir, files in os.walk(path):
for fp in files:
if".JPG"in fp.upper():
# open a... |
JSRicci/AdvancedPython | MinesweeperClient.py | <filename>MinesweeperClient.py
import socket
import tkinter
loop = True
flag = False
global sock
button = False
buttonLst = []
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#When the shift key and mouse button 1 are pressed change button to True
def keydown(e):
global button
button = T... |
JSRicci/AdvancedPython | ZipCracker.py | import zipfile
ZFile = zipfile.ZipFile('CrackMe.zip')
Verbose = 5
with open('dictionary.txt', 'rb') as PWords:
for index, line in enumerate(PWords):
try:
pwd = line.strip(b'\n')
pwd = pwd.strip(b'\r')
ZFile.extractall(pwd=pwd)
except RuntimeError:
... |
thomasbridge74/nautobot | nautobot/extras/tests/test_api.py | <reponame>thomasbridge74/nautobot
from datetime import datetime, timedelta
import os.path
import uuid
from unittest import mock, skipIf
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.http import Http404
from django.... |
thomasbridge74/nautobot | nautobot/extras/views.py | import inspect
from datetime import datetime
import logging
from django import template
from django.contrib import messages
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.db import transaction
from django.db.models import ProtectedError, Q
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.