repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
billiob/papyon | papyon/gnet/parser.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2005 Ole André Vadla Ravnås <oleavr@gmail.com>
# Copyright (C) 2006 Ali Sabil <ali.sabil@gmail.com>
#
# 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; ... |
rizen1892/SmartHomeSolutions-Web | app/recording.py | class RecordingException(Exception):
pass
class Recording(object):
def __init__(self, stream, lenght):
import command
self.name = None
self.time = None
self.lenght = lenght
self.path = None
self._temp_path = None
self._processing_list = []
if i... |
MengbinZhu/pfldp | ropp-7.0/grib_api-1.9.9/examples/python/clone.py | import traceback
import sys
import random
from gribapi import *
INPUT='../../data/constant_field.grib1'
OUTPUT='out.grib'
VERBOSE=1 # verbose error reporting
def example():
fin = open(INPUT)
fout = open(OUTPUT,'w')
gid = grib_new_from_file(fin)
nx = grib_get(gid,'Ni')
ny = grib_get(gid,'Nj')
... |
cylc/cylc | tests/integration/utils/test_utils.py | # THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & 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, either version 3 of the Licen... |
e1211205/pimouse_ros | scripts/buzzer4.py | #!/usr/bin/env python
#encoding: utf8
import rospy, actionlib
from std_msgs.msg import UInt16
from pimouse_ros.msg import MusicAction, MusicResult, MusicFeedback
def write_freq(hz=0):
bfile = "/dev/rtbuzzer0"
try:
with open(bfile,"w") as f:
f.write(str(hz) + "\n")
except IOError:
... |
madscatt/zazzie | src_2.7/sassie/analyze/altens/altens.py | '''
SASSIE: Copyright (C) 2011-2016 Joseph E. Curtis, Ph.D.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.... |
erjohnso/ansible | lib/ansible/plugins/action/ironware.py | #
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... |
metiscus/pychess | lib/pychess/Savers/pgn.py | # -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import re
from datetime import date
from pychess.compat import basestring, StringIO
from pychess.System import conf
from pychess.System.Log import log
from pychess.Utils.Board i... |
frappe/erpnext | erpnext/payroll/doctype/gratuity/test_gratuity.py | # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import unittest
import frappe
from frappe.utils import add_days, flt, get_datetime, getdate
from erpnext.hr.doctype.employee.test_employee import make_employee
from erpnext.hr.doctype.expense_claim.test_expense_claim import get_pa... |
michelts/aloe_django | tests/integration/django/dill/leaves/features/steps.py | #
import io
import json
import sys
from django.core.management import call_command
from leaves.models import (
Harvester,
Panda,
)
from aloe import after, step
from aloe.tools import guess_types
from aloe_django.steps.models import (
test_existence,
tests_existence,
write_models,
writes_mode... |
samhoo/askbot-realworld | askbot/migrations/0050_move_qa_revisions_to_postrevision.py | # encoding: utf-8
import datetime
from django.db import models
from south.db import db
from south.v2 import DataMigration
class Migration(DataMigration):
def copy_revision(self, orm, source_revision):
question = getattr(source_revision, 'question', None)
answer = getattr(source_revision, 'answer... |
chfoo/wpull | wpull/util_test.py | # encoding=utf-8
import os
import sys
import tempfile
import unittest
from dns.resolver import NoNameservers
from wpull.util import (datetime_str, python_version, filter_pem,
parse_iso8601_str, is_ascii, close_on_error,
get_exception_message, GzipPickleStream)
DEFAULT_... |
osdlyrics/osdlyrics | python/dbusext/property.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Tiger Soldier
#
# This file is part of OSD Lyrics.
#
# OSD Lyrics 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 ... |
drmpeg/gr-dvbt2 | apps/vv016_256qam34.py | #!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Vv016 256Qam34
# Generated: Wed Feb 11 04:36:51 2015
##################################################
# Call XInitThreads as the _very_ first thing.
# After some Qt import, it's too late
import ctypes
impor... |
jabauer/ProjectQuincy | activities/models.py | #This is the models.py file for the ACTIVITIES app
#These classes constitute the Organizations and Assignments modules in the database
#Will eventually be expanded to include events.
#Essentially -- anything where a person came to a location for a reason.
from django.db import models
from people.models import Individu... |
capoe/espressopp.soap | src/Int3D.py | # Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of t... |
wysiwyng/sr13 | voltaged.py | # Copyright (C) 2105 wysiwyng
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is d... |
matthewkenzie/gammacombo | scripts/plotModuleExample.py | #!/usr/bin/env python
import ROOT as r
def setTextBoxAttributes(text, color, font):
text.SetTextColor(color)
text.SetTextAlign(13)
text.SetTextSize(0.04)
text.SetTextFont(font)
def dress(canv, colors):
# need this to keep the objects alive
objs = []
vub_inc = r.TLatex(0.16,0.655,"V_{ub} inclusive")
... |
pombredanne/Octopus | octopus/backends/docker.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2015 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This ... |
jonnatas/codeschool | old/cs_auth/test_app.py | from codeschool.tests import *
from cs_auth.factories import *
# Fixtures
register(FriendshipStatusFactory)
class TestURLs(URLBaseTester):
public_urls = [
'/',
'/accounts/login',
'/accounts/signout',
]
login_urls = [
'/accounts/{user.username}/edit',
'/accounts/{us... |
petricm/DIRAC | WorkloadManagementSystem/Agent/OptimizerModule.py | ########################################################################
# File : Optimizer.py
# Author : Stuart Paterson
########################################################################
"""
The Optimizer base class is an agent that polls for jobs with a specific
status and minor status pair. The checkJo... |
TaskEvolution/Task-Coach-Evolution | taskcoach/taskcoachlib/thirdparty/src/reportlab/pdfgen/pdfimages.py | #Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfgen/pdfimages.py
__version__=''' $Id$ '''
__doc__="""
Image functionality sliced out of canvas.py for generalization
"""
import os
import string
fr... |
larsbergstrom/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorwebdriver.py | import json
import os
import socket
import sys
import threading
import time
import traceback
import urlparse
import uuid
from .base import (CallbackHandler,
RefTestExecutor,
RefTestImplementation,
TestharnessExecutor,
extra_timeout,
... |
Yukarumya/Yukarum-Redfoxes | toolkit/mozapps/update/updater/gen_cert_header.py | from __future__ import print_function
import binascii
def file_byte_generator(filename, block_size = 512):
with open(filename, "rb") as f:
while True:
block = f.read(block_size)
if block:
for byte in block:
yield byte
else:
break
def create_header(out_fh, in_filename... |
garbas/mozilla-releng-services | src/shipit_taskcluster/tests/test_tc_utils.py | # -*- coding: utf-8 -*-
import pytest
from unittest.mock import patch
import os
import json
from shipit_taskcluster.taskcluster_utils import get_queue_group_state
def mocked_listtaskgroup(task_group_id):
filename = os.path.join(os.path.dirname(__file__), 'testdata', task_group_id)
with open(filename, 'r') as... |
policycompass/policycompass-services | apps/referencepool/management/commands/harvest.py | from django.core.management.base import BaseCommand
from django.db.utils import IntegrityError
from apps.referencepool.models import *
import requests
import json
import os
__author__ = 'fki'
class Command(BaseCommand):
help = 'Harvest external resources to fill the Reference Pool'
def handle(self, *args, *... |
xorpaul/shinken | shinken/objects/checkmodulation.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... |
miptliot/edx-platform | lms/djangoapps/courseware/views/index.py | """
View for Courseware Index
"""
import logging
import urllib
# pylint: disable=attribute-defined-outside-init
from datetime import datetime
import waffle
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.context_pro... |
marwoodandrew/superdesk-core | superdesk/factory/sentry.py |
import logging
from raven.contrib.flask import Sentry
from raven.contrib.celery import register_signal, register_logger_signal
class SuperdeskSentry():
"""Sentry proxy that will do nothing in case sentry is not configured."""
def __init__(self, app):
if app.config.get('SENTRY_DSN'):
app.... |
litui/openparliament | parliament/committees/admin.py | from django.contrib import admin
from parliament.committees.models import *
class CommitteeAdmin(admin.ModelAdmin):
list_display = ('short_name', 'slug', 'latest_session', 'display')
list_filter = ('sessions', 'display')
class CommitteeInSessionAdmin(admin.ModelAdmin):
list_display = ('committee', 'acron... |
1flow/1flow | oneflow/core/admin/__init__.py | # -*- coding: utf-8 -*-
u"""
Copyright 2013-2014 Olivier Cortès <oc@1flow.io>.
This file is part of the 1flow project.
1flow is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of
the License... |
gangadhar-kadam/hrerp | erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
import frappe.defaults
from frappe.utils import cint
class TestPurchaseReceipt(unittest.TestCase):
def test_make_pur... |
igor-sfdc/qt-wk | doc/src/diagrams/contentspropagation/customwidget.py | #!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
## Contact: Nokia Corporation (qt-info@nokia.com)
##
## This file is part of the documentation of the Qt Toolkit.
##
## $QT_... |
willprice/python-omxplayer-wrapper | tests/unit/test_dbus_connection.py | import unittest
from parameterized import parameterized
from mock import patch, Mock
from dbus import DBusException
from omxplayer.dbus_connection import DBusConnection, DBusConnectionError
@patch('dbus.bus.BusConnection')
class DBusConnectionTests(unittest.TestCase):
def setUp(self):
self.proxy = Mock(... |
dtklein/vFense | tp/src/utils/_constants.py | import os
from OpenSSL.crypto import TYPE_RSA, TYPE_DSA, FILETYPE_PEM
from vFense import VFENSE_SSL_PATH
class SSLConstants():
RSA = TYPE_RSA
DSA = TYPE_DSA
PEM = FILETYPE_PEM
SSL_DIR = VFENSE_SSL_PATH
SERVER = 'server'
PRIV_NAME = 'server.key'
CERT_NAME = 'server.crt'
CSR_NAME = 's... |
OpenLinkedSocialData/ocd | OCD.py | #!/usr/bin/python
#-*- coding: utf-8 -*-
import cPickle as pickle, time, string
from SPARQLWrapper import SPARQLWrapper, JSON
import rdflib as r, pygraphviz as gv
import pylab as pl
# variaveis principais:
# classes (kk), props,
# vizinhanca_ (de classes)
T=time.time()
U=r.URIRef
def fazQuery(query):
NOW=time.tim... |
joachimmetz/dfvfs | tests/file_io/hfs_file_io.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the Extended File System (HFS) file-like object."""
import unittest
from dfvfs.file_io import hfs_file_io
from dfvfs.lib import definitions
from dfvfs.lib import errors
from dfvfs.path import factory as path_spec_factory
from dfvfs.resolver import context
fr... |
scotwk/cloud-custodian | c7n/resources/elb.py | # Copyright 2015-2017 Capital One Services, 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 ... |
noironetworks/neutron | neutron/db/migration/alembic_migrations/versions/newton/contract/3b935b28e7a0_migrate_to_pluggable_ipam.py | # Copyright 2016 OpenStack Foundation
#
# 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 ... |
googleads/googleads-dfa-reporting-samples | python/v3_5/get_user_role_permissions.py | #!/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... |
jmontleon/ansible-service-broker | scripts/create_broker_secret.py | #! /usr/bin/env python
import sys
import yaml
import subprocess
USAGE = """USAGE:
{command} NAME NAMESPACE IMAGE [KEY=VALUE]* [@FILE]*
NAME: the name of the secret to create/replace
NAMESPACE: the target namespace of the secret. It should be the namespace of the broker for most usecases
IMAGE: the do... |
calpeyser/google-cloud-python | vision/tests/unit/test_client.py | # Copyright 2016 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 required by applicable law or agreed to in writing, ... |
idaholab/raven | doc/workshop/ExternalModels/Bateman/AnalyticalDplMain.py | # Copyright 2017 Battelle Energy Alliance, 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 t... |
zooniverse/aggregation | experimental/algorithms/chimp.py | #!/usr/bin/env python
__author__ = 'greghines'
import numpy as np
import os
import pymongo
import urllib
import matplotlib.pyplot as plt
import cv2
# the directory to store the movie preview clips in
image_directory = "/home/greg/Databases/chimp/images/"
# connect to the mongodb server
client = pymongo.MongoClient()
... |
mostafa-mahmoud/sahwaka | tests/collaborative_tests.py | #!/usr/bin/env python
import numpy
import unittest
from lib.abstract_recommender import AbstractRecommender
from lib.collaborative_filtering import CollaborativeFiltering
from lib.evaluator import Evaluator
from util.data_parser import DataParser
from util.model_initializer import ModelInitializer
class TestcaseBase(... |
w1ll1am23/home-assistant | homeassistant/components/flo/device.py | """Flo device object."""
from __future__ import annotations
import asyncio
from datetime import datetime, timedelta
from typing import Any
from aioflo.api import API
from aioflo.errors import RequestError
from async_timeout import timeout
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.... |
frreiss/tensorflow-fred | tensorflow/lite/python/metrics_nonportable_test.py | # Lint as: python2, 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
#
... |
nerdvegas/rez | src/rez/status.py | # SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Rez Project
from __future__ import print_function
import sys
import os
import os.path
from fnmatch import fnmatch
from rez import __version__
from rez.utils.data_utils import cached_property
from rez.resolved_context import ResolvedContext
from re... |
djkonro/client-python | kubernetes/client/models/v1_binding.py | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... |
malaterre/ITK | Wrapping/Generators/Python/Tests/lazy.py | #==========================================================================
#
# Copyright NumFOCUS
#
# 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/l... |
diagonalwalnut/Experience | lrs/util/req_validate.py | import json
import urllib2
from isodate.isodatetime import parse_datetime
from isodate.isoerror import ISO8601Error
from django.conf import settings
from util import validate_uuid, convert_to_dict, get_agent_ifp
from Authorization import auth
from StatementValidator import StatementValidator
from ..models import Sta... |
calpeyser/google-cloud-python | storage/tests/unit/test_batch.py | # Copyright 2014 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 required by applicable law or agreed to in writing, ... |
punchagan/zulip | tools/run-dev.py | #!/usr/bin/env python3
import argparse
import os
import pwd
import signal
import subprocess
import sys
from typing import Any, Callable, Generator, List, Sequence
from urllib.parse import urlunparse
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
# check for the v... |
partofthething/home-assistant | homeassistant/components/auth/__init__.py | """Component to allow users to login and get tokens.
# POST /auth/token
This is an OAuth2 endpoint for granting tokens. We currently support the grant
types "authorization_code" and "refresh_token". Because we follow the OAuth2
spec, data should be send in formatted as x-www-form-urlencoded. Examples will
be in JSON ... |
redhat-openstack/manila | manila/tests/api/v1/test_share_types.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 required by applicable l... |
apache/incubator-systemml | src/main/python/tests/matrix/test_transpose.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 unde... |
jabesq/home-assistant | homeassistant/components/ads/__init__.py | """Support for Automation Device Specification (ADS)."""
import threading
import struct
import logging
import ctypes
from collections import namedtuple
import asyncio
import async_timeout
import voluptuous as vol
from homeassistant.const import (
CONF_DEVICE, CONF_IP_ADDRESS, CONF_PORT, EVENT_HOMEASSISTANT_STOP)
... |
clarkperkins/stackdio | stackdio/api/formulas/exceptions.py | # -*- coding: utf-8 -*-
# Copyright 2017, Digital Reasoning
#
# 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... |
Khushbu27/Tutorial | test/functional/test_container.py | #!/usr/bin/python
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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... |
devoid/nova | nova/tests/scheduler/test_host_filters.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 req... |
mrzl/ECO | src/experiments/textparser.py | from pattern.en import parse, Text
class TextParser(object):
def __init__(self):
self.proper_sentences = []
self.MIN_WORD_COUNT = 10
@staticmethod
def get_count_tag(sentence, tag):
count = 0
for word in sentence:
if word.type == tag:
count += 1
... |
seanli9jan/tensorflow | tensorflow/python/data/experimental/ops/map_defun.py | # Copyright 2018 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... |
emory-libraries/findingaids | findingaids/utils.py | # file findingaids/utils.py
#
# Copyright 2015 Emory University Library
#
# 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... |
stackforge/watcher | watcher/common/config.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the ... |
CRImier/pyLCI | output/drivers/pfcad.py | import pifacecad
from time import sleep
class Screen():
""" A driver for PiFace Control and Display Raspberry Pi shields. It has a simple 16x2 LCD on it, controlled by a MCP23S17 over SPI.
Doesn't yet conform to HD44780 library specs, many functions are not transferred from the ``pifacecad`` library.
TOD... |
uskudnik/ggrc-core | src/ggrc/migrations/versions/20140930092005_53bb0f4f6ec8_switch_fulltext_record_properties.py |
"""Switch fulltext_record_properties to innodb
Revision ID: 53bb0f4f6ec8
Revises: 63fc392c91a
Create Date: 2014-09-30 09:20:05.884100
"""
# revision identifiers, used by Alembic.
revision = '53bb0f4f6ec8'
down_revision = '63fc392c91a'
from alembic import op
def upgrade():
op.drop_index('fulltext_record_propert... |
anythingrandom/eclcli | eclcli/common/limits.py | # Copyright 2012-2013 OpenStack Foundation
#
# 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 la... |
rednaxelafx/apache-spark | python/pyspark/storagelevel.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 us... |
Teagan42/home-assistant | tests/components/mqtt/test_lock.py | """The tests for the MQTT lock platform."""
import json
from unittest.mock import ANY
from homeassistant.components import lock, mqtt
from homeassistant.components.mqtt.discovery import async_start
from homeassistant.const import (
ATTR_ASSUMED_STATE,
STATE_LOCKED,
STATE_UNAVAILABLE,
STATE_UNLOCKED,
)
... |
VillanCh/g3ar | g3ar/utils/ipwhois/rdap.py | # Copyright (c) 2013, 2014, 2015, 2016 Philip Hane
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this li... |
astrofrog/glue-vispy-viewers | glue_vispy_viewers/scatter/multi_scatter.py | from __future__ import absolute_import, division, print_function
from contextlib import contextmanager
import numpy as np
from matplotlib.colors import ColorConverter
from ..extern.vispy import scene
from glue.external import six
class MultiColorScatter(scene.visuals.Markers):
"""
This is a helper class ... |
riscmaster/risc_maap | risc_msgs/src/foo_msgs/msg/_Landmark.py | """autogenerated by genpy from foo_msgs/Landmark.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class Landmark(genpy.Message):
_md5sum = "2edff07075d48378c13052415416989c"
_type = "foo_msgs/Landmark"
_has_header = False #flag to mark the prese... |
tethysplatform/tethys | tests/unit_tests/test_tethys_gizmos/test_gizmo_options/test_base.py | """
********************************************************************************
* Name: base.py
* Author: nswain
* Created On: July 23, 2018
* Copyright: (c) Aquaveo 2018
********************************************************************************
"""
import unittest
import tethys_gizmos.gizmo_options.base as ... |
pygraz/old-flask-website | migrations/versions/002_notificationflags.py | from sqlalchemy import *
from migrate import *
meta = MetaData()
user_tbl = Table('user', meta)
status_col = Column('email_status', String, default='not_verified')
activation_code_col = Column('email_activation_code', String, nullable=True)
notify_new_meetup = Column('email_notify_new_meetup', Boolean, default=False... |
RCOS-Grading-Server/HWserver | bin/make_generated_output.py | #!/usr/bin/env python3
"""
# USAGE
# make_generated_output.py <path to config file for gradeable> <assignment> <semester> <course>
"""
import argparse
import json
import os
from submitty_utils import dateutils
import sys
SUBMITTY_DATA_DIR = "/var/local/submitty"
def parse_args():
parser = argparse.Argume... |
twz915/django | tests/builtin_server/tests.py | import sys
import traceback
from io import BytesIO
from unittest import TestCase
from wsgiref import simple_server
# If data is too large, socket will choke, so write chunks no larger than 32MB
# at a time. The rationale behind the 32MB can be found in #5596#comment:4.
MAX_SOCKET_CHUNK_SIZE = 32 * 1024 * 1024 # 32 MB... |
netkicorp/python-partner-api-client | netki/NetkiClient.py | __author__ = 'frank'
from Certificate import Certificate
from Domain import Domain
from Partner import Partner
from Requestor import process_request
from WalletName import WalletName
class Netki:
"""
General methods for interacting with Netki's Partner API.
:param partner_id: Your Partner ID available i... |
alexm92/sentry | src/sentry/models/commit.py | from __future__ import absolute_import, print_function
from django.db import models
from django.utils import timezone
from sentry.db.models import (
BoundedPositiveIntegerField, FlexibleForeignKey, Model, sane_repr
)
from sentry.utils.cache import memoize
class Commit(Model):
__core__ = False
organizat... |
nephila/djangocms_twitter | djangocms_twitter/south_migrations/0004_rename_tables.py | # -*- coding: utf-8 -*-
from distutils.version import LooseVersion
import cms
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
if LooseVersion(cms.__ver... |
puttarajubr/commcare-hq | custom/ilsgateway/tanzania/handlers/keyword.py | from corehq.apps.sms.api import send_sms_to_verified_number
from corehq.util.translation import localize
from django.utils.translation import ugettext as _
class KeywordHandler(object):
def __init__(self, user, domain, args, verified_contact, msg):
self.user = user
self.domain = domain
se... |
glemaitre/scikit-learn | sklearn/mixture/tests/test_gaussian_mixture.py | # Author: Wei Xue <xuewei4d@gmail.com>
# Thierry Guillemot <thierry.guillemot.work@gmail.com>
# License: BSD 3 clause
import re
import sys
import copy
import warnings
import pytest
import numpy as np
from scipy import stats, linalg
from sklearn.covariance import EmpiricalCovariance
from sklearn.datasets impo... |
hainm/pythran | pythran/transformations/unshadow_parameters.py | """
UnshadowParameters prevents the shadow parameter phenomenon
"""
from pythran.analyses import Identifiers
from pythran.passmanager import Transformation
import ast
class UnshadowParameters(Transformation):
'''
Prevents parameter shadowing by creating new variable.
>>> import ast
>>> from pythran... |
sunlightlabs/python-sunlight | setup.py | #!/usr/bin/env python
# Copyright (c) Sunlight Labs, 2012 under the terms and conditions
# of the LICENSE file.
from sunlight import __appname__, __version__
from setuptools import setup
long_description = open('README.rst').read()
setup(
name = __appname__,
version = __version__,
packages = [... |
dominicgs/GreatFET-experimental | host/greatfet/sensors/tsl2561.py | #
# This file is part of GreatFET
#
from .. import errors
from ..sensor import GreatFETSensor
from ..interfaces.i2c_device import I2CDevice
class TSL256X(I2CDevice, GreatFETSensor):
"""
Represents a TSL256X Ambient Light Sensor.
"""
SHORTHAND = "tsl256x"
# Default I2C address.
DEFAULT_AD... |
vadimtk/chrome4sdp | build/android/pylib/remote/device/remote_device_gtest_run.py | # Copyright 2014 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.
"""Run specific test on specific environment."""
import logging
import os
import tempfile
from pylib import constants
from pylib.base import base_test_resu... |
roadhead/satchmo | satchmo/recentlist/middleware.py | from django.core.urlresolvers import NoReverseMatch, reverse
from satchmo.configuration import config_value
import logging
import re
log = logging.getLogger('recentlist.middleware')
try:
producturl = reverse('satchmo_product',
kwargs={'product_slug': 'FAKE'})
producturl = "^" + producturl.replace("FAK... |
coreboot/chrome-ec | extra/cr50_rma_open/cr50_rma_open.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Used to access the cr50 console and handle RMA Open
"""Open cr50 using RMA authentication.
Run RMA Open ... |
kumar303/rockit | vendor-local/kombu/common.py | """
kombu.common
============
Common Utilities.
:copyright: (c) 2009 - 2012 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from __future__ import with_statement
import socket
import sys
from collections import defaultdict, deque
from functools import partial
f... |
justinpotts/mozillians | mozillians/users/es.py | from django.conf import settings
from elasticsearch import TransportError
from elasticsearch.exceptions import NotFoundError
from elasticutils.contrib.django import Indexable, MappingType, S, get_es
from mozillians.phonebook.helpers import langcode_to_name
from mozillians.users.managers import MOZILLIANS, PUBLIC
ES_... |
urbn/kombu | kombu/connection.py | """Client (Connection)."""
from __future__ import absolute_import, unicode_literals
import os
import socket
import sys
from collections import OrderedDict
from contextlib import contextmanager
from itertools import count, cycle
from operator import itemgetter
try:
from ssl import CERT_NONE
ssl_available = T... |
htygithub/bokeh | bokeh/charts/conftest.py | """Defines chart-wide shared test fixtures."""
import numpy as np
import pandas as pd
import pytest
from bokeh.sampledata.autompg import autompg
class TestData(object):
"""Contains properties with easy access to data used across tests."""
def __init__(self):
self.cat_list = ['a', 'c', 'a', 'b']
... |
leiferikb/bitpop-private | chrome/test/install_test/chrome.py | # Copyright (c) 2012 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.
"""Extended WebDriver interface that uses helper extension.
This file is makeshift and should eventually be switched over to
using the new ChromeDriver ... |
rvswift/BlastNFilter | build/lib/BlastNFilter/PreRelease/ParsePreRelease.py | __author__ = 'robswift'
import sys
from collections import defaultdict
from filtering_sets import do_not_call
from BlastNFilter.Blast.Target import Target
def add_ligands(non_polymer):
"""
Remove undesirable residues from the non_polymer_file, and return a list of target objects.
:param non_polymer: absol... |
asifmadnan/DIGITS | digits/model/tasks/caffe_train.py | # Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import os
import re
import time
import math
import subprocess
import numpy as np
from google.protobuf import text_format
import caffe
try:
import caffe_pb2
except ImportError:
# See issue #32
from caffe.proto import caffe_pb2
from train... |
claudelee/Wi-FiTestSuite-UCC | python/myutils.py | ###################################################################
#
# Copyright (c) 2014 Wi-Fi Alliance
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copi... |
lamblin/fuel | fuel/utils.py | import collections
import six
# See http://python3porting.com/differences.html#buffer
if six.PY3:
buffer_ = memoryview
else:
buffer_ = buffer # noqa
def lazy_property_factory(lazy_property):
"""Create properties that perform lazy loading of attributes."""
def lazy_property_getter(self):
if... |
spacy-io/spaCy | spacy/lang/lb/tokenizer_exceptions.py | from ..tokenizer_exceptions import BASE_EXCEPTIONS
from ...symbols import ORTH, NORM
from ...util import update_exc
# TODO
# treat other apostrophes within words as part of the word: [op d'mannst], [fir d'éischt] (= exceptions)
_exc = {}
# translate / delete what is not necessary
for exc_data in [
{ORTH: "’t", ... |
Robpol86/terminaltables | terminaltables/ascii_table.py | """AsciiTable is the main table class. To be inherited by other tables. Define convenience methods here."""
from terminaltables.base_table import BaseTable
from terminaltables.terminal_io import terminal_size
from terminaltables.width_and_alignment import column_max_width, max_dimensions, table_width
class AsciiTabl... |
FinnStutzenstein/OpenSlides | server/tests/unit/utils/cache_provider.py | from typing import Any, Callable, Dict, List
from openslides.utils.cache_providers import Cachable, MemoryCacheProvider
def restrict_elements(elements: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
"""
Adds the prefix 'restricted_' to all values except id.
"""
out = []
for element in elements:
... |
thomashuang/Fukei | setup.py | from setuptools import setup
with open('README.rst') as f:
long_description = f.read()
setup(
name = "fukei",
version = "0.1",
license = 'MIT',
description = "A Python Tornado port of shadowsocks and socks proxy",
author = 'Thomas Huang',
url = 'https://github.com/thomashuang/Fukei',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.