repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
alexmitchell/file_manipulations | data_wrangling/legacy_code/omnipickle_manager.py | <filename>data_wrangling/legacy_code/omnipickle_manager.py
#!/usr/bin/env python3
import os
from helpyr.data_loading import DataLoader
from tokens import PeriodData, Experiment
import global_settings as settings
# This class is meant to manage the creation and updating of the omnipickle.
# The omnipickle contains... |
alexmitchell/file_manipulations | data_wrangling/__init__.py | <gh_stars>0
#!/usr/bin/env python3
from .data_collectors import (
DataCollectorBase,
LightTableCollector,
)
__all__ = [
"DataCollectorBase",
"LightTableCollector",
]
|
alexmitchell/file_manipulations | data_wrangling/legacy_code/gsd_processor.py | <gh_stars>0
#!/usr/bin/env python3
import os
import numpy as np
import pandas as pd
from time import asctime
from omnipickle_manager import OmnipickleManager
import global_settings as settings
from helpyr import data_loading
from helpyr import logger
#from helpyr import crawler
from helpyr import helpyr_misc as hm
... |
alexmitchell/file_manipulations | data_wrangling/legacy_code/frame_times_crawler.py | <gh_stars>0
import os
import numpy as np
from pathlib import Path
# From Helpyr
import data_loading
from helpyr_misc import nsplit
from helpyr_misc import ensure_dir_exists
from logger import Logger
from crawler import Crawler
class FrameTimesCrawler (Crawler):
# The FrameTimesCrawler navigates through the bac... |
janaSunrise/Spotify-Twitter-Banner | app/api/spotify.py | <reponame>janaSunrise/Spotify-Twitter-Banner
import base64
import json
import sys
import time
import typing as t
import requests
from loguru import logger
from .route import Route
from ..config import Config
from ..utils import generate_oauth_url
PYTHON_VERSION = f"{sys.version_info.major}.{sys.version_info.minor}.{... |
janaSunrise/Spotify-Twitter-Banner | app/image/generate.py | <gh_stars>10-100
import typing as t
from PIL import Image, ImageDraw, ImageFont
from ..config import Fonts
from ..models.song import Song
def truncate_text(text: str, font: ImageFont.FreeTypeFont, max_width: int) -> str:
if font.getsize(text)[0] <= max_width:
return text.strip()
while font.getsize(... |
janaSunrise/Spotify-Twitter-Banner | scripts/generate_refresh_token.py | <reponame>janaSunrise/Spotify-Twitter-Banner<filename>scripts/generate_refresh_token.py
import base64
import typing as t
import requests
from app.config import Config
from app.utils import generate_oauth_url
def get_refresh_token(code: str) -> t.Dict[str, t.Any]:
token = base64.b64encode(f"{Config.SPOTIFY_CLIEN... |
janaSunrise/Spotify-Twitter-Banner | scripts/update_banner.py | import random
from app import spotify, twitter
from app.config import Config
from app.image.generate import generate_image
from app.twitter import update_twitter_banner
from app.utils import get_song_info
# Get top tracks.
top_tracks = spotify.top_tracks(limit=5)
top_tracks = [track for track in top_tracks["items"]]... |
janaSunrise/Spotify-Twitter-Banner | app/__init__.py | <filename>app/__init__.py
import json
import os
import sys
import tweepy
from loguru import logger
from .api.spotify import Spotify
from .config import Config, LoggerConfig
# Configure logging
logger.configure(
handlers=[
dict(
sink=sys.stdout,
format=LoggerConfig.LOG_FORMAT,
... |
janaSunrise/Spotify-Twitter-Banner | app/twitter.py | import tweepy
from .config import Config
def update_twitter_banner(api: tweepy.API) -> None:
"""Update the twitter banner of the current profile using the image specified in config."""
api.update_profile_banner(Config.IMAGE_PATH)
|
janaSunrise/Spotify-Twitter-Banner | app/config.py | import os
from decouple import config
class Config:
# Debug mode.
DEBUG = config("DEBUG", default=False, cast=bool)
# Update interval (in minutes).
UPDATE_INTERVAL = config("UPDATE_INTERVAL", default=5, cast=int)
# Spotify refresh token for headless environments.
SPOTIFY_REFRESH_TOKEN = con... |
janaSunrise/Spotify-Twitter-Banner | app/utils.py | import random
import typing as t
from .models.song import Song
if t.TYPE_CHECKING:
from .api.spotify import Spotify
# Generate the OAuth2 URL for spotify
def generate_oauth_url(client_id: str, redirect_uri: str, scopes: list) -> str:
return f"https://accounts.spotify.com/authorize?client_id={client_id}&resp... |
janaSunrise/Spotify-Twitter-Banner | app/__main__.py | <filename>app/__main__.py
import random
import time
from loguru import logger
from . import spotify, twitter
from .config import Config
from .image.generate import generate_image
from .twitter import update_twitter_banner
from .utils import get_song_info
while True:
# Get top tracks.
top_tracks = spotify.top... |
janaSunrise/Spotify-Twitter-Banner | app/models/song.py | <reponame>janaSunrise/Spotify-Twitter-Banner<gh_stars>10-100
import typing as t
from dataclasses import dataclass, field
from io import BytesIO
import requests
from PIL import Image
@dataclass
class Song:
name: str
artist: str
album: str
is_explicit: bool
currently_playing_type: t.Literal["trac... |
janaSunrise/Spotify-Twitter-Banner | scripts/generate_image.py | import random
from app import spotify
from app.config import Config
from app.image.generate import generate_image
from app.utils import get_song_info
# Get top tracks.
top_tracks = spotify.top_tracks(limit=5)
top_tracks = [track for track in top_tracks["items"]]
# Get song info with switch to recently played if no ... |
janaSunrise/Spotify-Twitter-Banner | app/api/route.py | <reponame>janaSunrise/Spotify-Twitter-Banner
class Route:
BASE_URL = "https://api.spotify.com/v1"
def __init__(self, method: str, path: str) -> None:
self.method = method
self.path = path
# Properties
@property
def base_url(self) -> str:
return self.BASE_URL
@base_url.... |
ericchen12377/BRDT-Python | brdt/Optimal.py | <reponame>ericchen12377/BRDT-Python<gh_stars>1-10
import Risk
import Cost
import numpy as np
class Optimal:
def __init__(self, name, pi):
''' Constructor for this class. '''
# assign the name of distribution
self.name = name
self.pi = pi
def Optimal_Sample_Size(self, c,... |
ericchen12377/BRDT-Python | brdt/Cost.py | import numpy as np
import Risk
from scipy.stats import binom
class Cost:
def __init__(self, name, n, c, pi, R):
''' Constructor for this class. '''
# assign the name of distribution
self.name = name
self.n = n
self.c = c
self.pi = pi
self.R = R
... |
ericchen12377/BRDT-Python | brdt/app.py | import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.express as px
import pandas as pd
import Prior
import Data
pi = Prior.Prior(name = 'Beta', size = 1000, par = [1, 1], random_state = 1234).Prior_MCsim()
p = Data.Data(name = 'B... |
ericchen12377/BRDT-Python | brdt/Prior.py | from scipy.stats import beta
class Prior:
def __init__(self, name, size, par, random_state):
''' Constructor for this class. '''
"""
:type name: str
:type size: int
:type par: list
:rtype: list
"""
self.name = name # assign the name... |
ericchen12377/BRDT-Python | brdt/Indicator.py | import numpy as np
class Indicator:
def __init__(self, name):
''' Constructor for this class. '''
"""
:type name: str
:rtype: int
"""
self.name = name # assign the name of distribution
def Binary_Indicator(self, prob, R):
"""
:type pi: float
... |
ericchen12377/BRDT-Python | brdt/Risk.py | <reponame>ericchen12377/BRDT-Python
import numpy as np
from scipy.stats import binom
import Indicator as Indicator
class Risk:
def __init__(self, name, n, c, pi, R):
''' Constructor for this class. '''
self.name = name # assign the name of distribution
self.n = n
self.c = c
... |
ericchen12377/BRDT-Python | brdt/Data.py | <reponame>ericchen12377/BRDT-Python<gh_stars>1-10
import Risk
import Cost
import Optimal
import numpy as np
import pandas as pd
class Data:
def __init__(self, name, pi, cost_fix, cost_var, sales_volume, cost_warranty, cost_reliability_growth):
''' Constructor for this class. '''
# assign the name of... |
naomifox-invitae/hgvs | tests/test_hgvs_extras_babelfish.py | def test_hgvs_to_vcf(parser, babelfish38):
"""
49949___ 400 410 420
|123456789|123456789|
NC_000006.12 GACCAGAAAGAAAAATAAAAC
"""
def _h2v (h):
return babelfish38.hgvs_to_vcf(parser.parse(h))
# no-op
assert _h2v("NC_000006.12:g.49949407=") == N... |
aepks/coffee-is-a-core-value | rpi_python/database.py | from sqlalchemy import Column, Integer, String, Boolean, DateTime, Float, desc
from sqlalchemy import create_engine, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy.sql import func
from datetime import datetime
from mail import Sen... |
aepks/coffee-is-a-core-value | sqlalchemy_cheat_sheet.py | from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from datetime import datetime
# Connecting to the engine with PostgreSQL (make sure psycopg2 is installed!):
engine = create_engine('postgresql://user:password@server_ip/databa... |
aepks/coffee-is-a-core-value | rpi_python/gpio_interface.py | <gh_stars>1-10
from gpiozero import LED, Button
# import adafruit_character_lcd.character_lcd as characterlcd
import board
import time
import digitalio
#
# lcd_columns = 16
# lcd_rows = 2
#
b1 = Button(18)
l1 = LED(23)
b2 = Button(24)
l2 = LED(25)
b3 = Button(8)
l3 = LED(7)
button_led = {b1: l1, b2: l2, b3: l3}
butt... |
aepks/coffee-is-a-core-value | rpi_python/management.py | <filename>rpi_python/management.py
import database
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from datetime import datetime
# Config:
server = 'localhost'
def logon():
username = input("Enter your username: \n> ")
password = input("Enter your password: \n> ")
try:
... |
aepks/coffee-is-a-core-value | rpi_python/rfid-poc/rfid_led.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import signal
import argparse
import traceback
import time
import http.client
import requests
import json
import ConfigParser
from evdev import InputDevice, list_devices, categorize, ecodes
SCANCODES = {
# Scancode: ASCIICode
0: None, 1: u'ESC', 2: u'1'... |
aepks/coffee-is-a-core-value | rpi_python/program.py | from database import invoice_users, rfid_return_user, fingerprint_return_user
from gpio_interface import display, button_press, activate_led, deactivate_led
from gpio_interface import b1, b2, b3, flash_led
import time
import datetime
while True:
c_time = datetime.now()
if c_time.hours == 23:
invoice_us... |
Phlya/C-TALE-Normalization | ctale_normalize/__init__.py | from .C_TALE_normalize import *
|
Phlya/C-TALE-Normalization | setup.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
import re
VERSIONFILE="ctale_normalize/_version.py"
verstrlin... |
dharmaxbum1/net-analysis | netanalysis/dns/model.py | # Copyright 2018 Jigsaw Operations LLC
#
# 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 law or agreed to i... |
dharmaxbum1/net-analysis | netanalysis/ip/ip_info.py | #!/usr/bin/python
#
# Copyright 2018 Jigsaw Operations LLC
#
# 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 applicabl... |
dharmaxbum1/net-analysis | netanalysis/ip/simple_autonomous_system_test.py | <reponame>dharmaxbum1/net-analysis
#!/usr/bin/python
#
# Copyright 2017 Jigsaw Operations LLC
#
# 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... |
dharmaxbum1/net-analysis | netanalysis/infrastructure/resources.py | <gh_stars>1-10
#!/usr/bin/python
#
# Copyright 2018 Jigsaw Operations LLC
#
# 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 requir... |
dharmaxbum1/net-analysis | netanalysis/analysis/analysis_app.py | #!/usr/bin/python
#
# Copyright 2018 Jigsaw Operations LLC
#
# 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 applicabl... |
dharmaxbum1/net-analysis | netanalysis/ooni/measurements_to_dns_records.py | <filename>netanalysis/ooni/measurements_to_dns_records.py
#!/usr/bin/python
#
# Copyright 2018 Jigsaw Operations LLC
#
# 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... |
dharmaxbum1/net-analysis | netanalysis/ooni/ooni_client.py | # Copyright 2018 Jigsaw Operations LLC
#
# 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 law or agreed to i... |
dharmaxbum1/net-analysis | netanalysis/dns/serialization.py | # Copyright 2018 Jigsaw Operations LLC
#
# 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 law or agreed to i... |
dharmaxbum1/net-analysis | netanalysis/analysis/ip_info_widget.py | <reponame>dharmaxbum1/net-analysis
#!/usr/bin/python
#
# Copyright 2018 Jigsaw Operations LLC
#
# 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... |
dharmaxbum1/net-analysis | netanalysis/ooni/fetch_measurements.py | <filename>netanalysis/ooni/fetch_measurements.py<gh_stars>1-10
#!/usr/bin/python
#
# Copyright 2018 Jigsaw Operations LLC
#
# 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.a... |
dharmaxbum1/net-analysis | netanalysis/analysis/analyze_domain.py | #!/usr/bin/python
#
# Copyright 2018 Jigsaw Operations LLC
#
# 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 applicabl... |
CYRO4S/Gekko | gekko/gekko.py | #!/usr/bin/env python3
import os
import re
import pysftp
import paramiko
import argparse
import getpass
import yaml
import warnings
import random
import configparser
__VERSION__ = "1.0.0"
warnings.filterwarnings("ignore")
def bootstrapper():
parser = argparse.ArgumentParser(description='Gekko - Makes SFTP sync... |
CYRO4S/Gekko | gekko/__init__.py | <reponame>CYRO4S/Gekko
from .gekko import bootstrapper |
raspitv/raspitweets | twitterwin.py | #!/usr/bin/env python2.7
# twitterwin.py by <NAME> http://raspi.tv/?p=5281
import tweepy
import random
# Consumer keys and access tokens, used for OAuth
consumer_key = 'copy your consumer key here'
consumer_secret = 'copy your consumer secret here'
access_token = 'copy your access token here'
access_token_secret = 'co... |
raspitv/raspitweets | tweet2.py | #!/usr/bin/env python2.7
# tweet2.py by <NAME> http://raspi.tv/?p=5941
import tweepy
import sys
import os
from datetime import datetime
i = datetime.now()
degree = unichr(176) # code for degree symbol
# Consumer keys and access tokens, used for OAuth
consumer_key = 'type in your consumer key here'
consumer_s... |
raspitv/raspitweets | tweetpic6BLOG.py | #!/usr/bin/env python2.7
# tweetpic6BLOG.py by <NAME> http://raspi.tv/?p=6004
# take a photo with the Pi camera, overlay some text
# then overlay a small logo and tweet the final image
import tweepy
from time import sleep
from subprocess import call
from datetime import datetime
import sys
if len(sys.argv) >= 2:
t... |
raspitv/raspitweets | tweetpic.py | <reponame>raspitv/raspitweets
#!/usr/bin/env python2.7
# tweetpic.py take a photo with the Pi camera and tweet it
# by <NAME> http://raspi.tv/?p=5918
import tweepy
from subprocess import call
from datetime import datetime
i = datetime.now() #take time and date for filename
now = i.strftime('%Y%m%d-%H%M%... |
raspitv/raspitweets | tweet.py | <reponame>raspitv/raspitweets
#!/usr/bin/env python2.7
# tweet.py by <NAME> http://raspi.tv/?p=5908
import tweepy
import sys
# Consumer keys and access tokens, used for OAuth
consumer_key = 'type in your consumer key here'
consumer_secret = 'type in your consumer secret here'
access_token = 'type in your access toke... |
SemanticLab/data-2-wikibase | add_items.py | import wikidataintegrator as WI
import requests, csv, sys, re
"""
NOTES:
The wikidataintegrator module was built to do a sepcific task, to populate
wikdiata with Genes, Proteins, Diseases, Drugs and other domain specific stuff
so we need to overwrite a few pieces of it in order to make it work for ou... |
zeeshanahmad10809/sst-deep-tensorflow | sst/dataset.py | <reponame>zeeshanahmad10809/sst-deep-tensorflow
import pytreebank
from sst.tokenizer import SSTTokenizer
import os
from loguru import logger
from tensorflow.keras.utils import to_categorical
from sst.preprocessing import preprocess_sst
from sst.utils import get_binary_label
class SSTContainer:
def __init__(self, ... |
zeeshanahmad10809/sst-deep-tensorflow | training.py | <reponame>zeeshanahmad10809/sst-deep-tensorflow
import tensorflow as tf
from sst.model import buildModel
from sst.dataset import SSTContainer
import numpy as np
from loguru import logger
import os
from tensorflow.keras.optimizers import Adam, Adagrad, SGD, RMSprop, Adadelta
from tqdm import tqdm
from time import time
f... |
zeeshanahmad10809/sst-deep-tensorflow | sst/utils.py | import numpy as np
from loguru import logger
from tqdm import tqdm
import os
def get_binary_label(sentiment):
if sentiment <= 1:
return 0
else:
return 1
def loadFastTextModel(path=""):
logger.info("Loading FastText Model!")
embeddings_index = dict()
try:
with open(path, ... |
zeeshanahmad10809/sst-deep-tensorflow | utils.py | <reponame>zeeshanahmad10809/sst-deep-tensorflow<gh_stars>1-10
from os.path import join
from os import path
import os
from loguru import logger
import shutil
import tensorflow as tf
def setup_tensorboard_dirs(model_name=""):
if not path.exists(join(os.getcwd(), "tensorboard_logs/{}".format(model_name))):
t... |
zeeshanahmad10809/sst-deep-tensorflow | sst/model.py | <filename>sst/model.py
from sst.utils import loadFastTextModel, buildEmbeddingMatrix
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Embedding, LSTM, BatchNormalization, Dense, Dropout
from tensorflow.keras.layers import (
GRU,
Bidirectional,
SimpleRNN,
Conv1D,
Glo... |
zeeshanahmad10809/sst-deep-tensorflow | inference.py | <filename>inference.py
from sst.tokenizer import SSTTokenizer
from utils import load_saved_model
import click
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
@click.command(context_settings=CONTEXT_SETTINGS)
@click.option("-r", "--root", is_flag=True, help="SST root or all")
@click.option("-b", "--binar... |
zeeshanahmad10809/sst-deep-tensorflow | tensorboardwriter.py | <reponame>zeeshanahmad10809/sst-deep-tensorflow
import tensorflow as tf
def tensorboard_write_metrics(summary_writer, metric, epoch):
with summary_writer.as_default():
tf.summary.scalar(metric.name, metric.result(), step=epoch)
summary_writer.flush()
def tensorboard_write_prf(summary_writer, nam... |
zeeshanahmad10809/sst-deep-tensorflow | testing.py | <gh_stars>1-10
from utils import load_saved_model
from sst.dataset import SSTContainer
import numpy as np
from sklearn.metrics import (
precision_score,
recall_score,
f1_score,
confusion_matrix,
accuracy_score,
)
from loguru import logger
def test(root, binary, filename=""):
model = load_saved... |
zeeshanahmad10809/sst-deep-tensorflow | run.py | <filename>run.py
from sst.dataset import SSTContainer
from sst.model import buildModel
from training import train
import numpy as np
import os
import click
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
@click.command(context_settings=CONTEXT_SETTINGS)
@click.option("-n", "--name", default="lstm", help=... |
zeeshanahmad10809/sst-deep-tensorflow | sst/__init__.py | <filename>sst/__init__.py
from .dataset import SSTContainer
from .model import buildModel
|
zeeshanahmad10809/sst-deep-tensorflow | sst/tokenizer.py | from tensorflow.keras.preprocessing import sequence
from tensorflow.keras.preprocessing.text import Tokenizer
from loguru import logger
from nltk.stem import WordNetLemmatizer
lemmatizer = WordNetLemmatizer()
class SSTTokenizer:
def __init__(self, corpus):
logger.info("Preparing SST Tokenizer")
s... |
Kentaro1043/timer.py | main.py | import time
import math
import kivy
kivy.require('2.0.0')
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import StringProperty
from kivy.clock import Clock
from kivy.core.audio import SoundLoader
hour = 0
minute = 0
second = 0
class TextWidget(Widget):
text = StringProperty()
... |
FreyGod/AirForce | LineDetect_longest_distance.py | <reponame>FreyGod/AirForce
import numpy as np
import cv2
import annotation as atn
import matplotlib.pyplot as plt
import math
import sys
import random
def intercept(a):
if(float(a[2])-float(a[0])==0):
return 9999999
slope = (float(a[3])-float(a[1]))/(float(a[2])-float(a[0]))
return -slope*float(a[0]) + float(a[... |
FreyGod/AirForce | annotation.py | <filename>annotation.py<gh_stars>0
import tensorflow as tf
import numpy as np
import PIL.Image as Image
from skimage import io, transform
import TensorflowUtils as utils
import scipy.misc as misc
import matplotlib.pyplot as plt
def FCN(jpg_path, pb_file_path = "pb/FCN.pb"):
with tf.Graph().as_default():
... |
jubalh/poezio | plugins/server_part.py | <filename>plugins/server_part.py
"""
This plugin adds a ``/server_part`` command to leave all rooms
on a server.
Command
-------
.. glossary::
/server_part
**Usage:** ``/server_part [<server> [message]]``
Leave all rooms on ``<server>``, if not provided and the current
tab is a chatroom ... |
jubalh/poezio | poezio/windows/info_bar.py | <gh_stars>10-100
"""
Module defining the global info bar
This window is the one listing the current opened tabs in poezio.
The GlobalInfoBar can be either horizontal or vertical
(VerticalGlobalInfoBar).
"""
import curses
import itertools
import logging
from typing import List, Optional
from poezio.config import conf... |
jubalh/poezio | poezio/ui/types.py | from __future__ import annotations
from datetime import datetime
from math import ceil, log10
from typing import Optional, Tuple, Dict, Any, Callable
from slixmpp import JID
from poezio import poopt
from poezio.theming import dump_tuple, get_theme
from poezio.ui.funcs import truncate_nick
from poezio.user import Use... |
jubalh/poezio | poezio/windows/text_win.py | """
TextWin, the window showing the text messages and info messages in poezio.
Can be locked, scrolled, has a separator, etc…
"""
import logging
from typing import Optional, List, Union
from poezio.windows.base_wins import Win
from poezio.text_buffer import TextBuffer
from poezio.config import config
from poezio.the... |
jubalh/poezio | plugins/qr.py | <reponame>jubalh/poezio<filename>plugins/qr.py
#!/usr/bin/env python3
import io
import logging
import qrcode
from typing import Dict, Callable
from slixmpp import JID, InvalidJID
from poezio import windows
from poezio.tabs import Tab
from poezio.core.structs import Command
from poezio.decorators import command_args... |
jubalh/poezio | poezio/windows/roster_win.py | """
Windows used with the roster (window displaying the contacts, and the
one showing detailed info on the current selection)
"""
import logging
log = logging.getLogger(__name__)
from datetime import datetime
from typing import Optional, List, Union, Dict
from poezio.windows.base_wins import Win
from poezio import c... |
jubalh/poezio | plugins/reorder.py | <filename>plugins/reorder.py
"""
``reorder`` plugin: Reorder the tabs according to a layout
Commands
--------
.. glossary::
/reorder
**Usage:** ``/reorder``
Reorder the tabs according to the configuration.
/save_order
**Usage:** ``/save_order``
Save the current tab order to... |
jubalh/poezio | poezio/windows/muc.py | <gh_stars>10-100
"""
Windows specific to a MUC
"""
import logging
import curses
from typing import List, Tuple, Optional
from poezio.windows.base_wins import Win
from poezio import poopt
from poezio.config import config
from poezio.theming import to_curses_attr, get_theme
from poezio.user import User
log = logging... |
jubalh/poezio | poezio/types.py | <reponame>jubalh/poezio<filename>poezio/types.py
"""Poezio type stuff"""
try:
from typing import TypedDict
except ImportError:
from typing_extensions import TypedDict
__all__ = ['TypedDict']
|
jubalh/poezio | poezio/config.py | """
Defines the global config instance, used to get or set (and save) values
from/to the config file.
This module has the particularity that some imports and global variables
are delayed because it would mean doing an incomplete setup of the python
loggers.
TODO: get http://bugs.python.org/issue1410680 fixed, one day... |
jubalh/poezio | poezio/plugin.py | <filename>poezio/plugin.py
"""
Define the PluginConfig and Plugin classes, plus the SafetyMetaclass.
These are used in the plugin system added in poezio 0.7.5
(see plugin_manager.py)
"""
from typing import Any, Dict, Set, Optional
from asyncio import iscoroutinefunction
from functools import partial
from configparser ... |
jubalh/poezio | poezio/decorators.py | """
Module containing various decorators
"""
from __future__ import annotations
from asyncio import iscoroutinefunction
from typing import (
cast,
Any,
Callable,
Dict,
List,
Optional,
TypeVar,
TYPE_CHECKING,
)
from poezio import common
if TYPE_CHECKING:
from poezio.core.core impor... |
jubalh/poezio | poezio/common.py | # Copyright 2010-2011 <NAME> <<EMAIL>>
#
# This file is part of Poezio.
#
# Poezio is free software: you can redistribute it and/or modify
# it under the terms of the zlib license. See the COPYING file.
"""
Various useful functions.
"""
from datetime import (
datetime,
timedelta,
timezone,
)
from pathlib i... |
jubalh/poezio | test/test_logger.py | """
Test the functions in the `logger` module
"""
import datetime
from pathlib import Path
from random import sample
from shutil import rmtree
from string import hexdigits
from poezio import logger
from poezio.logger import (
LogMessage, parse_log_line, parse_log_lines, build_log_message
)
from poezio.ui.types impo... |
jubalh/poezio | poezio/contact.py | <filename>poezio/contact.py
# Copyright 2010-2011 <NAME> <<EMAIL>>
#
# This file is part of Poezio.
#
# Poezio is free software: you can redistribute it and/or modify
# it under the terms of the zlib license. See the COPYING file.
"""
Defines the Resource and Contact classes, which are used in
the roster.
"""
from col... |
jubalh/poezio | poezio/core/command_defs.py | from typing import Callable, List, Optional
from poezio.core.commands import CommandCore
from poezio.core.completions import CompletionCore
from poezio.plugin_manager import PluginManager
from poezio.types import TypedDict
CommandDict = TypedDict(
"CommandDict",
{
"name": str,
"func": Callabl... |
jubalh/poezio | plugins/untrackme.py | """
UntrackMe wannabe plugin
"""
from typing import Callable, Dict, List, Tuple, Union
import re
import logging
from slixmpp import Message
from poezio import tabs
from poezio.plugin import BasePlugin
from urllib.parse import quote as urlquote
log = logging.getLogger(__name__)
ChatTabs = Union[
tabs.MucTab... |
jubalh/poezio | poezio/mam.py | <reponame>jubalh/poezio
"""
Query and control an archive of messages stored on a server using
XEP-0313: Message Archive Management(MAM).
"""
from __future__ import annotations
import asyncio
import logging
from datetime import datetime, timedelta, timezone
from hashlib import md5
from typing import (
Any,... |
jubalh/poezio | poezio/tabs/privatetab.py | """
Module for the PrivateTab
A PrivateTab is a private conversation opened with someone from a MUC
(see muctab.py). The conversation happens with both JID being relative
to the MUC (room@server/nick1 and room@server/nick2).
This tab references his parent room, and is modified to keep track of
both participant’s nick... |
jubalh/poezio | poezio/args.py | <filename>poezio/args.py
"""
Module related to the argument parsing
"""
import pkg_resources
import stat
import sys
from argparse import ArgumentParser, SUPPRESS, Namespace
from pathlib import Path
from shutil import copy2
from typing import Tuple
from poezio.version import __version__
from poezio import xdg
def par... |
jubalh/poezio | poezio/core/structs.py | """
Module defining structures useful to the core class and related methods
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Callable, List, TYPE_CHECKING, Optional
if TYPE_CHECKING:
from poezio import windows
__all__ = [
'Command',
'Completion',
'POSSIB... |
jubalh/poezio | test/test_text_buffer.py | <filename>test/test_text_buffer.py
"""
Tests for the TextBuffer class
"""
from pytest import fixture
from poezio.text_buffer import (
TextBuffer,
HistoryGap,
)
from poezio.ui.types import (
Message,
BaseMessage,
MucOwnJoinMessage,
MucOwnLeaveMessage,
)
@fixture(scope='function')
def buf2048(... |
jubalh/poezio | plugins/user_extras.py | """
This plugin enables rich presence events, such as mood, activity, gaming or tune.
.. versionadded:: 0.14
This plugin was previously provided in the poezio core features.
Command
-------
.. glossary::
/activity
**Usage:** ``/activity [<general> [specific] [comment]]``
Send your current ac... |
jubalh/poezio | poezio/logger.py | <gh_stars>10-100
# Copyright 2010-2011 <NAME> <<EMAIL>>
#
# This file is part of Poezio.
#
# Poezio is free software: you can redistribute it and/or modify
# it under the terms of the zlib license. See the COPYING file.
"""
The logger module that handles logging of the poezio
conversations and roster changes
"""
impor... |
jubalh/poezio | poezio/text_buffer.py | <filename>poezio/text_buffer.py
"""
Define the TextBuffer class
A text buffer contains a list of intermediate representations of messages
(not xml stanzas, but neither the Lines used in windows.py.
Each text buffer can be linked to multiple windows, that will be rendered
independently by their TextWins.
"""
from __f... |
jubalh/poezio | poezio/windows/image.py | <gh_stars>10-100
"""
Defines a window which contains either an image or a border.
"""
import curses
from io import BytesIO
try:
from PIL import Image
HAS_PIL = True
except ImportError:
class Image: # type: ignore
class Image:
pass
HAS_PIL = False
try:
import gi
gi.require... |
jubalh/poezio | poezio/multiuserchat.py | <reponame>jubalh/poezio
# Copyright 2010-2011 <NAME> <<EMAIL>>
#
# This file is part of Poezio.
#
# Poezio is free software: you can redistribute it and/or modify
# it under the terms of the zlib license. See the COPYING file.
"""
Implementation of the XEP-0045: Multi-User Chat.
Add some facilities that are not availab... |
jubalh/poezio | poezio/log_loader.py | <gh_stars>10-100
"""
This modules contains a class that loads messages into a ChatTab, either from
MAM or the local logs, and a class that loads MUC history into the local
logs.
How the log loading works will depend on the poezio configuration:
- if use_log is True, no logs will be fetched dynamically
- if use_log i... |
jubalh/poezio | test/test_user.py | """
Tests for the User class
"""
import pytest
from datetime import datetime
from slixmpp import JID
from poezio.user import User
@pytest.fixture
def user1():
return User(
nick='nick1',
affiliation='member',
show='xa',
status='My Status!',
role='moderator',
jid=JID... |
jubalh/poezio | plugins/b64.py | <reponame>jubalh/poezio
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 Maxime <NAME> <<EMAIL>>
#
# Distributed under terms of the zlib license.
"""
Usage
-----
Base64 encryption plugin.
This plugin also respects security guidelines listed in XEP-0419.
.. glossary::
/b64
... |
jubalh/poezio | poezio/plugin_e2ee.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8 et ts=4 sts=4 sw=4
#
# Copyright © 2019 Maxime “pep” Buquet <<EMAIL>>
#
# Distributed under terms of the zlib license. See COPYING file.
"""
Interface for E2EE (End-to-end Encryption) plugins.
"""
from typing import (
Callable,
Dict,
List... |
jubalh/poezio | test/test_xhtml.py | <reponame>jubalh/poezio
"""
Test the functions in the `xhtml` module
"""
import pytest
import xml
import poezio.xhtml
from poezio.xhtml import (poezio_colors_to_html, xhtml_to_poezio_colors,
_parse_css as parse_css, clean_text)
class ConfigShim:
def __init__(self):
self.value = True
... |
prashg008/chatify | apps/accounts/serializers.py | from rest_framework import serializers
from .models import User
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ['id', 'email', 'username', 'password', 'picture', 'status']
read_only_fields = ['id']
extra_kwargs = {
'password': {
... |
prashg008/chatify | apps/accounts/apps.py | from django.apps import apps as django_apps
class AccountsConfig(django_apps.AppConfig):
name = 'accounts'
|
prashg008/chatify | chatify/settings/production.py | from .base import * # noqa
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = os.getenv("DJANGO_SECRET_KEY")
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = os.gete... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.