code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
from collections import defaultdict
import itertools
import re
import socket
import time
import xmlrpclib
# 3p
import supervisor.xmlrpc
# project
from checks import AgentCheck
DEFAULT_HOST = 'localhost... | varlib1/servermall | supervisord/check.py | Python | bsd-3-clause | 6,952 |
# Actually a correct module to check that we don't even attempt to regenerate a skeleton for it.
| siosio/intellij-community | python/helpers/tests/generator3_tests/data/SkeletonGeneration/skeleton_not_regenerated_for_failed_module_on_same_generator_version/failing.py | Python | apache-2.0 | 97 |
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
"""
defines logger classes and few convinience methods, not related to the declarations
tree
"""
import os
import sys
import l... | daviddoria/itkHoughTransform | Wrapping/WrapITK/Languages/SwigInterface/pygccxml-1.0.0/pygccxml/utils/__init__.py | Python | apache-2.0 | 5,211 |
#!/usr/bin/env python3
# Copyright (c) 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.
#
# Helper script to create the cache
# (see BitcoinTestFramework.setup_chain)
#
from test_framework.test_fra... | UFTS-Device/NanoCoin | qa/rpc-tests/create_cache.py | Python | mit | 594 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsImageCache.
.. note:: 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) any later version.
"""
__a... | tomtor/QGIS | tests/src/python/test_qgsimagecache.py | Python | gpl-2.0 | 5,431 |
"""Fixes bug 958640 adu updates
Revision ID: 58ed3acc86cb
Revises: 4a068f8838c6
Create Date: 2014-01-15 10:56:54.860954
"""
# revision identifiers, used by Alembic.
revision = '58ed3acc86cb'
down_revision = '4a068f8838c6'
from alembic import op
from socorro.lib import citexttype, jsontype, buildtype
from socorro.li... | Serg09/socorro | alembic/versions/58ed3acc86cb_fixes_bug_958640_adu_updates.py | Python | mpl-2.0 | 686 |
"""Models for the util app. """
import cStringIO
import gzip
import logging
from config_models.models import ConfigurationModel
from django.db import models
from django.utils.text import compress_string
from opaque_keys.edx.django.models import CreatorMixin
logger = logging.getLogger(__name__) # pylint: disable=inv... | ahmedaljazzar/edx-platform | common/djangoapps/util/models.py | Python | agpl-3.0 | 1,962 |
#!/usr/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
"""This tests for things in source files. Initially, absence of tabs :-)
"""
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, SecureTestCase, GlobDirectoryWalker, printLocation
setOutDir(... | Distrotech/reportlab | tests/test_source_chars.py | Python | bsd-3-clause | 3,375 |
"""Utility for changing directories and execution of commands in a subshell."""
from __future__ import print_function
import os
import shlex
import subprocess
# Store the previous working directory for the 'cd -' command.
class Holder:
"""Holds the _prev_dir_ class attribute for chdir() function."""
_prev_d... | endlessm/chromium-browser | third_party/llvm/lldb/examples/customization/pwd-cd-and-system/utils.py | Python | bsd-3-clause | 1,600 |
###
# Copyright (c) 2003-2005, Daniel DiPaolo
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of cond... | tecan/xchat-rt | plugins/scripts/encryption/supybot-code-6361b1e856ebbc8e14d399019e2c53a35f4e0063/plugins/MoobotFactoids/__init__.py | Python | gpl-2.0 | 2,507 |
"""
Objects for dealing with Laguerre series.
This module provides a number of objects (mostly functions) useful for
dealing with Laguerre series, including a `Laguerre` class that
encapsulates the usual arithmetic operations. (General information
on how this module represents and works with such polynomials is in th... | ruibarreira/linuxtrail | usr/lib/python2.7/dist-packages/numpy/polynomial/laguerre.py | Python | gpl-3.0 | 54,314 |
# Note:
# This is a total hack to implement simple disk-based memoization,
# with no expiration.
import os
PATH = '/tmp/django_cache_belonging_to_%s' % os.environ.get('USER', 'unknown')
def set(key, value):
if not os.path.isdir(PATH):
os.mkdir(PATH)
file_obj = file(os.path.join(PATH, key), 'w')
f... | waseem18/oh-mainline | mysite/base/disk_cache.py | Python | agpl-3.0 | 504 |
# Copyright (c) 2011 Zadara Storage Inc.
# Copyright (c) 2011 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-... | takeshineshiro/cinder | cinder/api/contrib/types_extra_specs.py | Python | apache-2.0 | 7,548 |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ansible_tower/tower_host.py | Python | bsd-3-clause | 5,445 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Networking/Requests/Messages/CollectDailyDefenderBonusMessage.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import mes... | Mickey32111/pogom | pogom/pgoapi/protos/POGOProtos/Networking/Requests/Messages/CollectDailyDefenderBonusMessage_pb2.py | Python | mit | 2,108 |
# encoding: utf-8
import datetime
import django
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
# Django 1.5+ compatibility
if django.VERSION >= (1, 5):
from django.contrib.auth import get_user_model
else:
from django.contrib.auth.models import User
def get_user... | mark-adams/django-waffle | waffle/south_migrations/0001_initial.py | Python | bsd-3-clause | 7,674 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | balajikris/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/models/long_wrapper.py | Python | mit | 899 |
# -*- coding: utf-8 -*-
#
# Copyright © 2011 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or impli... | rbramwell/pulp | playpen/v2_plugins/distributors/harness_distributor/distributor.py | Python | gpl-2.0 | 4,394 |
"""
Settings validations for the theming app
"""
import os
import six
from django.conf import settings
from django.core.checks import Error, Tags, register
@register(Tags.compatibility)
def check_comprehensive_theme_settings(app_configs, **kwargs):
"""
Checks the comprehensive theming theme directory settings... | BehavioralInsightsTeam/edx-platform | openedx/core/djangoapps/theming/checks.py | Python | agpl-3.0 | 2,784 |
#!/usr/bin/env python
import puka
import time
client = puka.Client("amqp://localhost/")
promise = client.connect()
client.wait(promise)
promise = client.queue_declare(queue='task_queue', durable=True)
client.wait(promise)
print ' [*] Waiting for messages. To exit press CTRL+C'
consume_promise = client.basic_consume... | fams/rabbitmq-tutorials | python-puka/worker.py | Python | apache-2.0 | 575 |
# Copyright 2017 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... | nburn42/tensorflow | tensorflow/contrib/kfac/python/ops/fisher_blocks_lib.py | Python | apache-2.0 | 1,576 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
sagaproviderplugin.py
---------------------
Date : May 2021
Copyright : (C) 2021 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
**********... | uclaros/QGIS | python/plugins/sagaprovider/SagaProviderPlugin.py | Python | gpl-2.0 | 1,562 |
"""SCons.Script.SConscript
This module defines the Python API provided to SConscript and SConstruct
files.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software an... | ff94315/hiwifi-openwrt-HC5661-HC5761 | staging_dir/host/lib64/scons-2.1.0/SCons/Script/SConscript.py | Python | gpl-2.0 | 24,428 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ghchinoy/tensorflow | tensorflow/python/keras/wrappers/scikit_learn_test.py | Python | apache-2.0 | 5,719 |
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
"name" : "Norway - Accounting",
"version" : "1.1",
"author" : "Rolv Råen",
"category" : "Localization/Account Charts",
"description": """This is the module to manage the accounting chart for Norwa... | minhphung171093/GreenERP_V9 | openerp/addons/l10n_no/__openerp__.py | Python | gpl-3.0 | 630 |
import datetime
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, override_settings, skipUnlessDBFeature
from django.test.utils import requires_tz_support
from django.utils import timezone
from .models import Artist, Author, Book, BookSigning, Page
def _make_books(n, base_dat... | labcodes/django | tests/generic_views/test_dates.py | Python | bsd-3-clause | 34,915 |
# Bloom Framework
#
# John Boxall
# Copyright 2008 Handi Mobility
# www.handimobility.ca
| kevintom/django-bloom | bloom/image/templatetags/__init__.py | Python | gpl-3.0 | 89 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests Task 02."""
# Import Python libs
import unittest
import hamlet
import task_02
class Task02TestCase(unittest.TestCase):
"""
Test cases for Task 02.
"""
def test_positional_value(self):
"""
Tests that the POSITIONAL constant has ... | ModestoCabrera/is210-week-05-warmup | tests/test_task_02.py | Python | mpl-2.0 | 689 |
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy import testing
from sqlalchemy.testing.util import function_named
from sqlalchemy.testing import fixtures
from sqlalchemy.testing.schema import Table, Column
class BaseObject(object):
def __init__(self, *args, **kwargs):
for key, value ... | itkovian/sqlalchemy | test/orm/inheritance/test_magazine.py | Python | mit | 9,316 |
"""
Tests for the test server itself.
Not intended to be run by the greater test suite, only by specifically
targeting it on the command-line. Rationale: not really testing Fabric itself,
no need to pollute Fab's own test suite. (Yes, if these tests fail, it's likely
that the Fabric tests using the test server may als... | jaraco/fabric | tests/test_server.py | Python | bsd-2-clause | 2,975 |
# -*- 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 field 'Team.date_added'
db.add_column('sentry_team', 'date_added',
self.gf('d... | JackDanger/sentry | src/sentry/south_migrations/0086_auto__add_field_team_date_added.py | Python | bsd-3-clause | 23,507 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | anryko/ansible | lib/ansible/modules/network/f5/bigip_device_trust.py | Python | gpl-3.0 | 12,094 |
#!/usr/bin/python
#
# (c) 2018 Extreme Networks 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 late... | resmo/ansible | lib/ansible/modules/network/slxos/slxos_facts.py | Python | gpl-3.0 | 13,825 |
"""HTTP library functions."""
# This module contains functions for building an HTTP application
# framework: any one, not just one whose name starts with "Ch". ;) If you
# reference any modules from some popular framework inside *this* module,
# FuManChu will personally hang you up by your thumbs and submit you
# to a... | Branlala/docker-sickbeardfr | sickbeard/cherrypy/lib/httputil.py | Python | mit | 15,480 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | omwdunkley/crazyflieROS | src/crazyflieROS/cflib/utils/callbacks.py | Python | gpl-2.0 | 1,843 |
#!/usr/bin/env python
# Copyright 2014 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import json
import os
import sys
import urllib
from common_includes import *
import chromium_roll
class CheckActiv... | mxOBS/deb-pkg_trusty_chromium-browser | v8/tools/push-to-trunk/auto_roll.py | Python | bsd-3-clause | 4,392 |
# coding: utf-8
"""
Tests for some corner cases with deleting.
"""
from django.db import models
class DefaultRepr(object):
def __repr__(self):
return u"<%s: %s>" % (self.__class__.__name__, self.__dict__)
class A(DefaultRepr, models.Model):
pass
class B(DefaultRepr, models.Model):
a = models.For... | adviti/melange | thirdparty/google_appengine/lib/django_1_2/tests/modeltests/delete/models.py | Python | apache-2.0 | 967 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | alxgu/ansible | lib/ansible/modules/identity/ipa/ipa_service.py | Python | gpl-3.0 | 6,566 |
from i18nurls.application import Application as make_app
| jackTheRipper/iotrussia | web_server/lib/werkzeug-master/examples/i18nurls/__init__.py | Python | gpl-2.0 | 57 |
#!/usr/bin/python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Use: ../mergetraces.py `ls cyglog.* -Sr` > merged_cyglog
""""Merge multiple logs files from different processes into a single log.
Give... | jgcaaprom/android_external_chromium_org | tools/cygprofile/mergetraces.py | Python | bsd-3-clause | 8,029 |
# pylint: disable=no-member
"""
Tests for the Third Party Auth REST API
"""
import unittest
import ddt
from django.core.urlresolvers import reverse
from django.http import QueryDict
from mock import patch
from provider.constants import CONFIDENTIAL
from provider.oauth2.models import Client, AccessToken
from openedx.co... | ahmadiga/min_edx | common/djangoapps/third_party_auth/api/tests/test_views.py | Python | agpl-3.0 | 12,482 |
var = <warning descr="Python version 2.4, 2.5, 2.6, 3.0 do not support dictionary comprehensions">{k: v for k, v in zip('abc', <caret>range(3)) if k % 2}</warning> | idea4bsd/idea4bsd | python/testData/inspections/DictComprehensionToCall.py | Python | apache-2.0 | 163 |
# Copyright 2015 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/learn/python/learn/tests/dataframe/csv_parser_test.py | Python | apache-2.0 | 2,054 |
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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 lat... | goozbach/ansible | lib/ansible/plugins/action/normal.py | Python | gpl-3.0 | 1,774 |
from ctypes import *
import unittest
class SimpleTestCase(unittest.TestCase):
def test_cint(self):
x = c_int()
self.assertEquals(x._objects, None)
x.value = 42
self.assertEquals(x._objects, None)
x = c_int(99)
self.assertEquals(x._objects, None)
def test_ccharp(... | ztane/zsos | userland/lib/python2.5/ctypes/test/test_keeprefs.py | Python | gpl-3.0 | 4,029 |
"""Backward compatible with arrayfns from Numeric
"""
__all__ = ['array_set', 'construct3', 'digitize', 'error', 'find_mask',
'histogram', 'index_sort', 'interp', 'nz', 'reverse', 'span',
'to_corners', 'zmin_zmax']
import numpy as np
from numpy import asarray
class error(Exception):
pass
d... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/numpy/oldnumeric/arrayfns.py | Python | agpl-3.0 | 2,532 |
"""
Timezone-related classes and functions.
This module uses pytz when it's available and fallbacks when it isn't.
"""
from datetime import datetime, timedelta, tzinfo
from threading import local
import sys
import time as _time
try:
import pytz
except ImportError:
pytz = None
from django.conf import setting... | zzeleznick/zDjango | venv/lib/python2.7/site-packages/django/utils/timezone.py | Python | mit | 9,180 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/ndlstm/python/misc_test.py | Python | apache-2.0 | 2,875 |
# Copyright: (c) 2018, Toshio Kuratomi <tkuratomi@ansible.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
"""
Context of the running Ansible.
In the... | vmindru/ansible | lib/ansible/context.py | Python | gpl-3.0 | 2,049 |
# make sure type of first arg (self) to a builtin method is checked
list.append
try:
list.append()
except TypeError as e:
print("TypeError")
try:
list.append(1)
except TypeError as e:
print("TypeError")
try:
list.append(1, 2)
except TypeError as e:
print("TypeError")
l = []
list.append(l, 2... | MrSurly/micropython-esp32 | tests/basics/self_type_check.py | Python | mit | 464 |
# -*- coding: utf-8 -*-
# Author: David Goodger
# Contact: goodger@users.sourceforge.net
# Revision: $Revision: 4229 $
# Date: $Date: 2005-12-23 00:46:16 +0100 (Fri, 23 Dec 2005) $
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, pleas... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/docutils/parsers/rst/languages/gl.py | Python | gpl-2.0 | 3,711 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.middleware.csrf import (
CSRF_KEY_LENGTH, CsrfViewMiddleware, get_token,
)
from django.template import RequestContext, Template
from django.... | jejimenez/django | tests/csrf_tests/tests.py | Python | bsd-3-clause | 19,350 |
"""
Oracle database backend for Django.
Requires cx_Oracle: http://cx-oracle.sourceforge.net/
"""
from __future__ import unicode_literals
import datetime
import decimal
import os
import platform
import sys
import warnings
from django.conf import settings
from django.db import utils
from django.db.backends.base.base ... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/Django-1.9-py2.7.egg/django/db/backends/oracle/base.py | Python | artistic-2.0 | 24,995 |
version = 0x105016
tools = [{'tool': 'ar', 'tooldir': None, 'funs': None}, {'tool': 'cc', 'tooldir': None, 'funs': None}, {'tool': 'gcc', 'tooldir': None, 'funs': None}, {'tool': 'compiler_cc', 'tooldir': None, 'funs': None}, {'tool': 'cxx', 'tooldir': None, 'funs': None}, {'tool': 'gxx', 'tooldir': None, 'funs': None}... | thetomcraig/redwood | web/node_modules/hiredis/build/c4che/build.config.py | Python | isc | 434 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2016, Silvio Peroni <essepuntato@gmail.com>
#
# 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 copies.
... | essepuntato/opencitations | script/statistics.py | Python | isc | 3,561 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# rocketdiagram documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this... | natronics/rocketdiagram | docs/conf.py | Python | isc | 8,473 |
import ConfigParser
import os.path
import ast
DEFAULT_CONF_FILE = '/etc/unbound/unbound_ec2.conf'
DEFAULT_AWS_REGION = 'us-west-1'
DEFAULT_ZONE = 'zone.tld'
DEFAULT_REVERSE_ZONE = '127.in-addr.arpa'
DEFAULT_TTL = '300'
DEFAULT_CACHE_TTL = '30'
DEFAULT_SERVER_TYPE = 'caching'
DEFAULT_LOOKUP_TYPE = 'cache'
DEFAULT_LOOKU... | unibet/unbound-ec2 | unbound_ec2/config.py | Python | isc | 3,425 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Decrypting the encrypted C&C traffic in version C of WireLurker. """
__copyright__ = "Copyright (c) 2014, Palo Alto Networks, Inc."
__author__ = "Claud Xiao"
import sys
import base64
try:
import pyDes
except ImportError:
print 'ERROR: the script requi... | PaloAltoNetworks-BD/WireLurkerDetector | decryptor.py | Python | isc | 992 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2022 F4PGA 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
#
# Unl... | SymbiFlow/prjuray | fuzzers/007-timing/bel/tim2json.py | Python | isc | 10,507 |
"""
[12/4/2012] Challenge #114 [Easy] Word ladder steps
https://www.reddit.com/r/dailyprogrammer/comments/149kec/1242012_challenge_114_easy_word_ladder_steps/
A word ladder is a sequence of words made by changing one letter at a time. For example:
cold → cord → card → ward → warm
Given a word, list all the words ... | DayGitH/Python-Challenges | DailyProgrammer/DP20121204A.py | Python | mit | 983 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
HOST = 'localhost'
PORT = 1234
ADDR = (HOST, PORT)
BUFSIZE = 1024
while True:
tcpCliSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tcpCliSock.connect(ADDR)
data = raw_input('> ')
if not data:
break
tcpCliSock.send('{}... | Furzoom/learnpython | app/test/TsTclntSS.py | Python | mit | 455 |
import unittest
from programy.parser.template.nodes import *
from test.parser.template.graph.test_graph_client import TemplateGraphTestClient
class TemplateGraphTopicTests(TemplateGraphTestClient):
def test_topicstar_index_as_attrib_full(self):
template = ET.fromstring("""
<template>
<topicstar i... | Thielak/program-y | src/test/parser/template/graph/test_topic.py | Python | mit | 663 |
from scipy.io import loadmat
# which_profile = "LMS"
# which_profile = "longer_profile2"
# which_profile = "properly_aligned3"
def get_stations(which_profile):
all_gps = loadmat('data/gps/CalaisGanSocquetBanerjeeApel_in_Calais_RF_trim_Clean_Tog.sta.data.mat')
all_station_names = all_gps['station_name']
... | tbenthompson/LMS_public | lms_code/lib/gps.py | Python | mit | 1,311 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 绘制简单的折线图
import matplotlib.pyplot as plt
input_values = list(range(1, 6))
squares = [x * x for x in input_values]
# 根据传递的参数来绘制出有意义的图形
plt.plot(input_values, squares, linewidth=3)
# 设置图表的标题及标题的字体大小
plt.title("Square Numbers", fontsize=14)
# 给坐标轴加上标签
plt.xlabel("Value... | felix9064/python | Demo/pcc/mpl_squares.py | Python | mit | 606 |
#!/usr/bin/env python
import sys
import os
import re
import glob
import shutil
import argparse
from fractions import *
import common
log = common.get_log()
# Global paths
base_path = os.path.dirname(os.path.normpath(sys.argv[0]))
tmp_base_path = os.path.join(base_path, "tmp")
tmp_path = os.path.join(tmp_base_path,... | soarlab/FPTaylor | scripts/plot/gappa_data.py | Python | mit | 6,162 |
#!/usr/bin/python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the directory tha... | ahmedbodi/terracoin | contrib/seeds/generate-seeds.py | Python | mit | 4,378 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-11-21 18:16
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... | ByrdOfAFeather/AlphaTrion | Community/migrations/0034_auto_20171121_1316.py | Python | mit | 1,619 |
# -*- coding: utf-8 -*-
#
# sqla-taskq documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 12 07:55:53 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
... | LeResKP/sqla-taskq | docs/conf.py | Python | mit | 9,266 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/virtual_machine_scale_set_vm_instance_view.py | Python | mit | 3,269 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | rjschwei/azure-sdk-for-python | azure-mgmt-dns/azure/mgmt/dns/models/arecord.py | Python | mit | 833 |
import sys
from sqlblock.postgres.connection import AsyncPostgresSQL
def aiohttp_setup_sqlblock(app, conn: AsyncPostgresSQL):
async def startup(app):
await conn.__aenter__()
async def shutdown(app):
await conn.__aexit__(*sys.exc_info())
print('closed sqlblock')
app.on_startup.... | lcgong/sqlblock | sqlblock/setup.py | Python | mit | 372 |
from myfitnesspal.client import Client # noqa
__version__ = "1.16.6"
VERSION = tuple(int(v) for v in __version__.split("."))
| coddingtonbear/python-myfitnesspal | myfitnesspal/__init__.py | Python | mit | 128 |
__author__ = 'sean-abbott'
# RED this whole thing should be swapped out for cookiecutter
# https://github.com/audreyr/cookiecutter
import os
import sys
import shutil
import inspect
from pkg_resources import resource_filename
import click
from jinja2 import Environment, PackageLoader
import utils
# YELLOW create_b... | sean-abbott/auto_build_env | src/abe/create_skeleton.py | Python | mit | 3,540 |
##A script for creating tables for each cancer, with the data sorted
def compare(first,second):
if float(first[-2])>float(second[-2]):
return 1
elif float(first[-2])<float(second[-2]):
return -1
else:
return 0
## Load necessary modules
import os
BASE_DIR = os.path.dirname(os.path.... | OmnesRes/pan_cancer | paper/tables/S1/table_creation.py | Python | mit | 5,368 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
# from datetime import timedelta, datetime
from yamo import (
Connection,
EmbeddedDocument, Document, IDFormatter, Index,
StringField,
IntField,
FloatField,
BooleanField,
ListField,
EmbeddedField,
DateTimeField,
)
conn = ... | yxdong/ybk | zg/models.py | Python | mit | 3,701 |
#!/usr/bin/env python
import os
import sys
from optparse import OptionParser
import django
from django.conf import settings
from django.core.management import call_command
def main():
parser = OptionParser()
parser.add_option("--DATABASE_ENGINE", dest="DATABASE_ENGINE", default="sqlite3")
parser.add_op... | FundedByMe/django-bisnode | run_tests.py | Python | mit | 2,639 |
import json
import os
import unittest
from pymatgen.phonon.bandstructure import PhononBandStructureSymmLine
from pymatgen.util.testing import PymatgenTest
class PhononBandStructureSymmLineTest(PymatgenTest):
def setUp(self):
with open(
os.path.join(PymatgenTest.TEST_FILES_DIR, "NaCl_phonon_ba... | materialsproject/pymatgen | pymatgen/phonon/tests/test_bandstructure.py | Python | mit | 3,536 |
#!/usr/bin/env python
# coding:utf-8
"""
只在单进程时正确工作.
"""
import os
import re
import sys
import time
import shutil
import logging
from logging.handlers import RotatingFileHandler
VERSION = "1.0.0"
def init_log(mod_dir):
logging_msg_format = '[%(asctime)s] [%(levelname)s] [%(module)s] %(message)s'
logging_date... | boisde/Greed_Island | business_logic/order_collector/transwarp/log.py | Python | mit | 6,028 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 limitation the rights to us... | EmanueleCannizzaro/scons | test/WhereIs.py | Python | mit | 4,794 |
"""
Test objconfig.writer.AbstractWriter
"""
import pytest
from objconfig.exception import RuntimeException
from objconfig.writer import WriterInterface
from objconfig.writer import AbstractWriter
from objconfig import Config
import os
def test_methods_abstractwriter():
writer = AbstractWriter()
conf = Confi... | asherwunk/objconfig | tests/writer/test_abstractwriter.py | Python | mit | 728 |
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
root = os.path.abspath(os.path.dirname(__file__))
try:
with open(os.path.join(root, 'README.rst')) as f:
README = f.read()
with open(os.path.join(root, 'CHANGES.rst')) as f:
CHANGES = f.read()
except IOError:
REA... | Gab-km/papylon | setup.py | Python | mit | 1,466 |
from os import listdir
from os.path import isfile, join
from Utilities.Text import Text
from Utilities.TermFrequencyInverseDocumentFrequency import TermFrequencyInverseDocumentFrequency as TFIDF
from sklearn import svm
from pprint import pprint
import numpy as np
from sklearn.decomposition import PCA
def main():
p... | ajkannan/Classics-Research | tf_idf_one_class_svm.py | Python | mit | 2,185 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2019-11-24 03:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('logger', '0001_initial'),
]
operations = [
migrations.AlterField(
... | imvu/bluesteel | app/logic/logger/migrations/0002_auto_20191123_1904.py | Python | mit | 679 |
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2017 - 2018 FrostLuma
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 limitation the rights
to use, c... | FrostLuma/Mousey | mousey/bot/context.py | Python | mit | 2,070 |
import unittest
from katas.kyu_7.guess_my_number import guess_my_number
class GuessMyNumberTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(guess_my_number('0'), '###-###-####')
def test_equals_2(self):
self.assertEqual(guess_my_number('01'), '1##-##1-####')
def test... | the-zebulan/CodeWars | tests/kyu_7_tests/test_guess_my_number.py | Python | mit | 693 |
import imaplib
import email
# you want to connect to a server; specify which server
server = imaplib.IMAP4('imap.*.com')
# after connecting, tell the server who you are
server.login('*', '*')
# this will show you a list of available folders
# possibly your Inbox is called INBOX, but check the list of mailboxes
code, m... | jhertzog/pi | email/imap_delete.py | Python | mit | 1,097 |
""" Module of mathematical array """
class Array(object):
"""
Multidimentionnal Array of Number
"""
def __init__(self):
self.data = []
def add(self, target):
""" Add another Array to self """
for (i, table) in enumerate(target.data):
for (j, val) in enumerate(tab... | SuliacLEGUILLOU/computor | srcs/Array.py | Python | mit | 575 |
from zipfile import ZipFile
class Package(object):
"""ZipFile wrapper to append/update/remove files from zip"""
def __init__(self, filename=None):
self.filename = filename
self.content = {}
def read(self, filename=None):
filename = filename or self.filename
with ZipFile(fi... | backbohne/docx-xslt | docxxslt/package.py | Python | mit | 1,498 |
# -*- coding: utf-8 -*-
from recommonmark.parser import CommonMarkParser
from recommonmark.transform import AutoStructify
templates_path = ['_templates']
source_suffix = '.markdown'
source_parsers = { '.markdown': CommonMarkParser }
master_doc = 'index'
project = u'sphinxproj'
copyright = u'2015, rtfd'
author = u'rt... | rtfd/recommonmark | tests/sphinx_custom_md/conf.py | Python | mit | 794 |
from setuptools import setup
long_description = ""
setup(
name="fluidsynth",
version="0.1",
packages=[
'fluidsynth',
],
author="Paul Tagliamonte",
author_email="tag@pault.ag",
long_description=long_description,
description='n/a',
license="Expat",
url="http://pault.ag/"... | paultag/python-fluidsynth | setup.py | Python | mit | 346 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-01-05 14:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0006_auto_20161229_1650'),
]
operations = [
migrations.AlterField(
... | uraxy/imozzle | api/migrations/0007_auto_20170105_2339.py | Python | mit | 446 |
from __future__ import division, print_function, absolute_import
import math
import sys
import numpy as np
from numpy import sqrt, cos, sin, arctan, exp, log, pi, Inf
from numpy.testing import (assert_, TestCase, run_module_suite, dec,
assert_allclose, assert_array_less, assert_almost_equal... | DailyActie/Surrogate-Model | 01-codes/scipy-master/scipy/integrate/tests/test_quadpack.py | Python | mit | 13,179 |
import json
import requests
class Building():
"""Building Client."""
# Service Setup
config = {
'schema': 'http',
'host': 'localhost',
'port': '9202',
'endpoint': 'api/v1/buildings'
}
@classmethod
def base_url(cls):
"""Form the base url for the service... | Foris/darwined-core-python-clients | darwined_core_python_clients/physical/buildings.py | Python | mit | 2,117 |
from vgengine import game
from vgengine.game import graphics, physics, control
scene = game.Scene(
physics.Physics2DGrid(),
graphics.Graphics2D((400, 400)),
control.Control()
)
scene.graphics.camera.size = (400, 400)
class Keyboard(control.Controller):
def update(self):
keyboard_pressed = graphics... | jrburga/VGEngine | examples/grid_world.py | Python | mit | 1,271 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
from ..net import VAE
from ..util.common import batch_to_sequence, sequence_to_batch
from ..util.init import orthogonal_init
class _CNNBase(nn.Module):
def __init__(self):
super(_CNNBase, self).__ini... | qsheeeeen/Self-Driving-Car | rl_toolbox/policy/shared.py | Python | mit | 8,677 |
import superimport
import numpy as np
import matplotlib.pyplot as plt
import pyprobml_utils as pml
err = np.linspace(-3.0, 3.0, 60)
L1 = abs(err);
L2 = err**2;
delta = 1.5;
ind = abs(err) <= delta;
huber = np.multiply(0.5*ind, (err**2)) + np.multiply((1-ind) , (delta*(abs(err)-delta/2)))
vapnik = np.multiply(ind, 0)... | probml/pyprobml | scripts/huberLossPlot.py | Python | mit | 583 |
from ulp.urlextract import escape_ansi, parse_input
import os
TEST_DIR = os.path.dirname(os.path.realpath(__file__))
def test_parse_no_url_input():
assert len(parse_input("")) == 0
multiline_text = """
text
without URLs
and
multiple lines """
assert len(parse_input(multiline_text)) == 0
... | victal/ulp | test/test_urlextract.py | Python | mit | 1,212 |
import scipy.stats
import mir3.data.score as sc
import mir3.lib.mir.midifeatures as feats
import mir3.module
class BestNoteDistribution(mir3.module.Module):
"""Selects the score with the best note distribution
"""
def get_help(self):
return """Finds the periodicity of a series of binarizations r... | pymir3/pymir3 | mir3/modules/unsupervised/detection/threshold/lower_pitchclass_entropy.py | Python | mit | 1,438 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# This file is part of Pynspect package (https://pypi.python.org/pypi/pynspect).
# Originally part of Mentat system (https://mentat.cesnet.cz/).
#
# Copyright (C) since 2016 CESNET, z.s.p.o (h... | honzamach/pynspect | pynspect/tests/test_filters_inspector.py | Python | mit | 13,013 |
import glob
import math
import shutil
import os
import sys
if len(sys.argv) == 1:
print("usage: partition.py <raw_dataset_folder> <train_percentage> <test_percentage>")
sys.exit()
kTRAINING_SET_PERCENTAGE = int(sys.argv[2])
kTEST_SET_PERCENTAGE = int(sys.argv[3])
# Delete directory if exists
if os.path.exist... | diharaw/EmoLib | scripts/preprocess/1_partition.py | Python | mit | 2,329 |