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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-05-15 06:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pages', '0002_auto_20160512_0259'),
]
operations = [
migrations.CreateModel(... | samdowd/drumm-farm | pages/migrations/0003_auto_20160515_0618.py | Python | mit | 2,802 |
# Transfomer/Framework/Utilities.py
# ----------------
# Module Docstring
# ----------------
""" Utilities for (re)processing sets of structures in parallel. """
# -------
# Imports
# -------
import multiprocessing;
from Transformer import StructureSet;
from Transformer.Utilities import MultiprocessingHelper;
... | JMSkelton/Transformer | Transformer/Framework/Utilities.py | Python | gpl-3.0 | 9,340 |
import os
from setuptools import setup, find_packages
import versioneer
import sys
ENABLE_INSTALL = os.getenv('CIF_ENABLE_INSTALL')
# vagrant doesn't appreciate hard-linking
if os.environ.get('USER') == 'vagrant' or os.path.isdir('/vagrant'):
del os.link
# https://www.pydanny.com/python-dot-py-tricks.html
if sys... | csirtgadgets/bearded-avenger | setup.py | Python | mpl-2.0 | 3,557 |
from django.db import models
from elixir.model.resource_model.resource import *
# TODO
class Topic(models.Model):
# topic should not be mandatory
uri = models.TextField(blank=True, null=True)
term = models.TextField(blank=True, null=True)
resource = models.ForeignKey(Resource, null=True, blank=True, related_name... | bio-tools/biotoolsregistry | backend/elixir/model/resource_model/topic.py | Python | gpl-3.0 | 484 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | mfherbst/spack | var/spack/repos/builtin/packages/py-numba/package.py | Python | lgpl-2.1 | 2,019 |
import os
import sys
import copy
import errno
import yaml
from twisted.internet import defer
from twisted.python import usage
from ooni import errors
from ooni.geoip import ProbeIP
from ooni.settings import config
from ooni.deckgen import __version__
from ooni.resources import inputs
class Options(usage.Options):... | 0xPoly/ooni-probe | ooni/deckgen/cli.py | Python | bsd-2-clause | 5,005 |
def f(x):
"""
Returns:
object:
"""
return 42 | amith01994/intellij-community | python/testData/intentions/afterReturnTypeInNewGoogleDocString.py | Python | apache-2.0 | 68 |
# List of modules to import when the Celery worker starts.
imports = ('refill.tasks',)
## Broker settings.
broker_url = 'redis://localhost'
## Using the database to store task state and results.
result_backend = 'redis://localhost'
## Autoscaling
max_concurrency = 100
min_concurrency = 10
task_annotations = {'*': {... | zhaofengli/refill | backend/celeryconfig.example.py | Python | bsd-2-clause | 342 |
from django.contrib.gis.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class City(models.Model):
name = models.CharField(max_length=30)
point = models.PointField(geography=True)
objects = models.GeoManager()
def __str__(self):
return... | ericholscher/django | django/contrib/gis/tests/geogapp/models.py | Python | bsd-3-clause | 876 |
#!/usr/bin/python
from distutils.core import setup
from setuptools import find_packages
setup(
name='autopilot',
version='1.0',
description='Unity test driver automation script',
author='Alex Launi',
author_email='alex.launi@canonical.com',
url='https://launchpad.net/unity',
license='GPLv3... | isaacj87/unity | tests/autopilot/setup.py | Python | gpl-3.0 | 355 |
# -*- coding: utf-8 -*-
# Copyright © 2015-2017 Carl Chenet <chaica@backupcheckerproject.org>
# 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
# any later vers... | backupchecker/backupchecker | backupchecker/expectedvalues.py | Python | gpl-3.0 | 10,915 |
#!/usr/bin/env python
#coding: utf-8
#### CLASSES ####
class fasta():
"""
"""
def __init__(self):
"""
"""
self.fastaDict = {}
#### FUNCTIONS ####
def fasta_reader(self, fastaFile):
"""
"""
fastaDict = {}
subHeader("Fasta reader")
... | brguez/TEIBA | src/python/clusterClippedReads.py | Python | gpl-3.0 | 25,308 |
import os
import time
from datetime import datetime, timedelta
from time import sleep
from expects import expect, have_key, contain, have_keys, be_empty, equal, be_false, be_above_or_equal, have_len
from mamba import it, before, context, description
from sdcclient.monitor import EventsClientV2
from specs import be_su... | draios/python-sdc-client | specs/monitor/events_v2_spec.py | Python | mit | 6,893 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-datafactory/azure/mgmt/datafactory/models/phoenix_linked_service.py | Python | mit | 6,533 |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import mock
from nose.tools import assert_raises
from . import scheduler
from .config import config_value
from .job import Job
from .webapp import app
from digits import test_utils
from digits.utils import subc... | TimZaman/DIGITS | digits/test_scheduler.py | Python | bsd-3-clause | 1,786 |
#!/usr/bin/env python3
""" Staging/live web site pubsubber for ASF git repos """
import urllib.request
import asfpy.messaging
import syslog
import subprocess
import os
import time
import shutil
import re
import threading
import json
import socket
PUBSUB_URL = 'http://pubsub.apache.org:2069/'
PUBSUB_QUEUE = {}
GIT_CMD ... | sebbASF/infrastructure-puppet | modules/staged/files/staged.py | Python | apache-2.0 | 7,554 |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from stix import report
from stix.core.ttps import TTPs
from stix.test import EntityTestCase, data_marking_test
from stix.test.common import (information_source_test, structured_text_test,
... | STIXProject/python-stix | stix/test/report_test.py | Python | bsd-3-clause | 3,509 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2010 Prof. William H. Green (whgreen@mit.edu) and the
# RMG Team (rmg_dev@mit.edu)
#
# Permission is hereby granted, free of c... | comocheng/RMG-Py | rmgpy/data/base.py | Python | mit | 52,066 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/ha/hanode_ci_binding.py | Python | apache-2.0 | 5,672 |
from enable.api import OverlayContainer, Compass, Window
from enable.example_support import demo_main, DemoFrame
class MyFrame(DemoFrame):
def _create_window(self):
compass = Compass(scale=2, color="blue", clicked_color="red")
container = OverlayContainer()
container.add(compass)
... | tommy-u/enable | examples/enable/compass_example.py | Python | bsd-3-clause | 739 |
#!/usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
from contextlib import contextmanager
import json
import os
from selenium import webdriver
from... | UK992/servo | etc/ci/performance/gecko_driver.py | Python | mpl-2.0 | 3,811 |
import toolz
from distributed.http.prometheus import PrometheusCollector
from distributed.http.utils import RequestHandler
from distributed.scheduler import ALL_TASK_STATES
from .semaphore import SemaphoreMetricCollector
class SchedulerMetricCollector(PrometheusCollector):
def __init__(self, server):
su... | dask/distributed | distributed/http/scheduler/prometheus/core.py | Python | bsd-3-clause | 3,609 |
"""Base Entity for Sonarr."""
from __future__ import annotations
from sonarr import Sonarr
from homeassistant.const import (
ATTR_IDENTIFIERS,
ATTR_MANUFACTURER,
ATTR_NAME,
ATTR_SW_VERSION,
)
from homeassistant.helpers.entity import DeviceInfo, Entity
from .const import DOMAIN
class SonarrEntity(En... | lukas-hetzenecker/home-assistant | homeassistant/components/sonarr/entity.py | Python | apache-2.0 | 1,359 |
from django.conf import settings
from pydjamodb.models import DynamoModel
from pynamodb.attributes import (
MapAttribute, NumberAttribute, UnicodeAttribute, UTCDateTimeAttribute, BooleanAttribute, NumberAttribute
)
class Comment(DynamoModel):
issue_id = UnicodeAttribute(hash_key=True)
user_id = UnicodeAt... | matllubos/django-is-core | example/dj/apps/issue_tracker/dynamo/models.py | Python | bsd-3-clause | 493 |
from djangojs.views import QUnitView
class MyQUnitView(QUnitView):
django_js = True
template_name = 'integration_tests/test-qunit.html'
js_files = (
'site/tests/qunit-assert-canvas.js',
'site/js/Detection.js',
'site/js/VideoDetections.js',
'site/tests/Detection.tests.js',
... | iago-suarez/ancoweb-TFG | src/integration_tests/views.py | Python | apache-2.0 | 368 |
#!/usr/bin/env python
from translate.convert import csv2po, po2csv, test_convert
from translate.misc import wStringIO
from translate.storage import csvl10n, po
from translate.storage.test_base import first_translatable, headerless_len
class TestPO2CSV:
def po2csv(self, posource):
"""helper that converts... | claudep/translate | translate/convert/test_po2csv.py | Python | gpl-2.0 | 5,532 |
# -*- coding: utf-8 -*-
import logging
from django_docopt_command import DocOptCommand
from ...feeds.thematicmapping import Thematicmapping
logger = logging.getLogger(__name__)
class Command(DocOptCommand):
docs = "Usage: thematicmapping <level>"
def handle_docopt(self, arguments):
importer = Th... | jleivaizq/freesquare | freesquare/geo/management/commands/thematicmapping.py | Python | mit | 380 |
CONFIG_PATH = 'genconf/config.yaml'
SSH_KEY_PATH = 'genconf/ssh_key'
IP_DETECT_PATH = 'genconf/ip-detect'
SERVE_DIR = 'genconf/serve'
STATE_DIR = 'genconf/state'
GENCONF_DIR = 'genconf'
| xinxian0458/dcos | dcos_installer/constants.py | Python | apache-2.0 | 186 |
#!/usr/local/bin/python
import json
import sys
import time
import requests
import yaml
import subprocess
import os
import asfgit.cfg as cfg
import asfgit.git as git
import asfgit.log as log
def has_publishing_via_asfyaml(refname):
""" Figure out if this branch has a .asf.yaml file with publishing enabled.
... | apache/infrastructure-puppet | modules/gitbox/files/asfgit/hooks/gitpubsub.py | Python | apache-2.0 | 3,803 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: Twitter client
#
# Copyright (C) 2001-2017 NLTK Project
# Author: Lorenzo Rubio <lrnzcig@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Regression tests for `json2csv()` and `json2csv_entities()` in Twitter
package.
"""
import o... | sdoran35/hate-to-hugs | venv/lib/python3.6/site-packages/nltk/test/unit/test_json2csv_corpus.py | Python | mit | 7,966 |
# coding=utf-8
#
# 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");... | lukecwik/incubator-beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/groupbykey_test.py | Python | apache-2.0 | 1,724 |
"""
Obfuscated, service version of C windows/meterpreter/reverse_http.
Implements various randomized string processing functions in an
attempt to obfuscate the call tree.
Also compatible with Cobalt-Strike's Beacon.
Psexec-compatible.
Original reverse_tcp inspiration from https://github.com/rsmudge/metasploit-load... | codercold/Veil-Evasion | modules/payloads/c/meterpreter/rev_http_service.py | Python | gpl-3.0 | 15,135 |
# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Mozaik: Involvement",
"summary": """
Manage involvements (and all kind of segmentation) on partners""",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV",
"websit... | mozaik-association/mozaik | mozaik_involvement/__manifest__.py | Python | agpl-3.0 | 1,026 |
"""
Project Name: Twitter Tagcloud
Author: Alexandru Buliga
Email: bugaaa92@gmail.com
"""
import sys
import re
import logging
import json
import redis
from threading import currentThread, enumerate, Lock, Thread
from collections import Counter, OrderedDict
from datetime import datetime
... | Bugaa92/Twitter-Tagcloud | src/redis_tagcloud.py | Python | apache-2.0 | 6,589 |
"""
Utilities and helper functions
"""
def get_object_or_none(model, **kwargs):
try:
return model.objects.get(**kwargs)
except model.DoesNotExist:
return None | chhantyal/exchange | uhura/exchange/utils.py | Python | bsd-3-clause | 183 |
## \file
## \ingroup tutorial_pyroot
## \notebook -nodraw
## example of macro to read data from an ascii file and
## create a root file with a Tree.
##
## NOTE: comparing the results of this macro with those of staff.C, you'll
## notice that the resultant file is a couple of bytes smaller, because the
## code below str... | mhuwiler/rootauto | tutorials/pyroot/staff.py | Python | lgpl-2.1 | 2,311 |
# cording: utf-8
import os
import logging
from logging.handlers import RotatingFileHandler
from oslo_config import cfg
from fabkit import env
CONF = cfg.CONF
def init_logger(cluster_name):
root_logger = logging.getLogger()
root_logger.setLevel(CONF.logger.level.upper())
cluster_log_dir = os.path.join(C... | fabrickit/fabkit | core/fabkit/log/log_util.py | Python | mit | 1,333 |
# LXC Python Library
# for compatibility with LXC 0.8 and 0.9
# on Ubuntu 12.04/12.10/13.04
# Author: Elie Deloumeau
# Contact: elie@deloumeau.fr
# The MIT License (MIT)
# Copyright (c) 2013 Elie Deloumeau
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associate... | mosquito/LXC-Web-Panel | lwp/lxc/__init__.py | Python | mit | 13,591 |
#! /usr/bin/env python
import os
import re
def generate_rule(fname):
if fname[-4:] != ".cpp":
return
base = fname[:-4]
regex = re.compile(r'#\s*include\s*"([\w/.]+)"')
deps = list()
for fline in open(fname):
mtch = regex.search(fline)
#print mtch, fline
if mtch:
deps.append(mtch.gr... | LWisteria/hpcg | tools/makefile.py | Python | bsd-3-clause | 781 |
# -*- coding: utf-8 -*-
#Copyright (C) 2011 Seán Hayes
#
#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 ... | greyside/django-mesh | django_mesh/tests/test_urls.py | Python | gpl-3.0 | 24,907 |
from core.himesis import *
#find the nodes with these mm names
def find_nodes_with_mm(graph, mm_names):
return [node for node in graph.vs if node["mm__"] in mm_names]
#=========================
def get_all_attached(graph):
attached = [[] for x in range(graph.vcount())]
for edge in graph.es:
sour... | levilucio/SyVOLT | core/himesis_plus.py | Python | mit | 7,446 |
import logging
import mock
import tempfile
import os
from . import fixture
from . import stubs
from rhsm import logutil
# no NullHandler in 2.6, include our own
class NullHandler(logging.Handler):
def emit(self, record):
pass
class TestLogutil(fixture.SubManFixture):
def setUp(self):
sup... | candlepin/subscription-manager | test/test_logutil.py | Python | gpl-2.0 | 10,956 |
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | tensorflow/tfx | tfx/tools/cli/commands/run_test.py | Python | apache-2.0 | 6,891 |
from dal import autocomplete
from django import test
from django.core.exceptions import ValidationError
import six
class Select2ListChoiceFieldTest(test.TestCase):
choice_list = ['windows', 'linux', 'osx']
def get_choice_list(self):
return self.choice_list
def test_init(self):
field ... | shubhamdipt/django-autocomplete-light | test_project/select2_list/test_fields.py | Python | mit | 1,178 |
from django.shortcuts import get_object_or_404
from django.views.generic import ListView,DetailView
from books.models import Publisher,Book,Author
from django.utils import timezone
class PublisherBookList(ListView):
template_name="books/books_by_publisher.html"
def get_queryset(self):
self.publisher ... | salamer/NotesOfDjangoBook | mysite/books/views.py | Python | apache-2.0 | 1,249 |
'''
GAMEPAD INTERFACE
Ethan Laverack and David Buckingham
Description: Uses PyGame joystick library to pull data off of gamepad and send axis
and button states to ui_hub through standard out
FOR REFERENCE: https://www.pygame.org/docs/ref/joystick.html
CONSULT global_data.py FOR DEFINITIONS -db
'''
imp... | DaveBuckingham/robosoft | gamepad_to_stdout.py | Python | mit | 2,471 |
# -*- coding: utf-8 -*-
class Meta:
author = "Indifex Ltd."
title = "Translation Memory"
description = "Search through current and past translations"
| hfeeki/transifex | transifex/addons/trans_memory/__init__.py | Python | gpl-2.0 | 162 |
"""
Copyright 2014 Quentin Kaiser
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
dis... | QKaiser/pynessus | pynessus/models/user.py | Python | apache-2.0 | 4,013 |
# coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
from time import time
import pandas as pd
import psutil
class Runtime(list):
# TODO: https://docs.python.org/3/library/time.html#time.proc... | jaantollander/Pointwise-Convergence | src_legacy/io/save/metadata.py | Python | mit | 1,616 |
# -*- coding: utf-8 -*-
# Copyright 2014 MongoDB, 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 ... | asvetlov/motor | test/asyncio_tests/test_asyncio_gridfs.py | Python | apache-2.0 | 14,732 |
"""
Test for Tanh convolutional layer.
"""
import os
from theano import config
from theano.sandbox import cuda
from pylearn2.config import yaml_parse
import pylearn2
def test_conv_tanh_basic():
"""
Tests that we can load a convolutional tanh model
and train it for a few epochs (without saving) on a dum... | JazzeYoung/VeryDeepAutoEncoder | pylearn2/pylearn2/models/tests/test_convelemwise_tanh.py | Python | bsd-3-clause | 718 |
# flake8: noqa
TWITTER_ACCOUNTS = {
'twitter_username' = {
'KEY': '',
'SECRET': '',
'CONS_KEY': '',
'CONS_SECRET': '',
}
| cnbird1999/ava | ava/test_twitter/example_twitter_settings.py | Python | gpl-2.0 | 158 |
"""Runnable model."""
import inspect
import warnings
from typing import Union
import sciunit.capabilities as cap
from .backends import Backend, available_backends
from .base import Model
class RunnableModel(Model, cap.Runnable):
"""A model which can be run to produce simulation results."""
def __init__(
... | scidash/sciunit | sciunit/models/runnable.py | Python | mit | 4,954 |
import numpy as np
from keras.datasets import mnist
from keras.layers import Activation
from keras.layers import Dense
from keras.models import Sequential
from keras.utils import np_utils
np.random.seed(1337)
nb_classes = 10
batch_size = 128
nb_epoch = 5
weighted_class = 9
standard_weight = 1
high_weight = 5
max_trai... | farizrahman4u/keras-contrib | keras_contrib/tests/regularizers.py | Python | mit | 1,414 |
# -*- coding: utf-8 -*-
from plone.autoform.interfaces import IFormFieldProvider
from plone.dexterity.interfaces import IDexterityContent
from plone.namedfile import field as namedfile
from plone.supermodel import model
from zope import schema
from zope.component import adapter
from zope.interface import implementer
fr... | ade25/ade25.contacts | ade25/contacts/behaviors/portrait.py | Python | mit | 752 |
#!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
import os
import re
import sys
import urllib
from urllib.request import urlopen, URLError
""... | cordjr/wttd-exercise | logpuzzle/logpuzzle.py | Python | apache-2.0 | 2,453 |
# 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.
import logging
import time
from integration_tests import network_metrics
from telemetry.page import page_test
from telemetry.value import scalar
class Chr... | hefen1/chromium | tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py | Python | bsd-3-clause | 16,680 |
"""
This is a simple calculator program.
Exercise:
1. Make sure it works correctly.
2. Fix any problems with this program
3. Commit the fix to your repository
3. Add feature to use existing subtraction function
4. Commit
5. Add multiplication and division (requires writing new function)
"""
def add_two_numbers(x,y):
... | mixmixmix/malagasy_translate_tutorial | 2_calculator.py | Python | gpl-3.0 | 872 |
# Copyright (c) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | dims/heat | heat/tests/openstack/sahara/test_cluster.py | Python | apache-2.0 | 8,913 |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... | CraigHarris/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/security/kerberos/test_kerberos_smoke.py | Python | apache-2.0 | 943 |
#!/usr/bin/env python
"""
data_prep.py: classes for designing data treatment.
"""
import pandas as pd
from .mixin import TreatmentDesignMixin
from ..utils._validation import _check_positive_class
class ClassificationTreatmentDesign(TreatmentDesignMixin):
"""
Class for designing treatments for classification ... | jmwoloso/avalearn | avalearn/preprocessing/design.py | Python | bsd-3-clause | 16,430 |
# TypeSubjectFromRIFCS.py takes input xml in RIFCS format and outputs subjectType and subjectText to .csv file per line as:
# subjectType|subjectText
#
#
#Usage: TypeSubjectFromRIFCS.py [options] arg1
#
#Options:
# -h, --help show this help message and exit
# --input_xml=INPUT_XML
# ... | mlwbarlow/scripts-as-required | python/TypeSubjectFromRIFCS.py | Python | gpl-2.0 | 1,871 |
#
# QAPI types generator
#
# Copyright IBM, Corp. 2011
#
# Authors:
# Anthony Liguori <aliguori@us.ibm.com>
#
# This work is licensed under the terms of the GNU GPLv2.
# See the COPYING.LIB file in the top-level directory.
from ordereddict import OrderedDict
from qapi import *
import sys
import os
import getopt
impor... | huikang/vCSIMx86_qemu | scripts/qapi-types.py | Python | gpl-2.0 | 6,861 |
# -*- encoding: utf-8 -*-
import time
from autosklearn.metalearning.optimizers.metalearn_optimizer.metalearner \
import MetaLearningOptimizer
from autosklearn.constants \
import MULTILABEL_CLASSIFICATION, MULTICLASS_CLASSIFICATION, TASK_TYPES_TO_STRING
def suggest_via_metalearning(
meta_base, datase... | automl/auto-sklearn | autosklearn/metalearning/mismbo.py | Python | bsd-3-clause | 997 |
# -*- coding: utf-8 -*-
"""
@author: Fabio Erculiani <lxnay@sabayon.org>
@contact: lxnay@sabayon.org
@copyright: Fabio Erculiani
@license: GPL-2
B{Entropy Package Manager Client Interface}.
"""
from entropy.client.interfaces.client import Client
| mudler/entropy | lib/entropy/client/interfaces/__init__.py | Python | gpl-2.0 | 269 |
"""
Unit tests for the DirectoryAuthority of stem.descriptor.networkstatus.
"""
import unittest
import test.require
from stem.descriptor.networkstatus import (
DirectoryAuthority,
KeyCertificate,
)
DIR_SOURCE_LINE = 'turtles 27B6B5996C426270A5C95488AA5BCEB6BCC86956 no.place.com 76.73.17.194 9030 9090'
class T... | patrickod/stem | test/unit/descriptor/networkstatus/directory_authority.py | Python | lgpl-3.0 | 9,534 |
# Initial code in JAVA has copyright © 2002–2015, Robert Sedgewick and Kevin Wayne.
# A symbol table implemented using a left-leaning red-black BST.
# This is the 2-3 version.
RED = True
BLACK = False
class Node(object):
key = None
value = None # associated data
left = None
right = None
color = ... | napplebee/EPI | rs/rbt.py | Python | mit | 21,357 |
# Copyright (c) 2010-2015 Martin Natano <natano@natano.net>
# 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 ... | natano/presentation | pysrc/DouF00/DisplayChoice.py | Python | bsd-3-clause | 3,117 |
from doit.action import CmdAction
import os
SCRIPTS = ['thesis']
EXT = 'pdf' # extension for figure export : png or pdf !
DPI = 300 # resolution for bitmap figures
SVG_FILES =[]
for f in os.listdir('./figures/'):
if f.endswith('.svg'):
SVG_FILES.append('figures/'+f)
FILES = [f.replace('.svg', '.'+EXT) fo... | yzerlaut/phd_thesis | dodo.py | Python | gpl-2.0 | 3,637 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# t... | jakubbrindza/gtg | GTG/gtk/browser/treeview_factory.py | Python | gpl-3.0 | 16,845 |
import sys
sys.path.insert(1, "../../")
import h2o, tests
def insert_missing():
air_path = [h2o.locate("smalldata/airlines/allyears2k_headers.zip")]
data = h2o.import_file(path=air_path)
hour1 = data["CRSArrTime"] / 100
mins1 = data["CRSArrTime"] % 100
arrTime = hour1*60 + mins1
hour2 = data["CRSDepTime... | printedheart/h2o-3 | h2o-py/tests/testdir_munging/pyunit_ifelse.py | Python | apache-2.0 | 569 |
# urllib3/request.py
# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencod... | kristerhedfors/xnet | xnet/packages/urllib3/request.py | Python | bsd-3-clause | 5,873 |
# -*- coding: utf-8 -*-
from django.conf.urls import url, include
from djanban.apps.multiboards.views import multiboards
urlpatterns = [
url(r'^$', multiboards.view_list, name="list"),
url(r'^$', multiboards.view_list, name="view_list"),
url(r'^view_archived$', multiboards.view_archived_list, name="list_... | diegojromerolopez/djanban | src/djanban/apps/multiboards/urls.py | Python | mit | 1,065 |
# -*- coding: utf-8 -*-
import json
import redis
import random
import string
import pymysql
from datetime import datetime
from gevent.pywsgi import WSGIServer
# from gevent import monkey
#
# monkey.patch_all()
from flask import Flask
from flask import jsonify
from flask import request
app = Flask(__name__)
app.de... | stamaimer/Hackthon | app.py | Python | gpl-2.0 | 10,516 |
from unittest import mock
import pytest
from aiohttp import web
from bottery.conf import Settings
from bottery.message import Message
from bottery.messenger import engine as Engine
@pytest.fixture
def engine():
server = web.Application()
return Engine(token='token', session='session', server=server,
... | rougeth/bottery | tests/platform/messenger/test_engine.py | Python | mit | 2,832 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 IBM Corp.
#
# 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
#
# ... | DirectXMan12/nova-hacking | nova/virt/powervm/common.py | Python | apache-2.0 | 9,118 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import jimit as ji
from IPy import IP, intToIp
from jimvc.models import FilterFieldType
from jimvc.models import ORM
__author__ = 'James Iter'
__date__ = '2018-12-15'
__contact__ = 'james.iter.cn@gmail.com'
__copyright__ = '(c) 2018 by James Iter.'
class ... | jamesiter/JimV-C | jimvc/models/ip_pool.py | Python | gpl-3.0 | 3,690 |
import os
import re
from MenuList import MenuList
from Components.Harddisk import harddiskmanager
from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename, fileExists
from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, \
eServiceReference, eServiceCenter, gFont
from Tools.LoadPixmap import LoadPixm... | isslayne/enigma2 | lib/python/Components/FileList.py | Python | gpl-2.0 | 15,167 |
import os
import copy
import dockbot
local_cfg_hdr = '''\
# -*- python -*-
# Autogenerated file
c['projectName'] = '%(project)s'
c['projectURL'] = '%(url)s'
c['debugPassword'] = '%(passwd)s'
'''
class Master(dockbot.Container):
def kind(self): return 'Master'
def gen_config(self):
f = None
... | CauldronDevelopmentLLC/dockbot | dockbot/Master.py | Python | gpl-3.0 | 4,074 |
inf=open('chains/MayCalchains.txt','r')
lines=inf.readlines()
nl=[]
for i in range(0,len(lines)):
if lines[i]=='\n':
nl.append(i)
blocks=[]
for i in range(0,len(nl)-1):
blocks.append(lines[nl[i]+1:nl[i+1]])
ACB=[]
for i in blocks:
if any('I' in j for j in i) and not any('F' in j for j in i):
... | ntbrewer/pixie_ldf_she | scripts/chainsParse6.py | Python | gpl-3.0 | 1,588 |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import, generators
from .compat import *
from .qtpy import QtCore, QtGui, QtWidgets
import math
import time
import sys
MAX_AUTOSIZE_MS = 150 # Milliseconds given (at most) to perform column auto-sizing
MIN_TRUNC_CHARS = 8 ... | wavexx/gtabview | gtabview/viewer.py | Python | mit | 20,298 |
from .Condition import Condition
from .Configuration import Configuration
from .Classifier import Classifier
from .ClassifiersList import ClassifiersList
from .XCS import XCS
from .GeneticAlgorithm import *
| ParrotPrediction/pyalcs | lcs/agents/xcs/__init__.py | Python | mit | 207 |
'''tests for nilsimsa transform
.. This software is released under an MIT/X11 open source license.
Copyright 2012-2015 Diffeo, Inc.
'''
from __future__ import absolute_import
import os
from nilsimsa import Nilsimsa
from streamcorpus import make_stream_item, ContentItem, Chunk
from streamcorpus_pipeline._clean_htm... | trec-kba/streamcorpus-pipeline | streamcorpus_pipeline/tests/test_nilsimsa.py | Python | mit | 1,079 |
#!/usr/bin/env python
# required utilities: imagemagick, xdotool, xbacklight
import time
import os
import math
try: import cpickle as pickle
except: import pickle
import opts
import models
from run_cmd import run_cmd
def set_brightness(new_level, time):
if opts.XRANDR_OUTPUT:
import xrandr
xrandr.set_brig... | autolume/autolux | autolux/autolux.py | Python | mit | 5,227 |
from django.utils.translation import ugettext_lazy as _
import horizon
from caravan.dashboards.results import dashboard
class Browser(horizon.Panel):
name = _("Browser")
slug = "browser"
dashboard.Results.register(Browser)
| PaulMcMillan/shmoocon_2014_talk | caravan/caravan/dashboards/results/browser/panel.py | Python | bsd-2-clause | 237 |
# Simple class that processes HTML files created by HipSTR
# and removes any alignment positions in which all bases correspond
# to an insertion
# Useful when filtering HTML files for a subset of samples and insertions
# are no longer present
import collections
import sys
from HTMLParser import HTMLParser
from svglib.... | tyjo/HipSTR | scripts/html_alns_to_pdf.py | Python | gpl-2.0 | 6,904 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014, 2015, 2016 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
... | mdhaman/superdesk-core | apps/validate/tests.py | Python | agpl-3.0 | 16,119 |
# pylint: disable=missing-docstring, invalid-name, too-few-public-methods, no-self-use
def test_regression_737():
import xml # [unused-variable]
def test_regression_923():
import unittest.case # [unused-variable]
import xml as sql # [unused-variable]
def test_unused_with_prepended_underscore():
_foo... | rogalski/pylint | pylint/test/functional/unused_variable.py | Python | gpl-2.0 | 762 |
# Copyright 2015, Province of British Columbia
# License: https://github.com/bcgov/ckanext-bcgov/blob/master/license
import re
import os
import csv
import sys
import json
import urllib2
import urllib
import pprint
from base import (
create_org,
site_url,
... | gjlawran/ckanext-bcgov | ckanext/bcgov/scripts/create_orgs.py | Python | agpl-3.0 | 7,074 |
'''
None (non-VCS) module Status class submodule
'''
class Status(object):
'''Performs status checks on the svn repository'''
def __init__(self, qatracker, eadded):
'''Class init
@param qatracker: QATracker class instance
@param eadded: list
'''
self.qatracker = qatracker
self.eadded = eadded
def ch... | dol-sen/portage | repoman/pym/repoman/modules/vcs/None/status.py | Python | gpl-2.0 | 1,134 |
from biicode.server.api.jwt_manager import JWTManager
from biicode.server.conf import BII_AUTH_TOKEN_EXPIRE_MINUTES,\
BII_JWT_SECRET_KEY
from biicode.common.utils.bii_logging import logger
import jwt
class JWTCredentialsManagerFactory(object):
"""Handles creation of JWTAccountsManager providing the right auth... | bowlofstew/bii-server | api/jwt_credentials_manager.py | Python | mit | 1,904 |
import os
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = [
# ("Kumar Anirudha", "anirudhastark@yahoo.com"),
]
MANAGERS = ADMINS
DATABASES = {
"default": {
"ENG... | codersjgec/coders.jolites.in | coders/coders/settings.py | Python | gpl-2.0 | 5,193 |
from __future__ import absolute_import
import six
import time
from django.http import HttpResponseRedirect, HttpResponse
from django.utils.translation import ugettext as _
from sentry import options
from sentry.web.frontend.base import BaseView
from sentry.web.forms.accounts import TwoFactorForm
from sentry.web.help... | JamesMura/sentry | src/sentry/web/frontend/twofactor.py | Python | bsd-3-clause | 5,993 |
import numpy as np
import random as rand
import sys, os
import copy
import pickle
#from mpi4py import MPI
from pymatgen import Lattice, Structure, Element, PeriodicSite
from pymatgen.io.vasp import Poscar, VaspInput
from pymatgen.analysis.structure_matcher import StructureMatcher, FrameworkComparator
from pymatgen.app... | skasamatsu/py_mc | examples/HAp-bulk/model_setup.py | Python | gpl-3.0 | 8,809 |
#!/usr/bin/env python2.7
#coding=utf-8
'''
@author: Nathan Schneider (nschneid@inf.ed.ac.uk)
@since: 2015-05-06
'''
from __future__ import print_function
import sys, re, fileinput, codecs
from collections import Counter, defaultdict
from amr import AMR, AMRSyntaxError, AMRError, Concept, AMRConstant
c = defaultdict(... | mdtux89/amr-eager | src/list-frames-roles.py | Python | bsd-2-clause | 806 |
# encoding: utf-8
import sys
from query_exchange import asrun, asquote
from workflow import Workflow3, ICON_INFO
from today import get_cache_key
import GoogleInterface
from GoogleInterface import GoogleInterface, NoCalendarException
def query_google_calendar(wf, start_search, end_search, date_offset):
"""Queries... | jeeftor/alfredToday | src/query_google.py | Python | mit | 4,344 |
#!/usr/bin/env python
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
module_path = os.path.join(os.path.dirname(__file__), 'railroad', '__init__.py')
versi... | s-m-i-t-a/railroad | setup.py | Python | mit | 1,690 |
#
#
#
import requests
from bs4 import BeautifulSoup
import re
import os
def all_links(URL,abs=False,session=None):
'''Generator function for all links in a page.
ARGS:
URL -> url of the page
abs -> (True) returns actual 'href's of each <a> tag (False) process each 'href' to generate the full li... | RRostami/Spiderpy | spiderpy/core.py | Python | gpl-3.0 | 2,986 |
# coding=utf-8
from unittest import TestCase
import numpy as np
from mdlmc.misc.tools import chunk, chunk_trajectory, online_variance_generator
def test_chunk():
simple_range = range(100)
range_chunk = chunk(simple_range, 3)
for start, stop, chk in range_chunk:
assert simple_range[start: stop] ... | gkabbe/cMDLMC | tests/misc/test_tools.py | Python | gpl-3.0 | 1,116 |
# import libraries
import math
import random
import pygame
from pygame.locals import *
pygame.init()
pygame.mixer.init()
width, height = 800, 600
screen = pygame.display.set_mode((width, height))
keys = [False, False, False, False]
player = [100, 520]
invaders = []
bullets = []
bombs = []
rockets = []
rocketpieces =... | vlna/another-py-invaders | another-py-invaders.py | Python | gpl-3.0 | 3,451 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.