repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
Giangblackk/hanoi_road_map_analysis
preprocess/from_road_to_graph.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun Apr 30 17:32:10 2017 @author: giangblackk """ from osgeo import ogr, osr import networkx as nx import numpy as np def calculateGeometryLength(pointList, sourceSRS, destSRS): line = ogr.Geometry(ogr.wkbLineString) transform = osr.CoordinateTran...
tensorflow/similarity
tensorflow_similarity/retrieval_metrics/map_at_k.py
# Copyright 2021 The TensorFlow 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
tylertian/Openstack
openstack F/glance/tools/migrate_image_owners.py
#!/usr/bin/python import sys import keystoneclient.v2_0.client import glance.context from glance.openstack.common import cfg import glance.openstack.common.log as logging import glance.registry.context import glance.db.sqlalchemy.api as db_api LOG = logging.getLogger(__name__) LOG.addHandler(logging.StreamHandler(...
IBMPredictiveAnalytics/GATHERMD
src/GATHERMD.py
#/*********************************************************************** # * Licensed Materials - Property of IBM # * # * IBM SPSS Products: Statistics Common # * # * (C) Copyright IBM Corp. 1989, 2020 # * # * US Government Users Restricted Rights - Use, duplication or disclosure # * restricted by GSA ADP Schedule Co...
metamarkovic/jobChecker
jobChecker_lisa.py
from pexpect import pxssh import ConfigParser class jobChecker(): config_path = './config.lisa.ini' s = pxssh.pxssh() def readConfig(self): self.config.read(self.config_path) self.hostname = self.config.get('Credentials', 'hostname') self.username = self.config.get('Credentials'...
lliss/tr-55
tr55/model.py
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import division """ TR-55 Model Implementation A mapping between variable/parameter names found in the TR-55 document and variables used in this program are as follows: * `precip` is referred to as P...
EricssonResearch/calvin-base
calvin/runtime/south/calvinlib/mathlib/Arithmetic.py
# -*- coding: utf-8 -*- # Copyright (c) 2017 Ericsson AB # # 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 ...
googleapis/python-channel
samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py
# -*- coding: utf-8 -*- # Copyright 2022 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
stweil/letsencrypt
certbot/certbot/compat/filesystem.py
"""Compat module to handle files security on Windows and Linux""" from __future__ import absolute_import import errno import os # pylint: disable=os-module-forbidden import stat import sys from typing import List try: import ntsecuritycon import win32security import win32con import win32api impor...
nchursin/ApexIntentionActions
helpers/PropertyActions.py
from . import logger from . import TemplateHelper as TH from . import RegexHelper as re from . import Actions as A from . import ClassActions as CA from . import SublimeHelper as SH from .SublimeHelper import ViewHelper as VH log = logger.get(__name__) class PropertyAction(A.Action): """Stores info on property act...
spohnan/geowave
python/src/main/python/pygw/query/vector/vector_query_constraints_factory.py
# # Copyright (c) 2013-2019 Contributors to the Eclipse Foundation # # See the NOTICE file distributed with this work for additional information regarding copyright # ownership. All rights reserved. This program and the accompanying materials are made available # under the terms of the Apache License, Version 2.0 which...
victorywang80/Maintenance
saltstack/src/salt/modules/dnsutil.py
# -*- coding: utf-8 -*- ''' Compendium of generic DNS utilities ''' # Import salt libs import salt.utils import socket # Import python libs import logging log = logging.getLogger(__name__) def __virtual__(): ''' Generic, should work on any platform (including Windows). Functionality which requires depe...
turbokongen/home-assistant
homeassistant/components/zwave_js/api.py
"""Websocket API for Z-Wave JS.""" import json from aiohttp import hdrs, web, web_exceptions import voluptuous as vol from zwave_js_server import dump from homeassistant.components import websocket_api from homeassistant.components.http.view import HomeAssistantView from homeassistant.components.websocket_api.connect...
project-asap/IReS-Platform
asap-tools/experiments/depricated/handler/metrics.py
__author__ = 'cmantas' from tools import * from json import loads ms = take_single("select metrics from mahout_kmeans_text where k=15 and documents=90300 and dimensions=53235;")[0] mj = loads(ms) cols = iter(["#727272", '#f1595f', '#79c36a', '#599ad3', '#f9a65a','#9e66ab','#cd7058', '#d77fb3']) def timeline2vaslue...
vishnuprathish/constrained-data-generator
file1.py
from fingered import * import random import csv import sys def caac(): records = random.randrange(200,500) inst3=Xf("r") inst3.setStats(records,2,(2,records/10),[-1,0],[False,False],0,40000) inst3.FormData() inst4=Xf("s") inst4.setStats(100,2,(2,10),[-1,0],[False,True],0,40000) inst4.FormData() print inst3 ...
HybridF5/jacket
jacket/api/compute/openstack/compute/legacy_v2/server_metadata.py
# Copyright 2011 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...
drix00/pymcxray
pymcxray/serialization/test_Serialization.py
#!/usr/bin/env python """ """ # Script information for the file. __author__ = "Hendrix Demers (hendrix.demers@mail.mcgill.ca)" __version__ = "" __date__ = "" __copyright__ = "Copyright (c) 2011 Hendrix Demers" __license__ = "" # Standard library modules. import unittest import logging import os.path import tempfile i...
kidchang/compassv2-api
bin/query_switch.py
#!/usr/bin/python # # Copyright 2014 Huawei Technologies Co. Ltd # # 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 appl...
melver/bibmanage
lib/python/bibman/commands/sync.py
# Copyright (c) 2012-2016, Marco Elver <me AT marcoelver.com> # # 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...
acshi/osf.io
api/users/serializers.py
from rest_framework import serializers as ser from modularodm.exceptions import ValidationValueError from api.base.exceptions import InvalidModelValueError from api.base.serializers import AllowMissing, JSONAPIRelationshipSerializer, HideIfDisabled, \ PrefetchRelationshipsSerializer from website.models import Use...
google-research/robel
robel/dkitty/utils/scripted_reset.py
# Copyright 2019 The ROBEL 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
wangheda/youtube-8m
youtube-8m-wangheda/all_frame_models/biunilstm_model.py
import sys import models import model_utils import math import numpy as np import video_level_models import tensorflow as tf import utils import tensorflow.contrib.slim as slim from tensorflow import flags FLAGS = flags.FLAGS class BiUniLstmModel(models.BaseModel): def create_model(self, model_input, vocab_size, nu...
hkumarmk/oslo.messaging
tests/test_exception_serialization.py
# Copyright 2013 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
sebrandon1/tempest
tempest/lib/services/compute/aggregates_client.py
# Copyright 2013 NEC Corporation. # 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...
bravomikekilo/mxconsole
mxconsole/util/decorator_utils_test.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
opensignal/airflow
airflow/www/forms.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from datetime import datetime from flask_admin.form import DateTimePickerWidget from wtforms import DateTimeField, SelectField from flask_wtf import Form class DateTime...
alex-ip/geophys_utils
geophys_utils/_dem_utils.py
#!/usr/bin/env python #=============================================================================== # Copyright 2017 Geoscience Australia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the...
dcramer/taskmaster
src/taskmaster/cli/master.py
""" taskmaster.cli.master ~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ from taskmaster.util import parse_options from taskmaster.constants import (DEFAULT_LOG_LEVEL, DEFAULT_ADDRESS, DEFAULT_BUFFER_SIZE) def run(...
tomjshine/pynet
week1/ex6.py
#!/usr/bin/env python # import modules needed from pprint import pprint as pp import json, yaml # initialize list and dict my_list = [] my_dict = {'key1': 'val1','key2': 'val2', 'key3': {'subkey1': 'subval1', 'subkey2': 'subval2'}} my_list = range(10) my_list.append(my_dict) # dump to json with open('json.txt', 'w')...
valeros/platformio
platformio/platforms/linux_x86_64.py
# Copyright 2014-2016 Ivan Kravets <me@ikravets.com> # # 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...
FederatedAI/FATE
python/federatedml/ensemble/boosting/hetero/hetero_fast_secureboost_guest.py
from typing import List import numpy as np import functools from federatedml.ensemble.boosting.hetero.hetero_secureboost_guest import HeteroSecureBoostingTreeGuest from federatedml.param.boosting_param import HeteroFastSecureBoostParam from federatedml.ensemble.basic_algorithms import HeteroFastDecisionTreeGuest from f...
openstack/neutron-lib
neutron_lib/tests/unit/db/test_model_query.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
InformaticsMatters/squonk
components/rdkit-camel/src/main/python/find_props/find_props.py
# File to calculate properties for a molecule and add these properties back to the molecules # property to be calculate will be put in using a request.header string from java import lang from com.im.lac.types import MoleculeObject, MoleculeObjectIterable lang.System.loadLibrary('GraphMolWrap') from org.RDKit import * i...
openstack/tacker
tacker/tests/functional/sol_kubernetes/vnflcm/test_kubernetes_multi_ns.py
# 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 agreed to in...
comic/comic-django
app/grandchallenge/cases/migrations/0003_auto_20210406_0753.py
# Generated by Django 3.1.6 on 2021-04-06 07:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("cases", "0002_auto_20210305_1248"), ] operations = [ migrations.AlterField( model_name="rawimageuploadsession", name...
tetherless-world/ecoop
pyecoop/setup.py
# -*- coding: utf-8 -*- """ ecoop ==== ecoop_ utility functions to automatize the building of the Ecosystem Status Report for the NE-LME. .. _ecoop: https://github.com/epifanio/ecoop .. _ecoop-project: http://tw.rpi.edu/web/project/ECOOP """ from distutils.core import setup import os import sys import subprocess i...
alexryndin/ambari
ambari-server/src/main/resources/stacks/BigInsights/4.2/services/ZOOKEEPER/package/scripts/zookeeper_server.py
""" 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 use this ...
hashdd/pyhashdd
hashdd/features/hashdd_filemagic.py
""" hashdd_filemagic.py @brad_anton License: Copyright 2015 hashdd.com 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 l...
briancurtin/python-openstacksdk
examples/image/delete.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
hmrc/captain
captain/tests/util_mock.py
from mock import MagicMock import docker.errors from requests.exceptions import ConnectionError import datetime class ClientMock(): def __init__(self): def __logs(i, stream=False): if stream: return ("this is line {}".format(l) for l in xrange(1, 100)) else: ...
joerideturck/gcloud-python-bigtable
docs/conf.py
# -*- coding: utf-8 -*- # # Google Cloud Bigtable documentation build configuration file, created by # sphinx-quickstart on Fri Jul 24 16:48:39 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerat...
neurodata/synaptome-stats
collman15v2/201710/annoStats.py
#!/usr/bin/env python3 ### ### ### ### Jesse Leigh Patsolic ### 2017 <jpatsol1@jhu.edu> ### S.D.G # import argparse from intern.remote.boss import BossRemote from intern.resource.boss.resource import * from intern.utils.parallel import block_compute import configparser import requests import numpy as np from numpy ...
kubeflow/examples
mnist/web-ui/mnist_client.py
#!/usr/bin/env python2.7 ''' Copyright 2018 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 t...
tensorflow/lingvo
lingvo/tasks/milan/input_generator.py
# Lint as: python3 # Copyright 2021 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 ...
Vadimkin/aristocrats-to-mp3
run.py
# coding=utf-8 import json import time import sys import urllib import urllib2 from bs4 import BeautifulSoup try: import settings except ImportError: print("Rename settings.example to settings.py") sys.exit(0) def get_playlist(page): html = urllib2.urlopen(page).read() data = BeautifulSoup(htm...
quantumlib/Cirq
cirq-core/cirq/interop/quirk/cells/frequency_space_cells_test.py
# Copyright 2019 The Cirq Developers # # 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 ...
vegitron/django-template-preprocess
template_preprocess/processor.py
from django.conf import settings from importlib import import_module from template_preprocess.util.loader import Loader from template_preprocess.util.content_type import filename_is_html def process_sub_template(name, seen_templates): content = Loader().get_template_content(name) is_html = filename_is_html(n...
navrasio/mxnet
tests/python/gpu/test_kvstore_gpu.py
# 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 u...
kejrp23/Python
combination.py
""" This Program is being written to incorporate all things Python that I have learned thus far. I am writing this in windows notepad to better test my ablility to do proper spacing and indentions without having a proper tool that will handle small things for me. I'm unsure at the time of this writing whe...
PapenfussLab/Mungo
bin/fasta2phylip.py
#!/usr/bin/env python """ clustal2phylip.py <input filename> <output filename> Author: Tony Papenfuss Date: Mon Jan 8 11:44:37 EST 2007 """ import os, sys from optparse import OptionParser from mungo.align import Alignment usage = "%prog [options] <input file> <output file>" parser = OptionParser(usage=usage) op...
sergeneren/anima
tests/ui/test_version_creator.py
# -*- coding: utf-8 -*- # Copyright (c) 2012-2015, Anima Istanbul # # This module is part of anima-tools and is released under the BSD 2 # License: http://www.opensource.org/licenses/BSD-2-Clause import sys import shutil import tempfile import logging import unittest from anima.env.testing import TestEnvironment log...
agoose77/hivesystem
manual/movingpanda/panda-6.py
import dragonfly import dragonfly.pandahive import bee from bee import connect import math, functools from panda3d.core import NodePath import dragonfly.scene.unbound import dragonfly.std import dragonfly.io import dragonfly.canvas # ## random matrix generator from random import random def random_matrix_generator...
tgrogers/gpgpu-sim_simulations
util/job_launching/common.py
from optparse import OptionParser import subprocess import re import os import yaml import glob import hashlib this_directory = os.path.dirname(os.path.realpath(__file__)) + "/" defined_apps = {} defined_baseconfigs = {} defined_xtracfgs = {} def get_argfoldername( args ): if args == "" or args == None: ...
sklam/numba
numba/cpython/hashing.py
""" Hash implementations for Numba types """ import math import numpy as np import sys import ctypes import warnings from collections import namedtuple import llvmlite.binding as ll import llvmlite.llvmpy.core as lc from llvmlite import ir from numba.core.extending import ( overload, overload_method, intrinsic, ...
aterrel/dynd-python
dynd/tests/test_array_getitem.py
import sys import unittest from dynd import nd, ndt class TestArrayGetItem(unittest.TestCase): def test_strided_dim(self): a = nd.empty(100, ndt.int32) a[...] = nd.range(100) b = list(range(100)) self.assertEqual(nd.type_of(a), ndt.type('strided * int32')) self.assertEqual(...
pipermerriam/perjury
tests/test_util.py
from unittest import TestCase from perjury import generators as g from perjury import util from perjury.exceptions import UniqueValueTimeoutError class TestUniqueDecorator(TestCase): def test_is_pretty_unique(self): # This is not the most scientific way to test it, but we have slightly # more tha...
KholdStare/generators-to-coroutines
generators_to_coroutines/tools.py
from .decorators import invertibleGenerator, coroutine def pushFromIterable(iterable, target): try: for elem in iterable: target.send(elem) target.close() except StopIteration: pass @invertibleGenerator def genPairs(iterable): """ Aggregate two consecutive values in...
TOTVS/mdmpublic
couchbase-cli/lib/python/couchbase/migrator/migrator.py
# # Copyright 2012, Couchbase, 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 l...
WojciechMula/toys
avx512-remove-spaces/scripts/parse_speed.py
from os.path import basename from procedure_names import display_name def load(file): data = {} for line in file: F = line.split(':') if len(F) == 1: file = basename(F[0].strip()) if file not in data: data[file] = [] continue assert ...
HenryHu/pybbs
UserManager.py
from UCache import UCache import User import UserMemo import json from errors import * class UserManager: users = {} @staticmethod def HandleLogin(svc, username, passwd): user = UserManager.LoadUser(username) if (user == None): raise Unauthorized('Login failed') if (use...
lino-framework/xl
lino_xl/lib/sepa/models.py
# -*- coding: UTF-8 -*- # Copyright 2014-2018 Rumma & Ko Ltd # License: GNU Affero General Public License v3 (see file COPYING for details) from __future__ import unicode_literals from django.db import models from lino.api import dd, _, rt from lino.core.diff import ChangeWatcher from lino.utils.format_date import ...
eucalyptus/se34euca
se34euca/lib/EucaUITestLib_IP_Address.py
from se34euca.lib.EucaUITestLib_Base import * class EucaUITestLib_IP_Address(EucaUITestLib_Base): def test_ui_allocate_ip_address(self, ip_count): print print "Started Test: Allocate IP Address: IP_COUNT " + str(ip_count) print self.click_element_by_link_text("Dashboard") ...
jkafader/trough
tests/wsgi/test_segment_manager.py
import pytest from trough.wsgi.segment_manager import server import ujson import trough from trough.settings import settings import doublethink import rethinkdb as r import requests # :-\ urllib3? import hdfs3 import time import tempfile import os import sqlite3 import logging import socket trough.settings.configure_l...
svebk/DeepSentiBank_memex
cu_image_search/hasher/hasher_swig.py
import os import pwd import sys import time import json import shutil import random import subprocess import numpy as np from .generic_hasher import GenericHasher from ..memex_tools.image_dl import mkpath from ..memex_tools.binary_file import read_binary_file # should me move the _hasher_obj_py.so? #from ..hashing_new....
ponty/MyElectronicProjects
docs/projects/usbasp/usbasp_reset_old.py
#!/usr/bin/env python import fcntl import usb ID_VENDOR = 0x16c0 ID_PRODUCT = 0x05dc USBDEVFS_RESET = 21780 class Device: def __init__(self): '' @classmethod def find(cls, idVendor, idProduct): print("searching for device (%x:%x)" % (idVendor, idProduct)) for bus in usb.busses()...
Sythelux/Picarto.bundle
Contents/Libraries/Shared/PicartoClientAPI/models/thumbnail.py
# coding: utf-8 """ Picarto.TV API Documentation The Picarto.TV API documentation Note, for fixed access tokens, the header that needs to be sent is of the format: `Authorization: Bearer yourTokenHere` This can be generated at https://oauth.picarto.tv/ For chat API, see https://docs.picarto.tv/chat/chat.pr...
dogukantufekci/supersalon
supersalon/products/migrations/0002_auto_20151112_1729.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('products', '0001_initial'), ] operations = [ migrations.AddField( model_name='product', name='due_pe...
DjenieLabs/django-magic-content-calendarevents
magiccontentcalendarevents/views.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.http import HttpResponse, Http404 from django.views.generic.edit import CreateView, UpdateView from django.views.generic import ListView, TemplateView from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404 ...
leighpauls/k2cro4
third_party/webdriver/pylib/selenium/webdriver/remote/webelement.py
# Copyright 2008-2009 WebDriver committers # Copyright 2008-2009 Google 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 requ...
kumar303/rockit
vendor-local/djcelery/management/commands/celeryd_detach.py
""" Start detached worker node from the Django management utility. """ import os import sys from celery.bin import celeryd_detach from djcelery.management.base import CeleryCommand class Command(CeleryCommand): """Run the celery daemon.""" help = 'Runs a detached Celery worker node.' requires_model_va...
kbsezginel/raspberry-pi
rpi-web-server/camera/app-camera.py
import datetime from flask import Flask, render_template, redirect, url_for, request import picamera from time import sleep app = Flask(__name__) @app.route('/') def index(): index_data = {'high': weather['high'], 'low': weather['low'], 'bus': bus_data} return render_template('index.html', **index_data) @a...
puttarajubr/commcare-hq
custom/ewsghana/__init__.py
from custom.ewsghana.comparison_report import ProductsCompareReport, LocationsCompareReport,\ SMSUsersCompareReport, WebUsersCompareReport, SupplyPointsCompareReport from custom.ewsghana.reports.email_reports import CMSRMSReport, StockSummaryReport from custom.ewsghana.reports.maps import EWSMapReport from custom.e...
goddardl/gaffer
python/GafferImageUI/ImageSamplerUI.py
########################################################################## # # Copyright (c) 2015, Image Engine Design 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: # # * Redistrib...
jorge-marques/wagtail
wagtail/wagtailcore/rich_text.py
import re # parsing HTML with regexes LIKE A BOSS. from django.utils.html import escape from wagtail.wagtailcore.whitelist import Whitelister from wagtail.wagtailcore.models import Page from wagtail.wagtailcore import hooks # Define a set of 'embed handlers' and 'link handlers'. These handle the translation # of '...
mfwarren/projector
projector/config/production.py
# -*- coding: utf-8 -*- ''' Production Configurations - Use djangosecure - Use Amazon's S3 for storing static files and uploaded media - Use sendgird to sendemails - Use MEMCACHIER on Heroku ''' from configurations import values # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings ...
pbrod/numpy
numpy/ma/extras.py
""" Masked arrays add-ons. A collection of utilities for `numpy.ma`. :author: Pierre Gerard-Marchant :contact: pierregm_at_uga_dot_edu :version: $Id: extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $ """ __all__ = [ 'apply_along_axis', 'apply_over_axes', 'atleast_1d', 'atleast_2d', 'atleast_3d', 'average'...
smn/vumi-app-router
vxapprouter/router.py
# -*- test-case-name: vxapprouter.tests.test_router -*- import json from urlparse import urlunparse from twisted.internet.defer import inlineCallbacks from vumi import log from vumi.components.session import SessionManager from vumi.config import ( ConfigDict, ConfigList, ConfigInt, ConfigText, ConfigUrl) from vu...
afajl/sy
sy/prompt.py
''' :synopsis: Prompt users for information .. moduleauthor: Paul Diaconescu <p@afajl.com> ''' import re try: import readline has_readline = True except ImportError: has_readline = False pass def _indent_out(question): indent = 0 for c in question: if c != ' ': break ...
jimporter/bfg9000
test/unit/arguments/test_windows.py
from .. import * from bfg9000.arguments.windows import * class TestWindowsArgParse(TestCase): def test_empty(self): parser = ArgumentParser() self.assertEqual(parser.parse_known([]), ({}, [])) self.assertEqual(parser.parse_known(['extra']), ({}, ['extra'])) self.assertEqual(parser...
apple/coremltools
coremltools/converters/onnx/_tests/test_graph.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import unittest from coremltools._deps import _HAS_ONNX, MSG_ONNX_NOT_FOUND if _HAS_ONNX: import onnx from onnx import helper, numpy_helper, TensorProto from...
pdfliberation/python-hocrgeo
hocrgeo/parsers/hocr.py
from __future__ import unicode_literals from io import TextIOBase try: TextIOBase = file except NameError: pass # Forward compatibility with Py3k from bs4 import BeautifulSoup import re from hocrgeo.models import HOCRDocument import logging logger = logging.getLogger(__name__) logger.addHandler(logging.Null...
ConPaaS-team/conpaas
conpaas-services/src/conpaas/core/misc.py
import socket import fcntl import struct import zipfile import tarfile import readline from subprocess import Popen, PIPE from conpaas.core.https.server import FileUploadField def file_get_contents(filepath): f = open(filepath, 'r') filecontent = f.read() f.close() return filecontent def file_write...
paulsmith/geodjango
django/contrib/gis/gdal/prototypes/ds.py
""" This module houses the ctypes function prototypes for OGR DataSource related data structures. OGR_Dr_*, OGR_DS_*, OGR_L_*, OGR_F_*, OGR_Fld_* routines are relevant here. """ from ctypes import c_char_p, c_int, c_long, c_void_p, POINTER from django.contrib.gis.gdal.envelope import OGREnvelope from django.contrib...
quantmind/pulsar-queue
pq/backends/redis.py
from .. import mq class MQ(mq.MQ): """Redis Message Broker """ def __init__(self, backend, store): super().__init__(backend, store) self._client = store.client() async def get_message(self, *queues): '''Asynchronously retrieve a :class:`Task` from queues :return: a :c...
robotican/ric
ric_board/scripts/RiCConfigurator/GUI/Schemes/UsbRoles.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'UsbRoles.ui' # # Created: Wed Jun 10 09:17:48 2015 # by: PyQt4 UI code generator 4.11.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except Attri...
heavenshell/py-robo-talk
tests/test_talk_handler.py
# -*- coding: utf-8 -*- """ robo.tests.test_talk_handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests for robo.handlers.talk. :copyright: (c) 2015 Shinya Ohyanagi, All rights reserved. :license: BSD, see LICENSE for more details. """ import os import logging import requests import simplejson as json from m...
davidjcox/artlaasya
artlaasya/signals.py
'''artlaasya signals''' from django.dispatch import receiver from django.db.models.signals import pre_save, post_save, pre_delete try: from django.utils.text import slugify except ImportError: try: from django.template.defaultfilters import slugify except ImportError: print("Una...
hotsyk/uapython2
uapython2/users/migrations/0003_auto_20150809_0918.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('users', '0002_user_activity'), ] operations = [ migrations.AddField( model_name='user', name='age', ...
larsoner/mne-python
examples/visualization/xhemi.py
# -*- coding: utf-8 -*- """ =========================== Cross-hemisphere comparison =========================== This example illustrates how to visualize the difference between activity in the left and the right hemisphere. The data from the right hemisphere is mapped to the left hemisphere, and then the difference is...
Purg/SMQTK
python/smqtk/compute_functions.py
""" Collection of higher level functions to perform operational tasks. Some day, this module could have a companion module containing the CLI logic for these functions instead of scripts in ``<source>/bin/scripts``. """ import collections import logging import numpy from smqtk.utils import ( bin_utils, bit_...
mattduan/proof
pk/generator/IDGenerator.py
""" Interface to be implemented by id generators. It is possible that some implementations might not require all the arguments, for example MySQL will not require a keyInfo Object, while the IDBroker implementation does not require a Connection as it only rarely needs one and retrieves a connection from the Connection...
qwhelan/asv
asv/plugins/virtualenv.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from __future__ import absolute_import, division, unicode_literals, print_function from distutils.version import LooseVersion import sys import re import os import six from .. import environment from ..console import log from .....
Pathel/deuterium
src/utils/inlinefunc.py
""" Inlinefunc This is a simple inline text language for use to custom-format text in Evennia. It is applied BEFORE ANSI/MUX parsing is applied. To activate Inlinefunc, settings.INLINEFUNC_ENABLED must be set. The format is straightforward: {funcname([arg1,arg2,...]) text {/funcname Example: "This is {pad(50...
fake-name/ReadableWebProxy
WebMirror/management/rss_parser_funcs/feed_parse_extractInfiniteNovelTranslations.py
def extractInfiniteNovelTranslations(item): """ # Infinite Novel Translations """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None tagmap = [ ('Ascendance of a Bookworm', 'Ascend...
mick-d/nipype
nipype/interfaces/semtools/utilities/tests/test_auto_insertMidACPCpoint.py
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from __future__ import unicode_literals from ..brains import insertMidACPCpoint def test_insertMidACPCpoint_inputs(): input_map = dict(args=dict(argstr='%s', ), environ=dict(nohash=True, usedefault=True, ), ignore_exception=dict(nohash=True...
MAECProject/python-maec
maec/package/__init__.py
_namespace = 'http://maec.mitre.org/XMLSchema/maec-package-2' from .action_equivalence import ActionEquivalenceList, ActionEquivalence # noqa from .malware_subject_reference import MalwareSubjectReference # noqa from .object_equivalence import ObjectEquivalence, ObjectEquivalenceList # noqa from .analysis import (Anal...
mozilla/kitsune
kitsune/forums/events.py
from django.contrib.sites.models import Site from django.utils.translation import ugettext_lazy as _lazy from tidings.events import InstanceEvent, EventUnion from kitsune.forums.models import Thread, Forum from kitsune.sumo.email_utils import emails_with_users_and_watches from kitsune.sumo.templatetags.jinja_helpers ...
ZeitOnline/zeit.retresco
src/zeit/retresco/testing.py
from __future__ import absolute_import import gocept.httpserverlayer.custom import json import mock import pkg_resources import plone.testing import zeit.cms.content.interfaces import zeit.cms.testcontenttype.testcontenttype import zeit.cms.testing import zeit.content.article.testing import zeit.content.image.testing i...
DrAlexx/pdfium
testing/tools/gold.py
# Copyright 2015 The PDFium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import os import shlex import shutil # This module collects and writes output in a format expected by the # Gold baseline tool. Based on meta dat...
awacha/cct
cct/qtgui2/tools/capillarysizer/capillarysizer.py
import logging from typing import Optional, Tuple from PyQt5 import QtWidgets from matplotlib.axes import Axes, np from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT, FigureCanvasQTAgg from matplotlib.figure import Figure from matplotlib.lines import Line2D from .capillarysizer_ui import Ui_Form from...