repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
google-research/korvapuusti | listening_test_summer_2020/analysis/data_generation/data_analysis.py | # Lint as: python3
"""Functionality to plot and save the data generated by data_generation.py.
Copyright 2020 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/... |
h2oai/sparkling-water | py-scoring/tests/unit/simple/pySparklingImportLoadsJustScoringJar.py | from pysparkling import *
from pyspark.sql import SparkSession
import sys
spark = SparkSession.builder.appName("App name").master("local").getOrCreate()
# Check if Sparkling Water classes are available
jvm = spark.sparkContext._jvm
scoringPackage = getattr(jvm.ai.h2o.sparkling.ml.models, "H2OMOJOProps$")
scoringModule... |
henaras/sahara | sahara/service/networks.py | # Copyright (c) 2013 Mirantis 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 agreed to in writ... |
RudolfCardinal/pythonlib | cardinal_pythonlib/tools/__init__.py | #!/usr/bin/env python
# cardinal_pythonlib/tools/__init__.py
"""
===============================================================================
Original code copyright (C) 2009-2021 Rudolf Cardinal (rudolf@pobox.com).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2... |
foobarbecue/afterflight | afterflight/af_utils.py | #Copyright 2013 Aaron Curtis
#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... |
googleapis/python-dialogflow | samples/generated_samples/dialogflow_v2beta1_generated_agents_train_agent_async.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... |
digwanderlust/pants | tests/python/pants_test/tasks/test_bootstrap_jvm_tools_integration.py | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.util.cont... |
moloch--/TornadoAppTemplate | models/__init__.py | # -*- coding: utf-8 -*-
"""
@author: moloch
Copyright 2015
"""
import time
import logging
from tornado.options import options
from sqlalchemy import event, create_engine
from sqlalchemy.engine import Engine
from sqlalchemy.orm import scoped_session, sessionmaker
from libs.ConsoleColors import R, W, BLU, BOLD
from lib... |
ak681443/mana-deep | ae_tries/new_train.py | from keras.layers import Input, Dense, Convolution2D, MaxPooling2D, UpSampling2D
from keras.models import Model
from keras.callbacks import TensorBoard, ModelCheckpoint
from keras import regularizers
import tensorflow as tf
tf.python.control_flow_ops = tf
import os
from os import listdir
from os.path import isfile, ... |
mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/tests/python/integration/test_ewise_fpga.py | import tvm
import numpy as np
import os
os.environ["XCL_EMULATION_MODE"] = "1"
os.environ["CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA"] = "1"
@tvm.register_func
def tvm_callback_vhls_postproc(code):
"""Hook to inspect the Vivado HLS code before actually run it"""
print(code)
return code
def test_exp():
# g... |
baylee-d/cos.io | export_json.py | import json
import django
django.setup()
from common.models import Organization # NOQA
import io # NOQA
def save_to_journal_json(file_name, para_name, file_option):
bulk = []
get_entries = 'Journal.objects.filter(is_' + para_name + '_journal=True)'
entries = eval(get_entries)
if file_option == 1:
... |
tensorflow/data-validation | tensorflow_data_validation/utils/schema_util_test.py | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
tchellomello/home-assistant | homeassistant/components/darksky/sensor.py | """Support for Dark Sky weather service."""
from datetime import timedelta
import logging
import forecastio
from requests.exceptions import ConnectionError as ConnectError, HTTPError, Timeout
import voluptuous as vol
from homeassistant.components.sensor import DEVICE_CLASS_TEMPERATURE, PLATFORM_SCHEMA
from homeassist... |
mogproject/mog-commons-python | src/mog_commons/terminal.py | from __future__ import division, print_function, absolute_import, unicode_literals
import os
import sys
import codecs
import subprocess
import locale
import platform
import time
if os.name == 'nt':
# for Windows
import msvcrt
else:
# for Unix/Linux/Mac/CygWin
import termios
import tty
from mog_co... |
ibm-cds-labs/pixiedust | pixiedust/display/chart/renderers/bokeh/bkHistogramDisplay.py | # -------------------------------------------------------------------------------
# Copyright IBM Corp. 2017
#
# 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/licens... |
GoogleCloudPlatform/gsutil | gslib/tests/test_iam.py | # -*- coding: utf-8 -*-
# Copyright 2016 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 require... |
openstack/blazar | blazar/tests/utils/openstack/test_nova.py | # Copyright (c) 2013 Mirantis 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 agreed to in writ... |
HazyResearch/metal | metal/logging/checkpointer.py | import os
import torch
class Checkpointer(object):
def __init__(self, config, verbose=True):
"""Saves checkpoints as applicable based on a reported metric.
Args:
checkpoint_runway (int): don't save any checkpoints for the first
this many iterations
checkpo... |
dbrattli/RxPY | rx/linq/observable/combinelatest.py | from rx.observable import Observable
from rx.anonymousobservable import AnonymousObservable
from rx.disposables import CompositeDisposable, SingleAssignmentDisposable
from rx.internal import extensionmethod, extensionclassmethod
@extensionmethod(Observable, instancemethod=True)
def combine_latest(self, *args):
""... |
tombstone/models | orbit/runner.py | # Copyright 2020 The Orbit 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 applicable l... |
FederatedAI/FATE | python/federatedml/ensemble/basic_algorithms/decision_tree/tree_core/loss/test/regression_loss_test.py | #
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
patpatpatpatpat/stormpath-django | django_stormpath/models.py | """Custom Django User models for Stormpath.
Any application that uses django_stormpath must provide a user model with a
href field. The href is used in the authentication backend to keep track which
remote Stormpath user the local user represents. It is meant to be used in an
application that modifies user data on Sto... |
paullab/my-first-blog | blog/migrations/0003_post_photo.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-09 13:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0002_comment'),
]
operations = [
migrations.AddField(
mo... |
redhat-openstack/python-openstackclient | functional/tests/compute/v2/test_server_group.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... |
ray-project/ray | python/ray/train/callbacks/results_preprocessors/aggregate/aggregate_utils.py | import logging
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
from ray.util.debug import log_once
VALID_AGGREGATE_TYPES: Tuple[type] = (
int,
float,
np.float32,
np.float64,
np.int32,
np.int64,
)
logger = logging.getLogger(__name__)
def _check_if_key_is_reported(ke... |
sorenh/cc | nova/tests/future_unittest.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2010 Anso Labs, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... |
hulingfei/Shaka | bia-660/hw10/identify_negations.py | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 05 19:40:33 2015
@author: Lingfei Hu
"""
import nltk.data
import re
_POS_TAGGER = 'taggers/maxent_treebank_pos_tagger/english.pickle'
tagger=nltk.data.load( _POS_TAGGER )
#read the input
input_file = open('input.txt')
output_file = open('negations.txt', 'w')
for sen... |
ClockwerksSoftware/pyrft | pyrft/protocol/__init__.py | """
PyRFT - Python-based Reliable File Transfer
Copyright 2014 Clockwerks Software, 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 require... |
thingsboard/thingsboard-gateway | tests/data/modbus/modbus_server.py | from pymodbus.server.asynchronous import StartTcpServer, StopServer
from pymodbus.datastore import ModbusSequentialDataBlock
from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
from pymodbus.constants import Endian
from pymodbus.payload import BinaryPayloadBuilder
from time import sleep
import signal... |
UManPychron/pychron | pychron/image/tasks/save_view.py | # ===============================================================================
# Copyright 2015 Jake Ross
#
# 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... |
linktlh/Toontown-journey | toontown/battle/MovieSquirt.py | from direct.interval.IntervalGlobal import *
from BattleBase import *
from BattleProps import *
from BattleSounds import *
from toontown.toon.ToonDNA import *
from toontown.suit.SuitDNA import *
import MovieUtil
import MovieCamera
from direct.directnotify import DirectNotifyGlobal
import BattleParticles
from toontown.t... |
TheMysteriousX/SNMPv3-Hash-Generator | snmpv3_hashgen/hashgen.py | import hashlib
import string
import secrets
from itertools import repeat
from functools import partial
P_LEN = 32
E_LEN = 16
class Hashgen(object):
@staticmethod
def hash(bytes, alg=hashlib.sha1, name=None, raw=False):
digest = alg(bytes).digest()
return digest if raw else digest.hex()
... |
intel-analytics/analytics-zoo | pyzoo/test/zoo/pipeline/autograd/test_operator_special.py | #
# Copyright 2018 Analytics Zoo 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... |
snuffkingit/pycroservices | examples/ex2_manual_emit/word_counter.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from pycroservices import function
logger = logging.getLogger()
logger.setLevel(logging.INFO)
@function(auto_emit=False)
def split(event, context):
logger.info("receive={}".format(event))
words = event.split()
context.pycro_context.emit(words, ... |
dmugtasimov/django_audit_trail | audit_trail/admin.py | # pylint: disable=E1002,E1101
from django.contrib.contenttypes.models import ContentType
from django.contrib import admin
from django.contrib.admin import SimpleListFilter
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from d... |
waterblue13/tensor2tensor | tensor2tensor/data_generators/generator_utils.py | # coding=utf-8
# Copyright 2017 The Tensor2Tensor 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... |
hortonworks/hortonworks-sandbox | desktop/core/ext-py/Twisted/doc/core/examples/dbcred.py | #!/usr/bin/python
# Copyright (c) 2001-2007 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Simple example of a db checker: define a L{ICredentialsChecker} implementation
that deals with a database backend to authenticate a user.
"""
from twisted.cred import error
from twisted.cred.credentials import IUse... |
getninjas/adwords-client | adwords_client/adwords_api/operations/label.py | import logging
from .utils import _get_selector
logger = logging.getLogger(__name__)
def new_label_operation(label: 'String'= None,
operator: 'String' = 'ADD',
**kwargs):
if not label:
raise ValueError('Argument "label" must be provided in operation.')
... |
waterblue13/tensor2tensor | tensor2tensor/models/lstm_test.py | # coding=utf-8
# Copyright 2017 The Tensor2Tensor 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... |
nathanbjenx/cairis | cairis/bin/add_cairis_user.py | #!/usr/bin/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
# "... |
hoangelos/Herd | lib/herd/herd_config.py | # -*- coding: utf-8 -*-
## Copyright 2012 Peter Halliday
##
## 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... |
laurenbarker/SHARE | share/migrations/0010_auto_20161212_1418_b.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-12-12 14:18
from __future__ import unicode_literals
import db.deletion
from django.conf import settings
from django.db import migrations, models
import share.models.fields
class Migration(migrations.Migration):
dependencies = [
('share', '0010_... |
googleapis/python-recaptcha-enterprise | samples/generated_samples/recaptchaenterprise_v1_generated_recaptcha_enterprise_service_create_key_async.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... |
googleapis/python-os-config | samples/generated_samples/osconfig_generated_osconfig_v1_os_config_service_list_patch_deployments_async.py | # -*- coding: utf-8 -*-
# Copyright 2020 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... |
blackberry/lifeguard | app/views/template/models.py | from jinja2 import BaseLoader, TemplateNotFound
class ObjectLoader(BaseLoader):
def get_source(self, environment, obj):
return obj, None, None
class VarParser():
@staticmethod
def parse_kv_strings_to_dict(*args):
"""
Parse 1 or more string/dict objects containing template
variables in a final ... |
asimihsan/mindgames-webpage | src/upload.py | #!/usr/bin/env python
import boto
import contextlib
import cStringIO as StringIO
import datetime
import os
import pprint
import re
# -----------------------------------------------------------------------------
# Logging.
# -----------------------------------------------------------------------------
import logging... |
sonoprob/0x56 | bot/py/py-irc-8.5.1/scripts/testbot.py | #! /usr/bin/env python
#
# Example program using irc.bot.
#
# Joel Rosdahl <joel@rosdahl.net>
"""A simple example bot.
This is an example bot that uses the SingleServerIRCBot class from
irc.bot. The bot enters a channel and listens for commands in
private messages and channel traffic. Commands in channel messages
a... |
almarklein/flexx | flexx/react/tests/test_both.py | """
Tests that should run in both Python and JS.
This helps ensure that both implementation work in the same way.
Focus on use-cases rather than coverage.
These tests work a bit awkward, but its very useful to be able to test
that the two systems work exactly the same way. You define a class with
signals, and then pr... |
analytehealth/chronicler | chronicler/models.py | ''' Audit Log Models '''
import json
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django import dispatch
from django.conf import settings
from .utils import serialize_data, data_has_changes
audit = dispat... |
wheelcms/wheelcms_project | wheelcms_project/settings/base/settings_locale.py | from .util import get_env_variable
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the ope... |
lowRISC/edalize | edalize/vivado.py | import logging
import os.path
import platform
import re
import subprocess
from edalize.edatool import Edatool
logger = logging.getLogger(__name__)
""" Vivado Backend
A core (usually the system core) can add the following files:
- Standard design sources
- Constraints: Supply xdc files with file_type=xdc or unmana... |
nebgnahz/CS268NetworkMeasurement | mobile/tracerouteParse.py | """
Traceroute log parser
"""
import time, re, sys, argparse, datetime
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy import Column, Integer, PickleType, String
from sqlalchemy.ext.declarative import declarative_base
from multiprocessing import Pool
from os import listdir... |
edgarklerks/composablepairingheap | tests/heap_test.py | from hypothesis import *
import data.composablepairingheap as c
import data.optional as o
import random as r
import hypothesis.settings as hs
from hypothesis.database.backend import SQLiteBackend
from hypothesis.database import ExampleDatabase
# The reference identity is like the pointer identity,
# it will reflect th... |
idnrfc/Crypto-Nexus | Crypto-Nexus/MainToolGUI_UI.py | """
개발환경 : PyQt5 x64, Python 3.4.3 x64, Windows 8.1 x64
파일 : MainToolGUI_UI.py
내용 : UI의 기본 구성을 위한 파이썬 코드로, 그냥 매우 길어서 분리해놨음...ㅡ,.ㅡ
"""
from functools import partial
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from _thread import *
import sys
import urllib.request
class MainTool... |
streamlink/streamlink | tests/plugins/test_onetv.py | from streamlink.plugins.onetv import OneTV
from tests.plugins import PluginCanHandleUrl
class TestPluginCanHandleUrlOneTV(PluginCanHandleUrl):
__plugin__ = OneTV
should_match = [
"https://www.1tv.ru/live",
"http://www.1tv.ru/live",
"https://static.1tv.ru/eump/embeds/1tv_live_orbit-plu... |
feixiao5566/Py_Rabbic | 1OOP/student.py | #!/usr/bin/env python
# encoding: utf-8
class Student(object):
def __init__(self, name, score):
self.name = name
self.score = score
def print_score(self):
print("%s:%s" % (self.name,self.score))
bart = Student("Bart Simpson", 59)
lisa = Student("Lisa Simpson", 87)
bart.print_score()
... |
tactcomplabs/gc64-hmcsim | test/sst/6.0.0/goblin_singlestream1-trace.py | import sst
# Define SST core options
sst.setProgramOption("timebase", "1ps")
sst.setProgramOption("stopAtCycle", "0 ns")
# Define the simulation components
comp_cpu = sst.Component("cpu", "miranda.BaseCPU")
comp_cpu.addParams({
"verbose" : 0,
"generator" : "miranda.SingleStreamGenerator",
"generatorParams.verbose"... |
kvantos/intro_to_python_class | classwork/lesson_classes2.py | from student import Student
from proffesor import Proffesor
if __name__ == '__main__':
st1 = Student("Bill", 22)
st2 = Student("Alice", 24)
print(st2.name, st2.age)
print(id(st2))
st1.print_info()
st2.print_info()
st1.accept_task(2)
st1.accept_test(10)
st1.prin... |
wheelcms/wheelcms_comments | wheelcms_comments/migrations/0001_initial.py | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
("wheelcms_axle", "0001_initial.py"),
)
def forwards(self, orm):
# Adding model 'Comment'
db.create_t... |
amplifylitco/asiaq | disco_aws_automation/disco_app_auth.py | """
Generate App auth password and upload to S3 code
"""
from __future__ import print_function
import os
import re
# Pylint thinks string is a deprecated module
# pylint: disable=W0402
import string
import random
from hashlib import sha512
from base64 import standard_b64encode
from . import DiscoS3Bucket
from .disco_... |
Puppet-Finland/trac | files/spam-filter/tracspamfilter/filters/regex.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2006 Edgewall Software
# Copyright (C) 2005 Matthew Good <trac@matt-good.net>
# Copyright (C) 2006 Christopher Lenz <cmlenz@gmx.de>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of th... |
aio-libs/aiozmq | tests/rpc_namespace_test.py | import unittest
import asyncio
import aiozmq
import aiozmq.rpc
from aiozmq._test_util import find_unused_port
class MyHandler(aiozmq.rpc.AttrHandler):
@aiozmq.rpc.method
async def func(self, arg):
return arg + 1
class RootHandler(aiozmq.rpc.AttrHandler):
ns = MyHandler()
class RpcNamespaceTes... |
GeotrekCE/Geotrek-admin | geotrek/trekking/tests/factories.py | import factory
from django.conf import settings
from django.contrib.gis.geos import Point
from .. import models
from geotrek.core.tests.factories import TopologyFactory, PointTopologyFactory
from geotrek.common.tests.factories import ReservationSystemFactory
from geotrek.common.utils.testdata import get_dummy_uploaded... |
desaster/uusipuu | uusipuu.py | #!/usr/bin/env python
# -*- coding: ISO-8859-15 -*-
# doing execfile() on this file will alter the current interpreter's
# environment so you can import libraries in the virtualenv
#activate_this_file = "env2/bin/activate_this.py"
#execfile(activate_this_file, dict(__file__=activate_this_file))
from core import Uusip... |
awemulya/fieldsight-kobocat | onadata/apps/userrole/models.py | from datetime import datetime
from django.core.urlresolvers import reverse
from fcm.utils import get_device_model
from django.contrib.auth.models import Group
from django.core.exceptions import ValidationError
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.db.mo... |
Nextdoor/buckle | buckle/commands/init.py | """ buckle init command
Prints shell commands for auto-complete.
"""
from __future__ import print_function
import os
import sys
import argparse
import pkg_resources
SETUP_SCRIPT = """\
_buckle_autocomplete_setup "{toolbelt_name}"
"""
def main(argv=sys.argv):
parser = argparse.ArgumentParser(description='Se... |
JacekPierzchlewski/RxCS | rxcs/console.py | """
Module contains console printing functions for the RXCS. |br|
All of the console print in RxCS should be done using functions
from this module.
*Author*:
Jacek Pierzchlewski, Aalborg University, Denmark. <jap@es.aau.dk>
*Version*:
0.1 | 14-MAY-2014 : * Initial version. |br|
0.2 | 15-MAY-2014 : * Doc... |
sniemi/SamPy | sandbox/src1/fractal.py | """
draw a fractal tree using PIL, code adopted from:
http://www.math.union.edu/research/fractaltrees/
uses the Python Image Library (PIL) free from:
http://www.pythonware.com/products/pil/index.htm
"""
import os
import math
# needs Python Image Library (PIL)
from PIL import Image, ImageDraw
def fractal_tree(iter, o... |
ColumbiaCMB/kid_readout | apps/data_taking_scripts/cooldown/2016-06-09_hpd/sweepstream_r2.py | """
Measure one resonator per LO frequency. Since each measurement has only one channel, record SingleSweepStreams.
"""
import time
import logging
import numpy as np
from kid_readout.utils import log
from kid_readout.roach import hardware_tools, analog
from kid_readout.measurement import acquire, basic
from kid_reado... |
jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_cond_format02.py | ###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... |
jonathansick/preprint | preprint/latexdiff.py | #!/usr/bin/env python
# encoding: utf-8
"""
Command for running latexdiff.
"""
import logging
import os
import subprocess
import codecs
import shutil
import git
from paperweight.texutils import inline, inline_blob, remove_comments
from paperweight.gitio import read_git_blob, absolute_git_root_dir
from cliff.command ... |
niklasf/python-prompt-toolkit | prompt_toolkit/contrib/telnet/server.py | """
Telnet server.
Example usage::
class MyTelnetApplication(TelnetApplication):
def client_connected(self, telnet_connection):
# Set CLI with simple prompt.
telnet_connection.set_application(
telnet_connection.create_prompt_application(...))
def handle_com... |
andrelucas/hsync | tests/test_unit_pwmgr.py | # Test (trivially) the local password manager wrapper.
# Copyright (c) 2015, Andre Lucas
# 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 abo... |
oesteban/niworkflows | niworkflows/interfaces/itk.py | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <nipreps@gmail.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... |
gabrielcsapo/dobby | dobby/examples/splitview.py | import dobby
class Graze(dobby.App):
def startup(self):
main_container = dobby.Container()
main_button = dobby.Button("Change Direction", on_click=self.toggle_direction)
main_container.add(main_button)
main_container.constrain(main_button.TOP == main_container.TOP + 5)
mai... |
v-legoff/pa-poc2 | ext/aboard/service/default/wiki.py | # Copyright (c) 2012 LE GOFF Vincent
# 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 conditions and ... |
reflectometry/osrefl | osrefl/loaders/reduction/qxqz.py | # This code is public domain
# Author: Paul Kienzle
"""
Translate coordinates between real and reciprical space.
"""
import numpy
from numpy import sin, cos, pi, arcsin, sqrt, arctan2, degrees, radians
def ABL_to_QxQz(sample_angle, detector_angle, wavelength):
"""
Compute Qx,Qz given incident and reflected an... |
Mediator/HollowCraft | contrib/test-blocks.py | #!/usr/bin/env python
from minecraft import *
class TestBot(AlphaConnection):
def __init__(self, user, passwd, host, port):
super(TestBot, self).__init__(user, passwd, host, port);
self.blockCount = 0
def onSelfSpawn(self):
self.client_setBlock(28, 28, 32, 0, 0);
self.client_setBlock(28, 28, 32, 1, 0);
d... |
ru-faraon/the-backdoor-factory | backdoor.py | #!/usr/bin/env python2
'''
BackdoorFactory (BDF) v3 - FOUNTAINPATCH
Many thanks to Ryan O'Neill --ryan 'at' codeslum <d ot> org--
Without him, I would still be trying to do stupid things
with the elf format.
Also thanks to Silvio Cesare with his 1998 paper
(http://vxheaven.org/lib/vsc01.html) which these ELF patching... |
ojii/webservices | webservices/models.py | # -*- coding: utf-8 -*-
from itsdangerous import TimedSerializer, SignatureExpired, BadSignature
from webservices.exceptions import BadRequest, WebserviceError
import urlparse
PUBLIC_KEY_HEADER = 'x-services-public-key'
def _split_dsn(dsn):
parse_result = urlparse.urlparse(dsn)
host = parse_result.hostname
... |
zorna/zorna | zorna/site/forms.py | from django.forms import ModelForm
from django import forms
from django.utils.translation import ugettext_lazy as _
from zorna.site.models import SiteAlert, SiteRegistration
from zorna.calendars.models import ZornaCalendarCategory
class SiteAlertAdminAddForm(ModelForm):
def __init__(self, data=None, **keyw):
... |
fr0uty/oartm | oar/lib/fixture.py | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import re
import time
from codecs import open
from collections import OrderedDict
from datetime import datetime
from .compat import json, iteritems, itervalues, iterkeys
from .utils import JSONEncoder, ResultProxyIter
class JsonSeriali... |
goddardl/gaffer | python/GafferImageTest/CopyImageMetadataTest.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... |
mishbahr/staticgen-demo | staticgen_demo/plugins/picture/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import filer.fields.image
class Migration(migrations.Migration):
dependencies = [
('cms', '0013_urlconfrevision'),
('filer', '0002_auto_20150606_2003'),
]
operations = [
mig... |
mojodna/TileStache | setup.py | #!/usr/bin/env python
from distutils.core import setup
version = open('VERSION', 'r').read().strip()
setup(name='TileStache',
version=version,
description='A stylish alternative for caching your map tiles.',
author='Michal Migurski',
author_email='mike@stamen.com',
url='http://tilestach... |
yaccz/war | war/protocol/server.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import logging
log = logging.getLogger(__name__)
from gevent import Greenlet
from war.protocol.messages import factory
from war.protocol.core import Protocol
from war.world import World, Player, Coord
states = [
'NEW_CLIENT',
'GAME_CHALLENGE',
'GAME_IN_PROG... |
tommy-u/enable | examples/kiva/star.py | from __future__ import with_statement
from scipy import pi
from kiva.image import GraphicsContext
def add_star(gc):
gc.begin_path()
gc.move_to(-20,-30)
gc.line_to(0,30)
gc.line_to(20,-30)
gc.line_to(-30,10)
gc.line_to(30,10)
gc.close_path()
gc.move_to(-10,30)
gc.line_to(10,30)
gc ... |
nbari/my-sandbox | python/xor/xor_js.py | s1 = '1392216676293'
s2 = '18NYGMM7TOG'
def xor(data, key):
l = len(key)
buff = []
for idx, val in enumerate(data):
buff.append(chr(ord(val) ^ ord(key[idx % l])))
print val, key[idx % l], idx, ord(val)
return ''.join(buff)
print xor(s1, s2)
def xor_str(a, b):
result = int(a, 36)... |
jyt109/termite-data-server | bin/import_gensim.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import json
from gensim import corpora, models
from import_abstr import ImportAbstraction
class ImportGensim( ImportAbstraction ):
def __init__( self, app_name, app_model = 'lda', app_desc = 'Gensim Topic Model' ):
ImportAbstraction.__init__( self, ap... |
wengzhilai/family | iSoft/dal/UserDal.py | '''用户业务处理'''
from iSoft.entity.model import db, FaUser, FaModule, FaRole, FaLogin
import math
from iSoft.model.AppReturnDTO import AppReturnDTO
from iSoft.core.Fun import Fun
import numpy
from iSoft.model.LogingModel import LogingModel
import hashlib
import iSoft.entity.model
from sqlalchemy import and_
from iSoft.cor... |
wdm0006/petersburg | petersburg/__init__.py | """
.. module:: petersburg
:platform: Unix, Windows
:synopsis:
.. moduleauthor:: Will McGinnis <will@pedalwrencher.com>
"""
from petersburg.edges import Edge
from petersburg.nodes import Node
from petersburg.graph import Graph
from petersburg.estimators import FrequencyEstimator, MixedModeEstimator
__all__ =... |
ChenHsiang/dadi | dadi/__init__.py | """
For examples of dadi's usage, see the examples directory in the source
distribution.
Documentation of all methods can be found in doc/api/index.html of the source
distribution.
"""
import logging
logging.basicConfig()
import Demographics1D
import Demographics2D
import godambe
import Inference
import Integration
i... |
omg-insa/server | api/urls.py | from django.conf.urls.defaults import *
handler500 = 'djangotoolbox.errorviews.server_error'
urlpatterns = patterns('',
(r'^login/$', 'api.views.login'),
(r'^register/$', 'api.views.register'),
(r'^get_user_info/$', 'api.views.getUserInfo'),
(r'^get_full_user_info/$', 'api.views.getFullUserInfo'),
(r'^updat... |
frc1418/2014 | driver_station/src/ui/widgets/network_tables.py | #
# This file is part of KwarqsDashboard.
#
# KwarqsDashboard 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, version 3.
#
# KwarqsDashboard is distributed in the hope that it will be useful,
# but... |
wesm/statsmodels | scikits/statsmodels/examples/tsa/ar1cholesky.py | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 21 15:42:18 2010
Author: josef-pktd
"""
import numpy as np
from scipy import linalg
def tiny2zero(x, eps = 1e-15):
'''replace abs values smaller than eps by zero, makes copy
'''
mask = np.abs(x.copy()) < eps
x[mask] = 0
return x
nobs = 5
autocov =... |
gilramir/instmake | utlib/cli.py | # Copyright (c) 2016 by Gilbert Ramirez <gramirez@a10networks.com>
import unittest
from utlib import base
from utlib import util
from instmakelib.shellsyntax import split_shell_cmdline
class CliTest(unittest.TestCase, base.TestBase):
def test_simple(self):
cmdline = "gcc -o x.o x.c"
cmdv = ["gc... |
dinhkhanh/trac | sample-plugins/workflow/CodeReview.py | from genshi.builder import tag
from trac.core import implements,Component
from trac.ticket.api import ITicketActionController
from trac.ticket.default_workflow import ConfigurableTicketWorkflow
from trac.perm import IPermissionRequestor
from trac.config import Option, ListOption
revision = "$Rev: 11075 $"
url = "$URL... |
matteobachetti/srt-single-dish-tools | srttools/tests/test_simulate.py | import numpy as np
import shutil
import os
import pytest
import subprocess as sp
from astropy.io import fits
from srttools.io import mkdir_p
from srttools.simulate import (
simulate_map,
simulate_sun,
simulate_scan,
sim_position_switching,
sim_crossscans,
)
from srttools.simulate import _default_map... |
hiveary/hiveary-agent | hiveary/controller.py | #!/usr/bin/env python
"""
Hiveary
https://hiveary.com
Licensed under Simplified BSD License (see LICENSE)
(C) Hiveary, Inc. 2013-2014 all rights reserved
"""
import glob
import impala
import importlib
import inspect
import json
import logging
import os
import signal
import socket
import subprocess
import sys
from twi... |
morepath/more.jwtauth | more/jwtauth/main.py | """Provides the JWTIdentityPolicy.
The following settings are available:
* master_secret: A secret known only by the server, used for
the default HMAC (HS*) algorithm.
* private_key: An Elliptic Curve or an RSA private_key used for
the EC (EC*) or RSA (PS*/RS*) algorithms.
* private_key... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.