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 |
|---|---|---|---|---|---|
## \example buffers.py
# Showing how to read and write from buffers
import RMF
buf = RMF.BufferHandle()
fw = RMF.create_rmf_buffer(buf)
# do stuff
del fw
fr = RMF.open_rmf_buffer_read_only(buf)
# do more stuff
| shanot/imp | modules/rmf/dependency/RMF/examples/buffers.py | Python | gpl-3.0 | 215 |
#=======================================================================
# Author: Donovan Parks
#
# Unit tests for STAMP.
#
# Copyright 2011 Donovan Parks
#
# This file is part of STAMP.
#
# STAMP is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publishe... | dparks1134/STAMP | STAMP_test.py | Python | gpl-3.0 | 27,791 |
import h5py
import argparse
import numpy as np
def process_arguments():
parser = argparse.ArgumentParser(description="Heat Equation IC generator")
parser.add_argument('-x', '--cols', type=int, default=31, help='Simulation columns')
parser.add_argument('-y', '--rows', type=int, default=31, help='Simulation rows')... | csrhau/castle | testcases/input-gen/h5gen.py | Python | apache-2.0 | 1,940 |
import subprocess
import django
if django.VERSION[0:2] >= (1, 8):
from django.db.backends.base.client import BaseDatabaseClient
else:
from django.db.backends import BaseDatabaseClient
class CassandraDatabaseClient(BaseDatabaseClient):
executable_name = 'cqlsh'
def runshell(self):
settings_di... | paksu/django-cassandra-engine | django_cassandra_engine/base/client.py | Python | bsd-2-clause | 739 |
from __future__ import unicode_literals
import datetime
import pickle
from decimal import Decimal
from operator import attrgetter
from django.core.exceptions import FieldError
from django.contrib.contenttypes.models import ContentType
from django.db.models import Count, Max, Avg, Sum, StdDev, Variance, F, Q
from djan... | rogerhu/django | tests/aggregation_regress/tests.py | Python | bsd-3-clause | 47,311 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-03-23 18:33
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('d4s2_api', '0016_email_group_to_set'),
]
operations... | Duke-GCB/DukeDSHandoverService | d4s2_api/migrations/0017_auto_20180323_1833.py | Python | mit | 944 |
# 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-sql/azure/mgmt/sql/models/schema.py | Python | mit | 1,759 |
# -*- coding: utf-8 -*-
# Copyright (C) 2006-2008 Vodafone España, S.A.
# Copyright (C) 2008-2009 Warp Networks, S.L.
# Author: Pablo Martí
#
# 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; e... | andrewbird/wader | setup.py | Python | gpl-2.0 | 4,510 |
from django.http import HttpResponse, Http404
from django.utils.http import urlquote
import os
import re
import mimetypes
from . settings import LASANA_USE_X_SENDFILE, LASANA_NGINX_ACCEL_REDIRECT_BASE_URL
#For no-XSendfile approach
from django.core.servers.basehttp import FileWrapper
CONTENT_RANGE_REGEXP = re.compil... | ntrrgc/lasana | sendfile.py | Python | mit | 2,641 |
# -*- coding: utf-8 -*-
"""
FlyFi - Floppy-Fidelity
@author: Ricardo (XeN) Band <xen@c-base.org>,
Stephan (coon) Thiele <coon@c-base.org>
This file is part of FlyFi.
FlyFi is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by... | coon42/FlyFi | SettingsWindow.py | Python | gpl-3.0 | 13,127 |
import os
from unittest import TestCase
from unittest.mock import patch
from bs4 import BeautifulSoup
from RatS.criticker.criticker_ratings_inserter import CritickerRatingsInserter
TESTDATA_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, "assets")
)
class CritickerRatingsI... | StegSchreck/RatS | tests/unit/criticker/test_criticker_ratings_inserter.py | Python | agpl-3.0 | 9,321 |
#!/usr/bin/env python
from sospex import __main__
__main__()
| LunaAstro/rochelobe | rochelobe.py | Python | gpl-3.0 | 61 |
with open('day8.txt') as f:
print(sum([len(line.strip()) - len(eval(line)) for line in f])) | BethyDiakabananas/Advent-of-Code | Day 8/day8_part1.py | Python | mit | 92 |
import cvxpy
GAMMA = 100
solver_map = {
'cvxopt': cvxpy.CVXOPT,
'gurobi': cvxpy.GUROBI
}
'''
- *r_list* is a list of tuples (weight, body, head)
- *body* and *head* are lists of tuples (is_constant, value/id, is_negated)
- *is_constant* is a flag, True if the truth value is known, False otherwise
- *value... | gfarnadi/FairPSL | engines/fpsl_cvxpy.py | Python | mit | 5,365 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy import config as _config
class Conf(_config.ConfigNamespace):
"""
Configuration parameters for `astropy.table`.
"""
auto_colname = _config.ConfigItem(
'col{0}',
'The template that determines the name of a co... | bsipocz/astropy | astropy/table/__init__.py | Python | bsd-3-clause | 2,572 |
# -*- coding: utf-8 -*-
import abc
class IWaitStrategy(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def compute_wait_time(self, attempt):
"""
Parameters
----------
attempt : clare.common.retry.attempt.Attempt
Returns
-------
float
... | dnguyen0304/clare | clare/clare/common/retry/wait_strategies.py | Python | mit | 684 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_04_01/aio/operations/_subnets_operations.py | Python | mit | 35,858 |
# (C) British Crown Copyright 2017, Met Office
#
# This file is part of Iris.
#
# Iris 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 3 of the License, or
# (at your option) any later ve... | QuLogic/iris | lib/iris/tests/unit/util/test__slice_data_with_keys.py | Python | gpl-3.0 | 16,153 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import mock
import unittest
from livespace import Client
from livespace.exceptions import ApiError
class ClientTestCase(unittest.TestCase):
def setUp(self):
self.client = Client('api_url', 'api_key', 'api_secret')
super(ClientTestCase, self).setUp()
... | ra2er/livespace-sdk | livespace/tests.py | Python | mit | 1,010 |
import threading
import logging
import time
import os
logging.basicConfig( level=logging.DEBUG, format='[%(levelname)s] - %(threadName)-10s : %(message)s')
def worker(x):
logging.debug('Lanzado')
importer = 'bin/mallet import-svmlight --input archivoEntrenamiento%s.txt --output training%s.mallet' % (x,x)
... | mespinozas/si | t3/t3_marcelo/t3loader.py | Python | gpl-2.0 | 1,105 |
# stdlib
from collections import defaultdict
import time
# 3p
import psutil
# project
from checks import AgentCheck
from config import _is_affirmative
from utils.platform import Platform
DEFAULT_AD_CACHE_DURATION = 120
DEFAULT_PID_CACHE_DURATION = 120
ATTR_TO_METRIC = {
'thr': 'threads',
'cpu... | mertaytore/koding | deployment/datadog/checks.d/process.py | Python | agpl-3.0 | 12,203 |
from kokki import Package
Package("php5-mysql")
| samuel/kokki | kokki/cookbooks/mysql/recipes/php5.py | Python | bsd-3-clause | 50 |
#!/usr/bin/env python
# built-ins
import sys
import os
import ConfigParser
from xml.dom import minidom
import json
import random
import time
import datetime
import re
import traceback
import pickle
import sqlite3
import tempfile
import urllib
# site-packages
import requests
import prettytable
import inflection
# glo... | sjml/SimulatorGenerator | SimulatorGeneratorTwitter.py | Python | mit | 23,502 |
from __future__ import division, print_function, absolute_import, unicode_literals
from calendar_cli.operation.operation import Operation
from calendar_cli.setting.arg_parser import parser
from mog_commons.io import print_safe
class HelpOperation(Operation):
def __init__(self, exception=None):
Operation.... | mogproject/calendar-cli | src/calendar_cli/operation/help_operation.py | Python | apache-2.0 | 524 |
from PyQt4 import QtCore, QtGui
from PyQt4.Qt import *
import ui_phylo_analysis_details_page
#import python_to_R
from ome_globals import *
RMA_MV_RANDOM_EFFECTS_METHODS_TO_PRETTY_STRS = {
"ML":"maximum-likelihood estimator",
"REML":"rest... | gdietz/OpenMEE | phylo/phylo_analysis_details_page.py | Python | gpl-3.0 | 8,970 |
from typeahead import app
if __name__ == "__main__":
app.run()
| mhanline/FlaskTypeahead | wsgi.py | Python | mit | 69 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Vincent Paredes
#
# This file is part of a weboob module.
#
# This weboob module 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 3 of the... | laurentb/weboob | modules/orange/pages/bills.py | Python | lgpl-3.0 | 9,949 |
"""
Support for Denon Network Receivers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.denon/
"""
import logging
import telnetlib
from homeassistant.components.media_player import (
DOMAIN, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, SUPPORT_PR... | mikaelboman/home-assistant | homeassistant/components/media_player/denon.py | Python | mit | 4,842 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from flask import session
from indico.core import signals
from i... | mic4ael/indico | indico/modules/rb/__init__.py | Python | mit | 5,197 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | sadanandb/pmt | src/pyasm/prod/checkin/maya_checkin_test.py | Python | epl-1.0 | 1,263 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import re
from datetime import datetime
import dateutil.parser
from lxml import etree
from pytz import ti... | mic4ael/indico | indico/web/http_api/metadata/xml.py | Python | mit | 4,159 |
"""Tests for certbot.plugins.util."""
import os
import unittest
import sys
import mock
from six.moves import reload_module # pylint: disable=import-error
from certbot.tests import test_util
class PathSurgeryTest(unittest.TestCase):
"""Tests for certbot.plugins.path_surgery."""
@mock.patch("certbot.plugins... | jtl999/certbot | certbot/plugins/util_test.py | Python | apache-2.0 | 9,024 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from celery import task
@task
def add(x,y):
print x+y
return x[0]+y[0]
| schedul-xor/celery-practice | tasks.py | Python | mit | 126 |
from . import db
class Credentials(db.Model):
"""username and password for system"""
__tablename__ = "credentials"
password = db.Column(db.String(20))
username = db.Column(db.String(20), primary_key=True) | RollingThunder6/MidnightInventers | Source Code/Flask/app/models.py | Python | gpl-3.0 | 209 |
from django.contrib import admin
from messaging.models import ServerMOTD, CharacterMessage, MessageRecipient, \
MessageRecipientGroup, MessageRelationship
@admin.register(ServerMOTD)
class MOTDAdmin(admin.ModelAdmin):
list_display = ('title', 'display_order', 'draft')
list_filter = ('draft', )
admin.sit... | jardiacaj/finem_imperii | messaging/admin.py | Python | agpl-3.0 | 471 |
# coding: utf-8
__author__ = 'edubecks'
from pprint import pprint
# # oauth_access_token = facebook.get_app_access_token(config.DEV_FB_APP_ID, config.DEV_FB_APP_SECRET)
# oauth_access_token = config.OAUTH_TOKEN
# graph = facebook.GraphAPI(oauth_access_token)
# profile = graph.get_object('me')
# group = graph.get_obj... | edubecks/vaidecaronaorg | caronasbrasilapp/djangoapp/apps/caronasbrasil/model/test.py | Python | mit | 1,802 |
#!/usr/bin/python
"""
Read all the caveman/pindel files, collect gene names
and create a table with genes and mutation counts in
every sample (try to merge pindel and caveman results)
"""
from __future__ import print_function
import sys
import gzip
import re
genepatt = re.compile("VD=([^|]+)")
table = di... | TravisCG/SI_scripts | genefound.py | Python | gpl-3.0 | 1,134 |
__source__ = 'https://leetcode.com/problems/detect-capital/'
# Time: O()
# Space: O()
#
# Description: 520. Detect Capital
#
# Given a word, you need to judge whether the usage of capitals in it is right or not.
#
# We define the usage of capitals in a word to be right when one of the following cases holds:
#
# All le... | JulyKikuAkita/PythonPrac | cs15211/DetectCapital.py | Python | apache-2.0 | 1,983 |
# AFM font NewCenturySchlbk-Bold (path: /usr/share/fonts/afms/adobe/pncb8a.afm).
# Derived from Ghostscript distribution.
# Go to www.cs.wisc.edu/~ghost to get the Ghostcript source code.
from . import dir
dir.afm["NewCenturySchlbk-Bold"] = (
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 5... | ska-sa/purr | Purr/Plugins/local_pychart/afm/NewCenturySchlbk_Bold.py | Python | gpl-2.0 | 1,509 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.thermal_zones_and_surfaces import Door
log = logging.getLogger(__name__)
class TestDoor(unittest.TestCase):
def setUp(self):
self.fd, self.path = tempfile.mkstemp()... | rbuffat/pyidf | tests/test_door.py | Python | apache-2.0 | 2,158 |
# Copyright (c) 2021 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 required... | openstack/neutron-lib | neutron_lib/api/definitions/qos_fip_network_policy.py | Python | apache-2.0 | 1,546 |
#
# Copyright (c) 2008--2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | dmacvicar/spacewalk | client/tools/rhnpush/rpm2mpm.py | Python | gpl-2.0 | 5,730 |
import asyncore
import email.utils
import socket
import smtpd
import smtplib
import StringIO
import sys
import time
import select
import unittest
from test import test_support
try:
import threading
except ImportError:
threading = None
HOST = test_support.HOST
def server(evt, buf, serv):
... | Jeff-Tian/mybnb | Python27/Lib/test/test_smtplib.py | Python | apache-2.0 | 20,434 |
from scara5 import FiveBar
b = FiveBar([1,1,1,1,1],[1,1,1,1,1]);
print(b.L);
| bulski7/ScaraRobot | Test1.py | Python | gpl-2.0 | 78 |
# ***************************************************************************
# * Copyright (c) 2017 Johannes Hartung <j.hartung@gmx.net> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... | sanguinariojoe/FreeCAD | src/Mod/Fem/feminout/readFenicsXDMF.py | Python | lgpl-2.1 | 2,385 |
# Copyright (C) 2016 Jordan Tardif http://github.com/jordant
# Jordan Tardif <jordan@dreamhost.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | ChameleonCloud/openstack-nagios-plugins | openstacknagios/nova/Images.py | Python | gpl-3.0 | 2,216 |
from setuptools import setup
requirements = {
'install': [
'distribute',
],
'extras': {
'docs': [
'sphinx>=1.1',
'agoraplex.themes.sphinx>=0.1.3',
'pygments',
],
'tests': [
'nose>=1.2.1',
'coverage>=3.6',
... | agoraplex/predicates | setup.py | Python | bsd-3-clause | 1,584 |
# -*- coding: utf-8 -*-
import unittest
from cwr.parser.decoder.dictionary import GroupTrailerDictionaryDecoder
"""
Dictionary to Message decoding tests.
The following cases are tested:
"""
__author__ = 'Bernardo Martínez Garrido'
__license__ = 'MIT'
__status__ = 'Development'
class TestGroupTrailerDictionaryEnc... | weso/CWR-DataApi | tests/parser/dictionary/decoder/control/test_group_trailer.py | Python | mit | 903 |
# Copyright (c) 2011 Neal H. Walfield
#
# This software 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 software is distribute... | khertan/Khweeteur | khweeteur/wc.py | Python | gpl-3.0 | 8,356 |
#!/usr/bin/env python
"""
responses
=========
A utility library for mocking out the `requests` Python library.
:copyright: (c) 2013 Dropbox, Inc.
"""
from setuptools import setup
from setuptools.command.test import test as TestCommand
import sys
setup_requires = []
if 'test' in sys.argv:
setup_requires.append(... | cournape/responses | setup.py | Python | apache-2.0 | 1,534 |
# -*- coding: utf-8 -*-
#
# This file is part of INGInious. See the LICENSE and the COPYRIGHTS files for
# more information about the licensing of this file.
import web
from inginious.frontend.pages.course_admin.utils import make_csv, INGIniousAdminPage
class CourseStudentInfoPage(INGIniousAdminPage):
""" List... | JuezUN/INGInious | inginious/frontend/pages/course_admin/student_info.py | Python | agpl-3.0 | 2,233 |
import os
from django.test import TestCase
from django.core.files.uploadedfile import SimpleUploadedFile
from demos.models import Demo, Project
class DemoTestCase(TestCase):
def setUp(self):
super(DemoTestCase, self).setUp()
self.demo = Demo.objects.create(
title='CloudCV Classifica... | Cloud-CV/CloudCV | tests/unit/demos/test_models.py | Python | gpl-3.0 | 2,051 |
NAME="Phone Alert Status"
| brettchien/PyBLEWrapper | pyble/const/profile/phone_alert_status.py | Python | mit | 26 |
from datetime import datetime, timedelta
from flask import Flask, render_template, jsonify
from flask_moment import Moment
app = Flask(__name__)
moment = Moment(app)
@app.route('/')
def index():
now = datetime.utcnow()
midnight = datetime(now.year, now.month, now.day, 0, 0, 0)
epoch = datetime(1970, 1, 1... | miguelgrinberg/Flask-Moment | example/app.py | Python | mit | 703 |
from controller import app
if __name__ == "__main__":
app.run()
| Plezito/TCC_fuji_plez | site/wsgi.py | Python | mit | 69 |
""" support for skip/xfail functions and markers. """
from __future__ import absolute_import, division, print_function
import os
import sys
import traceback
import py
from _pytest.config import hookimpl
from _pytest.mark import MarkInfo, MarkDecorator
from _pytest.runner import fail, skip
def pytest_addoption(parser... | alexzoo/python | selenium_tests/env/lib/python3.6/site-packages/_pytest/skipping.py | Python | apache-2.0 | 13,618 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | darren-wang/ksc | keystoneclient/tests/unit/v3/test_federation.py | Python | apache-2.0 | 17,143 |
################################################################################
# Copyright 2015 Samuel Gongora Garcia (s.gongoragarcia@gmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Founda... | satnet-project/propagators | output_predict.py | Python | apache-2.0 | 2,281 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 12, transform = "Difference", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Difference/trend_MovingAverage/cycle_12/ar_12/test_artificial_32_Difference_MovingAverage_12_12_20.py | Python | bsd-3-clause | 270 |
from .. import config
from .. import fixtures
from ..assertions import eq_
from ..schema import Column
from ..schema import Table
from ... import ForeignKey
from ... import Integer
from ... import select
from ... import String
from ... import testing
class CTETest(fixtures.TablesTest):
__backend__ = True
__re... | graingert/sqlalchemy | lib/sqlalchemy/testing/suite/test_cte.py | Python | mit | 6,802 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google 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... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_v1_generated_metadata_service_create_context_sync.py | Python | apache-2.0 | 1,468 |
from __future__ import absolute_import
import os
import sys
import errno
from .common import TERM_SIGNAL
__all__ = ['Popen']
#
# Start child process using fork
#
class Popen(object):
method = 'fork'
sentinel = None
def __init__(self, process_obj):
sys.stdout.flush()
sys.stderr.flush()... | ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/billiard/popen_fork.py | Python | mit | 2,600 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Authr: João Juíz
'''
import sys,os, argparse
class Main(object):
def argparser(self):
parser = argparse.ArgumentParser(description='What this program does')
#parser.add_argument("param", type=str, help='Parameter Description')
parser.add_... | juix/scripts | motherless-ai/control.py | Python | gpl-3.0 | 2,116 |
"""
dal_camera v1.0.0
Auteur: Bruno DELATTRE
Date : 16/09/2016
"""
class DAL_Camera:
def __init__(self, connection, cursor):
self.connection = connection
self.cursor = cursor
""" Select"""
def get_last_picture_id(self):
rows = self.cursor.execute('SELECT id_picture FROM c... | delattreb/StratoBalloon | src/dal/dal_camera.py | Python | gpl-3.0 | 1,112 |
"""
WSGI config for leyaproject project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATIO... | paulormart/leyaproject | leya/wsgi.py | Python | mit | 1,436 |
# -*- coding: utf-8 -*-
"""UI view definitions."""
from logging import getLogger
from urllib.parse import parse_qs
from django.http.request import HttpRequest
from django.http.response import HttpResponse
from eventkit_cloud.core.helpers import get_cached_model
from eventkit_cloud.tasks.models import DataProvider
fro... | venicegeo/eventkit-cloud | eventkit_cloud/utils/views.py | Python | bsd-3-clause | 2,084 |
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 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:
#
# 1. Redistributions of source code must retain the above copyri... | apyrgio/snf-ganeti | lib/cmdlib/network.py | Python | bsd-2-clause | 23,099 |
#!/usr/bin/env python
# Copyright (c) 2012 Cloudera, 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 requir... | grundprinzip/Impala | tests/hs2/hs2_test_suite.py | Python | apache-2.0 | 7,230 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | timsnyder/bokeh | bokeh/document/events.py | Python | bsd-3-clause | 28,451 |
class BankAccount(object):
def __init__(self, initial_balance=0):
self.balance = initial_balance
def deposit(self, amount):
self.balance += amount
def withdraw(self, amount):
self.balance -= amount
def overdrawn(self):
return self.balance < 0
my_account = BankAccount(15)
... | 2014c2g5/2014cadp | wsgi/local_data/brython_programs/class2.py | Python | gpl-3.0 | 368 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hhlregistrations', '0004_auto_20150411_1935'),
]
operations = [
migrations.AddField(
model_name='event',
... | hacklab-fi/hhlevents | hhlevents/apps/hhlregistrations/migrations/0005_auto_20150412_1806.py | Python | bsd-3-clause | 592 |
#
# 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/gslb/gslbservice.py | Python | apache-2.0 | 37,663 |
#!/usr/bin/python
# Copyright 2015 The ANGLE 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.
#
# gen_dxgi_support_tables.py:
# Code generation for the DXGI support tables. Determines which formats
# are natively support in D3D... | ppy/angle | src/libANGLE/renderer/gen_dxgi_support_tables.py | Python | bsd-3-clause | 11,799 |
import pytest
from sondra.suite import SuiteException
from .api import *
from sondra.collection import Collection
def _ignore_ex(f):
try:
f()
except SuiteException:
pass
@pytest.fixture(scope='module')
def s(request):
v = ConcreteSuite()
_ignore_ex(lambda: EmptyApp(v))
_ignore_ex... | JeffHeard/sondra | sondra/tests/test_collections.py | Python | apache-2.0 | 2,602 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
# $Id: vboxshell.py $
"""
VirtualBox Python Shell.
This program is a simple interactive shell for VirtualBox. You can query
information and issue commands from a simple command line.
It also provides you with examples on how to use VirtualBox's Python API.
This shell is even... | ruibarreira/linuxtrail | usr/lib/virtualbox/vboxshell.py | Python | gpl-3.0 | 120,819 |
from __future__ import absolute_import
import sys
from future.utils import PY2, PY26
__future_module__ = True
from collections import *
if PY2:
from UserDict import UserDict
from UserList import UserList
from UserString import UserString
if PY26:
from future.backports.misc import OrderedDict, Counte... | snakeleon/YouCompleteMe-x86 | third_party/ycmd/third_party/python-future/src/future/moves/collections.py | Python | gpl-3.0 | 417 |
import pytest
import os
import matplotlib
# Disable plotting
matplotlib.use("Template")
class ThresholdTestData:
def __init__(self):
"""Initialize simple variables."""
# Test data directory
self.datadir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "testdata")
... | danforthcenter/plantcv | tests/plantcv/threshold/conftest.py | Python | mit | 691 |
from JumpScale import j
import inspect
class CuisineBase:
def __init__(self, executor, cuisine):
self._p_cache = None
self.__classname = None
self._executor = executor
self._cuisine = cuisine
# maybe best to still show the cuisine, is easier
self.cuisine = cuisine... | Jumpscale/jumpscale_core8 | lib/JumpScale/tools/cuisine/CuisineFactory.py | Python | apache-2.0 | 7,076 |
from operator import itemgetter
from itertools import groupby
def groupby2(cols, lst, lev=0):
if not cols:
return str(list(lst))
keyfun = itemgetter(cols[0])
srted = sorted(list(lst), key=keyfun)
output = ""
for key, iter in groupby(srted, key=keyfun):
output += "\n"+" "*lev+"%10... | ActiveState/code | recipes/Python/535129_Groupby_hierarchy_tree/recipe-535129.py | Python | mit | 396 |
# Authors: Gilles Louppe, Mathieu Blondel, Maheshakya Wijewardena
# License: BSD 3 clause
import numpy as np
from .base import SelectorMixin
from ..base import TransformerMixin, BaseEstimator, clone
from ..externals import six
from ..utils import safe_mask, check_array, deprecated
from ..utils.validation import chec... | DSLituiev/scikit-learn | sklearn/feature_selection/from_model.py | Python | bsd-3-clause | 9,544 |
# Create your views here.
from apps.fumoufeed.models import *
from django.views.generic import View
from django.http import HttpResponse
import re
from django.views.decorators.csrf import csrf_exempt
def JsonResponse(data, status=200):
import json
data = json.dumps(data)
return HttpResponse(data, content_t... | littleq0903/fumoufeed | fumoufeed/apps/fumoufeed/views.py | Python | mit | 2,510 |
#!/usr/bin/env python2
# -*- coding: utf8 -*-
"""Pipeline for Goodman High Troughput Spectrograph spectra Extraction.
This program finds reduced images, i.e. trimmed, bias subtracted, flat fielded,
etc. that match the ``<pattern>`` in the source folder, then classify them in
two groups: Science or Lamps. For science i... | soar-telescope/goodman | goodman_pipeline/spectroscopy/redspec.py | Python | bsd-3-clause | 22,879 |
class Solution:
"""
@param A : An integer array
@return : An integer
"""
def singleNumberII(self, A):
# write your code here
res = 0
if A == None or A == 0:
return -1
n = len(A)
#for item in A:
#for k in self.baseConvert(item)
b... | quake0day/oj | singlenumber2.py | Python | mit | 1,020 |
# -*- coding: utf-8 -*-
import re
import unittest
from mock import patch
from mock import MagicMock
from django.core import mail
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test import TestCase
from common.alert_utils import BatchedEmailErrors
from ... | ebmdatalab/openprescribing | openprescribing/frontend/tests/commands/test_send_monthly_alerts.py | Python | mit | 19,193 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-30 01:35
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0015_auto_20170129_0129'),
]
operations = [
migrations.RemoveField(
... | andrewsosa/hackfsu_com | api/api/migrations/0016_remove_mentorinfo_availability.py | Python | apache-2.0 | 399 |
#!/usr/bin/env python
"""
This is the installation script of the offtheshelf module, a very simple and
minimal NoSQL database that uses shelve as a backend. You can run it by typing:
python setup.py install
You can also run the test suite by running:
python setup.py test
"""
import sys
from distutils.core im... | dotpy/offtheshelf | setup.py | Python | bsd-3-clause | 1,493 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_libtool
----------------------------------
Tests for `libtool` module.
"""
import os
import unittest
import sys
import shutil
from libtool.folder_tool import get_year_month_dir
print sys.path
from libtool.package_utils import include_all_ex
class TestLibtool... | weijia/libtool | tests/test_libtool.py | Python | bsd-3-clause | 652 |
from django.contrib.auth.models import User
from django.views import View
from django.views.generic import DetailView
from django.views.generic.edit import CreateView, UpdateView, FormView
from django.contrib.auth.decorators import login_required
from django.contrib.admin.views.decorators import staff_member_required
f... | avinassh/della | della/user_manager/views.py | Python | mit | 6,524 |
# This file is part of Korman.
#
# Korman 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.
#
# Korman is distributed i... | Hoikas/korman | korman/nodes/node_logic.py | Python | gpl-3.0 | 5,565 |
# coding=utf-8
# from cStringIO import StringIO
# from euphorie.client.report import HtmlToRtf
# from euphorie.client.report import IdentificationReport
# from euphorie.content.risk import Risk
from euphorie.client import model
from euphorie.client.adapters.session_traversal import TraversedSurveySession
from euphorie.... | euphorie/Euphorie | src/euphorie/client/tests/test_report.py | Python | gpl-2.0 | 18,350 |
#!/usr/bin/env/python
"""
vivocourses.py -- tools for courses and course section in VIVO
See CHANGELOG.md for history
"""
# TODO write test functions
# TODO get rid of tempita
# TODO update for VIVO-ISF
# TODO replace make_x_rdf series with add_x series
# TODO get rid of count and i in dictionary functions. ... | mconlon17/vivo-course-lib | vivocourses.py | Python | bsd-3-clause | 9,737 |
__author__ = 'noe'
import numpy as np
def estimate_P(C, reversible = True, fixed_statdist=None):
# import emma
import pyemma.msm.estimation as msmest
# output matrix. Initially eye
n = np.shape(C)[0]
P = np.eye((n), dtype=np.float64)
# treat each connected set separately
S = msmest.connect... | bhmm/legacy-bhmm-force-spectroscopy-manuscript | bhmm/msm/tmatrix_disconnected.py | Python | lgpl-3.0 | 2,267 |
from tyr.servers.server import Server
import zuun
import json
class MongoNode(Server):
SERVER_TYPE = 'mongo'
CHEF_RUNLIST = ['role[rolemongo]']
CHEF_MONGODB_TYPE = 'generic'
IAM_ROLE_POLICIES = ['allow-volume-control']
IAM_MANAGED_POLICIES = ['zuun-managed']
def __init__(self, group=None, ... | hudl/Tyr | tyr/servers/mongo/node.py | Python | unlicense | 3,253 |
class AutoParams(object):
"""
This base class is supposed to be used as a base class or mixin.
Is assigns all the arguments passed to the init method as instance
named attributes.
"""
def __init__(self, **kwargs):
self.__dict__.update({k: v for k, v in kwargs.items() if k != 'self'})
| mathiasbc/Pyswiss | pyswiss/classes.py | Python | gpl-2.0 | 320 |
#-------------------------------------------------------------------------------
# elftools example: dwarf_range_lists.py
#
# Examine DIE entries which have range list values, and decode these range
# lists.
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#--------------------------------------... | dhxkgozj/DirEngine | lib/pyelftools/examples/dwarf_range_lists.py | Python | bsd-3-clause | 3,402 |
#!/usr/bin/env python
'''
Copyright (C) 2020, WAFW00F Developers.
See the LICENSE file for copying permission.
'''
NAME = 'SEnginx (Neusoft)'
def is_waf(self):
schemes = [
self.matchContent(r'SENGINX\-ROBOT\-MITIGATION')
]
if any(i for i in schemes):
return True
return False | EnableSecurity/wafw00f | wafw00f/plugins/senginx.py | Python | bsd-3-clause | 310 |
##############################################################################
# Copyright (c) 2013-2017, 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... | skosukhin/spack | var/spack/repos/builtin/packages/py-pathos/package.py | Python | lgpl-2.1 | 1,881 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-27 17:03
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.core.files.uploadedfile import SimpleUploadedFile
from django.conf import... | Galexrt/zulip | zerver/migrations/0060_move_avatars_to_be_uid_based.py | Python | apache-2.0 | 4,466 |
from pandas.compat import range
import re
import operator
import pytest
import warnings
from numpy import nan
import numpy as np
from pandas import _np_version_under1p8
from pandas.core.sparse.api import SparseArray, SparseSeries
from pandas._libs.sparse import IntIndex
from pandas.util.testing import assert_almost_... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/pandas/tests/sparse/test_array.py | Python | mit | 30,556 |
#!/usr/bin/python
import sys
import os
from hashlib import sha512, sha256
import base64
from lib.oath.hotpie import TOTP
b32Key = ''
secret = base64.b32decode(b32Key)
digits = TOTP(secret, digits=6 )
print(digits)
| jdhall75/authenticator | authenticator.py | Python | gpl-3.0 | 220 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.