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 |
|---|---|---|---|---|---|
# -*- coding:utf-8 -*-
#
# Copyright (C) 2015, Maximilian Köhl <mail@koehlma.de>
#
# This library is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 3.0 of the License, or
# (at your option)... | koehlma/pygrooveshark | src/grooveshark/utils/tags.py | Python | lgpl-3.0 | 2,022 |
#!/usr/bin/env python2.7
#Created by: Bruno Costa
# ITQB 2016
#
# This calculates the distribution profile from collapsed fasta files
# fragment-abundance.py -h for help
import argparse
##### Inputs #######
#targets_file="/home/brunocosta/INIA-Targets/INIA-miRNA-classification_INIA_mappable.fa_dd__Cleaveland4_resu... | netbofia/CleaveLand4 | fragment-abundance.py | Python | gpl-3.0 | 2,416 |
""" This module will run some job descriptions defined with an older version of DIRAC
"""
# pylint: disable=protected-access, wrong-import-position, invalid-name, missing-docstring
import unittest
import os
import sys
import shutil
from DIRAC.Core.Base.Script import parseCommandLine
parseCommandLine()
from DIRAC im... | chaen/DIRAC | tests/Workflow/Regression/Test_RegressionUserJobs.py | Python | gpl-3.0 | 3,108 |
# 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.
from core import perf_benchmark
from benchmarks import silk_flags
from measurements import smoothness
from telemetry import benchmark
import page_sets
cla... | yury-s/v8-inspector | Source/chrome/tools/perf/benchmarks/repaint.py | Python | bsd-3-clause | 2,008 |
"""
Merge output from multiple lastlog outputs to give a single last log
"""
import os
import sys
import argparse
import re
import dateutil.parser
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="")
parser.add_argument('-l', help='lastlog file(s). You can provide multiple -l at once',... | linsalrob/EdwardsLab | bin/merge_last_logs.py | Python | mit | 3,130 |
import json
import logging
import logging.config
from vFense import VFENSE_LOGGING_CONFIG
from vFense.core.api.base import BaseHandler
from vFense.core.decorators import authenticated_request
from vFense.plugins.monit import api
logging.config.fileConfig(VFENSE_LOGGING_CONFIG)
logger = logging.getLogger('rvapi')
RO... | dtklein/vFense | tp/src/server/api/monit_api.py | Python | lgpl-3.0 | 1,558 |
#
# See the perf-trace-python Documentation for the list of available functions.
# perf python script for creating the cdict files out of a perf.data file
# To be used by the perf-sched post processing script.
#
# This script reads a perf binary file (through perf script -s) and generates a cdict file
# named perf.cdic... | cisco-oss-eng/perftools | perfwhiz/mkcdict_perf_script.py | Python | apache-2.0 | 15,337 |
#!/usr/bin/env python
command += testshade ("-layer alayer a -layer dlayer d --layer clayer c --layer blayer b --connect alayer output_closure clayer in0 --connect dlayer output_closure clayer in1 --connect clayer output_closures blayer input_closures ")
| mcanthony/OpenShadingLanguage | testsuite/closure-array/run.py | Python | bsd-3-clause | 257 |
from pypoly import Polynomial, X
#
# 1 + X + X**2 + ...
#
def Ones(n):
return Polynomial(*(1 for _ in range(n + 1)))
#
# Chebyshev polynomials
#
def ChebyshevIterator():
U = 1
yield U
V = X
yield V
while True:
U, V = V, 2 * X * V - U
yield V
def Chebyshev(n):
it = Chebys... | tchaumeny/PyPoly | pypoly/examples.py | Python | mit | 1,356 |
# Adapter.py - class Adapter
#
# Copyright (C) 2008 Vinicius Gomes <vcgomes [at] gmail [dot] com>
# Copyright (C) 2008 Li Dongyang <Jerry87905 [at] gmail [dot] 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 ... | namili/blueman | blueman/bluez/Adapter.py | Python | gpl-3.0 | 10,566 |
def a(): b()
def b(): 1/0
a() | bobbyrward/fr0st | scripts/tests/_exception.py | Python | gpl-3.0 | 35 |
from __future__ import unicode_literals
from babeldjango.templatetags.babel import currencyfmt
from django.contrib import messages
from django.http import JsonResponse
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from django.utils.translation import ugettext as _
from . ... | rchav/vinerack | saleor/cart/views.py | Python | bsd-3-clause | 2,072 |
# scheduler.core: Data structures for managing K3 jobs.
class Job:
def __init__(self, roles, binary_url):
self.roles = roles
self.binary_url = binary_url
self.tasks = None
self.status = None
self.all_peers = None
self.inputs = None
# TODO inputs per Roles instead of per Job
class Role:
def... | yliu120/K3 | tools/scheduler/scheduler/core.py | Python | apache-2.0 | 1,002 |
from django.conf.urls import patterns, include, url
from django.views.generic import DetailView, ListView
from polls.models import Poll
urlpatterns = patterns('',
url(r'^$',
ListView.as_view(
queryset=Poll.objects.order_by('-pub_date')[:5],
context_object_name='latest_poll_list',
... | yinhe/demo-django | polls/urls.py | Python | bsd-3-clause | 719 |
#!/usr/bin/python
#
# Copyright (c) 2015, Arista Networks, 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 notice,
# t... | chepazzo/ansible-eos | library/eos_bgp_network.py | Python | bsd-3-clause | 13,863 |
#!/usr/bin/env python3
import sys
import os
import logging
import argparse
from PyQt5.QtWidgets import QApplication, QLabel, QMainWindow, QVBoxLayout, QWidget
from PyQt5.QtGui import QPalette
def _parseCommandLine():
parser = argparse.ArgumentParser(description='Qutepart test application')
parser.add_argume... | andreikop/qutepart | editor.py | Python | lgpl-2.1 | 5,062 |
from mock import patch
from .... import base
from pulp.devel import mock_plugins
from pulp.plugins.loader import api as plugin_api
from pulp.server.controllers import distributor as dist_controller
from pulp.server.db import model
from pulp.server.db.model.consumer import Bind, Consumer, ConsumerHistoryEvent
from pulp... | ulif/pulp | server/test/unit/server/managers/consumer/test_bind.py | Python | gpl-2.0 | 23,025 |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfbase/pdfdoc.py
__version__=''' $Id: pdfdoc.py 3582 2009-11-10 12:06:32Z meitham $ '''
__doc__="""
The module pdfdoc.py handles the 'outer structure'... | fergalmoran/Chrome2Kindle | server/reportlab/pdfbase/pdfdoc.py | Python | mit | 81,977 |
# Copyright 2012-2013, Damian Johnson
# See LICENSE for licensing information
"""
Connection and networking based utility functions. This will likely be expanded
later to have all of `arm's functions
<https://gitweb.torproject.org/arm.git/blob/HEAD:/src/util/connections.py>`_,
but for now just moving the parts we need... | arlolra/stem | stem/util/connection.py | Python | lgpl-3.0 | 8,605 |
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from .test_sale_shipment_cost import suite
__all__ = ['suite']
| kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/sale_shipment_cost/tests/__init__.py | Python | gpl-3.0 | 209 |
# -*- coding:utf-8 -*-
## src/session.py
##
## Copyright (C) 2008-2014 Yann Leboulanger <asterix AT lagaule.org>
## Copyright (C) 2008 Brendan Taylor <whateley AT gmail.com>
## Jonathan Schleifer <js-gajim AT webkeks.org>
## Stephan Erb <steve-e AT h3c.de>
##
## This file is part o... | irl/gajim | src/session.py | Python | gpl-3.0 | 21,949 |
# encoding: utf-8
import json
import requests
from datetime import datetime
import application.models as Models
from application.cel import celery
from flask import current_app
from configs.enum import LOG_STATS
from application.utils import to_utc
__all__ = ['kuaidi_request']
@celery.task
def kuaidi_request(compan... | seasonstar/bibi | application/services/jobs/express.py | Python | apache-2.0 | 2,248 |
import chainer
from chainer import Variable, optimizers, flag
from chainer import Link, Chain, ChainList
import chainer.functions as F
import chainer.links as L
import numpy as np
import cPickle as pc
import os
import json
# miscellaneous class
class EnvSpec():
def __init__(self, max_steps):
self.timestep_... | iaroslav-ai/gan-rl | gan_rl_fitter.py | Python | mit | 8,469 |
"""Raw Data View: show raw data traces."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import numpy as np
import pandas as pd
import bisect
from galry import (Manager, PlotPaintMana... | DavidTingley/ephys-processing-pipeline | installation/klustaviewa-0.3.0/klustaviewa/views/traceview.py | Python | gpl-3.0 | 25,271 |
from __future__ import absolute_import
from __future__ import unicode_literals
import io
import os
import pytest
from pre_commit_hooks.check_merge_conflict import detect_merge_conflict
from pre_commit_hooks.util import cmd_output
from testing.util import cwd
from testing.util import write_file
# pylint:disable=unu... | arahayrabedian/pre-commit-hooks | tests/check_merge_conflict_test.py | Python | mit | 3,248 |
# -*- coding: utf-8 -*-
# (c) 2016 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import wiz_stock_information
from . import wiz_create_procurement_stock_info
from . import wiz_run_procurement_stock_info
| alfredoavanzosc/odoo-addons | stock_information/wizard/__init__.py | Python | agpl-3.0 | 261 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.jvm
~~~~~~~~~~~~~~~~~~~
Pygments lexers for JVM languages.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, ... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/pygments/lexers/jvm.py | Python | gpl-3.0 | 48,592 |
#!/usr/bin/env python
from pybloom_live import BloomFilter
class MultigramSearch(object):
"""
This datastructure is useful when you have many potential subsequence that
you wish to find within a target sequence. An example is finding which of
several thousands of phrases occures within a given text.
... | mynameisfiber/pymicha | pymicha/datastructures/multigramsearch.py | Python | mit | 2,851 |
"""
Import OpenAI Gym Wrapper
"""
| sisl/Chimp | chimp/simulators/gym/__init__.py | Python | apache-2.0 | 35 |
#!/usr/bin/env python3
import sys
import xml.etree.ElementTree as ET
# -----------------------------------------------------------------------------
# replace the text between two lines starting with 'delimiter' in file 'fold'
# by the text between two lines starting with 'delimiter' in file 'ftouse'.
# Write new con... | noferini/AliceO2 | scripts/datamodel-doc/mdUpdate.py | Python | gpl-3.0 | 3,371 |
# -*- coding: utf8 -*-
"""
The ``last.fm`` plugin
===================
Inspired from OneBot (What.cd)
"""
| salas106/lahorie | lahorie/plugins/lastfm.py | Python | mit | 123 |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2011 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
import logging
from sleekxmpp.xmlstream import JID
from sleekxmpp.xmlstream.handler import Callback
from sleekxmpp.xmlstream.matcher import Sta... | tiancj/emesene | emesene/e3/xmpp/SleekXMPP/sleekxmpp/plugins/xep_0060/pubsub.py | Python | gpl-3.0 | 25,426 |
# -*- coding: utf-8 -*-
import sys
def get_skeleton(N, strings):
skeletons = []
for i in range(N):
skeleton = [strings[i][0]]
skeleton += [strings[i][j] for j in range(1, len(strings[i])) if strings[i][j] != strings[i][j-1]]
skeletons.append(skeleton)
for i in range(1, N):
... | changyuheng/code-jam-solutions | 2014/Round 1B/A.py | Python | mit | 1,248 |
../../../../../../../share/pyshared/papyon/service/description/Sharing/FindMembership.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/papyon/service/description/Sharing/FindMembership.py | Python | gpl-3.0 | 88 |
# -*- coding: utf-8 -*-
import sys
from optparse import OptionParser
from generator import AppGenerator, APP_TYPES
def main():
usage = '''usage: %prog [options]
ex) run.py -t 1 -n hello_python
'''
parser = OptionParser(usage=usage)
parser.add_option('-t', '--type', dest='type',
... | SeoDongMyeong/flask-app-generator | src/flask_app_generator/run.py | Python | mit | 1,162 |
# Copyright (c) 2014 Evalf
#
# 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, distribute, s... | wijnandhoitinga/nutils | nutils/points.py | Python | mit | 18,587 |
#
# colors.py -- color definitions
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import re
color_dict = {
'aliceblue': (0.9411764705882353, 0.9725490196078431, 1.0... | rupak0577/ginga | ginga/colors.py | Python | bsd-3-clause | 49,185 |
project_slug = '{{ cookiecutter.project_slug }}'
if hasattr(project_slug, 'isidentifier'):
assert project_slug.isidentifier(), 'Project slug should be valid Python identifier!'
| kappataumu/cookiecutter-django | hooks/pre_gen_project.py | Python | bsd-3-clause | 184 |
# coding=utf-8
# Author: Clinton Collins <clinton.collins@gmail.com>
# Medicine: Dustyn Gibson <miigotu@gmail.com>
# This file is part of SickChill.
#
# SickChill 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 Foundatio... | eleonrk/SickRage | sickbeard/clients/putio_client.py | Python | gpl-3.0 | 2,165 |
import numpy as np
from lfd.rapprentice import transformations
try:
import geometry_msgs.msg as gm
import rospy
except ImportError:
print "couldn't import ros stuff"
def pose_to_trans_rot(pose):
return (pose.position.x, pose.position.y, pose.position.z),\
(pose.orientation.x, pose.orientatio... | rll/lfd | lfd/rapprentice/conversions.py | Python | bsd-2-clause | 3,751 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Pelix interactive shell
Provides a console interface for the Pelix shell, based on readline when
available.
:author: Thomas Calmant
:copyright: Copyright 2020, Thomas Calmant
:license: Apache License 2.0
:version: 1.0.1
..
Copyright 2020 Thomas Calmant
... | tcalmant/ipopo | pelix/shell/console.py | Python | apache-2.0 | 20,364 |
#!/usr/bin/env python
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | ekasitk/sahara | sahara/cli/sahara_all.py | Python | apache-2.0 | 1,772 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | pixelrebel/st2 | st2common/st2common/bootstrap/sensorsregistrar.py | Python | apache-2.0 | 6,750 |
import itertools
import warnings
import numpy as np
from numpy import (arange, array, dot, zeros, identity, conjugate, transpose,
float32)
import numpy.linalg as linalg
from numpy.random import random
from numpy.testing import (assert_equal, assert_almost_equal, assert_,
... | WarrenWeckesser/scipy | scipy/linalg/tests/test_basic.py | Python | bsd-3-clause | 62,678 |
# Copyright 2016 The Kubernetes 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 ... | dchen1107/test-infra | gubernator/view_pr.py | Python | apache-2.0 | 7,528 |
# efficiency.py - functions for computing node, edge, and graph efficiency
#
# Copyright 2011, 2012, 2013, 2014, 2015 NetworkX developers
#
# This file is part of NetworkX.
#
# NetworkX is distributed under a BSD license; see LICENSE.txt for more
# information.
"""Provides functions for computing the efficiency of node... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/networkx/algorithms/efficiency.py | Python | gpl-3.0 | 4,363 |
#!/usr/bin/env python
from gi.repository import Gtk
from kiwi.controllers import BaseController
from kiwi.ui.views import BaseView
class FarenControl(BaseController):
def convert_temperature(self, temp):
celsius = (temp - 32) * 5 / 9.0
farenheit = (temp * 9 / 5.0) + 32
return farenheit, ... | stoq/kiwi | examples/framework/faren/faren2.py | Python | lgpl-2.1 | 1,463 |
from billing.integrations.samurai_integration import SamuraiIntegration
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
try:
import json
except ImportError:
import simplejson as json
except ImportError:
from django.utils import simplejson as json
class SamuraiExamp... | SimpleTax/merchant | example/app/integrations/samurai_example_integration.py | Python | bsd-3-clause | 542 |
import hashlib
import typing
import uuid
from os import path
from datetime import datetime
from collections import namedtuple
from functools import partial
from flask_restful import fields as flask_fields
from sqlalchemy import case
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy import func, selec... | cloudify-cosmo/cloudify-manager | rest-service/manager_rest/storage/resource_models.py | Python | apache-2.0 | 87,622 |
import sys
def pad(map):
size = max(*[len(l) for l in map])
return [l + (" "*(size-len(l))) for l in map]
def parse(f):
maps = []
current = []
for line in f.readlines():
if line[0] == ';': continue
if len(line.strip()):
current.append(line.rstrip("\n"))
elif len... | dbreen/sokoban | bin/parse-levels.py | Python | mit | 769 |
"""
util.py
~~~~~~~~~~~~
contains utility functions.
"""
import json
import hashlib
import datetime
import math
def current_time():
return str(datetime.datetime.utcnow())
def add_time(timestamp, seconds):
previous_timestamp = to_datetime(timestamp)
return str(previous_timestamp + datetime.ti... | samuelwu90/PynamoDB | PynamoDB/util.py | Python | mit | 2,717 |
# Copyright (c) 2013 Mirantis, 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... | ativelkov/murano-api | murano/db/services/sessions.py | Python | apache-2.0 | 5,708 |
# Copyright 2004-2020 Odoo S.A.
# Copyright 2020 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# Licence LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0).
{
"name": "Import Statement Files",
"category": "Accounting",
"version": "14.0.2.0.0",
... | OCA/bank-statement-import | account_statement_import/__manifest__.py | Python | agpl-3.0 | 856 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.racing.RaceGag
from panda3d.core import BitMask32, CollideMask, CollisionNode, CollisionTube, NodePath, Point3, Vec3
from direct.interval.IntervalGlobal import *
from direct.showbase import DirectObject
from DroppedGag import *
types = ['',
'Pie... | DedMemez/ODS-August-2017 | racing/RaceGag.py | Python | apache-2.0 | 2,548 |
from __future__ import absolute_import
from __future__ import print_function
import unittest
import tools.lib.template_parser
from tools.lib.html_branches import (
get_tag_info,
html_branches,
html_tag_tree,
)
class TestHtmlBranches(unittest.TestCase):
def test_get_tag_info(self):
# type: ... | cosmicAsymmetry/zulip | tools/tests/test_html_branches.py | Python | apache-2.0 | 3,549 |
# 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 wri... | GoogleCloudPlatform/python-docs-samples | iam/api-client/workload_identity_federation_test.py | Python | apache-2.0 | 998 |
'''
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.
Notes: It is intended for this problem to be specified vaguely (ie, no given input specs). You are responsible t... | gavinfish/leetcode-share | python/008 String to Integer.py | Python | mit | 2,466 |
#-*- coding: ISO-8859-1 -*-
# pysqlite2/test/hooks.py: tests for various SQLite-specific hooks
#
# Copyright (C) 2006-2007 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for... | teeple/pns_server | work/install/Python-2.7.4/Lib/sqlite3/test/hooks.py | Python | gpl-2.0 | 7,206 |
from pyb import Pin
p = Pin('X8', Pin.IN)
print(p)
print(p.name())
print(p.pin())
print(p.port())
p = Pin('X8', Pin.IN, Pin.PULL_UP)
p = Pin('X8', Pin.IN, pull=Pin.PULL_UP)
p = Pin('X8', mode=Pin.IN, pull=Pin.PULL_UP)
print(p)
print(p.value())
p.init(p.IN, p.PULL_DOWN)
p.init(p.IN, pull=p.PULL_DOWN)
p.init(mode=p.IN... | pozetroninc/micropython | tests/pyb/pin.py | Python | mit | 554 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from nose.tools import (assert_equal, assert_is, assert_is_not,
assert_raises)
import pandas as pd
from ggplot import *
from ggplot.utils.exceptions import GgplotError
from . import clea... | ricket1978/ggplot | ggplot/tests/test_stat_calculate_methods.py | Python | bsd-2-clause | 2,240 |
#!/usr/bin/python3
from DistUtilsExtra.auto import setup
setup(
name = 'same-ball',
version = '0.9.4',
author = 'David Lazăr',
author_email = 'dlazar@gmail.com',
license = 'Apache License 2.0',
description = 'Colored balls puzzle game',
long_description = 'Remove groups of two or more ball... | dlzr/same-ball | setup.py | Python | apache-2.0 | 493 |
import numpy as np
from numpy.testing import *
from ..admm import Lasso, ElasticNet #, ElasticNetCV, LassoCV, enet_path
#from ..base import RidgeRegression
def test_lasso_zero():
"""Check that Lasso can handle zero data."""
X = [[0], [0], [0]]
y = [0, 0, 0]
model = Lasso(tau=0).fit(X, y)
pred = mo... | slipguru/l1l2py | l1l2py/tests/test_admm.py | Python | gpl-3.0 | 3,176 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
Catalog.py
---------------------
Date : June 2014
Copyright : (C) 2014 by Agresta S. Coop
Email : iescamochero at agresta dot org
***********************... | michaelkirk/QGIS | python/plugins/processing/algs/lidar/fusion/Catalog.py | Python | gpl-2.0 | 4,062 |
# Copyright 2012-2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | varunarya10/python-openstackclient | openstackclient/shell.py | Python | apache-2.0 | 12,311 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" This package contains the qibuild actions. """
from __future__ import absolute_import
from __future__ import unicode_li... | aldebaran/qibuild | python/qibuild/actions/__init__.py | Python | bsd-3-clause | 365 |
class PopulationModel:
def __init__(self, world):
self.world = world
def population_of_hex(self, hid):
pass
def population_of_city(self, cid):
pass
| connor-cash/nesonomics | NESCore/PopulationModel.py | Python | gpl-3.0 | 186 |
print('Welcome to Moustacheminer Server Services Music Bot')
import json
import traceback
import discord
from os import path
from discord.ext import commands
from discord.ext.commands import errors as commands_errors
with open(path.abspath(path.join(path.dirname(__file__), '..', 'config', 'default.json'))) as f:
... | moustacheminer/MSS-Discord | music/bot.py | Python | mit | 2,252 |
from spec.helper import *
from pygame import Surface
from pygametemplate import Image
with description("pygametemplate.Image"):
with it("should initialise correctly, without loading a Surface object"):
self.image = Image("test.png")
expect(self.image.file).to(equal("test.png"))
expect(se... | AndyDeany/pygame-template | spec/image_spec.py | Python | mit | 806 |
# Copyright 2017 Battelle Energy Alliance, 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 t... | idaholab/raven | tests/framework/pca_sparseGridCollocation/scgpcMVNUncorrelated/polynomial.py | Python | apache-2.0 | 804 |
from celery import Celery
from puzzle_engine.hitori.solve import solve_hitori
app = Celery()
@app.task(queue='engine_worker')
def run_hitori_solve(hitori_data):
return solve_hitori(hitori_data)
| nathandaddio/puzzle_app | puzzle_engine/puzzle_engine/engine_worker.py | Python | mit | 204 |
##################################################################
# Extract a dbtable for every instance of a value in a geo-file #
# Written by Thomas Fish #
# Released under the MIT License #
# ... | Guerillero/ArcExtractor | Extractor.py | Python | mit | 2,156 |
"""
Small program to show the acceleration of the x and y axis on the LEDs. The
more you accelerate the board, the more LEDs light up.
An easy way to test this is to hold the board vertically. This causes the
gravity to "pull" on the accelerator – the LEDs light up.
"""
import pyb
import math
leds = [pyb.LED(i) for ... | dbrgn/micropython-scripts | led_accel.py | Python | mit | 886 |
#
# This file is part of pyasn1 software.
#
# Copyright (c) 2005-2016, Ilya Etingof <ilya@glas.net>
# License: http://pyasn1.sf.net/license.html
#
# Original concept and code by Mike C. Fletcher.
#
import sys
from pyasn1.type import error
class AbstractConstraint:
"""Abstract base-class for constraint objects
... | filippog/pyasn1 | pyasn1/type/constraint.py | Python | bsd-3-clause | 7,064 |
import time
class Clock:
def __init__(self):
self.t = 0
def add(self, n):
self.t += n
def set(self, t):
self.t = t
def inc(self, amt=1):
self.t += amt
def now(self):
return self.t
def clock_fake():
ob = Clock()
return ob
| solent-eng/solent | testing/eng/clock.py | Python | lgpl-3.0 | 292 |
from django.conf.urls import url
from .views import (
TeamListView, TeamDetailView, CreateTeamView, InviteTeamMemberView,
JoinTeamView, ChangeTeamMemberRoleView, DeleteTeamMemberRoleView,
JoinTeamUserView, DeleteTeamView
)
urlpatterns = [
url(r'^$', TeamListView.as_view(), name='team-list'),
url(r... | stefanw/froide | froide/team/urls.py | Python | mit | 1,057 |
def main():
while True:
m,n = eval(input("Please enter two integers separated by a comma: "))
if (m,n) == (0,0):
print("The greatest common divisor does not exist.")
break
else:
answer = gcd(m,n)
print("The greatest common divisor is: ", answer... | jameslivulpi/pythonprograms | gcd.py | Python | gpl-3.0 | 471 |
"""Extensions which are maintained in-tree.
All public modules (those not beginning with ``_``) in this package are
extensions. They could, in concept, be maintained separately from HIL
core, but are in-tree as they are maintained by the core developers.
"""
| SahilTikale/haas | hil/ext/__init__.py | Python | apache-2.0 | 260 |
# Copyright (c) 2001-2017, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | pbougue/navitia | source/jormungandr/jormungandr/scenarios/helper_classes/helper_future.py | Python | agpl-3.0 | 3,660 |
# -*- coding: utf-8 -*-
# pylint: disable=fixme, invalid-name
"""
Classes representing Sonos UPnP services.
>>> s = SoCo('192.168.1.102')
>>> print s.RenderingControl.GetMute([('InstanceID', 0),
... ('Channel', 'Master')])
>>> r = s.ContentDirectory.Browse([
... ('ObjectID', 'Q:0'),
... ('BrowseFlag', 'Bro... | xxdede/SoCo | soco/services.py | Python | mit | 29,569 |
# This file is part of Pimlico
# Copyright (C) 2020 Mark Granroth-Wilding
# Licensed under the GNU LGPL v3.0 - https://www.gnu.org/licenses/lgpl-3.0.en.html
import os
from pimlico.core.dependencies.python import numpy_dependency
from pimlico.core.modules.base import BaseModuleInfo
from pimlico.datatypes.embeddings im... | markgw/pimlico | src/python/pimlico/modules/input/embeddings/fasttext_vec/info.py | Python | gpl-3.0 | 2,047 |
from django.test import TestCase
from django.shortcuts import resolve_url
class TestCase(TestCase):
def assertStatusCode(self, status_code, fn, urlconf, *args, **kwargs):
response = fn(resolve_url(urlconf, *args, **kwargs))
self.assertEqual(
response.status_code,
status_cod... | lamby/trydiffoscope | trydiffoscope/utils/test.py | Python | agpl-3.0 | 1,316 |
# XXX TO DO:
# - popup menu
# - support partial or total redisplay
# - more doc strings
# - tooltips
# object browser
# XXX TO DO:
# - for classes/modules, add "open source" to object browser
import re
from idlelib.TreeWidget import TreeItem, TreeNode, ScrolledCanvas
from repr import Repr
myrepr = Repr()
myrepr.m... | svanschalkwyk/datafari | windows/python/Lib/idlelib/ObjectBrowser.py | Python | apache-2.0 | 4,376 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
install_requires = ['Ghost.py']
try:
import argparse
except ImportError:
install_requires.append('argparse')
setup(
name='Kanedama',
version='0.1.1',
provides=['kanedama'],
description='Download and email Heroku invoi... | jimr/Kanedama | setup.py | Python | mit | 1,363 |
from django.http import HttpResponse
import re
import json
from elasticsearch import Elasticsearch, RequestsHttpConnection
from requests_aws4auth import AWS4Auth
host = 'search-tweetmap-5mngdbvk7sf2ax3j6t7z2hhznq.us-west-2.es.amazonaws.com'
awsauth = AWS4Auth('', '','us-west-2', 'es')
es = Elasticsearch(
hosts=[{'h... | aw3011/tweetMap | tweetMapProject/tweetMapProject/getJSON.py | Python | gpl-3.0 | 782 |
#/usr/bin/env python
import Queue
import threading
def test_queue():
def worker():
while not q.empty():
item = q.get()
print item
q.task_done()
print threading.current_thread().getName()
q = Queue.Queue()
for item in ['hello', 'world', 'haha', 'liwei', 'se... | seckcoder/lang-learn | python/queue_user.py | Python | unlicense | 972 |
def groupby(iterable, key=None):
"""
Group items from iterable by key and return a dictionary where values are
the lists of items from the iterable having the same key.
:param key: function to apply to each element of the iterable.
If not specified or is None key defaults to identity function and... | alexandershov/mess | mess/dicts.py | Python | mit | 686 |
import asyncio
import logging
import websockets
from jsonrpcclient.clients.websockets_client import WebSocketsClient
from jsonrpcclient.requests import Request, Notification
async def main():
async with websockets.connect("ws://localhost:5000") as ws:
requests = [Request("ping"), Notification("ping"), ... | bcb/jsonrpcclient | examples/websockets/batch.py | Python | mit | 634 |
# -*- coding: utf-8 -*-
""" Python-bash (Pash)
This module contains a class which uses 'Popen' from the 'subprocess'
module in the standard Python library in order to easily carry out
interactions with the bourne-again shell.
While this module was written for and tested with Ubuntu 14.04, it
it may function in other ... | iansmcf/pash | pash.py | Python | bsd-3-clause | 5,635 |
# Generated by Django 2.1 on 2018-08-13 07:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ibms', '0004_auto_20180326_1257'),
]
operations = [
migrations.CreateModel(
name='ServicePriorityMappings',
fields=[
... | parksandwildlife/ibms | ibms_project/ibms/migrations/0005_serviceprioritymappings.py | Python | apache-2.0 | 1,083 |
# Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | lordmos/blink | Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py | Python | mit | 8,514 |
# Copyright 2017 Balazs Nemeth
#
# 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, s... | 5GExchange/mapping | generator/CarrierTopoBuilder.py | Python | apache-2.0 | 30,515 |
#!/usr/bin/python
import tkinter
top = tkinter.Tk()
top.title("Bigsby on tKinter")
# Code to add widgets will go here...
top.mainloop() | Bigsby/PoC | Other/tKintering/empty.py | Python | apache-2.0 | 136 |
from mapgeist.keywords.stemming import StemmingHelper
from mapgeist.keywords.single_doc_keywords import (
get_word_sets_file, get_param_matrices,
get_weightage_values)
| sachinrjoglekar/MapGeist | mapgeist/keywords/__init__.py | Python | mit | 176 |
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Yahoo! Inc. All Rights Reserved.
#
# 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.... | novel/fasteners | fasteners/_utils.py | Python | apache-2.0 | 3,815 |
#!/usr/bin/env python
# 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 is a simple HTTP/FTP/TCP/UDP/BASIC_AUTH_PROXY/WEBSOCKET server used for
testing Chrome.
It supports several test URLs, as spec... | fujunwei/chromium-crosswalk | net/tools/testserver/testserver.py | Python | bsd-3-clause | 85,023 |
from zipfile_infolist import print_info
import zipfile
print('creating archive')
with zipfile.ZipFile('write.zip', mode='w') as zf:
print('adding README.txt')
zf.write('README.txt')
print()
print_info('write.zip')
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_data_compression_and_archiving/zipfile_write.py | Python | apache-2.0 | 224 |
# Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
#
# 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 la... | pjotrp/genenetwork2 | wqflask/base/webqtlCaseData.py | Python | agpl-3.0 | 2,817 |
#!/usr/bin/env python
###
# (C) Copyright (2012-2015) Hewlett Packard Enterprise Development LP
#
# 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 limita... | ufcg-lsd/python-hpOneView | examples/scripts/get-storage-systems.py | Python | mit | 5,218 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-10-01 19:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('investments', '0011_auto_20180927_1712'),
]
operations = [
migrations.Alte... | hpfn/charcoallog | charcoallog/investments/migrations/0012_auto_20181001_1935.py | Python | gpl-3.0 | 626 |
from datetime import timedelta, datetime
from django.core.serializers import serialize
from django.http import HttpResponse
from django.views.generic import View
from django.urls import path
from django.utils.decorators import method_decorator
from django.utils import timezone
from django.contrib.gis.geos import LineSt... | ropable/resource_tracking | tracking/geojsonviews.py | Python | bsd-3-clause | 6,030 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.