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 |
|---|---|---|---|---|---|
"""Unit tests for the SonarQube duplicated lines collector."""
from .base import SonarQubeTestCase
class SonarQubeDuplicatedLinesTest(SonarQubeTestCase):
"""Unit tests for the SonarQube duplicated lines collector."""
METRIC_TYPE = "duplicated_lines"
async def test_duplicated_lines(self):
"""Tes... | ICTU/quality-time | components/collector/tests/source_collectors/sonarqube/test_duplicated_lines.py | Python | apache-2.0 | 781 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('costos', '0027_auto_20180102_2154'),
('proyecciones', '0006_auto_20180107_1240'),
]
operations = [
migrations.Delete... | infoINGenieria/Zweb | z_web/costos/migrations/0028_auto_20180107_1251.py | Python | gpl-2.0 | 562 |
# coding=utf-8
# Copyright (c) 2016 Intel, Inc.
# Author Erkka Kääriä <erkka.kaaria@intel.com>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; version 2 of the License
#
# This program is dist... | 01org/AFT | testing_harness/devices/common.py | Python | gpl-2.0 | 6,077 |
#! /usr/bin/env python
# Written by Ivan Sovic, March 2015.
#
# The MIT License (MIT)
# Copyright (c) 2015 Ivan Sovic
# 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, i... | isovic/samscripts | src/venn_of_sams.py | Python | mit | 17,183 |
# Copyright 2016 CERN. This software is distributed under the
# terms of the GNU General Public Licence version 3 (GPL Version 3),
# copied verbatim in the file LICENCE.md.
# In applying this licence, CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Orga... | blond-admin/BLonD | blond/trackers/utilities.py | Python | gpl-3.0 | 31,291 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2014 Tech Receptives (<http://techreceptives.com>)
{
'name': 'Singapore - Accounting',
'author': 'Tech Receptives',
'version': '2.0',
'category': 'Accounting/Localizations/Account Charts'... | rven/odoo | addons/l10n_sg/__manifest__.py | Python | agpl-3.0 | 1,059 |
"""Hello World API implemented using Google Cloud Endpoints.
Contains declarations of endpoint, endpoint methods,
as well as the ProtoRPC message class and container required
for endpoint method definition.
"""
import endpoints
from protorpc import messages
from protorpc import message_types
from protorpc import remot... | junzhou365/ud858 | Lesson_2/000_Hello_Endpoints/helloworld_api.py | Python | gpl-3.0 | 1,642 |
#! /usr/bin/env python
import sys, os.path, glob
from setuptools import setup, Extension
from python.lib.moresetuptools import build_ext, CleanGenerated
# function to generate gen/*.{c,h}
from this_version import get_aubio_version, get_aubio_pyversion
__version__ = get_aubio_pyversion()
__aubio_version__ = get_aubio_... | dafx/aubio | setup.py | Python | gpl-3.0 | 2,681 |
import django.contrib.sitemaps.views
import django_xmlrpc.views
from django.conf.urls import include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from .ajax_views import (
BrowseReplaysDTView,
CommentDTView,
ajax_map_lookup,
ajax_player_lookup,
ajax_playerrating_tbl_src,... | dansan/spring-replay-site | srs/urls.py | Python | gpl-3.0 | 5,260 |
"""
CLEAN UP THE WORDS
CHALLENGE DESCRIPTION:
You have a list of words. Letters of these words are mixed with extra symbols,
so it is hard to define the beginning and end of each word. Write a program
that will clean up the words from extra numbers and symbols.
INPUT SAMPLE:
The first argument is a path to a file. E... | joelstanner/codeeval | python_solutions/CLEAN_UP_THE_WORDS/CLEAN_UP_THE_WORDS.py | Python | mit | 1,545 |
# encoding: utf-8
from sqlalchemy import *
from migrate import *
import datetime
import uuid
from migrate.changeset.constraint import PrimaryKeyConstraint
def make_uuid():
return unicode(uuid.uuid4())
def upgrade(migrate_engine):
metadata = MetaData()
metadata.bind = migrate_engine
role_action = Tabl... | NicoVarg99/daf-recipes | ckan/ckan/ckan/ckan/migration/versions/036_lockdown_roles.py | Python | gpl-3.0 | 1,485 |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
from models import *
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
... | jonlatorre/MatriculaEIDE | pasarela/tests.py | Python | mit | 677 |
# This file is a minimal clang-format vim-integration. To install:
# - Change 'binary' if clang-format is not on the path (see below).
# - Add to your .vimrc:
#
# map <C-I> :pyf <path-to-this-file>/clang-format.py<CR>
# imap <C-I> <ESC>:pyf <path-to-this-file>/clang-format.py<CR>i
#
# The first line enables clang-f... | cxx-hep/root-cern | interpreter/llvm/src/tools/clang/tools/clang-format/clang-format.py | Python | lgpl-2.1 | 2,950 |
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
from core.models import BaseModel
class Profile(BaseModel):
user = models.OneToOneField(User)
# Note to coders: The '_url' fields below need to JU... | QLGu/djangopackages | profiles/models.py | Python | mit | 4,608 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# 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 can redis... | wbsavage/shinken | shinken/modules/livestatus_broker/livestatus_request.py | Python | agpl-3.0 | 3,558 |
# Copyright 2021 The gRPC 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 applicable law or agreed to in writ... | donnadionne/grpc | src/python/grpcio_admin/setup.py | Python | apache-2.0 | 2,117 |
# Copyright 2013 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.
"""This module wraps Android's adb tool.
This is a thin wrapper around the adb interface. Any additional complexity
should be delegated to a higher level (e... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/build/android/devil/android/sdk/adb_wrapper.py | Python | mit | 22,846 |
# 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
# "License"); you may not u... | ikoula/cloudstack | tools/marvin/marvin/lib/common.py | Python | gpl-2.0 | 67,873 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/xfontsel/package.py | Python | lgpl-2.1 | 1,904 |
"""Compute McCabe's Cyclomatic Metric.
This routine computes McCabe's Cyclomatic metric for the whole file.
"""
from metricbase import MetricBase
mccabe_keywords = [
'assert',
'break',
'continue',
'elif',
'else',
'for',
'if',
'while']
class McCabeMetric(MetricBase):
"""Comp... | GadgetSteve/metrics | metrics/mccabe.py | Python | mit | 1,278 |
# coding: utf-8
#
# Copyright 2015 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... | AllanYangZhou/oppia | core/storage/recommendations/gae_models.py | Python | apache-2.0 | 1,826 |
from rest_framework import viewsets
from rest_framework import renderers
from webhooks.models import WebHook
from webhooks.serializers import WebHookSerializer
class WebHookViewSet(viewsets.ModelViewSet):
queryset = WebHook.objects.all()
serializer_class = WebHookSerializer
| sourcelair/castor | castor/webhooks/views.py | Python | mit | 286 |
#!/usr/bin/python
# Copyright 2003, 2004, 2005, 2006 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Test that a chain of libraries work ok, not matter if we use static or
# shared linking.
from BoostBu... | gorkinovich/DefendersOfMankind | dependencies/luabind/boost-build/test/library_chain.py | Python | gpl-3.0 | 3,365 |
# Authors: Jaakko Leppakangas <jaeilepp@student.jyu.fi>
# Robert Luke <mail@robertluke.net>
#
# License: BSD-3-Clause
from collections import OrderedDict
from datetime import datetime, timedelta, timezone
import os.path as op
import re
from copy import deepcopy
from itertools import takewhile
import json
from... | larsoner/mne-python | mne/annotations.py | Python | bsd-3-clause | 62,560 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ogr2ogrclipextent.py
---------------------
Date : November 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*******************... | landryb/QGIS | python/plugins/processing/algs/gdal/ogr2ogrclipextent.py | Python | gpl-2.0 | 3,642 |
import cgi
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from whoosh import store
from whoosh.fields import Schema, STORED, ID, KEYWORD, TEXT
from whoosh.index import getdatastoreindex
from whoosh.qparser import QueryParser, MultifieldParser
import logging
SEARCHSC... | tallstreet/Whoosh-AppEngine | example/hello.py | Python | apache-2.0 | 2,677 |
'''
Created on Jan 2, 2015
@author: alessandro
'''
import add_path
import os
import cv2
import sys
import json
import getopt
import random
import numpy as np
from filter_tig import FilterTIG
EDGE = 8
BASE_LOG = 2
MIN_EDGE_LOG = int(np.ceil(np.log(10.)/np.log(BASE_LOG)))
MAX_EDGE_LOG = int(np.ceil(np.log(500.)/np.log(... | bubae/gazeAssistRecognize | lib/BING-Objectness/source/bing.py | Python | mit | 10,487 |
import heapq, bisect, math, collections, sys, fractions, copy, functools, operator, itertools, string
argmax = lambda l: l.index(max(l))
argmin = lambda l: l.index(min(l))
def read_list(t): return [t(x) for x in input().split()]
def read_line(t): return t(input())
def read_lines(t, N): return [t(input()) for _ in ran... | knuu/competitive-programming | atcoder/corp/codefes2015_qa_a.py | Python | mit | 441 |
#! /usr/bin/env python
"""Simple FastAGI server using starpy"""
#------------------------------------------------------------------------------#
from twisted.web import static, resource, server
from twisted.application.service import Application
from twisted.application.internet import TCPServer
from autobahn.twisted.... | kbu9999/QmlRemis | QmlRemisServer/service/socketService.py | Python | gpl-3.0 | 1,653 |
from lxml import etree
from healthvaultlib.itemtypes.healthrecorditem import HealthRecordItem
from healthvaultlib.utils.xmlutils import XmlUtils
class Height(HealthRecordItem):
def __init__(self, thing_xml=None):
super(Height, self).__init__()
self.type_id = '40750a6a-89b2-455c-bd8d-b420a4cb500b'... | rajeevs1992/pyhealthvault | src/healthvaultlib/itemtypes/height.py | Python | mit | 2,163 |
# Copyright 2013 - Noorul Islam K M
#
# 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 w... | pravisankar/python-solumclient | solumclient/common/base.py | Python | apache-2.0 | 5,443 |
import numpy as np
from extra_trees.ensemble.forest import ExtraTreesClassifier
from extra_trees.ensemble.forest import ExtraTreesRegressor
def test_extra_trees_regressor(circles):
X, y = circles
indices = np.random.permutation(len(X.data))
X_train = X[indices[:-10]]
y_train = y[indices[:-10]]
X_... | allrod5/extra-trees | tests/ensemble/test_forest.py | Python | mit | 1,085 |
# Copyright (C) 2017-2018 Intel Corporation
#
# SPDX-License-Identifier: MIT
import base_bs_erf
import numpy as np
import dask.array as da
from numpy import log, exp
from base_bs_erf import erf, invsqrt
def black_scholes ( nopt, price, strike, t, rate, vol ):
mr = -rate
sig_sig_two = vol * vol * 2
P = price
S =... | IntelPython/BlackScholes_bench | bs_erf_dask_numpy.py | Python | mit | 882 |
"""
`smart_eval` command test module
"""
from tests.utils import GefUnitTestGeneric, gdb_start_silent_cmd
class SmartEvalCommand(GefUnitTestGeneric):
"""`smart_eval` command test module"""
def test_cmd_smart_eval(self):
examples = (
("$ $pc+1", ""),
("$ -0x1000", "-4096"),
... | hugsy/gef | tests/commands/smart_eval.py | Python | mit | 628 |
#!/usr/bin/env python3
# coding=utf-8
from Geometry.Vector2 import Vector2
import math
import pygame
def intersecting_rows(rect1, rect2):
"""
@param rect2: pygame.Rect
@param rect1: pygame.Rect
@return: tuple
"""
tile_left = math.floor(rect1.left / rect2.width)
tile_right = math.ceil(rect... | bubbles231/Prototype | Helpers.py | Python | gpl-3.0 | 20,270 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | nathanaevitas/odoo | openerp/addons/account_analytic_analysis/account_analytic_analysis.py | Python | agpl-3.0 | 48,454 |
import os
import io
from threading import Thread
from .backends.base import (STREAM_WAITING_TO_START,
STREAM_TRANSFER_IN_PROGRESS)
import logging
from .utils import repeatfunc
CHUNK_SIZE = 4096
log = logging.getLogger(__name__)
class Tee(object):
""" Tee implements a multi reader / ... | javierwilson/err | errbot/streaming.py | Python | gpl-3.0 | 2,820 |
""" Test pickling of MLP, to see if I've pickled all the required state variables """
import cPickle
import gzip
import os
import sys
import time
import numpy
import theano
import theano.tensor as T
from logistic_sgd import LogisticRegression, load_data
from hidden_layer import HiddenLayer
from MLP import MLP
def... | lzamparo/SdA_reduce | theano_models/mlp/test_pickle_MLP.py | Python | bsd-3-clause | 14,154 |
#!/usr/bin/python
#-------------------------------------------------------------------------------
#License GPL v3.0
#Author: Alexandre Manhaes Savio <alexsavio@gmail.com>
#Grupo de Inteligencia Computational <www.ehu.es/ccwintco>
#Universidad del Pais Vasco UPV/EHU
#Use this at your own risk!
#2012-07-26
#-----------... | alexsavio/aizkolari | aizkolari_extract_featset.py | Python | bsd-3-clause | 15,592 |
#!/usr/bin/env python
import os
import sys
### START UPDATE SYS.PATH ###
### END UPDATE SYS.PATH ###
try:
from iocbio.optparse_gui import OptionParser
except ImportError:
from optparse import OptionParser
from fparser.script_options import set_read_options
def runner (parser, options, args):
from fparser.r... | pemryan/f2py | fparser/scripts/read.py | Python | bsd-3-clause | 905 |
# lesson2.py
# Stand-alone script to run the code from the lesson2-matsaleh.ipynb Jupyter Notebook.
'''
Lesson 2 Assignment Plan:
1. Train a linear model using the ImageNet predictions to classify images into dogs or cats.
* Get the true labels for every image
* Get the 1,000 imagenet category predictions for... | matsaleh13/courses | deeplearning1/nbs/lesson2.py | Python | apache-2.0 | 6,771 |
#!/usr/bin/env python
import numpy as np
from horton import *
# specify the even tempered basis set
alpha_low = 5e-3
alpha_high = 5e2
nbasis = 30
lnratio = (np.log(alpha_high) - np.log(alpha_low))/(nbasis-1)
# build a list of "contractions". These aren't real contractions as every
# contraction only contains one bas... | eustislab/horton | data/examples/hamiltonian/even_tempered_li.py | Python | gpl-3.0 | 725 |
class AbstractBackend(object):
def register_command_contexts(self, context):
pass
def register_options_contexts(self, context):
pass
| esc/Bento | bento/backends/core.py | Python | bsd-3-clause | 158 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
"""
This module contains composers to allow creation of XML for URN:NBN, so you
don't have to create XML by hand.
See:
- http://resolver.nkp.cz/api/v3/digDocRegistration.xsd
- https://code.google.com/p/czidlo/wiki/ApiV3
"""
# ... | edeposit/cz-urnnbn-api | src/cz_urnnbn_api/xml_composer.py | Python | mit | 9,037 |
# -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... | crate/crate-python | src/crate/client/sqlalchemy/tests/connection_test.py | Python | apache-2.0 | 2,183 |
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0012_auto_20150607_2207'),
]
operations = [
migrations.CreateModel(
name='UrlconfRevision',
fields=[
('id', models.AutoField(verbose_name='ID'... | rsalmaso/django-cms | cms/migrations/0013_urlconfrevision.py | Python | bsd-3-clause | 546 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Eficent (<http://www.eficent.com/>)
# <contact@eficent.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero ... | Eficent/eficent-odoo-addons-wip | project_resource_unit/model/project_task.py | Python | agpl-3.0 | 9,381 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | datalogics/scons | test/Split.py | Python | mit | 1,908 |
import ptypes
from ptypes import *
import functools,operator,itertools,types
import logging
ptypes.setbyteorder(ptypes.config.byteorder.bigendian)
### X.224 Variable
class X224Variable(ptype.definition):
cache = {}
@X224Variable.define
class CR_TPDU(pstruct.type):
'''Connection Request'''
type = 0xe
... | arizvisa/syringe | template/protocol/x224.py | Python | bsd-2-clause | 8,636 |
#!/usr/bin/env python
# blink the disk light
import commands
import getopt
import sys
import os
import re
class BlinkDisk():
def __init__(self):
megacli = '/opt/MegaRAID/MegaCli/MegaCli64'
self.megacli = megacli
def resetAll(self):
cmd = 'lspci -v |grep LSI '
status,... | kk47/Python | modules/blink.py | Python | lgpl-3.0 | 9,557 |
#!/usr/local/bin/python
# Written by Pavel
# License: BSD
import sqlite3
import time
import os
import mraa
light = mraa.Aio(0)
sound = mraa.Aio(1)
i2c = mraa.I2c(0)
#pins A0 and A1 tied to ground, so address is 0x40
i2c.address(0x40)
#reset hdc1008
i2c.writeReg(0x02, 144L)
#configuration; see datasheet. sets hdc1008 ... | Pavlos1/SensoringJMSS | read_sensor_data.py | Python | bsd-3-clause | 1,798 |
from uuid import uuid4
class BaseError(Exception):
@property
def data(self):
return {
'errors': [{
'id': uuid4(),
'code': self.code,
'status': self.status_code,
'title': self.title,
'detail': self.detail
... | bladams/sqlalchemy-jsonapi | sqlalchemy_jsonapi/errors.py | Python | mit | 3,776 |
"""Astra <--> Ocelot lattice converter"""
import re
from ocelot.cpbd.magnetic_lattice import *
from ocelot.cpbd.elements import *
from ocelot.cpbd.io import *
class AstraLatticeConverter:
def __init__(self):
self.astra_matrix = {}
# used elements for conversion
self.as... | ocelot-collab/ocelot | ocelot/adaptors/astra_lattice_converter.py | Python | gpl-3.0 | 6,216 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def fix_archived_outgoing(apps, schema_editor):
Msg = apps.get_model('msgs', 'Msg')
wonky = Msg.objects.filter(direction='O', visibility='A')
updated = wonky.update(visibility='V')
if updated:
... | praekelt/rapidpro | temba/msgs/migrations/0022_no_archived_outgoing.py | Python | agpl-3.0 | 593 |
###
# Copyright (c) 2011, Valentin Lorentz
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditi... | kg-bot/SupyBot | plugins/Trivia/test.py | Python | gpl-3.0 | 1,915 |
import calendar_service
import res_partner
import sale | oerp-odoo/service-management | calendar_service/models/__init__.py | Python | agpl-3.0 | 54 |
from __future__ import print_function
from matplotlib import pyplot as plt
from CoolProp.CoolProp import PropsSI
import pump
import pump.graphs.generate
from units import ureg
hello = PropsSI('T', 'P', 101325, 'Q', 0, 'Water')
print(hello)
| spookysys/turbopump | main.py | Python | gpl-3.0 | 242 |
# -*- 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):
# Changing field 'User.profile_image_url_https'
db.alter_column('twitter_api_user', 'profile_image_url_http... | kwameboame/django-twitter-api | twitter_api/migrations/0002_auto__chg_field_user_profile_image_url_https__chg_field_user_profile_i.py | Python | bsd-3-clause | 8,224 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br)
#
# This file is part of libSigNetSim.
#
# libSigNetSim 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 Fou... | msreis/SigNetSim | signetsim/views/admin/ComputationsView.py | Python | agpl-3.0 | 3,640 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | EmanueleCannizzaro/scons | test/Requires/basic.py | Python | mit | 3,351 |
from __future__ import absolute_import, unicode_literals
from django.db import models
# Create your models here.
| openearth/delft3d-gt-server | delft3dgtfrontend/models.py | Python | gpl-3.0 | 115 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils.make_random import add_random_children
import frappe.utils
import random
def make_sample_data():
"""Create a few oppo... | mahabuber/erpnext | erpnext/setup/setup_wizard/sample_data.py | Python | agpl-3.0 | 3,342 |
'''
@author: Michael Wan
@since : 2014-11-08
'''
from math import log
import operator
def createDataSet():
dataSet = [[1, 1, 'yes'],
[1, 1, 'yes'],
[1, 0, 'no'],
[0, 1, 'no'],
[0, 1, 'no']]
labels = ['no surfacing','flippers']
#cha... | onehao/opensource | pyml/inaction/ch03/decisiontree/trees.py | Python | apache-2.0 | 4,087 |
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer that transforms `xyzzy` into repr(xyzzy)."""
# Local imports
from .. import fixer_base
from ..fixer_util import Call, Name, parenthesize
class FixRepr(fixer_base.BaseFix):
PATTERN = """
at... | leighpauls/k2cro4 | third_party/python_26/Lib/lib2to3/fixes/fix_repr.py | Python | bsd-3-clause | 594 |
# The Hazard Library
# Copyright (C) 2012-2014, GEM Foundation
#
# 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 Foundation, either version 3 of the
# License, or (at your option) any later version.
... | mmpagani/oq-hazardlib | openquake/hazardlib/tests/gsim/youngs_1997_test.py | Python | agpl-3.0 | 3,507 |
# -*- coding: utf-8 -*-
#
# HyperSpy documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 18 11:10:55 2010.
#
# 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.
#
# Al... | sillvan/hyperspy | doc/conf.py | Python | gpl-3.0 | 7,719 |
from Child import Child
from Node import Node # noqa: I201
GENERIC_NODES = [
# generic-where-clause -> 'where' requirement-list
Node('GenericWhereClause', kind='Syntax',
children=[
Child('WhereKeyword', kind='WhereToken'),
Child('RequirementList', kind='GenericRequirementLis... | zisko/swift | utils/gyb_syntax_support/GenericNodes.py | Python | apache-2.0 | 2,522 |
"""
Student Views
"""
import datetime
import logging
import uuid
import time
import json
import warnings
from collections import defaultdict
from pytz import UTC
from ipware.ip import get_ip
from django.conf import settings
from django.contrib.auth import logout, authenticate, login
from django.contrib.auth.models imp... | kamalx/edx-platform | common/djangoapps/student/views.py | Python | agpl-3.0 | 88,916 |
from django.db import models
from rest_framework import serializers
from rest_framework_recursive.fields import RecursiveField
class LinkSerializer(serializers.Serializer):
name = serializers.CharField(max_length=25)
next = RecursiveField(allow_null=True)
class NodeSerializer(serializers.Serializer):
na... | pombredanne/django-rest-framework-recursive | tests/test_recursive.py | Python | isc | 6,530 |
#encoding:utf-8
subreddit = 'apexlegends'
t_channel = '@r_apexlegends'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/r_apexlegends/app.py | Python | mit | 145 |
"""
Django settings for eventex project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
#... | kalicki/EventeX | eventex/settings.py | Python | mit | 2,369 |
###############################################################################
##
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary forms, with or without
## modification, ... | CMUSV-VisTrails/WorkflowRecommendation | vistrails/packages/controlflow/products.py | Python | bsd-3-clause | 4,689 |
from dependencies.dependency import aq_inner
from dependencies.dependency import aq_parent
from dependencies.dependency import getToolByName
from dependencies.dependency import REFERENCE_CATALOG
def upgrade(tool):
""" Remove Maintenance, Validations, Calibrations ans Schedule
https://github.com/bikalabs/Bi... | yasir1brahim/OLiMS | lims/upgrade/to3012.py | Python | agpl-3.0 | 768 |
from pybrain.rl.learners.valuebased.interface import ActionValueTable, ActionValueNetwork
from pybrain.rl.learners.valuebased.nfq import NFQ
from pybrain.rl.learners.valuebased.q import Q
from pybrain.rl.learners.valuebased.qlambda import QLambda
from pybrain.rl.learners.valuebased.sarsa import SARSA | RatulGhosh/pybrain | pybrain/rl/learners/valuebased/__init__.py | Python | bsd-3-clause | 301 |
#!/usr/bin/env python
# Copyright (c) 2011, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# noti... | Hypha-ROS/hypha-racecar | script/racecar_teleop.py | Python | lgpl-3.0 | 5,705 |
from _version import __version__ | greenape/disclosure-game-module | disclosuregame/__init__.py | Python | mpl-2.0 | 32 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import sys... | baroquebobcat/pants | tests/python/pants_test/engine/examples/visualizer.py | Python | apache-2.0 | 3,015 |
# 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 ... | yaqiyang/autorest | src/generator/AutoRest.Python.Azure.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/operations/parameter_grouping_operations.py | Python | mit | 13,102 |
# 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
# "License"); you may not u... | Laurawly/tvm-1 | python/tvm/contrib/mkldnn.py | Python | apache-2.0 | 1,715 |
# -*- coding: utf-8 -*-
#
# 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
#... | Fokko/incubator-airflow | tests/contrib/hooks/test_aws_logs_hook.py | Python | apache-2.0 | 2,734 |
import os
import sys
import linecache
from idlelib.TreeWidget import TreeNode, TreeItem, ScrolledCanvas
from idlelib.ObjectBrowser import ObjectTreeItem, make_objecttreeitem
def StackBrowser(root, flist=None, tb=None, top=None):
if top is None:
from tkinter import Toplevel
top = Toplevel(root)
... | PennartLoettring/Poettrix | rootfs/usr/lib/python3.4/idlelib/StackViewer.py | Python | gpl-2.0 | 3,567 |
#import CV libraries
import numpy
import cv2
img=cv2.imread("/home/udayan/Downloads/Lena.png", 0) #read image, 0=read as grayscale, -1=read as color
#kernels, in-built APIs are available for blurring and sharpening too (more preferable)
kernel_avg=numpy.ones((3,3),numpy.float32)/9 #3x3 averaging kernel
kernel_1_... | UdayanSinha/Code_Blocks | OpenCV/cv_2D_convolution.py | Python | mit | 1,112 |
#!/usr/bin/env python
import os
import sys
import shutil
import setuptools.command.egg_info as egg_info_cmd
from setuptools import setup, find_packages
SETUP_DIR = os.path.dirname(__file__)
README = os.path.join(SETUP_DIR, 'README.rst')
try:
import gittaggers
tagger = gittaggers.EggInfoFromGit
except Impor... | StarvingMarvin/common-workflow-language | v1.1.0-dev1/salad/setup.py | Python | apache-2.0 | 2,730 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010 - 2012, A. Murat Eren
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
... | meren/oligotyping | Oligotyping/visualization/oligotype_distribution_across_samples.py | Python | gpl-2.0 | 6,880 |
# Copyright 2015 ETH Zurich
# Copyright 2018 ETH Zurich, Anapaya Systems
#
# 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 b... | klausman/scion | python/lib/types.py | Python | apache-2.0 | 5,374 |
#!/usr/bin/env python
import os, sys
sys.path = [os.path.dirname(os.path.abspath(__file__))] + sys.path
from .svm import *
from .svm import __all__ as svm_all
from .svm import scipy, sparse
from .commonutil import *
from .commonutil import __all__ as common_all
if sys.version_info[0] < 3:
range = xrange
from ... | cjlin1/libsvm | python/libsvm/svmutil.py | Python | bsd-3-clause | 10,602 |
# -*- coding: utf-8 -*-
"""
Functions to open audio files and to record from default microphone
:platform: Linux
:synopsis: Audio Helper
.. moduleauthor:: Dominik Schuermann <d.schuermann@tu-braunschweig.de>
"""
import logging
# get logger
log = logging.getLogger("fuzzy_pairing")
from scipy.io import wavfi... | dschuermann/fuzzy-pairing | helper_audio.py | Python | gpl-3.0 | 2,183 |
# Copyright (C) 2016 Ross Wightman. 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
# =================================... | rwightman/tensorflow-litterbox | litterbox/layers/lstm.py | Python | apache-2.0 | 3,224 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ogr2ogrtabletopostgislist.py
---------------------
Date : November 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***********... | AsgerPetersen/QGIS | python/plugins/processing/algs/gdal/ogr2ogrtabletopostgislist.py | Python | gpl-2.0 | 8,963 |
# -*- coding: utf-8 -*-
import os
from twms import projections
from libkomapnik import pixel_size_at_zoom
import json
import psycopg2
from mapcss import MapCSS
try:
import psyco
psyco.full()
except ImportError:
pass
def get_vectors(db, bbox, zoom, style, vec = "polygon"):
bbox_p = projections.from4326(bbox, "... | pbabik/mapfiddle | modules/json_getter.py | Python | bsd-2-clause | 7,622 |
import os
from functools import reduce, lru_cache
import logging
import re
import subprocess
from randrctl import DISPLAY, XAUTHORITY
from randrctl.exception import XrandrException, ParseException
from randrctl.model import Profile, Viewport, XrandrConnection, Display
logger = logging.getLogger(__name__)
class Xra... | edio/randrctl | randrctl/xrandr.py | Python | gpl-3.0 | 10,440 |
"""
Simple polygon area example version 2
"""
class Polygon(object):
""" Polygon class to store border and calculate area
:param coords: list of lists of coordinate pairs [[1, 2], [3, 5], [2, 6]]
"""
def __init__(self, coords):
self.coords = coords
def area(self):
""" Calcu... | OSGeoLabBp/tutorials | hungarian/python/code/area2.py | Python | cc0-1.0 | 968 |
import atexit
import hashlib
import hmac
import json
import re
import os
import sys
import time
from datetime import datetime, timedelta
import click
import requests
from pytz import timezone, utc
from urllib.parse import urlencode, urljoin
from . import notifiers
from .util import read_config
from .storage import St... | pferreir/indico-mattermost | indico_chat_bot/bot.py | Python | mit | 4,893 |
#!/usr/bin/env python
import unittest
from redef import redef, stdout_of, stderr_of, wiretap, Redef
from oktest import ok, test
class Somewhere:
def show(self, message):
return self.__class__.__name__ + ', ' + message
class RedefTest(unittest.TestCase):
@test("Test1: redef del test")
def t1(self)... | joeheyming/redef | test_redef.py | Python | gpl-2.0 | 6,937 |
from . import _ccallback_c
import ctypes
PyCFuncPtr = ctypes.CFUNCTYPE(ctypes.c_void_p).__bases__[0]
ffi = None
class CData(object):
pass
def _import_cffi():
global ffi, CData
if ffi is not None:
return
try:
import cffi
ffi = cffi.FFI()
CData = ffi.CData
except... | Eric89GXL/scipy | scipy/_lib/_ccallback.py | Python | bsd-3-clause | 6,196 |
#!/usr/bin/env python
"""
6. Write a Python program that creates a list. One of the elements of the list should be a dictionary with at least
two keys.
Write this list out to a file using both YAML and JSON formats. The YAML file should be in the expanded form.
"""
__author__ = 'Chip Hudgins'
__email__ = 'mudzi42@g... | mudzi42/pynet_class | class1/class1_lists.py | Python | apache-2.0 | 1,309 |
#!/bin/python
#-*-coding: utf-8-*-
from __future__ import division
import re
def getNums(file):
myfile = open(file,'r')
enable = True
nums = []
while enable:
line = myfile.readline().decode('utf-8')
if (line == ''):
enable = False
pattern = re.compile(r'.*?(\d+.*\d+... | hao-app/baiduCrawl | get_two_indicator.py | Python | gpl-2.0 | 4,073 |
# Copyright 2021 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 agreed to in writing, ... | google-research/pyreach | pyreach/gyms/oracle_element.py | Python | apache-2.0 | 1,448 |
from ciscoconfparse import CiscoConfParse
cisco_cfg = CiscoConfParse("cisco.txt")
crypto_map = cisco_cfg.find_objects(r'crypto map CRYPTO')
for map in crypto_map:
print map.text
for child in map.children:
print child.text
| cb1234/pynet-test | pyth_ansibel/class1/crypto_map_1.py | Python | apache-2.0 | 240 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import date
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
from odoo.osv import expression
class Contract(models.Mode... | rven/odoo | addons/hr_contract/models/hr_contract.py | Python | agpl-3.0 | 11,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.