code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""CMS view for static pages"""
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from boski.mixins impor... | Alkemic/webpage | module/static_page/cms/views.py | Python | mit | 5,262 |
# Copyright 2013-2020 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.path
import re
import shutil
import llnl.util.tty as tty
import llnl.util.lang
import spack.compiler
import spac... | rspavel/spack | lib/spack/spack/compilers/apple_clang.py | Python | lgpl-2.1 | 7,173 |
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
__author__ = "d01"
__email__ = "jungflor@gmail.com"
__copyright__ = "Copyright (C) 2015-16, Florian JUNG"
__license__ = "MIT"
__version__ = "0.1.0... | the01/python-paps | examples/measure/main.py | Python | mit | 3,357 |
"""
session --- Reopen files when starting
======================================
"""
from PyQt5.QtCore import QTimer
import os.path
from enki.core.core import core
from enki.core.defines import CONFIG_DIR
import enki.core.json_wrapper
_AUTO_SAVE_INTERVAL_MS = 60 * 1000
def getSessionFilePath():
if core.comma... | bjones1/enki | enki/plugins/session.py | Python | gpl-2.0 | 4,134 |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import logging
LOG = logging.getLogger(__name__)
class CopyAnnotationsPlugin(QObject):
def __init__(self, labeltool, class_filter=None, frame_range=1, overlap_threshold=None, prefix=''):
QObject.__init__(self)
self._class_filter = class_filte... | shiquanwang/sloth | sloth/plugins/__init__.py | Python | gpl-3.0 | 3,144 |
r"""
Cole-Cole
=========
There are various different definitions of a Cole-Cole model, see for instance
Tarasov and Titov (2013). We try a few different ones here, but you can supply
your preferred version.
The original Cole-Cole (1941) model was formulated for the complex dielectric
permittivity. It is reformulated ... | prisae/empymod | examples/time_domain/cole_cole_ip.py | Python | apache-2.0 | 8,028 |
#
# 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 ... | mkhutornenko/incubator-aurora | src/test/python/apache/aurora/client/cli/util.py | Python | apache-2.0 | 7,372 |
#!/usr/bin/python3
# Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
# 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 License, or
# (at your option) any later... | CZ-NIC/knot | scripts/dns_sql2zf.py | Python | gpl-3.0 | 10,871 |
'''
--------------------------------------------------------------------------------------
tasks.py
--------------------------------------------------------------------------------------
A set of tasks to manage your AWS Django deployment.
author : Ashok Fernandez (github.com/ashokfernandez/)
credit : Derived from fi... | aqui/website | fabfile/tasks.py | Python | gpl-3.0 | 13,021 |
import requests
from django.core.management.base import BaseCommand
from popolo.models import Membership
from speeches.models import Section, Speech
class Command(BaseCommand):
help = 'Validates speeches, sections and memberships'
def handle(self, *args, **options):
# All speeches should belong to a... | SpringtideCollectiveOrg/openhousens.ca | legislature/management/commands/validate.py | Python | mit | 1,437 |
# pip install matplotlib
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import datetime
import time
x = [0, 1]
y = [0, 1.5]
#y = []
fig = plt.figure("盈利分析", (18, 5))
# plt.plot(x,y)
# plt.plot_date(x,y)
# x = range(3)
# y1 = [elem*2 for elem in x]
# plt.plo... | GuLiPing-Hz/PL | py/pytest/test_draw.py | Python | gpl-3.0 | 1,222 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import sys
# Application
APP_NAME = "BigBashView"
APP_VERSION = "3.0.0"
# Directories
PROGDIR = os.path.dirname(os.path.abspath(sys.argv[0]))
DATA_DIR = os.path.expanduser("~/.bigbashview3")
# Server
ADDRESS = "127.0.0.1"
PORT = 6543
COMPAT = True
# Window
WIDTH... | kaiana/bigbashview | usr/share/bigbashview3/globals.py | Python | gpl-2.0 | 436 |
"""
sentry.testutils
~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import base64
import time
from sentry.conf import settings
from sentry.utils import json
from sentry.utils.auth im... | simmetria/sentry | src/sentry/testutils.py | Python | bsd-3-clause | 5,319 |
from flask import Flask, jsonify, request
from flask.ext.cors import CORS
import re
availability = {}
app = Flask(__name__)
CORS(app)
@app.route("/")
def hello_world():
return jsonify({"message": "Hello World!"})
@app.route("/availability")
def get_availability():
return jsonify(availability)
@app.route(... | hacksu/Availability | AvailabilityBackend.py | Python | unlicense | 1,039 |
"""Offer numeric state listening automation rules."""
import logging
import voluptuous as vol
from homeassistant import exceptions
from homeassistant.const import (
CONF_ABOVE,
CONF_ATTRIBUTE,
CONF_BELOW,
CONF_ENTITY_ID,
CONF_FOR,
CONF_PLATFORM,
CONF_VALUE_TEMPLATE,
)
from homeassistant.co... | partofthething/home-assistant | homeassistant/components/homeassistant/triggers/numeric_state.py | Python | apache-2.0 | 6,771 |
# ENH some closed forms
import pathlib
from sympy import Rational as frac
from sympy import sqrt
from ...helpers import article
from .._helpers import C2Scheme, _read, register
from .._tyler import tyler_2 as dunavant_03
source = article(
authors=["D.A. Dunavant"],
title="Economical symmetrical quadrature ru... | nschloe/quadpy | src/quadpy/c2/_dunavant/__init__.py | Python | mit | 1,858 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | caio2k/RIDE | src/robotide/lib/robot/running/userkeyword.py | Python | apache-2.0 | 10,334 |
#!/usr/bin/python
# Copyright 2017 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 ... | deepmind/pysc2 | pysc2/env/mock_sc2_env_comparison_test.py | Python | apache-2.0 | 2,364 |
#!/usr/bin/env python
import re
import glob
import sys
if len(sys.argv) != 3:
print('usage: python post.py directory versionNumber')
sys.exit(1)
path = str(sys.argv[1])
insertVersion = re.compile(r'VERSION_VERSION_VERSION')
insertSTLLink = re.compile(r'WWW_STL_DOCU')
# tested with doxygen 1.7.5.1
hasAnchor... | dstoe/vigra | docsrc/post.py | Python | mit | 6,047 |
# Lint as: python2, python3
# 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
#
... | karllessard/tensorflow | tensorflow/tools/compatibility/update/generate_v2_renames_map.py | Python | apache-2.0 | 7,410 |
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Replay
import json
class CausewayFileLoader(Replay.FileLoader):
__gtype_name__ = 'CausewayFileLoader'
def __init__(self):
Replay.FileLoader.__init__(self, name='Causeway Traces', pattern='*.log')
def valida... | alexmurray/replay | plugins/causeway/causeway.py | Python | gpl-3.0 | 5,091 |
# -*- coding: utf-8 -*-
"""
A Trait Documenter
(Subclassed from the autodoc ClassLevelDocumenter)
:copyright: Copyright 2012 by Enthought, Inc
"""
import traceback
import sys
import inspect
import tokenize
import token
import StringIO
from sphinx.ext.autodoc import ClassLevelDocumenter
from ..trait_hand... | HyperloopTeam/FullOpenMDAO | lib/python2.7/site-packages/traits-4.3.0-py2.7-macosx-10.10-x86_64.egg/traits/util/trait_documenter.py | Python | gpl-2.0 | 4,801 |
#!/usr/bin/env python
from SettingsWidgets import *
from gi.repository import Gio
class Module:
def __init__(self, content_box):
keywords = _("desktop, home, button, trash")
advanced = False
sidePage = SidePage(_("Desktop"), "desktop.svg", keywords, advanced, content_box)
self.side... | chitwanix/Sagarmatha | files/usr/lib/sagarmatha-settings/modules/cs_desktop.py | Python | gpl-2.0 | 1,650 |
from oauth2app.models import *
def clientAuthorizations(client, user):
authorizations = AccessToken.objects.filter(client=client, user=user).all()
ass = []
for a in authorizations:
ass += [k.key for k in a.scope.all()]
return ass
def getClients(type):
try: clients = Client.objects.filter(type=ClientType.object... | RaduGatej/SensibleData-Platform | sensible_data_platform/oauth2_authorization_server/manager.py | Python | mit | 847 |
import os
import sys
import time
import atexit
import datetime
import argparse
CUR_DIR = os.path.dirname(os.path.realpath(__file__))
# If you have more than 8 stations, change this value.
NUMBER_OF_STATIONS = 8
# The longest a station can run for by default is 30 minutes. This allows
# the operating system a way to ... | greencoder/ospi-cli | opensprinkler.py | Python | mit | 9,457 |
import numpy as np
import copy
class Complex:
def __init__(self, dim, func, func_args=(), symmetry=False, bounds=None,
g_cons=None, g_args=()):
self.dim = dim
self.bounds = bounds
self.symmetry = symmetry # TODO: Define the functions to be used
# here in init... | scipy/scipy | scipy/optimize/_shgo_lib/triangulation.py | Python | bsd-3-clause | 21,439 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| mindcube/mindcube-django-cookiecutter | {{cookiecutter.repo_name}}/manage.py | Python | mit | 256 |
from myhdl import *
from vga_intf import System
from vga_intf import VideoMemory
# r, g, b
cbars = [
[1, 1, 1,], # white
[1, 1, 0,], # yellow
[0, 1, 1,], # cyan
[0, 1, 0,], # green
[1, 0, 1,], # magenta
[1, 0, 0,], # red
[0, 0, 1,], # blue
[0, 0, 0,], # black
]
d... | chiggs/alt.hdl | examples/ex6_vgasys/myhdl/vga_color_bars.py | Python | mit | 1,886 |
from cms.constants import PUBLISHER_STATE_DIRTY
from django.db import models
from cms.models import Page, Title
class BaseExtension(models.Model):
public_extension = models.OneToOneField('self', null=True, editable=False, related_name='draft_extension')
extended_object = None
class Meta:
abstrac... | sephii/django-cms | cms/extensions/models.py | Python | bsd-3-clause | 3,140 |
# -*- coding: utf-8 -*-
import os.path
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from functools import partial
import asyncio
import argparse
from aiogear import Worker, Client
def parse_args():
args = sys.argv[1:]
parser = argparse.ArgumentParser()
parse... | sardok/aiogear | examples/client.py | Python | mit | 1,875 |
from .banyan_base_multi import BanyanBaseMulti
| MrYsLab/python_banyan | python_banyan/banyan_base_multi/__init__.py | Python | agpl-3.0 | 47 |
##############################################################################
#
# Copyright (c) 2014, 2degrees Limited.
# All Rights Reserved.
#
# This file is part of hubspot-contacts
# <https://github.com/2degrees/hubspot-contacts>, which is subject to the
# provisions of the BSD at
# <http://dev.2degreesnetwork.com... | 2degrees/hubspot-contacts | hubspot/contacts/_schemas/contacts.py | Python | bsd-3-clause | 1,895 |
# source: http://stackoverflow.com/questions/2758159/how-to-embed-a-python-interpreter-in-a-pyqt-widget
import sys
import os
import re
import traceback
from PyQt5 import QtCore
from PyQt5 import QtGui
from PyQt5 import QtWidgets
from electrum_ltc import util
from electrum_ltc.i18n import _
from .util import MONOSP... | vialectrum/vialectrum | electrum_ltc/gui/qt/console.py | Python | mit | 11,822 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
TRANSACTION_STATUS = (
('P', _('pending')),
('F', _('failed')),
('C', _('complete')),
)
class Transaction(models.Model):
user = models.ForeignKey(User, blank = True, null... | truevision/django_banklink | django_banklink/models.py | Python | bsd-3-clause | 1,291 |
name = input("What is your name? ")
number = input("How old are you? ")
age = int(number)
print("Your name backwards is ", name[::-1].lower())
print("Your age is ten years will be ", age + 10) | SaileshPatel/BBC-Brum-Challenges | name.py | Python | mit | 193 |
import os
import logging
import numpy as np
from utils import CONFIG
from pandas import read_csv
from pprint import pformat
from collections import Counter
from nltk.tokenize import word_tokenize
try:
import cPickle as pickle
except:
import pickle
config = CONFIG.CapData
logger = logging.getLogger('CapData')
lo... | chintak/image-captioning | scripts/reader.py | Python | mit | 3,050 |
"""class:`trols_stats.Reporter`
Statistics reporting module.
"""
import re
import collections
import logging
import trols_stats
class Reporter:
def __init__(self, db):
self.__db = db()
@property
def db(self):
return self.__db
@db.setter
def db(self, value):
self.__db =... | loum/trols-stats | trols_stats/interface/reporter.py | Python | gpl-2.0 | 18,397 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import os
import pytest
from django.conf import settings
from djan... | shoopio/shoop | shuup_tests/admin/test_modules.py | Python | agpl-3.0 | 6,785 |
#!/usr/bin/env python
#
import ACNodeBase as ACNodeBase
import SharedSecret as SharedSecret
import TrustOnFirstContact as TrustOnFirstContact
# Protocol 0.0
# class ACNode(ACNodeBase.ACNodeBase):
# pass
# Protocol SIG/1
# class ACNode(SharedSecret.SharedSecret):
# pass
# Protocol SIG/1 and /2
class ACNode(Trus... | dirkx/AccesSystem | lib-python/ACNode.py | Python | apache-2.0 | 395 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from wechatpy.client.api.base import BaseWeChatAPI
class WeChatPoi(BaseWeChatAPI):
def add(self, poi_data):
"""
创建门店
详情请参考
http://mp.weixin.qq.com/wiki/16/8f182af4d8dcea02c56506306bdb2f4c.html
... | chenjiancan/wechatpy | wechatpy/client/api/poi.py | Python | mit | 2,307 |
__author__ = 'Mirko Rossini'
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Command that fails'
def add_arguments(self, parser):
parser.add_argument('argument', nargs='+', type=str)
def handle(self, *args, **options):
print("AAaaaaaaaa", args, op... | MirkoRossini/pybuilder_django_enhanced_plugin | src/integrationtest/resources/testproject/testapp/management/commands/working_command.py | Python | bsd-3-clause | 407 |
#!/usr/bin/env python3
## get_protein_www.py --
## get a protein sequence from the Uniprot or NCBI/Refseq web sites using the accession
##
import sys
import re
import textwrap
import time
import requests
ncbi_url = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?"
uniprot_url = "https://www.uniprot.org... | uwbmrb/BMRB-API | server/wsgi/bmrbapi/submodules/fasta36/scripts/get_protein.py | Python | gpl-3.0 | 1,680 |
import datetime
from mock import patch, MagicMock, PropertyMock
from cloudify_rest_client import deployments, executions, blueprints
from cloudify_rest_client.exceptions import CloudifyClientError, \
MissingRequiredDeploymentInputError, UnknownDeploymentInputError
from ... import exceptions
from .mocks import M... | isaac-s/cloudify-cli | cloudify_cli/tests/commands/test_deployments.py | Python | apache-2.0 | 12,173 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.thermal_zones_and_surfaces import ShadingOverhang
log = logging.getLogger(__name__)
class TestShadingOverhang(unittest.TestCase):
def setUp(self):
self.fd, self.pat... | rbuffat/pyidf | tests/test_shadingoverhang.py | Python | apache-2.0 | 2,442 |
import chipDB
class IspBase():
def programChip(self, flashData):
self.curExtAddr = -1
self.chip = chipDB.getChipFromDB(self.getSignature())
if self.chip == False:
raise IspError("Chip with signature: " + str(self.getSignature()) + "not found")
self.chipErase()
print("Flashing %i bytes" % len(flashData... | fastbot3d/Octoprint | src/octoprint/util/avr_isp/ispBase.py | Python | agpl-3.0 | 851 |
# coding: utf-8
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class Subtitle(object):
"""
NOTE: This class is auto gen... | kinow-io/kinow-python-sdk | kinow_client/models/subtitle.py | Python | apache-2.0 | 8,021 |
"""Provide access to Python's configuration information.
"""
import sys
import os
from os.path import pardir, realpath
_INSTALL_SCHEMES = {
'posix_prefix': {
'stdlib': '{base}/lib/python{py_version_short}',
'platstdlib': '{platbase}/lib/python{py_version_short}',
'purelib': '{base}/lib/pyt... | qenter/vlc-android | toolchains/arm/lib/python2.7/sysconfig.py | Python | gpl-2.0 | 23,143 |
"""The setup for our data_structures project."""
from setuptools import setup
setup(
name="Data structures",
description="Implementations of various data structures in Python",
version=0.1,
author="Maelle Vance, Sera Smith, Ben Shields, Joey DeRosa",
author_email="maellevance@gmail.com, seras37@gm... | ellezv/data_structures | setup.py | Python | mit | 826 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/svn/docs/wafbook/single.html#_obtaining_the_waf_file
from waflib import TaskGen,Task,Utils
from waflib.Tools import c_preproc
from waflib.Tools.ccroot import link_task,stlink_task
def c_hook(self,node):
return self.create_compi... | drayside/kodkod | libs/.waf-1.6.6-c57dd0fa119e23d36c23d598487c6880/waflib/Tools/c.py | Python | mit | 1,096 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "plataforma_fadcanic.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| CARocha/plataforma_fadcanic | manage.py | Python | mit | 262 |
from student.roles import CourseStaffRole, CourseInstructorRole, CourseCreatorRole
from student.models import CourseAccessRole
# Role name for OrgStaffRole, OrgInstructorRole has hardcoded in __init__ method ("staff" and "instructor")
LIBRARY_CREATE_ROLES = [
'staff',
'instructor',
CourseInstructorRole.ROL... | miptliot/edx-platform | openedx/eduscaled/cms/utils.py | Python | agpl-3.0 | 566 |
# -*- coding: utf-8 -*-
"""The FVDE file entry implementation."""
from dfvfs.lib import definitions
from dfvfs.lib import errors
from dfvfs.vfs import root_only_file_entry
from dfvfs.vfs import vfs_stat
class FVDEFileEntry(root_only_file_entry.RootOnlyFileEntry):
"""Class that implements a file entry object using ... | dc3-plaso/dfvfs | dfvfs/vfs/fvde_file_entry.py | Python | apache-2.0 | 1,039 |
"""User containers module."""
from dependency_injector import containers, providers
from . import entities, repositories
class UserContainer(containers.DeclarativeContainer):
database = providers.Dependency()
user = providers.Factory(entities.User)
user_repository = providers.Singleton(
repos... | ets-labs/python-dependency-injector | examples/miniapps/decoupled-packages/example/user/containers.py | Python | bsd-3-clause | 409 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
import models
import forms
import nested_admin
# Register your models here.
class CiudadAdmin(admin.ModelAdmin):
list_display = ['nombre']
form = forms.CiudadForm
#end class
class EmpresaAdmin(admin.ModelAdmin):... | darkdrei/GestionRegistro | empresa/admin.py | Python | mit | 1,855 |
import concurrent.futures
import contextlib
import json
import logging
import random
import threading
import time
from collections import deque
from subprocess import check_output
import pytest
import requests
import retrying
from test_helpers import expanded_config
from test_util.marathon import get_test_app, get_t... | darkonie/dcos | packages/dcos-integration-test/extra/test_networking.py | Python | apache-2.0 | 13,788 |
#!/usr/bin/env python3
import os
import glob
from shutil import copytree, copy2, move
from xml.etree import ElementTree
from pathlib import Path
from scripts.build_env import BuildEnv, Platform
from scripts.platform_builder import PlatformBuilder
class zeromqWindowsBuilder(PlatformBuilder):
def __init__(self,
... | lovewinds/story-project | external/scripts/packages/zeromq/windows.py | Python | gpl-2.0 | 4,234 |
#!/usr/bin/python3
## system-config-printer
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2014, 2015 Red Hat, Inc.
## Copyright (C) 2006 Florian Festi <ffesti@redhat.com>
## Copyright (C) 2006, 2007, 2008, 2009 Tim Waugh <twaugh@redhat.com>
## This program is free software; you can redistribute it and/or modi... | zdohnal/system-config-printer | cupshelpers/ppds.py | Python | gpl-2.0 | 44,162 |
# vim:set et sts=4 sw=4:
#
# ibus - The Input Bus
#
# Copyright(c) 2007-2009 Peng Huang <shawn.p.huang@gmail.com>
# Copyright(c) 2007-2009 Red Hat, Inc.
#
# 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 Softw... | sun-im/ibus | ui/gtk/languagebar.py | Python | lgpl-2.1 | 9,031 |
"""
Escape the `body` part of .chm source file to 7-bit ASCII, to fix visual
effect on some MBCS Windows systems.
https://bugs.python.org/issue32174
"""
import re
from html.entities import codepoint2name
from sphinx.util.logging import getLogger
# escape the characters which codepoint > 0x7F
def _process(string):
... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Doc/tools/extensions/escape4chm.py | Python | gpl-2.0 | 1,817 |
# -*- coding: utf8 -*-
SQL = """SELECT ONAME, concat(FKOD," опись:",OKOD) FROM `afweb_opis` WHERE FKOD LIKE '%%%(q)s%%' or OKOD LIKE '%%%(q)s%%' or ONAME LIKE '%%%(q)s%%' limit %(limit)s ;"""
| ffsdmad/af-web | cgi-bin/plugins/autocomplit_mod/opis_search.py | Python | gpl-3.0 | 199 |
"""
[2017-02-08] Challenge #302 [Intermediate] ASCII Histogram Maker: Part 1 - The Simple Bar Chart
https://www.reddit.com/r/dailyprogrammer/comments/5st2so/20170208_challenge_302_intermediate_ascii/
# Description
Any Excel user is probably familiar with the bar chart - a simple plot showing vertical bars to represen... | DayGitH/Python-Challenges | DailyProgrammer/DP20170208B.py | Python | mit | 1,545 |
##########################################################################
#
# Copyright (c) 2012, John Haddon. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that ... | hradec/gaffer | python/GafferSceneTest/ScenePlugTest.py | Python | bsd-3-clause | 9,869 |
from .configuration_line_parser import ConfigurationLineParser
from .ert_keywords import ErtKeywords
| arielalmendral/ert | python/python/ert_gui/ide/keywords/__init__.py | Python | gpl-3.0 | 101 |
#!/usr/bin/python
from otpsetup.shortcuts import DjangoBrokerConnection
from otpsetup.shortcuts import stop_current_instance, build_multi_queue
from otpsetup import settings
from datetime import datetime
import traceback
import handlers
import process_gtfs, transformer
print "Starting Graph Builder Consumer"
queue... | opentripplanner/OTPSetup | otpsetup/graph_builder/main.py | Python | gpl-3.0 | 1,230 |
import unittest
from System.Windows.Browser.HtmlPage import Document as d
from System.Windows.Browser.HtmlPage import BrowserInformation as browser
class HtmlBridgeRegression(unittest.TestCase):
def setUp(self):
self.div = d.CreateElement('div')
self.div.id = 'testDiv'
a = d.CreateElement... | tempbottle/dlr | Src/Hosts/Silverlight/Tests/tests/regressions/test_htmlbridge.py | Python | apache-2.0 | 2,103 |
from collections import OrderedDict
from plenum.common.messages.fields import LimitedLengthStringField
from plenum.common.messages.client_request import ClientMessageValidator
from plenum.common.messages.node_messages import Propagate
EXPECTED_ORDERED_FIELDS = OrderedDict([
("request", ClientMessageValidator),
... | evernym/zeno | plenum/test/input_validation/message_validation/test_propagate_message.py | Python | apache-2.0 | 805 |
#!/usr/bin/env python
# Helpful little script that spits out a comma-separated list of
# language codes for Qt icons that should be included
# in binary bitmark distributions
import glob
import os
import re
import sys
if len(sys.argv) != 3:
sys.exit("Usage: %s $QTDIR/translations $BITMARKDIR/src/qt/locale"%sys.arg... | project-bitmark/pfennig | contrib/qt_translations.py | Python | mit | 616 |
import sys
import traceback
import urllib2
from xml.dom.minidom import getDOMImplementation
from django.views.debug import get_safe_settings
from django.conf import settings
from hoptoad import VERSION, NAME, URL
from hoptoad import get_hoptoad_settings
from hoptoad.api.htv1 import _parse_environment, _parse_request,... | sjl/django-hoptoad | hoptoad/api/htv2.py | Python | mit | 9,161 |
#!/opt/local/bin/pypy -tt
# -*- coding: utf-8 -*-
#Copyright (C) 2014 Chris Hinsley All Rights Reserved
import sys, argparse, router
from copy import deepcopy
from ast import literal_eval
from mymath import *
def main():
parser = argparse.ArgumentParser(description = 'Pcb layout optimizer.', formatter_class = argpa... | vygr/Python-PCB | pcb.py | Python | gpl-2.0 | 3,869 |
"""
WSGI config for hue7jip8 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | sih4sing5hong5/hue7jip8 | hue7jip8/wsgi.py | Python | mit | 394 |
from json import dumps
import random
import time
def strTimeProp(start, end, format, prop):
"""Get a time at a proportion of a range of two formatted times.
start and end should be strings specifying times formated in the
given format (strftime-style), giving an interval [start, end].
prop specifies... | trangel/Data-Science | tracking-purchases/insight_testsuite/tests/test_5/log_input/mkdb.py | Python | gpl-3.0 | 2,917 |
from flask import Blueprint
from flask import Flask, abort
from flask import jsonify
from flask import render_template
from flask import request,send_from_directory
import socket
import config as conf
import helpers
churn_api = Blueprint('churn_api', __name__)
@churn_api.route('')
def getChurn():
return render_t... | nachoaguadoc/aimlx-demos | controller/churn_controller.py | Python | mit | 1,137 |
#!/usr/bin/python2
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Simple system info tool for bug reports, etc.
"""
# More info at:
#
# http://code.activestate.com/recipes/511491/
# http:... | Lind-Project/native_client | tools/sysinfo.py | Python | bsd-3-clause | 3,324 |
# Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
from UM.Job import Job
## A Job subclass that performs writing.
#
# The writer defines what the result of this job is.
class WriteFileJob(Job):
## Creates a new job for writing.
#
# \param writer The ... | onitake/Uranium | UM/FileHandler/WriteFileJob.py | Python | agpl-3.0 | 1,153 |
# Copyright 2013-2015 VPAC
# Copyright 2014 The University of Melbourne
#
# 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 y... | monash-merc/karaage | karaage/common/decorators.py | Python | gpl-3.0 | 3,954 |
import os
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class DBConnector():
'''
where every row is the details one employee was paid for an entire month.
'''
@classmethod
def get_sess... | JasonThomasData/payslip_code_test | app/models/db_connector.py | Python | mit | 498 |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _
User = get_user_model()
class TimtecUserAdmin(UserAdmin):
model = User
fieldsets = UserAdmin.fieldsets + (
(_('Timt... | hacklabr/timtec | accounts/admin.py | Python | agpl-3.0 | 501 |
import sys
sys.path.append('../..')
import codestudio
z = codestudio.load('s1level86')
def draw_square():
for count in range(4):
z.move_forward(100)
z.turn_right(90)
def draw_triangle():
for count in range(3):
z.move_forward(100)
z.turn_right(120)
def draw_house():
draw_sq... | skilstak/code-dot-org-python | solutions/stage15-artist4/s1level86.py | Python | unlicense | 404 |
# -*- 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... | Grirrane/odoo | addons/account/account_bank_statement.py | Python | agpl-3.0 | 57,413 |
from . import (
code_blocks, headings, plain_summary, featured_image, media, tables,
authors, outdated_article,
)
PLUGINS = [
code_blocks, headings, plain_summary, featured_image, media, tables,
authors, outdated_article
]
| honzajavorek/danube-delta | danube_delta/plugins/__init__.py | Python | mit | 241 |
# Copyright 2014: Mirantis 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 ... | group-policy/rally | rally/task/validation.py | Python | apache-2.0 | 24,903 |
from .base import SQLAdapter
from . import adapters, with_connection_or_raise
@adapters.register_for("informix")
class Informix(SQLAdapter):
dbengine = "informix"
drivers = ("informixdb",)
def _initialize_(self):
super(Informix, self)._initialize_()
ruri = self.uri.split("://", 1)[1]
... | web2py/pydal | pydal/adapters/informix.py | Python | bsd-3-clause | 2,076 |
"""
MIT License
Copyright (c) 2017 cgalleguillosm, AlessioNetti
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, ... | cgalleguillosm/accasim | accasim/base/scheduler_class.py | Python | mit | 26,009 |
import threading
# 创建全局ThreadLocal对象:
local_school = threading.local()
def process_student():
# 获取当前线程关联的student:
std = local_school.student
print('Hello, %s (in %s)' % (std, threading.current_thread().name))
def process_thread(name):
# 绑定ThreadLocal的student:
local_school.student ... | IIIIIIIIll/sdy_notes_liaoxf | LiaoXueFeng/multitasking_multithreading/localThread.py | Python | gpl-3.0 | 593 |
#!/usr/bin/env python
# Copyright 2007 The Closure Linter 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
#
#... | SummerLW/Perf-Insight-Report | third_party/closure_linter/closure_linter/common/filetestcase.py | Python | bsd-3-clause | 4,040 |
# coding: utf-8
try:
from urllib import quote #, unquote_plus
except ImportError:
from urllib.parse import quote #, unquote_plus
from grab.tools.lxml_tools import get_node_text
import logging
from .encoding import smart_str
class CaptchaError(Exception):
"""
Raised when yandex shows captcha.
"""
... | boooka/GeoPowerOff | venv/lib/python2.7/site-packages/grab/tools/yandex.py | Python | apache-2.0 | 3,550 |
# Copyright (c) 2014 Alexander Bredo
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions ... | alexbredo/site-packages3 | handler/elasticsearch.py | Python | bsd-2-clause | 6,002 |
# Generated by Django 2.2.25 on 2021-12-30 13:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("letters", "0012_letter_created_by_staff"),
]
operations = [
migrations.AlterField(
model_name="letter",
name="creat... | watchdogpolska/poradnia | poradnia/letters/migrations/0013_auto_20211230_1439.py | Python | mit | 433 |
# Copyright 2016 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... | tornadozou/tensorflow | tensorflow/python/ops/check_ops.py | Python | apache-2.0 | 35,158 |
from django.contrib.auth import (authenticate,
logout as auth_logout,
login as auth_login)
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.shortcuts import redirect, render_to_response
from django.cont... | mmcfarland/model-my-watershed | src/mmw/apps/user/views.py | Python | apache-2.0 | 7,827 |
# 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... | allenlavoie/tensorflow | tensorflow/contrib/autograph/pyct/static_analysis/activity.py | Python | apache-2.0 | 10,778 |
from dgs2.discogs_client.exceptions import HTTPError
from dgs2.discogs_client.utils import parse_timestamp, update_qs, omit_none
class SimpleFieldDescriptor(object):
"""
An attribute that determines its value using the object's fetch() method.
If transform is a callable, the value will be passed through ... | hzlf/openbroadcast | website/tools/dgs2/discogs_client/models.py | Python | gpl-3.0 | 21,790 |
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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 lat... | hnakamur/ansible | lib/ansible/plugins/action/script.py | Python | gpl-3.0 | 4,074 |
"""
Tri-Polar Grid Projected Plotting
=================================
This example demonstrates cell plots of data on the semi-structured ORCA2 model
grid.
First, the data is projected into the PlateCarree coordinate reference system.
Second four pcolormesh plots are created from this projected dataset,
using diff... | pp-mo/iris | docs/iris/example_code/General/orca_projection.py | Python | lgpl-3.0 | 1,647 |
#!/usr/bin/env python3
# Where to find explanation: https://www.geeksforgeeks.org/reverse-a-linked-list/
# Iterative approach:
# 1. Initialize three pointers prev as NULL, curr as head and next as NULL.
# 2. Iterate through the linked list. In loop, do following.
# 3. Before changing next of current, store next node
... | fedusia/python | leetcode/revers-linked-list.py | Python | apache-2.0 | 1,497 |
# This file is part of Firemix.
#
# Copyright 2013-2016 Jonathan Evans <jon@craftyjon.com>
#
# Firemix 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... | Openlights/firemix | plugins/dissolve.py | Python | gpl-3.0 | 1,064 |
"""Platform to retrieve uptime for Home Assistant."""
import voluptuous as vol
from homeassistant.components.sensor import DEVICE_CLASS_TIMESTAMP, PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME, CONF_UNIT_OF_MEASUREMENT
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity ... | tboyce1/home-assistant | homeassistant/components/uptime/sensor.py | Python | apache-2.0 | 1,659 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 by YOUR NAME HERE
#
# This file is part of RoboComp
#
# RoboComp 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... | robocomp/robocomp-ursus-rockin | components/trajtester/src/name.py | Python | gpl-3.0 | 4,582 |
from __future__ import absolute_import
from __future__ import unicode_literals
import sys
from distlib.wheel import ABI
from distlib.wheel import IMPVER
def is_py2_or_pypy():
return str is bytes or '__pypy__' in sys.builtin_module_names
def expected_wheel_name(fmt):
return fmt.format(IMPVER, 'none' if is_... | chriskuehl/pip-custom-platform | testing/util.py | Python | mit | 344 |
from superset import security, sm
from .base_tests import SupersetTestCase
def get_perm_tuples(role_name):
perm_set = set()
for perm in sm.find_role(role_name).permissions:
perm_set.add((perm.permission.name, perm.view_menu.name))
return perm_set
class RolePermissionTests(SupersetTestCase):
... | alanmcruickshank/superset-dev | tests/security_tests.py | Python | apache-2.0 | 7,916 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.