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 |
|---|---|---|---|---|---|
import unicornhat as uh
uh.clear()
uh.show()
| hekim13/unicorn-app | src/unicorn-scripts/off.py | Python | mit | 46 |
import numpy as np
import hyperspy.api as hs
from hyperspy_gui_ipywidgets.tests.utils import KWARGS
def test_span_roi():
roi = hs.roi.SpanROI(left=0, right=10)
wd = roi.gui(**KWARGS)["ipywidgets"]["wdict"]
assert wd["left"].value == 0
assert wd["right"].value == 10
wd["left"].value = -10
wd[... | hyperspy/hyperspy_gui_ipywidgets | hyperspy_gui_ipywidgets/tests/test_roi.py | Python | gpl-3.0 | 2,405 |
#!/usr/bin/env python2
from configobj import ConfigObj
from validate import Validator
import os, sys, subprocess, signal, tempfile, shutil, pipes, time, locale
from datetime import datetime
from PyQt4 import QtGui, QtCore
try:
from gi.repository import Notify
except:
Notify = None
dirname = os.path.dirname... | yrsegal/Perdyshot | gui/perdyshot.py | Python | mit | 4,988 |
from __future__ import annotations
# standard libraries
import asyncio
import typing
# third party libraries
import numpy.typing
# local libraries
from nion.data import Image
from nion.swift import MimeTypes
from nion.swift import Thumbnails
from nion.swift.model import DisplayItem
from nion.swift.model import Docum... | nion-software/nionswift | nion/swift/DataItemThumbnailWidget.py | Python | gpl-3.0 | 19,101 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# 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
... | vlegoff/tsunami | src/primaires/joueur/masques/nv_groupe/__init__.py | Python | bsd-3-clause | 3,211 |
"""
Tests for RunCaseVersionResource api.
"""
from tests import case
from datetime import datetime
class RunCaseVersionResourceTest(case.api.ApiTestCase):
@property
def factory(self):
"""The model factory for this object."""
return self.F.RunCaseVersionFactory
@property
def resou... | mozilla/moztrap | tests/model/execution/api/test_runcaseversion.py | Python | bsd-2-clause | 2,717 |
#! coding=UTF-8
from tbparser.grammar import Rule, tokenNode as tnode, \
connector, sequence, zeroToOne, Switch, oneToMany, zeroToMany
from tbparser.parser import AstNode
from gobjcreator2.input.grammar.tokens import *
from gobjcreator2.input.grammar.type_name import TypeName
from gobjcreator2.input.grammar.misc_rules... | ThomasBollmeier/GObjectCreator2 | src/gobjcreator2/input/grammar/method.py | Python | gpl-3.0 | 5,664 |
# Demo of a robust regression model with multivariate-t distributed noise
import numpy as np
import numpy.random as npr
np.random.seed(0)
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("white")
from pybasicbayes.util.text import progprint_xrange
from pybasicbayes.distributions import Regression,... | mattjj/pybasicbayes | examples/robust_regression.py | Python | mit | 4,079 |
# -*- coding: utf-8 -*-
"""AST nodes generated by the parser for the compiler. Also provides
some node tree helper functions used by the parser and compiler in order
to normalize nodes.
"""
import operator
from collections import deque
from markupsafe import Markup
from ._compat import izip
from ._compat import PY2
f... | sserrot/champion_relationships | venv/Lib/site-packages/jinja2/nodes.py | Python | mit | 31,095 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
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 sys
import logging
import getpass
import threading
from optparse import OptionParser
impo... | emesene/emesene | emesene/e3/xmpp/SleekXMPP/examples/roster_browser.py | Python | gpl-3.0 | 5,744 |
from django.contrib import admin
from import_export.admin import ImportExportModelAdmin
from .models import Concept
class ConceptAdmin(ImportExportModelAdmin):
list_display = ('name',)
search_fields = ('name',)
ordering = ('name',)
admin.site.register(Concept, ConceptAdmin)
| effa/flocs | concepts/admin.py | Python | gpl-2.0 | 289 |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import sys
from builtins import map, object
import pkg_resources
from pa... | twitter/pants | src/python/pants/init/options_initializer.py | Python | apache-2.0 | 5,384 |
from flask import Blueprint, current_app as app
from flask_api import exceptions
from ._settings import CONTRIBUTING_URL
blueprint = Blueprint('fonts', __name__, url_prefix="/api/fonts/")
@blueprint.route("")
def get():
"""Get a list of all available fonts."""
return sorted(app.font_service.all())
@bluep... | DanLindeman/memegen | memegen/routes/api_fonts.py | Python | mit | 428 |
"""This module contains code from
Think Python by Allen B. Downey
http://thinkpython.com
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import math
try:
# see if Swampy is installed as a package
from swampy.TurtleWorld import *
except ImportError:
# otherwise ... | simontakite/sysadmin | pythonscripts/thinkpython/pie.py | Python | gpl-2.0 | 1,636 |
# stopanalyzer package
| romanchyla/pylucene-trunk | samples/LuceneInAction/lia/analysis/stopanalyzer/__init__.py | Python | apache-2.0 | 23 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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... | devananda/ironic | ironic/tests/unit/db/test_conductor.py | Python | apache-2.0 | 8,622 |
"""
tree2tree.py - manipulate trees
===============================
:Author: Andreas Heger
:Release: $Id$
:Date: |today|
:Tags: Python
Purpose
-------
This script reads a collection of trees from stdin and outputs the again on stdout
after manipulating them. Manipulations include
* renaming taxa
* normalizi... | CGATOxford/Optic | scripts/tree2tree.py | Python | mit | 13,003 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
import webnotes
from webnotes.utils import cint
def get_website_settings(context):
post_login = []
cart_enabled = cint(webnotes.conn.get_default("shopping_cart_enabled"))
if cart_enabled:
post_login +... | Yellowen/Owrang | startup/webutils.py | Python | agpl-3.0 | 1,022 |
#!/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... | cryptapus/electrum-uno | plugins/trustedcoin/qt.py | Python | mit | 11,440 |
import json
def response_to_str(response):
content = response.content
try:
# A bytes message, decode it as str
if isinstance(content, bytes):
content = content.decode()
if response.headers.get("content-type") == "application/json":
# Errors from Artifactory loo... | memsharded/conan | conans/client/rest/__init__.py | Python | mit | 681 |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from open_municipio.locations.models import Location
class LocationAdmin(admin.ModelAdmin):
list_display = ('name', 'count')
admin.site.register(Location, LocationAdmin)
| openpolis/open_municipio | open_municipio/locations/admin.py | Python | agpl-3.0 | 267 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | sgerhart/ansible | lib/ansible/modules/network/vyos/vyos_config.py | Python | mit | 9,276 |
# -*- coding: utf-8 -*-
{
'!langcode!': 'bg',
'!langname!': 'Български',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN',
'"User Exceptio... | xiang12835/python_web | py2_web2py/web2py/applications/admin/languages/bg.py | Python | apache-2.0 | 35,738 |
from datetime import datetime
from app import db
from app.exceptions import ValidationError
from flask import current_app, url_for
from flask_login import UserMixin
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from werkzeug.security import generate_password_hash, check_password_hash
from . imp... | AlvinCJin/RealEstateApp | app/models.py | Python | bsd-3-clause | 8,303 |
#!/usr/bin/env python3
#
# 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
# ... | francisliu/hbase | dev-support/git-jira-release-audit/git_jira_release_audit.py | Python | apache-2.0 | 27,558 |
import mock
from unittest import TestCase
from shade_janitor.resources import NoCloudException
from shade_janitor.resources import Resources
class TestResourcesCloud(TestCase):
def test_resources_fails_no_cloud(self):
with self.assertRaises(NoCloudException):
Resources(None)
def test_pa... | yazug/shade_janitor | shade_janitor/tests/unit/resources/test_cloud.py | Python | gpl-3.0 | 378 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
__doctest_skip__ = ['quantity_support']
def quantity_support(format='latex_inline'):
"""
En... | kelle/astropy | astropy/visualization/units.py | Python | bsd-3-clause | 2,941 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
import functools
class AboutDecoratingWithClasses(Koan):
def maximum(self, a, b):
if a > b:
return a
else:
return b
def test_partial_that_wrappers_no_args(self):
"""
Before we can... | aishraj/pykons_solution | python2/koans/about_decorating_with_classes.py | Python | mit | 3,738 |
class VeppyFeatureException(Exception):
pass
class StopEffectPrediction(Exception):
pass
class VeppyFileException(Exception):
pass
class FeatureFileException(VeppyFileException):
pass
class FastaFileException(VeppyFileException):
pass
| solvebio/veppy | veppy/errors.py | Python | mit | 263 |
"""
Set of various HTML parsers.
"""
from bs4 import BeautifulSoup
def apply_linebreaks(text):
"""
Convert python-style linebreaks to a html-style ones.
:param text: text with python-style linebreaks.
:return: text with html-style linebreaks.
"""
line_break = "<br>"
return text.repla... | BrainTech/pisak | pisak/blog/html_parsers.py | Python | gpl-3.0 | 2,262 |
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os.path
import platform
import re
import textwrap
from ansible import __version__
from ansible.module_utils._text import to_text
from ansible.module_utils.six import string_types
def system(v... | roots/bedrock-ansible | lib/trellis/utils/output.py | Python | mit | 4,757 |
# Copyright 2014 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | openstack/ironic-lib | ironic_lib/disk_utils.py | Python | apache-2.0 | 30,540 |
# -*- coding: utf-8 -*-
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2010 Thomas Perl and the gPodder Team
#
# gPodder 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... | Hillshum/gPodder-tagging | src/gpodder/gui.py | Python | gpl-3.0 | 171,344 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | redhat-openstack/cinder | cinder/volume/manager.py | Python | apache-2.0 | 91,945 |
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
# Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
#
# 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... | eworm-de/pacman | test/pacman/pmrule.py | Python | gpl-2.0 | 7,425 |
######################################
# Last update: 27 November 2018, Jan Dreyling-Eschweiler
######################################
# Sensor Name
sensor_name = "104"
# Middlepoints in DAC
IVDREF2 = 100
IVDREF1A = 65
IVDREF1B = 80
IVDREF1C = 135
IVDREF1D = 145
# Thermal noise: TN
THN_matA = 0.9318
THN_matB = 0.85... | eudaq/eudaq-configuration | jtag_generation/sensors/chip104/chip104.py | Python | lgpl-3.0 | 1,011 |
from django.core.management.base import BaseCommand
from build.management.commands.base_build import Command as BaseBuild
from django.db import transaction
from contactnetwork.models import *
from residue.models import Residue
import contactnetwork.interaction as ci
import logging
import datetime
from contactnetwo... | cmunk/protwis | build/management/commands/build_crystal_interactions.py | Python | apache-2.0 | 6,177 |
from setuptools import setup, find_packages
import os
from io import open
import re
# this setup.py is set up in a specific way to keep the azure* and azure-mgmt-* namespaces WORKING all the way
# up from python 2.7. Reference here: https://github.com/Azure/azure-sdk-for-python/wiki/Azure-packaging
PACKAGE_NAME = "a... | Azure/azure-sdk-for-python | sdk/remoterendering/azure-mixedreality-remoterendering/setup.py | Python | mit | 2,825 |
# -*- coding: utf-8 -*-
#
# User interface module of Dashboard.
#
# (C) 2013 Internet Initiative Japan Inc.
# All rights reserved.
#
# Created on 2013/05/20
# @author: yosinobu@iij.ad.jp
from genshi.builder import tag
from pkg_resources import resource_filename
from trac.core import *
from trac.perm import IPermission... | iij/TracPortalPlugin | tracportal/dashboard/web_ui.py | Python | mit | 2,727 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import re
from waflib.Tools import ccroot
from waflib import Utils
from waflib.Logs import debug
c_compiler={'win32':['msvc','gcc','clang'],'cygwin':['gcc'],'darwin':['clang','gcc'],'aix':['xlc','gcc... | softDi/clusim | ns3/ns-3.26/.waf-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Tools/compiler_c.py | Python | apache-2.0 | 1,750 |
""" This file contains the baseline functions for detecting anomalies from
sensor data using the ellipsoid boundary modeling techniques outlined by
Dr. Suthaharan et al. They are accessible via the IPython notebook
at the root of the repository and can be interchanged with custom functions
for exploratory analysis of t... | HarryRybacki/SensorDataResearchReproduction | baseline.py | Python | apache-2.0 | 11,136 |
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | oppia/oppia | core/controllers/resources_test.py | Python | apache-2.0 | 33,854 |
import pytest
from .._util import LocalProtocolError
from .._events import *
from .._state import *
from .._state import ConnectionState, _SWITCH_UPGRADE, _SWITCH_CONNECT
def test_ConnectionState():
cs = ConnectionState()
# Basic event-triggered transitions
assert cs.states == {CLIENT: IDLE, SERVER: IDL... | njsmith/h11 | h11/tests/test_state.py | Python | mit | 8,778 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | NewpTone/stacklab-cinder | cinder/tests/fake_flags.py | Python | apache-2.0 | 1,721 |
import os
import shutil
import sys
import tempfile
import pytest
from mock import Mock, patch, mock_open
from pip.exceptions import (
PreviousBuildDirError, InvalidWheelFilename, UnsupportedWheel,
)
from pip.download import PipSession
from pip._vendor import pkg_resources
from pip.index import PackageFinder
from ... | Carreau/pip | tests/unit/test_req.py | Python | mit | 11,138 |
'''
Created on Aug 24, 2016
@author: Rykath
Package: Utilities
Usage: various functions and classes
'''
def output(typ,message):
if typ == "error":
print("Error: "+message)
elif typ == "warning":
print("Warning: "+message)
elif typ in ["console","debug","test"]:
print(message)
de... | Rykath/RM-GoL | GameOfLife/Main-Py/Utilities/misc.py | Python | gpl-3.0 | 974 |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... | liosha2007/temporary-groupdocs-python3-sdk | groupdocs/models/SignatureFormsResult.py | Python | apache-2.0 | 1,012 |
import numpy as np
import equidistant as eq
selector = eq.PythonEquidistantSelector()
completePoints = np.array([1, 2, 4, 7])
sampledPoints = np.array([[1, 5], [3, 7], [6, 10]])
selector.setSampledPoints(sampledPoints)
selector.setCompletePoints(completePoints)
while(selector.hasNextInput()):
nextInp = selector.g... | Alexander-Schiendorfer/active-learning-collectives | CSP Model Abstraction/python/equidistant/testEquidistant.py | Python | mit | 809 |
#!/usr/bin/env python
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class NumberFormatDlg(QDialog):
def __init__(self, format, parent=None):
super(NumberFormatDlg, self).__init__(parent)
thousandsLabel = QLabel('&Thousands separator')
self.thousandsEdit = QLineEdit(format['thousand... | opensvn/python | numberformatdlg1.py | Python | gpl-2.0 | 1,085 |
from mediadrop.forms.admin.settings import *
| jobsafran/mediadrop | mediacore/forms/admin/settings.py | Python | gpl-3.0 | 45 |
"""
WSGI config for backbonejs_todos_with_Django 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.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "backbonejs_todos_... | ladder1984/backbonejs_todos_with_Django | backbonejs_todos_with_Django/wsgi.py | Python | mit | 431 |
# Import the Python Imaging Library if it is available. On error, ignore
# the problem and continue. PIL being absent should only affect the
# graphic lump loading/saving methods and the user may not be interested
# in installing PIL just to pass this line if not interested in using the
# graphics functionality at all.... | jmickle66666666/omgifol | lump.py | Python | mit | 11,325 |
#SPDX-License-Identifier: MIT
"""
Metrics that provide data about with insight detection and reporting
"""
import sqlalchemy as s
import pandas as pd
from augur.util import register_metric
@register_metric()
def deps(self, repo_group_id, repo_id=None):
depsSQL = s.sql.text("""
SELECT * FROM augur_data.dependenc... | OSSHealth/ghdata | augur/metrics/deps.py | Python | mit | 395 |
# coding=utf-8
# Copyright (c) 2001-2014, 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 a... | xlqian/navitia | source/jormungandr/jormungandr/instance.py | Python | agpl-3.0 | 30,251 |
import os
import zipfile
import simplejson as json
from flask import Blueprint, Response, current_app, request
from models.repository import Repository
from formatters.repository_formatter import RepositoryFormatter
from datetime import datetime
index_blueprint = Blueprint('index', __name__)
@index_blueprint.route("... | c0d3m0nkey/json-diff-api | app/controllers/index_controller.py | Python | bsd-2-clause | 5,021 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class Channel(models.Model):
_inherit = 'slide.channel'
nbr_certification = fields.Integer("Number of Certifications", compute='_compute_slides_statistics', store=True)
| ddico/odoo | addons/website_slides_survey/models/slide_channel.py | Python | agpl-3.0 | 312 |
#
# network.py - network configuration install data
#
# Copyright (C) 2008, 2009 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 o... | vojtechtrefny/python-meh | meh/network.py | Python | gpl-2.0 | 1,481 |
#!/usr/bin/env
def main() :
if __name__ == "__main__" :
main()
| prodicus/dabble | sqlite3/prac.py | Python | mit | 72 |
"""... automodule::"""
from autoencoder import Autoencoder
from backproptrainer import BackPropTrainer, SparseBackPropTrainer
| thomlake/EbmLib | ebmlib/autoencoder/__init__.py | Python | gpl-3.0 | 126 |
# stdlib
import importlib
import sys
from types import ModuleType
from typing import Any
from typing import Any as TypeAny
from typing import Dict as TypeDict
from typing import Iterable
from typing import List as TypeList
from typing import Optional
from typing import Set as TypeSet
from typing import Tuple as TypeTup... | OpenMined/PySyft | packages/syft/src/syft/lib/__init__.py | Python | apache-2.0 | 10,154 |
import logging
from datetime import date
from util import parse_date
from programtitles import ProgramTitles
from programeventdetails import ProgramEventDetails
from programdescriptionlist import ProgramDescriptionList
from programmetadata import ProgramMetadata
from programcast import ProgramCast
from programcrew impo... | astrilchuk/sd2xmltv | libschedulesdirect/common/program.py | Python | mit | 6,469 |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/storagepool/azure-mgmt-storagepool/setup.py | Python | mit | 2,679 |
from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket
#from websocket import create_connection
import threading
import time
clients = []
def searchFiles():
filelist = []
listOfFiles = os.listdir()
listOfFiles.sort()
pattern = 'file*'
for entry in listOfFiles:
if fnmatch.fnmatch(entry, pattern):
... | Bowenislandsong/Distributivecom | Archive-Dec-8/ServerCode/wsserver.py | Python | gpl-3.0 | 1,500 |
# -*- coding: utf-8 -*-
"""djwechat URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.ho... | stornado/djwechat | djwechat/djwechat/urls.py | Python | apache-2.0 | 1,016 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import frappe
import frappe.share
import unittest
class TestDocShare(unittest.TestCase):
def setUp(self):
self.user = "test@example.com"
self.event = frappe.get_doc({"doctype": "Event",
"subject": "test share event",
"st... | indautgrp/frappe | frappe/core/doctype/docshare/test_docshare.py | Python | mit | 3,305 |
from aiosparkapi.baseresponse import BaseResponse
from aiosparkapi.async_generator import AsyncGenerator
class Person(BaseResponse):
def __init__(self, result):
self._result = result
@property
def id(self):
return self._result['id']
@property
def emails(self):
return sel... | martiert/aiosparkapi | aiosparkapi/api/people.py | Python | mit | 2,135 |
# coding: utf-8
#
# Copyright 2015 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | DewarM/oppia | core/domain/collection_domain.py | Python | apache-2.0 | 23,086 |
# -*- coding: utf-8 -*-
# Copyright(C) 2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob 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 opt... | laurentb/weboob | weboob/applications/boobathon/boobathon.py | Python | lgpl-3.0 | 27,634 |
"""
Copyright (c) 2016- by Dietmar W Weiss
This 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) any later version.
This software ... | dwweiss/pmLib | src/Operation.py | Python | lgpl-3.0 | 6,899 |
"""
Core methods
------------
.. autofunction:: cache_toolbox.core.get_instance
.. autofunction:: cache_toolbox.core.delete_instance
.. autofunction:: cache_toolbox.core.instance_key
"""
from django.core.cache import cache
from django.db import DEFAULT_DB_ALIAS
from . import app_settings
def get_instance(model, in... | lamby/live-studio | contrib/cache_toolbox/core.py | Python | agpl-3.0 | 3,040 |
def mapper( keyword ):
result = ""
keywordFile = open("all_agu_keywords.csv", "r")
for line in keywordFile:
parts = line.split(",")
k = int(parts[1].strip())
name = parts[2].strip()
if ( keyword == k ):
result = name
ret... | narock/agu_analytics | obsolete/keyword_sort_by_topic.py | Python | gpl-3.0 | 1,743 |
from __future__ import annotations
import os
import shutil
import time
import gc
import threading
from typing import Optional
from utils.utilfuncs import safeprint
def DummyAsyncFileWrite(fn, writestr, access='a'):
safeprint('Called HB file write before init {} {} {}'.format(fn, writestr, access))
AsyncFileWrite ... | kevinkahn/softconsole | historybuffer.py | Python | apache-2.0 | 4,574 |
import sublime
import sublime_plugin
from isort.isort import SortImports
class PysortCommand(sublime_plugin.TextCommand):
def run(self, edit):
old_content = self.view.substr(sublime.Region(0, self.view.size()))
new_content = SortImports(file_contents=old_content).output
self.view.replace(... | turbidsoul/isort | sort.py | Python | mit | 556 |
# 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
# d... | mahak/neutron | neutron/tests/functional/services/logapi/drivers/ovn/test_driver.py | Python | apache-2.0 | 15,392 |
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
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... | eswartz/RenderPipeline | rpcore/util/generic.py | Python | mit | 4,285 |
# -*- coding: utf-8 -*-
from flask import g, flash, render_template, url_for, request
from coaster.views import load_model
from baseframe import _
from baseframe.forms import render_form, render_redirect, render_delete_sqla
from lastuser_core.models import db, UserEmail, UserEmailClaim, UserPhone, UserPhoneClaim
from... | sindhus/lastuser | lastuser_ui/views/profile.py | Python | bsd-2-clause | 6,260 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | meejah/AutobahnPython | autobahn/wamp/request.py | Python | mit | 7,949 |
import math
def swap(arr, i, j):
arr[i], arr[j] = arr[j], arr[i]
def selection_sort(a, lo, hi):
for i in range(lo, hi):
m = i
for j in range(i, hi):
if a[j] < a[m]:
m = j
swap(a, i, m)
def bubble_sort(a, lo, hi):
for i in range(lo, hi):
for j... | vadimadr/python-algorithms | algorithms/sorting.py | Python | mit | 8,501 |
"""Program to find the credit grade of a person.
usage:
firefly credit_grade.find_credit_grade
"""
import zlib
import random
def find_credit_grade(email):
"""Returns the credit grade of the person identified by the given email address.
The credit grade is generated randomly using the email as the se... | amitkaps/full-stack-data-science | credit-risk-deploy/credit_grade.py | Python | mit | 789 |
import pathlib
import pytest
import salt.modules.runit as runit
from tests.support.mock import patch
pytestmark = [pytest.mark.skip_on_windows]
@pytest.fixture
def configure_loader_modules():
return {runit: {}}
@pytest.fixture
def service_dir(tmp_path):
dirname = tmp_path / "services"
dirname.mkdir(ex... | saltstack/salt | tests/pytests/functional/modules/test_runit.py | Python | apache-2.0 | 1,518 |
# -*- coding: utf-8 -*-
"""
netvisor.auth
~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy.
:license: MIT, see LICENSE for more details.
"""
from __future__ import absolute_import
import datetime
import hashlib
import uuid
from requests.auth import AuthBase
from ._compat import text_type
... | fastmonkeys/netvisor.py | netvisor/auth.py | Python | mit | 3,762 |
__author__ = 'ahmetdal'
urlpatterns = [
] | mstzn36/django-river | test_urls.py | Python | gpl-3.0 | 44 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
BasicStatistics.py
---------------------
Date : November 2016
Copyright : (C) 2016 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
************... | stevenmizuno/QGIS | python/plugins/processing/algs/qgis/BasicStatistics.py | Python | gpl-2.0 | 12,810 |
# -*- coding: utf-8 -*-
import typing
import urllib.parse
import telegram.ext
import telegram.utils.helpers
import analytics
import constants
def check_admin(bot: telegram.Bot, context: telegram.ext.CallbackContext, message: telegram.Message, analytics_handler: analytics.AnalyticsHandler, admin_user_id: int) -> bo... | revolter/DexRoBot | src/telegram_utils.py | Python | gpl-3.0 | 2,302 |
# -*- coding: cp1252 -*-
#-------------------------------------------------------------------------------
# Name: Cumpleaños
#
# Author: Carlos Chesta
#-------------------------------------------------------------------------------
n = {
'Pepito': (1990, 10, 20),
'Yayita': (1992, 3, 3),
... | xbash/LabUNAB | 15_estructuras/cumpleaños.py | Python | gpl-3.0 | 1,052 |
import cx_Freeze
import sys
import os
os.environ['TCL_LIBRARY'] = "C:\\LOCAL_TO_PYTHON\\Python35-32\\tcl\\tcl8.6"
os.environ['TCL_LIBRARY'] = "C:\\LOCAL_TO_PYTHON\\Python35-32\\tcl\\tk8.6"
base = None
if sys.platform == 'win32':
base = 'Win32GUI'
executables = [cx_Freeze.Executable("test.py", base=None)]
cx_Fre... | AmilaViduranga/FDDS | setup.py | Python | mit | 670 |
"""Config flow for BSB-Lan integration."""
import logging
from typing import Any, Dict, Optional
from bsblan import BSBLan, BSBLanError, Info
import voluptuous as vol
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.help... | GenericStudent/home-assistant | homeassistant/components/bsblan/config_flow.py | Python | apache-2.0 | 2,690 |
"""this extension try to enhance the function of the calculator"""
from lib import basic_cal
import math
class MathExpressionsCal(basic_cal.Calculator):
def __init__(self):
super().__init__()
self.math_operator_list = {"sin": -1, "cos": -1, "tan": -1, "log": -1, ',': -1, "ln": -1}
... | DaivdZhang/pyCalculator | src/lib/math_cal.py | Python | mit | 2,432 |
from threading import Thread
import zmq
from protobuf.cta_event_pb2 import CTAEvent
class ReadProtoBuf(Thread, object):
'''reads cta data from protobuf and pushes the data into the tk window '''
def __init__(self, ip, port, queue, stop_event):
Thread.__init__(self)
self.stop_event = stop_even... | MaxNoe/cta_event_viewer | read/__init__.py | Python | mit | 1,003 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2019-01-09 13:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crm', '0006_auto_20181001_0631'),
]
operations = [
migrations.AddField(
... | ocwc/ocwc-members | members/crm/migrations/0007_organization_billing_type.py | Python | mit | 633 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Gilles-Alexandre Quenot
#
# This file is part of weboob.
#
# weboob 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... | franek/weboob | modules/fortuneo/backend.py | Python | agpl-3.0 | 2,495 |
"""This module contains functionality expected to be used by all request handlers."""
import tor_async_util
class RequestHandler(tor_async_util.RequestHandler):
"""Absract base class for all request handlers."""
@property
def config(self):
"""motivated by desire to make code easier to read and m... | simonsdave/cloudfeaster_infrastructure | cloudfeaster_services/request_handlers.py | Python | mit | 470 |
files = [ "strobe_gen.vhd" ]
| lnls-dig/dsp-cores | hdl/modules/strobe_gen/Manifest.py | Python | lgpl-3.0 | 30 |
# -*- coding: utf-8 -*-
# This coding header is significant for tests, as the debug view is parsing
# files to search for such a header to decode the source file content
from __future__ import absolute_import, unicode_literals
import inspect
import os
import sys
from django.conf import settings
from django.core impor... | Proggie02/TestRepo | tests/regressiontests/views/tests/debug.py | Python | bsd-3-clause | 22,519 |
"""
Constants used in ops classes
"""
HYBRID_VM = 'hybridvm'
VM_POWER_ON_STATUS = 4
VM_POWER_OFF_STATUS = 8
| HybridF5/hybrid-jacket | nova_jacket/virt/jacket/vcloud/constants.py | Python | apache-2.0 | 110 |
########################################################################
#
# File Name: HTMLScriptElement
#
# Documentation: http://docs.4suite.com/4DOM/HTMLScriptElement.html
#
### This file is automatically generated by GenerateHtml.py.
### DO NOT EDIT!
"""
WWW: http://4suite.com/4DOM ... | carvalhomb/tsmells | guess/src/Lib/xml/dom/html/HTMLScriptElement.py | Python | gpl-2.0 | 3,340 |
import numpy as np
import warnings
import operator
from heapq import merge
class intervals(object):
r"""
This class implements methods for intervals or union of two unbounded
intervals, when all these sets have a point in their intersection
"""
def __init__(self, I = None):
"""
... | selective-inference/selective-inference | selectinf/constraints/intervals.py | Python | bsd-3-clause | 6,279 |
"""
Unit tests for trust-region optimization routines.
To run it in its simplest form::
nosetests test_optimize.py
"""
import pytest
import numpy as np
from numpy.testing import assert_, assert_equal, assert_allclose
from scipy.optimize import (minimize, rosen, rosen_der, rosen_hess,
ros... | scipy/scipy | scipy/optimize/tests/test_trustregion.py | Python | bsd-3-clause | 4,701 |
import time
import os
import pickle
from softwarecenter.paths import SOFTWARE_CENTER_CACHE_DIR
# decorator to add a fake network delay if set
# in FakeReviewSettings.fake_network_delay
def network_delay(fn):
def slp(self, *args, **kwargs):
fake_settings = FakeReviewSettings()
delay = fake_setting... | sti-lyneos/shop | softwarecenter/backend/fake_review_settings.py | Python | lgpl-3.0 | 7,873 |
#!/usr/bin/env python
# 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.
"""
A Deterministic acyclic finite state automaton (DAFSA) is a compact
representation of an unordered word list (dictionary).
https:/... | nwjs/chromium.src | net/tools/dafsa/make_dafsa.py | Python | bsd-3-clause | 14,621 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.