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 |
|---|---|---|---|---|---|
# chatpy
# Copyright 2013-2015 aqn
# the original source code is written by Joshua Roesslein (Tweepy)
# See LICENSE for details.
"""
Chatwork API library
"""
__version__ = '0.3.0'
__license__ = 'MIT'
from chatpy.models import Status, ModelFactory
from chatpy.error import ChatpyError
from chatpy.api import API
from ch... | aqn/chatpy | chatpy/__init__.py | Python | mit | 575 |
# (c) 2015, Robert Chady <rchady@sitepen.com>
# Based on `runner/lookup_plugins/file.py` for Ansible
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Debops.
# This file is NOT part of Ansible yet.
#
# Debops is free software: you can redistrib... | ganto/debops | ansible/roles/ansible_plugins/lookup_plugins/template_src.py | Python | gpl-3.0 | 6,642 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test of the HDF storage for the Tables API.
Copyright 2009-2014 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import time
import pytest
import omero.columns
import omero.tables
import logging
import ... | tp81/openmicroscopy | components/tools/OmeroPy/test/unit/tablestest/test_hdfstorage.py | Python | gpl-2.0 | 10,650 |
f = lambda n: n*(n+1)/2
n = 2000000
ans = (0, n)
i = 1
while f(i)**2 <= n*2:
j = i
s = f(i)*f(j)
while s <= n*2:
if ans[1] > abs(s-n):
ans = (i*j, abs(s-n))
j += 1
s = f(i)*f(j)
i += 1
print ans
| huangshenno1/algo | project_euler/85.py | Python | mit | 208 |
#! usr/bin/env python
#
# APM - Another Python Mud
# Copyright (C) 2012 bdubyapee (BWP) p h i p p s b @ g m a i l . c o m
#
# 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 versi... | bdubyapee/apm | src/color.py | Python | gpl-3.0 | 5,554 |
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 7 18:14:49 2017
@author: Shabaka
"""
import pandas as pd
import numpy as np
# Define count_entries()
def count_entries(df, *args):
"""Return a dictionary with counts of
occurrences as value for each key."""
#Initialize an empty dictionary: cols_... | qalhata/Python-Scripts-Repo-on-Data-Science | General Multi_Column DataFrame Analysis.py | Python | gpl-3.0 | 1,145 |
#!/usr/bin/env python
from __future__ import division
import numpy as np
import pandas as pd
import time
import glob
import re
from collections import OrderedDict
import composition.support_functions.paths as paths
def load_sim(config='IT73', bintype='logdist', return_cut_dict=False):
# Load simulation datafr... | jrbourbeau/composition | analysis/load_sim.py | Python | mit | 3,972 |
# coding=utf-8
from twisted.protocols import amp
from twisted.cred.error import UnauthorizedLogin
from errors import SlotErrorNotification
from errors import BadCredentials
"""
Copyright 2014, 2015 Xabier Crespo Álvarez
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this fil... | satnet-project/generic-client | ampCommands.py | Python | apache-2.0 | 5,800 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('open_humans', '0010_auto_20180611_2029'),
]
operations = [
migrations.AlterField(
model_name='blogpost',
name='image_url',
field... | PersonalGenomesOrg/open-humans | open_humans/migrations/0011_auto_20180709_2220.py | Python | mit | 385 |
# Copyright 2014 PerfKitBenchmarker 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 appli... | syed/PerfKitBenchmarker | perfkitbenchmarker/benchmark_status.py | Python | apache-2.0 | 3,856 |
from django.core.checks import Error, register, Warning
import dashboard
import pathlib
# these paths will be checked for existence. Warnings are raised if any are missing.
PO_PATHS = [
'locale/nl/LC_MESSAGES/django.po',
'locale/nl/LC_MESSAGES/djangojs.po',
'dashboard/locale/nl/LC_MESSAGES/django.po',
... | amcat/amcat-dashboard | dashboard/checks.py | Python | agpl-3.0 | 1,471 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("XGBRegressor" , "diabetes" , "oracle")
| antoinecarme/sklearn2sql_heroku | tests/regression/diabetes/ws_diabetes_XGBRegressor_oracle_code_gen.py | Python | bsd-3-clause | 128 |
# 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 th... | CiscoSystems/avos | openstack_dashboard/dashboards/project/stacks/forms.py | Python | apache-2.0 | 15,580 |
#!/usr/bin/python
#
# Copyright (c) 2008--2010 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... | colloquium/spacewalk | backend/server/test/test-rhn-import.py | Python | gpl-2.0 | 895 |
from Screens.Screen import Screen
from Screens.LocationBox import MovieLocationBox, TimeshiftLocationBox
from Screens.MessageBox import MessageBox
from Components.Label import Label
from Components.config import config, ConfigSelection, getConfigListEntry
from Components.ConfigList import ConfigListScreen
from Componen... | OpenPLi/enigma2 | lib/python/Screens/RecordPaths.py | Python | gpl-2.0 | 8,099 |
"""Support for displaying minimal, maximal, mean or median values."""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT,
CONF_NAME,
CONF_TYPE,
STATE_UNAVAILABLE,
STATE_UNKNOWN... | jawilson/home-assistant | homeassistant/components/min_max/sensor.py | Python | apache-2.0 | 7,886 |
#!/usr/bin/env python
"""
"""
import vtk
def view_frog(fileName, tissues):
colors = vtk.vtkNamedColors()
tissueMap = CreateTissueMap()
colorLut = CreateFrogLut()
# Setup render window, renderer, and interactor.
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWind... | lorensen/VTKExamples | src/Python/Visualization/ViewFrog.py | Python | apache-2.0 | 5,808 |
#!/usr/bin/python
#8.4 Open the file romeo.txt and read it line by line. For each line, split the line into a list of words using the split() function. The program should build a list of words. For each word on each line check to see if the word is already in the list and if not append it to the list. When the program ... | hiteshagrawal/python | romeo.py | Python | gpl-2.0 | 671 |
import unittest
from datetime import datetime
from django.test import SimpleTestCase, ignore_warnings
from django.utils.datastructures import MultiValueDict
from django.utils.deprecation import RemovedInDjango30Warning
from django.utils.http import (
base36_to_int, cookie_date, escape_leading_slashes, http_date,
... | nesdis/djongo | tests/django_tests/tests/v22/tests/utils_tests/test_http.py | Python | agpl-3.0 | 12,062 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# MIT License. See license.txt
from __future__ import unicode_literals
import webnotes, os
from webnotes.modules import scrub, get_module_path, scrub_dt_dn
def import_files(module, dt=None, dn=None, force=False):
if type(module) is list:
out = []
for m in ... | rohitw1991/latestadbwnf | webnotes/modules/import_file.py | Python | mit | 3,122 |
# ############################################################################
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core business i... | uclouvain/osis | backoffice/tests/settings/rest_framework/test_authentication.py | Python | agpl-3.0 | 6,687 |
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that ... | sestrella/ansible | lib/ansible/module_utils/facts/virtual/linux.py | Python | gpl-3.0 | 10,658 |
import base64
import binascii
import mimetypes
import urllib.parse
import uuid
from django.core.exceptions import ValidationError
from django.core.files.base import ContentFile
from django.core.files.uploadedfile import UploadedFile
from django.utils.translation import ugettext as _
from rest_framework.fields import F... | concentricsky/badgr-server | apps/mainsite/drf_fields.py | Python | agpl-3.0 | 3,112 |
from lino.projects.std.settings import *
# configure_plugin('countries', country_code='BE')
class Site(Site):
verbose_name = "20121124"
# demo_fixtures = ["few_countries", "few_cities", "demo"]
def get_installed_apps(self):
yield super(Site, self).get_installed_apps()
yield 'lino_book.p... | lino-framework/book | lino_book/projects/20121124/settings.py | Python | bsd-2-clause | 579 |
"""Provides a Hue API to control Home Assistant."""
import asyncio
import logging
from aiohttp import web
from homeassistant import core
from homeassistant.const import (
ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON, SERVICE_VOLUME_SET,
SERVICE_OPEN_COVER, SERVICE_CLOSE_COVER, STATE_ON, STATE_OFF,
HT... | kyvinh/home-assistant | homeassistant/components/emulated_hue/hue_api.py | Python | apache-2.0 | 13,038 |
# Copyright 2020 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.
"""Script that does nothing successfully."""
| ric2b/Vivaldi-browser | chromium/build/noop.py | Python | bsd-3-clause | 207 |
from pecan import expose
from ceph_installer.controllers import (
tasks, mon, osd, rgw, calamari, errors, setup, agent,
status
)
class ApiController(object):
@expose('json')
def index(self):
# TODO: allow some autodiscovery here so that clients can see what is
# available
retu... | ceph/ceph-installer | ceph_installer/controllers/root.py | Python | mit | 774 |
import os
from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from electrum_mona.util import base_units
from electrum_mona.storage import StorageReadWriteError
from ...i18n import _
from .label_dialog import LabelDialog
Builder.load_stri... | wakiyamap/electrum-mona | electrum_mona/gui/kivy/uix/dialogs/wallets.py | Python | mit | 2,112 |
# 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... | NeCTAR-RC/swift | test/unit/container/test_server.py | Python | apache-2.0 | 88,183 |
from datetime import date, datetime
from functools import wraps
try:
# PY2
from urllib import quote_plus
except ImportError:
# PY3
from urllib.parse import quote_plus
# parts of URL to be omitted
SKIP_IN_PATH = (None, '', [], ())
def _escape(value):
"""
Escape a single value of a URL string or... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/elasticsearch/client/utils.py | Python | agpl-3.0 | 2,382 |
"""
Tests for `_ods`.
"""
# Copyright (C) 2009-2021 Thomas Aglassinger
#
# This program 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 v... | roskakori/cutplace | tests/test_ods.py | Python | lgpl-3.0 | 2,347 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.utils.translation import ugettext_lazy as _
from filer.... | suutari/shoop | shuup/admin/modules/media/__init__.py | Python | agpl-3.0 | 1,421 |
import time
import datetime
import random
import threading
import slackbot_settings as settings
import slacker
from log import logger
from cron import CronScheduleTime, parse_cron_schedule
def _run_thread(slackclient, cron_schedule_times, channel_ids, messages):
while True:
now = datetime.datetime.now(... | murrple-1/foodorder-slack | foodorder-slackbot/announcethread.py | Python | mit | 2,765 |
# Copyright 2016 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | himanshu-dixit/oppia | core/tests/performance_framework/perf_domain.py | Python | apache-2.0 | 13,677 |
# -*- coding: utf-8 -*-
"""
Authors: Hung-Hsin Chen <chenhh@par.cse.nsysu.edu.tw>
License: GPL v2
"""
import numpy as np
import pandas as pd
def sharpe(series):
"""
Sharpe ratio
note: the numpy std() function is the population estimator
Parameters:
---------------
series: list or numpy.array... | chenhh/PySPPortfolio | PySPPortfolio/pysp_portfolio/utils.py | Python | gpl-3.0 | 2,140 |
'''
Copied from pyglet 1.2 lib/x11
Wrapper for X11
Generated with:
tools/genwrappers.py xlib
Do not modify this file.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import ctypes
from ctypes import *
import pyglet.lib
_lib = pyglet.lib.load_library('X11')
_int_types = (c_int16, c_int32)
if hasattr(... | psychopy/versions | psychopy/iohub/devices/xlib.py | Python | gpl-3.0 | 190,917 |
# -*- coding: utf-8 -*-
#############################################
class Duck:
_fly_behavior = None;
_quack_behavior = None;
def __init__(self):
pass
def display(self):
pass
def perform_fly(self):
self._fly_behavior.fly()
def perform_quack(self):
self._quack_behavior.quack()
def swim():
print... | tisOO/Patterns | strategy/python/example_1/strategy.py | Python | mit | 1,711 |
import unittest
from string_searching import search_for_substring
class TestStringSearching(unittest.TestCase):
def test_edge(self):
self.assertEqual('true', search_for_substring('Hello,ello'))
self.assertEqual('true', search_for_substring('Hello,Hello'))
def test_given(self):
self.as... | Goyatuzo/Challenges | CodeEval/Hard/String Searching/test_string_searching.py | Python | mit | 960 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | vmturbo/nova | nova/compute/manager.py | Python | apache-2.0 | 326,877 |
from __future__ import unicode_literals
from mopidy_gpiocont import Extension, frontend as frontend_lib
def test_get_default_config():
ext = Extension()
config = ext.get_default_config()
assert '[gpiocont]' in config
assert 'enabled = true' in config
def test_get_config_schema():
ext = Extens... | JasperGerth/Mopidy-GPIOcont | tests/test_extension.py | Python | apache-2.0 | 507 |
from a10sdk.common.A10BaseClass import A10BaseClass
class IpStats(A10BaseClass):
"""Class Description::
Statistics for the object ip-stats.
Class ip-stats supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param DeviceProx... | amwelch/a10sdk-python | a10sdk/core/system/system_ip_stats_stats.py | Python | apache-2.0 | 850 |
import base as Base
class ChangeX(Base.BaseClass):
def __init__(self):
self.x = 17
class ChangeHam(Base.BaseClass):
def __init__(self):
super(BetterHam, self).__init__()
def printHam(self):
print ('Ham2')
class Combo(ChangeX, ChangeHam):
def __init__(self):
super(Comb... | Valka7a/python-playground | let's-learn-python/inheritance-oop-2/challenge/classes.py | Python | mit | 462 |
from esp import neopixel_write
import machine
GAMMA = 2.8
GAMMA_SHIFT = 40
class Led(object):
def __init__(self, hsv=(0, 0, 0), rgb=None):
self.set_hsv(0, 0, 0)
def set_hsv(self, *hsv):
self.h = hsv[0]
self.s = hsv[1]
self.v = hsv[2]
def to_rgb(self):
return hsv_... | numero-trey/py8266 | ledpy.py | Python | gpl-3.0 | 3,405 |
import random
from random import randint
import sys
#4000 4 0.005 0.0025
num_nodes = 1000
num_partition = 4
print num_nodes
intra_prop = 0.01
inter_prop = 0.01
ans = []
cnt = 0
for i in range(num_nodes):
ans.append([])
for i in range(num_nodes):
for j in range(i + 1, num_nodes):
first = i % num_partition
... | simp1eton/CS224W_Final_Project | DATA/stochastic_block_model_6.py | Python | mit | 842 |
import sys
sys.path.append("../src")
from gehol import GeholProxy
from gehol.converters.utils import write_content_to_file
from gehol.converters.rfc5545icalwriter import convert_geholcalendar_to_ical
if __name__=="__main__":
print 'import calendar test --> csv files'
all_courses = ['INFOH500','BIMEH404','STAT... | Psycojoker/geholparser | examples/test_ical_writer.py | Python | mit | 881 |
class LinkedList:
def __init__(self, data):
self.data = data
def append(self, data):
self.next = LinkedList(data)
test = LinkedList(5)
test.next.data
| jrahm/DuckTest | tests/test_ll.py | Python | bsd-2-clause | 177 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS (Oracle)
Date : Aug 27, 2014
copyright : (C) 2014 by Médéric RIBREUX
email : meder... | SebDieBln/QGIS | python/plugins/db_manager/db_plugins/oracle/plugin.py | Python | gpl-2.0 | 22,853 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
# Module API
def ensure_dir(path):
"""Ensure directory exists.
Args:
path (str): file path inside the directory to e... | sirex/datapackage-py | datapackage/helpers.py | Python | mit | 448 |
import agents as ag
import envgui as gui
# change this line ONLY to refer to your project
import submissions.Porter.vacuum2 as v2
# ______________________________________________________________________________
# Vacuum environmenty
class Dirt(ag.Thing):
pass
class VacuumEnvironment(ag.XYEnvironment):
"""Th... | austinban/aima-python | submissions/Porter/vacuum2Runner.py | Python | mit | 6,343 |
import itertools
import pyglet
from pyglet.gl import *
from freezegame.image_loader import *
import freezegame.resources
from freezegame.image_loader import ImageLoader
from freezegame.abstract_state import AbstractState
from freezegame.sprite import Sprite
from freezegame.tile_map import TileMap
from freezegame.broa... | mattfister/freezegame | freezegame/sample.py | Python | mit | 6,929 |
# coding: utf-8
import itertools
import json
import logging
from datetime import date
from django.contrib import messages
from django.contrib.admin.models import LogEntry, DELETION
from django.contrib.contenttypes.models import ContentType
from django.core.serializers.json import DjangoJSONEncoder
from django.http im... | pitpalme/volunteer_planner | scheduler/views.py | Python | agpl-3.0 | 11,582 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing the tray starter configuration page.
"""
from __future__ import unicode_literals
from .ConfigurationPageBase import ConfigurationPageBase
from .Ui_TrayStarterPage import Ui_TrayStarterPage
impo... | testmana2/test | Preferences/ConfigurationPages/TrayStarterPage.py | Python | gpl-3.0 | 2,369 |
from ESSArch_Core.exceptions import ESSArchException
class UnknownTransformer(ESSArchException):
pass
| ESSolutions/ESSArch_Core | ESSArch_Core/fixity/transformation/exceptions.py | Python | gpl-3.0 | 108 |
"""
Performs management commands for the scheduler app
"""
import hashlib
from flask.ext.script import Manager
from sqlalchemy import exc
# Importing routes causes our URL routes to be registered
from src import routes
from src import models
from src import scheduler
scheduler.app.config.from_object(scheduler.Config... | ginstrom/scheduler | manage.py | Python | mit | 1,385 |
"""Test class for Environment Preparation after a fresh installation"""
from robottelo import ssh
from robottelo.cli.base import CLIReturnCodeError
from robottelo.cli.org import Org
from robottelo.cli.product import Product
from robottelo.cli.repository import Repository
from robottelo.cli.repository_set import Reposit... | danuzclaudes/robottelo | tests/foreman/performance/test_standard_prep.py | Python | gpl-3.0 | 7,716 |
"""
homeassistant.components.media_player.snapcast
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides functionality to interact with Snapcast clients.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.snapcast/
"""
import logging
import s... | nnic/home-assistant | homeassistant/components/media_player/snapcast.py | Python | mit | 2,333 |
from direct.directnotify import DirectNotifyGlobal
import DistributedBrutalFactoryAI
import DistributedFactoryAI
from toontown.toonbase import ToontownGlobals
from direct.showbase import DirectObject
class FactoryManagerAI(DirectObject.DirectObject):
notify = DirectNotifyGlobal.directNotify.newCategory('FactoryMan... | Spiderlover/Toontown | toontown/coghq/FactoryManagerAI.py | Python | mit | 1,076 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Web',
'category': 'Hidden',
'version': '1.0',
'description':
"""
Odoo Web core module.
========================
This module provides the core of the Odoo Web Client.
""",
'... | maxive/erp | addons/web/__manifest__.py | Python | agpl-3.0 | 744 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | faneshion/MatchZoo | docs/source/conf.py | Python | apache-2.0 | 5,927 |
# runs integration tests against the osmo-smsc inserter
# Copyright (C) 2016 Henning Heinold <henning@itconsulting-heinold.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Founda... | zecke/osmo-smsc | integration-tests/inserter_test.py | Python | agpl-3.0 | 3,504 |
from django import http
from django.http import HttpResponseRedirect
from django.views.generic.simple import direct_to_template
from openid.consumer import consumer
from openid.consumer.discover import DiscoveryFailure
from openid.extensions import pape, sreg
from openid.yadis.constants import YADIS_HEADER_NAME, YADI... | alon/polinax | libs/external_libs/python-openid-2.1.1/examples/djopenid/consumer/views.py | Python | gpl-2.0 | 7,062 |
"""
edx-organizations management commands tests package initialization module
"""
| devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/organizations/management/commands/tests/__init__.py | Python | agpl-3.0 | 82 |
from abc import abstractmethod
from treehopper.libraries.sensors import Pollable
class Magnetometer(Pollable):
"""Three-axis magnetic sensor"""
def __init__(self):
super().__init__()
self._magnetometer = [0.0, 0.0, 0.0]
@property
def magnetometer(self):
if self.auto_update_whe... | treehopper-electronics/treehopper-sdk | Python/treehopper/libraries/sensors/magnetic/magnetometer.py | Python | mit | 453 |
from opal.TestProblemCollections import CUTEr
from opal.TestProblemCollections.cuterfactory import CUTErQuery
'''
Some notes on special problems:
- JUNKTURN is solved (ecode = 0) with surrogate whose tolerance is less strict.
For the original blackbox, JUNKTURN return always exit code = 2. However
the number of fu... | dpo/opal | examples/ipopt/ipopt_test_problems.py | Python | lgpl-3.0 | 12,281 |
#!/usr/bin/env python
"""Tests for the puppies package."""
| LifeBuddy/puppies | puppies/test/__init__.py | Python | agpl-3.0 | 60 |
import random
import matplotlib.pyplot as plt
# necessary packages
def throwdice(dicetype, thrownumber=1):
""" Throws dice """
value = 0
# # if thrownumber==1:
# # value=random.randint(0,dicetype)
# elif thrownumber > 1:
for i in range(1, thrownumber + 1):
value = value + random.ra... | kergely/Character-creator-szerep | src/dices.py | Python | mit | 3,896 |
#!/usr/bin/python
#Copyright (C) 2009 Gabes Jean, naparuba@gmail.com
#
#This file is part of Shinken.
#
#Shinken is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at yo... | baloo/shinken | shinken/modules/thrift_broker/thrift_status.py | Python | agpl-3.0 | 10,583 |
#!/usr/bin/python
size=77050
arr = [None] * size
max_value=-1
max_position=-1
for i in range(1, size):
if i%1000==0:
print "got to", i
count = 0
series=[]
n = i
while n!=1:
if n>len(arr):
diff=n-len(arr)+1
extra_array=[None]*diff
arr.extend(extra_array)
print "extended to", len(arr)
if arr[n] i... | veltzer/riddling | instances/series/solution_better.py | Python | gpl-3.0 | 627 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import six
import codecs
import errno
import fnmatch
import locale
import logging
import os
import pytz
import re
import shutil
import sys
import traceback
import pickle
import datetime
from collections import Hashable
from contextlib imp... | levanhien8/pelican | pelican/utils.py | Python | agpl-3.0 | 23,526 |
# -*- coding: utf-8 -*-
#
import base64
import crcmod
import datetime
import json
import hashlib
import hmac
import urlparse
import time
import os
import oss2
from django.conf import settings
from django.utils import timezone
from chisch.common import dependency
# from django.conf import settings
# 以下代码展示了PostOb... | zhaowenxiang/chisch | oss/cores.py | Python | mit | 8,433 |
'''
libpcap.py contains the function in libpcap but not in winpcap, not all function are already implemented
'''
from .pcap import _pcap, PcapError, PCAP_ERRBUF_SIZE, pcap_t_p
from ctypes import *
from libpcapy.pcap import PcapWarning
# Error codes for the pcap API.
# These will all be negative, so you can check for ... | public0821/libpcapy | libpcapy/libpcap.py | Python | apache-2.0 | 7,180 |
"""Handle communication with any Deep or IcePAP device"""
# Standard modules
import string
import time
import numpy
import sys
import pdb
from threading import Lock #import gevent
# DEEP modules
from . import log
# Get python modules to communicate with an DEEP device
from sockdeep import SockDeep
from sldeep impo... | esrf-emotion/emotion | emotion/controllers/libicepap/deep/device.py | Python | gpl-2.0 | 13,738 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('scores', '0004_player_last10avg'),
]
operations = [
migrations.RenameField(
model_name='player',
old... | takumiharada/fantasypl | scores/migrations/0005_auto_20150624_0418.py | Python | mit | 968 |
# -*- coding: utf-8 -*-
"""Fallback controller."""
from depotexample.lib.base import BaseController
from tg import abort
__all__ = ['TemplateController']
class TemplateController(BaseController):
"""
The fallback controller for depotexample.
By default, the final controller tried to fulfill the req... | rlam3/depot | examples/turbogears/depotexample/controllers/template.py | Python | mit | 984 |
#!/usr/bin/env python
# Copyright 2017 Calico 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | calico/basenji | bin/sonnet_predict_bed.py | Python | apache-2.0 | 9,710 |
#!/usr/bin/python3.3
import sys
print(sys.path)
| eroicaleo/LearningPython | ch20/script2.py | Python | mit | 48 |
from charm.core.math.pairing import hashPair as sha2
from charm.schemes.abenc.dabe_aw11 import Dabe
from charm.toolbox.ABEncMultiAuth import ABEncMultiAuth
from charm.toolbox.pairinggroup import PairingGroup,GT
from charm.toolbox.symcrypto import AuthenticatedCryptoAbstraction
debug = False
class HybridABEncMA(ABEncMu... | JHUISI/charm | charm/adapters/dabenc_adapt_hybrid.py | Python | lgpl-3.0 | 4,900 |
"""
Make graphs (lifecycles, ...)
"""
from __future__ import absolute_import, division, print_function
import os
import sys
import json
from collections import OrderedDict
try:
import pygraphviz as pgv
except ImportError:
print('(optional) install pygraphviz to generate graphs')
sys.exit(0)
... | WIPACrepo/iceprod | docs/make_graphs.py | Python | mit | 1,446 |
import aravis
import cv2
import time
if __name__ == "__main__":
ar = aravis.Aravis()
cam = ar.get_camera("Prosilica-02-2110A-06145")
#cam = ar.get_camera("AT-Automation Technology GmbH-20805103")
width, height = cam.get_sensor_size()
cam.set_region(0, 0, width, height)
x, y, width, height = ... | oroulet/python-aravis | ctypes-based/prosilica-streaming.py | Python | gpl-3.0 | 1,778 |
import os
import unittest
from vsg.rules import assert_statement
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_002_test_input.vhd'))
dIndentMap = utils.read_indent_file()
dIndentMap = utils.read_ind... | jeremiah-c-leary/vhdl-style-guide | vsg/tests/assert_statement/test_rule_002.py | Python | gpl-3.0 | 1,409 |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
# $Id: xmlrpc_curl.py,v 1.13 2007/03/04 19:26:59 kjetilja Exp $
# We should ignore SIGPIPE when using pycurl.NOSIGNAL - see
# the libcurl tutorial for more info.
try:
import signal
from signal import SIGPIPE, SIG_IGN
signal.signal(signal.SIGP... | kerneltravel/pycurl | examples/xmlrpc_curl.py | Python | lgpl-2.1 | 1,958 |
# -*- encoding: utf-8 -*-
from osv import fields, osv
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
'fullnum': fields.char('num', size=40),
'sales_ids': fields.many2many('res.users', 'rel_partner_user','partner_id','user_id', '负责业务员', help='内部负责业务员. 设置邮件地址,以备通知使用.'),
... | Johnzero/OE7 | OE-debug文件/PyWapFetion-master/extra.py | Python | agpl-3.0 | 1,703 |
# -*- coding: utf-8 -*-
#
# allocations/entries.py is part of MetaDoc (Client).
#
# All of MetaDoc 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 opti... | henrikau/metadoc | client/allocations/entries.py | Python | gpl-3.0 | 2,825 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# This file is part of qmljs, the QML/JS language support plugin for KDevelop
# Copyright (c) 2014 Denis Steckelmacher <steckdenis@yahoo.fr>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# pub... | mali/kdevelop | languages/qmljs/nodejsmodules/readline.py | Python | gpl-2.0 | 2,074 |
# pylint: disable = blacklisted-name, missing-docstring, useless-return, misplaced-comparison-constant, invalid-name, no-self-use, line-too-long, useless-object-inheritance
def foo():
return None
def goo():
return None
if foo == 786: # [comparison-with-callable]
pass
if 666 == goo: # [comparison-with-c... | kczapla/pylint | pylint/test/functional/comparison_with_callable.py | Python | gpl-2.0 | 1,204 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Copyright (c) 2014, Kersten Doering <kersten.doering@gmail.com>, Bjoern Gruening <bjoern.gruening@gmail.com>
"""
#Kersten Doering 04.06.2014
#check https://github.com/miracle2k/xappy/blob/master/docs/introduction.rst for nice examples
import xappy
searchConn = xap... | telukir/PubMed2Go | full_text_index/search_title.py | Python | isc | 2,405 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import calcoohija
def modo_operacion(lista2, modelo):
primero = int(lista2[1])
for i in lista2[2:]:
primero = modelo(primero, int(i))
print(primero)
def operando_valido(operador, lista2):
calcular = calcoohija.CalculadoraHija()
try... | arealg/ptavi-p2 | calcplus.py | Python | gpl-2.0 | 774 |
# -*- coding: utf-8 -*-
'''
Tests neo_utils.core.
@author: Pierre Thibault (pierre.thibault1 -at- gmail.com)
@license: MIT
@since: 2010-11-10
'''
__docformat__ = "epytext en"
import unittest
from neo_utils.core import count
from neo_utils.core import every
from neo_utils.core import inverse_linked_list
from neo_ut... | Pierre-Thibault/neo-utils | neo_utils/test_core.py | Python | mit | 3,484 |
from pprint import pprint
team_file_2016_Spr = ('/Users/coulter/Desktop/life_notes/2016_q1/' +
'scvl/ratings/teams_for_import_2016-Spr.csv-Sheet1.csv')
def import_teams():
import csv
from copy import deepcopy
divisions = []
with open(team_file_2016_Spr, 'r') as team_file:
... | widgetOne/league_admin | scheduler/members.py | Python | mit | 3,094 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def add_course_to_tasks(apps, schema_editor):
Task = apps.get_model('course', 'Task')
AssignmentTask = apps.get_model('course', 'AssignmentTask')
for task in Task.objects.all():
for assignment_... | wallysalami/gamified-education | course/migrations/0013_add_course_to_task_step_2.py | Python | mit | 1,339 |
__author__ = 'reggie'
import ujson as json
import Queue
import zmq
import time
import pika
import zlib
import base64
import PmkSeed
import PmkBroadcast
import PmkShared
from PmkShared import *
from Queue import *
class rx(Queue):
def __init__(self, maxsize=0):
Queue.__init__(self, maxsize)
pass
... | recap/pumpkin | pumpkin/PmkInternalDispatch.py | Python | mit | 15,836 |
"""
Countdown
=========
"""
from tryalgo.arithm_expr_target import arithm_expr_target
arithm_expr_target([25, 50, 75, 100, 3, 6], 952)
# %%
# Returns :code:`((((75*3)*(100+6))-50)/25)=952`.
#
# See on our blog the `original Countdown video <https://tryalgo.org/fr/2017/03/14/le-compte-est-bon/>`_ behind this example... | jilljenn/tryalgo | examples/arithm_expr_target.py | Python | mit | 322 |
#!/usr/bin/env python
#
# Copyright 2016 BMC Software, 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 applicab... | jdgwartney/pulse-api-python | tests/unit/tspapi/source_test.py | Python | apache-2.0 | 4,505 |
from webassets.filter import ExternalTool
class Babel(ExternalTool):
"""Processes ES6+ code into ES5 friendly code using `Babel <https://babeljs.io/>`_.
Requires the babel executable to be available externally.
To install it, you might be able to do::
$ npm install --global babel-cli
You pro... | morreene/tradenews | venv/Lib/site-packages/webassets/filter/babel.py | Python | bsd-3-clause | 2,007 |
#!/usr/bin/python
################################################################################
# twittertail.py
################################################################################
# Copyright 2010 Etienne Membrives <etienne@membrives.fr>
#
# This program is free software; you can redistribute it and/or... | emembrives/TwitterTail | twittertail.py | Python | gpl-3.0 | 5,126 |
import inspect
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping
import six
from .reducers import tuple_reducer, path_reducer, dot_reducer, underscore_reducer
from .splitters import tuple_splitter, path_splitter, dot_splitter, underscore_splitter
REDUCER_DICT = {
... | ianlini/flatten-dict | src/flatten_dict/flatten_dict.py | Python | mit | 5,769 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""Calculations with datetime values.
"""
__version__ = "$Id$"
#end_pymotw_header
import datetime
today = datetime.datetime.today()
print 'Today :', today
yesterday = today - datetime.timedelta(days=1)
print 'Yest... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/datetime/datetime_datetime_math.py | Python | gpl-3.0 | 572 |
import datetime
from decimal import Decimal
from django.core.exceptions import FieldDoesNotExist, FieldError
from django.db.models import (
BooleanField, CharField, Count, DateTimeField, ExpressionWrapper, F, Func,
IntegerField, NullBooleanField, Q, Sum, Value,
)
from django.db.models.functions import Length, ... | reinout/django | tests/annotations/tests.py | Python | bsd-3-clause | 22,342 |
#!/usr/bin/env python3
#
# 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
# "L... | SergeyMakarenko/fbthrift | thrift/perf/py3/load_handler.py | Python | apache-2.0 | 2,965 |
import unittest
from python.src import coverage_demo
class test_coverage_demo(unittest.TestCase):
def test_foo_returns_true(self):
self.assertTrue(coverage_demo.foo(1))
def test_foo_returns_false(self):
self.assertFalse(coverage_demo.foo(0))
"""
def test_foo_throws_exception(self):
#self.assertFalse(covera... | Deepthibr28/software-testing | tutorials/unittests/python/tests/test_coverage_demo.py | Python | mit | 403 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.