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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
MoEDAL and CERN@school - Plotting NBL information.
See the README.md file and the GitHub wiki for more information.
http://cernatschool.web.cern.ch
"""
# Import the code needed to manage files.
import os, glob
#...for parsing the arguments.
import argparse
#.... | twhyntie/tasl-data-management | plot_nbl.py | Python | mit | 2,465 |
# Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 OpenStack Foundation
# Copyright 2012 IBM Corp.
# 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
#
# ... | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/novaclient/tests/unit/v2/test_shell.py | Python | mit | 110,887 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
url(r'^(?P<pk>\d+)/results/$', views.ResultsView.as_view(), name='results'),
url(r'^(?P<poll_id>\d+)/vote/$', vi... | fedenko/django-gulp-example | polls/urls.py | Python | bsd-3-clause | 346 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | lukas-krecan/tensorflow | tensorflow/python/kernel_tests/tensor_array_ops_test.py | Python | apache-2.0 | 22,384 |
import pytest
import numpy as np
from keras.utils.test_utils import get_test_data
from keras.utils import np_utils
from keras import backend as K
from keras.models import Sequential
from keras.layers.core import Dense, Activation
from keras.wrappers.scikit_learn import KerasClassifier, KerasRegressor
input_dim = 5
h... | kemaswill/keras | tests/keras/wrappers/test_scikit_learn.py | Python | mit | 4,769 |
'''
objtoolz.decorators.kwargsdeco
`````````````````````````````````
Decorators that allow provide keyword arguments to decorators when wrapping
'''
from toolz import curry
from ..descriptors.undescriptor import Undescriptor
from ..compat import update_wrapper
__all__ = ('method_kwargs_decorator',)
def ... | justanr/objtoolz | objtoolz/decorators/kwargsdeco.py | Python | mit | 1,052 |
import ast
import getpass
import json
import minepy
import sys
import yggdrasil
def handler(self, packet_id, data):
pass
with open("auths.json") as f:
auths = ast.literal_eval(f.read())
c = 0
for auth in auths:
print(str(c) + ": " + auth[2]["name"] + " (" + auth[2]["id"][0:8] + ")")
c += 1
print(str(c) + ": Sign... | luker2009/Minepy | example.py | Python | mit | 1,902 |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | nparley/mylatitude | lib/endpoints_management/gen/__init__.py | Python | mit | 638 |
# Copyright 2014 Diamond Light Source Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | mjn19172/Savu | savu/plugins/manchester_recon.py | Python | apache-2.0 | 7,507 |
# encoding: 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 'Feature.implemented_on'
db.add_column('feature_vote_feature', 'implemented_on', self.gf('d... | mollyproject/mollyproject | molly/apps/feature_vote/migrations/0002_auto__add_field_feature_implemented_on.py | Python | apache-2.0 | 1,852 |
# Copyright (c) 2014 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | watonyweng/neutron | neutron/tests/functional/agent/test_l3_agent.py | Python | apache-2.0 | 61,386 |
import numpy
import six
import chainer
from chainer.backends import cuda
from chainer import function_node
from chainer.utils import type_check
class PadSequence(function_node.FunctionNode):
"""Padding arrays to create a matrix."""
def __init__(self, length, padding):
self.length = length
s... | aonotas/chainer | chainer/functions/array/pad_sequence.py | Python | mit | 3,289 |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | gotostack/swift | swift/container/updater.py | Python | apache-2.0 | 12,736 |
import os
# Application constants
APP_NAME = 'job_offers'
INSTALL_DIR = os.path.dirname(os.path.abspath(__file__))
LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
LOG_NAME = os.path.join(INSTALL_DIR, 'job_offers.log')
# Testing fixtures
JOB_OFFER_FIXTURES = os.path.join(INSTALL_DIR, "fixtures/job_... | jvazquez/organization | organization/job_offers/constants.py | Python | unlicense | 334 |
#!/usr/bin/env python
# 0. call this script form Programs/TestBed folder
# 1. generate json with all files
# 2. build local_meta.db
import os
import sys
sys.path.append(os.path.abspath("../../Programs/SdlcBuilder"))
from pack_datum import generate_meta # noqa
# collect all files
all_files = []
input_data_dir = 'Da... | dava/dava.engine | Programs/TestBed/Scripts/build_local_meta.py | Python | bsd-3-clause | 1,278 |
from django.core.management.base import BaseCommand
from metashare.repository.models import resourceInfoType_model
from optparse import make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('-x', '--extended', action='store_true', dest='extended',
... | MiltosD/CEF-ELRC | metashare/sync/management/commands/get_resource_list.py | Python | bsd-3-clause | 851 |
__author__ = 'djw'
| sourlows/rating-cruncher | src/lib/flask_httpauth/__init__.py | Python | apache-2.0 | 19 |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | gkc1000/pyscf | pyscf/cc/uccsd_lambda.py | Python | apache-2.0 | 23,438 |
#!/usr/bin/python
# -*- coding: utf-8; -*-
#
# 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
#
# Unles... | locaweb/leela-client | src/python/leela/client/sensors/linux/network.py | Python | apache-2.0 | 1,492 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, copy, modify, merge, publish... | rwl/PyCIM | CIM15/IEC61970/Wires/PhaseTapChanger.py | Python | mit | 3,526 |
#!/usr/bin/env python2
from CSVToCFG import CSV2CFG
from libjoern.FileIterators import SourceFileASTIterator
def extractCSVCFGs(projectRoot):
codeTreeWalker = SourceFileASTIterator(projectRoot)
for metaDataFile in codeTreeWalker:
print metaDataFile
processor = CSV2CFG()
process... | fabsx00/chucky-old | sourceutils/pythonCFGs/create.py | Python | gpl-3.0 | 566 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
#local imports
from modules.page_mount import Principal
page = Principal()
page.mount(
page='strains.quality.edit',
category='external',
js=('ext.jquery', 'ext.json', 'loc','form.strains.quality','ext.tinymce', 'tinymce.init', 'form... | cria/microSICol | py/strains.quality.edit.py | Python | gpl-2.0 | 490 |
# -*- coding: utf-8 -*-
#########################################################################
## This is a samples controller
## - index is the default action of any application
## - user is required for authentication and authorization
## - download is for downloading files uploaded in the db (does streaming)
##... | johntynan/publicradioroadtrip | controllers/default.py | Python | gpl-3.0 | 35,981 |
# A normalizer is used to parse text from vulnerability feeds into something useful
import os
import re
class Normalizer():
def __init__(self):
# Stores the entries from the source
self.entries = []
common_words_file = open(os.path.dirname(__file__) + "/dictionaries/common-words").read()
... | bocajspear1/vulnfeed | vulnfeed/util/normalizer.py | Python | gpl-3.0 | 1,964 |
# PyUI
# Copyright (C) 2001-2002 Sean C. Riley
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but... | burito/PyUI | pyui/dialogs.py | Python | lgpl-2.1 | 22,471 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Skript zum generieren von DeepZoomImages
# Stand: 19.09.2017
###############################################################################
# Importieren allgemeiner Bibliotheken
import argparse, errno, json, logging, os, shutil, sys
from time import time
from multipro... | dla-marbach/dla_kachelgenerator | kachelgenerator.py | Python | apache-2.0 | 9,544 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, copy, modify, merge, publish,
... | azverkan/scons | test/runtest/src.py | Python | mit | 2,185 |
import csv
import sys
from datetime import date
from collections import defaultdict
from django.utils.six.moves import input
from django.core.management.base import BaseCommand, CommandError
from elasticsearch_dsl import Q
from catalog.elastic_models import Declaration
class Command(BaseCommand):
args = '<file... | dchaplinsky/declarations.com.ua | declarations_site/catalog/management/commands/loadvulyk.py | Python | mit | 12,260 |
"""Module functions for converting object to JSON
Todo:
Use constants
"""
from hashlib import md5
import json
from LmCommon.common.lmconstants import LMFormat
from LmServer.base.atom import Atom
from LmServer.base.layer import Raster, Vector
from LmServer.base.utilities import format_time_human
from LmServer.comm... | lifemapper/core | LmWebServer/formatters/json_formatter.py | Python | gpl-3.0 | 17,952 |
'''
Created on Jul 25, 2016
@author: Thomas Adriaan Hellinger
'''
from abc import ABCMeta, abstractmethod
from math import sqrt, pow
class Voter(object):
"""Basic entity in simulation, represents an individual.
Args:
metric (:obj:`VotingMetric`): Determines the voter's relative opinion
... | brotherjack/RoodeStem | roodestem/simulations/voter.py | Python | mit | 11,912 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softwa... | bl4ckdu5t/registron | tests/multipackage/test_multipackage5.py | Python | mit | 533 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""Tests for ``llnl/util/argparsewriter.py``
These tests are fairly minimal, and ArgparseWriter is more extensively
teste... | LLNL/spack | lib/spack/spack/test/llnl/util/argparsewriter.py | Python | lgpl-2.1 | 896 |
#-*- coding: utf-8 -*-
import pygame
from projectileDroit import ProjectileDroit
#projectile allant en ligne droite
class ProjectileDroitRouge(ProjectileDroit):
image = pygame.Surface((10, 10))
pygame.draw.circle(image, (255,0,0), (5, 5), 5)
| PolySlug/polyslug | projectiles/projectileDroitRouge.py | Python | mit | 254 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apach... | cloudbau/glance | glance/db/sqlalchemy/migrate_repo/versions/012_id_to_uuid.py | Python | apache-2.0 | 12,493 |
# Copyright (c) 2006-2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# Copyright (c) 2010, Eucalyptus Systems, Inc.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation file... | donny/mako-mori | external/boto/s3/connection.py | Python | mit | 21,291 |
'''
Application
===========
The :class:`App` class is the base for creating Kivy applications.
Think of it as your main entry point into the Kivy run loop. In most
cases, you subclass this class and make your own app. You create an
instance of your specific app class and then, when you are ready to
start the applicati... | darkopevec/kivy | kivy/app.py | Python | mit | 36,425 |
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.views import generic
from .models import Question, Choice
class IndexView(generic.ListView):
template_name = 'polls/index.html'
context_object_name = 'la... | philmui/simplepoll | src/polls/views.py | Python | mit | 1,971 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 Google, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ... | gorakhargosh/pyoauth | pyoauth/oauth1/client/twitter.py | Python | apache-2.0 | 1,860 |
from decimal import Decimal
from colorsys import hls_to_rgb, rgb_to_hls
from math import ceil
from .errors import IncompatibleUnits
from .globals import NAMED_COLORS
class RuleBlock():
'''
Represents a series of CSS selectors and any children objects, including
nested RuleBlocks and CSS property/value de... | divmain/lightyear | lightyear/ly_types.py | Python | mit | 12,433 |
# Copyright (C) 2008 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at you... | jbouse-debian/paramiko | tests/test_auth.py | Python | lgpl-2.1 | 9,191 |
#!/usr/bin/env python2.7
#
# 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 "... | chrismattmann/tika-img-similarity | affinity_propagation.py | Python | apache-2.0 | 8,355 |
# Copyright (c) 2007-2019 UShareSoft, 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 requi... | emuus/hammr | hammr/commands/os/os.py | Python | apache-2.0 | 5,937 |
# Copyright (c) 2012 Intel
# Copyright (c) 2012 OpenStack, LLC.
# Copyright (c) 2015 EMC 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
#
# ... | scality/manila | manila/scheduler/filters/capacity.py | Python | apache-2.0 | 5,377 |
# -*- coding: utf-8 -*-
"""
This file is covered by the LICENSING file in the root of this project.
"""
import logging
from os.path import realpath, dirname, join
from logging import config, DEBUG, INFO
__all__ = ["log"]
class Log(object):
"""Wrapper of Python logging module for easier usage
:Example:
... | juniwang/open-hackathon | open-hackathon-client/src/client/log.py | Python | mit | 2,041 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
setup(name='python-mode.el',
version='6.0.1',
description='Major mode for editing Python programs',
maintainer='Andreas Roehler',
maintainer_email='andreas.roehler@online.de',
url='https://launchpad.net/pytho... | zzhang1987/emacs.d | python-mode/setup.py | Python | gpl-3.0 | 478 |
'''
Created on 2011-07-14
@author: George
'''
IPINFODB_APIKEY = ''
COUNTRY_CODES = ('US', 'CA')
SELECT_CITY_URL = 'go_to_select_city'
CITY_SWITCH_DEFAULT_BACKEND_URL_AUTO_SETUP = True
SELECT_CITY_CACHE_TIMEOUT = 2592000
MIN_POPULATION_FOR_COUNTRY = {
'CN': 250000,
'CA': 12000,
'US': ... | georgema1982/django-city-switch | city_switch/backends/default/settings.py | Python | bsd-3-clause | 330 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | skuda/client-python | kubernetes/test/test_core_v1_api.py | Python | apache-2.0 | 36,562 |
# Copyright (C) 2016-2019 Dmitry Marakasov <amdmi3@amdmi3.ru>
#
# This file is part of repology
#
# repology 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 optio... | repology/repology | repology/parsers/parsers/cpan.py | Python | gpl-3.0 | 4,152 |
from typing import List, Union
from logging import _nameToLevel
class LogDedicatedLevelFilter(object):
def __init__(self, levels: List[Union[int, str]]):
self.__levels = []
for level in levels:
if isinstance(level, str):
val = _nameToLevel.get(level)
if ... | SpeedProg/eve-inc-waitlist | waitlist/utility/logging/filter.py | Python | mit | 469 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from x1tool import *
class X1ToolUnixTimestamp(X1Tool):
''' Front end application
ID: 7b738768ecb599379a095e96f270f7a826e8f81b95b201e6b8654e5f829c648b
'''
DEFAULT_METADATA = {'name': "Unix Timestamp", 'author': "Admin", 'comments': "Enjoy it.", 'templa... | xinyangni/X1Tool | src/server/apps/x1tool_unix_timestamp.py | Python | gpl-2.0 | 675 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | graph_embedding/monet/polblogs_experiment.py | Python | apache-2.0 | 24,704 |
from collections import UserList
from copy import copy
from npc.util import print_err
class Tag(UserList):
"""
Defines a mult-value tag object
"""
def __init__(self, name: str, *args, required: bool=False, hidden: bool=False, limit: int=-1):
"""
Create a new Tag object
Args:
... | aurule/npc | npc/character/tags/tag.py | Python | mit | 9,073 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name, protected-access, unused-argument
import os
import pytest
from debot.app import create_app
@pytest.fixture
def slack_token():
return "slack_token"
@pytest.fixture
def app(request, slack_token):
os.environ["DEBOT_SLACK_TOKE... | tryagainconcepts/debot | tests/conftest.py | Python | mit | 893 |
#!/usr/bin/env python3
"""
Remote python server.
Execute Python commands remotely and send output back.
WARNING: This version has a gaping security hole -- it accepts requests
from any host on the Internet!
"""
import sys
from socket import socket, AF_INET, SOCK_STREAM
import io
import traceback
PORT... | Orav/kbengine | kbe/src/lib/python/Tools/demo/rpythond.py | Python | lgpl-3.0 | 1,344 |
"""
Support for myStrom switches.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/switch.mystrom/
"""
import logging
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
from homeassistant.const import (C... | leoc/home-assistant | homeassistant/components/switch/mystrom.py | Python | mit | 2,908 |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2014,2015,2016 Contributor
#
# 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... | guillaume-philippon/aquilon | tests/broker/test_update_campus.py | Python | apache-2.0 | 2,609 |
import os
import re
import urllib
import datetime
import supremecourt
import utils
class LokSabhaUrl:
def __init__(self):
self.hostname = '164.100.47.132'
baseurl = 'http://164.100.47.132/LssNew/psearch/'
date2num = {\
(datetime.date(1998, 03, 23), \
datetime.... | sushant354/judis-re | loksabha.py | Python | gpl-3.0 | 8,596 |
from plenum.test.helper import sdk_send_random_and_check, sdk_send_random_requests, \
sdk_eval_timeout, sdk_get_and_check_replies
from plenum.test.node_request.helper import sdk_ensure_pool_functional
from plenum.test.node_catchup.helper import ensure_all_nodes_have_same_data
from plenum.test.pool_transactions.help... | evernym/zeno | plenum/test/node_request/test_different_ledger_request_interleave.py | Python | apache-2.0 | 4,934 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# *************************************... | chujieyang/ice | python/test/Ice/facets/Server.py | Python | gpl-2.0 | 1,324 |
import praw
import sys
r = praw.Reddit("sub_search.py: search a subreddit for threads that"
"mention any one of the words given by"
"the user")
def get_subname(s):
if s[:4] != "sub=":
print "error: invalid syntax"
sys.exit()
retu... | jsardo/subsearch | sub_search.py | Python | mit | 2,230 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | xhorn/xchorizon | horizon/site_urls.py | Python | apache-2.0 | 1,402 |
from nose_parameterized import parameterized
from instal.firstprinciples.normparser.NormParserTestEngine import NormParserTestEngine, NORMPARSER_FALSETESTS, \
NORMPARSER_GETTRUETESTS
NORMPARSER_INITIATES_TRUETESTS = [
("institutional", "inertial"),
("institutional", "permission"),
("institutional", "... | cblop/tropic | instal-linux/instal/firstprinciples/normparser/TestNormParserInitiates.py | Python | epl-1.0 | 948 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import datetime
from django.core.urlresolvers import reverse
from sentry.models import Deploy, Environment, Release, ReleaseProjectEnvironment
from sentry.testutils import APITestCase
class ReleaseDeploysListTest(APITestCase):
def test_simple(self... | looker/sentry | tests/sentry/api/endpoints/test_release_deploys.py | Python | bsd-3-clause | 3,543 |
import sys
import argparse
import sqlite3
import gzip
from progressbar import ProgressBar, Counter, Timer
from lxml import etree
parser = argparse.ArgumentParser(prog='apntool', description="""Process Android's apn xml files and drop them into an easily
quer... | Securecom/Securecom-Messaging | apntool/apntool.py | Python | gpl-3.0 | 3,592 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is an Astropy affiliated package.
"""
# Affiliated packages may add whatever they like to this file, but
# should keep this content at the top.
# ----------------------------------------------------------------------------
from ._astropy_init im... | Guokr1991/POCS | panoptes/__init__.py | Python | mit | 570 |
import re
import os
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from scrapy import log
import csv, codecs, cStringIO
from productloader import l... | 0--key/lib | portfolio/Python/scrapy/americanrv/tweetys_americanrv.py | Python | apache-2.0 | 5,619 |
from enum import Enum
# Takes string names or int indices of a type and an attribute.
# Returns None if that type does not have that attribute.
# Else returns the default value for that attribute.
def getDefault(typeName, attrName):
# Determine index of type
if type(typeName) == int:
typeIndex = typeN... | GooeyComps/gooey-dist | gooeydist/interpreter/matrix.py | Python | mit | 2,797 |
# -*- coding: utf-8 -*-
# Copyright 2010-2021, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this... | fcitx/mozc | src/build_tools/code_generator_util.py | Python | bsd-3-clause | 6,296 |
__author__ = 'Jesus Maria'
import matplotlib.pyplot as plotter
from src import wav_manager
def plot_amplitude(file_path):
"""
Inputs:
file_path (string) = path for the file we want to plot. It has to be a WAV file with just one channel (mono)
Output:
The function should display a graphi... | jmescuderojustel/signal-processing | src/signal_plotter.py | Python | mit | 640 |
import oauth.oauth as oauth
import httplib
import json
import sys
class BaseClient:
def __init__(self, baseURL, key, secret):
self.url = baseURL
self.connection = httplib.HTTPConnection(baseURL)
self.consumer = oauth.OAuthConsumer(key, secret)
def _execute(self, httpmethod, path, body):
request = oauth.... | stackmob/stackmob-python-examples | stackmob/client.py | Python | apache-2.0 | 1,397 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from xml.dom.minidom... | cevaris/pants | src/python/pants/util/xml_parser.py | Python | apache-2.0 | 2,671 |
def draw_smpte_rects(draw, x, y, width, height, colors):
for i in range(len(colors)):
draw.rectangle([(x + (width * i), y), (x + (width * (i + 1)), y + height)], fill=colors[i], outline=colors[i])
def draw_smpte_pattern(draw):
fb_width, fb_height = draw.im.size
# top colors: grey/silver, yellow, c... | notro/pydrm | utils/utils.py | Python | mit | 1,704 |
from haystack.signals import RealtimeSignalProcessor
class RelatedRealtimeSignalProcessor(RealtimeSignalProcessor):
def handle_save(self, sender, instance, **kwargs):
if hasattr(instance, 'reindex_related'):
for related in instance.reindex_related():
self.handle_save(related.__... | mayapurmedia/tovp | tovp/search/signals.py | Python | mit | 793 |
# Copyright 2010 The Closure Library 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 a... | BOKteam/common | closure/google-closure-builder_win_cn/builder/jscompiler.py | Python | mit | 2,353 |
#!/usr/bin/env python3
import idmaker
import utils
from tkinter import *
from PIL import Image, ImageTk
top = Tk()
top.wm_title("Voice Research Laboratory")
top.iconbitmap('icons/favicon.ico')
top.state('zoomed')
class MainWindow:
def __init__(self, top):
self.top = top
self.... | drf24/labutils | utils_gui.py | Python | gpl-3.0 | 7,383 |
"""Relay domains settings definition."""
from django import forms
from django.utils.translation import ugettext_lazy
from modoboa.lib.form_utils import SeparatorField
from modoboa.parameters import forms as param_forms
class AdminParametersForm(param_forms.AdminParametersForm):
"""Admin parameters definition.""... | carragom/modoboa | modoboa/relaydomains/app_settings.py | Python | isc | 699 |
# from txrdq.rdq import ResizableDispatchQueue
from twisted.internet.threads import deferToThread
from django.dispatch import receiver
from .signals import short_task, long_task
from .messaging import send_callback_json_message, send_json_message, send_errback_json_message
import inspect
def parse_signal_args(kwar... | anthonyalmarza/hendrix | hendrix/contrib/async/processing.py | Python | mit | 4,183 |
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP S.A. (<http://www.openerp.com>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it un... | ksrajkumar/openerp-6.1 | openerp/addons/fetchmail_crm_claim/__openerp__.py | Python | agpl-3.0 | 1,498 |
#!/usr/bin/env python3
"""
DNSSEC Single-Type Signing Scheme, RFC 6781
"""
from dnstest.utils import *
from dnstest.test import Test
t = Test()
knot = t.server("knot")
zones = t.zone_rnd(5, dnssec=False, records=10)
t.link(zones, knot)
t.start()
# one KSK
knot.gen_key(zones[0], ksk=True, zsk=True, alg="ECDSAP256SHA2... | CZ-NIC/knot | tests-extra/tests/dnssec/single_type_signing/test.py | Python | gpl-3.0 | 1,348 |
__all__ = [ 'Dockerfile','DockerEventListner','DockerCache','DockerStats','DockerRun' ]
| peitur/docker-util | lib/Docker/__init__.py | Python | apache-2.0 | 88 |
# -*- coding: utf-8 -*-
from Api import Poll, Talk, Channel
from Gen.ttypes import *
def def_callback(str):
print(str)
class LINE:
mid = None
authToken = None
cert = None
channel_access_token = None
token = None
obs_token = None
refresh_token = None
def __init__(self):
self.Talk = Talk()
... | merkremont/LineChivas | LineAlpha/LineApi.py | Python | gpl-3.0 | 9,334 |
import pytest
from spacy.lang.da.lex_attrs import like_num
def test_da_tokenizer_handles_long_text(da_tokenizer):
text = """Der var så dejligt ude på landet. Det var sommer, kornet stod gult, havren grøn,
høet var rejst i stakke nede i de grønne enge, og der gik storken på sine lange,
røde ben og snakkede ægyptis... | explosion/spaCy | spacy/tests/lang/da/test_text.py | Python | mit | 1,219 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | savi-dev/heat | heat/openstack/common/threadgroup.py | Python | apache-2.0 | 3,978 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pylab as plt
import numpy as np
import seaborn as sns; sns.set()
import keras
from keras.models import Sequential, Model
from keras.layers import Dense
from keras.optimizers import Adam
from keras.data... | wolfiex/DSMACC-testing | dsmacc/examples/autoencoderminst.py | Python | gpl-3.0 | 2,098 |
#!/usr/bin/python3
#
# This is a simple script that we use to check for files in git
# and not in the distribution. It was previously written in cinnamon
# and inlined in the Makefile.am, but 'git ls-files --exclude=<pattern>'
# was changed to no longer do anything useful, which made that
# too challenging to be worthw... | linuxmint/Cinnamon | tools/check-for-missing.py | Python | gpl-2.0 | 785 |
import itertools
import re
class Gene(object):
def __init__(self, mid, chr, sequence, count=0):
#self.__location = location
self.__mid = mid
self.__chr = chr
self.__sequence = sequence
self.sequence_binding=[0]*len(sequence)
###### COMMENT for DATA GROUP #######
... | tbphu/fachkurs_2016_project | oldcode/DataGroup/gene.py | Python | mit | 2,878 |
import json
import requests
""" OANDA API wrapper for OANDA's REST API """
""" EndpointsMixin provides a mixin for the API instance
Parameters that need to be embedded in the API url just need to be passed as a keyword argument.
E.g. oandapy_instance.get_instruments(instruments="EUR_USD")
"""
class EndpointsMixin(obj... | MonoCloud/oandapy | oandapy.py | Python | mit | 13,440 |
import logging
import sys
if __name__ != '__init__':
from . import config
else:
import config
def configure_logger(logger, level):
logger.setLevel(level)
f = logging.Formatter(fmt='%(asctime)s:%(levelname)s:%(message)s')
h = logging.StreamHandler(stream=sys.stderr)
h.setLevel(logging.WARNING)
h.setForma... | mdcarr941/mcmgr | __init__.py | Python | gpl-3.0 | 544 |
"""Redis database engine."""
import time
import logging
import datetime
import functools
try:
import redis
_has_redis = True
except ImportError:
redis = None
_has_redis = False
from pyzor.engines.common import *
VERSION = "1"
NAMESPACE = "pyzord.digest_v%s" % VERSION
def encode_date(date):
"""... | lazy404/pyzor | pyzor/engines/redis_.py | Python | gpl-2.0 | 6,235 |
#!/usr/bin/python
"""
Example to create a Mininet topology and connect it to the internet via NAT
through eth0 on the host.
Glen Gibb, February 2011
(slight modifications by BL, 5/13)
"""
from mininet.cli import CLI
from mininet.log import lg
from mininet.node import Node
from mininet.topolib import TreeNet
from mi... | lonelytb/A.C.T.Z | topo.py | Python | gpl-2.0 | 4,805 |
#!/usr/bin/env python
# This test harness structure was recommended in SO Answer
# http://stackoverflow.com/a/2992477. Very convenient for
# bootstrapping a test env for new cloners of the repo.
# Also requires relative imports in the individual test files.
import unittest
import tests.all_tests
testSuite = tests.all_... | conorsch/septapy | runtests.py | Python | mit | 401 |
"""Helpers for config validation using voluptuous."""
from collections import OrderedDict
from datetime import timedelta
import os
from urllib.parse import urlparse
from typing import Any, Union, TypeVar, Callable, Sequence, Dict
import voluptuous as vol
from homeassistant.loader import get_platform
from homeassista... | Smart-Torvy/torvy-home-assistant | homeassistant/helpers/config_validation.py | Python | mit | 14,118 |
#!/usr/bin/env python3
"""
Unpack a compressed archive in TAR.BZ2 format.
"""
import argparse
import glob
import os
import signal
import sys
import tarfile
from typing import List
class Options:
"""
Options class
"""
def __init__(self) -> None:
self._args: argparse.Namespace = None
s... | drtuxwang/system-config | bin/untbz.py | Python | gpl-2.0 | 4,333 |
#/bin/python
from time import time
class BotModule():
def __init__(self, module, hastimer=False):
self.hastimer=hastimer
if hastimer:
self.Timer = time() - 13
self.LastCall = 0
self.module = module
self._trigger = self.module.trigger
def trigger(self, ... | Gab0/dZAP | bot/Module.py | Python | gpl-3.0 | 667 |
# Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | google/makani | avionics/bootloader/generate_image.py | Python | apache-2.0 | 9,290 |
AUTHOR = 'Zachary Priddy. (me@zpriddy.com)'
TITLE = 'Nest Eco Window'
METADATA = {
'title': TITLE,
'author': AUTHOR,
'commands': [],
'interface': {
'devices': {
"windows": {
'context': 'Windows that will trigger this automation.',
'type': 'deviceList',
'filter': {... | Firefly-Automation/Firefly | Firefly/automation/nest_eco_window/metadata.py | Python | apache-2.0 | 862 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Wed Jul 13 22:51:09 2016
# by: The Resource Compiler for PyQt (Qt v4.8.5)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x02\xbd\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x... | khafen74/RasterProperties | resources.py | Python | gpl-3.0 | 4,047 |
import kivy
kivy.require('1.9.1')
from fieldlabel import FieldLabel
from kivy.app import Builder
from kivy.clock import Clock
from kivy.uix.screenmanager import Screen
from utils import kvFind, kvFindClass
from kivy.metrics import dp
from autosportlabs.racecapture.views.dashboard.widgets.roundgauge import RoundGauge
fr... | ryandoherty/RaceCapture_App | autosportlabs/racecapture/views/dashboard/gaugeview.py | Python | gpl-3.0 | 1,786 |
from xml.etree import ElementTree as ET
from nose2.tests._common import TestCase
from nose2.compat import unittest
from nose2 import events, loader, result, session, tools
from nose2.plugins import junitxml, logcapture
from nose2.plugins.loader import generators, parameters, testcases
import logging
import os
import s... | little-dude/nose2 | nose2/tests/unit/test_junitxml.py | Python | bsd-2-clause | 11,677 |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 6 16:41:40 2014
@author: xiao
"""
from k_order import *
#number of items to recommand
p=2
fadress = "/home/xiao/ProjetLibre/matrix/matrixInfo"
readDataFromFile(fadress)
getDu()
recommendationListe = zeros((m,p))
############################################
#### We ... | wangxiaox10/projetlibre | k-order-test.py | Python | bsd-3-clause | 2,086 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.