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 |
|---|---|---|---|---|---|
"""
If the user requests "Docs" then this will call this script as a tool
In which case we include all the related builders
"""
from . import Mkdocs
def generate(env):
Mkdocs.generate(env)
Pandoc.generate(env)
Doxygen.generate(env)
def exists(env):
if (Mkdocs.exists(env) == False): retur... | ASoftTech/Scons-Tools-Grbd | scons_tools_grbd/Tools/Docs/__init__.py | Python | mit | 451 |
from django.contrib import admin
from datapoint.models import Datapoint, Annotation
admin.site.register(Datapoint)
admin.site.register(Annotation)
| allyjweir/lackawanna | lackawanna/datapoint/admin.py | Python | bsd-3-clause | 148 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | lidalei/DataMining | nn_with_alpha.py | Python | mit | 11,180 |
########################################################################
#
# File Name: HTMLDListElement
#
#
### This file is automatically generated by GenerateHtml.py.
### DO NOT EDIT!
"""
WWW: http://4suite.com/4DOM e-mail: support@4suite.com
Copyright (c) 2000 Fourthought Inc, USA. All Right... | alanjw/GreenOpenERP-Win-X86 | python/Lib/site-packages/_xmlplus/dom/html/HTMLDListElement.py | Python | agpl-3.0 | 1,396 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | gunan/tensorflow | tensorflow/python/keras/mixed_precision/experimental/autocast_variable_test.py | Python | apache-2.0 | 20,461 |
# This file is a part of the AnyBlok project
#
# Copyright (C) 2014 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
#
# 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/.
vers... | AnyBlok/anyblok_furetui | anyblok_furetui/release.py | Python | mpl-2.0 | 334 |
# -*- coding: utf-8 -*-
from openerp import SUPERUSER_ID
from openerp.api import Environment
def post_init_hook(cr, pool):
env = Environment(cr, SUPERUSER_ID, {})
env['res.partner'].search(
[('birthdate', "!=", False)])._birthdate_inverse()
| diagramsoftware/partner-contact | partner_contact_birthdate/hooks.py | Python | agpl-3.0 | 260 |
from hashlib import md5
class PhpbbPassword(object):
"""PhpBB3 password compatibility class.
Ported from:
http://code.phpbb.com/repositories/entry/5/trunk/phpBB/includes/functions.php
"""
itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
wrong = "*"
def php_hash... | Zelgadiss/django-phpbb | phpbb/password.py | Python | gpl-3.0 | 3,881 |
#
# Chris Lumens <clumens@redhat.com>
#
# Copyright 2007, 2009, 2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# ... | atodorov/pykickstart | pykickstart/commands/harddrive.py | Python | gpl-2.0 | 3,819 |
#!/usr/bin/env python
#
# This file is part of embedcover.
#
# Embedcover is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Embedcove... | pipitu/embedcover | setup.py | Python | gpl-3.0 | 1,304 |
#**************************************************************************
#* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
#* *
#* Author: The ALICE Off-line Project. *
#* Contributors ... | mfasDa/raadev | analysis/util/SpectrumTools.py | Python | gpl-3.0 | 29,555 |
# -*- coding: utf-8 -*-
"""The app module, containing the app factory function."""
from flask import Flask, render_template
from temp_app import commands, public, user
from temp_app.extensions import bcrypt, cache, csrf_protect, db, debug_toolbar, login_manager, migrate, webpack
from temp_app.settings import ProdConfi... | franc3000/temp-app | temp_app/app.py | Python | bsd-3-clause | 2,398 |
__author__ = 'lucernae'
from geosafe.views import analysis
| ismailsunni/geonode | geosafe/views/__init__.py | Python | gpl-3.0 | 60 |
import warnings
from django.conf.urls import include, patterns, url
from django.utils.deprecation import RemovedInDjango110Warning
from .views import (
absolute_kwargs_view, defaults_view, empty_view, empty_view_partial,
empty_view_wrapped, nested_view,
)
other_patterns = [
url(r'non_path_include/$', emp... | h4r5h1t/django-hauthy | tests/urlpatterns_reverse/urls.py | Python | bsd-3-clause | 5,021 |
import logging
import re
from mopidy import backend, models
from mopidy.models import SearchResult
from mopidy_beets.browsers.albums import (
AlbumsByArtistBrowser,
AlbumsByGenreBrowser,
AlbumsByYearBrowser,
)
from mopidy_beets.translator import assemble_uri, parse_uri
logger = logging.getLogger(__name_... | mopidy/mopidy-beets | mopidy_beets/library.py | Python | mit | 7,842 |
import gzip
__author__ = 'husnusensoy'
lkp = {"-RCB-": "}", "-LCB-": "{", "-RRB-": ")", "-LRB-": "("}
convert = lambda x: lkp[x] if x in lkp else x
skiplist = [')', '(', '}', '{']
import logging
logging.basicConfig(level=logging.INFO)
super_open = lambda f: gzip.open(f) if f.endswith(".gz") else open(f)
def ve... | hsensoy/ai-parse | scripts/enrich_with_embeddings.py | Python | mit | 4,500 |
# -*- 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... | ksrajkumar/openerp-6.1 | openerp/addons/crm/crm.py | Python | agpl-3.0 | 23,509 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
try:
from PyQt5.QtCore import QCoreApplication
except:
from PyQt4.QtCore import QCoreApplication
import fcntl, socket
def name():
return QCoreApplication.translate("PluginBluetooth", "Bluetooth")
def hci0_up():
# AF_BLUETOOTH = 31, BTPROTO_HCI = 1
... | ski7777/ftcommunity-TXT | board/fischertechnik/TXT/rootfs/opt/ftc/plugins/bluetooth.py | Python | gpl-3.0 | 1,836 |
from roundware.rw.models import Event, Asset, ListeningHistoryItem, Tag
from distutils.util import strtobool
import django_filters
BOOLEAN_CHOICES = (('false', False), ('true', True),
(0, False), (1, True),)
class IntegerListFilter(django_filters.Filter):
def filter(self, qs, value):
i... | yangjackascd/roundware-server | roundware/api2/filters.py | Python | agpl-3.0 | 3,454 |
# This file originally from pip:
# https://github.com/pypa/pip/blob/8f4f15a5a95d7d5b511ceaee9ed261176c181970/src/pip/_internal/pep425tags.py
"""Generate and work with PEP 425 Compatibility Tags."""
from __future__ import absolute_import
import distutils.util
from distutils import log
import platform
import re
import s... | astaninger/speakout | venv/lib/python3.6/site-packages/setuptools/pep425tags.py | Python | mit | 10,862 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | eayunstack/horizon | openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/workflows/create.py | Python | apache-2.0 | 15,774 |
# Copyright 2022 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class DistributionListMassFunction(models.TransientModel):
_inherit = "distribution.list.mass.function"
def _update_mass_mailing(self, mail_composer, mass_mailing):
super()._update_... | mozaik-association/mozaik | mozaik_mass_mailing_template/wizards/distribution_list_mass_function.py | Python | agpl-3.0 | 501 |
# -*- coding: utf-8 -*-
################################################################################
# Copyright 2014, Distributed Meta-Analysis System
################################################################################
"""
This file provides methods for extracting data from impact bundles (.nc4 files... | jrising/prospectus-tools | gcp/extract/lib/bundles.py | Python | mit | 7,025 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests, json
from specparser import get_settings_from_file
def handler(uri,method):
if method == "GET":
r = requests.get(uri)
elif method == "POST":
r = requests.post(uri)
else:
print "Except \'GET\' and \'POST\' method, others ... | DataCanvasIO/example-modules | modules/triggers/restapi_trigger/main.py | Python | bsd-3-clause | 639 |
"""
"""
import os
import re
import glob
import scipy
import numpy as np
import matplotlib.pyplot as plt
from pyproj import Proj
from mpl_toolkits.mplot3d import Axes3D
from openquake.hazardlib.geo import Line, Point
from openquake.hazardlib.geo.surface import ComplexFaultSurface
from openquake.hazardlib.scalerel.wc... | GEMScienceTools/oq-subduction | openquake/sub/utils.py | Python | agpl-3.0 | 9,512 |
import json
from django.contrib import messages
from django.core.exceptions import SuspiciousOperation
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import get_object_or_404
from django.utils.decorators import method_decorator
fro... | j-po/django-brambling | brambling/views/payment.py | Python | bsd-3-clause | 5,261 |
"""
The MIT License (MIT)
Copyright (c) 2015 Ryan Vennell
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,... | hickeroar/scentamint | scentamint/__init__.py | Python | mit | 1,087 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-05 20:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('transactions', '0002_auto_20170605_2029'),
]
operations = [
migrations.Alte... | bejmy/backend | bejmy/transactions/migrations/0003_auto_20170605_2033.py | Python | mit | 661 |
from os.path import dirname
from os import listdir
path = dirname(__file__)
i = path.find(".zip")
if i == -1: # OS X app or unpacked python files
__all__ = [p[:-3] for p in listdir(path) if p.endswith(".py") and p != "__init__.py"]
del p
else: # Windows binary ziped .pyc files
import zipfile
__all__... | chrmoritz/zoxel | src/plugins/__init__.py | Python | gpl-3.0 | 547 |
#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated 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.
#
# Pixelated is distrib... | alabeduarte/pixelated-user-agent | service/test/support/integration/app_test_client.py | Python | agpl-3.0 | 9,168 |
from django.shortcuts import render
import social.apps.django_app.default.models as sm
from django.contrib.auth import authenticate, login, logout
def home(request):
uname=""
if request.method == 'POST' and 'submit' in request.POST:
submit = request.POST['submit']
if submit=="sign-out":
logout(request... | wasit7/PythonDay | django/mysite4/myapp/views.py | Python | bsd-3-clause | 524 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ProfileRemovedEvent(vim, *args, **kwargs):
'''This event records that a Profile was r... | xuru/pyvisdk | pyvisdk/do/profile_removed_event.py | Python | mit | 1,153 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0013_auto_20151021_0155'),
]
operations = [
migrations.AlterField(
model_name='article',
n... | I-sektionen/i-portalen | wsgi/iportalen_django/articles/migrations/0014_auto_20151021_1246.py | Python | mit | 543 |
# -*- coding: UTF-8 -*-
"""
``GetReadsInBAM``
-----------------------------------------------------------------
:Authors: Menachem Sklarz
:Affiliation: Bioinformatics core facility
:Organization: National Institute of Biotechnology in the Negev, Ben Gurion University.
A module for extracting read names from a bam fil... | bioinfo-core-BGU/neatseq-flow_modules | neatseq_flow_modules/mapping/GetReadsInBAM.py | Python | gpl-3.0 | 3,654 |
# pyenchant
#
# Copyright (C) 2004-2008, Ryan Kelly
#
# 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 your option) any later version.
#
# This ... | lucidlylogicole/scope | plugins/spellcheck/enchant/checker/CmdLineChecker.py | Python | gpl-3.0 | 7,357 |
def extractBLNovelObsession(item):
"""
'BL Novel Obsession'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
if 'Feng Mang' in item['tags']:
return buildReleaseMessageWithType(item, 'Feng Mang', vol,... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractBLNovelObsession.py | Python | bsd-3-clause | 854 |
# -*- coding: utf-8 -*-
""" This test generate one default report for each category under reports accordion
"""
import pytest
from cfme import test_requirements
from cfme.infrastructure.provider import InfraProvider
from cfme.markers.env_markers.provider import ONE
# from selenium.common.exceptions import NoSuchEleme... | Yadnyawalkya/integration_tests | cfme/tests/intelligence/reports/test_generate_report.py | Python | gpl-2.0 | 2,110 |
import copy
from collections import OrderedDict
import six
from cornflake.fields import Field
from cornflake.exceptions import ValidationError, SkipField
class BaseSerializer(Field):
def __init__(self, instance=None, data=None, partial=False, **kwargs):
meta = getattr(self, 'Meta', None)
if met... | renalreg/cornflake | cornflake/serializers.py | Python | mit | 12,308 |
"""Truncated exponential distribution."""
import numpy
from scipy import special
from ..baseclass import SimpleDistribution, ShiftScaleDistribution
class truncexpon(SimpleDistribution):
"""Truncated exponential distribution."""
def __init__(self, b):
super(truncexpon, self).__init__(dict(b=b))
... | jonathf/chaospy | chaospy/distributions/collection/trunc_exponential.py | Python | mit | 1,855 |
"""
"""
from functions import FunctionSkin
from skin import Skin
class Context(object):
"""
Context is a namespace that manages the stack of skins.
"""
_skin = None
@classmethod
def skins(cls):
s = cls._skin
while s:
s = s.parent_skin
yield s
@c... | fakedrake/WikipediaBase-skinz | wikipediabase/context.py | Python | bsd-3-clause | 2,173 |
"""Test runner for the Review Board test suite.
This is used by :file:`manage.py` or when running ``./tests/runtests.py`` from
the top of the source tree.
"""
import os
import sys
from django.conf import settings
from django.contrib import admin
from djblets.testing.testrunners import TestRunner
class RBTestRunner... | reviewboard/reviewboard | reviewboard/test.py | Python | mit | 2,658 |
# Copyright 2015 VPAC
#
# This file is part of Karaage.
#
# Karaage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Karaage is dist... | monash-merc/karaage | karaage/plugins/kgusage/templatetags/usage.py | Python | gpl-3.0 | 3,289 |
import urllib2, json, os
import datetime
class BaseCrawler(object):
def __init__(self, timestamp):
self.search_service_host = os.environ['CRAWLER_HOST']
self.namespace = os.environ['CRAWLER_NAMESPACE'] + '/{container_id}'
self.container_name = ''
self.timestamp = timestamp
self.url = "http://{hos... | sealuzh/ContextBasedAnalytics | extraction/crawler/base_crawler.py | Python | apache-2.0 | 1,754 |
# Copyright 2009-2015 MongoDB, 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 writin... | nichung/wwwflaskBlogrevA | venv/lib/python2.7/site-packages/pymongo/helpers.py | Python | mit | 11,534 |
"""
Tests for queryset-filtering.
"""
from django.http import QueryDict
from mock import Mock
from django.template.response import TemplateResponse
from django.test import RequestFactory
from django.utils.datastructures import MultiValueDict
from tests import case
class FiltersTestCase(case.TestCase):
"""A te... | peterbe/moztrap | tests/view/lists/test_filters.py | Python | bsd-2-clause | 21,368 |
from mongodb_gridfs_beaker import MongoDBGridFSNamespaceManager, log, pickle
def includeme(config):
# Monkey patch 3rd party class to fix runtime error
MongoDBGridFSNamespaceManager.lock_dir = None
# Monkey patch "set_value" method after upgrade to Beaker-1.9.0 to accept the "expiretime" argument.
de... | ip-tools/ip-navigator | patzilla/util/database/beaker_mongodb_gridfs.py | Python | agpl-3.0 | 828 |
from .forms import SubscribeForm
def subscribe_form(request):
return {'subscribe_form': SubscribeForm()}
| cercisanat/cercisanat.com | cerci_newsletters/processors.py | Python | gpl-3.0 | 111 |
#!/usr/bin/env python3
# Requires Pygame, gtts, pyttsx
# For windows: Speech Recognition, PyAudio
import os.path
import random
import webbrowser
import socket
import pyttsx
import logging
import speech_recognition as sr
from sys import platform
from time import sleep, strftime
from pygame import mixer, time
from gtts... | SerhiiStets/Voice-assistant | friday.py | Python | mit | 3,098 |
from __future__ import (absolute_import, division, print_function)
from six.moves import (filter, input, map, range, zip) # noqa
import iris
import iris.quickplot as qplt
import iris.analysis
import matplotlib.pyplot as plt
import numpy as np
fname = iris.sample_data_path('hybrid_height.nc')
column = iris.load_cub... | decvalts/iris | docs/iris/src/userguide/regridding_plots/interpolate_column.py | Python | gpl-3.0 | 2,039 |
import os
from django.conf import settings
from config.models import OpenstackSettings, NodeSettings
import subprocess
def fetch_ls_server_bindings(query_str_dict):
# Determine the selected records
selected_records_index_list = []
for key, value in query_str_dict.items():
if "role-" in key:
... | Havate/havate-openstack | proto-build/gui/horizon/openstack-dashboard/config/helpers.py | Python | apache-2.0 | 6,305 |
# Copyright 2017 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... | tensorflow/autograph | reference_tests/reference_test_base.py | Python | apache-2.0 | 10,390 |
from gaphas import Canvas
from gaphas.item import Line
import re
from blockitem import DefaultBlockItem, GraphicalBlockItem
from blockline import BlockLine
from blockstream import BlockStream
UNITS_RE = re.compile("([-+]?(\d+(\.\d*)?|\d*\.d+)([eE][-+]?\d+)?)\s*(.*)");
saved_model = None
class BlockCanvas(Canvas):
... | georgyberdyshev/ascend | pygtk/canvas/blockcanvas.py | Python | gpl-2.0 | 4,302 |
"""
WSGI config for misc_proj project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | luke-powers/django_exercise | misc_proj/wsgi.py | Python | unlicense | 395 |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... | wunderlins/learning | python/zodb/lib/osx/ZEO/zrpc/connection.py | Python | gpl-2.0 | 32,341 |
#
# Copyright 2009-2017 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | EdDev/vdsm | vdsm/storage/fileVolume.py | Python | gpl-2.0 | 23,800 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from askbot.migrations import TERM_YELLOW, TERM_RESET
from askbot.utils.console import ProgressBar
class Migration(DataMigration):
def forwards(self, orm):
message = "Adding accepted ... | tvenkat/askbot-devel | askbot/migrations/0066_transplant_accepted_answer_data.py | Python | gpl-3.0 | 28,845 |
#!/usr/bin/env vpython
# Copyright 2016 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import datetime
import json
import sys
import unittest
import swarming_test_env
swarming_test_env.setup_test_env()
from g... | luci/luci-py | appengine/swarming/ts_mon_metrics_test.py | Python | apache-2.0 | 15,674 |
'''
InsertedX csv entrance and exit surveys into mongodb
***USAGE***
./survey_csv_to_mongod.py DB COLL SURVEY1 SURVEY2 ...
'''
import csv, json, collections, pymongo, os, sys
# SPECIFY database address
DATABASE_ADDRESS = "mongodb://localhost"
if len(sys.argv) < 4:
print "Arguments missing..."
print "Usage: ./... | andyzsf/edx_data_research | reporting_scripts/surveys/survey_csv_to_mongod.py | Python | mit | 1,865 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
~Gros
'''
config = {
"host": "localhost",
"task1": {
"port_alice": 10001,
"port_bob": 10002
},
"task2": {
"port_alice": 10001,
"port_bob": 10002
},
"task3": {
"port_alice": 30001,
"port_bob": 300... | JustHitTheCore/ctf_workshops | 2017/lab_dh/config.py | Python | mit | 380 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_certificate_orders_diagnostics_operations.py | Python | mit | 13,082 |
# -*- coding: utf-8 -*
import os
from django.conf import settings
from django.core import serializers
from django.test import TestCase
from wagtail.images.blocks import ImageChooserBlock
from .utils import Image, get_test_image_file
class TestImageChooserBlock(TestCase):
def setUp(self):
self.image = I... | wagtail/wagtail | wagtail/images/tests/test_blocks.py | Python | bsd-3-clause | 2,066 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Sword York
# GitHub: https://github.com/SwordYork/sequencing
# No rights reserved.
#
from collections import namedtuple
import tensorflow
MODE = namedtuple('MODE', 'TRAIN EVAL INFER RL')(0, 1, 2, 3)
TIME_MAJOR = True
DTYPE = tensorflow.float32
from .enc... | SwordYork/sequencing | sequencing/__init__.py | Python | mit | 1,170 |
# Copyright 2021 Valentin Vinagre <valentin.vinagre@sygel.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
fiscal_position_type = fields.Selection(
selection="_selection_fiscal_posit... | OCA/account-fiscal-rule | account_fiscal_position_partner_type/models/res_partner.py | Python | agpl-3.0 | 799 |
from main.management.commands._private import SharedCommand
from main.models import Destination
class Command(SharedCommand):
model = Destination
| huseyinkabil/coral-ci | main/management/commands/insert_destination_data.py | Python | gpl-3.0 | 152 |
# Copyright 2013 VMware, 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,... | vmware/dbeekeeper | dbeekeeper/dbee/base.py | Python | apache-2.0 | 4,065 |
from collections import namedtuple
from sqlalchemy.sql.expression import and_, literal_column
from shapely.geometry import MultiPoint
from geoalchemy2.shape import from_shape
from skylines.database import db
from skylines.lib import files
from skylines.model import Elevation, IGCFile, Location
from xcsoar import Fligh... | kerel-fs/skylines | skylines/lib/xcsoar_/flightpath.py | Python | agpl-3.0 | 3,773 |
import sys
from repoze.lru import lru_cache
from logging.config import fileConfig
from ConfigParser import ConfigParser, NoSectionError, NoOptionError
from reports.helpers import create_db_url
BIDS_PAYMENTS_KEYS = frozenset(('bids', 'invoices'))
TENDERS_PAYMENTS_KEYS = frozenset(('tenders', 'refunds'))
class Confi... | openprocurement/reports | reports/config.py | Python | apache-2.0 | 2,186 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... | digitalbitbox/electrum | lib/websockets.py | Python | mit | 4,648 |
from operator import mul
from functools import reduce
def factorial(n):
return reduce(mul, range(1, n+1))
def answer():
n = 20
# 2n choose n
return factorial(2*n) // factorial(n) ** 2
if __name__ == '__main__':
print(answer())
| peterstace/project-euler | OLD_PY_CODE/project_euler_py/pe0015.py | Python | unlicense | 250 |
from bedrock.redirects.util import redirect, is_firefox_redirector, no_redirect
def firefox_mobile_faq(request, *args, **kwargs):
qs = request.META.get('QUERY_STRING', '')
if 'os=firefox-os' in qs:
return 'https://support.mozilla.org/products/firefox-os'
return 'firefox.android.faq'
redirectpat... | TheJJ100100/bedrock | bedrock/firefox/redirects.py | Python | mpl-2.0 | 25,665 |
import unittest
from common import TestCase
import pyuv
class UtilTest(TestCase):
def test_hrtime(self):
r = pyuv.util.hrtime()
self.assertTrue(r)
def test_freemem(self):
r = pyuv.util.get_free_memory()
self.assertTrue(r)
def test_totalmem(self):
r = pyuv.util.... | fivejjs/pyuv | tests/test_util.py | Python | mit | 914 |
# -*- 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):
# Changing field 'UnsubscribeToken.modified_date'
db.alter_column(u'prof... | nirmeshk/oh-mainline | mysite/profile/migrations/0097_auto__chg_field_unsubscribetoken_modified_date__del_field_citation_dis.py | Python | agpl-3.0 | 17,952 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.settings import WAF_ATTACK_VECTORS
__product__ = "TrueShield Web Application Firewall (SiteLock)"
def detect(get_page):
retval = False
for vector in W... | undefinedv/Jingubang | sqlmap/waf/sitelock.py | Python | gpl-3.0 | 493 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0003_auto_20141128_0831'),
]
operations = [
migrations.AlterField(
model_name='acl',
name='us... | Virako/authapi | authapi/api/migrations/0004_auto_20141128_0914.py | Python | agpl-3.0 | 419 |
"""
Classes and functions for reading TRC motion capture files.
TRCData class by Hugh Sorby, taken from
https://github.com/mapclient-plugins/trcsourcestep
"""
class TRCData(dict):
def load(self, filename):
with open(filename) as f:
contents = f.readlines()
line_count = 0
... | mapclient-plugins/fieldworkgait2392geomstep | mapclientplugins/fieldworkgait2392geomstep/testing/trcdata.py | Python | apache-2.0 | 4,602 |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
#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... | PaddlePaddle/Paddle | python/paddle/vision/models/__init__.py | Python | apache-2.0 | 4,213 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | noironetworks/heat | heat/tests/openstack/manila/test_share_type.py | Python | apache-2.0 | 4,420 |
# -*- coding: utf-8 -*-
import os
from distutils.core import setup
#, find_packages
from version import get_git_version
def read(filename):
f = os.path.join(os.path.dirname(__file__), filename)
if os.path.exists(f):
return open(f).read()
setup(name='ypcspy',
version = get_git_version(),
# vers... | ypcs/ypcspy | setup.py | Python | gpl-3.0 | 1,322 |
# Bubble Sort: Sorting an array using Bubble Sort
# Based on http://en.wikipedia.org/wiki/Bubble_sort#Optimizing_bubble_sort's pseudocode
def bubble_sort(A):
n = len(A)
while True:
newn = 0
i = 1
while i <= (n - 1):
if A[i - 1] > A[i]:
A[i - 1], A[i] = A[i], A[i - 1]
newn = i
i += 1
n = newn
... | idunnowhy9000/Projects | SOURCE/Python/Classic Algorithms/Bubble Sort.py | Python | mit | 527 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2017 Canonical Ltd
#
# This program 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 h... | mvo5/snapcraft | snapcraft/cli/_command_group.py | Python | gpl-3.0 | 2,625 |
#!/usr/bin/env python
import os, sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dogestartme.settings")
from django.core.management import execute_from_command_line
import dogestartme.startup as startup
startup.run()
execute_from_command_line(sys.argv)
| javierder/dogestart.me | manage.py | Python | mit | 306 |
"""
Provides authorization functions for Mojang's login and session servers
"""
import hashlib
import json
# This is for python2 compatibility
try:
import urllib.request as request
from urllib.error import URLError
except ImportError:
import urllib2 as request
from urllib2 import URLError
import loggin... | Gjum/SpockBot | spockbot/plugins/core/auth.py | Python | mit | 4,860 |
__author__ = 'student'
A=[1, 2, 2, 3]
b=0
for i in range(len(A)):
if A.count(A[i])>b:
b=A.count(A[i])
print(b)
| nikakuznetsova/labus2016 | lab5/5.2.4.py | Python | gpl-3.0 | 124 |
'''
It should show a cavity behaviour
'''
from tuby.scheduler import Scheduler
from tuby.fastn_sine_gen import FastSineGen
from tuby.cavity_resonator import CavityReasonator
from tuby.one_dimension_graph import OneDimGraph
from tuby.timed_amp import TimedAmp
import matplotlib.pyplot as plt
import math
SIM_TIME = ... | Bellaz/Tuby | examples/cavity_FF.py | Python | gpl-3.0 | 1,223 |
"""
Update MP biographical data from the lovely Represent API
"""
from urlparse import urljoin
from time import sleep
from django.db import transaction
import requests
from parliament.core.models import Politician, Session, Riding
import logging
logger = logging.getLogger(__name__)
def update_mps_from_represent(d... | litui/openparliament | parliament/imports/represent.py | Python | agpl-3.0 | 3,960 |
# Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import json
import os
import re
import shutil
import unicodedata
import zipfile
from io import BufferedWriter
from typing import Any, Dict, List, Optional, Tuple, Union
from zipfile import Zip... | simgunz/anki | pylib/anki/exporting.py | Python | agpl-3.0 | 14,486 |
#!/usr/bin/env python
import numpy as np
from dynamics import LinearDynamics
from distance import EuclideanDist
class FeatureBase(object):
def __init__(self):
pass
def __call__(self, *args):
return self.f(*args)
def f(self, *args):
raise Exception("method must be implemented by ... | yuhangc/HRI_planner | scripts/IRL/multi_human/features_const_vel.py | Python | apache-2.0 | 12,870 |
from __future__ import print_function
from __future__ import absolute_import
import os
import boto3
from time import time, sleep
from n_utils import cf_utils
from n_utils import cf_deploy
from n_utils.ndt import find_include
def create_account(email, account_name, role_name="OrganizationAccountAccessRole",
... | NitorCreations/nitor-deploy-tools | n_utils/account_utils.py | Python | apache-2.0 | 4,851 |
#***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> *
#* ... | timthelion/FreeCAD | src/Mod/Arch/ArchFloor.py | Python | lgpl-2.1 | 6,324 |
from __future__ import with_statement
from functools import wraps
import random
import socket
import time
class _Timer(object):
"""A context manager/decorator for statsd.timing()."""
def __init__(self, client, stat, rate=1):
self.client = client
self.stat = stat
self.rate = rate
... | AdrianGaudebert/socorro-crashstats | vendor-local/lib/python/statsd/client.py | Python | mpl-2.0 | 2,227 |
# __ File: GraphicalForm.py __________________________________________________________________________________________________
# Implements : class GraphicalForm
# Author : Juan de Lara
# Description : A wrapper to Canvas objects. It is used when posing graphical constraints
# Modified : 23 Oct 2001
#... | Balannen/LSMASOMM | atom3/Kernel/UserInterface/GraphicalForm.py | Python | gpl-3.0 | 14,370 |
import random
from twisted.trial import unittest
from twisted.internet import defer
from foolscap.api import eventually
from allmydata.test import common
from allmydata.test.no_network import GridTestMixin
from allmydata.test.common import TEST_DATA
from allmydata import uri
from allmydata.util import log
from allmy... | sspreitzer/tahoe-lafs | src/allmydata/test/test_immutable.py | Python | gpl-2.0 | 14,181 |
import argparse
import logging
from imagemounter import _util, dependencies
class CheckAction(argparse.Action):
"""Action that checks the current state of the system according to the command requirements that imount has."""
# noinspection PyShadowingNames
def __call__(self, parser, namespace, values, opt... | ldgriffin/imagemounter | imagemounter/cli/__init__.py | Python | mit | 3,953 |
import sys
import os
import pickle
from threading import current_thread
from ..utils.exceptions import HaltServer, CommandError, ActorStarted
from ..utils import system
from ..utils.log import WritelnDecorator
from ..utils.lib import EventHandler
from .proxy import ActorProxy, ActorProxyMonitor, actor_identity
from .... | quantmind/pulsar | pulsar/async/actor.py | Python | bsd-3-clause | 14,208 |
# in a range from 1 to 100 print Fizz if the number is multiplie of 3
#and Buzz of 5, if both print FizzBuzz
def fizzBuzz():
for i in range(1,100):
if i % 3 is 0 and i % 5 is 0:
print("FizzBuzz")
elif i % 3 is 0:
print("Fizz")
elif i % 5 is 0:
print("Buzz")
else:
print(i) | diego-d5000/algorithms | FizzBuzz.py | Python | mit | 295 |
"""
This module contains 'classical' methods of calculating a pore size distribution for
pores in the micropore range (<2 nm). These are derived from the Horvath-Kawazoe models.
"""
import math
import numpy
from scipy import constants
from scipy import optimize
from pygaps.characterisation.models_hk import HK_KEYS
f... | pauliacomi/pyGAPS | src/pygaps/characterisation/psd_micro.py | Python | mit | 47,092 |
from qlearner import QLearner
import numpy as np
from collections import defaultdict
class QLearner3(QLearner):
'''
Implements a more intelligent Q-Learning Mechanism. Uses Logistic function for learning learn_rate
decay. Not that the parameters have been optimized using SpearMint.
'''
def __init__(self, es... | kandluis/machine-learning | prac4/practical4-code/qlearner3.py | Python | mit | 2,670 |
##############################################################################
# Copyright (c) 2013-2017, 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... | skosukhin/spack | var/spack/repos/builtin/packages/r-shape/package.py | Python | lgpl-2.1 | 1,707 |
# Command related to execution: auto-test
import sys
import os, os.path
import shutil
import urllib, urllib2
import subprocess
import webbrowser
import time
import signal
from play.utils import *
COMMANDS = ['autotest','auto-test']
HELP = {
'autotest': "Automatically run all application tests"
}
def execute(**... | chvrga/outdoor-explorer | java/play-1.4.4/framework/pym/play/commands/autotest.py | Python | mit | 5,231 |
"""
Analyzers
"""
| peragro/peragro-at | src/damn_at/analyzers/__init__.py | Python | bsd-3-clause | 21 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.