repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
dcartman/pygame-menu | pygame_menu/examples/other/widget_positioning.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
EXAMPLE - WIDGET POSITIONING
Test widget positioning example.
"""
import pygame_menu
from pygame_menu.examples import create_example_window
# Create the surface
surface = create_example_window('Example - Widget Positioning', (640, 480))
# Create a custom them... |
dcartman/pygame-menu | pygame_menu/controls.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
CONTROLS
Default controls of Menu object and key definition.
"""
__all__ = [
# Joy pad
'JOY_AXIS_X',
'JOY_AXIS_Y',
'JOY_BUTTON_BACK',
'JOY_BUTTON_SELECT',
'JOY_DEADZONE',
'JOY_DELAY',
'JOY_DOWN',
'JOY_LEFT',
'JOY_REPEAT'... |
dcartman/pygame-menu | pygame_menu/_widgetmanager.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
MENU WIDGET MANAGER
Easy widget add/remove to Menus.
"""
__all__ = ['WidgetManager']
import pygame_menu
from pygame_menu._base import Base
from pygame_menu.font import assert_font
from pygame_menu.utils import assert_vector, assert_color, assert_cursor, \
... |
dcartman/pygame-menu | pygame_menu/examples/other/scrollbar_area.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
EXAMPLE - SCROLL AREA
Shows ScrollArea widget usage.
"""
__all__ = ['main']
import pygame
from pygame_menu import locals
from pygame_menu.examples import create_example_window
from pygame_menu._scrollarea import ScrollArea
from pygame_menu.utils import make_su... |
dcartman/pygame-menu | pygame_menu/widgets/widget/menulink.py | """
pygame-menu
https://github.com/ppizarror/pygame-menu
MENULINK
Similar to a Button that opens a Menu, MenuLink is a widget that contains a Menu
reference. This Menu can be opened with .open() method.
"""
__all__ = [
'MenuLink',
'MenuLinkManager'
]
import pygame_menu
from abc import ABC
from pygame_menu.w... |
zzpmiracle/tensorflow-onnx | tf2onnx/onnx_opset/rnn.py | <gh_stars>0
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
"""
rnn
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import numpy as np
from tf2onnx import utils
from tf2onnx.handler import t... |
zzpmiracle/tensorflow-onnx | tf2onnx/onnx_opset/signal.py | <reponame>zzpmiracle/tensorflow-onnx
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
"""
signal
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import numpy as np
from onnx import onnx_pb
f... |
zzpmiracle/tensorflow-onnx | tf2onnx/rewriter/rnn_utils.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
"""
tf2onnx.rewriter.rnn_utils - rnn support
"""
from __future__ import unicode_literals
from collections import defaultdict
from enum import Enum
import logging
import numpy as np
from tf2onnx import utils
fr... |
zzpmiracle/tensorflow-onnx | tf2onnx/optimizer/const_fold_optimizer.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
"""const fold Optimizer.
if op's inputs are all const then do op computation when building the graph to improve performance
for example, input of transpose node is const then we can do transpose statically instead of at... |
AbrahamOsco/modelostp1 | ResolucionTP2.py | #Lee los archivos y devuelve dos diccionarios uno para las prendas incompatibles
#Y otro diccionario para el tiempo que demora cada prenda
import time
class Prenda:
def __init__(self,nroPrenda):
self.nro = nroPrenda
self.tiempoLavado = 0
self.prendasIncomp = []
self.estaLavada = False
def definirTiempo(sel... |
izapolsk/test-task | lib/widgets/sweet_alert.py | <filename>lib/widgets/sweet_alert.py
from widgetastic.widget.base import GenericLocatorWidget, View
from widgetastic.exceptions import NoSuchElementException
class SweetAlert(View):
""" Sweet alert modal widget
"""
ROOT = '//div[contains(@class, "swal-overlay") and .//div[contains(@class, "swal-modal") a... |
izapolsk/test-task | lib/views/base.py | from widgetastic.widget.base import View
from widgetastic_bootstrap.button import Button
from widgetastic.widget.input import TextInput
from widgetastic.widget.text import Text
from widgetastic_patternfly import BootstrapNav
from lib.widgets.account_dropdown import AccountDropdown
class LoginView(View):
title = ... |
izapolsk/test-task | lib/widgets/html_dropdown.py | <filename>lib/widgets/html_dropdown.py<gh_stars>0
from selenium.webdriver.support.ui import Select
from widgetastic.widget import Widget
from widgetastic.xpath import quote
from widgetastic_bootstrap.dropdown import (DropdownItemDisabled, DropdownItemNotFound, NoSuchElementException)
class HTMLDropdown(Widget):
"... |
izapolsk/test-task | lib/widgets/bootstrap_modal.py | from widgetastic.exceptions import NoSuchElementException
from widgetastic.widget import Text, View
from widgetastic_patternfly import Modal, Button
class BootstrapModal(Modal):
@property
def is_displayed(self):
""" Is the modal currently open? """
try:
return "show" in self.browse... |
izapolsk/test-task | lib/widgets/card.py | from widgetastic.utils import ParametrizedLocator
from widgetastic.widget.base import GenericLocatorWidget
from widgetastic.widget.base import View
from widgetastic_patternfly import Button
from wait_for import wait_for
class Card(View):
ROOT = ParametrizedLocator('//div[contains(@class, "card") and boolean(@data... |
izapolsk/test-task | lib/views/board.py | <reponame>izapolsk/test-task
from widgetastic.widget import TextInput, View, GenericLocatorWidget
from widgetastic.utils import WaitFillViewStrategy
from widgetastic_bootstrap.button import Button
from lib.views.base import BaseLoggedInView
from lib.widgets.card import Card
from lib.widgets.html_dropdown import HTMLDr... |
izapolsk/test-task | utils/log.py | import sys
from loguru import logger
logger.remove()
logger.add(sys.stderr, level="INFO")
|
izapolsk/test-task | lib/views/modals.py | from widgetastic.widget import View
from widgetastic_patternfly import Button
from lib.widgets.bootstrap_modal import BootstrapModal
class ConfirmModal(BootstrapModal):
@View.nested
class footer(View): # noqa
""" The footer of the modal """
ROOT = './/div[contains(@class, "modal-footer")]'
... |
izapolsk/test-task | utils/path.py | <reponame>izapolsk/test-task
import os
# todo: replace with getting path of installed module and entry points
repo_dir = os.path.realpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..'))
proj_dir = os.path.realpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
conf_dir = os.path.... |
izapolsk/test-task | tests/smoke_test.py | import pytest
from selenium.webdriver import Chrome, ChromeOptions
from wait_for import TimedOutError, wait_for
from widgetastic.browser import Browser
from lib.views.base import LoginView, BaseLoggedInView
from lib.views.board import CreateBoardView, MainBoardView
from lib.views.card import AddCardView
from lib.view... |
izapolsk/test-task | lib/widgets/account_dropdown.py | <filename>lib/widgets/account_dropdown.py
from widgetastic.widget import Widget
from widgetastic.utils import ParametrizedLocator
from widgetastic_bootstrap.dropdown import (Dropdown, DropdownItemDisabled, DropdownDisabled,
UnexpectedAlertPresentException)
class AccountDrop... |
izapolsk/test-task | lib/views/card.py | <reponame>izapolsk/test-task
from widgetastic.widget import TextInput, View
from widgetastic_bootstrap.button import Button
from lib.widgets.bootstrap_modal import BootstrapModal
from lib.widgets.html_dropdown import HTMLDropdown
class AddCardView(BootstrapModal):
@View.nested
class body(View): # noqa
... |
IntaSend/intasend-python | intasend/utils.py | from Crypto.PublicKey import RSA
import OpenSSL
from OpenSSL import crypto as OpenSSLCrypto
def generate_keys():
"""
Returns a private and public key.
Returns:
tupple: values of generated private and public key
"""
key = RSA.generate(2048)
private_key = key.export_key('PEM')
publi... |
IntaSend/intasend-python | intasend/exceptions.py | class IntaSendBadRequest(Exception):
pass
class IntaSendNotAllowed(Exception):
pass
class IntaSendUnauthorized(Exception):
pass
class IntaSendServerError(Exception):
pass
|
IntaSend/intasend-python | intasend/devices.py | from .client import APIBase
class Devices(APIBase):
def details(self, device_id):
return self.send_request("GET", f"r'account-devices'/{device_id}", None)
def retrieve(self, device_id=None):
if device_id:
return self.details(device_id)
return self.send_request("GET", "r'ac... |
IntaSend/intasend-python | intasend/wallets.py | <gh_stars>1-10
from .client import APIBase
from .collections import Collect
class Wallet(APIBase):
def __init__(self, **kwargs):
"""Wallets management service."""
self.collect = Collect(**kwargs)
super().__init__(**kwargs)
def details(self, wallet_id):
return self.send_request... |
IntaSend/intasend-python | intasend/client.py | <reponame>IntaSend/intasend-python<filename>intasend/client.py
import requests
from .exceptions import (IntaSendBadRequest, IntaSendNotAllowed,
IntaSendServerError, IntaSendUnauthorized)
def get_service_url(service_endpoint, test=False):
if test:
return f"https://sandbox.intasend... |
IntaSend/intasend-python | examples/services.py | import secrets
import os
from intasend import APIService
# from intasend.utils import generate_keys
TEST_PRIVATE_KEY = os.environ.get("TEST_PRIVATE_KEY")
TEST_PHONE_NUMBER = os.environ.get("TEST_PHONE_NUMBER")
TEST_API_TOKEN = os.environ.get("TEST_API_TOKEN")
TEST_PUBLISHABLE_KEY = os.environ.get("TEST_PUBLISHABLE_KEY... |
IntaSend/intasend-python | setup.py | from setuptools import setup
setup(
name='intasend-python',
packages=['intasend'],
version='1.0.1',
license='MIT',
description='Official Python SDK for IntaSend Payments Gateway API',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/IntaSend/intasend-python',
downloa... |
IntaSend/intasend-python | intasend/payment_links.py | <reponame>IntaSend/intasend-python
from .client import APIBase
class PaymentLinks(APIBase):
def details(self, link_id):
return self.send_request("GET", f"paymentlinks/{link_id}", None)
def create(self, title, currency, amount=0, mobile_tarrif="BUSINESS-PAYS", card_tarrif="BUSINESS-PAYS", is_active=Tr... |
IntaSend/intasend-python | intasend/customers.py | <filename>intasend/customers.py
from .client import APIBase
class Customers(APIBase):
def details(self, customer_id):
return self.send_request("GET", f"customers/{customer_id}", None)
def create(self, email, **kwargs):
payload = kwargs
payload["email"] = email
return self.send... |
IntaSend/intasend-python | intasend/transfers.py | <reponame>IntaSend/intasend-python<filename>intasend/transfers.py
from .client import APIBase
from .utils import sign_message
class Transfer(APIBase):
def send_money(self, device_id, provider, currency, transactions, callback_url=None):
payload = {
"device_id": device_id,
"provider... |
IntaSend/intasend-python | intasend/collections.py | <gh_stars>1-10
from .client import APIBase
class Collect(APIBase):
def checkout(self, email, amount, currency, **kwargs):
"""
Generates payment checkout URL
Args:
email (string): Customer email
amount (float): Total amount billed
currency (string): Curr... |
IntaSend/intasend-python | intasend/chargebacks.py | <reponame>IntaSend/intasend-python<filename>intasend/chargebacks.py<gh_stars>1-10
from .client import APIBase
class Chagebacks(APIBase):
def create(self, invoice, amount, reason, reason_details=None):
payload = {
"invoice": invoice,
"amount": amount,
"reason": reason,
... |
IntaSend/intasend-python | intasend/__init__.py | """IntaSend Payments API for Python 3."""
from .collections import Collect
from .transfers import Transfer
from .wallets import Wallet
from .chargebacks import Chagebacks
from .payment_links import PaymentLinks
from .devices import Devices
from .customers import Customers
class APIService:
def __init__(self, **kw... |
sgalpha01/biopython | Bio/Align/mauve.py | <reponame>sgalpha01/biopython<filename>Bio/Align/mauve.py
# Copyright 2015-2015 by <NAME>. All rights reserved.
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been inclu... |
sgalpha01/biopython | Tests/test_Align_bed.py | <reponame>sgalpha01/biopython<filename>Tests/test_Align_bed.py
# Copyright 2022 by <NAME>. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for Align.bed module."""
impor... |
sgalpha01/biopython | Bio/PDB/PDBIO.py | <reponame>sgalpha01/biopython<gh_stars>0
# Copyright (C) 2002, <NAME> (<EMAIL>)
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Output of PDB files."""
import warnings
# Exceptions and Warnings... |
sgalpha01/biopython | Tests/test_Align_msf.py | # Copyright 2021 by <NAME>. All rights reserved.
#
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for Bio.Align.msf module."""
import unittest
import warnings
from Bio import BiopythonPar... |
sgalpha01/biopython | Bio/Align/bed.py | # Copyright 2022 by <NAME>. All rights reserved.
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
"""Bio.Align support for BED (Br... |
sgalpha01/biopython | Tests/test_Align_clustal.py | <reponame>sgalpha01/biopython<gh_stars>0
# Copyright 2006-2014 by <NAME>. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for Bio.Align.clustal module."""
import unittes... |
sgalpha01/biopython | Tests/test_Align_phylip.py | <reponame>sgalpha01/biopython
# Copyright 2006-2014 by <NAME>. All rights reserved.
# Revisions copyright 2011 <NAME>. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests fo... |
sgalpha01/biopython | Tests/test_Align_mauve.py | # Copyright 2006-2014 by <NAME>. All rights reserved.
# Revisions copyright 2011 <NAME>. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for Bio.Align.mauve module."""
i... |
Unigmos/FamousWord | FamousWord.py | from selenium import webdriver
import time
import csv
#入力ファイルと出力ファイルの設定
input_path = 'input/input.txt'
output_path = 'output/output.txt'
csv_output_path = 'output/output.csv'
#ChromeDriverのパス指定
chrome_driver_path = 'chromedriver_win32/chromedriver.exe'
#入力ファイルの読み込み
with open(input_path, "r") as file:
... |
AzusaChino/iris-python | notifiers/wechat.py | <gh_stars>0
import notifiers
class Wechat(notifiers):
def __init__(self) -> None:
pass |
AzusaChino/iris-python | providers/__init__.py | class Provider(object):
base_url = None
def __init__(self, url: str) -> None:
self.base_url = url
def watch(self):
pass |
AzusaChino/iris-python | providers/taobao.py | from providers import Provider
class Taobao(Provider):
def __init__(self) -> None:
super().__init__()
def watch(self):
super().watch() |
AzusaChino/iris-python | notifiers/message.py | from notifiers import Notifier
class Message(Notifier):
def __init__(self) -> None:
pass |
AzusaChino/iris-python | providers/jd.py | <filename>providers/jd.py
from providers import Provider
class Jd(Provider):
def __init__(self) -> None:
pass |
AzusaChino/iris-python | app.py | import toml
class IrisWatcher:
config_file = "./app.toml"
def __init__(self):
parsed_config = toml.load(self.config_file)
self.frequency = parsed_config["config"]["frequency"]
def watch(self, product_name: str):
print(self.websites)
print(self.frequency)
if __name__ == ... |
AzusaChino/iris-python | notifiers/email.py | <reponame>AzusaChino/iris-python<gh_stars>0
from notifiers import Notifier
class Email(Notifier):
def __init__(self) -> None:
pass |
PacktPublishing/Real-time-Django | chapter-3/Rendering HTML/app/simple_app/views.py | from django.shortcuts import render
def index(request):
return render(request, 'index.html', {})
def bingo(request):
return render(request, 'bingo.html', {})
def bmi(request):
return render(request, 'bmi.html', {}) |
PacktPublishing/Real-time-Django | chapter-3/Sending JSON/app/simple_app/views.py | <filename>chapter-3/Sending JSON/app/simple_app/views.py<gh_stars>0
from django.shortcuts import render
def index(request):
return render(request, 'index.html', {})
def bingo(request):
return render(request, 'bingo.html', {}) |
PacktPublishing/Real-time-Django | chapter-4/social-network_step_6/app/website/models.py | from django.db import models
class Message(models.Model):
author = models.CharField(max_length=100)
text = models.TextField(max_length=200)
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
db_table = "messages"
verbose_name_plural = "Messages"
def __str__(self):
... |
PacktPublishing/Real-time-Django | chapter-6/app/app_template/backends.py | from django.contrib.auth.models import User
from django.contrib.auth.backends import BaseBackend
class EmailBackend(BaseBackend):
"""
Email authentication backend
"""
def authenticate(self, request, username=None, password=<PASSWORD>, **kwargs):
"""
Authenticate a user based on email ... |
PacktPublishing/Real-time-Django | chapter-7/app/website/views.py | <filename>chapter-7/app/website/views.py
from django.shortcuts import render
from .forms import CommentForm
from django.contrib.auth.decorators import login_required
def all_posts(request):
return render(
request,
"base.html",
{
"page": "pages/list_posts.html",
"act... |
PacktPublishing/Real-time-Django | chapter-3/Rendering HTML/app/simple_app/consumers.py | <filename>chapter-3/Rendering HTML/app/simple_app/consumers.py
# app/simple_app/consumers.py
from channels.generic.websocket import WebsocketConsumer
from datetime import datetime
import time
import threading
from random import randint
from channels.generic.websocket import JsonWebsocketConsumer
from django.template.lo... |
PacktPublishing/Real-time-Django | chapter-6/project_template/asgi.py | <gh_stars>0
# project_template/asgi.py
import os
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_template.settings")
from django.conf import settings
django.setup()
from django.core.asgi import get_asgi_application
from channels.security.websocket import OriginValidator
from channels.auth import... |
PacktPublishing/Real-time-Django | chapter-7/make_fake_data.py | <filename>chapter-7/make_fake_data.py<gh_stars>0
# ./manage.py shell < make_fake_data.py
from app.website.models import Post, Comment
from faker import Faker
# Delete all posts and comments
Post.objects.all().delete()
# Create fake object
fake = Faker()
# Create 30 posts
for _ in range(30):
post = Post(
... |
PacktPublishing/Real-time-Django | chapter-6/app/app_template/views.py | <reponame>PacktPublishing/Real-time-Django
from django.shortcuts import render
from .forms import LoginForm, SignupForm
from django.contrib.auth.decorators import login_required
def home(request):
return render(
request,
"base.html",
{
"page": "pages/home.html",
"ac... |
PacktPublishing/Real-time-Django | chapter-4/social-network_step_6/social_network/settings.py | """
Django settings for social_network project.
Generated by 'django-admin startproject' using Django 4.0.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import o... |
PacktPublishing/Real-time-Django | chapter-7/blog/urls.py | <gh_stars>0
from django.contrib import admin
from django.urls import path
from app.website import views
urlpatterns = [
path("", views.all_posts, name="all_posts"),
path("article/<slug:slug>/", views.single, name="single"),
path("about/", views.about, name="about"),
path("admin/", admin.site.urls),
]
... |
PacktPublishing/Real-time-Django | chapter-4/initial-template/app/app_template/consumers.py | # app/app_template/consumers.py
from channels.generic.websocket import JsonWebsocketConsumer
from django.template.loader import render_to_string
from asgiref.sync import async_to_sync
class ExampleConsumer(JsonWebsocketConsumer):
room_name = 'broadcast'
def connect(self):
"""Event when client connec... |
PacktPublishing/Real-time-Django | chapter-7/app/website/consumers.py | # app/website/consumers.py
from channels.generic.websocket import JsonWebsocketConsumer
import app.website.actions as actions
class ExampleConsumer(JsonWebsocketConsumer):
def connect(self):
"""Event when client connects"""
# Accept the connection
self.accept()
# Make session task... |
PacktPublishing/Real-time-Django | chapter-6/app/app_template/actions.py | from .forms import LoginForm, SignupForm
from asgiref.sync import async_to_sync
from django.template.loader import render_to_string
from django.urls import reverse
from channels.auth import login, logout
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from datetime import dateti... |
PacktPublishing/Real-time-Django | chapter-5/app/chat/views.py | <gh_stars>0
from django.shortcuts import render
from django.contrib.auth.models import User
def index(request):
"""View with chat layout"""
return render(
request, "index.html", {"users": User.objects.all().order_by("username")}
)
|
PacktPublishing/Real-time-Django | chapter-3/Sending plain text/hello_world/asgi.py | <gh_stars>0
# hello_world/asgi.py
import os
from django.core.asgi import get_asgi_application
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from django.urls import re_path
from app.simple_app.consumers import EchoConsumer
os.environ.setdefault('DJANGO_SETTINGS... |
PacktPublishing/Real-time-Django | chapter-7/app/website/actions.py | from .models import Post, Comment
from .forms import CommentForm
from django.template.loader import render_to_string
from django.urls import reverse
POST_PER_PAGE = 5
def send_page(self, data={}):
"""Render HTML and send page to client"""
# Prepare context data for page
page = data["page"]
context = ... |
PacktPublishing/Real-time-Django | chapter-6/app/app_template/forms.py | from django import forms
class LoginForm(forms.Form):
email = forms.CharField(
label="Email",
max_length=255,
widget=forms.EmailInput(attrs={"id": "login-email", "class": "input"}),
)
password = forms.CharField(
label="Password",
max_length=255,
widget=forms... |
PacktPublishing/Real-time-Django | chapter-5/app/chat/consumers.py | <reponame>PacktPublishing/Real-time-Django
# app/chat/consumers.py
from channels.generic.websocket import JsonWebsocketConsumer
from django.template.loader import render_to_string
from asgiref.sync import async_to_sync
from channels.auth import login, logout
from django.contrib.auth.models import User
from .models impo... |
PacktPublishing/Real-time-Django | chapter-5/project_template/asgi.py | <reponame>PacktPublishing/Real-time-Django<filename>chapter-5/project_template/asgi.py
# project_template/asgi.py
import os
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_template.settings")
django.setup()
from django.core.asgi import get_asgi_application
from channels.auth import AuthMiddlewa... |
PacktPublishing/Real-time-Django | chapter-4/social-network_step_6/social_network/asgi.py | # social_network/asgi.py
import os
import django
from django.core.asgi import get_asgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "social_network.settings")
django.setup()
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from django.urls import ... |
PacktPublishing/Real-time-Django | chapter-4/social-network_step_1/app/website/consumers.py | # app/website/consumers.py
from channels.generic.websocket import JsonWebsocketConsumer
from django.template.loader import render_to_string
from .models import Message
from asgiref.sync import async_to_sync
class SocialNetworkConsumer(JsonWebsocketConsumer):
room_name = 'broadcast'
def connect(self):
... |
PacktPublishing/Real-time-Django | chapter-3/Sending plain text/app/simple_app/consumers.py | <filename>chapter-3/Sending plain text/app/simple_app/consumers.py
# app/simple_app/consumers.py
from channels.generic.websocket import WebsocketConsumer
from datetime import datetime
import time
import threading
class EchoConsumer(WebsocketConsumer):
def connect(self):
"""Event when client connects"""
... |
PacktPublishing/Real-time-Django | chapter-3/Sending JSON/app/simple_app/consumers.py | # app/simple_app/consumers.py
from channels.generic.websocket import WebsocketConsumer
from datetime import datetime
import time
import threading
from random import randint
from channels.generic.websocket import JsonWebsocketConsumer
class EchoConsumer(WebsocketConsumer):
def connect(self):
"""Event when ... |
PacktPublishing/Real-time-Django | chapter-5/make_fake_users.py | # ./manage.py shell < make_fake_users.py
from django.contrib.auth.models import User
from faker import Faker
fake = Faker()
# Delete all users
User.objects.all().delete()
# Generate 30 random emails and iterate them.
for email in [fake.unique.email() for i in range(5)]:
# Create user in database
user = User.... |
PacktPublishing/Real-time-Django | chapter-7/app/website/models.py | <reponame>PacktPublishing/Real-time-Django<gh_stars>0
from django.db import models
# https://github.com/tanrax/demo-HTML-over-WebSockets-in-Django
class Post(models.Model):
title = models.CharField(max_length=200, unique=True)
author = models.CharField(max_length=20)
content = models.TextField()
creat... |
PacktPublishing/Real-time-Django | chapter-5/app/chat/models.py | <reponame>PacktPublishing/Real-time-Django
from django.db import models
from django.contrib.auth.models import User
class Client(models.Model):
"""
Clients for users
"""
user = models.ForeignKey(User, on_delete=models.CASCADE)
channel = models.CharField(max_length=200, blank=True, null=True, defa... |
korda/gitlab-client | gitlab_api_client.py | import json
import urllib.parse
import urllib.request
import urllib.error
class GitlabApi:
def __init__(self, url: str, token: str, checkout_url: str):
self.__url = url
self.__token = token
self.__checkout_url = checkout_url
self.__api_root = '/api/v4'
def repo_url(self, path:... |
korda/gitlab-client | open_project.py | <filename>open_project.py
import argparse
from os.path import isdir
from pathlib import Path
from subprocess import check_call
from curses_select import select_option
from gitlab_api_client import GitlabApi
from user_config import get_gitlab_api_client
from user_config import get_project_dir_location
def open_projec... |
korda/gitlab-client | user_config.py | import json
from os.path import isdir
from os import mkdir
from pathlib import Path
from gitlab_api_client import GitlabApi
config_location = Path.home() / ".gitlab-client.json"
def get_gitlab_api_client(gitlab_instance) -> GitlabApi:
config = __get_gitlab_instance_config(gitlab_instance)
return GitlabApi(c... |
korda/gitlab-client | create_project.py | import argparse
from gitlab_api_client import GitlabApi
from user_config import get_gitlab_api_client
from subprocess import check_call
def create_project_action(main_args, progname: str):
gitlab_instance = main_args.gitlab_instance
create_project_parser = argparse.ArgumentParser(description='Create new pro... |
korda/gitlab-client | __main__.py | <reponame>korda/gitlab-client
import argparse
from open_project import open_project_action
from create_project import create_project_action
from user_config import config_location
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Gitlab client.')
parser.add_argument('gitlab_instance', h... |
korda/gitlab-client | curses_select.py | <filename>curses_select.py
import time
import math
import string
from curses import wrapper
import curses
def select_option(options_list):
return wrapper(_select_option, options_list)
def _select_option(stdscr, options_list):
stdscr.clear()
select_size = 50
size_of_room_above_search = 2
selecte... |
dacosta2213/acuaponia | acuaponia/api.py | <filename>acuaponia/api.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import frappe
from frappe import _
import frappe.utils
import frappe.async
import frappe.sessions
import frappe.utils.file_manager
import frappe.desk.form.run_method
from frappe.utils.response import build_response
import datetim... |
dacosta2213/acuaponia | acuaponia/acuaponia/doctype/dash_acuaponia/dash_acuaponia.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class DashAcuaponia(Document):
pass
@frappe.whitelist(allow_guest=True)
def datos(contenedor):
ite... |
marl/jams | setup.py | <reponame>marl/jams
from setuptools import setup, find_packages
import imp
version = imp.load_source('jams.version', 'jams/version.py')
setup(
name='jams',
version=version.version,
description='A JSON Annotated Music Specification for Reproducible MIR Research',
author='<NAME>',
url='http://githu... |
rohit-k-das/proofpoint-emailbypass-catcher | main.py | import proofpointTAP.proofpointTAP as proofpointTAP
import mailApp.MicrosoftOutlookMail as MicrosoftOutlookMail
import mailApp.Gmail as Gmail
import mailApp.Directory as directory_api
import logging
import datetime
import argparse
import requests
import os
import json
import urllib.parse
import ConfigParser
active_use... |
rohit-k-das/proofpoint-emailbypass-catcher | mailApp/Gmail.py | import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import mailApp.Directory as directory_api
import datetime
import json
import logging
import time
import concurrent.futures
import jwt
import re
import ConfigParser
import os
logger = logging.getLogger(__nam... |
rohit-k-das/proofpoint-emailbypass-catcher | proofpointTAP/proofpointTAP.py | import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import datetime
import logging
import ConfigParser
import os
from base64 import b64encode
logger = logging.getLogger(__name__)
Config = ConfigParser.ConfigParser()
Config.read(os.path.join(os.path.abspath(... |
rohit-k-das/proofpoint-emailbypass-catcher | mailApp/Directory.py | import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import concurrent.futures
import json
import logging
import time
import jwt
import ConfigParser
import os
MAX_THREADS = 14 # Get max number of threads for multi-threading
logger = logging.getLogger(__nam... |
Antidote/dawn-cmake | third_party/vulkan-deps/update-commit-message.py | #!/usr/bin/env python3
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# based on an almost identical script by: <EMAIL> (<NAME>)
"""Updates the commit message used in the auto-roller.
Merges several small... |
Antidote/dawn-cmake | scripts/extract.py | # Copyright (c) 2015, Google Inc.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WA... |
Antidote/dawn-cmake | generator/generator_lib.py | #!/usr/bin/env python3
# Copyright 2019 The Dawn Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
Antidote/dawn-cmake | third_party/tint/fuzzers/generate_wgsl_corpus.py | <filename>third_party/tint/fuzzers/generate_wgsl_corpus.py
#!/usr/bin/env python3
# Copyright 2021 The Tint Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache... |
uk-gov-mirror/metomi.fab | source/fab/builder.py | ##############################################################################
# (c) Crown copyright Met Office. All rights reserved.
# For further details please refer to the file COPYRIGHT
# which you should have received as part of this distribution
###################################################################... |
uk-gov-mirror/metomi.fab | source/fab/dumper.py | <reponame>uk-gov-mirror/metomi.fab
##############################################################################
# (c) Crown copyright Met Office. All rights reserved.
# For further details please refer to the file COPYRIGHT
# which you should have received as part of this distribution
################################... |
uk-gov-mirror/metomi.fab | source/fab/tasks/common.py | <reponame>uk-gov-mirror/metomi.fab<filename>source/fab/tasks/common.py
# (c) Crown copyright Met Office. All rights reserved.
# For further details please refer to the file COPYRIGHT
# which you should have received as part of this distribution
import re
import subprocess
from typing import List, Optional, Match
from ... |
uk-gov-mirror/metomi.fab | source/fab/tasks/c.py | # (c) Crown copyright Met Office. All rights reserved.
# For further details please refer to the file COPYRIGHT
# which you should have received as part of this distribution
"""
C language handling classes.
"""
import subprocess
import re
import clang.cindex # type: ignore
from collections import deque
from typing imp... |
uk-gov-mirror/metomi.fab | source/fab/tasks/fortran.py | <reponame>uk-gov-mirror/metomi.fab
# (c) Crown copyright Met Office. All rights reserved.
# For further details please refer to the file COPYRIGHT
# which you should have received as part of this distribution
"""
Fortran language handling classes.
"""
import logging
from pathlib import Path
import re
import subprocess
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.