text stringlengths 12 6.59M |
|---|
"""WebSocket protocol versions 13 and 8."""
import base64
import binascii
import collections
import hashlib
import os
from struct import Struct
from aiohttp import errors, hdrs
from aiohttp.log import ws_logger
__all__ = ['WebSocketParser', 'WebSocketWriter', 'do_handshake',
'Message', 'WebSocketError',
... |
#!/usr/bin/env python3
'''aiospamc package.
An asyncio-based library to communicate with SpamAssassin's SPAMD service.'''
import asyncio
from typing import SupportsBytes, Union
from .client import Client
from .options import ActionOption, MessageClassOption
from .responses import Response
__all__ = ('Client',
... |
#
# growler/http/responder.py
#
"""
The Growler class responsible for responding to HTTP requests.
"""
from .parser import Parser
from .request import HTTPRequest
from .response import HTTPResponse
from .errors import (
HTTPErrorBadRequest
)
class GrowlerHTTPResponder():
"""
The Growler Responder for HT... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
# -*- coding: utf-8 -*-
#
# 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 in writing, software
... |
# Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Tests for the datasets REST API.
"""
# from uuid import UUID
from twisted.trial.unittest import TestCase
from ..testtools import (
require_cluster, require_moving_backend, # create_dataset,
# REALISTIC_BLOCKDEVICE_SIZE,
)
class LeaseAPITests(T... |
# Copyright 2017-2018 TensorHub, 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
# ToolKit criado por Pharaoh
# Versão 0.0.5 (2017) [Ter, 11 Jul 19:12:03]
# Linguagem = PT-BR
# Novo na versão 0.0.4:
# Atualização para PEP8.
# Correção de bugs.
# Adicionado Fibonacci no mudulo Calculadora.
# Adicionado Numeros primos no modulo Calculadora.
# Adicionado nova opção no menu principal, python.
#
# ----... |
#!/usr/local/bin/python
#
# Copyright (c) 2009-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain th... |
# -*- coding: utf-8 -*-
# (C) 2016 Muthiah Annamalai
#
# This file is part of 'open-tamil' package
# It implements a data-driven spell checker for Tamil language
#
from __future__ import print_function
import argparse
import copy
import codecs
import functools
import itertools
import json
import operator
import ppri... |
"""Miscellaneous tasks that don't fit into one of the other groupings."""
import os
import pkgutil
import zipfile
from StringIO import StringIO
from paver.easy import dry, task
_docsdir = os.path.join(os.path.dirname(__file__), "docs")
if os.path.exists(_docsdir):
@task
def paverdocs():
"""Open your w... |
import datetime
import json
import traceback
from django.conf import settings
from django.core.mail import EmailMessage
from django.db import models
from django.utils import timezone
from django.template.loader import render_to_string
from django.contrib.auth.models import User
from django.contrib.sites.models import... |
"""payu.experiment
===============
Interface to an individual experiment managed by payu
:copyright: Copyright 2011 Marshall Ward, see AUTHORS for details.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
from __future__ import print_function
# Standard Library
import datetime
import ... |
import logging
from psycopg2.extensions import AsIs
import skygear
from skygear.utils import db
from skygear.utils.context import current_user_id
from .exc import (NotInConversationException, NotSupportedException,
SkygearChatException)
from .message import Message
from .receipt import Receipt
from... |
#!/usr/bin/env python3
import argparse
import json
import math
import os
import re
import shutil
import sys
import tempfile
import numpy as np
from wand.api import library
from wand.color import Color
from wand.image import Image
import pcbnew
from lxml import etree
PKG_BASE = os.path.dirname(__file__)
default_sty... |
"""\
Run sanity checks on files.
Example.
%(prog)s --username ACCESS_KEY_ID --password SECRET_ACCESS_KEY \\
--output check_files.log https://www.encodeproject.org
"""
import datetime
import os.path
import json
import sys
from shlex import quote
import subprocess
import re
from urllib.parse import urljoin
... |
"""Tests for TLS/SSL support."""
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 :
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import functools
import os
import ssl
import sys
import threading
import time
import OpenSSL.SSL
import pytest
import requests
import six
impo... |
"""Tests for TLS support."""
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 :
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import functools
import json
import os
import ssl
import subprocess
import sys
import threading
import time
import OpenSSL.SSL
import pytest
impor... |
"""Tests for TLS support."""
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 :
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import functools
import json
import os
import ssl
import subprocess
import sys
import threading
import time
import OpenSSL.SSL
import pytest
impor... |
"""
Copyright (c) 2004, CherryPy Team (team@cherrypy.org)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list o... |
"""Session implementation for CherryPy.
We use cherrypy.request to store some convenient variables as
well as data about the session for the current request. Instead of
polluting cherrypy.request we use a Session object bound to
cherrypy.session to store these variables.
"""
import datetime
import os
try:
import ... |
"""Extensions to unittest for web frameworks.
Use the WebCase.getPage method to request a page from your HTTP server.
Framework Integration
=====================
If you have control over your server process, you can handle errors
in the server-side of the HTTP conversation a bit better. You must run
both the client ... |
import sys
import copy
import tqdm
import numpy
import numpy.lib.recfunctions
from scipy import stats, special
from galpy.util import bovy_plot, bovy_coords
import matplotlib
from matplotlib import cm, pyplot
import warnings
warnings.filterwarnings('ignore','.*All-NaN.*',) #turn-off All-NaN warnings
warnings.filterwarn... |
from discord.ext import commands
mod_names = [
'Moderator', 'Mod', # classic mod role names
'moderator', 'mod', # lowercase mod role names
# dog specific
'Dog Moderator', 'Woofer', 'woofer', 'dog moderator',
'dog mod',
]
def config_is_set(name):
async def _predicate(ctx):
return awai... |
#/usr/bin/env python
# -*- coding:utf-8 -*-
# Import some necessary libraries.
import socket, time, feedparser
server = "irc.freenode.net" # Server
channel = "#test" # Channel
botnick = "XDroid" # Bot name
def ping(): # This is our first function! It will respond to server Pings.
ircsock.send("PONG :pingi... |
#!/usr/local/bin/env python
#=============================================================================================
# MODULE DOCSTRING
#=============================================================================================
"""
Yank
====
Interface for automated free energy calculations.
"""
#=========... |
#!/usr/bin/env python
import asyncio
import datetime
import emoji
import os
import sys
from telethon import TelegramClient
from telethon.tl.types import MessageMediaDocument
from telethon.tl.types import MessageMediaPhoto
from telethon.tl.types import MessageMediaWebPage
from telethon.tl.types import MessageMediaGeo
f... |
import os
import pafy
def download_video(url):
video = pafy.new(url)
best = video.getbest()
best.download(os.path.join(os.getcwd(), 'videos'))
return '{0}.{1}'.format(best.title, best.extension)
|
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... |
import os
import json
import gevent
import pprint
import signal
import inspect
import humanize
import functools
import contextlib
from datetime import datetime, timedelta
from holster.emitter import Priority, Emitter
from disco.bot import Bot
from disco.types.message import MessageEmbed
from disco.api.http import APIE... |
#!/usr/bin/env python
"""
Script to try importing available plugins.
Plugins that have issues will have a change to emmit warnings or errors here.
:author: paul.tunison@kitware.com
"""
import logging
import smqtk.algorithms
import smqtk.representation
import smqtk.utils.bin_utils
def cli():
parser = smqtk.util... |
import os
import json
import pprint
import signal
import inspect
import humanize
import functools
import contextlib
from datetime import datetime, timedelta
from holster.emitter import Priority
from disco.types.message import MessageEmbed
from disco.api.http import APIException
from disco.bot.command import CommandEve... |
#!/usr/bin/env python3
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import numpy as np
import glob, math, queue, random, socket, subprocess, threading
import tensorflow as tf
from support import Config
import support, task_usage
class Learn:
def __init__(self, config):
... |
# A part of pdfrw (pdfrw.googlecode.com)
# Copyright (C) 2006-2012 Patrick Maupin, Austin, Texas
# MIT license -- See LICENSE.txt for details
'''
A tokenizer for PDF streams.
In general, documentation used was "PDF reference",
sixth edition, for PDF version 1.7, dated November 2006.
'''
import re
import itertools... |
#!/usr/bin/python
import sys
import os.path
from PySide import QtGui, QtCore, QtUiTools
import APS
libPath = '../../../common/src/+deviceDrivers/@APS/lib/'
#A signal for printing log messages from treads
class MessageFromThread(QtCore.QObject):
messageSignal = QtCore.Signal(str)
tmpVar = MessageFromThread()
m... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 29 13:44:51 2016
@author: sthomp
Command Line Script to run vetter on the K2 data.
Inputs
File of this info or the info itself
EpicId
Campaign
Period (days)
epoch (bkjd)
depth (ppm)
config File
"""
import dave.pipeline.clipboar... |
# This program handles the communication over I2C between a Raspberry Pi and an ADXL345 Accelerometer
# Made by: MrTijn/Tijndagamer
# Copyright 2015
import smbus
class MrTijnADXL345:
# Global Variables
earthGravityMS2 = 9.80665
moonGravityMS2 = 1.62243
marsGravityMS2 ... |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## ... |
from __future__ import print_function, unicode_literals
import os
import sys
import shutil
import platform
import tempfile
import functools
import contextlib
try:
from shlex import quote as _quote
except ImportError:
# shlex.quote was introduced in Python 3.3, use pipes.quote
# for Python 2.7.
from pi... |
from bs4 import BeautifulSoup
import requests
from django.forms.models import model_to_dict
from entry.models import Entry, Meaning
def get_meaning(keyword):
"""
Assuming that there are no Entry or Meaning objects in the DB for the
given /keyword/, it makes a request and extracts data from TDK website
... |
"""Script to load part files into a sql database.
For the inherent alpha model
We assume that the host temperature is well known so we will resitrict the
results to the host temperature. (within error bars)
For HD30501 and HD211847 this means +- 50K so a fixed temperature.
"""
import argparse
import os
import sys
i... |
# Tai Sakuma <tai.sakuma@cern.ch>
import argparse
import sys
import os
from .Configure import TableConfigCompleter
from .HeppyResult import ComponentReaderComposite
from .HeppyResult import ComponentLoop
from .HeppyResult import HeppyResult
from .EventReader import EventReader
from .EventReader import MPEventLoopRunne... |
# 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 in writing, software
# d... |
__all__ = ['typedispatcher', 'TypeDispatcher', 'StrictTypeDispatcher',
'defaultdispatch', 'dispatch',
'allChildren', 'visitAllChildren']
# Not used inside this module, only exported.
from xform import allChildren, visitAllChildren
import inspect
def dispatch(*types):
def dispatchF(f):
def di... |
#!/usr/bin/env python
import glob
import os
import shutil
import sys
import platform
from distutils import log
from setuptools import setup
from distutils.util import get_platform
from distutils.command.build import build
from distutils.command.sdist import sdist
from setuptools.command.bdist_egg import bdist_egg
SY... |
#!/usr/bin/env python
import glob
import os
import platform
import shutil
import stat
import sys
from distutils import log
from distutils import dir_util
from distutils.command.build_clib import build_clib
from distutils.command.sdist import sdist
from distutils.core import setup
from distutils.sysconfig import get_py... |
import os
import json
import logging
import requests
from collections import defaultdict
logger = logging.getLogger(__name__)
base_url = 'https://www.cbioportal.org/api'
resources_dir = os.path.join(os.path.dirname(
os.path.abspath(__file__)), 'resources')
patient_list_cache = os.path.join(resources_dir, 'cbio... |
"""
Bitreserve Python SDK
This is a python module to ease integration between python apps and the Bitreserve API.
Repo: http://github.com/byrnereese/bitreserve-python-sdk
TODO
* Create custom exceptions for common errors
* Add support for updating records
* Turn off authentication/authorization for public transaction... |
# -*- coding: utf-8 -*-
from bokeh.io import output_notebook, show, push_notebook
from bokeh.plotting import figure
from bokeh.layouts import gridplot
# ! only used to temporarily shutdown bokeh warning !
import warnings
warnings.filterwarnings('ignore')
# TODO: solve warning below
# \site-packages\bokeh\models\source... |
# !/usr/bin/python3
# coding: utf-8
# Copyright 2016-2018 Stefano Fogarollo
#
# 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... |
from .base_settings import *
import dj_database_url
import os
ALLOWED_HOSTS = ['shaha-halaqat.herokuapp.com', '0.0.0.0']
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/... |
"""HDL Module."""
from hdltools.abshdl import HDLObject
from hdltools.abshdl.builtin import HDLBuiltins
from hdltools.abshdl.scope import HDLScope
from hdltools.abshdl.signal import HDLSignal
from hdltools.abshdl.macro import HDLMacro
from hdltools.abshdl.port import HDLModulePort, HDLModuleTypedPort
from hdltools.abs... |
from django.contrib import messages
from django.contrib.auth import authenticate, login
from django.contrib.formtools.wizard.views import SessionWizardView
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse_lazy
from django.http import HttpResponseRedirect, Http404
from django.sho... |
#
# 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 in writing, software
# ... |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
"""
`hendrix-deploy.py` repensents a means of controlling the web service used to
deploy a wsgi application.
"""
import subprocess
import sys, os, errno
from hendrix import VIRTUALENV, HENDRIX_DIR
from os import listdir
from os.path import isfile, join
import argparse
#################################################... |
"""A little utility for manually patching in posts."""
import argparse
import datetime
from glob import glob
import json
import os
import time
import subprocess
from rauth.hook import OAuth1Hook
import requests
from models import Post
key, secret = os.environ['CIO_KEY'], os.environ['CIO_SECRET']
aid = os.environ['... |
# -*- coding: UTF-8 -*-
#
# This file contains UTF8 manipulation code.
# (It would be nice to use standard encoders, but they do not
# allow to read symbol by symbol.)
#
# Unicode UTF-8
# 0x00000000 — 0x0000007F: 0xxxxxxx
# 0x00000080 — 0x000007FF: 110xxxxx 10xxxxxx
# 0x00000800 — 0x0000FFFF: 1110xxxx 10xx... |
#!/usr/bin/env python
"""Bootstrap the setup tool.
What this does (only intended for Mac atm):
* installs Homebrew
* Homebrew installs a core set of packages (git and python3)
* git check out the project into ~/setup
* run
- setup (will restart os functions to reflect new settings)
- setup brew
- setup packages... |
import sys
import sublime
import sublime_plugin
import re
try:
from MarkdownEditing.mdeutils import *
except ImportError:
from mdeutils import *
package_name = 'MarkdownEditing'
def get_ingored_packages():
settings = sublime.load_settings('Preferences.sublime-settings')
return settings.get('ignored_p... |
from itertools import groupby
from numbers import Number
import numpy as np
import param
from .dimension import Dimension, ViewableElement
from .layout import Composable, Layout, AdjointLayout, NdLayout
from .ndmapping import OrderedDict, UniformNdMapping, NdMapping
from .overlay import Overlayable, NdOverlay, Overla... |
"""
Supplies Layer and related classes that allow overlaying of Views,
including Overlay. A Layer is the final extension of View base class
that allows Views to be overlayed on top of each other.
Also supplies ViewMap which is the primary multi-dimensional Map type
for indexing, slicing and animating collections of Vi... |
from django.conf import settings
from api.utils.request import get_dummy_request
from api.task.utils import callback, mgmt_lock, task_log_success, task_log_error
from api.node.sysinfo.utils import parse_esysinfo
from api.node.messages import LOG_NODE_CREATE, LOG_NODE_UPDATE
# noinspection PyProtectedMember
from api.no... |
import urlparse
import os, sys, re
from flask import Flask, request, jsonify, abort, json, make_response
from msc_apps import *
tools_dir = os.environ.get('TOOLSDIR')
lib_path = os.path.abspath(tools_dir)
sys.path.append(lib_path)
data_dir_root = os.environ.get('DATADIR')
app = Flask(__name__)
app.debug = True
@app.... |
"""
homeassistant
~~~~~~~~~~~~~
Home Assistant is a Home Automation framework for observing the state
of entities and react to changes.
"""
import time
import logging
import threading
from collections import namedtuple
import datetime as dt
import homeassistant.util as util
logging.basicConfig(level=logging.INFO)
... |
# Copyright 2013 Rackspace Australia
#
# 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 in writi... |
# Licensed under an MIT open source license - see LICENSE
import numpy as np
import cPickle as pickle
from copy import deepcopy
from astropy import units as u
from astropy.wcs import WCS
import statsmodels.api as sm
from ..psds import pspec
from ..base_statistic import BaseStatisticMixIn
from ...io import common_typ... |
from __future__ import absolute_import, print_function
import concurrent.futures
import logging
import multiprocessing
import s.cached
_size = multiprocessing.cpu_count() + 2
@s.cached.func
def _pool():
logging.debug('new process pool, size: %s', _size)
return concurrent.futures.ProcessPoolExecutor(_size)
... |
from django.conf.urls import *
from django.conf import settings
from filebrowser.sites import site
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView, RedirectView
from django.views.generic.dates imp... |
"""
A place for internal code
Some things are more easily handled Python.
"""
import ast
import re
import sys
import platform
from .multiarray import dtype, array, ndarray
try:
import ctypes
except ImportError:
ctypes = None
IS_PYPY = platform.python_implementation() == 'PyPy'
if (sys.byteorder == 'little'... |
__all__ = ['matrix', 'bmat', 'mat', 'asmatrix']
import sys
import numeric as N
from numeric import concatenate, isscalar, binary_repr, identity
from numpy.lib.utils import issubdtype
# make translation table
_table = [None]*256
for k in range(256):
_table[k] = chr(k)
_table = ''.join(_table)
_numchars = '0123456... |
import bisect, sys
# This module keeps track of arbitrary "states" at any point of the code.
# A state is considered known if every path to the given point agrees on
# its state, otherwise it is None (i.e. unknown).
# It might be useful to be able to "freeze" the set of states by pushing
# all state changes to the... |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 02:30:46 2015
@author: Michael Currie
Methods to extract transaction data from the paypal extract file:
append_sales_as_deposits
append_invoices
append_TicketLeap_fees
+ one "private" method:
get_tables_from_mapping
"""
import petl as etl
import csv
def append_... |
"""
Histogram-related functions
"""
from __future__ import division, absolute_import, print_function
import operator
import numpy as np
from numpy.compat.py3k import basestring
__all__ = ['histogram', 'histogramdd', 'histogram_bin_edges']
def _hist_bin_sqrt(x):
"""
Square root histogram bin estimator.
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import eyed3
from eyed3.id3 import ID3_V2_4
from mutagen.mp3 import MP3
from mutagen.id3 import ID3, APIC, error
import hashlib
import os
from slugify import slugify
import pycurl
import re
import sys
import urllib
import urllib2
import json
from clint.textui import puts, ... |
# -*- coding: utf-8 -*-
"""
Jbosscli
"""
import json
import types
import requests
class Jbosscli(object):
"""Jbosscli"""
def __init__(self, controller, auth):
self.controller = controller
self.credentials = auth.split(":")
self.data = {}
self._fetch_controller_data()
def i... |
__all__ = ['atleast_1d','atleast_2d','atleast_3d','vstack','hstack',
'column_stack','row_stack', 'dstack','array_split','split','hsplit',
'vsplit','dsplit','apply_over_axes','expand_dims',
'apply_along_axis', 'tile', 'kron']
import numpy.core.numeric as _nx
from numpy.core.numeric impo... |
# encoding=utf-8
# vim: fenc=utf-8 et sw=4 ts=4 sts=4 ai
from __future__ import unicode_literals
import time
runstart_s = time.time()
import logging
logger = logging.getLogger()
logger.setLevel(logging.DEBUG) # DEBUG if verbose
syslog = logging.StreamHandler()
# formatter = logging.Formatter('%(asctime)s [%(mem_us... |
''' Interactive console for inspecting Kate's internals and playing about.
The console provides syntax highlighting by tokenizing the code using standard
library module tokenize.'''
#
# Copyright (C) 2006 Paul Giannaros <paul@giannaros.org>
# Copyright (C) 2012 Shaheed Haque <srhaque@theiet.org>
#
# This library is f... |
#!/usr/bin/env python2
"""
Retrieves files/directories from JGI through the curl api.
"""
import sys
import os
import re
import subprocess
import textwrap
import xml.etree.ElementTree as ET
from collections import defaultdict
import argparse
import tarfile
import gzip
# FUNCTIONS
def deindent(string):
"""
P... |
import logging
import os
import re
import shutil
import subprocess
import sys
from .constants import drivetypes
logger = logging.getLogger(__name__)
# Regex parser for the output of `mount` on OSX, which contains rows that looks like:
# /dev/disk1s1 on /Volumes/HP v125w (msdos, local, nodev, nosuid, noowners)
OSX_M... |
import sys
from getch import getch
commands = '><+-.,[]'
class BrainfuckInterpreter:
def __init__(self):
self.i = 0
self.p = 0
self.cells = [0]
@staticmethod
def find_matching_paren(source, c):
paren = 0
d = {'[':']', ']':'['}
for k in range(len(source)):
... |
import os.path
import re
import random
import time
from kvmagent import kvmagent
from kvmagent.plugins.imagestore import ImageStoreClient
from zstacklib.utils import jsonobject
from zstacklib.utils import http
from zstacklib.utils import log
from zstacklib.utils import shell
from zstacklib.utils import linux
from zsta... |
import unittest
from deepchem.feat import RobertaFeaturizer
import pytest
class TestRobertaFeaturizer(unittest.TestCase):
"""Tests for RobertaFeaturizer"""
@pytest.mark.torch
def setUp(self):
self.smiles = ["Cn1c(=O)c2c(ncn2C)n(C)c1=O", "CC(=O)N1CN(C(C)=O)C(O)C1O"]
self.long_molecule_smiles = [
... |
import json
from kwue.DB_functions.ingredient_db_functions import *
# def ingredients_from_list_to_dict(ep):
# wanted_list = ep['wanted_list']
# unwanted_list = ep['unwanted_list']
# wanted_list_dict = []
# unwanted_list_dict = []
# for wanted_item in wanted_list:
# wanted_list_dict.append(... |
# © 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0
import logging
from odoo.tests import common
_logger = logging.getLogger("aeat")
class TestL10nEsAeatModBase(common.SavepointCase):
accounts = {}
# Set 'debug' attribute to True to easy de... |
#!/usr/bin/env python
import roslib; roslib.load_manifest('reactivecontrol')
import rospy
from reactivecontrol.msg import IRdistance
from geometry_msgs.msg import Transform
from std_msgs.msg import Bool
class reactive_control:
"""
Class that controls the reactive control
"""
def __init__( self ):
#publi... |
# Copyright (c) 2015, 2016 by Rocky Bernstein
# Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org>
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
"""
Python 2 Generic bytecode scanner/deparser
This overlaps various Python3's dis module, but it can be run from
Python versions other than t... |
# Author Conor O'Kelly
"""
This package will create have a main function that takes the argument of an imdb code and a character dict
It will match the character in the movie to an actor using imdb. Then add gender and meta critic rating of actor
This will then read in a csv file containing data for characters
There... |
#__BEGIN_LICENSE__
# Copyright (c) 2015, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The xGDS platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance ... |
###############################################################################
#
# Chart - A class for writing the Excel XLSX Worksheet file.
#
# Copyright 2013-2018, John McNamara, jmcnamara@cpan.org
#
import re
import copy
from warnings import warn
from .shape import Shape
from . import xmlwriter
from .utility impo... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Camptocamp SA
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# l... |
# -*- coding: utf-8 -*-
import operator
from dateutil.relativedelta import relativedelta
from datetime import datetime, date
from .mixins.interval import WordableIntervalMixin
from .interval import BaseInterval, Interval
from .constants import MONTHS_PER_YEAR
class Period(WordableIntervalMixin, BaseInterval):
"... |
# -*- test-case-name: xmantissa.test.test_people -*-
import re
from itertools import islice
from string import uppercase
from zope.interface import implements
from twisted.python import components
from nevow import rend, athena, inevow
from nevow.taglibrary import tabbedPane
from epsilon import extime
from axiom ... |
# Copyright (c) 2016-present, Facebook, 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
# -*- coding: utf-8 -*-
import sys
import os
import argparse
import json
import logging
from penman.__about__ import __version__
from penman.model import Model
from penman import layout
from penman.codec import PENMANCodec
from penman import transform
# Names of functions allowed for ordering triples/branches; we c... |
import types
from datetime import date, datetime
from django import template
from django.utils.html import escape
from casexml.apps.case.models import CommCareCase
from django.template.loader import render_to_string
register = template.Library()
@register.simple_tag
def render_case(case):
if isinstance(case, base... |
import re
import os
from bs4 import BeautifulSoup
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from pages.models import Page
PEP_ZERO_TEMPLATE = 'pages/pep-zero.html'
def check_paths():
""" Checks to ensure our PEP_REPO_PATH is setup correctly """
if not hasattr... |
# encoding: utf-8
"""
Persian
Simple tool for Persian language localization in Python
Copyright (C) 2017-2020 Reza Kamalifard (mrkamalifard@gmail.com) and others
@rezakamalifard
MIT licensed
https://github.com/itmard/Persian
"""
import re
import urllib.parse
def convert_en_numbers(input_str):
"""
Converts E... |
import itertools
import os
import re
import time
from math import inf
from multiprocessing import Queue
from typing import Sequence, Any, Tuple, List, Dict, Optional
from .conversion import UnitConverter
from .tmcl import TMCLUnpack, TMCLPack, TMCLError, AxisParameters, Instructions, TMCLStatusMessage
from ...device.b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.