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 |
|---|---|---|---|---|---|
#
# 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 us... | spark-test/spark | python/pyspark/resource/tests/test_resources.py | Python | apache-2.0 | 3,846 |
from __future__ import division
import math
import os
import sys
import matplotlib
from matplotlib import verbose
from matplotlib.cbook import is_string_like, onetrue
from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
FigureManagerBase, FigureCanvasBase, NavigationToolbar2, IdleEvent, curso... | runt18/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_qt4.py | Python | agpl-3.0 | 20,731 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-12 15:43
import collections
import jsonfield.fields
from django.db import migrations
import collections
class Migration(migrations.Migration):
dependencies = [
('django_netjsonconfig', '0010_basemodel_reorganization'),
]
operations =... | openwisp/django-netjsonconfig | django_netjsonconfig/migrations/0011_template_config_blank.py | Python | gpl-3.0 | 821 |
"""
Django settings for email_auth project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import o... | jacruzsdev/django_1.11_auth_email | email_auth/email_auth/settings.py | Python | gpl-3.0 | 3,245 |
import datetime
import random
import struct
from zlib import compress
def unpack_legacy_message(self):
"""Unpack a legacy buffer message
This routine unpacks a buffer message written by the LabVIEW DAQ
software version 2.1.1 and below. Versions 2.2 and above use a version
identifier in the message. ... | HiSPARC/sapphire | scripts/kascade/read_sqldump/legacy.py | Python | gpl-3.0 | 4,556 |
# -*- coding: utf-8 -*-
"""
celery.canvas
~~~~~~~~~~~~~
Composing task workflows.
Documentation for these functions are in :mod:`celery`.
You should not import from this module directly.
"""
from __future__ import absolute_import
from copy import deepcopy
from functools import partial as _partia... | mozilla/firefox-flicks | vendor-local/lib/python/celery/canvas.py | Python | bsd-3-clause | 14,524 |
from __future__ import print_function, division, absolute_import
import numpy as np
from PLIdentify import PL_identify
import cPickle as pk
data = pk.load(open('./dump_robust.txt', 'r'))
I_rec = data['I_rec']
# import ipdb;ipdb.set_trace()
n = len(I_rec) # window size
m = I_rec[0].shape[0] # no. of PLs
D = np.zeros((m... | hbhzwj/SADIT | Example/Configs_anomaly_TCNS/PLIdentify/RunPLIdentify.py | Python | gpl-3.0 | 949 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 3 of the Lic... | tumbl3w33d/ansible | lib/ansible/modules/network/fortios/fortios_system_autoupdate_push_update.py | Python | gpl-3.0 | 9,556 |
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Rene Dohmen acidjunk@gmail.com
#
# filewalker.py
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License
# as published by the Free Software Foundation. A copy of this license shoul... | childsplay-mobi/cp-pygame | lib/CPData/PhotoalbumData/filewalker.py | Python | gpl-3.0 | 1,697 |
# Copyright (C) Linaro Limited 2015,2016,2017,2019
# Author: Matt Hart <matthew.hart@linaro.org>
# Author: Milo Casagrande <milo.casagrande@linaro.org>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Softwa... | kernelci/kernelci-backend | app/utils/report/build.py | Python | lgpl-2.1 | 22,682 |
def char_concat(word):
mid = len(word) / 2
return ''.join('{}{}'.format(''.join(pair), i)
for i, pair in enumerate(zip(word[:mid],
word[-mid:][::-1]), start=1))
| the-zebulan/CodeWars | katas/kyu_7/character_concatenation.py | Python | mit | 236 |
# pylint: disable=line-too-long
import django.contrib.auth.models as auth_models
from adlt.core import factories as core_factories
def populatedb():
user = auth_models.User.objects.create_superuser(
'superuser', 'superuser@example.com', 'secret', first_name='Super', last_name='User',
)
agent = ... | sirex/atviriduomenys.lt | adlt/populatedb/services.py | Python | agpl-3.0 | 2,087 |
# -*- coding: utf-8 -*-
"""
Teams pages.
"""
from .course_page import CoursePage
from .discussion import InlineDiscussionPage
from ..common.paging import PaginatedUIMixin
from .fields import FieldsMixin
TOPIC_CARD_CSS = 'div.wrapper-card-core'
MY_TEAMS_BUTTON_CSS = 'a.nav-item[data-index="0"]'
BROWSE_BUTTON_CSS = '... | jazztpt/edx-platform | common/test/acceptance/pages/lms/teams.py | Python | agpl-3.0 | 11,435 |
from django.template.loader import render_to_string
def get_change_plan_form(plan_code, subscription_id):
return render_to_string("django_recurly/change_plan_form.html", {
"plan_code": plan_code,
"subscription_id": subscription_id,
}) | pakal/django-recurly | django_recurly/helpers/api.py | Python | bsd-3-clause | 259 |
from routes import API_PATH
from routes.base import BaseBlueprint
from routes.workers.worker import WorkersRoute, WorkerCheckinRoute
class Blueprint(BaseBlueprint):
def __init__(self):
super().__init__("workers", __name__, url_prefix=f"{API_PATH}/workers")
self.register_route(WorkersRoute())
... | openzim/zimfarm | dispatcher/backend/src/routes/workers/__init__.py | Python | gpl-3.0 | 366 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | SeleniumHQ/selenium | py/selenium/webdriver/remote/bidi_connection.py | Python | apache-2.0 | 968 |
# https://oj.leetcode.com/problems/binary-tree-level-order-traversal/
# Definition for a binary tree node
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
# @param root, a tree node
# @return a list of lists of integers
def levelOrder(self, ro... | yaoxuanw007/forfun | leetcode/python/binaryTreeLevelOrderTraversal.py | Python | mit | 847 |
import os
from setuptools import setup, find_packages
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='pybbm-private-messages',... | skolsuper/pybbm_private_messages | setup.py | Python | mit | 1,386 |
#!/usr/bin/env python
# Modified from
# https://github.com/f5devcentral/f5-aws-migrate/blob/master/f5-aws-migrate.py
# Assumptions: Script will be run on a BIGI-IP itself
import os
import sys
import re
import shutil
import tarfile
from tempfile import mkstemp
from optparse import OptionParser
def get_hostname(config... | F5Networks/f5-cloud-libs | scripts/update_autoscale_ucs.py | Python | apache-2.0 | 10,718 |
"""
Copyright 2012 Ali Ok (aliokATapacheDOTorg)
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 wr... | aliok/trnltk | trnltk/morphology/learner/controller/indexcontroller.py | Python | apache-2.0 | 1,425 |
# Authors:
# Jr Aquino <jr.aquino@citrixonline.com>
#
# Copyright (C) 2010 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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, eith... | apophys/freeipa | ipaserver/plugins/sudocmdgroup.py | Python | gpl-3.0 | 6,037 |
import xml.etree.ElementTree as ET
import csv
import sys
import os
#
# convert Treasury Direct Yield XML File to a CSV File
# wget -O ust.xml "http://data.treasury.gov/feed.svc/DailyTreasuryYieldCurveRateData?$filter=year(NEW_DATE)%20eq%202012"
#
def __clean(child):
#tag has prefix xml stuff that's unnecessary
... | jrrpanix/master | examples/python/apps/tsyXMLtoCSV.py | Python | gpl-3.0 | 2,716 |
#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under the
# terms of the GNU General Public License as published by ... | RedhawkSDR/integration-gnuhawk | components/max_ff_1i/tests/test_max_ff_1i.py | Python | gpl-3.0 | 4,061 |
#!/opt/zenoss/bin/python
DEBUG_flag=False
import os
import sys
import re
import urllib2
import json
import time
import datetime
def help():
print "Usage:"
print "hadoop.py -url=SOURCE_JSON_URL -t MAX_TIME_SINCE_LAST_UPDATE_IN_MINUTES (optional)"
sys.exit(3)
if (len(sys.argv) >= 2):
if (len(sys.argv) =... | thomasvincent/utilities | NagiosPlugins/check_hadoop/hadoop.py | Python | apache-2.0 | 3,764 |
"""URL Request utilities."""
from __future__ import unicode_literals
from django.utils.six.moves.urllib.request import Request as BaseURLRequest
class URLRequest(BaseURLRequest):
"""A request that can use any HTTP method.
By default, the :py:class:`urllib2.Request` class only supports HTTP GET
and HTTP... | reviewboard/rbintegrations | rbintegrations/util/urlrequest.py | Python | mit | 1,260 |
"""
Django settings for my_blog project.
Generated by 'django-admin startproject' using Django 1.10.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os... | spark8103/my_blog_tutorial | my_blog/settings.py | Python | mit | 3,594 |
# -*- coding: utf-8 -*-
# https://gist.github.com/114831
# recursive_dictionary.py
# Created 2009-05-20 by Jannis Andrija Schnitzer.
#
# Copyright (c) 2009 Jannis Andrija Schnitzer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (... | skirsdeda/django-filer | filer/utils/recursive_dictionary.py | Python | bsd-3-clause | 3,401 |
# Orca
#
# Copyright 2005-2009 Sun Microsystems Inc.
# Copyright 2010-2013 The Orca Team.
#
# 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 2.1 of the License, or (at you... | GNOME/orca | src/orca/scripts/apps/soffice/script.py | Python | lgpl-2.1 | 37,876 |
# coding: utf-8
# # python-enzymegraph
# A Python package for generating models of enzymes under the quasi-steady-state assumption (QSSA).
#
# ## Requirements
# Currently tested with only Python 3.4.
#
# Requires [sympy](https://github.com/sympy/sympy).
#
# ## Installation
# pip install git+git://github.com/robjs... | robjstan/python-enzymegraph | example/enzymegraph-example.py | Python | mit | 6,370 |
#!/usr/bin/env python
#
# Copyright 2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your optio... | RedhawkSDR/integration-gnuhawk | qa/tests/qa_fft.py | Python | gpl-3.0 | 10,015 |
# $Id$
import os
from itcc.Molecule import atom, molecule
__revision__ = '$Rev$'
def hatree2kcalpermol(hatree):
return 627.51 * float(hatree)
def kcalpermol2hatree(kcalpermol):
return float(kcalpermol) / 627.51
def out2arch(ifname):
TAILLINENUMBER = 100
ifile = os.popen('tail -n %i %s' % (TAILLIN... | lidaobing/itcc | itcc/torsionfit/gaussian.py | Python | gpl-3.0 | 2,223 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
#===============================================================================
#
# Dependencies
#
#-------------------------------------------------------------------------------
from layman.utils import path
from laym... | gentoo/layman | layman/overlays/modules/stub/stub.py | Python | gpl-2.0 | 1,731 |
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class book1(models.Model):
value1 = models.IntegerField()
value2 = models.IntegerField()
value3 = models.IntegerField()
value4 = models.IntegerField()
value5 = models.IntegerField()
value6 = model... | dilwaria/financialgraph | graphs/models.py | Python | mit | 4,109 |
# Copyright 2016 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | VirtueSecurity/aws-extender | BappModules/s3transfer/download.py | Python | mit | 28,306 |
def extractRandomnessShelfBlogspotCom(item):
'''
Parser for 'randomness-shelf.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated')... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractRandomnessShelfBlogspotCom.py | Python | bsd-3-clause | 569 |
#!/usr/bin/python3
import sys
from ifsApprover.web import app
sys.path.append("../")
# run standalone for debugging
if __name__ == "__main__":
app.run(debug=False) | ktt-ol/ifs-approver | backend/cgi/ifs-approver.wsgi.py | Python | mit | 170 |
"""
homeassistant.components.switch.scsgate
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for SCSGate switches.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.scsgate/
"""
import logging
import homeassistant.components.scsgate as scsgate
from ho... | toddeye/home-assistant | homeassistant/components/switch/scsgate.py | Python | mit | 5,589 |
from __future__ import annotations
import copy
from datetime import timedelta
from textwrap import dedent
from typing import (
Callable,
Hashable,
Literal,
final,
no_type_check,
)
import numpy as np
from pandas._libs import lib
from pandas._libs.tslibs import (
BaseOffset,
IncompatibleFre... | dsm054/pandas | pandas/core/resample.py | Python | bsd-3-clause | 67,558 |
def add_root_indicator_segment():
root_indicators = {
'bash': ' \\$ ',
'zsh': ' \\$ ',
'bare': ' $ ',
}
bg = Color.CMD_PASSED_BG
fg = Color.CMD_PASSED_FG
if powerline.args.prev_error != 0:
fg = Color.CMD_FAILED_FG
bg = Color.CMD_FAILED_BG
powerline.append(... | fellipecastro/powerline-shell | segments/root.py | Python | mit | 397 |
"""
HTML Widget classes
"""
try:
set
except NameError:
from sets import Set as set # Python 2.3 fallback
import copy
from itertools import chain
from django.conf import settings
from django.utils.datastructures import MultiValueDict, MergeDict
from django.utils.html import escape, conditional_escape
from dj... | AloneRoad/Inforlearn | vendor/django/forms/widgets.py | Python | apache-2.0 | 25,335 |
# Copyright 2020 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, so... | googleapis/python-automl | samples/snippets/language_sentiment_analysis_predict.py | Python | apache-2.0 | 1,791 |
# BaseSciDocXMLReader and BaseSciDocXMLWriter
#
# Copyright: (c) Daniel Duma 2015
# Author: Daniel Duma <danielduma@gmail.com>
# For license information, see LICENSE.TXT
from __future__ import absolute_import
from proc.general_utils import loadFileText
class BaseSciDocXMLReader(object):
"""
Base class ... | danieldmm/minerva | scidoc/xmlformats/base_classes.py | Python | gpl-3.0 | 1,485 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from flask import g
from sqlalchemy import DDL
from sqlalchemy.di... | mvidalgarcia/indico | indico/modules/events/contributions/models/contributions.py | Python | mit | 19,957 |
# Copyright 2019 Objectif Libre
#
# 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 agr... | openstack/cloudkitty | cloudkitty/api/v2/scope/state.py | Python | apache-2.0 | 9,390 |
from random import randint
from ..core.bunk_user import BunkUser
from .duel_result import DuelResult
"""
Class that represents a duel between two bunk_users
"""
class Duel:
def __init__(self, challenger: BunkUser, opponent: BunkUser):
self.challenger: BunkUser = challenger
self.opponent: BunkUser ... | fugwenna/bunkbot | src/rpg/duel.py | Python | mit | 993 |
#
# Copyright 2011 Twitter, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | twitter/pycascading | examples/word_count.py | Python | apache-2.0 | 1,485 |
# 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 http://mozilla.org/MPL/2.0/.
import os
import posixpath
from StringIO import StringIO
from dmunit import DeviceManagerTestCase
class ExecEnvTestCa... | Yukarumya/Yukarum-Redfoxes | testing/mozbase/mozdevice/sut_tests/test_exec_env.py | Python | mpl-2.0 | 961 |
# -*- coding: utf-8 -*-
import handlers
from django.conf.urls import url, patterns
from anaf.core.api.auth import auth_engine
from anaf.core.api.doc import documentation_view
from anaf.core.api.resource import CsrfExemptResource
ad = {'authentication': auth_engine}
# events resources
eventResource = CsrfExemptResour... | tovmeod/anaf | anaf/events/api/urls.py | Python | bsd-3-clause | 723 |
import logging
import os
import shutil
from typing import Any, Dict, List, Optional
from zerver.data_import.import_util import build_attachment, create_converted_data_files
class AttachmentHandler:
def __init__(self) -> None:
self.info_dict: Dict[str, Dict[str, Any]] = dict()
def handle_message_data... | timabbott/zulip | zerver/data_import/hipchat_attachment.py | Python | apache-2.0 | 4,561 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack import *
class Casacore(CMakePackage):
"""A suite of c++ libraries for radio astronomy data pr... | LLNL/spack | var/spack/repos/builtin/packages/casacore/package.py | Python | lgpl-2.1 | 4,875 |
from __future__ import absolute_import, unicode_literals
import os
import os.path
from freight.constants import PROJECT_ROOT
from freight.exceptions import CommandError
class UnknownRevision(CommandError):
pass
class Vcs(object):
ssh_connect_path = os.path.join(PROJECT_ROOT, 'bin', 'ssh-connect')
def... | jkimbo/freight | freight/vcs/base.py | Python | apache-2.0 | 1,988 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
#TODO add requirements, author_email
config = {
'description' : 'Pattern Detection and Recognition using Deep Learning',
'author' : ['jalFaizy', 'manasikhapke', 'shraddhabgunjal'],
'url' : '',
'aut... | faizankshaikh/Project | project/setup.py | Python | mit | 525 |
from django.contrib.auth.models import User
from django.test import TestCase
import json
from mixer.backend.django import mixer
from catalogue.models import Record, Application
class RecordAPITestCase(TestCase):
def setUp(self):
# Generate a test user for endpoint responses.
self.testuser = User... | rockychen-dpaw/oim-cms | catalogue/test_api.py | Python | apache-2.0 | 1,689 |
#===============================================================================
# Submodules
#===============================================================================
from empty import Empty
from plane import Plane
from sphere import Sphere
from box import Box
from tube import Tube
from cylinder import Cylinde... | kralf/morsel | python/lib/morsel/nodes/panda/solids/__init__.py | Python | gpl-2.0 | 364 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'BackupPolicy'
db.create_table(u'backup_backuppolicy', (
... | kamal-gade/rockstor-core | src/rockstor/backup/migrations/0001_initial.py | Python | gpl-3.0 | 2,438 |
#!/usr/bin/env python
# File: transform.py
import sys
import os
import pathlib
import magic
import multiprocessing as mp
import time
from urllib.parse import urlparse
import bs4
import tqdm
import pygments
import pygments.lexers
import pygments.formatters
from selectolax.parser import HTMLParser
LEXER = pygments.le... | ppwwyyxx/dash-docset-tensorflow | transform.py | Python | apache-2.0 | 4,728 |
import sys
sys.path.insert(0, "../..")
from Cube import *
if sys.version_info[0] >= 3:
raw_input = input
#Define global variables
globalVarCount = {}
globalVarCount['bool'] = 0
globalVarCount['int'] = 0
globalVarCount['float'] = 0
globalVarCount['char'] = 0
localVarCount = {}
localVarCount['bool'] = 0
localVarCou... | sanchezz93/Giga-Compiler | Entrega 4/Giga.py | Python | mit | 13,943 |
# -*- coding: utf-8 -*-
#
# PySPED - Python libraries to deal with Brazil's SPED Project
#
# Copyright (C) 2010-2012
# Copyright (C) Aristides Caldeira <aristides.caldeira at tauga.com.br>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lice... | aricaldeira/PySPED | pysped/cte/leiaute/cte_300.py | Python | lgpl-2.1 | 106,356 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
RandomPointsLayer.py
---------------------
Date : April 2014
Copyright : (C) 2014 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*********... | sebastic/QGIS | python/plugins/processing/algs/qgis/RandomPointsLayer.py | Python | gpl-2.0 | 4,815 |
# -*- coding: utf-8 -*-
from __future__ import division
from numpy import round, maximum as max_, logical_not as not_, logical_or as or_, vectorize
from ...base import * # noqa analysis:ignore
from .base_ressource import nb_enf
class af_enfant_a_charge(Variable):
column = BoolCol
entity_class = Individus... | adrienpacifico/openfisca-france | openfisca_france/model/prestations/prestations_familiales/af.py | Python | agpl-3.0 | 14,785 |
#!/usr/bin/env python
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Tests for detecting function memory leaks (typically the ones
implemented in C). It does so by calling a function many times and... | Haynie-Research-and-Development/jarvis | deps/lib/python3.4/site-packages/psutil/tests/test_memory_leaks.py | Python | gpl-2.0 | 18,259 |
#
# Copyright (C) 2012 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 3 as published by
# the Free Software Foundation.
#
# This program is distributed in the hope... | hmpf/nav | python/nav/web/info/location/urls.py | Python | gpl-3.0 | 1,011 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# JAVIERTV - XBMC Add-on by J (j@gmail.com)
# Version 0.2.99 (17.10.2014)
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Gracias a la librería plugintools de J... | javier3407/Plugin.Video.Eljavitv.iptv | default.py | Python | gpl-3.0 | 200,215 |
import readline
class completer:
def __init__( self, cmds, jids ):
readline.set_completer( self.complete )
readline.parse_and_bind("tab: complete")
self.cmds = cmds
self.jids = jids
def set_jids( self, jids ):
self.jids = jids
def complete( self, word, state, choices=None ):
line = readline.get_line_... | hanzz/spectrum | spectrumctl/spectrum/completer.py | Python | gpl-2.0 | 652 |
#!/usr/bin/env python3
import sys
from makediary.DiaryInfo import DiaryInfo
from makediary.DSC import preamble, postamble
from makediary.PostscriptPage import PostscriptPage
class ImageFilePage(PostscriptPage):
"""A page whose content is made up of an image file."""
def __init__(self, dinfo... | russells/makediary | makediary/ImageFilePages.py | Python | gpl-2.0 | 3,593 |
#!/usr/bin/python
# -*- coding: utf8 -*-
#from qt import *
from PyQt4 import QtCore, QtGui
#Todo: gérer le cas où n sélectionne un élément pour le changer de couleur
#class MyQListBoxText(QListBoxText):
# color = {'OK':QColor(0,170,127),'NOOK':QColor(170,2,86),'BADCOMPRESSION':QColor('lightgray'),'SELECTED':QColo... | naparuba/pyndsgest | myQListBoxText.py | Python | gpl-2.0 | 1,300 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... | Kraymer/beets | test/test_ui.py | Python | mit | 49,238 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2016-12-06 09:04
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cms', '0016_auto_20160608_1535'),
('maps', '0002_au... | rouxcode/django-cms-plugins | cmsplugins/maps/migrations/0003_googlemap_cms_page.py | Python | mit | 601 |
# This file is part of Buildbot. Buildbot 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.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | pmisik/buildbot | master/buildbot/data/changes.py | Python | gpl-2.0 | 8,824 |
'''
Created on 22 lut 2014
@author: mkieszek
'''
from openerp.osv import osv, fields
class jp_candidate_tag(osv.Model):
def name_get(self, cr, uid, ids, context=None):
"""Return the categories' display name, including their direct
parent by default.
:param dict context: the ``pa... | mkieszek/jobsplus | jobsplus_marketing/jp_candidate_tag.py | Python | agpl-3.0 | 3,032 |
# Copyright 2020 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, ... | GoogleCloudPlatform/repo-automation-playground | xunit-autolabeler-v2/ast_parser/lib/file_utils.py | Python | apache-2.0 | 3,255 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.system.forms
~~~~~~~~~~~~~~~~~~~~~~~
Forms for the system app.
:copyright: 2011 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from django.forms import Form, CharField, TextInput, BooleanField,... | svschannak/openslides-templates-pmv | openslides/system/forms.py | Python | gpl-2.0 | 3,753 |
"""
This module implements AIMP-like headers for playlists, which help to distinguish
songs from different directories.
"""
import gtk
import pango
import cairo
import gobject
import glib
import os.path
import re
"""
CellRenderer for ui.treeview. Columns for songs, which need a header, must have a
gproperty "aimp_hea... | themylogin/sonata | sonata/aimpheaders.py | Python | gpl-3.0 | 3,991 |
from datetime import datetime, timedelta, timezone as datetime_timezone
import pytz
try:
import zoneinfo
except ImportError:
try:
from backports import zoneinfo
except ImportError:
zoneinfo = None
from django.conf import settings
from django.db.models import (
DateField, DateTimeField... | elena/django | tests/db_functions/datetime/test_extract_trunc.py | Python | bsd-3-clause | 69,302 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | lukeiwanski/tensorflow | tensorflow/python/keras/estimator/__init__.py | Python | apache-2.0 | 1,873 |
import xbmcgui
#abstract
class Li(object):
def __init__(self, title, icon, thumb, url, isFolder, isPlayalbe,
videoInfoLabels, generalInfoLabels, contextMenus=None):
li = xbmcgui.ListItem(title, iconImage=icon, thumbnailImage=thumb)
if isPlayalbe:
... | SportySpice/Collections | src/li/Li.py | Python | gpl-2.0 | 913 |
from sqlalchemy.util import topological
from test.lib.testing import assert_raises, eq_
from test.lib.util import conforms_partial_ordering
from sqlalchemy import exc
from test.lib import fixtures
class DependencySortTest(fixtures.TestBase):
def assert_sort(self, tuples, allitems=None):
if allitems is Non... | ioram7/keystone-federado-pgid2013 | build/sqlalchemy/test/base/test_dependency.py | Python | apache-2.0 | 8,756 |
#! /usr/bin/env python
"""
based on https://github.com/tomchristie/django-rest-framework/blob/master/runtests.py
"""
from __future__ import print_function
import pytest
import sys
import os
import subprocess
PYTEST_ARGS = {
'default': ['tests'],
'fast': ['tests', '-q'],
}
FLAKE8_ARGS = ['rest_framework_frie... | FutureMind/drf-friendly-errors | runtests.py | Python | mit | 2,452 |
# (C) British Crown Copyright 2014, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... | Jozhogg/iris | lib/iris/tests/unit/fileformats/grib/load_convert/test_time_range_unit.py | Python | lgpl-3.0 | 1,951 |
# Dynamic wpa_supplicant interface
# Copyright (c) 2013, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import subprocess
import time
import hwsim_utils
import hostapd
from wpasupplicant import... | wangybgit/Chameleon | hostapd-OpenWrt/tests/hwsim/test_sta_dynamic.py | Python | apache-2.0 | 11,322 |
import xbmcgui
import urllib
import time
def download(url, dest, dp = None):
if not dp:
dp = xbmcgui.DialogProgress()
dp.create("YCBeast Wizard","Downloading the Freshness",' ', ' ')
dp.update(0)
start_time=time.time()
urllib.urlretrieve(url, dest, lambda nb, bs, fs: _pbhook(n... | anyoneuno/ycrepo | plugin.program.ycbeast/resources/libs/downloader.py | Python | gpl-3.0 | 1,331 |
import glib
import gst
from common import TestCase
import ges
class GlobalFunctions(TestCase):
def testGlobalFunctions(self):
tl = ges.timeline_new_audio_video()
tr = ges.timeline_standard_transition_new_for_nick("crossfade")
| freesteph/gst-editing-services | bindings/python/testsuite/test_global_functions.py | Python | lgpl-2.1 | 249 |
import json
from functools import wraps
from flask import request
from utils.exceptions import HttpBadRequest
from utils.validators import ValidationError
class validate(object):
def __init__(self, rules):
self.rules = rules
def get_params(self):
if request.method in ['POST', 'PUT']:
return json... | vtemian/kruncher | utils/decorators/validate.py | Python | apache-2.0 | 798 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#******************************************************************************
#
# This file is part of the lizard_waterbalance Django app.
#
# The lizard_waterbalance app is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public Li... | nens/timeseries | timeseries/timeseriesstub.py | Python | gpl-3.0 | 31,231 |
from Object.PotionList import PotionList
from Object.Potion import Potion
from Object.PotionColor import PotionColor
from Object.PotionSign import PotionSign
from Object.Ingredient import Ingredient
from Object.IngredientProperties import IngredientProperties
class PotionCombinations:
def distinct_potions_list(potio... | josephxsxn/alchemists_notepad | Routine/PotionCombinations.py | Python | apache-2.0 | 2,880 |
# Copyright (C) 2016 - Yevgen Muntyan
# Copyright (C) 2016 - Ignacio Casal Quinteiro
# Copyright (C) 2016 - Arnavion
#
# 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 t... | wingtk/gvsbuild | gvsbuild/projects/gtk.py | Python | gpl-2.0 | 8,166 |
#!/usr/bin/python
#======================================================================
#
# Project : hpp_IOStressTest
# File : IOST_WRun_SPI.py
# Date : Oct 25, 2016
# Author : HuuHoang Nguyen
# Contact : hhnguyen@apm.com
# : hoangnh.hpp@gmail.com
# License : MIT License
# Copyright : 2016
# D... | HPPTECH/hpp_IOSTressTest | Refer/IOST_OLD_SRC/IOST_0.17/Libs/IOST_WRun_SPI.py | Python | mit | 6,038 |
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields
from openerp import tools
class DaftarKlienNonAuditUmum(models.Model):
_name = "l10n_id.ppajp_daftar_klien_non_audit_umum"
_description = "PPAJP - ... | open-synergy/opnsynid-l10n-indonesia | l10n_id_ppajp_daftar_klien_non_audit_umum/reports/daftar_klien_non_audit_umum.py | Python | agpl-3.0 | 3,129 |
from flask.ext.wtf import Form
from wtforms import TextField, BooleanField, SelectField
from wtforms.validators import Required
class GetIdForm(Form):
identifier = TextField('identifier', validators = [Required()])
class SearchForm(Form):
text = TextField('text', validators = [Required()])
class SearchItemsF... | pombreda/https-gitorious.org-appstream-figment | figment/forms.py | Python | gpl-3.0 | 627 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os,socket,tempfile,time
try:
import http.client as httplib
from urllib import request as url_request
except ImportError: #above is available in py3+,below is py2.7
import httplib as httplib
import urllib as url_request
#配置app
def configure_app(app)... | quentin-xia/Maticv | common/app.py | Python | mit | 1,573 |
from mas.multiagent import *
class TouchPointOracle(OracleSpace) :
def touch(self, c, d = 0) :
blocks = []
for obj in self.get_objs_at(c, d) :
l = ppdist_l2(obj.pos, c)
x = obj.pos[0] - c[0]
y = obj.pos[1] - c[1]
if (abs(l) > 0.001) :
... | csningli/MultiAgent | mas/extension.py | Python | apache-2.0 | 1,352 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import abc
from typing import cast, TYPE_CHECKING
from .. import CredentialUnavailableError
from .._internal.managed_identity_client import ManagedIdentityClient
from .... | Azure/azure-sdk-for-python | sdk/identity/azure-identity/azure/identity/_internal/managed_identity_base.py | Python | mit | 2,084 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2022 GEM Foundation
#
# OpenQuake 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 Licen... | gem/oq-engine | openquake/calculators/base.py | Python | agpl-3.0 | 54,542 |
"""Config flow for the Abode Security System component."""
from __future__ import annotations
from http import HTTPStatus
from typing import Any, cast
from abodepy import Abode
from abodepy.exceptions import AbodeAuthenticationException, AbodeException
from abodepy.helpers.errors import MFA_CODE_REQUIRED
from request... | rohitranjan1991/home-assistant | homeassistant/components/abode/config_flow.py | Python | mit | 5,964 |
import random
import sys
n = int(sys.argv[1])
tst = []
for ix in range(n):
x = 0
while x == 0:
x = random.randrange(-10000, 10001)
tst.append(x)
print n, n
print ' '.join(map(str, tst))
| pbl64k/HackerRank-Contests | 2014-10-10-FP/OrderExercises/gen_test.py | Python | bsd-2-clause | 211 |
from distutils.core import setup
import py2exe
setup(console=['daemon.py'])
| IngenuityEngine/daemon | setup.py | Python | mit | 77 |
from PyQt5.Qt import QObject
from BookManipulation.FolderKeeper import FolderKeeper
FIRST_CSS_NAME = "Style0001.css"
FIRST_SVG_NAME = "Image0001.svg"
PLACEHOLDER_TEXT = "PLACEHOLDER"
EMPTY_HTML_FILE = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" \
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\n" \... | tcp813/tolo | BookManipulation/Book.py | Python | mit | 3,311 |
# -------------------------------------------------------------
#
# 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 unde... | apache/incubator-systemml | src/main/python/tests/source/test_source_with_default_values.py | Python | apache-2.0 | 2,157 |
#!/usr/bin/env python2.6
import sys
import boto
from boto.s3.key import Key
if len(sys.argv) < 3:
print "Not enough arguments"
print "%s <bucket> <prefix>" % sys.argv[0]
sys.exit(1)
s3 = boto.connect_s3()
bucket = s3.get_bucket(sys.argv[1])
for k in bucket.list(sys.argv[2]):
if k.name not in [sys.ar... | markusd/gpgpu | aws/delete-s3-keys.py | Python | gpl-3.0 | 361 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2017-02-21 17:04
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('index', '0012_cartridgeitemname_manufacturer'),
]
o... | sfcl/ancon | index/migrations/0013_auto_20170221_2204.py | Python | gpl-2.0 | 578 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.