text stringlengths 17 737k |
|---|
# -*- coding: utf-8 -*-
from odoo import api, fields, models
from odoo.tools import float_is_zero
from odoo.exceptions import UserError
# 状态可选值
TASK_STATES = [
('todo', u'新建'),
('doing', u'正在进行'),
('done', u'已完成'),
('cancel', u'已取消'),
]
AVAILABLE_PRIORITIES = [
('0', u'一般'),
('1', u'低'),
... |
# -*- coding: utf-8 -*-
#
# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
import os
import tempfile
import datetime
import mimetypes
import urllib
import functools
import logging
logger = logging.getLogger('fnp.... |
## $Id$
##
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS 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
## Li... |
#!/usr/bin/env python
"""
This module provides functionalities for training an svr model
"""
from util.data_parser import DataParser
from util.keyword_extractor import KeywordExtractor
from lib.peer_extractor import PeerExtractor
import numpy as np
from sklearn.svm import SVC as SKSVR
from util.top_similar import TopSi... |
import logging
import os
import shutil
import sys
from subprocess import PIPE, Popen
from dcb.dcbenvironment import DCBEnvironment
from typing import List
from jinja2 import BaseLoader, Template
# inspired by http://blog.endpoint.com/2015/01/getting-realtime-output-using-python.html
# https://stackoverflow.com/questi... |
import logging
import base64
import hmac
import hashlib
from urllib import parse
from django.contrib.auth.decorators import login_required
from django.http import (HttpResponseBadRequest, HttpResponseRedirect,
HttpResponse, HttpResponseForbidden)
from django.conf import settings
from django.sh... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import re
import csv
import logging
import itertools
import requests
from io import BytesIO, StringIO
from zipfile import ZipFile
from collections import namedtuple
from indra.util import read_unicode_csv
f... |
import datetime
import importlib
import os
import sys
import click
import jinja2
import markdown
import strictyaml
from docutils.core import publish_parts
from utilkit import datetimeutil, fileutil
def include_type_exists(key):
"""
Check whether the include type (plugin) is valid/exists.
Needs a file of ... |
#!/usr/bin/env python3.5
# -*- coding: UTF-8 -*-
############################################################################
#
# passgen.py
#
############################################################################
#
# Author: Videonauth <videonauth@googlemail.com>
# Date: 30.06.2016
# Purpose:
# Generate a ra... |
import math
import numpy as np
import scipy.linalg
import pyscf.gto.mole
pi=math.pi
class Cell(pyscf.gto.mole.Mole):
def __init__(self, mol, h):
pyscf.Mole.__init__(self, mol)
# h in HM (Eq. (3.1))
self.h=h
def get_gv(gs):
'''
integer cube of indices, -gs...gs along each d... |
# Copyright 2016 Nexenta Systems, 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 req... |
import json
import sys
try:
import dns.resolver
resolver = dns.resolver.Resolver()
resolver.timeout = 0.2
resolver.lifetime = 0.2
except ImportError:
print("dnspython3 is missing, use 'pip install dnspython3' to install it.")
sys.exit(0)
misperrors = {'error': 'Error'}
mispattributes = {'input... |
"""Module containing classes for datagrid MVC implementation."""
import os
from datetime import datetime
from gi.repository import (
GLib,
GObject,
GdkPixbuf,
Gtk,
Pango,
)
from . import popupcal
from .uifile import UIFile
GRID_LABEL_MAX_LENGTH = 100
_MEDIA_FILES = os.path.join(
os.path.dirn... |
#
# Quru Image Server
#
# Document: imaging_pillow.py
# Date started: 22 May 2018
# By: Matt Fozard
# Purpose: Provides an interface to the Pillow image processing library
# Requires: The Python Pillow library (http://python-pillow.org)
# Copyright: Quru Ltd (www.quru.com)
# Licence:
#
#... |
##
# See the file COPYRIGHT for copyright information.
#
# 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... |
# Copyright 2014-2015 Boxkite Inc.
# This file is part of the DataCats package and is released under
# the terms of the GNU Affero General Public License version 3.0.
# See LICENSE.txt or http://www.fsf.org/licensing/licenses/agpl-3.0.html
import sys
from os import listdir
from os.path import isdir, exists
from datac... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import six
import six.moves.urllib as urllib
import tabulator
from .resource_file import (
InlineResourceFile,
LocalResourceFile,
RemoteResourceFi... |
from __future__ import print_function
from autobahn.twisted.websocket import WebSocketClientProtocol, WebSocketClientFactory
from twisted.internet.protocol import ReconnectingClientFactory
from twisted.internet.task import LoopingCall
class LiveStream(WebSocketClientProtocol): # pragma: no cover
""" Internal cla... |
# Copyright 2015 Cedric RICARD
#
# This file is part of CloudMailing.
#
# CloudMailing 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 your option) any later ve... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import logging
import pymongo
from django.core.cache import cache
from contextlib import contextmanager
from . import BaseDriver
from . import DatabaseInfraStatus
from . import DatabaseStatus
from . import AuthenticationError
from . import... |
# coding: utf-8
from sqlalchemy import BigInteger, Boolean, Column, Float, Integer, Numeric, \
String, Table, Text, text
from geoalchemy2.types import Geometry
from sqlalchemy.dialects.postgresql.base import ARRAY
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.met... |
"""TinyFlow Example code.
Automatic variable creation and shape inductions.
The network structure is directly specified via forward node numbers
The variables are automatically created, and their shape infered by tf.infer_variable_shapes
"""
import tinyflow as tf
from tinyflow.datasets import get_mnist
# Create the m... |
# CTK: Cherokee Toolkit
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2009-2010 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Software Foundation.... |
import tushare as ts
import os
import pandas as pd
class DataBase:
def update_share_list(self):
self._log("updata share list form internet")
data = ts.get_stock_basics()
data.to_csv("share_list.csv")
def has_share_list_local(self);
return os.path.exists("share_list.csv")
d... |
# Strangers wrote
import os
import sys
import numpy as np
import matplotlib.nxutils as nxutils
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.patches import FancyArrow
from subprocess import PIPE, Popen
from matplotlib.ticker import NullFormatter, MaxNLocator, MultipleLocator
import pyfits
i... |
import json
from collections import OrderedDict
from functools import wraps
from .cache import cache, recache
from .command import Command
from .settings import FormatterSettings
def formatter(name, command='', args=''):
def decorator(cls):
@wraps(cls)
def make_formatter(*args, **kwargs):
... |
import discord
import re
import csv
from discord.ext import commands
class MCOCTools:
'''Tools for Marvel Contest of Champions'''
lookup_links = {
'event': (
'Tiny MCoC Schedule',
'<http://simians.tk/MCOC-Sched>',
'Josh Morris Schedule',
... |
import random
from unittest import TestCase, main
from zbj import Card, Hand, Deck
class CardBasics(TestCase):
SUITS = ('C', 'S', 'H', 'D')
VALUES = {'A':1, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, 'T':10, 'J':10, 'Q':10, 'K':10}
def setUp(self):
self.ac = Card('C', 'A')
class Card... |
"""
Switchvox common methods
"""
# 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 your option) any later version.
#
# ... |
# import gevent.monkey
# gevent.monkey.patch_socket()
import sys
import os
import random
import threading
import collections
import functools
import time
import thread
import traceback
import concurrent.futures
from PyQt4 import QtCore, QtGui
Qt = QtCore.Qt
from sgfs import SGFS
sgfs = SGFS()
threadpool = concur... |
import itertools
import re
import networkx
from .io import open_read_file
def read_obo(path_or_file):
"""
Return a networkx.MultiDiGraph of the ontology serialized by the
specified path or file.
This function attempts to follow the specifications provided at:
http://owlcollab.github.io/oboforma... |
"""data.py: different ProjectElementData classes"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import properties
from .base import UidModel, ContentModel, ProjectElementData
from .serializers i... |
VERSION = '1.6.1'
|
# The MIT License (MIT)
#
# Copyright (C) 2014 OpenBet Limited
#
# 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, copy,... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2012, Davyd McColl; 2013, Jaime Soffer
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 cop... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import glob
import sys
from nose.tools import *
from utilities import execution_path
import os, mapnik
# make the tests silent since we intentially test error conditions that are noisy
mapnik.logger.set_severity(mapnik.severity_type.None)
def setup():
# All of the pa... |
"""
I/O for Medit's format/Gamma Mesh Format,
Latest official up-to-date documentation and a reference C implementation at
<https://github.com/LoicMarechal/libMeshb>
"""
import logging
import struct
from ctypes import c_double, c_float
import numpy
from .._common import _pick_first_int_data
from .._exceptions import ... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# The most stupid IRC bot
#
import socket
from time import ctime
import feedparser
# Config
# ------
server = "irc.freenode.net"
channel = "#zdroid"
nick = "XDroid"
# Connect to server
# -----------------
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
irc.co... |
# Copyright 2012-2015 The Meson development team
# 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... |
# Copyright 2013-2014 The Meson development team
# 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... |
# Time: O(logm + logn)
# Space: O(1)
#
# Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
#
# Integers in each row are sorted from left to right.
# The first integer of each row is greater than the last integer of the previous row.
# For example,
#
... |
import logging
from main.models import Station
import csv
def populate_stations(path='/opt/code/vvs_data/HaltestellenVVS_simplified_utf8_stationID.csv'):
with open(path, 'r') as f:
reader = csv.reader(f, delimeter=',')
# skip first row
next(reader, None)
for row in reader:
... |
"""
@brief test log(time=1s)
"""
import sys
import os
import unittest
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
... |
#!/usr/bin/env python
# Copyright (c) 2012 - 2014 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
# Demonstrate that the flow can be dynamically calculated by the script
from __future__ import print_function
import sys, os, tempfile
import logging
from co... |
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.tools.translate import _
class AccountMoveReversal(models.TransientModel):
"""
Account move reversal wizard, it cancel an account move by reversing it.
"""
_name = 'account.move.reversal'
_description = 'Account Move Reversal'
... |
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
from scipy import weave
from kern import Kern
from ...util.linalg import tdot
from ...util.misc import fast_array_equal, param_to_array
from ...core.parameterization import Param
from ..... |
"""
TWLight email sending.
TWLight generates and sends emails using https://bameda.github.io/djmail/ .
Any view that wishes to send an email should do so using a task defined here.
Templates for these emails are available in emails/templates/emails. djmail
will look for files named {{ name }}-body-html.html, {{ name ... |
"""Caching decorator for dictionary/tuples."""
import json
import os
from functools import wraps
import gzip
import sys
from string import punctuation
import codecs
from hashlib import md5
class _DumpAdapter(object):
""" Flexible interlace to blindly use codecs module or
gzip module
"""
def __ini... |
#!/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 "Li... |
#!/usr/bin/env python3
import logging
import argparse
import bottle
from bottle import route, run, template, response, request
import subprocess
import json
import sys
import os
import ipaddress
logging.basicConfig(
level=logging.INFO,
format='%(asctime)-15s %(levelname)-8s %(name)-12s %(message)s'
)
logger = ... |
# Copyright 2013 Scott Duckworth
#
# This file is part of django-sshkey.
#
# django-sshkey 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 3 of the License, or
# (at your option) any late... |
# All the times here are in hours
# These are the times for non-pgo
import requests
import logging
from mozci.mozci import query_repo_url_from_buildername, query_repo_name_from_buildername, trigger_all_talos_jobs, trigger_range
from mozci.query_jobs import TreeherderApi
from mozci.platforms import build_talos_builderna... |
"""define current version"""
__version__ = '0.2.1'
|
processStarted = False
processExited = False
def __handleProcessStarted__(object):
global processStarted
processStarted = True
def __handleProcessExited__(object, exitCode):
global processExited
processExited = True
def openQmakeProject(projectPath):
invokeMenuItem("File", "Open File or Project..... |
#
# crawler.py
#
# statbot - Store Discord records for later analysis
# Copyright (c) 2017 Ammon Smith
#
# statbot is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be useful, but
# WITHOUT ANY... |
from devicehive import DeviceException
from devicehive import ApiResponseException
def list_notifications(device, **params):
notifications = device.list_notifications(**params)
return [notification for notification in notifications
if notification.notification()[0] != '$']
def test_list(test):
... |
# Copyright 2020 - 2021 MONAI Consortium
# 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... |
# This program 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 your option) any later version.
#
# This program is distributed in the hope that it will be usefu... |
import os
import unittest
import multiprocessing
import time
from urllib.parse import urlparse
from werkzeug.security import generate_password_hash
from splinter import Browser
# Configure app to use the testing database
os.environ["CONFIG_PATH"] = "crossword.config.TravisConfig"
#os.environ["CONFIG_PATH"] = "crosswo... |
# Import Salt Testing libs
from salttesting import skipIf, TestCase
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
from salt.modules import pip
from salt.exceptions import CommandExecutionError
try:
from mock import MagicMock, patch
has_mock = True
except Impo... |
import os
import json
import tempfile
import base64
from mock import patch, call, create_autospec
import unit
from nose.tools import assert_equal, assert_in, assert_raises, assert_is_none, assert_is_not_none, \
assert_not_equals, assert_true
import synapseclient
from synapseclient import File, Folder, Team
from s... |
import copy
from operator import itemgetter
from pprint import pprint
from django.contrib.auth.mixins import PermissionRequiredMixin
from fo2.connections import db_cursor_so
from base.paginator import list_paginator_basic
from base.views import O2BaseGetPostView
from utils.classes import Perf
from utils.functions.di... |
"""Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "cc4bfd7f59d5a0024ada2a5c2a6f46d53290882b"
LLVM_SHA256 = "37536d911a0c82f6c5a0f3e3804c40781fac87f5f4457387cef9eaf9c8026f9f"
tfrt_http_archive(
... |
"""Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "026fac2a14cdf0b904ec83044d1f271e1ba2c5f9"
LLVM_SHA256 = "5ad28384c54fa6acfe4e624bd0bf9cf173bec7c542c416db08e7917f03ab1fc1"
tf_http_archive(
... |
# Copyright 2015 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 by applicable law or a... |
from ..core import (Dummy, Expr, Float, Integer, PoleError, Rational, Symbol,
nan, oo, sympify)
from ..functions.elementary.trigonometric import cos, sin
from .gruntz import limitinf
from .order import Order
def limit(expr, z, z0, dir="+"):
"""
Compute the directional limit of ``expr`` at ... |
''' Streamline object '''
import numpy as np
class Volume(object):
def __init__(self, func):
self._func = func
def at_points(self, points):
return np.array([self._func(pt) for pt in points.T])
class PointVolume(Volume):
def __init__(self, points, values, out_value=np.nan):
self... |
#!/usr/bin/env python3
import sys
class Nobe:
def __init__(self, val):
self.val = val
self.next = None
def go(cur, map, N):
start3 = cur.next
last3 = start3.next.next
end3 = last3.next
cur.next = end3
up = [start3.val, start3.next.val, start3.next.next.val]
dest = cur.val... |
import numpy as np
import nibabel as nib
from dipy.segment.mask import median_otsu
import AFQ.registration as reg
import AFQ.utils.volume as auv
__all__ = ["MaskFile", "FullMask", "RoiMask", "B0Mask", "LabelledMaskFile",
"ThresholdedMaskFile", "ScalarMask", "ThresholdedScalarMask",
"CombinedMa... |
#!/usr/bin/env python
# Licensed under the Apache 2.0 License
# Author Gary O'Neall gary@sourceauditor.com
"""
Primary web application to control the lightshowPi
Usage: sudo lightsite.py
Website can be accessed on port 5000
The file also contains the default configuration parameters
"""
from logging import handlers
im... |
#!/usr/bin/python
import argparse
import ConfigParser
import platform
import os
import sys
import time
import re
import string
import socket
import netifaces, netaddr
import subprocess
import fnmatch
import struct
import shutil
import json
from pprint import pformat
import xml.etree.ElementTree as ET
import platform
... |
from splunk.appserver.mrsparkle.lib.util import make_splunkhome_path
from insteon_app.modular_input import Field, IntegerField, FieldValidationException, ModularInput
import logging
from logging import handlers
import sys
import time
import os
import splunk
import re
from insteon_app.pytomation.pyinsteon import *
fr... |
import os
import sys
import json
from django.http import HttpResponse
sys.path.append(os.path.join(os.path.dirname(__file__),"..", "tellina_learning_module"))
from bashlex import data_tools
## load the manpage expl file, note that the root should be before tellina
with open(os.path.join('tellina', 'manpage_expl.jso... |
# -*- coding: utf-8 -*-
import os
import logging
import codecs
import json
import re
from collections import defaultdict
from flask import Flask, request, jsonify, Response, stream_with_context, render_template
from pattern.en import wordnet as WN
import whoosh
from whoosh import index
from whoosh import qparser
fro... |
"""
verktyg.application
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2014 by Ben Mather.
:license: BSD, see LICENSE for more details.
"""
import sys
from werkzeug.local import Local, LocalManager
from werkzeug.utils import cached_property, redirect
from verktyg.exception_dispatch import (
ExceptionDispatc... |
#!/usr/bin/env python
"""
Comprehensive script to handle migrating PANDA's Solr indices to a larger EBS volume.
Handles all stages of device creation, attachment, file movement, etc.
It will work whether the indices are currently on another EBS or on local storage.
The only thing this script does not do is detach and... |
from __future__ import print_function
import sys
import re
from collections import defaultdict
import zipfile
import argparse
import itertools
import os
class ReutersCodes(object):
"""Index CoNLL docs by Retuers topic, country and indexing codes
The following will index Reuters docs by topic:
%(prog)... |
""" Contains definitions for creation of external C/C++ build rules (for building external libraries
with CMake, configure/make, autotools)
"""
load("@bazel_skylib//lib:collections.bzl", "collections")
load("@rules_foreign_cc//tools/build_defs:version.bzl", "VERSION")
load(
":cc_toolchain_util.bzl",
"Librarie... |
import sys, os.path, operator, thread, threading
from operator import itemgetter, attrgetter
from itertools import count, imap, izip, ifilter, ifilterfalse
from pony import utils
from pony.thirdparty import etree
class OrmError(Exception): pass
class DiagramError(OrmError): pass
class SchemaError(OrmError)... |
import __builtin__, re, sys, threading, types, inspect
from compiler import ast
from operator import attrgetter, itemgetter
from itertools import count, ifilter, ifilterfalse, imap, izip, chain
import datetime
try: from pony.thirdparty import etree
except ImportError: etree = None
from pony import options
f... |
from django.shortcuts import render
from django.db.models import Q
from django.views.decorators.cache import cache_page
from collections import defaultdict
from django.conf import settings
import json
import functools
from contactnetwork.models import *
from structure.models import Structure
from protein.models impo... |
import sys, os.path, operator, thread, threading
from operator import itemgetter, attrgetter
from itertools import count, imap, izip, ifilter, ifilterfalse
from pony import utils
from pony.thirdparty import etree
class OrmError(Exception): pass
class DiagramError(OrmError): pass
class SchemaError(OrmError)... |
"""Serialize graphs to/from files on disk."""
import ast
import os
import networkx as nx
import pandas as pd
from shapely import wkt
from . import osm_xml
from . import settings
from . import utils
from . import utils_graph
def save_graph_geopackage(G, filepath=None, encoding="utf-8"):
"""
Save graph nodes... |
##############################################################################
#
# Copyright (C) 2014 Pexego Sistemas Informáticos All Rights Reserved
# $Jesús Ventosinos Mayor <jesus@pexego.es>$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero ... |
import json
import requests
def urljoin(*args):
"""
Kinda ghetto.
"""
return "/".join(map(lambda x: str(x).rstrip('/'), args))
class ArcGIS:
"""
A class that can download a layer from a map in an
ArcGIS web service and convert it to something useful,
like GeoJSON.
Usage:
>>>... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2010, Willow Garage, Inc.
# 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... |
# -*- coding: utf-8 -*-
"""Generalized logging utilities"""
import os
import logging
from traceback import print_exc
from datetime import datetime
import csutil
def formatMsg(*msg, **po):
"""Format the message for pretty visualization"""
t = csutil.time()
st = datetime.fromtimestamp(t).strftime('%x %X.%f'... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import urllib
import urllib2
import elementtree.ElementTree as ET
import time
from datetime import datetime, timedelta
from md5 import md5
__all__ = ['ApiClient']
def _local_date(string):
dt = datetime.strptime(string[0:25], '%a, %d %b %Y %H:%M:%S')
re... |
import time
import queue
from typing import List, Optional
from wsproto.frame_protocol import CloseReason
from wsproto.frame_protocol import Opcode
from mitmproxy import flow
from mitmproxy.net import websockets
from mitmproxy.coretypes import serializable
from mitmproxy.utils import strutils, human
class WebSocket... |
# -*- coding: UTF-8 -*-
from django import forms
from django import http
from django.conf import settings
from django.contrib import auth
from django.contrib.auth.decorators import login_required
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.db import transaction
from d... |
import base64
import datetime
import logging
import party
from ..credentials import load_credentials
LOG = logging.getLogger(__name__)
class Artifactory(object):
def __init__(self, repo_name=None):
self.repo_name = repo_name
self.credentials = load_credentials()
self.artifactory = party... |
# import argparse
import sys
from app import generate_pokemon, initMove
import requests
from bs4 import BeautifulSoup
from models import Pokemon
def populate(arg):
if '-u' in arg or '--update' in arg:
pokeList = []
for poke in Pokemon.query.all():
for move in poke.stats['moves']:
... |
import math
import random
import tradingsim.configuration as configuration
import tradingsim.utils as utils
class Agent:
def __init__(self, name, x, y):
self.x = x
self.y = y
self.speed = configuration.AGENT_SPEED # simulation distance units by simulation time
self.name = name
... |
from __future__ import print_function
import copy
import operator
import sys
import unittest
from collections import namedtuple
from datetime import datetime, timedelta
import numpy as np
import pytest
from numpy.testing import assert_almost_equal, assert_equal
import cftime
from cftime import datetime as datetimex
... |
#!/usr/bin/env python2
import unittest
from common.unittests import ConfigTest
from common.dcfile import *
class TestConfigCore(ConfigTest):
def test_core_good(self):
config = """\
daemon:
name: Core Message Director
url: http://123.45.67.89/coremd/
... |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: mouli@meics.org
# Maintained By: dan@reciprocitylabs.com
from flask import current_app, request
from ggrc.app import app
import ggrc_workflows.mod... |
from itertools import chain
from operator import itemgetter
from django.conf import settings
from django.contrib import messages
from django.core.cache import cache
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import NoReverseMatch, reverse
from djan... |
#!/usr/bin/python
# =================================================================
#
# $Id$
#
# Authors: Tom Kralidis <tomkralidis@hotmail.com>
#
# Copyright (c) 2011 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files ... |
import inspect
from itertools import chain
import sys
from fields import Fields
from hunter.actions import Action
from hunter.actions import CodePrinter
from hunter.actions import Debugger
from hunter.actions import VarsPrinter
__version__ = "0.1.0"
__all__ = 'F', 'CodePrinter', 'Debugger', 'VarsPrinter', 'trace', ... |
import random
import unittest
import numpy as np
import mock
import modAL.models
import modAL.uncertainty
import modAL.disagreement
import modAL.density
import modAL.utils.selection
import modAL.utils.validation
import modAL.utils.combination
from copy import deepcopy
from itertools import chain, product
from collect... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.