repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
Rodney-Smith/rc522-mqtt | readRFID.py | <gh_stars>0
#!/usr/bin/python
import json
import os
import socket
import sys
import time
from pirc522 import RFID
import paho.mqtt.client as mqtt
def LOG(msg):
print(msg)
def message(client, userdata, msg):
# Method callled when a client's subscribed feed has a new value.
LOG("Message received on topic... |
Kiru-axis/I-connect | config.py | import os
import secrets
secret =secrets.token_urlsafe(32)
class Config:
SECRET_KEY = secret
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
UPLOADED_PHOTOS_DEST = 'app/static/photos'
... |
Kiru-axis/I-connect | app/auth/forms.py | from flask_wtf import FlaskForm
from wtforms import StringField,PasswordField,SubmitField,BooleanField
from wtforms.validators import DataRequired,Length,Email,EqualTo
from ..models import User
from wtforms import ValidationError
# Registration form
class RegistrationForm(FlaskForm):
"""
class for registration ... |
Kiru-axis/I-connect | app/main/forms.py | from flask_wtf import FlaskForm
from flask_wtf.file import FileField,FileAllowed
from wtforms import StringField,TextAreaField, SubmitField,ValidationError
from wtforms.validators import Required,Email
from flask_login import current_user
from ..models import User
# Update proile form
class UpdateProfile(FlaskForm):
... |
Kiru-axis/I-connect | app/auth/views.py | <reponame>Kiru-axis/I-connect
from flask import render_template,flash, request, redirect, url_for
from flask_login import login_user, logout_user,login_required
from app.auth import auth
from app.models import User
from .forms import RegistrationForm,LoginForm
from .. import db
# registration of users with
@auth.rout... |
psavery/mongochemserver | girder/molecules/server/openbabel.py | from openbabel import OBMol, OBConversion
def convert_str(str_data, in_format, out_format):
mol = OBMol()
conv = OBConversion()
conv.SetInFormat(in_format)
conv.SetOutFormat(out_format)
conv.ReadString(mol, str_data)
return (conv.WriteString(mol), conv.GetOutFormat().GetMIMEType())
def to_inc... |
psavery/mongochemserver | girder/molecules/plugin_tests/calculations_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2018 Kitware Inc.
#
# 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 cop... |
psavery/mongochemserver | girder/notebooks/server/__init__.py | import os
import glob
from bson.objectid import ObjectId
from girder import events
from girder.models.folder import Folder
from girder.models.upload import Upload
from girder.utility.path import lookUpPath
from .rest import Notebook
def createNotebooks(event):
user = event.info
folder_model = Folder()
... |
psavery/mongochemserver | girder/molecules/server/chemspider.py | import os
from chemspipy import ChemSpider
from girder.constants import TerminalColor
try:
chemspikey = os.environ['chemspikey']
except KeyError:
chemspikey = None
print(TerminalColor.warning('WARNING: chemspikey not set, common names will not be resolved.'))
def find_common_name(inchikey, formula):
... |
psavery/mongochemserver | girder/molecules/server/experiment.py | <reponame>psavery/mongochemserver
from girder.api.describe import Description
from girder.api.docs import addModel
from girder.api import access
from girder.api.rest import Resource
from girder.api.rest import RestException, getBodyJson, getCurrentUser, \
loadmodel
from girder.models.model_base import ModelImporte... |
psavery/mongochemserver | girder/molecules/server/models/calculation.py | from jsonschema import validate, ValidationError
from girder.models.model_base import AccessControlledModel, ValidationException
from girder.constants import AccessType
class Calculation(AccessControlledModel):
'''
{
'frames': {
'<mode>': [[3n]]
}
},
'cjson': '...'
... |
psavery/mongochemserver | girder/molecules/server/models/cubecache.py | from jsonschema import validate, ValidationError
from bson.objectid import ObjectId
from girder.models.model_base import AccessControlledModel, ValidationException
from girder.constants import AccessType
class Cubecache(AccessControlledModel):
def __init__(self):
super(Cubecache, self).__init__()
de... |
psavery/mongochemserver | girder/molecules/server/avogadro.py | from avogadro2 import *
import json
from jsonpath_rw import parse
def convert_str(str_data, in_format, out_format):
mol = Molecule()
conv = FileFormatManager()
conv.readString(mol, str_data, in_format)
return conv.writeString(mol, out_format)
def atom_count(str_data, in_format):
mol = Molecule()
... |
psavery/mongochemserver | girder/molecules/server/models/molecule.py | <filename>girder/molecules/server/models/molecule.py
# -*- coding: utf-8 -*-
import re
from girder.models.model_base import AccessControlledModel, ValidationException
from girder.constants import AccessType
class Molecule(AccessControlledModel):
def __init__(self):
super(Molecule, self).__init__()
... |
psavery/mongochemserver | girder/molecules/server/__init__.py | <gh_stars>0
# -*- coding: utf-8 -*-
from .molecule import Molecule
from .calculation import Calculation
from .experiment import Experiment
from girder import events
from girder.models.model_base import ValidationException
from .constants import PluginSettings
def validateSettings(event):
if event.info['key'] == ... |
psavery/mongochemserver | girder/molecules/plugin_tests/molecules_test.py | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2018 Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may ... |
psavery/mongochemserver | girder/molecules/server/constants.py | class PluginSettings:
VIRTUOSO_BASE_URL = 'molecules.virtuoso.base_url'
VIRTUOSO_RDF_UPLOAD_PATH = 'molecules.virtuoso.rdf_upload_path'
VIRTUOSO_USER = 'molecules.virtuoso.user'
VIRTUOSO_PASSWORD = '<PASSWORD>'
SEMANTIC_URI_BASE = 'molecules.semantic.url_base'
theory_priority = {
'mm': 10, # (m... |
psavery/mongochemserver | girder/molecules/server/semantic/cheminf.py | <filename>girder/molecules/server/semantic/cheminf.py
from rdflib import Namespace, Graph, URIRef
from rdflib.term import BNode, Literal
from rdflib.namespace import RDF, OWL, NamespaceManager
cheminf = Namespace('http://semanticscience.org/resource/')
def create_molecule_graph(uri_base, mol):
mongochem = Names... |
psavery/mongochemserver | girder/molecules/server/semantic/__init__.py | from . import gainesville
from . import cheminf
from . import virtuoso
from girder.utility.model_importer import ModelImporter
from girder.plugins.molecules.constants import PluginSettings
def upload_molecule(mol):
settings = ModelImporter.model('setting')
uri_base = settings.get(PluginSettings.SEMANTIC_URI_B... |
psavery/mongochemserver | girder/molecules/server/calculation.py | import cherrypy
import functools
from jsonpath_rw import parse
from bson.objectid import ObjectId
import json
from girder.api.describe import Description, autoDescribeRoute
from girder.api.docs import addModel
from girder.api import access
from girder.api.rest import Resource
from girder.api.rest import RestException,... |
psavery/mongochemserver | girder/molecules/plugin_tests/__init__.py | <reponame>psavery/mongochemserver
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2018 Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with th... |
psavery/mongochemserver | girder/molecules/server/molecule.py | import cherrypy
import json
import os
import functools
import requests
from jsonpath_rw import parse
from girder.api.describe import Description, autoDescribeRoute
from girder.api.docs import addModel
from girder.api.rest import Resource
from girder.api.rest import RestException, loadmodel, getCurrentUser
from girder.... |
Maninder-mike/bant-shuttring-store-renting-system | src/main.py | <gh_stars>1-10
from PyQt5.QtWidgets import QMainWindow, QApplication, QTextEdit, QStyleFactory, QHBoxLayout, QDockWidget, QWidget, \
QListWidget, QVBoxLayout, QAction
from PyQt5.QtGui import QPalette, QColor
from PyQt5.QtCore import Qt
import sys
from tab_widget import TabWidget
from toolbox import ToolBox
from st... |
Maninder-mike/bant-shuttring-store-renting-system | src/tab_widget.py | <filename>src/tab_widget.py
from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QTabWidget, QFormLayout, QLineEdit, QHBoxLayout
import sys
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.table = TabWidget(self)... |
Maninder-mike/bant-shuttring-store-renting-system | setup.py | from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='bssrs',
version='0.1.0',
description='A POS Python project',
long_description=long_de... |
Maninder-mike/bant-shuttring-store-renting-system | src/time_mangement.py | from datetime import datetime
import calendar
def calculateAge(birthDate):
today = datetime.date.today()
age = today.year - birthDate.year-((today.month, today.day) < (birthDate.month, birthDate.day))
return age
def birthCalendar(year):
return calendar.calendar(year)
def today():
return datetime... |
Maninder-mike/bant-shuttring-store-renting-system | clc.py | <filename>clc.py<gh_stars>1-10
from PyQt5.QtWidgets import QVBoxLayout, QWidget, QGridLayout, QLineEdit, QApplication, QPushButton, QStyleFactory
class MainWindow(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle('Calculator')
self.setMaximumSize(500, 300)
self.... |
Maninder-mike/bant-shuttring-store-renting-system | src/window_size.py | <gh_stars>1-10
def normal_window():
if True:
window = (500, 500)
return window
else:
print('Please change window size.') |
Maninder-mike/bant-shuttring-store-renting-system | tests/test_main.py | <reponame>Maninder-mike/bant-shuttring-store-renting-system<gh_stars>1-10
from src.check import add, mul
def test_add():
assert add(5, 5) == 10
def test_mul():
assert mul(4, 4) == 16
|
Maninder-mike/bant-shuttring-store-renting-system | src/menubar.py | from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QVBoxLayout, QMenu, QMenuBar
import sys
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.menubar = MenuBar()
self.setCentralWidget(self.menubar)
... |
Maninder-mike/bant-shuttring-store-renting-system | src/customwidgets.py | from PyQt5.QtWidgets import QWidget, QLabel, QPushButton, QHBoxLayout
class OnOffWidget(QWidget):
def __init__(self, name):
super(OnOffWidget, self).__init__()
self.name = name
self.is_on = False
self.lbl = QLabel(self.name)
self.btn_on = QPushButton('On')
self.btn... |
Maninder-mike/bant-shuttring-store-renting-system | src/layout.py | from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QHBoxLayout, QVBoxLayout
import sys
from toolbox import ToolBox
from tab_widget import TabWidget
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.setMinimumSize... |
Maninder-mike/bant-shuttring-store-renting-system | tests/test_database_set.py | <reponame>Maninder-mike/bant-shuttring-store-renting-system
from src.database.database_connect import connect
import sqlite3 |
Maninder-mike/bant-shuttring-store-renting-system | colored_lines.py | from colorama import Fore, Back, Style, init
init(autoreset=True)
def solution(n):
sum = 0
terms = (n - 1) // 3
sum += (terms * (6 + (terms - 1) * 3)) // 2 # sum of an A.P.
terms = (n - 1) // 5
sum += (terms * (10 + (terms - 1) * 5)) // 2
terms = (n - 1) // 15
sum -= (terms * (30 + (terms... |
Maninder-mike/bant-shuttring-store-renting-system | src/database/database_connect.py | import sqlite3
def connect():
conn = sqlite3.connect("books.db")
cur = conn.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS book (id INTEGER PRIMARY KEY, title TEXT, "
"author TEXT, year INTEGER, isbn INTEGER)")
conn.commit()
conn.close()
def insert(title, author, year, isbn):
... |
Maninder-mike/bant-shuttring-store-renting-system | src/status_bar.py | from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget
from PyQt5.Qt import Qt
import sys
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.setMinimumSize(500, 500)
self.bar = StatusBar()
self.setCent... |
Maninder-mike/bant-shuttring-store-renting-system | src/toolbox.py | <reponame>Maninder-mike/bant-shuttring-store-renting-system
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QToolBox, QLabel, QMainWindow
import sys
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.table = T... |
VicHug27/web-scraping-challenge | scrape_mars.py | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#Import dependencies and setup
import pandas as pd
from bs4 import BeautifulSoup as bs
from splinter import Browser
import requests
import pymongo
from webdriver_manager.chrome import ChromeDriverManager
# In[2]:
executable_path = {'executable_path': ChromeDriverMan... |
mhyeun/emojified-tweets-wall-of-fame | emojified_tweets_wall_of_fame/urls.py | from django.urls import path
from . import views
urlpatterns = [
path("", views.wall_of_fame, name="wall_of_fame"),
path("wall-of-fame", views.wall_of_fame, name="wall_of_fame"),
path("wall-of-shame", views.wall_of_shame, name="wall_of_shame"),
path("health", views.health, name="health"),
path("au... |
mhyeun/emojified-tweets-wall-of-fame | emojified_tweets_wall_of_fame/views.py | <reponame>mhyeun/emojified-tweets-wall-of-fame<gh_stars>1-10
from django.shortcuts import render, redirect, get_list_or_404
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseRedirect
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.hashers import make_password... |
mhyeun/emojified-tweets-wall-of-fame | emojified_tweets_wall_of_fame/admin.py | <filename>emojified_tweets_wall_of_fame/admin.py
from django.contrib import admin
from .models import Tweet, CustomUser, CustomUserToTweet
admin.site.register(CustomUser)
admin.site.register(Tweet)
admin.site.register(CustomUserToTweet)
|
mhyeun/emojified-tweets-wall-of-fame | emojified_tweets_wall_of_fame/apps.py | from django.apps import AppConfig
class EmojifiedTweetsWallOfFameConfig(AppConfig):
name = "emojified_tweets_wall_of_fame"
|
mhyeun/emojified-tweets-wall-of-fame | emojified_tweets_wall_of_fame/models.py | from django.db import models
from django.conf import settings
from django.utils.timezone import now
from django.contrib.auth.models import AbstractUser
# Made foreign key relation with no cascade delete since
# we will just replace username with [DELETED]
class CustomUser(AbstractUser):
pass
def __str__(sel... |
charlyalizadeh/ESILV_ADSA_Problem | steps/step1/numpyVSlist.py | <reponame>charlyalizadeh/ESILV_ADSA_Problem
import numpy as np
import matplotlib.pyplot as plt
import timeit
class NumpyVSList:
@staticmethod
def compute(operation):
"""Compute the time of an operation on a numpy array and a core_list.
:param str operation: The operation to compute.
:r... |
charlyalizadeh/ESILV_ADSA_Problem | interface/base.py | <gh_stars>0
import curses
import uuid
import os
class App:
def __init__(self, unicode_support=False):
os.environ.setdefault('ESCDELAY', '0')
self.stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
curses.curs_set(0)
self.stdscr.keypad(True)
self.windo... |
charlyalizadeh/ESILV_ADSA_Problem | interface/menu.py | import curses
from .base import *
class Menu(Widget):
def __init__(self, coord, texts, title=True, center=True):
super().__init__(coord)
self.texts = list(texts)
if center:
max_length = len(max(texts, key=len))
for i in range(len(texts)):
nb_space = i... |
charlyalizadeh/ESILV_ADSA_Problem | start.py | <gh_stars>0
from adsaapp import ADSAApp
from interface import App
def main():
main_app = App()
adsa_app = ADSAApp(main_app)
adsa_app.start()
if __name__ == '__main__':
main()
|
charlyalizadeh/ESILV_ADSA_Problem | steps/step2/findimpostors.py | <gh_stars>0
import numpy as np
def get_suspects_pairs(suspects, adjacency_matrix, dead_players):
"""Return the pairs of suspects of a game.
:param suspects: Array of suspect players.
:param adjacency_matrix: Matrix of players that have seen each other.
:param dead_players: Array of players that have b... |
charlyalizadeh/ESILV_ADSA_Problem | steps/step1/arraywrapper.py | <filename>steps/step1/arraywrapper.py
from .player import Player
class Array:
"""Wrapper around the list type."""
def __init__(self, size=0):
self.size = size
self._array = [Player(i, 0) for i in range(self.size)]
def delete_last(self, n=10):
"""Reduce the value of self.size.
... |
charlyalizadeh/ESILV_ADSA_Problem | utils/utils.py | def read_coordinates(path):
"""Read two-dimensional coordinates from a file and return them as a nested list.
:param str path: path to the coordinates file.
:return: a iterable containing the coordinates.
:rtype: a list of list
"""
file = open(path, "r")
coordinates = {}
index = 0
... |
charlyalizadeh/ESILV_ADSA_Problem | steps/step1/player.py | <gh_stars>0
class Player:
"""Player implementation for the step 1.
:param id: unique identifier for the player. (Default None)
:param score: score of the player. (Default 0)
"""
def __init__(self, id=None, score=0):
self.id = id
self.score = score
def __lt__(self, other):
... |
charlyalizadeh/ESILV_ADSA_Problem | steps/graph/unionfind.py | import pandas as pd
class UnionFind:
"""Disjoint-set data structure implementation """
def __init__(self):
self.parents = []
self.index_map = {}
self.size = []
def make_set(self, node):
if node not in self.index_map.keys():
index = len(self.parents)
... |
charlyalizadeh/ESILV_ADSA_Problem | adsaapp.py | from interface import *
from steps import *
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from copy import copy
class ADSAApp():
"""The class managing the interface for the project.
:param App app: The curses app wrapper where we will draw the interface.
"""
def __init__(sel... |
charlyalizadeh/ESILV_ADSA_Problem | steps/step1/arrayVSavltree.py | from .gameSimulation import Game
import timeit
def benchmark(repeat = 1000):
test_Array = "game.start()"
setup_Array = "from GameSimulation import Game; game = Game('Array')"
test_AVLTree = "game.start()"
setup_AVLTree = "from GameSimulation import Game; game = Game('AVLTree')"
time_Array = timeit.... |
charlyalizadeh/ESILV_ADSA_Problem | steps/step2/__init__.py | <reponame>charlyalizadeh/ESILV_ADSA_Problem<gh_stars>0
from .findimpostors import *
|
charlyalizadeh/ESILV_ADSA_Problem | steps/__init__.py | from .graph.graph import Graph
from .step1 import *
from .step2 import *
|
charlyalizadeh/ESILV_ADSA_Problem | steps/step1/game.py | from .avltree import AVLTree
from .arraywrapper import Array
import random
class Game:
"""Implementation of the Game for the step 1
:param str datastructure: The datastructure type to use for the game.
:param int nb_players: The number of players in the game.
"""
def __init__(self, datastruct... |
charlyalizadeh/ESILV_ADSA_Problem | steps/graph/graph.py | <gh_stars>0
from math import inf
import numpy as np
from copy import copy
import networkx as nx
from .unionfind import UnionFind
from utils.utils import read_coordinates
class Graph():
"""
Graph implementation with an adjacency matrix.
:param int nb_vertex: Number of vertices to initialize the graph with... |
charlyalizadeh/ESILV_ADSA_Problem | interface/fakescreen.py | import curses
from .base import *
class FakeScreen(Widget):
def __init__(self, coord, dim):
super().__init__(coord)
self.dim = dim
self.lines = []
self.offsets = [0, 0]
self.longest_string = 0
def _draw_border(self, app):
for i in range(self.coord[0], self.coord... |
charlyalizadeh/ESILV_ADSA_Problem | steps/step1/avltree.py | from collections import deque
import copy
from graphviz import Digraph
import random
from .player import Player
class NodePlayer:
"""Represent a node in the AVLTree class.
:param value: The value of the node.
:param NodePlayer left: The left child. (Default: None)
:param NodePlayer right: The right ch... |
charlyalizadeh/ESILV_ADSA_Problem | interface/__init__.py | <filename>interface/__init__.py
from .base import App, Widget
from .menu import Menu
from .fakescreen import FakeScreen
|
ZeccaLehn/WordWork | WordWork.py | #!/usr/bin/env python
# coding: utf-8
#
# PART 1: WORD FREQUENCIES
#
# In[1]:
# Linux Command from Anaconda (Prints inline): ipython notebook --matplotlib=inline
import os
HOME = os.environ['HOME'] # Finds computer home on Linux
WORKINGDIR = HOME + '/anaconda/Examples/WordWork' # Points to Anaconda package
W... |
alexandrealbuquerque000/Web-series | código-WebSeries(v3.5)/WebSeries(v3.5).py |
#<NAME>
from datetime import date
import speech_recognition
from gtts import gTTS
from playsound import playsound
import webbrowser
import pyautogui
import time
import sys
import os
import shutil
import pathlib
def presets():
global allquestions, width, height
width, height=pyautogui.size()
allquestio... |
richard-shepherd/crossword-helper | crossword_libs/word_utils/anagram_helper.py | <reponame>richard-shepherd/crossword-helper<gh_stars>0
import itertools
from singleton_decorator import singleton
from collections import defaultdict
from .word_manager import WordManager
from .word_utils import WordUtils
@singleton
class AnagramHelper(object):
"""
Finds anagrams for words.
"""
d... |
richard-shepherd/crossword-helper | crossword_libs/word_utils/word_utils.py | <filename>crossword_libs/word_utils/word_utils.py
import itertools
class WordUtils(object):
"""
Utility functions for working with words.
"""
@staticmethod
def clean_word(word):
"""
Returns a 'clean' form of the word passed in.
- Removes whitespace
- Removes punctu... |
richard-shepherd/crossword-helper | crossword_libs/cryptic_utils/clue.py | <filename>crossword_libs/cryptic_utils/clue.py
from .bits_and_pieces import BitsAndPieces
class Clue(object):
"""
Parses cryptic clues and provides information on how to solve them.
"""
def __init__(self, clue):
"""
Constructor.
"""
# The original text of the clue...
... |
richard-shepherd/crossword-helper | crossword_libs/word_utils/lemma_info.py | <gh_stars>0
from collections import defaultdict
class LemmaInfo(object):
"""
Holds info related to a lemma - ie, to the root form of a word.
In particular we hold a map of pos-tags to the word form for them.
For example, the LemmaInfo for "good" will include:
JJR -> "better"
JJT -> "best"... |
richard-shepherd/crossword-helper | crossword_libs/cryptic_utils/bits_and_pieces.py | import logging
from singleton_decorator import singleton
from collections import defaultdict
from ..word_utils import WordUtils
from ..utils import Utils
@singleton
class BitsAndPieces(object):
"""
Manages a collection of 'bits and pieces' - ie, substitutions of
words or phrases for collections of letters... |
richard-shepherd/crossword-helper | crossword_libs/word_utils/word_manager.py | import logging
import nltk
from nltk.corpus import wordnet
from nltk.stem import WordNetLemmatizer
from collections import defaultdict
from singleton_decorator import singleton
from ..utils import Utils
from .lemma_info import LemmaInfo
from .word_info import WordInfo
from .word_utils import WordUtils
@singleton
clas... |
richard-shepherd/crossword-helper | crossword_libs/utils/utils.py | import sys
import os
import logging
class Utils(object):
"""
Utility functions.
"""
@staticmethod
def log_to_stdout(level=logging.INFO):
"""
Sets up logging to stdout at the (optional) level specified.
"""
root = logging.getLogger()
root.setLevel(level)
... |
richard-shepherd/crossword-helper | crossword_libs/word_utils/words.py | import re
from .anagram_helper import AnagramHelper
from .definition_helper import DefinitionHelper
from .word_manager import WordManager
from .word_utils import WordUtils
class Words(object):
"""
Provides a fluent interface for looking up words given certain constraints.
Examples:
- Words().match(".... |
richard-shepherd/crossword-helper | main.py | <filename>main.py
import itertools
from crossword_libs import AnagramHelper
from crossword_libs import BitsAndPieces
from crossword_libs import Clue
from crossword_libs import DefinitionHelper
from crossword_libs import Utils
from crossword_libs import WordManager
from crossword_libs import Words
Utils.log_to_stdout... |
richard-shepherd/crossword-helper | crossword_libs/cryptic_utils/__init__.py | <reponame>richard-shepherd/crossword-helper<gh_stars>0
from .bits_and_pieces import BitsAndPieces
from .clue import Clue
|
richard-shepherd/crossword-helper | crossword_libs/word_utils/word_info.py | <reponame>richard-shepherd/crossword-helper<gh_stars>0
class WordInfo(object):
"""
Information associated with a word.
"""
def __init__(self):
"""
Constructor.
"""
# The collection of part-of-speech tags for the word...
self.pos_tags = set()
|
richard-shepherd/crossword-helper | crossword_libs/word_utils/__init__.py | <reponame>richard-shepherd/crossword-helper
from .anagram_helper import AnagramHelper
from .definition_helper import DefinitionHelper
from .lemma_info import LemmaInfo
from .word_info import WordInfo
from .word_manager import WordManager
from .word_utils import WordUtils
from .words import Words
|
richard-shepherd/crossword-helper | crossword_libs/__init__.py | from .cryptic_utils import BitsAndPieces
from .cryptic_utils import Clue
from .utils import Utils
from .word_utils import AnagramHelper
from .word_utils import DefinitionHelper
from .word_utils import WordManager
from .word_utils import Words
|
richard-shepherd/crossword-helper | crossword_libs/word_utils/definition_helper.py | from nltk.corpus import wordnet
from .word_manager import WordManager
from .word_utils import WordUtils
class DefinitionHelper(object):
"""
Finds words which match a crossword definition. For example:
"rodents" -> "rats", "mice"
"""
@staticmethod
def words_for_definition(definition):
... |
richard-shepherd/crossword-helper | setup.py | from crossword_libs import BitsAndPieces
from crossword_libs import Utils
from crossword_libs import Words
# Sets up logging...
Utils.log_to_stdout()
# Pre-loads words...
Words()
# Pre-loads bits-and-pieces...
BitsAndPieces()
|
matthiasmullie/media-search-signal-test | logreg.old.py | <reponame>matthiasmullie/media-search-signal-test
# This is the script that was used to do the first logistic regression based on a ranklib file for MediaSearch
#
# It's no longer relevant, but keeping in the repo just for information's sake
import os
import subprocess
import pandas as pd
import numpy as np
from sklea... |
matthiasmullie/media-search-signal-test | logreg.py | import getopt
import numpy as np
import os
import pandas as pd
from sklearn import preprocessing
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn import metrics
from sklearn.feature_selection import RFE
from statsmodels.stats.outliers_influence import... |
Jayich-Lab/jax | examples/experiments/ex1_hardware_control.py | <gh_stars>1-10
from artiq.experiment import *
from jax import JaxExperiment, SinaraEnvironment
# __all__ in an experiment module should typically only include the experiment class.
# Specially, it cannot include the base experiment class.
# ARTIQ discovers experiments by trying to load all objects that are subclasses... |
Jayich-Lab/jax | base/applets/jax_applet.py | import os
import asyncio
import threading
import pathlib
from PyQt5 import QtCore
from sipyco import pyon
__all__ = ["JaxApplet"]
class JaxApplet(QtCore.QObject):
"""Base class for all applets.
LabRAD cannot be run in the main thread as twisted asyncioreactor does not support the
WindowsProactorEventLo... |
Jayich-Lab/jax | util/ui/fast_plot_trace.py | <gh_stars>1-10
import numpy as _np
import pyqtgraph as _pg
from PyQt5 import QtCore
class _PlotPath(_pg.QtGui.QGraphicsPathItem):
"""Generates a path for x-y plotting data.
Replaces the expensive work of plotting data by plotting a path. When plotting a large dataset,
a path can be generated for every n ... |
Jayich-Lab/jax | tools/applets/dds_channel.py | from PyQt5 import QtWidgets, QtGui, QtCore
from jax.util.ui.dialog_on_top import DialogOnTop
class DDSParameters:
"""Stores DDS parameters and calls the artiq server when changes are made."""
def __init__(self, parent, channel, cpld, amplitude, att, frequency, phase, state):
self.parent = parent
... |
Jayich-Lab/jax | base/sequences/sequence.py | from artiq.experiment import *
class Sequence:
"""Base class for pulse sequences.
Pulse sequences are building blocks of kernel code.
A sequence can contain other Sequence instances as subsequences.
Set required_parameters to a list of parameters used in the sequence.
Set required_subsequences t... |
Jayich-Lab/jax | tools/experiments/initialize_sinara.py | from sipyco import pyon
from artiq.experiment import *
from jax import JaxExperiment, SinaraEnvironment
__all__ = ["InitializeSinara"]
class InitializeSinara(JaxExperiment, SinaraEnvironment):
"""Handles device initialization.
This sets previously initialized devices to their original parameter settings.
... |
Jayich-Lab/jax | util/ui/dialog_on_top.py | <filename>util/ui/dialog_on_top.py
from PyQt5 import QtWidgets, QtCore
class DialogOnTop(QtWidgets.QDialog):
"""QDialog that shows on top of the main window."""
def __init__(self, parent):
super().__init__(parent)
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)... |
Jayich-Lab/jax | __init__.py | from jax.base.applets.jax_applet import JaxApplet
from jax.base.applets.real_time_plot_applet import RealTimePlotApplet
from jax.base.environments.jax_environment import JaxEnvironment
from jax.base.environments.sinara_environment import SinaraEnvironment
from jax.base.experiments.jax_experiment import JaxExperiment
fr... |
Jayich-Lab/jax | util/labrad.py | import numpy as _np
from labrad.units import WithUnit, WithDimensionlessUnit
__all__ = ["remove_labrad_units"]
def remove_labrad_units(value):
"""Removes labrad unit from returned value of a labrad server.
Labrad sends some types of values in WithUnit or WithDimensionlessUnit types,
which we need to co... |
Jayich-Lab/jax | util/drift_tracker.py | import time as _t
import numpy as _np
import scipy.constants as _c
from artiq.experiment import *
from jax.util.tree_dict import TreeDict
__all__ = ["DriftTracker"]
class ZeemanTracker:
"""Calculates Zeeman shifts.
Args:
Zeeman_dict: dict that includes the following key-value pairs:
low... |
Jayich-Lab/jax | base/experiments/jax_experiment.py | from artiq.experiment import Experiment
class JaxExperiment(Experiment):
"""Base class for all Jayich lab experiments."""
def build(self):
super().build()
def prepare(self):
"""Skips Experiment.prepare() and goes to prepare() defined in the environment."""
delattr(Experiment, "pre... |
Jayich-Lab/jax | examples/sequences/state_detect.py | from artiq.experiment import *
from jax import Sequence
__all__ = ["StateDetect"]
class StateDetect(Sequence):
"""An example state detection sequence.
Turns on the cool and repump DDSes, and counts the PMT output.
"""
kernel_invariants = {
"_cool_dds", "_repump_dds", "_cool_drift_tracker", ... |
Jayich-Lab/jax | examples/experiments/ex2_pulse_sequence.py | from sipyco import pyon
from artiq.experiment import *
from jax import JaxExperiment, SinaraEnvironment
from jax.examples.sequences.example2 import Example2
from jax.util.parameter_group import ParameterGroup
from jax.util.drift_tracker import DriftTracker
__all__ = ["PulseSequence"]
class PulseSequence(JaxExperime... |
Jayich-Lab/jax | tools/applets/pmt.py | from PyQt5 import QtWidgets, QtCore, QtGui
from artiq.applets.simple import SimpleApplet
from jax import JaxApplet
class PMT(QtWidgets.QWidget, JaxApplet):
def __init__(self, args, **kwds):
super().__init__(**kwds)
self._dv_on = False
self._pmt_on = False
self.set_disable_state()
... |
Jayich-Lab/jax | examples/sequences/example2.py | from artiq.experiment import *
from jax import Sequence
from jax.examples.sequences.doppler_cool import DopplerCool
from jax.examples.sequences.state_detect import StateDetect
__all__ = ["Example2"]
class Example2(Sequence):
"""Pulse sequence for the example 2 experiment."""
kernel_invariants = {}
requ... |
Jayich-Lab/jax | base/environments/jax_environment.py | <filename>base/environments/jax_environment.py
import threading
from sipyco import pyon
from artiq.experiment import *
from jax.util.parameter_group import ParameterGroup
from jax.util.drift_tracker import DriftTracker
__all__ = ["JaxEnvironment"]
class JaxEnvironment(HasEnvironment):
"""Environment for Jayich ... |
Jayich-Lab/jax | examples/sequences/doppler_cool.py | from artiq.experiment import *
from jax import Sequence
__all__ = ["DopplerCool"]
class DopplerCool(Sequence):
"""An example Doppler cooling sequence."""
kernel_invariants = {
"_cool_dds", "_repump_dds", "_cool_drift_tracker", "_repump_drift_tracker"
}
required_parameters = [
("devi... |
Jayich-Lab/jax | tools/experiments/pmt.py | import time as _t
from sipyco import pyon
from artiq.experiment import *
from jax import JaxExperiment, SinaraEnvironment
__all__ = ["PMT"]
class PMT(JaxExperiment, SinaraEnvironment):
"""Base class for a background running experiment that reads PMT and sets TTL/DDS parameters.
Inherit this class in the ex... |
Jayich-Lab/jax | util/ui/custom_list_widget.py | from PyQt5 import QtWidgets, QtGui, QtCore
from jax.util.ui.dialog_on_top import DialogOnTop
class CustomListWidget(QtWidgets.QListWidget):
"""QListWidget that can reorder items and hide/show items.
Do not call self.addItem() or self.addItemWidget() directly.
Use self.add_item_and_widget() instead.
"... |
Jayich-Lab/jax | tools/applets/plot_pmt.py | <reponame>Jayich-Lab/jax
import numpy as _np
from PyQt5 import QtCore, QtGui, QtWidgets
from artiq.applets.simple import SimpleApplet
from jax import RealTimePlotApplet
class PlotPMT(RealTimePlotApplet):
def __init__(self, args, **kwds):
num_of_traces = 3 # high, low, differential.
datasets_names... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.