text stringlengths 17 737k |
|---|
# Copyright 2011-2013 Colin Scott
#
# 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 wri... |
"""
Create a wheel (.whl) distribution.
A wheel is a built archive format.
"""
import csv
import hashlib
import os
import subprocess
import warnings
import shutil
import json
import wheel
try:
import sysconfig
except ImportError: # pragma nocover
# Python < 2.7
import distutils.sysconfig as sysconfig
i... |
import os.path as op
SEVEN_DAYS = 60 * 60 * 24 * 7
# import cachetools
from bioservices import KEGG
kegg = KEGG()
import io
def download_kegg_gene_metadata(organism_code, gene_id, outdir='', force_rerun=False):
"""Download the KEGG flatfile for a KEGG ID and return the path.
Args:
organism_code: KEGG... |
#!/bin/bash -
# If you have PyPy 1.6+ in a directory called pypy alongside pox.py, we
# use it.
# Otherwise, we try to use a Python interpreter called python2.7, which
# is a good idea if you're using Python from MacPorts, for example.
# We fall back to just "python" and hope that works.
''''echo -n
export OPT="-O"
e... |
import numpy as np
from pystella.rf.rad_func import Lum2MagBol
from pystella.util.phys_var import phys
class Popov:
def __init__(self, name, R, M, Mni, E):
"""Creates a Popov's light curves model.
Required parameters: name, radius in R_sun, mass in M_sun."""
self.name = name
self... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2018, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
from exa import DataFrame
import numpy as np
import pandas as pd
from exatomic import plotter
class Tensor(DataFrame):
"""
The tensor dataframe.
+---------------+-----... |
"""Methods for importing files containing 2d precipitation fields.
The methods in this module implement the following interface:
import_xxx(filename, optional arguments)
where xxx is the name (or abbreviation) of the file format and filename is the
name of the input file.
The output of each method is a three-elem... |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from rest_framework import authentication, exceptions
from rest_framework.compat import is_authenticated
from rest_framework.exceptions import APIException
from rest_framework.pagination... |
from django.contrib import admin
from subcollections.models import Collection, Syndication
class CollectionAdmin(admin.ModelAdmin):
list_display = ('id', 'title', 'is_public', 'is_syndicated', 'updated')
search_fields = ['title', 'description', 'author']
raw_id_fields = ('items',)
readonly_fields = (... |
#!/usr/bin/env python3
# Copyright (C) 2011 Victor Semionov
# 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
# ... |
# module pyparsing.py
#
# Copyright (c) 2003-2016 Paul T. McGuire
#
# 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 u... |
# Copyright 2019 Google 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 agreed to in writing, ... |
import subprocess
import os
import time
# LXC Python Library
# for compatibility with LXC 0.8 and 0.9
# on Ubuntu 12.04/12.10/13.04
# Author: Elie Deloumeau
# Contact: elie@deloumeau.fr
# The MIT License (MIT)
# Copyright (c) 2013 Elie Deloumeau
# Permission is hereby granted, free of charge, to any person obtainin... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
__version__ = '0.1.0'
MACHINA_VANILLA_APPS = [
'machina',
'machina.apps.forum',
'machina.apps.forum_conversation',
'machina.apps.forum_conversation.forum_attachments',
'machina.apps.forum_conversation.forum_polls',
'ma... |
"""
State Space Analysis using the Kalman Filter
References
-----------
Durbin., J and Koopman, S.J. `Time Series Analysis by State Space Methods`.
Oxford, 2001.
Hamilton, J.D. `Time Series Analysis`. Princeton, 1994.
Harvey, A.C. `Forecasting, Structural Time Series Models and the Kalman Filter`.
Cambrid... |
import datetime
import json
import pytz
from django.core.exceptions import ValidationError
from django.core.mail import mail_admins
from herders.models import Summoner
from .models import *
from .com2us_parser import get_monster_from_id
from .com2us_mapping import inventory_type_map, timezone_server_map, summon_sour... |
#! /usr/bin/env python
# -*- python -*-
# -*- coding: utf-8 -*-
from __future__ import division
import puc
class Units(puc.Frame):
def __init__(self, parent: puc.Frame, controller: puc.Tk):
puc.Frame.__init__(self, parent)
self.controller = controller
self.data_change = False # if ther... |
# -*- encoding: utf-8 -*-
# Copyright (c) 2012 Rackspace
# flake8: noqa
# 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 ... |
#------------------------------------------------------------------------------
# Copyright 2013 Esri
# 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/LICENS... |
import sys
import os.path
import csv
import math
import types
from collections import defaultdict, Iterable
import itertools
class Apriori:
def __init__(self, data, minSup, minConf):
self.dataset = data
self.transList = defaultdict(list)
self.freqList = defaultdict(int)
self.itemse... |
"""
Startmigration command, version 2.
"""
import sys
import os
import re
import string
import random
import inspect
import parser
from optparse import make_option
try:
set
except NameError:
from sets import Set as set
from django.core.management.base import BaseCommand
from django.core.management.color impo... |
# -*- coding: utf-8 -*-
import csv
import itertools
import os
import random
import re
import six
import yaml
from geodata.addresses.units import Unit
from geodata.address_expansions.abbreviations import abbreviate
from geodata.address_expansions.address_dictionaries import address_phrase_dictionaries
from geodata.add... |
import random
from sympy.core.basic import Basic
from sympy.core.compatibility import is_sequence, as_int
from sympy.core.function import count_ops
from sympy.core.decorators import call_highest_priority
from sympy.core.singleton import S
from sympy.core.symbol import Symbol
from sympy.core.sympify import sympify
from... |
#! /usr/bin/env python
import sys
import cPickle as pickle
import os.path
def csv_parser(infile):
'''Parse a csv file and return index and values dictionary
File must have a header with no first column
The rest of the file has an index value in first column
After index there are the same number of fields as heade... |
#!/usr/bin/env python
#
# upgrade_tests.py: test the working copy upgrade process
#
# Subversion is a tool for revision control.
# See http://subversion.apache.org for more information.
#
# ====================================================================
# Licensed to the Apache Software Foundation (ASF) und... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This is a configuration File for the shadowserver parser
Mappings are "straight forward" each mapping is a dict
of at least three keys:
1) required fields:
the parser will... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 NTT
# 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/LICEN... |
from django.contrib.sites.models import Site
from livesettings import config_value
from l10n.utils import moneyfmt
from product.models import ProductVariation, Option, split_option_unique_id, \
ProductPriceLookup, OptionGroup, Discount, \
NullDiscoun... |
# -*- coding: UTF=8 -*-
import os
import sys
import shutil
import unittest
import tomoe
class TomoeDictTest(unittest.TestCase):
def testCopy(self):
dict_modules = os.getenv('DICT_MODULES').split()
for dest_dict_name in dict_modules:
if dest_dict_name == "xml":
if os.acc... |
import requests, datetime
from flask import session
import globs
def count():
return 1
def cyclemotto():
try:
session['i']
except:
session['i'] = 0
else:
session['i'] += 1
s = []
s.append("Paste a Google Spreadsheet URL and start pipulating.")
s.append("Pipulate is a Free and Open Source app... |
import os
import re
import json
import requests
import logging
import hglib
import urllib
import traceback
from xml.etree import ElementTree
from xml.dom import minidom
from datetime import datetime
from django.db import transaction
from django.db import models
from django.utils import timezone
from django.utils.six ... |
#
# 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... |
from __future__ import unicode_literals
from utils import CanadianScraper, CanadianPerson as Person
import csv
import json
import math
import re
import lxml.html
import requests
import scrapelib
from pupa.utils import get_pseudo_id
from six import StringIO
from six.moves.urllib.parse import parse_qs, urlparse, urlspl... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This is a "generic" parser for a lot of shadowserver feeds.
It depends on the configuration in the file "config"
which holds information on how to treat certain shadowserverfeed... |
#!/usr/bin/env python
#
# @file writeHeader.py
# @brief Create the header file for an object
# @author Sarah Keating
#
import sys
import fileHeaders
import generalFunctions
import strFunctions
import writeListOfHeader
import createNewElementDictObj
import writeCHeader
def writeConstructors(element, package, output... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 Thomas Voegtlin
#
# 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... |
#!/usr/bin/env python
"""
This module implements more advanced transformations.
"""
from __future__ import division
__author__ = "Shyue Ping Ong, Stephen Dacek"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
__date__ = "Jul... |
import os, sys, re, json
import platform
import shutil
from datetime import datetime
is_verbose = False
class MyEncoder(json.JSONEncoder):
def default(self, obj):
from transaction import Transaction
if isinstance(obj, Transaction):
return obj.as_dict()
return super(MyEncoder, s... |
#!/usr/bin/python
#
# Copyright 2012 Google Inc. 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 b... |
#!/usr/bin/env python
"""pyrg - colorized Python's UnitTest Result Tool"""
from ConfigParser import ConfigParser
from subprocess import Popen, PIPE
from select import poll, POLLIN
from optparse import OptionParser
import sys
import re
import os
__version__ = '0.2.3dev'
__author__ = 'Hideo Hattroi <hhatto.jp@gmail.com>... |
#!/usr/bin/env python
import os
import sys
import subprocess
import re
#justPrintCommands = False
def cmd(cmd_str_from_user, farm_queue=False, output_head=None, just_print_commands=False, outputFile = None, waitID = None, jobName = None, die_on_fail = False):
"""if farm_queue != False, submits to queue, other
di... |
from django import forms
from django.db import models
from .widgets import MarkdownTextarea
class MarkdownFormField(forms.fields.CharField):
def __init__(self, *args, **kwargs):
kwargs['widget'] = kwargs.pop('widget', MarkdownTextarea)
super(MarkdownFormField, self).__init__(*args, **kwargs)
cl... |
import sys
import os
import errno
import warnings
import inspect
import re
import collections
import weakref
def Initial(*args):
return SelfExporter.default_model.initial(*args)
def MatchOnce(pattern):
cp = as_complex_pattern(pattern).copy()
cp.match_once = True
return cp
# Internal helper to implem... |
import builtins
from math import floor, log10
import re
import shutil
import sys
import numpy as np
import pandas as pd
import pln.ctr
from pln.terminal import ansi
from . import *
#-------------------------------------------------------------------------------
# FIXME: We need a proper cascading configuratio... |
"""
Contains classes controlling wizards for making new maps
"""
import tkinter as tk
import mathsmap.colours as colours
class Wizard:
"""
A base class for all wizards in this project
"""
def clear(self):
"""
Remove all current widgets from top level of wizard
"""
for c... |
from pysb import ComponentSet
import pysb.core
import inspect
import numpy
import cStringIO
__all__ = ['alias_model_components', 'rules_using_parameter']
def alias_model_components(model=None):
"""Make all model components visible as symbols in the caller's global namespace"""
if model is None:
model ... |
"""
Implement the command-line tool interface.
"""
from __future__ import unicode_literals
import argparse
import os
import sys
from xml.etree import cElementTree
import diff_cover
from diff_cover.diff_reporter import GitDiffReporter
from diff_cover.git_diff import GitDiffTool
from diff_cover.git_path import GitPathToo... |
configure_flags = [
'--disable-mtp',
'--disable-daap',
'--disable-ipod',
'--disable-boo',
'--disable-gnome',
'--disable-docs',
'--enable-osx'
]
package = {
'name': 'banshee-1',
'version': '1.5.2',
'sources': [],
'prep': [
'cd ../../../../..',
],
'build': [
'cp configure.ac configure.ac.orig',
'gr... |
import asyncio
import os
import pymongo
import semver
import virtool.db.history
import virtool.db.otus
import virtool.db.processes
import virtool.db.utils
import virtool.errors
import virtool.github
import virtool.http.utils
import virtool.otus
import virtool.processes
import virtool.references
import virtool.utils
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
gallerize
~~~~~~~~~
Create a static HTML/CSS image gallery from a bunch of images.
See README for details.
:Copyright: 2007-2013 Jochen Kupperschmidt
:License: MIT, see LICENSE for details.
"""
from __future__ import print_function
import argparse
import codecs
fro... |
"""Filter design."""
import math
import operator
import warnings
import numpy
import numpy as np
from numpy import (atleast_1d, poly, polyval, roots, real, asarray,
resize, pi, absolute, logspace, r_, sqrt, tan, log10,
arctan, arcsinh, sin, exp, cosh, arccosh, ceil, conjugate,
... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Rackspace
# 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-... |
# Copyright 2017 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import argh
import numpy as np
import matplotlib.pyplot as plt
from chemreac.integrate import run
from chemreac.chemistry import Reaction, ReactionSystem
"""
Demo of non-linear fit to rate of binary reaction.
(e.g. stopped flow where one ... |
#! /usr/bin/env python
# Brokers communication between HydroTrend and Dakota through files.
# Mark Piper (mark.piper@colorado.edu)
import sys
import os
import re
import shutil
from subprocess import call
import numpy as np
def read(output_file):
'''
Reads a column of text containing HydroTrend output. Retur... |
#!/usr/bin/env python
import sys, os, subprocess, numpy
if len(sys.argv) not in [5,6,7]:
print("usage: " + sys.argv[0] + " cutoff_start cutoff_end" + \
" c13_percentage log10_samples [task_num] [plot]")
exit(1)
make_plot = True if sys.argv[-1] == "plot" else False
if make_plot:
del sys.argv[-1]
... |
""" Command line configuration parser """
import sys
import os.path
import argparse
import ConfigParser
def parse():
""" Parse command line options """
parser = argparse.ArgumentParser(
description='Dynamic DynamoDB - Auto provisioning AWS DynamoDB')
parser.add_argument(
'-c', '--config',
... |
import os
import sys
import glob
import time
import traceback
from PythonQt import QtGui
_messageTypes = {}
def loadMessageTypes(typesDict, typesName):
originalSize = len(_messageTypes)
for name, value in typesDict.iteritems():
if hasattr(value, '_get_packed_fingerprint'):
_messageTypes[... |
"""Render views from configurations."""
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
from ..models import Job
@view_config(route_name='home', renderer='../templates/home.jinja2')
def home_view(request):
"""On initial load, shows search bar. On query submit, loads results.""... |
version = "0.3.2"
|
"""
mbed CMSIS-DAP debugger
Copyright (c) 2016 ARM Limited
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 o... |
#
# 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 us... |
# -*- coding: utf-8 -*-
import datetime
import os
import shutil
import sys
import tempfile
from ev_transpose import Entry
from ev_transpose.compat import StringIO
from ev_transpose.tests import TEST_DATA
from ev_transpose.tests import unittest
class PatchedStderrTestCase(unittest.TestCase):
def setUp(self):
... |
# -*- coding: utf-8 -*-
#########################################################################
# #
# #
#########################################################################
... |
from typing import Callable, Dict
from pathlib import Path
from PyQt5 import QtWidgets, Qsci, QtGui
class CodeEditor(QtWidgets.QMainWindow):
""""""
NEW_FILE_NAME = "Untitled"
def __init__(self):
""""""
super().__init__()
self.new_file_count = 0
self.editor_path_map: Dict... |
import tak.ptn
import tak.train
import argparse
import csv
import os
import sys
import time
import numpy as np
import tensorflow as tf
FLAGS = None
class TakModel(object):
def __init__(self, size):
self.size = size
fshape = tak.train.feature_shape(size)
_, _, fplanes = fshape
fcount = fplanes * s... |
#-- coding: utf-8 --
import sys,os
reload(sys)
sys.setdefaultencoding('utf-8')
import collections
from PIL import Image, ImageOps, ImageDraw, ImageFont
code_2_icono = collections.defaultdict(lambda : '38')
kor_2_eng = collections.defaultdict(lambda : 'UNKNOWN')
code_2_icono['SKY_O00'] = ['38']
code_2_icono['SKY_O0... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys, getopt, re, os
try:
from splinter import Browser
except:
print "Please install Splinter: http://splinter.readthedocs.org/en/latest/install.html"
sys.exit();
import getpass
from splinter.request_handler.status_code import HttpResponseError
def main(argv):
em... |
"""
Perform expensive calculations based on user interactions while keeping the GUI
responsive. This makes use of asynchronous programming tools in the encode
package.
Move the slider to blur the image. Note the slider stays responsive even though
the blurring may lag the slider. Uncheck "Asynchronous" and note that t... |
# Copyright (c) 2021 PaddlePaddle 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 appli... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
from pyathena.error import * # noqa
__version__ = '1.9.0'
# Globals https://www.python.org/dev/peps/pep-0249/#globals
apilevel = '2.0'
threadsafety = 3
paramstyle = 'pyformat'
class DBAPITypeObj... |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015 Rapptz
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... |
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand
from django.conf import settings
from django.contrib.auth.models import User
from django.db import transaction
from sys import stderr
from cyder.core.ctnr.models import Ctnr, CtnrUser
from cyder.core.system.models... |
from __future__ import with_statement
__author__ = 'Tom Schaul, tom@idsia.ch; Justin Bayer, bayerj@in.tum.de'
import gc
import pickle
import logging
import threading
import os
import operator
from itertools import count
from math import sqrt
from random import random, choice
from string import split
from scipy impo... |
import datetime
from controler import webControl
from models import messageModel
import logging
__author__ = 'Jesse'
class JSON(webControl):
""" Forwards all JSON related HTTP requests to controller methods"""
@classmethod
def getMessages(cls, self):
"""Handles text JSON GET requests
GETS should be... |
#-*- coding: utf-8 -*-
import cv2
import utils
import object_detector.file_io as file_io
import numpy as np
import random
class FeatureExtractor():
def __init__(self, descriptor, patch_size, data_file):
self._desc = descriptor
self._patch_size = patch_size
if da... |
from __future__ import print_function
import argparse
import base64
import binascii
import datetime
import io
import itertools
import json
import operator
import pprint
import re
import socket
import struct
import sys
import unicodedata
import antlr4
import antlr4.error.ErrorListener
import antlr4.error.Errors
import... |
# -*- coding: utf-8 -*-
#
__version__ = '1.8.7'
__author__ = u'Nico Schlömer'
__author_email__ = 'nico.schloemer@gmail.com'
__website__ = 'https://github.com/nschloe/meshio'
__license__ = 'License :: OSI Approved :: MIT License'
__status__ = 'Development Status :: 5 - Production/Stable'
|
import os
from datetime import date
from datetime import datetime as dt
import time # performance test
import subprocess
from subprocess import CalledProcessError
from pywps import Process
from pywps import LiteralInput, LiteralOutput
from pywps import ComplexInput, ComplexOutput
from pywps import Format, FORMATS
fro... |
import gzip
import json
import logging
import struct
import cStringIO
import sys
from collections import defaultdict, OrderedDict
from ttypes import (FileMetaData, CompressionCodec, Encoding,
FieldRepetitionType, PageHeader, PageType, Type)
from thrift.protocol import TCompactProtocol
from thrift.tr... |
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import treeano
def to_shared_dict(network):
network.build()
if not network.is_relative():
network = network[network.root_node.name]
vws = network.find_vws_in_subtree(is_shared=True)
name_to... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2014 Thomas Voegtlin
#
# This program 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 3 of the License, or
# (at y... |
#
# Description:
# This is the main of the glideinFactory
#
# Arguments:
# $1 = poll period (in seconds)
# $2 = advertize rate (every $2 loops)
# $3 = glidein submit_dir
#
# Author:
# Igor Sfiligoi (Sept 15th 2006)
#
import os
import os.path
import sys
import traceback
import time
import threading
sys.path.a... |
# -*- coding: utf-8 -*-
__author__ = 'medvedev.ivan@mail.ru'
import os,sys,datetime,argparse,threading,time,shutil
from osgeo import gdal
from gdalconst import *
from Queue import Queue
queue = Queue()
LOCK = threading.RLock()
# CONSTs
folders = {
0.5: '0_5', # subfolder for raster with 0.5 pixel size
1.0: '1_0', ... |
#!/usr/bin/env python
"""
Created on 2015-02-22T19:41:02
"""
from __future__ import division, print_function
import sys
import argparse
import re
try:
import numpy as np
except ImportError:
print('You need numpy installed')
sys.exit(1)
try:
from astropy.io import fits
except ImportError:
print('... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# (c) 2019 Mike Lewis
import logging; log = logging.getLogger(__name__)
# Try to load JSON libraries in this order:
# ujson -> simplejson -> json
try:
import ujson as json
except ImportError:
try:
import simplejson as json
except ImportError:
im... |
# Copyright 2014-2015 ARM Limited
#
# 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 w... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Arne Neumann
"""
The ``paula`` module converts a ``DiscourseDocumentGraph`` (possibly
containing multiple annotation layers) into a PAULA XML document. Our goal is
to produce the subset of the PAULA 'specification' that is understood by the
SaltNPepper converter ... |
import frappe
from frappe.utils import get_datetime
def execute():
weekdays = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
weekly_events = frappe.get_list("Event", filters={"repeat_this_event": 1, "repeat_on": "Every Week"}, fields=["name", "starts_on"])
frappe.reload_doc("desk", ... |
from socketIO_client import SocketIO, LoggingNamespace
import logging
logging.getLogger('socketIO-client').setLevel(logging.DEBUG)
logging.basicConfig()
# options = {'reconnectionDelay': 10000, 'reconnection': true}
class TagoRealTime:
def __init__(self, address, token, callback):
self.socket = SocketI... |
"""
Functions for explaining classifiers that use tabular data (matrices).
"""
import collections
import copy
import json
import numpy as np
import sklearn
import sklearn.preprocessing
from lime.discretize import QuartileDiscretizer
from lime.discretize import DecileDiscretizer
from lime.discretize import EntropyDisc... |
#!/usr/bin/env python
# This is a straightforward implementation of a well-known algorithm, and thus
# probably shouldn't be covered by copyright to begin with. But in case it is,
# the author [Magnus Lie Hetland] has, to the extent possible under law,
# dedicated all copyright and related and neighboring rights to th... |
import abc
import hashlib
import hmac
import json
from typing import Any, Dict
import urllib.error
import urllib.parse
import urllib.request
from mesonwrap import wrap
from mesonwrap import upstream
JSON = Dict[Any, Any]
class ServerError(Exception):
pass
class APIError(ServerError):
pass
class Abstrac... |
"""Download, preview, and query example datasets for use in cartoframes
examples. Try examples by `running the notebooks in binder
<https://mybinder.org/v2/gh/CartoDB/cartoframes/master?filepath=examples>`__
In addition to the functions listed below, this examples module is
authenticated against all public datasets in... |
#!/usr/bin/env python3
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
########################################################################
# LeenO - Computo Metrico
# Template assistito per la compilazione di Computi Metrici Estimativi
# Copyright (C) Giuseppe Vizziello - supporto@leeno.... |
# by ME
# snoopify.py
# changes comments into snoop dog/lions language
import praw
import re
import pprint
import os
#gets password
with open('passwords.txt', 'r') as passFile:
password = passFile.read()
with open('user.txt', 'r') as uFile:
userName = uFile.read()
r = praw.Reddit('Snoop Translator by u/kmurph4... |
from datetime import datetime, timedelta
from icalendar.cal import Alarm
from rest_framework import renderers
from icalendar import Calendar, Event
from dateutil import parser
class ICalRenderer(renderers.BaseRenderer):
media_type = 'text/calendar'
format = 'ics'
def render(self, data, media_type=None, ... |
#!/usr/bin/env python3
"""
Charcoal's main module.
Contains definitions for the Charcoal canvas object, \
the CLI, and various classes used by the Charcoal class.
"""
# TODO List:
# !WIKI!
# bresenham
# image to ascii
# turn grammars into dictionaries (bison-style)
# escape to produce unicode char
# tests for reflec... |
# coding=utf-8
from __future__ import unicode_literals
__loader__ = None
import datetime
import json
import os
import random
import time
import unittest
import sys
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from faker import Generator, Factory
from faker.utils import tex... |
#-*- coding: utf-8 -*-
"""
pydouban
A lightweight douban api library.
Basic Usage:
>>> import pydouban
>>> key = 'your douban oauth consumer key'
>>> secret = 'your douban oauth consumer secret'
>>> auth = pydouban.Auth(key, secret)
>>> dic = auth.login()
>>> print dic['url']
...
>>> t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.