code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
__all__ = ['VAR', 'JVAR']
class Demeter(object):
loves = ''
@property
def hates(self):
return self.loves.upper()
class Variable(object):
attr = 'value'
_attr2 = 'v2'
attr2 = property(lambda self: self._attr2,
lambda self, value: setattr(self, '_attr2', value.uppe... | dkentw/robotframework | atest/testdata/variables/extended_assign_vars.py | Python | apache-2.0 | 524 |
# -*- coding: utf-8 -*-
"""Library Tests
.. Note::
- for safety test database is not dropped after tests are run it must be dropped manually
"""
import unittest
import gzip
import json
import codecs
from mongoUtils.client import muClient
from mongoUtils.configuration import testDbConStr
from mongoUtils import _PA... | nickmilon/mongoUtils | mongoUtils/tests/tests.py | Python | apache-2.0 | 6,489 |
#!/usr/bin/env python
#
# Copyright (c) 2012, Dave Eddy <[email protected]>
# 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
#... | bahamas10/Viridian | AmpacheTools/DatabaseSession.py | Python | bsd-3-clause | 3,664 |
# -*- coding: utf-8 -*-
"""Python library module for LSM6DS33 accelerometer and gyroscope.
This module for the Raspberry Pi computer helps interface the LSM6DS33
accelerometer and gyro.The library makes it easy to read
the raw accelerometer and gyro data through I²C interface and it also provides
methods for getting a... | SvetoslavKuzmanov/altimu10v5 | altimu10v5/lsm6ds33.py | Python | mit | 6,967 |
"""distutils.cygwinccompiler
Provides the CygwinCCompiler class, a subclass of UnixCCompiler that
handles the Cygwin port of the GNU C compiler to Windows. It also contains
the Mingw32CCompiler class which handles the mingw32 port of GCC (same as
cygwin in no-cygwin mode).
"""
# problems:
#
# * if you use a msvc com... | xbmc/atv2 | xbmc/lib/libPython/Python/Lib/distutils/cygwinccompiler.py | Python | gpl-2.0 | 17,279 |
"""
Tests for the logic in input type mako templates.
"""
from __future__ import absolute_import
import json
import unittest
from collections import OrderedDict
from lxml import etree
from mako import exceptions
from six.moves import range
from capa.inputtypes import Status
from capa.tests.helpers import capa_rende... | ESOedX/edx-platform | common/lib/capa/capa/tests/test_input_templates.py | Python | agpl-3.0 | 46,422 |
# Copyright (c) 2020, NVIDIA 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 by appli... | mlperf/inference_results_v0.7 | closed/Gigabyte/code/common/__init__.py | Python | apache-2.0 | 9,856 |
"""
Django settings for TangoWithDjango project.
Generated by 'django-admin startproject' using Django 1.9.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
imp... | GrimFanrango/TangoWithDjango | TangoWithDjango/settings.py | Python | agpl-3.0 | 3,703 |
import collections
from supriya import CalculationRate
from supriya.ugens.MultiOutUGen import MultiOutUGen
class Balance2(MultiOutUGen):
"""
A stereo signal balancer.
::
>>> left = supriya.ugens.WhiteNoise.ar()
>>> right = supriya.ugens.SinOsc.ar()
>>> balance_2 = supriya.ugens.... | Pulgama/supriya | supriya/ugens/Balance2.py | Python | mit | 889 |
import json
import multiprocessing.dummy as multiprocessing
from datetime import datetime
import requests
import yaml
import time
import sys
data = {}
bad_sites = {}
slack_icon_mapping = {
"OK": ":innocent",
"internal_error":":interrobang:",
"timeout":":timer_clock:",
"bad_status":":skull_and_crossbon... | k2xl/downtime_monitor | run.py | Python | apache-2.0 | 3,932 |
class Base(object):
def meth(self):
pass
class Derived1(Base):
def meth(self):
return super().meth()
class Derived2(Derived1):
def meth(self):
return super().meth()
class Derived3(Derived1):
pass
class Derived4(Derived3, Derived2):
def meth(self):
return super... | github/codeql | python/ql/test/3/library-tests/PointsTo/inheritance/test.py | Python | mit | 496 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('defcdb', '0029_remove_dc_finds_small_finds_type_category'),
]
operations = [
migrations.AddField(
model_name='dc... | acdh-oeaw/defc-app | defcdb/migrations/0030_dc_finds_small_finds_type_category.py | Python | mit | 495 |
# -*- coding: UTF-8 -*-
'''
Created on Dec 10, 2009
@author: barthelemy
'''
from __future__ import unicode_literals, absolute_import
from decimal import Decimal
import gc
from multiprocessing import Process
import os
from socket import AF_INET, SOCK_STREAM, socket
import subprocess
from threading import Thread
import... | rex1100/learning-spark | spark-1.3.1-bin-hadoop1/python/build/py4j/tests/java_gateway_test.py | Python | mit | 24,978 |
#!/usr/bin/env python
#
# !!!!!!!!! WARNING !!!!!!!!!!!!!!!
# This Script was bastardized To Read Password From /home/bspaans/.googlecode
#
#
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: [email protected] (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is int... | anthonyt/mingus-counterpoint | googlecode_upload.py | Python | gpl-3.0 | 9,994 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | jmesteve/saas3 | openerp/addons/base/res/res_config.py | Python | agpl-3.0 | 29,051 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 5, transform = "Quantization", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Quantization/trend_Lag1Trend/cycle_5/ar_12/test_artificial_128_Quantization_Lag1Trend_5_12_0.py | Python | bsd-3-clause | 267 |
import datetime
from poll.models import gettext_db, Response
from rapidsms.apps.base import AppBase
from rapidsms_httprouter.models import Message
from script.models import Script, ScriptProgress, ScriptSession, ScriptStep
from django.conf import settings
from script.utils.incoming import incoming_progress
from unregis... | unicefuganda/edtrac | edtrac_project/rapidsms_edtrac/education/app.py | Python | bsd-3-clause | 5,200 |
"""Runs the Treadmill application runner."""
from __future__ import absolute_import
import signal
import logging
import os
import click
from .. import appmgr
from .. import utils
from .. import logcontext as lc
from ..appmgr import run as app_run
from ..appmgr import abort as app_abort
_LOGGER = logging.getLogger... | toenuff/treadmill | lib/python/treadmill/sproc/run.py | Python | apache-2.0 | 2,089 |
from abc import ABC, abstractmethod
from copy import deepcopy
from tinydb import TinyDB
from tinydb.middlewares import Middleware
iteritems = getattr(dict, 'iteritems', dict.items)
itervalues = getattr(dict, 'itervalues', dict.values)
class Serializer(ABC):
"""
The abstract base class for Serializers.
A... | msiemens/tinydb-serialization | tinydb_serialization/__init__.py | Python | mit | 5,741 |
import keras
import pickle
import os.path
import numpy as np
# Hyperparameters
TWEET_LEN = 140
MAX_LEN = 200
# Other Constants
TWEET_FILE = "generated_trump_tweets.pickle"
MODEL_FILE = "Models/goodTrump(3-1024).h5"
BATCH_SIZE = 128
# Construct dictionaries to convert from tokens to strings and back
char_list = list(... | DarkGuenther/TrumpBot | gen_trump_tweets.py | Python | mit | 2,081 |
# Carl is free software; you can redistribute it and/or modify it
# under the terms of the Revised BSD License; see LICENSE file for
# more details.
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_raises
from sklearn.utils.testing import assert_greater
from sklearn.datasets import... | diana-hep/carl | tests/learning/test_calibration.py | Python | bsd-3-clause | 2,923 |
"""
Test the 'memory find' command.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.decorators import *
class MemoryFindTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
... | apple/swift-lldb | packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py | Python | apache-2.0 | 2,243 |
# coding: utf-8
import mimetypes
import os
import sys
import traceback
from time import sleep
from urllib.request import urlopen, Request
PARENT_DIR = 'downloaded_imgs'
MY_EMAIL_ADDR = ''
INTERVAL = 0.1
def fetch_and_save(fname):
with open(fname) as f:
for line in f:
fields = line.strip().s... | nknytk/face-classifier-cnn | tools/data_collector/dl_imgs.py | Python | mit | 1,730 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from datetime import timedelta, datetime
from distutils.version import LooseVersion
import sys
import nose
from numpy import nan
from numpy.random import randn
import numpy as np
from pandas.compat import lrange
from pandas import (compat, isnull, notnul... | pjryan126/solid-start-careers | store/api/zillow/venv/lib/python2.7/site-packages/pandas/tests/frame/test_analytics.py | Python | gpl-2.0 | 80,870 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
piStrings description
Supports language text strings for different subsystems:
-- bottle with 'template' and {{string}} replacement
-- JS/HTML replacement
'lang' (eg. DE or EN) controls the return of the language string, if asked
with unk... | neandr/piSchedule | piSchedule751/piStrings.py | Python | mit | 1,601 |
from __future__ import unicode_literals
import frappe
import frappe.defaults
from frappe.utils import cstr, cint, flt, comma_or, nowdate
from frappe import _ ,msgprint
from erpnext.stock.utils import get_incoming_rate
from erpnext.stock.stock_ledger import get_previous_sle
from erpnext.controllers.queries import get_... | suyashphadtare/vestasi-erp-1 | erpnext/stock/custom_methods.py | Python | agpl-3.0 | 26,194 |
from timit_dataset import TimitPhoneData
import itertools
import numpy as np
from pylearn2.datasets import DenseDesignMatrix
from pylearn2.models.mlp import MLP, Sigmoid, Softmax, VectorSpace
from pylearn2.termination_criteria import EpochCounter
from pylearn2.training_algorithms.sgd import SGD
from pylearn2.training_a... | jfsantos/ift6266h14 | old/exp_phone_rec.py | Python | mit | 1,681 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | snapcore/snapcraft | snapcraft/internal/sources/_local.py | Python | gpl-3.0 | 4,275 |
from .alarm_state import AlarmState
from .envisalink_base_client import EnvisalinkClient
from .honeywell_client import HoneywellClient
from .dsc_client import DSCClient
from .alarm_panel import EnvisalinkAlarmPanel
| jnimmo/pyenvisalink | pyenvisalink/__init__.py | Python | mit | 215 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Big Switch Networks, 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.a... | kaiweifan/vse-lbaas-plugin-poc | quantum/plugins/bigswitch/plugin.py | Python | apache-2.0 | 52,432 |
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth.views import login
urlpatterns = [
# Examples:
# url(r'^$', 'moodle.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
#administrador Django
url(r'^admin/', include(admin.site.urls))... | anderojas1/moodle | moodle/moodle/urls.py | Python | gpl-2.0 | 589 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Flash'
db.create_table('cmsplugin_flash', (
('cmsplugin_ptr', self.gf('django.db... | mpetyx/palmdrop | venv/lib/python2.7/site-packages/cms/plugins/flash/migrations/0001_initial.py | Python | apache-2.0 | 3,244 |
# Copyright 2020 gRPC 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 writing... | ejona86/grpc | tools/run_tests/xds_k8s_test_driver/framework/infrastructure/gcp/compute.py | Python | apache-2.0 | 17,539 |
# -*- coding: utf-8 -*-
"""Example that shows how to implement QSR makers.
:Author: Christan Dondrup <[email protected]>, Yiannis Gatsoulis <[email protected]>
:Organization: University of Lincoln
:Date: 10 September 2014
:Version: 0.1
:Status: Development
:Copyright: STRANDS default
:Notes: future extensio... | yianni/rtd-dbg | qsr_lib/src/qsrlib_qsrs/qsr_qtc_b_simplified.py | Python | mit | 1,495 |
"""
log handler
"""
import os
import logging
from config import ROOT_PATH
class Logger(object):
def __init__(self, log_name, log_file=None, log_format=None, log_level=None):
self._log_name = log_name
self._log_file = log_file
self._log_format = log_format
self._log_level = log_leve... | Jackeriss/Top15 | app/log_kit.py | Python | mit | 1,436 |
#!/usr/bin/env python
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye 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) a... | ccrisan/motioneye | motioneye/meyectl.py | Python | gpl-3.0 | 8,206 |
import unittest
import numpy
import chainer
from chainer import basic_math
from chainer import cuda
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
class BinaryOpTestBase(object):
def make_data(self):
raise NotImpleme... | sinhrks/chainer | tests/chainer_tests/functions_tests/math_tests/test_basic_math.py | Python | mit | 32,057 |
"""View flow data as Sankey diagrams."""
__version__ = '2.1.0-dev'
from .dataset import Dataset
from .partition import Partition, Group
from .sankey_definition import SankeyDefinition, ProcessGroup, Waypoint, Bundle, Elsewhere
from .view_graph import view_graph
from .results_graph import results_graph
from .augment_v... | ricklupton/sankeyview | floweaver/__init__.py | Python | mit | 861 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013-2015 Marcos Organizador de Negocios SRL http://marcos.do
# Write by Eneldo Serrata ([email protected])
#
# This program is free software: you can redistribute it and/or modify
# it un... | MarcosCommunity/odoo | marcos_addons/marcos_ncf/dgii_ventas/__init__.py | Python | agpl-3.0 | 1,016 |
a = 1 / 0
| tonyxty/quickfix.py | tests/errors/div_by_zero.py | Python | mit | 10 |
# This file is part of MyPaint.
# Copyright (C) 2007 by Martin Renold <[email protected]>
#
# 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 2 of the License, or
# (at your option) ... | benosteen/mypaint | gui/application.py | Python | gpl-2.0 | 15,563 |
# -*- coding: utf-8 -*-
##
# This file is part of Testerman, a test automation system.
# Copyright (c) 2010 Sebastien Lefevre and other 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
# Foundat... | seblefevre/testerman | admin/StructuredInteractiveShell.py | Python | gpl-2.0 | 36,549 |
#!/usr/bin/python
"""
Program that parses the avocado results ,will use the results.json
file as the input filename, the defualt dir is ~/avocado/job-results/latest/,
or you could specify it .
"""
__version__ = '1.1'
import os
import json
import argparse
from avocado.core import data_dir
def parse_result(resultfile... | PyLearner/myworks | scan_result_avocado.py | Python | apache-2.0 | 1,919 |
'''
test Ip4Protocol
'''
import pytest
import sys
sys.path.insert(0, '..')
sys.path.insert(0, '.')
from jabs import ilf
KNOWN_PROTOS = [('icmp', 1),
('tcp', 6),
('udp', 17),
('rdp', 27),
('rsvp', 46),
('gre', 47),
('esp'... | hertogp/jabs | test/test_ilf_core_protocols.py | Python | mit | 1,713 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2012 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | ddico/server-tools | users_ldap_populate/model/users_ldap.py | Python | agpl-3.0 | 8,007 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2015, Florent Thiery
import os
import subprocess
import shlex
ERRORS = (
'ERROR',
)
def run_cmd(cmd, shell=False):
env = dict(os.environ)
env["LANG"] = "C"
if shell:
args = cmd
else:
args = shlex.split(cmd)
p = subproce... | UbiCastTeam/gstreamer-benchmarks | utils/process.py | Python | lgpl-3.0 | 1,765 |
# Copyright 2015 Rackspace 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... | openstack/oslo.privsep | oslo_privsep/tests/test_daemon.py | Python | apache-2.0 | 10,078 |
#!/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2013 Fabio Falcinelli
#
# 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 late... | ffalcinelli/wstunnel | wstunnel/svc/wstunsrvd.py | Python | lgpl-3.0 | 2,656 |
class LazyLoadProxy(object):
# Taken from http://code.activestate.com/recipes/496741-object-proxying/
__slots__ = ["_obj_fn", "__weakref__", "__proxy_storage"]
def __init__(self, fn, storage=None):
object.__setattr__(self, "_obj_fn", fn)
object.__setattr__(self, "__proxy_storage", storage)
... | neversun/sailfish-hackernews | pyPackages/python_firebase-noarch/firebase/lazy.py | Python | mit | 3,754 |
# Copyright 2015 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.
"""Controller for the build_annotations app.
This controller sits between the django models for cidb tables and the views
that power the app.
Keep non-tr... | guorendong/iridium-browser-ubuntu | third_party/chromite/appengine/cq_stats/build_annotations/build_row_controller.py | Python | bsd-3-clause | 10,530 |
# License: https://github.com/RobFisher/mailshare/blob/master/LICENSE
import imaplib
import settings # TODO make this work: from django.conf import settings
import email
_server = None
def get_server_connection():
"""Logs in to the server if needed, Returns an IMAP4 object."""
global _server
if _server =... | RobFisher/mailshare | mailshareapp/poll_imap_email.py | Python | bsd-3-clause | 2,742 |
from django import forms
from django.contrib import messages
from django.core.exceptions import ValidationError
from django.db.models import ObjectDoesNotExist
from django.shortcuts import get_object_or_404, redirect, render_to_response
from django.template import RequestContext
from django.utils.translation import uge... | ixc/plata | examples/simple/views.py | Python | bsd-3-clause | 1,810 |
# Copyright (c) 2013 Yubico AB
# 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 list of conditi... | moreati/python-u2flib-server | u2flib_server/attestation/matchers.py | Python | bsd-2-clause | 2,683 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of the Poster project
#
# Copyright (c) 2006-2009 Marco Antonio Islas Cruz
#
# Poster 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... | markuz/poster | poster_resources/__init__.py | Python | gpl-3.0 | 988 |
__author__ = 'hiroki-m'
| hiroki8080/Kokemomo | test/plugins/blog/__init__.py | Python | mit | 27 |
# 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... | Fokko/incubator-airflow | airflow/kubernetes/pod_generator.py | Python | apache-2.0 | 13,165 |
import types
from stp_core.loop.eventually import eventually
from plenum.test import waits
from plenum.test.delayers import ppDelay, pDelay
from plenum.test.helper import sdk_send_random_request
from plenum.test.test_node import getNonPrimaryReplicas
def testOrderingWhenPrePrepareNotReceived(looper, txnPoolNodeSet,... | evernym/plenum | plenum/test/node_request/test_order/test_ordering_when_pre_prepare_not_received.py | Python | apache-2.0 | 2,139 |
import numpy as np
from scipy.ndimage import label
def generate_test_vecs(infile, strelfile, resultfile):
"test label with different structuring element neighborhoods"
def bitimage(l):
return np.array([[c for c in s] for s in l]) == '1'
data = [np.ones((7, 7)),
bitimage(["1110111",
... | sargas/scipy | scipy/ndimage/utils/generate_label_testvectors.py | Python | bsd-3-clause | 1,677 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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... | openstack/octavia | octavia/amphorae/backends/agent/api_server/amphora_info.py | Python | apache-2.0 | 7,469 |
# 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... | ankur-gupta91/horizon-net-ip | openstack_dashboard/dashboards/project/volumes/backups/views.py | Python | apache-2.0 | 4,315 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
GridNearest.py
---------------------
Date : October 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*************... | yordan-desta/QgisIns | python/plugins/processing/algs/gdal/GridNearest.py | Python | gpl-2.0 | 4,205 |
#
# Copyright (C) 2015 tknorris (Derived from Mikey1234's & Lambda's)
#
# 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 2, or (at your option)
# any later version.
#
# ... | repotvsupertuga/tvsupertuga.repository | script.vodextende/salts_lib/cloudflare.py | Python | gpl-2.0 | 6,746 |
"""
MySQL database backend for Django.
Requires MySQLdb: http://sourceforge.net/projects/mysql-python
"""
import datetime
import re
import sys
import warnings
try:
import MySQLdb as Database
except ImportError, e:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured("Error l... | smartfile/django-1.4 | django/db/backends/mysql/base.py | Python | bsd-3-clause | 19,979 |
import logging
import pinylib
log = logging.getLogger(__name__)
def main():
room_name = raw_input('Enter room name: ').strip()
if pinylib.CONFIG.ACCOUNT and pinylib.CONFIG.PASSWORD:
client = pinylib.TinychatRTMPClient(roomname=room_name, account=pinylib.CONFIG.ACCOUNT,
... | nortxort/pinylib | sample_client.py | Python | mit | 4,629 |
import six
from django.conf import settings as django_settings
from django.utils.functional import LazyObject
from wysihtml5.conf import defaults as app_settings
class LazySettings(LazyObject):
def _setup(self):
self._wrapped = Settings(app_settings, django_settings)
def update_dict_in_depth(a, b):
... | danirus/django-wysihtml5 | wysihtml5/conf/__init__.py | Python | bsd-2-clause | 1,049 |
from django.conf.urls import url
from dojo.engagement import views
urlpatterns = [
# engagements and calendar
url(r'^calendar$', views.engagement_calendar, name='calendar'),
url(r'^calendar/engagements$', views.engagement_calendar, name='engagement_calendar'),
url(r'^engagement$', views.engagement, n... | Prakhash/security-tools | external/django-DefectDojo-1.2.1/dojo/engagement/urls.py | Python | apache-2.0 | 2,035 |
# -*- coding: utf-8 -*-
"""
Tests of the Capa XModule
"""
# pylint: disable=missing-docstring
# pylint: disable=invalid-name
import datetime
import json
import random
import os
import textwrap
import unittest
import ddt
from mock import Mock, patch, DEFAULT
import webob
from webob.multidict import MultiDict
import x... | motion2015/a3 | common/lib/xmodule/xmodule/tests/test_capa_module.py | Python | agpl-3.0 | 80,522 |
#import the necessary modules
import sys
sys.path.append('/usr/local/lib/python2.7/dist-packages/')
import freenect
import cv2
import numpy as np
#function to get RGB image from kinect
def get_video():
array,_ = freenect.sync_get_video()
array = cv2.cvtColor(array,cv2.COLOR_RGB2BGR)
return array
#functi... | miltonsarria/dsp-python | images/kinect_test.py | Python | mit | 922 |
# (c) Nelen & Schuurmans. GPL licensed, see LICENSE.rst.
from django.conf.urls.defaults import include
from django.conf.urls.defaults import patterns
from django.conf.urls.defaults import url
from django.contrib import admin
from lizard_ui.urls import debugmode_urlpatterns
from lizard_box import views
admin.autodisc... | lizardsystem/lizard-box | lizard_box/urls.py | Python | gpl-3.0 | 871 |
"""Tests for the BitField class."""
import unittest
import bitfield
__author__ = 'Brian Landers <[email protected]>'
class BitFieldTest(unittest.TestCase):
"""Tests for the BitField class."""
def setUp(self):
self.bits = bitfield.BitField(36)
def test_constructor(self):
for i in xr... | Packetslave/bitfield | bitfield_test.py | Python | apache-2.0 | 1,913 |
import pytest
from pytorch_lightning import Trainer
from tests.helpers import BoringModel
@pytest.mark.parametrize(
["min_epochs", "max_epochs", "min_steps", "max_steps"],
[
(None, 3, None, None),
(None, None, None, 20),
(None, 3, None, 20),
(None, None, 10, 20),
(1, 3... | williamFalcon/pytorch-lightning | tests/trainer/flags/test_min_max_epochs.py | Python | apache-2.0 | 987 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#Language Detection based on unicode range
# Copyright 2008 Santhosh Thottingal <[email protected]>
# http://www.smc.org.in
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as... | smc/silpa | src/silpa/utils/langdetect.py | Python | agpl-3.0 | 3,409 |
import pygame.mixer as pm
from pygame_play_tone import Note
from time import sleep
#Default volume for Notes
DEFAULT_VOLUME=0.2
# Notes that can be called on, where C4 is middle C
C0 = 16.35
C0_SHARP = 17.32
D0 = 18.35
D0_SHARP = 19.45
E0 = 20.6
F0 = 21.83
F0_SHARP = 23.12
G0 = 24.5
G0_SHARP = 25.96
A0 = 27.5
A0_SHAR... | cornell-cup/cs-minibot-platform | python-interface/src/MiniBotFramework/Sound/note_library.py | Python | apache-2.0 | 2,243 |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 20 07:32:22 2015
@author: jmmauricio
"""
import os
directory = '/home/jmmauricio/Documents/public/jmmauricio6/RESEARCH/benches/ieee_118/ieee118_pvsync/code/ieee118_pv_50/simulations'
def rename_files(old_string, new_string,directory):
dir_list = os.listdir(direct... | jmmauricio/pypstools | dev/rename_files.py | Python | gpl-3.0 | 3,176 |
#!/usr/bin/env python
#
# urls.py
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; with... | pdelsante/pcapoptikon | main/urls.py | Python | gpl-2.0 | 1,023 |
#!/usr/bin/env python
# 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.
"""Get stats about your activity.
Example:
- my_activity.py for stats for the current week (last week on mondays).
- my_activ... | coreos/depot_tools | my_activity.py | Python | bsd-3-clause | 36,618 |
# -*- coding: utf-8 -*-
"""
Copyright 2014-2015 Ratina
@author: Savor d'Isavano
@date: 2015-02-09
Paginator helpers
"""
__author__ = "Savor d'Isavano"
from django.core.paginator import (
Paginator, EmptyPage, PageNotAnInteger
)
def make_page(object_list, *, per_page=5, current_page=1):
paginator = Pagin... | Ratina/ratina_portal | utils/paginator.py | Python | gpl-3.0 | 566 |
# Generated by Django 2.2.13 on 2020-08-24 11:47
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('tasks', '0030_available'),
]
operations = [
migrations.AlterField(
model_name='task',
... | rdmorganiser/rdmo | rdmo/tasks/migrations/0031_related_name.py | Python | apache-2.0 | 1,396 |
#!/usr/bin/python
import re
print 'flag = {}'
print 'op = {}'
print 'tag = {}'
print 'detail = {}'
print 'search = {}'
print 'value = {}'
print 'prefs = {}'
print 'flag[\'base\'] = 0x20'
with open("ECCodes.abstract") as f:
for line in f:
m = re.match(r"EC_CURRENT_PROTOCOL_VERSION[\t ]*(?P<code>0x[0-9a-fA-... | castorinop/pyamulecmd | helper/gen_codes.py | Python | mit | 1,775 |
# -*- coding: utf-8 -*-
from flask import render_template
from flask.views import MethodView
from wbc.connectors import get_sphinx
class HomeHTML(MethodView):
def get(self):
return render_template('home.html', stats=self._get_stats())
@staticmethod
def _get_stats():
"""
:rtype: o... | macbre/wbc.macbre.net | app/wbc/views/html/home.py | Python | mit | 580 |
from django.contrib.gis.utils import LayerMapping
from lingcod.spacing.models import *
def load_land(file_name, verbose=True):
mapping = {
'geometry' : 'POLYGON',
}
lm = prep_layer_mapping(file_name, Land, mapping)
lm.save(strict=True, verbose=verbose)
def prep_layer_mapping(shpfile_... | Alwnikrotikz/marinemap | lingcod/spacing/loader.py | Python | bsd-3-clause | 539 |
"""
URLResolver Addon for Kodi
Copyright (C) 2016 t0mm0, tknorris
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 late... | wndias/bc.repository | script.module.urlresolver/lib/default.py | Python | gpl-2.0 | 2,422 |
from __future__ import absolute_import
from pex.base import *
| Yasumoto/commons | src/python/twitter/common/python/base.py | Python | apache-2.0 | 62 |
from model_mommy import mommy
from django.test import override_settings
from django.urls import reverse
from meupet.models import Pet, PetStatus
from meupet.tests.tests import MEDIA_ROOT, MeuPetTestCase
@override_settings(MEDIA_ROOT=MEDIA_ROOT)
class PosterTest(MeuPetTestCase):
def setUp(self):
super().... | dirtycoder/pets | pets/meupet/tests/test_view_poster.py | Python | mit | 1,430 |
from pathlib import Path
import importlib.util
import ray
import time
def import_and_execute_test_script(relative_path_to_test_script: str):
"""Imports and executes a module from a path relative to Ray repo root."""
# get the ray folder
ray_path = next(
x for x in Path(__file__).resolve().parents ... | ray-project/ray | release/golden_notebook_tests/workloads/util.py | Python | apache-2.0 | 1,672 |
from flask.blueprints import Blueprint
import logging
from flask_login import login_required, current_user
from waitlist.ts3.connection import send_poke
from flask import jsonify
bp = Blueprint('api_ts3', __name__)
logger = logging.getLogger(__name__)
@bp.route("/test_poke")
@login_required
def test_poke():
send... | SpeedProg/eve-inc-waitlist | waitlist/blueprints/api/teamspeak.py | Python | mit | 473 |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
r... | integree/hello-world | manage.py | Python | mit | 648 |
from datetime import datetime
from lxml import etree
import pytest
from codalib import bagatom
@pytest.fixture(scope='module')
def queue_stub():
class QueueStub(object):
ark = 'ark:65443'
oxum = '1394.7'
url_list = 'http://example.com.urls'
status = 'Completed'
harvest_st... | unt-libraries/codalib | tests/bagatom/test_queueEntryToXML.py | Python | bsd-3-clause | 3,245 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
import os
import codecs
import shutil
from termcolor import colored
from jinja2 import Template
from studio.launch import ROOT_PATH
from jinja2 import Environment, FileSystemLoader
JDIR = os.path.join(ROOT_PATH, 'ji... | qisanstudio/qstudio-launch | src/studio/launch/commands/contrib.py | Python | mit | 2,178 |
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limi... | HewlettPackard/python-hpOneView | hpOneView/image_streamer/resources/plan_scripts.py | Python | mit | 6,767 |
from __future__ import division, print_function, absolute_import
from warnings import warn
import numpy as np
from numpy import asarray, empty, ravel, nonzero
from scipy.sparse import (isspmatrix_csc, isspmatrix_csr, isspmatrix,
SparseEfficiencyWarning, csc_matrix)
from . import _superlu
n... | Gillu13/scipy | scipy/sparse/linalg/dsolve/linsolve.py | Python | bsd-3-clause | 12,538 |
import uuid
from PyDesignData.PyDesignObject import *
from PyDesignData.PyDesignAnalysis import *
from PyDesignData.PyDesignParameter import *
from PyDesignData.PyDesignUOM import *
import os
__author__ = 'magnus'
class PyDesignDocument(PyDesignNamedObject):
def __init__(self, name, pdid=None):
self._py... | pracedru/pyDesign | PyDesignData/PyDesignDocument.py | Python | mit | 4,089 |
from uw_nws.models import Person, Channel, Endpoint, Subscription
| uw-it-aca/uw-restclients | vm/v1/viewmodels.py | Python | apache-2.0 | 66 |
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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... | vuntz/glance | glance/search/plugins/metadefs_notification_handler.py | Python | apache-2.0 | 9,496 |
########################################################################
# 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... | petricm/DIRAC | WorkloadManagementSystem/Agent/OptimizerModule.py | Python | gpl-3.0 | 11,859 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests that all containers are imported correctly."""
import unittest
from tests import test_lib
class ContainersImportTest(test_lib.ImportCheckTestCase):
"""Tests that container classes are imported correctly."""
_IGNORABLE_FILES = frozenset(['manager.py', 'int... | kiddinn/plaso | tests/containers/init_imports.py | Python | apache-2.0 | 558 |
import graph_tool as gt
from graph_tool import draw as gtd
import numpy as np
def lg2gt(g):
gr = gt.Graph()
vlabel = gr.new_vertex_property("string")
verts = {}
edges = {}
for v in g:
verts[v] = gr.add_vertex()
vlabel[verts[v]] = str(v)
gr.vertex_properties["label"] = vlabel
... | pliz/gunfolds | tools/gtool.py | Python | gpl-3.0 | 1,378 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2015-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/odoo_addons | clv_todo/__openerp__.py | Python | agpl-3.0 | 1,829 |
from __future__ import division
import Gnuplot
import logging
# Check for empty lists because Gnuplot-py will not plot if there are no entries.
default_width = 900
default_height = 600
# TODO: Is this an appropriate place for such a list? Maybe fnprobe.db would
# be better?
reject_types = [ "bulk_request_chk",
... | Thynix/pyProbe | fnprobe/gnuplots.py | Python | gpl-3.0 | 7,321 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test ZMQ interface
#
from test_framework.test_framework import NavCoinTestFramework
from test_framew... | navcoindev/navcoin-core | qa/rpc-tests/zmq_test.py | Python | mit | 3,264 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.