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 |
|---|---|---|---|---|---|
#
# Copyright 2015 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | catapult-project/catapult | third_party/gsutil/third_party/apitools/apitools/base/protorpclite/__init__.py | Python | bsd-3-clause | 693 |
# -*- coding: utf-8 -*-
# © 2015 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import base64
from openerp.tests.common import TransactionCase
from openerp.tools.misc import file_open
from openerp import http
class FakeRequest(object):
def __init__(self, env):
... | be-cloud-be/horizon-addons | web/web_favicon/tests/test_web_favicon.py | Python | agpl-3.0 | 1,546 |
#!/usr/bin/env python
traindat = '../data/fm_train_real.dat'
testdat = '../data/fm_test_real.dat'
label_traindat = '../data/label_train_multiclass.dat'
parameter_list = [[traindat,testdat,label_traindat,2.1,1,1e-5],[traindat,testdat,label_traindat,2.2,1,1e-5]]
def classifier_gmnpsvm (train_fname=traindat,test_fname=t... | MikeLing/shogun | examples/undocumented/python/classifier_gmnpsvm.py | Python | gpl-3.0 | 912 |
from django.conf.urls.defaults import patterns, url
from fhurl import fhurl
from zums.zumsd_users.forms import LoginForm, EmailOptionalRegistrationForm
from django.contrib.auth import views as auth_views
import zums
from zums.signals import UserSignedOut
def logout_with_signal(request, *args, **kw):
user, sessio... | amitu/zums | ROOT/zums/zumsd_users/urls.py | Python | bsd-3-clause | 1,853 |
# shaney - prepare Puppet code with LaTeX comments for multiple audiences.
# Based on <https://github.com/afseo/cmits>.
# Copyright (C) 2015 Jared Jennings, jjennings@fastmail.fm.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published... | jaredjennings/shaney | shaney/generators/autoindex.py | Python | gpl-3.0 | 3,828 |
# Задача 2. Вариант 50.
# Напишите программу, которая будет выводить на экран наиболее понравившееся вам высказывание,
#автором которого является Иларион (Алфеев).
#Не забудьте о том, что автор должен быть упомянут на отдельной строке.
# Alekseev I.S.
# 15.05.2016
print("Так и совершилось. Ибо вера благодатная расп... | Mariaanisimova/pythonintask | IVTa/2014/ALEKSEEV_I_S/task_2_50.py | Python | apache-2.0 | 984 |
"""Test module for pbs client."""
import pbclient
import json
from helpers import *
from default import TestDefault
from mock import patch, MagicMock
from nose.tools import assert_raises
from requests import exceptions
from pbsexceptions import ProjectNotFound
class TestPbsCreateProject(TestDefault):
"""Test cla... | PyBossa/pbs | test/test_pbs_create_project.py | Python | agpl-3.0 | 1,402 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
def configuration(parent_package='', top_path=None):
# compiles files during installation
from numpy.distutils.misc_util import Configuration
config = Configuration('cyQ', p... | Vutshi/qutip | qutip/cyQ/setup.py | Python | gpl-3.0 | 1,258 |
from django import forms
import happyforms
from django.utils.translation import ugettext_lazy as _lazy
INTERVAL_CHOICES = (
# Elasticsearch supports minute and hour but we don't.
('day', _lazy('Day')),
('week', _lazy('Week')),
('month', _lazy('Month')),
('quarter', _lazy('Quarter')),
('year',... | ingenioustechie/zamboni | mkt/stats/forms.py | Python | bsd-3-clause | 695 |
import _plotly_utils.basevalidators
class XrefValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="xref", parent_name="layout.annotation", **kwargs):
super(XrefValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/annotation/_xref.py | Python | mit | 522 |
from construct import *
TS_PACKET_LENGTH = 188
PAT_PID = 0
PES_MARKER = '\0\0\x01'
MIN_AUDIO_STREAM_ID = 0xC0
MAX_AUDIO_STREAM_ID = 0xDF
MIN_VIDEO_STREAM_ID = 0xE0
MAX_VIDEO_STREAM_ID = 0xEF
mpegTsHeader = BitStruct("mpegTsHeader",
BitField("syncByte", 8),
Flag("transportErrorIndicator"),
Flag("payloadUnitStartI... | kaltura/nginx-vod-module | test/mpeg_ts_defs.py | Python | agpl-3.0 | 3,848 |
import unittest
import sys
sys.path.append('./')
solutions = __import__('solutions.012_integer_to_roman', fromlist='*')
class Test012(unittest.TestCase):
def test_intToRoman(self):
s = solutions.Solution()
self.assertEqual(s.intToRoman(1), "I")
self.assertEqual(s.intToRoman(2), "II")
... | abawchen/leetcode | tests/012.py | Python | mit | 1,527 |
# flake8: noqa
"""Usage: from repo root, run `python3 -m unittest tests.core -v`
This test module makes sure that the `commands` packages is not imported
"""
import unittest
from unittest.mock import MagicMock
import os
import sys
import json
import tempfile
from collections import defaultdict, OrderedDict
sublime =... | kylebebak/Requester | tests/core.py | Python | mit | 10,924 |
try:
from django.utils.encoding import force_text # noqa
except ImportError:
from django.utils.encoding import force_unicode as force_text # noqa
try:
from urllib2 import urlopen # noqa
except ImportError:
from urllib.request import urlopen # noqa
| blueyed/pytest_django | tests/compat.py | Python | bsd-3-clause | 270 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='payment',
version='0.00.001.02',
packages=['payment', 'payment.amazon', 'payment.paypal'],
url='http://cosmosframework.com',
license='MIT License',
author='Maruf Maniruzzaman',
author... | kuasha/payment | setup.py | Python | mit | 889 |
from openpyxl import Workbook, load_workbook
xl = load_workbook(filename='./ipaddr.xlsx', data_only=True)
xs = xl.active
col_rang = xl['Sheet1']
cell_rang = xs['A1':'A2']
#print(col_rang['A'].value)
print ('Getting Data From :', xl.get_sheet_names())
for row in xs.iter_rows():
for cell in row:
iprecs = cel... | phasedscum/python-as-a-waffle | xcelip.py | Python | mit | 398 |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | gunan/tensorflow | tensorflow/python/framework/memory_checker_test.py | Python | apache-2.0 | 5,426 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: application.py
"""Class representing application/* type MIME documents."""
__all__ = [
'MIMEApplication']
from email import encoders
from email.mime... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/email/mime/application.py | Python | unlicense | 1,363 |
'''Find the sum of all the multiples of 3 or 5 below 1000.'''
L = [0]*1000
for i,c in enumerate(L):
if i%3 == 0 or i%5 == 0:
L[i] = i
print(sum(L))
# Alternatively
print(sum(c for c in range(1000) if c%3 == 0 or c%5 == 0))
| kluge-iitk/Project-Euler | 1.py | Python | mit | 239 |
'''
This is a GRID search to find the best parameters of an algorithm.
In future developments it will be parallelized.
In the Mountain Car Problem, for Sarsa with Tile Coding, we
have the parameters from Sutton and Barto Book
alpha = 0.5 (then divided by num tilings, so it becomes 0.5/0.8, check the implement... | SB-BISS/RLACOSarsaLambda | Mountain_Car3d_Grid_Search.py | Python | mit | 5,768 |
# coding: utf-8
from django.conf.urls import patterns, url
urlpatterns = patterns('canaa.blog.views',
url(r'^$', 'blog', name='blog'),
url(r'^(?P<slug>[\w\-]+)/$', 'post', name='post'),
)
| klebercode/canaa | canaa/blog/urls.py | Python | mit | 198 |
"""Tests for the system health component init."""
import asyncio
import pytest
from homeassistant.setup import async_setup_component
from tests.async_mock import AsyncMock, Mock
from tests.common import get_system_health_info, mock_platform
@pytest.fixture
def mock_system_info(hass):
"""Mock system info."""
... | sdague/home-assistant | tests/components/system_health/test_init.py | Python | apache-2.0 | 3,611 |
"""
WSGI config for monews project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "monews.settings")
from django.core.wsg... | Osmose/monews | monews/wsgi.py | Python | mit | 387 |
#!/usr/bin/python3
#
# Generate materials for the MSBR Serpent deck
# Ondrej Chvala, ochvala@utk.edu
# 2016-07-16
# GNU/GPL
def write_materials(lib):
'''Function to write material cards for Serpent input deck.
Inputs:
lib: String containing the neutron cross section library
to use (e.g., {lib}).
Outputs:
m... | ondrejch/MSBR-ORNL-4528 | scripts/generate-lattices/materials_old.py | Python | gpl-2.0 | 1,446 |
#
# 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
# ... | cryptickp/heat | heat/engine/clients/os/keystone.py | Python | apache-2.0 | 5,676 |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.tasks_v2beta2.proto import (
cloudtasks_pb2 as google_dot_cloud_dot_tasks__v2beta2_dot_proto_dot_cloudtasks__pb2,
)
from google.cloud.tasks_v2beta2.proto import (
queue_pb2 as google_dot_cloud_dot_tasks__v2beta2... | tseaver/google-cloud-python | tasks/google/cloud/tasks_v2beta2/proto/cloudtasks_pb2_grpc.py | Python | apache-2.0 | 29,408 |
"""
Tests of the instructor dashboard spoc gradebook
"""
from django.urls import reverse
from capa.tests.response_xml_factory import StringResponseXMLFactory
from common.djangoapps.student.tests.factories import AdminFactory, CourseEnrollmentFactory, UserFactory
from lms.djangoapps.courseware.tests.factories import St... | eduNEXT/edx-platform | lms/djangoapps/instructor/tests/test_spoc_gradebook.py | Python | agpl-3.0 | 6,317 |
'''
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
... | meisamhe/GPLshared | Research_Projects_UTD/DataScientistCompetitionCode/clickthroughratepredictionkagglecompetitioncodes/MHEDNNTTstBg0.1,1,1e-8,1e-1,10Bg3NoFilterNullRm.py | Python | gpl-3.0 | 14,344 |
import unittest
from publication import controller
class TestController(unittest.TestCase):
def test_construct_aggs(self):
aggs = controller.construct_aggs(['subject_areas'])
expected = {
"aggs": {
"subject_areas": {
"terms": {
... | fabiobatalha/publication_stats | tests/test_controller.py | Python | bsd-2-clause | 1,196 |
from collections import deque
import unittest
from test import test_support, seq_tests
from weakref import proxy
import copy
import cPickle as pickle
from cStringIO import StringIO
import random
import os
BIG = 100000
def fail():
raise SyntaxError
yield 1
class BadCmp:
def __eq__(self, other):
ra... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.5/Lib/test/test_deque.py | Python | mit | 18,684 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | keras-team/keras | keras/integration_test/tpu_strategy_test.py | Python | apache-2.0 | 8,941 |
import errno
import os
from django.test import TestCase
from cyder.base.eav.models import Attribute
from cyder.base.utils import copy_tree, remove_dir_contents
from cyder.base.vcs import GitRepo, GitRepoManager, SanityCheckFailure
from cyder.core.system.models import System
from cyder.cydhcp.build.builder import DHCP... | akeym/cyder | cyder/cydhcp/build/tests/build_tests.py | Python | bsd-3-clause | 4,906 |
# -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use Redis on Heroku
'''
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from django.util... | ej2/pixelpuncher | config/settings/production.py | Python | bsd-3-clause | 6,821 |
# Copyright 2011 OpenStack Foundation.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance w... | eayunstack/horizon | openstack_dashboard/openstack/common/log.py | Python | apache-2.0 | 26,247 |
"""
instagram.py
Instagram views
"""
import logging
import urllib.parse
from instagram.client import InstagramAPI
from flask import Blueprint, abort, request, jsonify
from werkzeug.exceptions import BadRequest
from app.decorators import crossdomain
from app.views.auth import OAUTH
from app.models.adventure import ... | myadventure/myadventure-api | app/views/instagram.py | Python | apache-2.0 | 5,115 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of t... | Panos512/invenio | modules/bibformat/lib/bibformat_engine.py | Python | gpl-2.0 | 93,306 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
class URLMappings(object):
def __init__(self, src_root, build_dir):
self.mappings = {
'dart:mojo.internal': os.path.join(s... | mxia/engine | sky/tools/skypy/url_mappings.py | Python | bsd-3-clause | 759 |
from django.utils.translation import ugettext_lazy as _
from settings.base import rel
TIME_ZONE = 'UTC'
LANGUAGES = (
('uk', _('Ukrainian')),
('en', _('English')),
('ru', _('Russian')),
)
LANGUAGE_CODE = 'uk-UA'
USE_I18N = True
USE_L10N = True
USE_TZ = True
LOCALE_PATHS = (
rel('locale'),
)
| skylifewww/pharmacognosy | settings/locale.py | Python | mit | 315 |
from rapidsms.contrib.handlers import KeywordHandler
from rapidsms.models import Contact
from ataps.apps.mothers_calendar.models import Mother, WeekNumber
from ataps.apps.mothers_calendar.tasks import query_number_of_weeks
class MotherRegistrationHandler(KeywordHandler):
keyword = "register|reg|join"
def hel... | muranga/ataps | ataps/apps/mothers_calendar/handlers/register.py | Python | unlicense | 1,275 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorflow_serving/config/platform_config.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.pr... | diplomacy/research | diplomacy_research/proto/tensorflow_serving/config/platform_config_pb2.py | Python | mit | 6,119 |
"""
Python packages
===============
This module provides tools for installing Python packages using
the ``easy_install`` command provided by `distribute`_.
.. _distribute: http://packages.python.org/distribute/
"""
from __future__ import with_statement
from fabric.api import *
def is_distribute_installed():
"... | pahaz/fabtools | fabtools/python_distribute.py | Python | bsd-2-clause | 1,880 |
from collections import OrderedDict
import pytest
from javaproperties import loads_xml
@pytest.mark.parametrize(
"s,d",
[
("<properties></properties>", {}),
(
'<properties><entry key="key">value</entry></properties>',
{"key": "value"},
),
(
'... | jwodder/javaproperties | test/test_loads_xml.py | Python | mit | 4,001 |
from collections import defaultdict
from django.utils.functional import cached_property
from mptt.utils import get_cached_trees
from rdmo.conditions.models import Condition
class ProjectWrapper(object):
def __init__(self, project, snapshot=None):
self._project = project
self._catalog = project.... | rdmorganiser/rdmo | rdmo/views/utils.py | Python | apache-2.0 | 3,612 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import pipes
import click
from . import _fileio, _pairsam_format, _headerops, cli, common_io_options
UTIL_NAME = 'pairsam_split'
@cli.command()
@click.argument(
'pairsam_path',
type=str,
required=False)
@click.option(
"--output-pairs",
t... | mirnylab/pairsamtools | pairsamtools/pairsam_split.py | Python | mit | 4,878 |
import numpy as np
import theano
import theano.tensor as T
from theano.printing import debugprint
w = theano.shared(np.float32(10.0), name = 'w')
a = T.scalar(dtype = theano.config.floatX, name = 'a')
b = T.scalar(dtype = theano.config.floatX, name = 'b')
c = a + b
f = theano.function([a], c, givens = {b : w / 2})
x... | dbchiem/dqnet | toy/givens_modify.py | Python | mit | 741 |
#!python
# I load a whole load of dependencies at the top here.
# Obviously there is overhead involved in calling in all this stuff
# but for the sake manageability I'm putting it all up here ;-)
# general
from __future__ import division
import os
import collections
import json
import time
import random
import math
... | pgchamberlin/sommelier | src/recommender.py | Python | mit | 31,427 |
"""Test Z-Wave workarounds."""
from homeassistant.components.zwave import const, workaround
from tests.mock.zwave import MockNode, MockValue
def test_get_device_no_component_mapping():
"""Test that None is returned."""
node = MockNode(manufacturer_id=' ')
value = MockValue(data=0, node=node)
assert wo... | MartinHjelmare/home-assistant | tests/components/zwave/test_workaround.py | Python | apache-2.0 | 2,679 |
#!/usr/bin/python3
import sys
blocks = []
#
# blocks is an array of paths under which we want to block by
# default.
#
# blocks[0] = ['path' = '/sys', 'children' = [A,B] ]
# blocks[1] = ['path' = '/proc/sys', 'children' = [ E ] ]
# A = [ 'path' = 'fs', children = [C] ]
# C = [ 'path' = 'cgroup', children = [F] ]... | DarknessBeforeDawn/lxc | config/apparmor/lxc-generate-aa-rules.py | Python | lgpl-2.1 | 3,766 |
#!/usr/bin/env python3
"""Implementation details for VCF/BCF access"""
import ctypes
import pyhtslib.load_dll as pl
from pyhtslib.hts_internal import * # NOQA
__author__ = 'Manuel Holtgrewe <manuel.holtgrewe@bihealth.de>'
# export everything from this submodule manually, including the code that
# starts with an un... | holtgrewe/pyhtslib | pyhtslib/bcf_internal.py | Python | bsd-3-clause | 14,952 |
# coding: utf-8
#
# Copyright 2014 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 requi... | won0089/oppia | core/tests/test_utils.py | Python | apache-2.0 | 26,631 |
# -*- coding: utf-8 -*-
# version.py
# Part of ‘python-daemon’, an implementation of PEP 3143.
#
# Copyright © 2008–2016 Ben Finney <ben+python@benfinney.id.au>
#
# This is free software: you may copy, modify, and/or distribute this work
# under the terms of the GNU General Public License as published by the
# Free So... | nyov/python-daemon | version.py | Python | gpl-3.0 | 18,554 |
# -*- coding: utf-8 -*-
"""
* Editor prompt example
"""
from __future__ import print_function, unicode_literals
from whaaaaat import style_from_dict, Token, prompt, print_json
from whaaaaat import Validator, ValidationError, default_style
questions = [
{
'type': 'editor',
'name': 'bio',
'... | finklabs/whaaaaat | examples/editor.py | Python | mit | 548 |
# Copyright (c) 2019 San Diego Regional Data Library This file is licensed under the terms of the
# Revised BSD License, included in this distribution as LICENSE
"""
"""
def parallel_process(array, function, n_jobs=16, use_kwargs=False, front_num=3):
"""
A parallel version of the map function with a pro... | sdrdl/sdipylib | sdipylib/parallel.py | Python | bsd-2-clause | 2,407 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-25 05:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('campaigns', '0006_auto_20170416_1525'),
]
operations... | watchdogpolska/petycja-norweskie | petycja_norweskie/campaigns/migrations/0007_auto_20170425_0530.py | Python | mit | 589 |
# 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
# d... | bac/horizon | openstack_dashboard/test/integration_tests/tests/test_images.py | Python | apache-2.0 | 17,057 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('game', '0002_auto_20150206_1604'),
]
operations = [
migrations.AddField(
model_name='problem',
name=... | heinzehavinga/bethepresidenttoday | game/migrations/0003_problem_actual_result.py | Python | cc0-1.0 | 462 |
#!/usr/bin/env kross
import os, sys, re, types, string, datetime, urllib
# import the reportlab module.
import reportlab
from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate
from reportlab.lib.units import inch, cm
from reportlab.lib.pagesizes import A0,A1,A2,A3,A4,A5,A6,B0,B1,B2,B3,B4,B5,B6,lette... | KDE/calligra-history | kword/plugins/scripting/scripts/kwreportlab.py | Python | gpl-2.0 | 18,197 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# kvector documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... | olgabot/kvector | docs/conf.py | Python | bsd-3-clause | 8,419 |
from bgenOutput import *
from bgenGeneratorGroup import GeneratorGroup
class Module(GeneratorGroup):
def __init__(self, name, prefix = None,
includestuff = None,
finalstuff = None,
initstuff = None,
variablestuff = None):
GeneratorGroup.__init__(self, prefix or name)
self.name = name
... | kidmaple/CoolWall | user/python/Tools/bgen/bgen/bgenModule.py | Python | gpl-2.0 | 2,260 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
import sys
import struct
from pokemongo_bot.event_manager import EventHandler
class ColoredLoggingHandler(EventHandler):
EVENT_COLOR_MAP = {
'api_error': 'red',
'bot_exit': 'r... | tibotic/simple-pokemongo-bot | pokemongo_bot/event_handlers/colored_logging_handler.py | Python | mit | 7,247 |
# -*- coding: utf-8 -*-
from openerp import http, SUPERUSER_ID
from openerp.http import request
class MassMailController(http.Controller):
@http.route(['/mail/mailing/<int:mailing_id>/unsubscribe'], type='http', website=True, auth='none')
def mailing(self, mailing_id, email=None, res_id=None, **post):
... | minhphung171093/GreenERP | openerp/addons/website_mass_mailing/controllers/main.py | Python | gpl-3.0 | 3,640 |
class SomeClass:
@classmethod
def foo(cls, arg2, arg1):
pass
SomeClass.foo(2, 1)
SomeClass().foo(2, 1) | jwren/intellij-community | python/testData/refactoring/changeSignature/classMethod.after.py | Python | apache-2.0 | 120 |
"""
We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11).
Now given a string represented by several bits. Return whether the last character must be a one-bit character or not. The given string will always end with a zero.
E... | franklingu/leetcode-solutions | questions/1-bit-and-2-bit-characters/Solution.py | Python | mit | 1,231 |
import abc
import json
import requests
from zdict import exceptions
from zdict.models import Record, db
from zdict.utils import Color
class DictBase(metaclass=abc.ABCMeta):
REQUIRED_TABLE = (
Record,
)
def __init__(self, args):
self.args = args
self.color = Color()
self... | M157q/zdict | zdict/dictionary.py | Python | gpl-3.0 | 5,557 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class EmmiscraperItem(scrapy.Item):
product = scrapy.Field()
price = scrapy.Field()
img_url = scrapy.Field()
description = scrapy.Field(... | Lazar-T/E-Commerce-scraper | emmiScraper/items.py | Python | mit | 355 |
#coding: UTF-8
'''This script would guide the seafile admin to setup seafile with MySQL'''
import sys
import os
import time
import re
import shutil
import glob
import subprocess
import hashlib
import getpass
import uuid
import warnings
import MySQLdb
from ConfigParser import ConfigParser
try:
import readline # ... | raghon1/seafile | docker-suitecrm/scripts/setup-seafile-mysql.py | Python | gpl-3.0 | 45,788 |
# -*- coding: utf-8 -*-
#
# scrapy-sentry documentation build configuration file, created by
# sphinx-quickstart on Mon Mar 11 12:47:00 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#... | noelmf/scrapy-sentry | docs/conf.py | Python | bsd-3-clause | 8,052 |
"""
Support for the LIFX platform that implements lights.
This is a legacy platform, included because the current lifx platform does
not yet support Windows.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.lifx/
"""
import logging
import voluptuou... | PetePriority/home-assistant | homeassistant/components/light/lifx_legacy.py | Python | apache-2.0 | 7,494 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/oval_5/sc/unix/EntityItemEncryptMethodType.py | Python | gpl-3.0 | 1,167 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from exception import PathException
from misc import Logger
class Path(object):
'''
@summary: should be responsible for static translation of routes
'''
def __init__(self):
self.routes = {
'Master': {
... | wzin/interactivespaces-python-api | interactivespaces/abstract.py | Python | apache-2.0 | 5,188 |
# 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/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/aio/operations/_registries_operations.py | Python | mit | 10,205 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Gu1
# Licensed under the MIT license
import os
import pyrax
import pyrax.exceptions as exc
import requests
import re
import urlparse
import ConfigParser
import time
from pyrax.base_identity import BaseIdentity, Service
from requests.compat import quote... | muff1nman/duplicity | duplicity/backends/pyrax_identity/hubic.py | Python | gpl-2.0 | 9,344 |
# -*- coding: utf-8 -*-
"""
(c) 2014-2016 - Copyright Red Hat Inc
Authors:
Pierre-Yves Chibon <pingou@pingoured.fr>
"""
from __future__ import unicode_literals, absolute_import
import sqlalchemy as sa
import wtforms
try:
from flask_wtf import FlaskForm
except ImportError:
from flask_wtf import Form a... | pypingou/pagure | pagure/hooks/pagure_request_hook.py | Python | gpl-2.0 | 3,496 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
class SmallSMILHandler(ContentHandler):
def __init__(self):
self.tags = []
self.dicc = {'root-layout': ['width', 'height', 'background-color'],
'region': ['... | rpaunero/ptavi-p3 | smallsmilhandler.py | Python | apache-2.0 | 1,170 |
import random
import datetime
import psycopg2
from collections import deque
from tornado.stack_context import wrap
from tornado.ioloop import IOLoop
from tornado.concurrent import return_future
class WrapCursor:
def __init__(self,db,cur):
self._db = db
self._cur = cur
self._oldcur = None
... | pzread/sdup | pg.py | Python | mit | 8,196 |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
i... | kubevirt/client-python | test/test_v1_interface_slirp.py | Python | apache-2.0 | 909 |
"""
[2017-05-31] Challenge #317 [Intermediate] Counting Elements
https://www.reddit.com/r/dailyprogrammer/comments/6eerfk/20170531_challenge_317_intermediate_counting/
#Description
Chemical formulas describe which elements and how many atoms comprise a molecule. Probably the most well known chemical
formula, H2O, tel... | DayGitH/Python-Challenges | DailyProgrammer/DP20170531B.py | Python | mit | 1,814 |
import sys
import os
sys.path.insert(0, os.path.abspath('..'))
extensions = ['sphinx.ext.autodoc', 'sphinxcontrib.napoleon']
source_suffix = '.rst'
master_doc = 'index'
project = u'Elma Python Library'
copyright = u'2015, Elma Library Contributors'
exclude_patterns = ['_build']
pygments_style = 'sphinx'
todo_include_t... | sigvef/elma | docs/conf.py | Python | mit | 365 |
# -*- coding: utf-8 -*-
#
# oseoserver documentation build configuration file, created by
# sphinx-quickstart on Tue May 5 17:24:02 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
... | pyoseo/django-oseoserver | docs/conf.py | Python | apache-2.0 | 8,228 |
#!/usr/bin/env python
#
# Copyright 2007 The Closure Linter 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
#... | karmis/ncf | src/Brainstrap/Core/NCBundle/Resources/public/js/libs/cron.js-master/closure/linter/closure_linter/tokenutil.py | Python | mit | 10,542 |
""" This module implements features specific for HTTP Processing """
# Michael Cohen <scudette@users.sourceforge.net>
# Gavin Jackson <gavz@users.sourceforge.net>
#
# ******************************************************
# Version: FLAG $Version: 0.87-pre1 Date: Thu Jun 12 00:48:38 EST 2008$
# ***********************... | anarchivist/pyflag | src/plugins/NetworkForensics/ProtocolHandlers/FTP.py | Python | gpl-2.0 | 25,639 |
# -*- coding: utf-8 -*-
import os
from random import randrange
from time import perf_counter
def test(expr):
global nbc
nbc += 1
return expr
def insere(x, t):
if t == [] or test(x >= t[-1]):
t.append(x)
return t
else:
tt = insere(x, t[:-1])
tt.append(t[-1])
... | NicovincX2/Python-3.5 | Algorithmique/Algorithme/Algorithme de tri/Tri par insertion/tri_insertion_rec.py | Python | gpl-3.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 | mol_dqn/experimental/multi_obj_gen.py | Python | apache-2.0 | 4,724 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 University of Dundee & Open Microscopy Environment.
# All Rights Reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
"""
FOR TRAINING PURPOSES ONLY!
"""
from omero.gateway import BlitzGateway
from Parse_OMERO_Pr... | dominikl/openmicroscopy | examples/Training/python/Groups_Permissions.py | Python | gpl-2.0 | 2,523 |
"""
Copyright 2010 Sami Dalouche
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 ... | pymager/pymager | pymager/imgengine/_transformationrequest.py | Python | apache-2.0 | 1,555 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Pyromaths
# Un programme en Python qui permet de créer des fiches d'exercices types de
# mathématiques niveau collège ainsi que leur corrigé en LaTeX.
# Copyright (C) 2006 -- Jérôme Ortais (jerome.ortais@pyromaths.org)
#
# This program is free software; you can redistribute... | JeromeO/Pyromaths | src/pyromaths/ex/cinquiemes/aires.py | Python | gpl-2.0 | 4,395 |
##~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~##
## ##
## This file forms part of the pyReefCore synthetic coral reef core model app. ##
## ... | pyReef-model/pyReefCore | pyReefCore/forcing/preProc.py | Python | gpl-3.0 | 7,181 |
#!/usr/bin/python3
def isprime(n):
if n == 1:
return False
for x in range(2, n):
if n % x == 0:
return False
else:
return True
def primes(n = 1):
while(True):
if isprime(n): yield n
n += 1
for n in primes():
if n > 100: break
print(n)
| hckrtst/learnpython | py3_essential_training/02 Quick Start/generator.py | Python | mit | 313 |
from __future__ import print_function
from Chessnut import Game
from pystockfish import *
import sys, subprocess
if len(sys.argv) < 2 or 'help' in sys.argv[1]:
print('Usage:\n python evaluate_move.py [FEN]')
print('Reply: [best_move] [NEW_FEN] if valid, otherwise error')
sys.exit(0);
fen = sys.argv[1]... | michaelx11/chess-server | evaluate_move.py | Python | mit | 818 |
import json
import re
class Base(object):
def __init__(self, test, test_client):
self.test_client = test_client
self.test = test
self._endpoint = None
self.params = None
self.status_code = None
self.response = None
self.headers = None
self.route = No... | not-nexus/shelf | tests/route_tester/base.py | Python | mit | 5,737 |
from sense_hat import SenseHat
sense = SenseHat()
# Display
#sense.show_message("Green Syntaxx ")
# Humidity
humidity = sense.get_humidity()
print("Humidity is %s %%rH" %humidity)
# Temperature
temperature = sense.get_temperature()
print("Temperature is %s C" % temperature)
# Barometric Pressure
pressure = sense... | greenSyntax/AWS-RaspberryPi | RaspberyPi AWS/AWS/sense.py | Python | mit | 563 |
# -*- coding: utf-8 -*-
__author__ = """Matthieu Berjon"""
__email__ = 'matthieu@berjon.net'
__version__ = '0.2.3'
| earswideopen/ewo | ewo/__init__.py | Python | gpl-2.0 | 116 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import re
import json
import requests
import flask
reload(sys)
sys.setdefaultencoding('utf-8')
GITHUB_MENTION = re.compile(
# Start with a non-word-boundary (ensuring the part before this can't be a word)
# Followed by an @ (ensuring emails should w... | Saevon/github-slack-bot | github.py | Python | mit | 5,028 |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | geokala/cloudify-cli | cloudify_cli/tests/commands/test_status.py | Python | apache-2.0 | 2,164 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class SpiderTemplateItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
| hanbox/spider_template | spider_template/spider_template/items.py | Python | mit | 292 |
# Windows service wrapper for oVirt Guest Agent
# The service is converted into an exe-file with py2exe
import ConfigParser
import _winreg
import cStringIO
import io
import logging
import logging.config
import os
import os.path
import servicemanager
import win32evtlogutil
import win32service
import win32serviceutil
... | oVirt/ovirt-guest-agent | ovirt-guest-agent/OVirtGuestService.py | Python | apache-2.0 | 4,724 |
"""
Module that makes it possible to extract information from a treeview
without having information about the treemodel, as we may not from inside PyUsecase
"""
import gtk
from storytext.guishared import removeMarkup
# This is the important information, used by other classes
cellRendererExtractors = {}
# For CellE... | emilybache/texttest-runner | src/main/python/storytext/lib/storytext/gtktoolkit/treeviewextract.py | Python | mit | 8,813 |
def board():
pass
| rootulp/xpython | exercises/minesweeper/minesweeper.py | Python | mit | 22 |
# Copyright 2007,2008,2009,2011 Everyblock LLC, OpenPlans, and contributors
#
# This file is part of ebdata
#
# ebdata 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,... | konfabproject/konfab-consumer | ebdata/templatemaker/listdiff.py | Python | gpl-3.0 | 4,034 |
from .resources.main import getUserDate, getUserTime, getUserDateTime
VERSION = '0.1.2'
| maxwellgerber/getTimer | getTimer/__init__.py | Python | mit | 88 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.