text stringlengths 12 6.59M |
|---|
"""Factory functions for exception handlers."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# abdt_exhandlers
#
# Public Functions:
# make_exception_message_handler
# make_exception_delay_h... |
# vim: sw=4 ts=4 sts=4 expandtab smarttab
# HXN fly-scan configuration
from hxnfly.bs import (FlyPlan1D, FlyPlan2D, FlyStep1D, maybe_a_table)
from hxnfly.hxn_fly import (Fly1D_MLL, Fly1D_ZP, Fly2D_MLL, Fly2D_ZP,
Fly1D_Diffraction, Fly2D_Diffraction)
# These define which scans can be done by which class:
# 1D s... |
#!/usr/bin/env python
import atexit
import contextlib
import errno
import platform
import re
import shutil
import ssl
import subprocess
import sys
import tarfile
import tempfile
import urllib2
import os
import zipfile
from config import is_verbose_mode
from env_util import get_vs_env
BOTO_DIR = os.path.abspath(os.pa... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import io
import logging
import re
import zipfile
import babelfish
import bs4
import charade
import requests
from . import Provider
from .. import __version__
from ..cache import region
from ..exceptions import InvalidSubtitle, ProviderNotAvailable, Provid... |
"""
Copyright [2009-2015] EMBL-European Bioinformatics Institute
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 a... |
'''
Scroll View
===========
.. versionadded:: 1.0.4
The :class:`ScrollView` widget provides a scrollable/pannable viewport that is
clipped at the scrollview's bounding box.
Scrolling Behavior
------------------
ScrollView accepts only one child, and applies a viewport/window to it
according to the :data:`scroll_x`... |
'''
Rom - the Redis object mapper for Python
Copyright 2013-2016 Josiah Carlson
Released under the LGPL license version 2.1 and version 3 (you can choose
which you'd like to be bound under).
Changing connection settings
============================
There are four ways to change the way that ``rom`` connects to Red... |
from django.core.management.base import BaseCommand
from django.utils import timezone
from event.models import Event, Participation, Frame, Comment, Question, Answer
from group.models import Group, Membership
from user.models import User
from tag.models import Tag
class Command(BaseCommand):
help = """
This is... |
import time
from copy import copy
from sfepy.base.base import (Struct, Container, OneTypeList, assert_,
output, get_default, basestr)
from functions import ConstantFunction, ConstantFunctionByRegion
class Materials(Container):
@staticmethod
def from_conf(conf, functions, wanted=... |
from sklearn import cross_validation
from readfacedatabases import *
# TODO: move to common?
def splitTrainTest(data1, data2, labels1, labels2, ratio):
assert len(data1) == len(data2)
assert len(labels1) == len(labels2)
assert len(labels1) == len(data1)
assert len(labels1) == len(labels2)
indexShuffle = np... |
import json
import requests
import os
from django.conf import settings
from django.contrib.sites.shortcuts import get_current_site
from django.template.loader import render_to_string
from django.core.mail import send_mail
from rest_framework.authtoken.models import Token
from urlparse import urlunparse
from malaria24... |
"""Track progress of completed DESI observations.
"""
from __future__ import print_function, division
import os.path
import numpy as np
import astropy.table
import astropy.units as u
import desimodel.io
import desiutil.log
import desisurvey.config
import desisurvey.utils
# Increment this value whenever a non-bac... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Comunitea Servicios Tecnológicos All Rights Reserved
# $Omar Castiñeira Saavedra <omar@pcomunitea.com>$
#
# This program is free software: you can redistribute it and/or modify
# it ... |
from __future__ import print_function
import sys, os
import yaml
from serial import Serial, SerialException
from time import sleep
#
# Logging util
#
def loginfo(*msg):
print("INFO:", *msg)
def logerr(*msg):
print("ERROR:", *msg, file=sys.stderr)
# The recipe gives simple implementation of a Discrete
# Pro... |
# IMPORTING THE REQUIRED MODULES
import ibm_db
import time
import os
import sys
from ibm_db import connect
from ibm_db import active
import datetime
import ConfigParser
from pubnub import Pubnub
import logging
LOG_FILENAME = 'logfile.log'
logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
# PUBNUB KEYS
... |
'''
Scroll View
===========
.. versionadded:: 1.0.4
The :class:`ScrollView` widget provides a scrollable/pannable viewport that is
clipped at the scrollview's bounding box.
Scrolling Behavior
------------------
ScrollView accepts only one child, and applies a viewport/window to it
according to the :data:`scroll_x` ... |
#!/usr/bin/env python
# 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 "Lice... |
from sfepy.base.base import *
from sfepy.base.la import cycle
try:
from enthought.mayavi import mlab
except ImportError:
mlab = None
def add_surf(obj, position, opacity=1.0):
surf = mlab.pipeline.surface(obj, opacity=opacity)
surf.actor.actor.position = position
return surf
def add_scalar_cut_pla... |
__author__ = 'Greg'
import pandas as pd
import gzip
import numpy as np
import lxml.etree as et
import itertools
import multiprocessing as mp
def recur_dictify(frame):
"""
h/t: http://stackoverflow.com/a/19900276/843419
:param frame: a pandas data frame
:return: a nested dictionary with the columns as... |
#!/usr/bin/env python
# Copyright 2017 Calico 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
import os, datetime, codecs, random, string, json, re, time, sqlite3, shutil
from flask import Flask, render_template, request, url_for, abort, redirect, send_from_directory, g, Response
from werkzeug import secure_filename
from functools import wraps
fp = open("claim_secret") # this needs to exist. Put a long random ... |
#!/usr/bin/env python
# coding=utf-8
# Filename: __version__.py
# pylint: disable=C0103
"""
Pep 386 compliant version info.
(major, minor, micro, alpha/beta/rc/final, #)
(1, 1, 2, 'alpha', 0) => "1.1.2.dev"
(1, 2, 0, 'beta', 2) => "1.2b2"
"""
version_info = (0, 9, 30, 'final', 0)
def _get_version(versio... |
#!/usr/bin/env python
"""
- look through events table, process what we're suppose to do
- can include building fee transactions, submitting govobjs to the network
"""
import sys
sys.path.append("lib")
from governance import GovernanceObject, Event
import libmysql
import config
import misc
import dashd
i... |
#!/usr/bin/python
"""functions to run first-level MRI analyses
"""
import matplotlib as mpl
# we do this because sometimes we run this without an X-server, and this backend doesn't need one
mpl.use('svg')
import argparse
import seaborn as sns
import pandas as pd
import numpy as np
import os
import warnings
import nibab... |
'''
Main "pipeline" script for the Legacy Survey (DECaLS, MzLS, BASS)
data reductions.
For calling from other scripts, see:
- :py:func:`run_brick`
Or for much more fine-grained control, see the individual stages:
- :py:func:`stage_tims`
- :py:func:`stage_image_coadds`
- :py:func:`stage_srcs`
- :py:func:`stage_fitbl... |
# Filename: __init__.py
"""
A collection of io for different kinds of data formats.
"""
import os.path
import numpy as np
from .evt import EvtPump # noqa
from .daq import DAQPump # noqa
from .clb import CLBPump # noqa
from .aanet import AanetPump # noqa
from .jpp import EventPump # noqa
from .ch import CHPump ... |
#!/usr/bin/env python
###################
"""
Workflow:
1. Fake data + animation only
--fake_data_segment=xxx --execution=0
2. Fake data + Gazebo. Set Gazebo to initial state of fake data segment so we'll execute the same thing.
--fake_data_segment=xxx --execution=1
This is just so we know the robot won't d... |
#!/usr/bin/env python
import sys
import re
import requests
from requests.exceptions import (
ConnectionError,
Timeout
)
BUG_PREFIX_REGEX = r'\[bug (\d+)\]'
def are_lines_not_more_than_79_chars(contents):
long_lines = [line for line in contents if len(line) > 79]
if long_lines:
print('Error:... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from tkinter import Tk, ttk, N, S, E, W, StringVar, Menu
from tkinter import font, filedialog, messagebox
from ConfigReader import configReader
import SpudScale
import threading
UPDATETIME = 0.1
class GUI():
def __init__(self):
# init Tk
root = Tk()
... |
'''
Main "pipeline" script for the Legacy Survey (DECaLS, MzLS, BASS)
data reductions.
For calling from other scripts, see:
- :py:func:`run_brick`
Or for much more fine-grained control, see the individual stages:
- :py:func:`stage_tims`
- :py:func:`stage_refs`
- :py:func:`stage_outliers`
- :py:func:`stage_halos`
- ... |
# from eventlet import monkey_patch
# monkey_patch()
from flask import Flask, request, current_app, render_template, json
#from flask_socketio import SocketIO, emit
from functools import wraps
#import eventlet
import json
import re
import random
import time
from urllib import parse
app = Flask(__name__)
app.config['S... |
# coding=utf-8
# Filename: aanet.py
# pylint: disable=locally-disabled
"""
Pump for the Aanet data format.
"""
from __future__ import division, absolute_import, print_function
from km3pipe import Pump
from km3pipe.dataclasses import HitSeries
from km3pipe.logger import logging
import os.path
log = logging.getLogger(... |
"""Graphical user interface classes and functions"""
# Copyright (c) 2001-2002 Andrew Straw. Distributed under the terms of the
# GNU Lesser General Public License (LGPL).
####################################################################
#
# Import all the necessary packages
#
#############################... |
#!/usr/bin/env python
import example_py
import struct
import ctypes
buf = struct.pack('BBBB', 0x41, 0x42, 0x43, 0x44)
print 'python:'
print buf
e = example_py.ExampleClass()
print 'c++:'
e.printBuffer(ctypes.cast(ctypes.c_char_p(buf), ctypes.POINTER(ctypes.c_ubyte)), len(buf))
|
import numpy as np
import pandas as pd
import scipy
from scipy import stats, spatial
import matplotlib as mpl
import matplotlib.pyplot as plt
from distutils.version import LooseVersion
import nose.tools as nt
import numpy.testing as npt
from numpy.testing.decorators import skipif
from . import PlotTestCase
from .. i... |
#!/usr/bin/python
import pandas as pd
import numpy as np
import csv
import json
import sys
import argparse
import multiprocessing as mp
import glob
import os
from functools import partial
import subprocess
from sofa_config import *
from sofa_print import *
def list_downsample(list, plot_ratio):
new_list = []
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from irc3 import plugin
from irc3 import utils
from irc3 import rfc
from irc3.dec import event
from irc3.utils import IrcString
from collections import defaultdict
__doc__ = '''
==============================================
:mod:`irc3.plugins.userlist` Us... |
from __future__ import annotations
import logging
logger = logging.getLogger("dials.extensions.dispersion_spotfinder_threshold_ext")
class DispersionSpotFinderThresholdExt:
"""Extensions to do dispersion threshold."""
name = "dispersion"
@staticmethod
def phil():
from libtbx.phil import pa... |
#!/usr/bin/env python
import sys
from splunklib.searchcommands import \
dispatch, StreamingCommand, Configuration, Option, validators
@Configuration()
class %(command.title())Command(StreamingCommand):
""" %(synopsis)
##Syntax
%(syntax)
##Description
%(description)
"""
def stream... |
'''
Main "pipeline" script for the Legacy Survey (DECaLS, MzLS, BASS)
data reductions.
For calling from other scripts, see:
- :py:func:`run_brick`
Or for much more fine-grained control, see the individual stages:
- :py:func:`stage_tims`
- :py:func:`stage_refs`
- :py:func:`stage_outliers`
- :py:func:`stage_halos`
- ... |
from datetime import datetime
import bson
import flask
import functools
import logging
import mongoengine as me
import pymongo
import re
import redis
import time
import rmc.shared.constants as c
import rmc.shared.secrets as s
import rmc.models as m
import rmc.shared.util as util
import rmc.shared.rmclogger as rmclogge... |
# coding=utf-8
from __future__ import division, absolute_import, print_function, unicode_literals
from collections import deque, namedtuple
class Connection(object):
def __init__(self, id):
self.id = id
self.port = None
self.hostname = None
self.buffers = []
def __repr__(self):... |
"""Render the differences between two data files as text."""
import argparse
import copy
import json
import shutil
import sys
import mel.rotomap.format
def setup_parser(parser):
parser.add_argument(
'FILE',
type=argparse.FileType(),
nargs=2,
help="Path to the rotomap json file."... |
#!/usr/bin/env python
"""Lightweight server to start/stop controllers."""
import sys
import os
from time import sleep
from math import fabs
import traceback
try:
import zmq
except ImportError:
sys.stderr.write("ERROR: Failed to import zmq. Is it installed?")
raise
try:
import yaml
except ImportError,... |
# This file is part of the MapProxy project.
# Copyright (C) 2010 Omniscale <http://omniscale.de>
#
# 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... |
import discord
from discord.ext import commands
from discord.permissions import Permissions
from .utils import checks
import asyncio
from .utils.dataIO import dataIO
import os
client = discord.Client()
class EventBets:
"""Create an event which people can bet on"""
def __init__(self, bot):
self.bot = ... |
"""Edit a 'rotomap' series of images."""
import copy
import cv2
import mel.lib.common
import mel.lib.image
import mel.lib.math
import mel.lib.ui
import mel.rotomap.display
def setup_parser(parser):
parser.add_argument(
'--images',
nargs='+',
action='append',
required=True,
... |
import inspect
import logging
import math
import sys
import threading
import time
import warnings
from functools import wraps
def retry_on_exception(tries=6, delay=1, backoff=2, max_delay=32):
'''
Decorator for implementing exponential backoff for retrying on failures.
tries: Max number of tries to execu... |
"""Some helper functions"""
from flask import abort, session, request, make_response
from maproulette.models import Challenge, Task, TaskGeometry
from maproulette.challengetypes import challenge_types
from functools import wraps
import json
from maproulette import app
from shapely.geometry import MultiPoint, asShape, P... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Other methods in my package
"""
import string, random, hashlib
DEFAULT_PREFIX = 'abc_'
################################
## UTILITIES
def string_generator(size=32, \
chars=string.ascii_uppercase + string.ascii_lowercase + string.digits):
""" Create a random ... |
"""Edit a 'rotomap' series of images.
In all modes:
Press 'q' to quit.
Press left for previous image, right for next image.
Press up for previous map, down for next map.
Ctrl-click on a point to zoom in on it.
Press space to restore original zoom.
Mode selection:
Press '1' for mole edit mode... |
"""
This module contains useful Javascript utility methods for base_case.py
These helper methods SHOULD NOT be called directly from tests.
"""
import re
import requests
import time
from selenium.common.exceptions import WebDriverException
from seleniumbase import config as sb_config
from seleniumbase.common import deco... |
#!/usr/bin/python
import binascii, re, json, copy, sys
from bitcoin.main import *
### Hex to bin converter and vice versa for objects
def json_is_base(obj, base):
alpha = get_code_string(base)
if isinstance(obj, (str, unicode)):
for i in range(len(obj)):
if alpha.find(obj[i]) == -1:
... |
import sys
import os
import subprocess
import threading
import wsgiserver
from Maraschino import app
from Logger import maraschinoLogger
from apscheduler.scheduler import Scheduler
FULL_PATH = None
RUNDIR = None
ARGS = None
DAEMON = False
PIDFILE = None
VERBOSE = True
LOG_FILE = None
PORT = None
DATABASE = None
INIT_L... |
from requests.exceptions import HTTPError
from iron_cache import IronCache
try:
from django.utils.encoding import force_unicode
except ImportError: # Python 3.*
from django.utils.encoding import force_text as force_unicode
from django.contrib.sessions.backends.base import SessionBase, CreateError
from iron_ses... |
from pyspark.context import SparkContext
from pyspark.sql.dataframe import DataFrame
from pyspark.rdd import RDD
from pyspark.sql import SQLContext
from h2o.frame import H2OFrame
import h2o
from pysparkling.utils import FrameConversions as fc
import warnings
from pkg_resources import resource_filename
def _monkey_patc... |
#!/usr/bin/env python3
from cereal import car
from selfdrive.config import Conversions as CV
from selfdrive.car.toyota.values import Ecu, ECU_FINGERPRINT, CAR, TSS2_CAR, FINGERPRINTS, CarControllerParams
from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, is_ecu_disconnected, gen_empty_fing... |
"""
Task:
Do fancy shit.
"""
# Import Built-Ins
import logging
import socket
import time
import json
# Import Homebrew
from bitex.api.bitstamp import API
from bitex.http.client import Client
log = logging.getLogger(__name__)
class BitstampHTTP(Client):
def __init__(self, server_addr, key='', secret='', key_fi... |
#!/usr/bin/python
# coding:utf-8
# Author: ASU --<andrei.suiu@gmail.com>
# Purpose: utility library for >=Python3.6
import collections
import io
import itertools
import math
import numbers
import pickle
import struct
import sys
import threading
from abc import ABC
from collections import defaultdict, abc
from functools... |
def create_steer_command(packer, steer, steer_req, raw_cnt):
"""Creates a CAN message for the Toyota Steer Command."""
values = {
"STEER_REQUEST": steer_req,
"STEER_TORQUE_CMD": steer,
"COUNTER": raw_cnt,
"SET_ME_1": 1,
}
return packer.make_can_msg("STEERING_LKA", 0, values)
def create_lta_st... |
from django import forms
from django.shortcuts import get_object_or_404, render, redirect
from django.contrib.contenttypes.models import ContentType
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger, InvalidPage
from django.core.cache import caches
from django.core.cache.backends.base import Inva... |
"""
bjson/connection.py
Asynchronous Bidirectional JSON-RPC protocol implementation over TCP/IP
Copyright (c) 2010 David Martinez Marti
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following condi... |
# -*- coding: utf8 -*-
"""
Module displaying the number of unread messages
on an IMAP inbox (configurable, may also be a
comma-separated list of IMAP folders).
@author obb
"""
import imaplib
from time import time
class Py3status:
# available configuration parameters
cache_timeout = 60
criterion = 'UNS... |
# -*- coding: utf-8 -*-
from functools import partial
from blackgate.executor_pools import ExecutorPools
from blackgate.circuit_beaker import NoCircuitBeaker, InProcessCircuitBeaker, get_circuit_beaker
class Component(object):
def __init__(self):
self.urls = []
self.pools = ExecutorPools()
... |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 24 10:00:14 2014
@author: Michael Winkler, Christian Münker
"""
from __future__ import print_function, division
import os, sys
import databroker as db
# TODO: need to delete unused imports from memory?
# TODO: replace __import__ by importlib.import_module()
class Filte... |
#!/usr/bin/env python3
from netcdfTools import *
import argparse
import numpy as np
import sys
from utilities import writeLog
#=======================================================================
'''A script to transform 3D numpy array to netCDF.
The 3D array is expected as the S file of the npz archive. The othe... |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2016-2017 CNRS
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2016-2019 CNRS
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... |
#
# X.509 certificate Request Message Format (CRMF) syntax
#
# ASN.1 source from:
# http://tools.ietf.org/html/rfc2511
#
# Sample captures could be obtained with OpenSSL
#
from pyasn1.type import tag, namedtype, namedval, univ, constraint, char,useful
from pyasn1_modules.rfc2459 import *
from pyasn1_modules import rfc2... |
"""Datasets for TOVS/ATOVS
"""
import io
import tempfile
import subprocess
import datetime
import logging
import gzip
import shutil
import abc
import numpy
import netCDF4
import dateutil
try:
import coda
except ImportError:
logging.warn("Unable to import coda, won't read IASI EPS L1C")
from .. import ... |
"""Datasets for TOVS/ATOVS
"""
import io
import tempfile
import subprocess
import datetime
import logging
import gzip
import shutil
import abc
import pathlib
import dbm
import numpy
import scipy.interpolate
import netCDF4
import dateutil
import progressbar
try:
import coda
except ImportError:
logging.warn("... |
# coding: utf-8
# Copyright (C) 2014 by Ronnie Sahlberg<ronniesahlberg@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
#... |
'''
Created on Jan 29, 2016
@author: Martin Koerner <info@mkoerner.de>
'''
# https://github.com/Mimino666/langdetect
from langdetect import detect
from bs4 import BeautifulSoup
import json
import urllib
import argparse
import langdetect
import html2text
from markdown import markdown
import signal
# generate help t... |
#!/usr/bin/env python
# =============================================================================
# file = api.py
# description = System Information API
# author = GR <https://github.com/shortdudey123>
# create_date = 2014-07-25
# mod_date = 2014-07-25
# version = 0.1
# usage =
# notes =
# python_ver = 2.7.6
# ===... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os.path
import warnings
import re
import pygccxml
from pygccxml import parser
from pygccxml import declarations
from module import Module
from typehandlers.codesink import FileCodeSink, CodeSink, NullCodeSink
import typehandlers.base
from typehandlers.base imp... |
# Copyright 2020 The FedLearner 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 base64
import json
import requests
import urllib
from app import redis
import config
class ApiError(Exception):
pass
class AuthError(ApiError):
pass
def cookies():
cookies = redis.get(config.COOKIE_KEY)
if not cookies:
raise AuthError('could not load cookies')
return json.loads... |
class ShiftValidateException(Exception):
"""
Main exception category
All package exceptions extend that to allow you to catch exception by
component in a general way
"""
pass
class PropertyExists(ShiftValidateException, ValueError):
"""
Property exists
Exception indicates certain ... |
from rest_framework import serializers
from django.core.exceptions import ValidationError
from rest_framework.authtoken.models import Token
import app
##############################
# --------- Users! --------- #
##############################
class ChronosUserSerializer(serializers.ModelSerializer):
class Meta:
... |
#!/usr/bin/env python
"""A systray app to set the JACK configuration from QjackCtl presets via DBus.
"""
import logging
import os
import sys
os.environ['NO_AT_BRIDGE'] = "1" # noqa
import gi
gi.require_version('Gtk', '3.0') # noqa
from gi.repository import Gtk, GObject
from gi.repository.GdkPixbuf import Pixbuf
f... |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... |
from feedly.feeds.aggregated_feed.base import AggregatedFeed
from feedly.serializers.aggregated_activity_serializer import \
NotificationSerializer
from feedly.storage.redis.timeline_storage import RedisTimelineStorage
import copy
import datetime
import json
import logging
logger = logging.getLogger(__name__)
cl... |
#!/usr/bin/python
#
# Copyright 2011 Friday Film Club. All Rights Reserved.
"""Question and Answer API - this contains the main quiz logic."""
__author__ = 'adamjmcgrath@gmail.com (Adam McGrath)'
from datetime import datetime
import logging
import auth
from datetime import datetime
from functools import partial
imp... |
# Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012 Andrey Golovizin #
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, c... |
# Copyright 2007 Andrey Golovizin
#
# This file is part of pybtex.
#
# pybtex is free software; you can redistribute it and/or modify
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# pybtex i... |
from pychecker2.Check import Check
from pychecker2.Check import Warning
from pychecker2 import symbols
from pychecker2.util import BaseVisitor, parents, type_filter
from compiler.misc import mangle
from compiler import ast, walk
_ignorable = {}
for ignore in ['repr', 'dict', 'class', 'doc', 'str']:
_ignorable['_... |
# generic solver
import functools
import pdb
from ..Tx import Tx, TxIn, TxOut
from ...key import Key
from ...ui import address_for_pay_to_script, standard_tx_out_script
from ..script.checksigops import parse_signature_blob
from pycoin import ecdsa
from pycoin import encoding
from pycoin.tx.pay_to import ScriptMultis... |
from exporters.logger.base_logger import StatsManagerLogger
from exporters.pipeline.base_pipeline_item import BasePipelineItem
class BaseStatsManager(BasePipelineItem):
def __init__(self, options):
super(BaseStatsManager, self).__init__(options)
self._init_stats_dict()
self.logger = StatsM... |
# -*- coding: utf-8 -*-
"""
PYCROSSCALL
Calling routines in Windows DLLs from Python scripts running on unixlike systems
https://github.com/s-m-e/pycrosscall
pycrosscall/wine.py: Class(es) for managing wineserver
Required to run on platform / side: [UNIX]
Copyright (C) 2017 Sebastian M. Ernst <ernst@pleiszenbur... |
import numpy as np
import openmdao.api as om
from pycycle.thermo.thermo import Thermo, ThermoAdd
from pycycle.thermo.cea.species_data import janaf
from pycycle.constants import AIR_FUEL_ELEMENTS, AIR_ELEMENTS
from pycycle.flow_in import FlowIn
class MixImpulse(om.ExplicitComponent):
"""
Compute the combined... |
#
# Kiwi: a Framework and Enhanced Widgets for Python
#
# Copyright (C) 2005-2006 Async Open Source
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, ... |
# BEGIN_COPYRIGHT
#
# Copyright 2009-2016 CRS4.
#
# 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 agree... |
"""
Boolean Expression Parsing
Exceptions:
BoolExprParseError
Interface Functions:
parse
"""
# pylint: disable=C0103
from warnings import warn
from pyeda.parsing.lex import RegexLexer, action
from pyeda.parsing.token import (
KeywordToken, NameToken, IntegerToken, OperatorToken, PunctuationToken,
)
cl... |
import time
import socket
import logging
import json
import os
from dispatch import receiver
from stoppable import StoppableLoopThread
import rlp
import signals
from peer import Peer
DEFAULT_SOCKET_TIMEOUT = .5
logger = logging.getLogger(__name__)
def is_valid_ip(ip): # FIXME, IPV6
return ip.count('.') == 3
... |
import pyexcel as pe
import sys
PY2 = sys.version_info[0] == 2
if PY2:
from StringIO import StringIO as BytesIO
else:
from io import BytesIO
FILE_TYPE_MIME_TABLE = {
"csv": "text/csv",
"tsv": "text/tab-separated-values",
"csvz": "application/zip",
"tsvz": "application/zip",
"ods": "app... |
# No shebang line, this module is meant to be imported
#
# Copyright 2014 Ambient Entertainment GmbH & Co. KG
# Copyright 2014 Oliver Palmer
#
# 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
#
... |
from model import cosine_sim
from evaluation import encode_data
import torch
import heapq
import scipy
import copy
def select_margin(model, train_loader):
img_embs, cap_embs = encode_data(model, train_loader)
scores = []
for i in range(0, len(img_embs), 128):
batch_range = min(128, len(img_embs) ... |
# No shebang line, this module is meant to be imported
#
# Copyright 2014 Ambient Entertainment GmbH & Co. KG
# Copyright 2014 Oliver Palmer
#
# 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
#
... |
from scriptworker.exceptions import ScriptWorkerTaskException
from scriptworker.constants import STATUSES
class TaskVerificationError(ScriptWorkerTaskException):
def __init__(self, msg):
super(TaskVerificationError, self).__init__(
msg, exit_code=STATUSES['malformed-payload']
)
class... |
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.http import Http404
from django.shortcuts import render, get_object_or_404, render_to_response
from django.views import generic
from django.db import connection, transaction
from django.contrib import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.