src stringlengths 721 1.04M |
|---|
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014-2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emmanuel Mathier <emmanuel.mathier@gmail.com>
#
# The licence is in the fi... |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publis... |
import matplotlib
from kid_readout.roach import baseband
matplotlib.use('agg')
import numpy as np
import time
import sys
from kid_readout.utils import data_file,sweeps
from kid_readout.analysis.resonator import fit_best_resonator
ri = baseband.RoachBasebandWide()
ri.initialize()
#ri.set_fft_gain(6)
#f0s = np.load('/... |
# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-21 pywws contributors
# 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;... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import traceback
from functools import wraps
from builtins import bytes
import click
import msgpack
import flask
from flask import Flask, render_template, copy_current_request_context
from flask import request, Response
from flask_socketio import Sock... |
# -*- coding: utf-8 -*-
"""
esdc_api.client
~~~~~~~~~~~~~~~
This module contains the Danube Cloud API :class:`Client` class used to access the Danube Cloud HTTP API.
"""
import json
import requests
from . import __version__
from .response import Response
__all__ = (
'Client',
)
class Client(object):
"""
... |
from adapt.intent import IntentBuilder
from mycroft.skills.core import MycroftSkill
import random, math, os, sys
from os.path import dirname
path= dirname(dirname(__file__))
sys.path.append(path)
# import intent layers
from service_intent_layer import IntentParser
__author__ = 'jarbas'
class MathQuestions:
def ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import plottool.draw_func2 as df2
import numpy as np
from ibeis.other import ibsfuncs
from plottool import plot_helpers as ph
import plottool as pt
import utool as ut
from ibeis.viz import viz_chip
(print, print_,... |
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi 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 la... |
"""
Hashtable Implementations with open addressing and linear probing.
For set semantics, you have to ensure add checks if value has already been inserted.
"""
def defaultHash(value, size):
return hash(value) % size
class Hashtable:
def __init__(self, b=1009, hashFunction=None, probeFun... |
# -*- coding:utf-8 -*-
# Author: Kei Choi(hanul93@gmail.com)
import os
import re
import kernel
import kavutil
import cryptolib
# -------------------------------------------------------------------------
# KavMain 클래스
# -------------------------------------------------------------------------
class KavMain:
# --... |
infile = open("DensityCC_w=05_L=10.txt",'r')
infile2 = open("DensityFCI_w=05_N=2_L=6_t=10.txt",'r')
infile3 = open("DensityCCSD_w=05_N=2_L=6_t=10.txt",'r')
densityCC_HF = []
densityFCI = []
densityCC2 = []
infile.next()
infile.next()
infile2.next()
infile2.next()
infile3.next()
infile3.next()
for line in infi... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
__init__.py
---------------------
Date : January 2016
Copyright : (C) 2016 by Matthias Kuhn
Email : matthias@opengis.ch
*********************************... |
'''
Sums the total elapsed time of all rendered images of a Pixar Renderman batch job.
It reads the data from the job XML files, so these are required!
Run in command line:
python prman_jobTime.py /path/to/jobFolder
'''
import os, sys
import xml.etree.ElementTree as ET
args = sys.argv[1:]
def readRenderTime(file)... |
import os
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager, prompt_bool
from flask_script import Server
from api import create_app, db
from api.models import User, Bucketlist, BucketlistItem
app = create_app(os.getenv('BUCKETLIST_ENV') or 'dev')
manager = Manager(app)
migrate = Migr... |
#
# Copyright (c) 2011, 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 copyright
# notice, this list of cond... |
import numpy as np
print(np.__version__)
# 1.19.0
print(np.pi)
# 3.141592653589793
print(np.radians(180))
# 3.141592653589793
print(type(np.radians(180)))
# <class 'numpy.float64'>
a = np.array([0, 90, 180])
print(type(a))
# <class 'numpy.ndarray'>
print(np.radians(a))
# [0. 1.57079633 3.14159265]
print(... |
# test_driver_updates.py - unittests for driver_updates.py
# Ignore any interruptible calls
# pylint: disable=interruptible-system-call
import unittest
try:
import unittest.mock as mock
except ImportError:
import mock
import os
import tempfile
import shutil
import sys
sys.path.append(os.path.normpath(os.pat... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from scrapy import Request
from scrapy.selector import Selector
from datetime import datetime
from base import BaseSpider
import db
class YouDianYin(BaseSpider):
name = 'youdianying'
ch_name = u'有点硬'
start_urls = ['https://youdian.in/']
def parse(self, ... |
import numpy as np
import loudness as ln
fs = 32000
N = 10000
x = np.arange(0, N)
# Input SignalBank
bufSize = 32
nEars = 2
nChannels = 1
inputBank = ln.SignalBank()
inputBank.initialize(nEars, nChannels, bufSize, int(fs))
# Frame generator
frameSize = 2048
hopSize = 32
startAtWindowCentre = True
frameGen = ln.Frame... |
from django.http import HttpResponse
from django.shortcuts import redirect
import json
import logging
log = logging.getLogger("apidemo")
# import our OAuth client
from . import client
# view decorator
def requires_login(view_fcn):
def wrapper(request, *args, **kwargs):
if client.OAUTH_KEY in request.sess... |
#
# Copyright (C) 2013-2018 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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... |
from django.conf.urls import url
from django.contrib.auth.views import login, logout_then_login
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
import views
urlpatterns = [
url(r'^login/$', login, {'template_name': 'base/login.html'}, name='login'),
url... |
from django.conf.urls import include, url
from django.shortcuts import redirect
from olympia.addons.urls import ADDON_ID
from olympia.amo.decorators import write
from olympia.amo.utils import partial
from olympia.lib.misc.urlconf_decorator import decorate
from . import views
# These will all start with /theme/<slug... |
import logging
from proxmox import Connector
from proxmox import Node
from proxmox.exceptions import ProxmoxError
def test_create_Node_object():
PROXMOX_HOST = "proxmox-7"
PROXMOX_PORT = 8006
USER = "apiuser@pam"
PASSWD = "strawberries"
VMID = 108
connection = Connector(PROXMOX_HOST, PROXMOX_... |
import json
from io import StringIO
from unittest.mock import (patch, mock_open, MagicMock)
import asyncio
from linkmanager.translation import gettext as _
class CP(object):
result = ''
def cpvar(self, r):
self.result = r
cp = CP()
addlink = iter([
### input on: test_cmd_flush
_('Y'),
... |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A "Test Server Spawner" that handles killing/stopping per-test test servers.
It's used to accept requests from the device to spawn and kill instances of ... |
#
# Copyright (C) University College London, 2007-2012, all rights reserved.
#
# This file is part of HemeLB and is provided to you under the terms of
# the GNU LGPL. Please see LICENSE in the top level directory for full
# details.
#
"""ConfigLoader which will process blocks asynchronously in parallel.
For debugg... |
# Copyright 2012 OpenStack Foundation
# 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 requ... |
#!/usr/bin/env python
#coding:utf-8
import decimal
import datetime
from Crypto.Cipher import AES
from Crypto import Random
import hashlib
import binascii
import hashlib
import base64
import calendar
import random
import os
import time
import uuid
import json
import functools
import logging
import urlparse
random_gener... |
#!/usr/bin/env python
import pytz
import datetime
from .row import Row
__all__ = ['get_parser']
class Parser():
def __init__(self, f):
self._fobj = f
def get(self):
return generate_rows(self._fobj)
def get_parser(fobj, options):
return Parser(fobj)
def generate_rows(f):
for lin... |
"""
"""
import warnings
import os
import sys
import posixpath
import fnmatch
import py
# Moved from local.py.
iswin32 = sys.platform == "win32" or (getattr(os, '_name', False) == 'nt')
try:
# FileNotFoundError might happen in py34, and is not available with py27.
import_errors = (ImportError, FileNotFoundErro... |
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
#
# Copyright (C) 2013 Simon Feltman <sfeltman@gnome.org>
#
# test_repository.py: Test for the GIRepository module
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General... |
# 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... |
#!/usr/bin/env python
"""
Lammps potentital types.
"""
class BondPotential(object):
"""
Class to hold bond styles that are implemented in lammps
Purpose is to store info that the user wants to use to overwrite standard UFF output of lammps_interface
"""
class Class2(object):
"""Potential ... |
from typing import Callable
import rx
from rx.core import Observable
from rx.disposable import CompositeDisposable, SingleAssignmentDisposable
from rx.internal.utils import is_future
def _exclusive() -> Callable[[Observable], Observable]:
"""Performs a exclusive waiting for the first to finish before
subscri... |
#!/usr/bin/python
#
# 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 b... |
from cmsis_svd.parser import SVDParser
import json
import re
# ------------------------------------
svd_name = 'STM32F30x.svd'
want_ofs = True
want_len = True
# Do not print poripheral field definitions (same as first instance)
no_print_fields = [
'GPIOB',
'GPIOC',
'GPIOD',
'GPIOE',
'GPIOF',
'GPIOG',
'USART... |
from functools import partial
import logging
logger = logging.getLogger(__name__)
import numpy
from lazyflow.graph import Operator, InputSlot, OutputSlot
from lazyflow.request import RequestLock, Request, RequestPool
from lazyflow.utility import OrderedSignal
from lazyflow.roi import getBlockBounds, getIntersectingBl... |
#!/usr/bin/env python
"""Entry point module for the command-line
interface. The kmos executable should be
on the program path, import this modules
main function and run it.
To call kmos command as you would from the shell,
use ::
kmos.cli.main('...')
Every command can be shortened as long as... |
import os
import shutil
import tempfile
import unittest
from holland.core.config import hollandcfg, setup_config
class TestHollandConfig(unittest.TestCase):
def setUp(self):
test_cfg = """
[holland]
plugin_dirs = /usr/share/holland/plugins
backupsets = default
umask = 0007
... |
import sys, os, urllib, StringIO, traceback, cgi, binascii, getopt, shutil
import zipfile, gzip, tarfile
#sys.path.append('/usr/local/pypi/lib')
# Filesystem Handling
import fs.errors
import fs.multifs
import fs.osfs
import redis
import rq
prefix = os.path.dirname(__file__)
sys.path.insert(0, prefix)
CONFIG_FILE =... |
r"""
This model provides the form factor, $P(q)$, for a multi-shell sphere where
the scattering length density (SLD) of each shell is described by an
exponential, linear, or constant function. The form factor is normalized by
the volume of the sphere where the SLD is not identical to the SLD of the
solvent. We currentl... |
#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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
Unle... |
""" Utility functions and classes for the test suite. """
from codecs import open
from requests import get
from scrapy import Request
from scrapy.http import HtmlResponse
from importlib import import_module
from slugify import slugify
from os.path import join, exists
from joby.settings import TEST_ASSETS_DIR
class ... |
"""
models.py
App Engine datastore models
"""
from google.appengine.ext import ndb
from utils import *
def to_dict(model):
assert isinstance(model, ndb.Model)
model_dict = model.to_dict()
model_dict['id'] = model.key.id()
return model_dict
def domain_of(email):
return email.lower().split('@'... |
#def write_fits(path,array):
# from astropy.io import fits
# hdul = fits.PrimaryHDU(array)
# hdul.writeto(path,overwrite=True)
# return
def write_fits(path,array):
from astropy.io import fits
opd = '/Users/mygouf/Python/webbpsf/webbpsf-data4/NIRCam/OPD/OPD_RevW_ote_for_NIRCam_requirements.fits.gz... |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2016 The Kore Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# mininode.py -... |
#!/usr/bin/env python
from bluetooth import *
import sys
from collections import OrderedDict
import argparse
import serial
# Take in command line args
parser = argparse.ArgumentParser(description='Interface with a game sir remote')
parser.add_argument('--pass_to_serial', action='store_true',
help='Pass the b... |
import logging
import web
import config
import requests
import json
import hashlib
import random
logger = logging.getLogger('route')
logger.setLevel(logging.INFO)
formatter = logging.Formatter('[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s','%m-%d %H:%M:%S')
#console
ch = logging.StreamHandler()
... |
"""Quality control and summary metrics for next-gen alignments and analysis.
"""
import collections
import contextlib
import csv
import os
import shutil
import subprocess
import pandas as pd
import lxml.html
import yaml
from datetime import datetime
# allow graceful during upgrades
try:
import matplotlib
matpl... |
LEVELS = [
('phil_1.tga', 'Jungle - 1',),
('phil_7.tga', 'Jungle - 2',),
('tim_2.tga', 'Jungle - 3',),
('phil_2.tga', 'Jungle - 4',),
('phil_13.tga', 'Jungle - 5',),
('pekuja_3.tga', 'Volcano - 1',),
('tim_4.tga', 'Volcano - 2',),
('phil_14.tga', 'Volcano - 3',),
('phil_8.tga', 'Bon... |
"""
Named projection classes that can be created or parsed.
"""
def find(projname, crstype, strict=False):
"""
Search for a projection name located in this module.
Arguments:
- **projname**: The projection name to search for.
- **crstype**: Which CRS naming convention to search (different
... |
from __future__ import print_function
import os
import sys
import socket
import datetime
import time
import akumulid_test_tools as att
import json
try:
from urllib2 import urlopen
except ImportError:
from urllib import urlopen
import traceback
import itertools
import math
HOST = '127.0.0.1'
TCPPORT = 8282
HTTP... |
"""project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... |
import os
import pwd
import Pyro5.api
class RestrictedService:
@Pyro5.api.expose
def who_is_server(self):
return os.getuid(), os.getgid(), pwd.getpwuid(os.getuid()).pw_name
@Pyro5.api.expose
def write_file(self):
# this should fail ("permission denied") because of the dropped privileg... |
##
# Copyright 2015-2020 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... |
import json
import logging
import mock
import pytest
import sanic
from aioresponses import aioresponses
from httpretty import httpretty
from sanic import Sanic
from rasa.core import utils
from rasa.core.agent import Agent
from rasa.core.interpreter import RegexInterpreter
from rasa.core.utils import EndpointConfig
fro... |
"""
Django settings for fred project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... |
from flask import Flask,request
app = Flask("My app with forms")
app.debug = True
@app.route('/register')
def show_registration_form():
# VIEW
response = '<html>'
response += ' <h1>Registration form</h1>'
response += ' <form name="registration" action="submit_registration_form" method="post">'
response += ' ... |
#!/usr/bin/env python
"""
Lighty-template
~~~~~~~~~~~~~~~
Lighty-template is very simple template engine for python (python.org).
Template syntax looks like django-template or jinja2 template. But template
engine code is easier and gives a way to write all needed tags without any
hacks.
Now it does not include all fe... |
# Copyright 2009, 2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
import random
import testtools
from lp.services.database.constants import UTC_NOW
from lp.services.tokens import (
create_token,
create_unique... |
#!/usr/bin/env python3.5
"""Test ModelPart class."""
import os
import tempfile
import unittest
import numpy as np
from numpy.testing import assert_array_equal
import tensorflow as tf
from neuralmonkey.vocabulary import Vocabulary
from neuralmonkey.encoders.recurrent import SentenceEncoder
from neuralmonkey.model.seq... |
""" Uses camera and takes images for documentation of motion """
import time
from PIL import Image
import urllib
import StringIO
import settings
user = settings.cam_user
pwd = settings.cam_pwd
cam_url = settings.cam_url
def fetch_snapshot_image():
im = StringIO.StringIO(urllib.urlopen(settings.cam_url).read())
... |
# -*- coding: utf-8 -*-
""" \file identity/saml/views/provider.py
\brief Implements the SAML endpoints for providers.
\author Erich Healy (cactuscommander) ErichRHealy@gmail.com
\author Ryan Leckey (mehcode) leckey.ryan@gmail.com
\copyright Copyright 2012 © Concordus Applications, Inc.
All Rights Reserved.... |
# -*- coding: utf-8 -*-
"""Http backend layer, formerly providing a httplib2 wrapper."""
from __future__ import absolute_import, unicode_literals
# (C) Pywikibot team, 2007-2015
__version__ = '$Id$'
__docformat__ = 'epytext'
# standard python libraries
import codecs
import sys
if sys.version_info[0] > 2:
from ur... |
#
# Copyright (c) 2004 Conectiva, Inc.
#
# Written by Gustavo Niemeyer <niemeyer@conectiva.com>
#
# This file is part of Smart Package Manager.
#
# Smart Package Manager 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 Fou... |
import argparse
import logging
import os
import sys
from pathlib import Path
import randovania
def create_subparsers(root_parser):
from randovania.cli import echoes, server, gui, prime_database
echoes.create_subparsers(root_parser)
prime_database.create_subparsers(root_parser)
server.create_subparser... |
"""
A simple python script to generate a sh table that takes the name of a syscall as input and translates it to the number corrosponding with that syscall.
This function is used in the sig_gen.sh script, used to generate an application signature for detection in kmaldetect.
Keep in mind that the '\n' characters used h... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Cloudbase Solutions Srl
# 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.ap... |
#!/usr/bin/env python
import sys
import argparse
import os
import glob
import kyotocabinet as kc
KC_UTILITIES = [
'create',
'import',
'get',
'dump',
'getbulk'
]
def open_multi(db_names, mode = kc.DB.OREADER):
"""
Return kc.DB objects for all files in db_names
Input:
db_names <... |
#
# Kiwi: a Framework and Enhanced Widgets for Python
#
# Copyright (C) 2003-2005 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, ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import socket
import types
from xml.etree.ElementTree import Element
from nassl._nassl import WantReadError
from sslyze.plugins import plugin_base
from sslyze.plugins.plugin_base import PluginScanResult, PluginScan... |
###################################################################################
# Copyright (c) 2005 John Judd
#
# 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, inc... |
###
# Copyright (c) 2014, KG-Bot
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of condition... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import threading
import urllib
import argparse
import urlparse
import logging
import urllib2
import httplib
import Queue
import re
import hashlib
import mechanize
from links import links
from bdd import bdd
logging.config.fileConfig('log.ini')
LOGGER = logging.getL... |
__author__ = 'tonycastronova'
import wrappers
import stdlib
from wrappers import base
from utilities import geometry
from utilities.status import Status
from api_old.ODM2.Core.services import readCore
from api_old.ODM2.Results.services import readResults
class wrapper(base.BaseWrapper):
def __init__(self, args)... |
"""
tests.test_manager
~~~~~~~~~~~~~~~~~~
Provides unit tests for the :mod:`flask_restless.manager` module.
:copyright: 2012 Jeffrey Finkelstein <jeffrey.finkelstein@gmail.com>
:license: GNU AGPLv3+ or BSD
"""
import datetime
import math
from flask import json
try:
from flask.ext.sqlalchemy ... |
import numpy as np
import sys
from scipy.stats import mode
import pandas as pd; pd.set_option('display.expand_frame_repr', False)
from time import time
import matplotlib.pyplot as plt
import logging
from classification_assess import get_performance
from keras.utils import np_utils
from sklearn.feature_selection import... |
#
# Copyright (C) 2009 Guillermo Ruiz Troyano
#
# This file is part of Nocturn Remote Script for Live (Nocturn RS4L).
#
# Nocturn RS4L 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 ... |
import os
import re
from .._core import SHELL_NAMES, ShellDetectionFailure
from . import proc, ps
def _get_process_mapping():
"""Select a way to obtain process information from the system.
* `/proc` is used if supported.
* The system `ps` utility is used as a fallback option.
"""
for impl in (pr... |
## store this into classes/jython/get.java
package jython;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import org.python.util.PythonInterpreter;
import org.python.core.*;
public class get extends TagSupport{
public PythonInterpreter interp;
public String cmd;
protected PageContext page... |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2016-present MagicStack Inc. and the EdgeDB authors.
#
# 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... |
"""
Revision ID: 0321_drop_postage_constraints
Revises: 0320_optimise_notifications
Create Date: 2020-06-08 11:48:53.315768
"""
import os
from alembic import op
revision = '0321_drop_postage_constraints'
down_revision = '0320_optimise_notifications'
environment = os.environ['NOTIFY_ENVIRONMENT']
def upgrade():
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from shapely.geometry import asShape
import json
import os
from pyproj import Proj, transform
# define the pyproj CRS
# our output CRS
wgs84 = Proj("+init=EPSG:4326")
# output CRS
pseudo_mercator = Proj("+init=EPSG:3857")
def transform_point(in_point, in_crs, out_crs):
... |
# -*- coding: utf-8 -*-
import functools
import warnings
from collections import namedtuple
from py_zipkin import Encoding
from py_zipkin import Kind
from py_zipkin.exception import ZipkinError
from py_zipkin.storage import get_default_tracer
from py_zipkin.transport import BaseTransportHandler
from pyramid_zipkin.re... |
# coding:utf-8
import os
import sys
import pycurl
c = pycurl.Curl()
URL = "http://www.baidu.com/"
c.setopt(pycurl.URL, URL)
# 连接超时时间,5秒
c.setopt(pycurl.CONNECTTIMEOUT, 5)
# 下载超时时间,5秒
c.setopt(pycurl.TIMEOUT, 5)
c.setopt(pycurl.FORBID_REUSE, 1)
c.setopt(pycurl.MAXREDIRS, 1)
c.setopt(pycurl.NOPROGRES... |
# Copyright (c) 2007-2017 Joseph Hager.
#
# Copycat 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.
#
# Copycat is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; with... |
# -*- coding: utf-8 -*-
import urlparse
from nose.tools import * # flake8: noqa
from website.models import Node
from website.util.sanitize import strip_html
from tests.base import ApiTestCase
from tests.factories import AuthUserFactory, DashboardFactory, FolderFactory, ProjectFactory
from api.base.settings.defaults... |
# Copyright 2016 Allan Rank
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
from contextlib import contextmanager
import datetime
from django.contrib.auth.models import Group
from django.contrib.auth.models import User
from django.test.client import RequestFactory
import fudge
from fudge.inspector import arg
import unittest
from ._utils import TestCase
try:
from registration.backends impo... |
class TennisGameDefactored1:
def __init__(self, player1Name, player2Name):
self.player1Name = player1Name
self.player2Name = player2Name
self.p1points = 0
self.p2points = 0
def won_point(self, playerName):
if playerName == self.player1Name:
self.p1... |
###${MARKDOWN}
# Recently, with the success of papers such as
# [Efficient Neural Architecture Search via Parameter Sharing](https://arxiv.org/abs/1802.03268),
# weight sharing has emerged as a popular way to speed up evaluation of sampled
# architectures in architecture search. Weight sharing simply involves sharing
#... |
#!/usr/bin/env python
#
# 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 requir... |
#!/usr/bin/python
"""
Module that provides several functions to handle (un)rimmed words.
"""
import words
def rims_of(word):
""" Return the rims for the given word. A rim is a (nonempty) word u such
that w = u.s = p.u' for some s,p,u' such that |u'| = |u|, and u' and u
agree on every position except ... |
"""Defines the Response class
Copyright 2013 by Rackspace Hosting, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable... |
#!/usr/bin/python
import PyFlxInstrument
from Structures import *
# --- class Image ------------------------------------------------------
class Image( object):
def get_entrypoint( self):
try:
return self.cached.entrypoint
except:
return self.ldr_data_table_entry.EntryPoin... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
# This code is part of the Fred2 distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
from tempfile import NamedTemporaryFile
__author__ = 'mohr,schubert'
import os
import subprocess
import logging
import itertools
import pandas
from Fred2... |
#!python3
import os
import ui
from objc_util import ns, ObjCClass, ObjCInstance, ObjCBlock, create_objc_class, on_main_thread
from blackmamba.log import error, issue
import blackmamba.util.runtime as runtime
import editor
import ctypes
import zipfile
from blackmamba.uikit.keyboard import (
register_key_event_handl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.