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 |
|---|---|---|---|---|---|
"""
Module for code that should run during Studio startup (deprecated)
"""
import django
from django.conf import settings
# Force settings to run so that the python path is modified
settings.INSTALLED_APPS # pylint: disable=pointless-statement
def run():
"""
Executed during django startup
NOTE: DO **N... | Stanford-Online/edx-platform | cms/startup.py | Python | agpl-3.0 | 650 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
# Cosm.com to CSV
# Copyright (C) 2013 by Xose Pérez
#
# 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 Soft... | xoseperez/mqtt2cloud | cosm2csv.py | Python | gpl-3.0 | 2,269 |
# -*- coding: utf-8 -*-
import moose
import re
def fixPath(path):
path = re.sub(r'/+', '/', path)
return path
paths = [ '/a'
, '//a'
, '/a/b'
, '/a/b/'
, '//a//b/////'
, '/a/./b'
, '///a/././b'
]
expectedPath = [fixPath(p) for p in paths]
expectedChange... | dharmasam9/moose-core | tests/python/test_accessing_existing_paths.py | Python | gpl-3.0 | 827 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution Addon
# Copyright (C) 2009-2012 IRSID (<http://irsid.ru>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the ... | prospwro/odoo | addons/irsid_base/__openerp__.py | Python | agpl-3.0 | 1,538 |
from boardme import db
import datetime
from sqlalchemy.orm import relationship
from werkzeug import generate_password_hash, check_password_hash
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
first_name = db.Column(db.String(128))
last_name = db.Column(db.St... | DextrousInc/board-me-server | wsgi/boardme/models/users.py | Python | mit | 1,768 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# yandex-search 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... | fluquid/yandex-search | docs/conf.py | Python | mit | 8,370 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you c... | kaji-project/shinken | shinken/pollerlink.py | Python | agpl-3.0 | 2,235 |
##############################################################################
#
# Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | CompassionCH/compassion-modules | child_compassion/models/gmc_message.py | Python | agpl-3.0 | 641 |
from prismriver.plugin.common import Plugin
from prismriver.struct import Song
# todo: load lyrics translations
class MusixmatchPlugin(Plugin):
ID = 'musixmatch'
RANK = 6
def __init__(self, config):
super(MusixmatchPlugin, self).__init__('Musixmatch', config)
def search_song(self, artist, t... | anlar/prismriver | prismriver/plugin/musixmatch.py | Python | mit | 1,445 |
import pydot
class Node:
count = 0
type = 'Node (unspecified)'
shape = 'ellipse'
def __init__(self,children=None):
self.ID = str(Node.count)
Node.count+=1
if not children:
self.children = []
elif hasattr(children,'__len__'):
self.children =... | roberseik/Python-Compiler | AST.py | Python | gpl-2.0 | 4,039 |
import numpy as np
from scipy.optimize import linear_sum_assignment
from ...utils.validation import check_consistent_length, check_array
__all__ = ["consensus_score"]
def _check_rows_and_columns(a, b):
"""Unpacks the row and column arrays and checks their shape."""
check_consistent_length(*a)
check_cons... | chrsrds/scikit-learn | sklearn/metrics/cluster/bicluster.py | Python | bsd-3-clause | 2,762 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer, RESPONSE_HEADER_SIZE
from hazelcast.protocol.codec.custom.raft_group_id_codec import RaftGroupIdCodec
from hazel... | hazelcast/hazelcast-python-client | hazelcast/protocol/codec/fenced_lock_lock_codec.py | Python | apache-2.0 | 1,475 |
import logging
from allauth.socialaccount.models import SocialToken
from django.conf import settings
from requests_oauthlib import OAuth2Session
from .models import GithubProject, GithubOrganization, BitbucketProject, BitbucketTeam
from tastyapi import apiv2
log = logging.getLogger(__name__)
def make_github_proje... | adrianmugnoz/Documentacion-Divulgame | readthedocs/oauth/utils.py | Python | mit | 7,756 |
# coding: utf-8
# Copyright 2014 Globo.com Player authors. All rights reserved.
# Use of this source code is governed by a MIT License
# license that can be found in the LICENSE file.
from collections import namedtuple
import os
import errno
import math
from parser import parse, format_date_time
from mixins import Ba... | olavopeixoto/plugin.video.brplay | resources/lib/modules/m3u8/model.py | Python | gpl-3.0 | 23,467 |
# LIBTBX_PRE_DISPATCHER_INCLUDE_SH export PHENIX_GUI_ENVIRONMENT=1
# DIALS_ENABLE_COMMAND_LINE_COMPLETION
# LIBTBX_SET_DISPATCHER_NAME dials.reciprocal_lattice_viewer
# LIBTBX_SET_DISPATCHER_NAME dials.rlv
from __future__ import annotations
import copy
import os
import wxtbx.app
from scitbx.array_family import flex
... | dials/dials | command_line/reciprocal_lattice_viewer.py | Python | bsd-3-clause | 2,225 |
#!/usr/bin/python
# Copyright 2017 Google Inc. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by app... | huyhg/runtimes-common | runtime_builders/builder_util.py | Python | apache-2.0 | 5,271 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity 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
# ... | ssujit/mca | docs/conf.py | Python | bsd-3-clause | 8,333 |
from __future__ import absolute_import
from django.utils import timezone
from rest_framework.response import Response
from sentry.api.base import Endpoint
from sentry.api.permissions import assert_perm
from sentry.db.models import create_or_update
from sentry.models import Project, Group, GroupSeen
from sentry.utils.... | camilonova/sentry | src/sentry/api/endpoints/group_markseen.py | Python | bsd-3-clause | 1,098 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# operations.py
#
# Copyright 2016 Bruno S <bruno@oac.unc.edu.ar>
#
# This file is part of ProperImage (https://github.com/toros-astro/ProperImage)
# License: BSD-3-Clause
# Full Text: https://github.com/toros-astro/ProperImage/blob/master/LICENSE.txt
#
"""operations m... | toros-astro/ProperImage | properimage/operations.py | Python | bsd-3-clause | 20,993 |
import numpy
def doPCA(data, dim):
data = makeDataMatrix(data)
means = getMeanVector(data)
data = normalizeData(data, means)
cov = getCov(data)
eigvals, eigvecs = getEigs(cov)
principalComponents = sortEigs(eigvals, eigvecs)
return getDimensions(dim, principalComponents)
def getDimensions... | hakuliu/inf552 | hw3/pca.py | Python | apache-2.0 | 1,541 |
# $Filename$$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
#
... | DLR-SC/DataFinder | test/unittest/datafinder_test/persistence/common/configuration_test.py | Python | bsd-3-clause | 3,995 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing M2M table for field assets on 'AssetType'
db.delete_table('AppDistribution_assettype_assets')
... | ridecharge/spout | AppDistribution/migrations/0020_auto__add_field_appasset_asset_type.py | Python | bsd-3-clause | 9,266 |
import kivy
from kivy.app import App
from kivy.lang import Builder
from kivy.logger import Logger
import logging
kivy.require('1.9.0')
# Logger.setLevel(logging.DEBUG)
import kivy.garden.contextmenu
kv = """
FloatLayout:
id: layout
AppMenu:
id: app_menu
top: root.height
cancel_handle... | Bakterija/mmplayer | mmplayer/other/garden_contextmenu/examples/simple_app_menu.py | Python | mit | 2,416 |
import logging
import random
import time
import config
# uncomment only one
#
logging.basicConfig(format='%(message)s', level=logging.INFO)
#logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
# load camera configuration
#
try:
settings = config.camera
except:
settings = {}
# transm... | MartinPaques/smart-video-counter | source/test_updater.py | Python | apache-2.0 | 843 |
#!/usr/bin/env python3
from anormbookmarker.test.test_enviroment import *
with self_contained_session(CONFIG.database_timestamp) as session:
BASE.metadata.create_all(session.bind)
# make a tag to make an alias to
aa = Tag.construct(session=session, tag='a a')
session.commit()
db_result = [('select CO... | jakeogh/anormbookmarker | anormbookmarker/test/tests/Tag/two_single_char_words.py | Python | mit | 876 |
# 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/__init__.py | Python | mit | 2,687 |
import bcrypt
import tempfile
from datetime import datetime
from hashlib import sha256, sha1
from dictshield.base import ShieldException
from dictshield.fields import StringField, IntField, DateTimeField, EmailField, URLField
from psycopg2 import DatabaseError
from boto.s3.key import Key
from boardhood.models.base im... | mayconbordin/boardhood | server_app/api/boardhood/models/users.py | Python | mit | 6,641 |
# Copyright 2006 James Tauber and contributors
#
# 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 agre... | lovelysystems/pyjamas | library/pyjamas/ui/FlexCellFormatter.py | Python | apache-2.0 | 1,299 |
from mrcrowbar.colour import TEST_PALETTE
from mrcrowbar import models as mrc
from mrcrowbar.lib.images import base as img
class TIMFile( mrc.Block ):
file_name = mrc.Bytes( length=13 )
size = mrc.UInt32_LE()
data = mrc.Bytes( length=mrc.Ref( "size" ) )
@property
def repr( self ):
return... | moralrecordings/mrcrowbar | mrcrowbar/lib/games/sierra.py | Python | bsd-3-clause | 2,635 |
import unittest
import sys
sys.path.append('../')
sys.path.append('../entities')
from SourceDAO import SourceDAO
from Source import Source
class SourceTestCase(unittest.TestCase):
hash = 'fake_hash_3453k24j5hk234j5h32kj5kjb345'
def testInsert(self):
sdao = SourceDAO()
source = Source()
... | tassia/DonkeySurvey | src/database/tests/SourceTestCase.py | Python | gpl-3.0 | 1,220 |
import time, hashlib
start = time.time()
prev = hashlib.md5(str(0).encode('utf-8')).hexdigest()
for i in range(1, 1000):
dict = {}
for j in range(1, 1000):
dict[hashlib.md5(str(j).encode('utf-8')).hexdigest()] = j
dict = sorted(dict)
end = time.time()
print("{0} sec.".format(end - start))
| Hast/Benchmark | python/dictionaries.py | Python | gpl-3.0 | 313 |
# -*- test-case-name: twisted.words.test.test_jabbersaslmechanisms -*-
#
# Copyright (c) 2001-2007 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Protocol agnostic implementations of SASL authentication mechanisms.
"""
import md5, binascii, random, time, os
from zope.interface import Interface, Attribut... | hortonworks/hortonworks-sandbox | desktop/core/ext-py/Twisted/twisted/words/protocols/jabber/sasl_mechanisms.py | Python | apache-2.0 | 6,610 |
# -*- 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-spanner | samples/generated_samples/spanner_v1_generated_database_admin_create_database_async.py | Python | apache-2.0 | 1,667 |
"""
django admin page for the course creators table
"""
from course_creators.models import CourseCreator, update_creator_state, send_user_notification, send_admin_notification
from course_creators.views import update_course_creator_group
from ratelimitbackend import admin
from django.conf import settings
from django.... | xiandiancloud/edx-platform | cms/djangoapps/course_creators/admin.py | Python | agpl-3.0 | 4,561 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop 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.db.transaction import atomic
from django.http.response import JsonResponse
from django.s... | hrayr-artunyan/shuup | shuup/front/apps/saved_carts/views.py | Python | agpl-3.0 | 5,738 |
import decimal
import ipaddr
from django.contrib.auth import models as auth_models
from django.core import exceptions
from django.db.models import *
from nodehub import forms
from nodehub import utils
class IPAddressField(Field):
__metaclass__ = SubfieldBase
description = 'An IP address stored as a decimal'
... | crazed/nodehub | nodehub/db/models.py | Python | mit | 3,164 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.settings import WAF_ATTACK_VECTORS
__product__ = "ExpressionEngine (EllisLab)"
def detect(get_page):
retval = False
for vector in WAF_ATTACK_VECTORS:
... | glaudsonml/kurgan-ai | tools/sqlmap/waf/expressionengine.py | Python | apache-2.0 | 462 |
import os
ROOT_PATH = os.path.dirname(__file__)
TEMPLATE_DEBUG = DEBUG = True
MANAGERS = ADMINS = ()
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = os.path.join(ROOT_PATH, 'testdb.sqlite')
TIME_ZONE = 'America/Chicago'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = True
MEDIA_ROOT = ''
MEDIA_URL = ''
ADMIN_MEDIA_PREFIX ... | bjarnoldus/django-roa | examples/twitter_roa/settings.py | Python | bsd-3-clause | 2,042 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from py3status.autodoc import (
create_auto_documentation,
Py3statusLexer,
ScreenshotDirective,
)
from py3status.version import version as py3_version
# py3status documentation build configuration file, created by
# sphinx-quickstart on Mon Mar 6 1... | Andrwe/py3status | doc/conf.py | Python | bsd-3-clause | 5,565 |
#!/usr/bin/env python
# encoding: utf-8
name = "Solute Descriptors"
shortDesc = u""
longDesc = u"""
From Abraham J. Chem. Soc. 1994
"""
entry(
index = 1,
label = "methane",
molecule = "C",
solute = SoluteData(
S = 0,
B = 0,
E = 0,
L = -0.323,
A = 0,
V = 0... | Molecular-Image-Recognition/Molecular-Image-Recognition | code/rmgpy/test_data/testing_database/solvation/libraries/solute.py | Python | mit | 1,145 |
from sqlalchemy.sql import text
from featuring import db
from featuring.entities.ticket.models import Ticket
from featuring.utilities.common import maybe_update
from .persistence import normalize_db_update_err, normalize_db_fetch_err
# ----------------------------------------------------------------------------------... | ccortezia/featuring | featuring-flask-api/featuring/controllers/crud_ticket.py | Python | mit | 6,593 |
#!/usr/bin/env python
from __future__ import division, absolute_import, unicode_literals
import re
import sys
from qtpy.QtCore import Qt
from qtpy.QtCore import QEvent
from qtpy.QtCore import Signal
from qtpy.QtGui import QMouseEvent
from qtpy.QtGui import QSyntaxHighlighter
from qtpy.QtGui import QTextCharFormat
from... | Vdragon/git-cola | cola/widgets/spellcheck.py | Python | gpl-2.0 | 4,261 |
# coding: utf-8
from django.test import TestCase
from feedhoos.worker.models.entry import EntryModel
from feedhoos.worker.models.entry import MAX_CONTENT_LENGTH
import datetime
from feedparser import FeedParserDict
class EntryModelTestCase(TestCase):
fixtures = [
'feedhoos/fixtures/entry.json',
]
... | 38elements/feedhoos | feedhoos/tests/entry.py | Python | mit | 3,528 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
int_or_none,
float_or_none,
unified_timestamp,
url_or_none,
)
class VzaarIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|view)\.)?vzaar\.com/(?:videos/)... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/vzaar.py | Python | gpl-3.0 | 2,278 |
'''
Created on 01/11/2013
@author: Dani
Just some functions used for a basic perceptron
The objectives for this module is to introduce perceptron as matrices
and consequently a little introduction for numpy
'''
import numpy as np
def costFunction(theta,X,y):
J=0 # costFunction
grad = np.zeros(theta.shape) # ... | DaniM/mscthesis | ANN/LinearRegressionPerceptron.py | Python | gpl-3.0 | 1,056 |
'''
-----------------------------------------------------------
BaseHTTPServer - base classes for implementing web servers:
-----------------------------------------------------------
Purpose: BaseHTTPServer includes classes that can form the basis of a web server.
Available In: 1.4 and later
BaseHTTPServer uses clas... | rolandovillca/python_basis | web/http_server_get_threading.py | Python | mit | 1,984 |
"""Data in internal awss structures for testing awss test scripts.
Contains:
ii_noami (dict) = instance dict without AMI name.
ii_all (dict) = instance dict with AMI name.
ami_lookup (dict) = lookup dict with ami-number: name.
ami_user_lu (list) = list of tuples with login-name: ami-name.
... | robertpeteuil/aws-shortcuts | test/awsstestdata.py | Python | gpl-3.0 | 13,661 |
#!/usr/bin/env python3
import os
import time
import json
import requests
import sys
GAME = "/Users/{}/Library/Application Support/Toontown Rewritten/Toontown Rewritten".format(os.getlogin())
DYLD_LIBRARY_PATH = "/Users/{}/Library/Application Support/Toontown Rewritten/Libraries.bundle".format(os.getlogin())
DYLD_FRA... | Omeryl/TTR-Launcher | launcher.py | Python | mit | 2,997 |
"""Some utilities specific to modifying config files.
"""
import os
import os.path
import sys
import logging
import tempfile
import shutil
import engage_utils.process as processutils
import file as fileutils
from log_setup import setup_engage_logger
logger = setup_engage_logger(__name__)
from regexp import *
def _... | quaddra/engage | python_pkg/engage/utils/cfg_file.py | Python | apache-2.0 | 6,149 |
import py
from rpython.flowspace.model import SpaceOperation, Constant, Variable
from rpython.rtyper.lltypesystem import lltype, llmemory, rffi
from rpython.translator.unsimplify import varoftype
from rpython.rlib import jit
from rpython.jit.codewriter import support, call
from rpython.jit.codewriter.call import CallC... | jptomo/rpython-lang-scheme | rpython/jit/codewriter/test/test_call.py | Python | mit | 11,707 |
"""
Unittests for gst-switch Python-API
"""
| timvideos/gst-switch | python-api/tests/unittests/__init__.py | Python | gpl-3.0 | 44 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import re
import sys
from stgit.run import Run, RunException
class VersionUnavailable(Exception):
pass
def git_describe_version():
root = sys.path[0] if sys.path[0] else None
try:
... | ctmarinas/stgit | stgit/version.py | Python | gpl-2.0 | 2,161 |
import pytest
from registry.utils import pass_spec_parser, pass_spec_builder
PASS_SPECS = {
'': [],
' ': [],
'a': [],
'111': [111],
'111,112': [111, 112],
'111, 112': [111, 112],
'111-113': [111, 112, 113],
'111 - 113': [111, ... | arsgeografica/kinderstadt-registry | test/unit/test_pass_spec.py | Python | gpl-3.0 | 1,112 |
import pytest
import mock
from datetime import timedelta
from awx.main.scheduler import TaskManager
from awx.main.models import InstanceGroup, WorkflowJob
from awx.main.tasks import apply_cluster_membership_policies
@pytest.mark.django_db
def test_multi_group_basic_job_launch(instance_factory, default_instance_group,... | wwitzel3/awx | awx/main/tests/functional/task_management/test_rampart_groups.py | Python | apache-2.0 | 9,820 |
# -*- coding: utf-8 -*-
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | fishjord/gsutil | gslib/cloud_api_helper.py | Python | apache-2.0 | 3,237 |
# Generated by Django 2.0.3 on 2018-03-21 09:17
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("page", "0001_initial")]
operations = [
migrations.AddField(
model_name="page",
name="seo_descriptio... | maferelo/saleor | saleor/page/migrations/0002_auto_20180321_0417.py | Python | bsd-3-clause | 870 |
#!/usr/bin/env python
##############################################################################
# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompan... | dtudares/hello-world | yardstick/tests/unit/benchmark/scenarios/networking/test_netperf_node.py | Python | apache-2.0 | 3,858 |
from numpy import pi
class Circunferencia(object):
def __init__(self, raio):
self.raio = raio
def area(self):
return pi*self.raio**2
def perimetro(self):
return 2*self.raio*pi
def main():
a = Circunferencia(3)
b = Circunferencia(10)
print(a.perimetro())
print(b.p... | moisesoliv/ProgAvanc | classe.py | Python | mit | 372 |
# Copyright (c) 2014 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | rdo-management/neutron | neutron/db/migration/migrate_to_ml2.py | Python | apache-2.0 | 20,776 |
""" Testing array writer objects
Array writers have init signature::
def __init__(self, array, out_dtype=None, order='F')
and methods
* to_fileobj(fileobj, offset=None)
They do have attributes:
* array
* out_dtype
* order
They may have attributes:
* slope
* inter
They are designed to write arrays to a file... | ME-ICA/me-ica | meica.libs/nibabel/tests/test_arraywriters.py | Python | lgpl-2.1 | 25,258 |
#from distutils.core import setup
from setuptools import setup
setup(name='F_UNCLE',
version='1.0',
description='Functional UNcertainty Constrained by Law and Experiment',
author='Stephen A Andrews and Andrew M Fraser',
author_email='afraser@lanl.gov',
packages=['F_UNCLE'],
)
| fraserphysics/F_UNCLE | setup.py | Python | gpl-2.0 | 314 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
print "Content-Type: text/plain ; charset=utf-8\n"
print "Une page de texte brut en CGI-Python"
| remilap/Raspberry_dev | www/cgi-bin/testcgi.py | Python | gpl-3.0 | 143 |
"""
Test the about xblock
"""
import datetime
import pytz
from ccx_keys.locator import CCXLocator
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from mock import patch
from nose.plugins.attrib import attr
from course_modes.models import Co... | fintech-circle/edx-platform | lms/djangoapps/courseware/tests/test_about.py | Python | agpl-3.0 | 25,930 |
import torch as t
from torch.autograd import Variable as V
from torch import FloatTensor as FT
import numpy as np
from bayestorch.hmc import HMCSampler
class SimpleTrainer:
def __init__(self, env,critic,hallucinator,policy_buffer,policy_c, noise_dim):
self.env = env
self.hallucinator = hallucinator... | fizz-ml/policybandit | trainer.py | Python | mit | 3,859 |
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils.facts.virtual import linux
def mock_os_path_is_fil... | ansible/ansible | test/units/module_utils/facts/virtual/test_linux.py | Python | gpl-3.0 | 1,613 |
# -*- coding: utf-8 -*-
#
# Copyright © 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or impli... | rbramwell/pulp | client_consumer/pulp/client/__init__.py | Python | gpl-2.0 | 650 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of the Shiboken Python Bindings Generator project.
#
# Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
#
# Contact: PySide team <contact@pyside.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms... | o11c/shiboken2 | tests/samplebinding/privatedtor_test.py | Python | gpl-2.0 | 3,309 |
# ===============================================================================
# Copyright 2016 ross
#
# 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/LICE... | NMTHydro/Recharge | zobs/ross/etrm_app.py | Python | apache-2.0 | 3,451 |
"""rules
Revision ID: 35088e32c557
Revises: d759891ddbf4
Create Date: 2019-11-18 14:20:23.661254
"""
from alembic import op
import sqlalchemy as sa
import datetime
import logging
log = logging.getLogger(__name__)
# revision identifiers, used by Alembic.
revision = '35088e32c557'
down_revision = 'd759891ddbf4'
bran... | hydraplatform/hydra-base | hydra_base/db/alembic/versions/35088e32c557_rules.py | Python | lgpl-3.0 | 5,229 |
bl_info = {
"name": "AC3D v2 (.ac)",
"category": "Import-Export",
"author": "ZLSA",
"description": "Import and export AC3D files",
"location": "File > Import/Export > AC3D v2",
"version": (0, 1),
"blender": (2, 72, 0),
"warning": "Alpha",
}
import bpy
from bpy.props impor... | zlsa/io_scene_ac3d_v2 | __init__.py | Python | mit | 8,159 |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~~~... | bmi-forum/bmi-pyre | pythia-0.8/packages/pyre/pyre/units/speed.py | Python | gpl-2.0 | 742 |
from pandac.PandaModules import *
from toontown.toonbase.ToonBaseGlobal import *
from direct.interval.IntervalGlobal import *
from BattleBase import *
from direct.distributed.ClockDelta import *
from toontown.toonbase import ToontownBattleGlobals
from direct.distributed import DistributedNode
from direct.fsm import Cla... | linktlh/Toontown-journey | toontown/battle/DistributedBattleBase.py | Python | apache-2.0 | 61,661 |
"""Test state helpers."""
import asyncio
from datetime import timedelta
import unittest
from unittest.mock import patch
import homeassistant.core as ha
from homeassistant.setup import async_setup_component
from homeassistant.const import (SERVICE_TURN_ON, SERVICE_TURN_OFF)
from homeassistant.util.async_ import run_cor... | molobrakos/home-assistant | tests/helpers/test_state.py | Python | apache-2.0 | 8,089 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module contains the NewRect class.
"""
from harpia.GUI.fieldtypes import *
from harpia.model.plugin import Plugin
class NewRect(Plugin):
"""
This class contains methods related the NewRect class.
"""
# ---------------------------------------------... | flschiavoni/harpia | harpia/extensions/c/opencv/newRect.py | Python | gpl-3.0 | 2,398 |
'''
A Mini-implementation of the Storlet middleware filter.
@author: josep sampe
'''
from swift.common.utils import get_logger
from swift.common.utils import register_swift_info
from swift.common.swob import Request
from swift.common.utils import config_true_value
from storlets.swift_middleware.handlers.base import Sw... | Crystal-SDS/filter-middleware | crystal_filter_middleware/filters/storlet.py | Python | gpl-3.0 | 6,161 |
import re
from markdown.blockprocessors import HRProcessor
class BBCodeHRProcessor(HRProcessor):
RE = r'^\[hr\]*'
# Detect hr on any line of a block.
SEARCH_RE = re.compile(RE, re.MULTILINE | re.IGNORECASE)
| 390910131/Misago | misago/markup/bbcode/blocks.py | Python | gpl-2.0 | 223 |
# Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
"""Utility functions for FOMs."""
import nu... | kohr-h/odl | odl/contrib/fom/util.py | Python | mpl-2.0 | 16,016 |
'''
flaskext.bcrypt
---------------
A Flask extension providing bcrypt hasing and comparison facilities.
:copyright: (c) 2011 by Max Countryman.
:license: BSD, see LICENSE for more details.
'''
from __future__ import absolute_import
from __future__ import print_function
__version_info__ ... | growingdever/flask-bcrypt | flask_bcrypt.py | Python | bsd-3-clause | 7,187 |
# coding: utf-8
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.core.urlresolvers import reverse
from django.forms import ModelForm, ValidationError
from django import forms
from django.views.generic import CreateView, UpdateView, DeleteView, TemplateView
from cr... | PyDev777/studentsdb | students/views/groups.py | Python | mit | 6,802 |
from toolbox.filetools import *
from toolbox.graphictools import *
from toolbox.misctools import *
from toolbox.objecttools import *
from toolbox.webtools import *
from toolbox.kanjitools import *
from toolbox.dataqualitytools import *
| marrcio/relate-kanji | resources/util/toolbox/__init__.py | Python | mit | 236 |
# Copyright 2017 The Forseti Security 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 ap... | forseti-security/forseti-security | google/cloud/forseti/common/util/retryable_exceptions.py | Python | apache-2.0 | 2,006 |
"""
Savings
===============================================================================
Overview
-------------------------------------------------------------------------------
The function ``savings`` computes the final balance for a savings account
with arbitrary deposits and withdrawls and variable interset ra... | jdvelasq/cashflows | cashflows/savings.py | Python | mit | 4,537 |
from .utils import merge_dict, perform_request, CommentClientRequestError
import models
import settings
class User(models.Model):
accessible_fields = ['username', 'follower_ids', 'upvoted_ids', 'downvoted_ids',
'id', 'external_id', 'subscribed_user_ids', 'children', 'course_id',
... | echanna/EdxNotAFork | lms/lib/comment_client/user.py | Python | agpl-3.0 | 6,362 |
# -*- coding: utf-8 -*-
import shutil
import widgetUtils
import platform
if platform.system() == "Windows":
import wxUI as view
from controller import settings
elif platform.system() == "Linux":
import gtkUI as view
import paths
import time
import os
import logging
import session
import manager
import config_utils
i... | codeofdusk/ProjectMagenta | src/sessionmanager/sessionManager.py | Python | gpl-2.0 | 3,568 |
from .analysis import find_outliers
from mollib.utils import MDTable, dict_table, FormattedStr
from mollib.utils.numbers import center
from mollib.utils.interactions import sort_func
def stats_table(stats, *args, **kwargs):
"""Render a table for the statistics.
Parameters
----------
stats: dict
... | jlorieau/mollib | mollib/pa/reports.py | Python | gpl-3.0 | 4,286 |
from django.utils.translation import ugettext_lazy as _
from django.utils.html import mark_safe
from django.core.urlresolvers import reverse
from tendenci.libs.model_report.report import reports, ReportAdmin
from tendenci.libs.model_report.utils import (sum_column, us_date_format, date_label,
... | alirizakeles/tendenci | tendenci/apps/invoices/reports.py | Python | gpl-3.0 | 2,731 |
from components import Graph
from src.utiltools import mkdir
import os, sys
import pygraphviz as pgv
class GraphAM(Graph):
def __init__(self, num_nodes, directed):
Graph.__init__(self, num_nodes, directed)
self.repr_type = 'AM'
self.graph = [[0] * self.num_nodes for _ in range... | MartinPenicka/randgraphlib | src/components/graphAM.py | Python | gpl-3.0 | 3,046 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# python 3.5.1
"""
Author: Bobby McDonnell
Date: 12/17/2015
Heirarchy:
BSQL > database > table > record
"""
from table import table
class record(table):
def __init__(self):
pass
| rmcdonnell/BSQL | record.py | Python | mit | 229 |
# coding:utf-8
from models import HMenu, HOrg, HRole, HUser
from peewee import JOIN_INNER, fn
__author__ = "chenghao"
def init_menus(user_id):
"""
用户登录时获取当前用户的菜单数据集
:param user_id: 用户id
:return:
"""
sql = HMenu.select(
HMenu.pid, HMenu.menu_name.alias("title"), HMenu.menu_url.ali... | chenghao/haoAdmin_flask | dal/__init__.py | Python | apache-2.0 | 1,454 |
class Application(object):
url = "http://rozetka.com.ua/"
def __init__(self, driver):
self.driver = driver
def go_to_home_page(self):
self.driver.get(self.url)
def search_product(self, product):
driver = self.driver
search_field = driver.find_element_by_name("text")
... | VolodyaEsk/selenium-python-vkhatianovskyi | other_test/model/application.py | Python | apache-2.0 | 515 |
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... | pelme/pyspresso | src/pyspresso/_vendor/Adafruit_GPIO/MCP230xx.py | Python | gpl-3.0 | 6,382 |
# -*- coding: utf-8 -*-
"""
flask.wrappers
~~~~~~~~~~~~~~
Implements the WSGI wrappers (request and response).
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase
from werkzeug.exce... | Aaron1992/flask | flask/wrappers.py | Python | bsd-3-clause | 7,304 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Franck Cuny <franck@lumberjaph.net>
#
# 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 L... | kbrebanov/ansible-modules-extras | packaging/language/cpanm.py | Python | gpl-3.0 | 6,848 |
###############################################################################
#
# temboo.core.util.*
#
# Utility functions.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... | jordanemedlock/psychtruths | temboo/core/util.py | Python | apache-2.0 | 1,009 |
import sh
import unittest
from sh import cut, grep, cat, wc, uniq, mv
zmap_std_args = [ "-b",
"configs/blocklist_shard.conf",
"--seed=1234",
"192.168.1.0/24",
"--dryrun",
"-c",
"1"
]
zmap = sh.... | zmap/zmap | test/test_sharding.py | Python | apache-2.0 | 2,420 |
# This file is part of Invenio.
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 the
# License, or (at your o... | CERNDocumentServer/invenio | modules/websubmit/lib/functions/Update_Approval_DB.py | Python | gpl-2.0 | 5,345 |
"""
Unittests for the rpc.jsonrpc module
"""
import sys
import unittest
if sys.version_info < (2, 7):
import unittest2 as unittest
from mock import Mock
from rpc import jsonp
class Handler(object):
def ping(self):
return "pong!"
def sayhi(self, person):
return "Hi " + person
class Serve... | davidmiller/rpc | test/test_jsonp.py | Python | lgpl-3.0 | 1,254 |
# I18N-related pylint module
#
# Copyright (C) 2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distribute... | gautamMalu/XenInBox | tests/pylint/intl.py | Python | gpl-2.0 | 6,421 |
# EFILTER Forensic Query Language
#
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | google/dotty | efilter/version.py | Python | apache-2.0 | 3,313 |
import bglib
from Adapter import Adapter
import logging
from utils import ConnectTimeout
logging.basicConfig(format='%(asctime)s:%(threadName)s:%(levelname)s:%(name)s:%(module)s:%(message)s', level=logging.DEBUG)
logger = logging.getLogger('BLEPython')
| AshtonInstruments/BLEPython | blepython/__init__.py | Python | gpl-2.0 | 254 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.