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 |
|---|---|---|---|---|---|
# Flexlay - A Generic 2D Game Editor
# Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option)... | Karkus476/flexlay | flexlay/tools/zoom2_tool.py | Python | gpl-3.0 | 1,815 |
#!/usr/bin/env python
# Copyright (C) 2006-2010, University of Maryland
#
# 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 us... | reflectometry/direfl | setup_py2exe.py | Python | mit | 12,830 |
#!/usr/bin/python
# This script parses contents of given 'Source' files, and creates rsync
# command line to synchronize mirror
import re
import sys
# Regex to parse
regex=re.compile("^(?P<param>[a-zA-Z0-9_-]+):\s?(?P<value>.*)$")
files_regex=re.compile("(?P<md5>[a-f0-9]{32}) [0-9]+ (?P<filename>.*)")
for pkg... | brain461/mirror-sync | util/parseSources.py | Python | gpl-2.0 | 1,263 |
"""Implementations of various matchers for pdbuddy
Matchers provide a convinience layer for filtering trace points. If a matcher
matches a call trace, that call will be processed. Otherwise it will be
ignored.
"""
from __future__ import absolute_import
from pdbuddy.matchers.base import BaseMatcher
from pdbuddy.match... | emou/pdbuddy | pdbuddy/matchers/__init__.py | Python | mit | 847 |
from django.test import TestCase
from curious.query import Parser
import humanize
class TestParserCore(TestCase):
def test_parsing_model_and_filter(self):
p = Parser('A(1)')
self.assertEquals(p.object_query, {'model': 'A', 'method': None,
'filters': [{'method': 'filte... | ginkgobioworks/curious | tests/curious_tests/test_parser.py | Python | mit | 8,133 |
# So that we can construct any QObject from a string.
from PySide.QtGui import *
from qtlayoutbuilder.api.layouterror import LayoutError
from qtlayoutbuilder.lib.qtclassnameprompter import QtClassNamePrompter
class QObjectMaker(object):
"""
Able to construct (or find) the QObjects cited by each line of the
... | peterhoward42/qt-layout-gen | src/qtlayoutbuilder/lib/qobjectmaker.py | Python | mit | 3,867 |
import os.path
#
# Build and add path facets from filename
#
class enhance_path(object):
def process(self, parameters=None, data=None):
if parameters is None:
parameters = {}
if data is None:
data = {}
docid = parameters['id']
filename_extension = os.path... | opensemanticsearch/open-semantic-etl | src/opensemanticetl/enhance_path.py | Python | gpl-3.0 | 2,155 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "learning_python.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure t... | aminhp93/learning_python | src/manage.py | Python | mit | 813 |
# encoding: utf-8
"""
The :mod:`ast` module contains the classes comprising the Python abstract syntax tree.
All attributes ending with ``loc`` contain instances of :class:`.source.Range`
or None. All attributes ending with ``_locs`` contain lists of instances of
:class:`.source.Range` or [].
The attribute ``loc``, ... | google/grumpy | third_party/pythonparser/ast.py | Python | apache-2.0 | 26,727 |
__author__ = 'paulo.rodenas'
from models.Cnpj import Cnpj
for idx in xrange(0, 100):
from_idx = idx * 1000000
to_idx = (idx + 1) * 1000000
file_name = 'cnpjs_base_' + str(from_idx).zfill(7) + '.txt'
print 'Generating from', from_idx, 'to', to_idx, file_name
f = open(file_name, 'w')
for cnp... | nfscan/fuzzy_cnpj_matcher | bulk/generate_cnpj_base_small.py | Python | mit | 644 |
#!/usr/bin/env python
# encoding: utf-8
class ApiException(Exception):
def __init__(self, api_response, previous=None):
self.__apiResponse = api_response
message = previous.message if previous and hasattr(previous, 'message') else 'Unknown error'
status = 0 # previous.status if previous ... | ringcentral/ringcentral-python | ringcentral/http/api_exception.py | Python | mit | 695 |
#
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#############################################
# WARNING #
#############################################
#
# This file is auto generated by ... | thaim/ansible | lib/ansible/module_utils/network/eos/argspec/lacp_interfaces/lacp_interfaces.py | Python | mit | 1,399 |
# 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 ... | Azure/azure-sdk-for-python | sdk/applicationinsights/azure-applicationinsights/azure/applicationinsights/models/events_page_view_info.py | Python | mit | 1,447 |
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^codeparser/', include('codeparser.urls')),
]
| CWelshE/dataquest | django_coderunner/urls.py | Python | mit | 148 |
"""Application settings."""
from os import environ as _env
DEBUG = _env.get('DEBUG', '').lower() == 'true'
SECRET_KEY = _env.get('SECRET_KEY', 'You need to define a secret key')
# Miscellaneous
GOOGLE_ANALYTICS_ACCOUNT = _env.get('GOOGLE_ANALYTICS_ACCOUNT')
GOOGLE_ANALYTICS_DOMAIN = _env.get('GOOGLE_ANALYTICS_DOMAIN... | dirn/Secret-Santa | xmas/settings.py | Python | bsd-3-clause | 1,256 |
# -*- coding: utf-8 -*-
"""Tests of Beautiful Soup as a whole."""
from pdb import set_trace
import logging
import unittest
import sys
import tempfile
from bs4 import (
BeautifulSoup,
BeautifulStoneSoup,
)
from bs4.builder import (
TreeBuilder,
ParserRejectedMarkup,
)
from bs4.element import (
Char... | mdworks2016/work_development | Python/05_FirstPython/Chapter9_WebApp/fppython_develop/lib/python3.7/site-packages/bs4/tests/test_soup.py | Python | apache-2.0 | 28,802 |
import logging
logging.basicConfig(level=logging.INFO,
format="[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
datefmt="%Y-%m-%d %H:%M:%S")
logger = logging.getLogger(__name__)
def is_positive_number(value):
try:
value = int(value)
return val... | willandskill/bacman | bacman/utils.py | Python | bsd-3-clause | 383 |
#!/usr/bin/env python
# coding: utf-8
import json
import os
import unittest
class TestGeohex(unittest.TestCase):
def setUp(self):
with open(os.path.join(os.path.dirname(__file__), 'hex_v3.2_test_code2HEX.json'), 'r') as f:
self.tests = json.load(f)
def test_consts(self):
from geo... | uncovertruth/py-geohex3 | test/geohex_test.py | Python | mit | 4,461 |
import unittest
from constants import *
from wow import *
from util import *
class BaseTest(unittest.TestCase):
def test_for_normal_query_split(self):
# Tests to ensure that the query gets split properly when the bot gets a message.
# Example query: '!armory pve/pvp <name> <realm> <region>'
... | remond-andre/discord-wow-armory-bot-modified | tests.py | Python | mit | 12,125 |
"""Python package version query tools."""
import logging
import json
import pathlib
from .version import Version
_LOG = logging.getLogger(__name__)
def query_metadata_json(path: pathlib.Path) -> Version:
"""Get version from metadata.json file."""
with path.open('r') as metadata_file:
metadata = jso... | mbdevpl/version-query | version_query/py_query.py | Python | apache-2.0 | 1,657 |
# encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
import warnings
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
import haystack
from haystack.backends import BaseEngine, BaseSearchBackend, Base... | celerityweb/django-haystack | haystack/backends/solr_backend.py | Python | bsd-3-clause | 33,372 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | stonebig/bokeh | bokeh/io/tests/test_notebook.py | Python | bsd-3-clause | 5,073 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutDecoratingWithFunctions(Koan):
def addcowbell(fn):
fn.wow_factor = 'COWBELL BABY!'
return fn
@addcowbell
def mediocre_song(self):
return "o/~ We all live in a broken submarine o/~"
def test_de... | Krakn/learning | src/python/python_koans/python2/about_decorating_with_functions.py | Python | isc | 832 |
from .cursor import Cursor
from collections import namedtuple
from itertools import zip_longest
class BasicSpan(object):
Range = namedtuple('Range', 'y line start_x end_x')
def __init__(self, start_curs): #, end_curs):
#assert isinstance(start_curs, Cursor)
#assert isinstance(end_curs, Cur... | sam-roth/Keypad | keypad/buffers/span.py | Python | gpl-3.0 | 7,061 |
# -*- coding: utf-8 -*-
import factory
from TWLight.resources.factories import PartnerFactory
from TWLight.users.factories import EditorFactory
from TWLight.applications.models import Application
class ApplicationFactory(factory.django.DjangoModelFactory):
class Meta:
model = Application
strate... | WikipediaLibrary/TWLight | TWLight/applications/factories.py | Python | mit | 446 |
class Solution(object):
def spiralOrder(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: List[int]
"""
if not matrix:
return []
left = 0
up = 0
right =len(matrix[0])
down = len(matrix)
direction = 0
res = []
... | darkpeach/AlgorithmCoding | _054_SpiralMatrix.py | Python | epl-1.0 | 1,157 |
from django.conf.urls import patterns, url, include
from .api import *
from rest_framework import routers
router = routers.DefaultRouter(trailing_slash=False)
router.register(r'indicators', IndicatorViewSet, base_name='indicator')
urlpatterns = patterns(
'',
url(r'^$', Base.as_view(), name="indicator-base"),
... | mmilaprat/policycompass-services | apps/indicatorservice/urls.py | Python | agpl-3.0 | 357 |
# oppia/preview/views.py
import codecs
import os
import re
from django.conf import settings
from django.shortcuts import render,render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from oppia.models import Course, Activ... | DigitalCampus/django-maf-oppia | oppia/preview/views.py | Python | gpl-3.0 | 3,111 |
# Copyright 2017 Arie Bregman
#
# 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 agree... | bregman-arie/rhoci | rhoci/common/exceptions.py | Python | apache-2.0 | 1,218 |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
from collections import OrderedDict
from calibre.ebooks.docx.block_styles im... | timpalpant/calibre | src/calibre/ebooks/docx/char_styles.py | Python | gpl-3.0 | 9,136 |
import numpy as np
import scipy.ndimage as nd
class Transformation(object):
"""
Transformation provides facilities to transform a frame of
reference by rotation, translation (shifting) and/or
magnification. If the frame is an image, the input is
interpolatated using a Spline function.
... | pyrrho314/recipesystem | trunk/gempy/library/transformation.py | Python | mpl-2.0 | 18,587 |
from iddt.dispatcher import Dispatcher
class MyDispatcher(Dispatcher):
def __init__(self):
super(MyDispatcher, self).__init__()
d = MyDispatcher()
d.dispatch({
'target_url': 'http://example.com',
'link_level': 0,
'allowed_domains': [],
})
| thequbit/iddt | iddt/dispatcher_example.py | Python | gpl-3.0 | 267 |
#!/usr/bin/python
"""
Script to verify errors on autotest code contributions (patches).
The workflow is as follows:
* Patch will be applied and eventual problems will be notified.
* If there are new files created, remember user to add them to VCS.
* If any added file looks like a executable file, remember user to m... | ColinIanKing/autotest | utils/check_patch.py | Python | gpl-2.0 | 24,686 |
"""
Standard interface for connecting client protocols to the operation extensions.
"""
from cStringIO import StringIO
import lxml.etree, lxml.builder
from zope import interface
from delta import DeltaObserverPool as dop
import opdev, delta
from pyofwave.utils.command import CommandInterface
from .action import ACT... | pyofwave/PyOfWave | pyofwave_server/pyofwave/core/operation.py | Python | mpl-2.0 | 4,886 |
# for constants which need to be accessed by various parts of Sentinel
# skip proposals on superblock creation if the SB isn't within the fudge window
SUPERBLOCK_FUDGE_WINDOW = 60 * 60 * 2
| dashpay/sentinel | lib/constants.py | Python | mit | 190 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings.SITE_ID... | tuticfruti/tuticfruti_blog | tuticfruti_blog/contrib/sites/migrations/0002_set_site_domain_and_name.py | Python | bsd-3-clause | 955 |
from django import forms
from django.forms.models import modelformset_factory
#https://docs.djangoproject.com/en/dev/topics/forms/modelforms/
from datetime import date
#from olwidget.forms import MapModelForm
from whyqd.wiqi.models import Wiqi, Text #, Image #, Book#, Geomap
class WiqiStackRevertForm(forms.Form):
... | turukawa/whyqd | whyqd/wiqi/forms.py | Python | agpl-3.0 | 2,599 |
"""Scraper for Fifth Circuit of Appeals
CourtID: ca5
Court Short Name: ca5
Reviewer: mlr
History:
- 2014-07-19: Created by Andrei Chelaru
- 2014-11-08: Updated for new site by mlr.
"""
from datetime import datetime
from juriscraper.OralArgumentSite import OralArgumentSite
class Site(OralArgumentSite):
def __i... | Andr3iC/juriscraper | oral_args/united_states/federal_appellate/ca5.py | Python | bsd-2-clause | 1,102 |
# coding: utf8
from __future__ import unicode_literals
from ..char_classes import LIST_ELLIPSES, LIST_ICONS
from ..char_classes import QUOTES, ALPHA, ALPHA_LOWER, ALPHA_UPPER
_quotes = QUOTES.replace("'", '')
_infixes = (LIST_ELLIPSES + LIST_ICONS +
[r'(?<=[{}])\.(?=[{}])'.format(ALPHA_LOWER, ALPHA_UPPE... | aikramer2/spaCy | spacy/lang/de/punctuation.py | Python | mit | 701 |
#!/usr/bin/env python
# coding=utf-8
import pprint
import csv
import click
import requests
import datetime as datetime
from datetime import date
from xml.etree import ElementTree as ET
import os
# from random import sample
import random
import json
# import logging
import subprocess
import glob
impor... | Fatman13/gta_swarm | ctripmultiplus.py | Python | mit | 1,017 |
"""Tests for the teams module."""
import functools
import json
from auvsi_suas.models import AerialPosition
from auvsi_suas.models import GpsPosition
from auvsi_suas.models import MissionClockEvent
from auvsi_suas.models import TakeoffOrLandingEvent
from auvsi_suas.models import UasTelemetry
from django.contrib.auth.m... | justineaster/interop | server/auvsi_suas/views/teams_test.py | Python | apache-2.0 | 11,961 |
"""Singleton class decorator"""
def singleton(cls):
"""
Singleton class decorator
>>> from chula.singleton import singleton
>>>
>>> @singleton
... class MyClass(object):
... pass
...
>>> a = MyClass()
>>> b = MyClass()
>>> c = MyClass()
>>>
>>> a is b
True
... | jmcfarlane/chula | chula/singleton.py | Python | gpl-2.0 | 547 |
# -*- coding: utf-8 -*-
"""This module defines functions generally useful in scikit-ci."""
import os
from .constants import SERVICES, SERVICES_ENV_VAR
def current_service():
for service, env_var in SERVICES_ENV_VAR.items():
if os.environ.get(env_var, 'false').lower() == 'true':
return servi... | scikit-build/scikit-ci | ci/utils.py | Python | apache-2.0 | 1,327 |
#
# $LicenseInfo:firstyear=2010&license=mit$
#
# Copyright (c) 2010, Linden Research, Inc.
#
# 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 ... | lexelby/apiary | apiary/base.py | Python | mit | 19,231 |
"""
Django settings for nostril project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | bbiskup/nostril | nostril/settings.py | Python | mit | 2,075 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="color", parent_name="scattermapbox.hoverlabel.font", **kwargs
):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent... | plotly/python-api | packages/python/plotly/plotly/validators/scattermapbox/hoverlabel/font/_color.py | Python | mit | 522 |
def knapsack():
knapsack = [1]
tmp = 0
for i in range(100):
for j in range(i):
tmp += knapsack[j]
tmp +=5
knapsack.append(tmp)
return knapsack
def ciphergen():
f = open("a.txt","r")
ptxt = f.read()
ctxt = 0
supsack = knapsack()
for i in range(len... | L34p/HeXA-CTF-2015 | challenges/Crypto/Crypto_300/knapsack.py | Python | mit | 504 |
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.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, either version 3 of the License,... | bram85/topydo | test/test_tag_command.py | Python | gpl-3.0 | 11,537 |
"""Support for Hydrawise cloud switches."""
import logging
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import CONF_MONITORED_CONDITIONS
import homeassistant.helpers.config_validation as cv
from . import (
ALLOWED_WATERING_TIME,
C... | nkgilley/home-assistant | homeassistant/components/hydrawise/switch.py | Python | apache-2.0 | 3,053 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | NoctuaNivalis/qutebrowser | tests/end2end/test_invocations.py | Python | gpl-3.0 | 13,799 |
# Copyright 2021 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | google/pigweed | pw_status/py/setup.py | Python | apache-2.0 | 690 |
"""Intesishome platform."""
| jawilson/home-assistant | homeassistant/components/intesishome/__init__.py | Python | apache-2.0 | 28 |
import json
import os
import praw
import requests
dirName = os.path.dirname(os.path.abspath(__file__))
fileName = os.path.join(dirName, '../config.json')
config = {}
with open(fileName) as f:
config = json.loads(f.read())
subredditName = config['reddit']['subreddit']
redditAuth = config['reddit']['auth']
port = ... | hswhite33/picturegame-api | scripts/edit-leaderboard.py | Python | mit | 1,312 |
from typing import List
class Solution:
def transformArray2(self, arr: List[int]) -> List[int]:
while True:
arr2 = [a for a in arr]
changed = 0
for id in range(1, len(arr) - 1):
l = arr[id - 1]
r = arr[id + 1]
m = arr[id]
... | lmmsoft/LeetCode | LeetCode-Algorithm/1243. Array Transformation/1243.py | Python | gpl-2.0 | 992 |
#!/usr/bin/python
# coding=utf-8
################################################################################
from test import unittest
from diamond.metric import Metric
class TestMetric(unittest.TestCase):
def testgetPathPrefix(self):
metric = Metric('servers.com.example.www.cpu.total.idle',
... | Ormod/Diamond | src/diamond/test/testmetric.py | Python | mit | 3,866 |
from tests.local.base import StatsTest
class GaugeTestCase(StatsTest):
def test_gauge_works(self):
fugly_hack = {'i': 0}
def _gauge_value():
fugly_hack['i'] += 1
return fugly_hack['i']
self.registry.gauge('GaugeTestCase.test_gauge_works', _gauge_value)
st... | emilssolmanis/tapes | tests/local/test_gauge.py | Python | apache-2.0 | 521 |
from rest_framework import serializers
from mkt.constants.payments import PROVIDER_LOOKUP_INVERTED
from mkt.prices.models import Price, price_locale
class PriceSerializer(serializers.ModelSerializer):
prices = serializers.SerializerMethodField()
localized = serializers.SerializerMethodField('get_localized_pr... | washort/zamboni | mkt/prices/serializers.py | Python | bsd-3-clause | 1,136 |
import arcas
import pandas
def test_setup():
api = arcas.Springer()
assert api.standard == 'http://api.springer.com/metadata/pam?q='
def test_keys():
api = arcas.Springer()
assert api.keys() == ['url', 'key', 'unique_key', 'title', 'author', 'abstract',
'doi', 'date', 'journa... | ArcasProject/Arcas | tests/test_springer.py | Python | mit | 3,670 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.enums import HTTP_HEADER
from lib.core.settings import WAF_ATTACK_VECTORS
__product__ = "NSFOCUS Web Application Firewall (NSFOCUS)"
def detect(get_... | hackersql/sq1map | waf/nsfocus.py | Python | gpl-3.0 | 580 |
# vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# 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 require... | grehx/spark-tk | regression-tests/sparktkregtests/lib/sparktk_test.py | Python | apache-2.0 | 3,650 |
#!/usr/bin/env python
# Copyright 2012 The Swarming 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 cStringIO
import hashlib
import json
import logging
import optparse
import os
import shutil
import subprocess
imp... | baslr/ArangoDB | 3rdParty/V8/V8-5.0.71.39/tools/swarming_client/tests/isolate_test.py | Python | apache-2.0 | 54,047 |
import os
import sys
from distutils.sysconfig import get_python_lib
from setuptools import find_packages, setup
CURRENT_PYTHON = sys.version_info[:2]
REQUIRED_PYTHON = (3, 6)
# This check and everything above must remain compatible with Python 2.7.
if CURRENT_PYTHON < REQUIRED_PYTHON:
sys.stderr.write("""
======... | fenginx/django | setup.py | Python | bsd-3-clause | 4,689 |
"""
-----------------------------------------------------------------------
dyneye
Copyright (C) Floris van Breugel, 2013.
florisvb@gmail.com
Released under the GNU GPL license, Version 3
This file is part of dyneye.
dyneye is free software: you can redistribute it and/or modify it
under the terms of the GNU Gene... | florisvb/dyneye | Theory/LieMath/dyneye_lie_observability.py | Python | gpl-3.0 | 2,035 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
from os import path as p
import subprocess
try:
from setuptools import setup, find_packages, Command
except ImportError:
from distutils.core import setup, find_packages, Command
def read(filename, parent=None):
parent = (parent or __file... | volker-kempert/python-tools | setup.py | Python | mit | 2,944 |
import _plotly_utils.basevalidators
class XsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="xsrc", parent_name="histogram", **kwargs):
super(XsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_typ... | plotly/python-api | packages/python/plotly/plotly/validators/histogram/_xsrc.py | Python | mit | 431 |
from catalog import Catalog
from category import Category | scruwys/wino | wino/__init__.py | Python | mit | 57 |
# -*- coding: utf-8 -*-
"""Fundamental models for rpi2caster, not depending on database.
Classes-only module. All constants come from definitions."""
import json
from collections import namedtuple, OrderedDict
from pkg_resources import resource_string as rs
# some named tuples for easier attribute addressing
WedgeLim... | elegantandrogyne/rpi2caster | rpi2caster/models.py | Python | gpl-2.0 | 10,884 |
#!/usr/bin/python2.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
#
# $Id$
#
# Copyright (C) 1999-2006 Keith Dart <keith@kdart.com>
#
# 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... | xiangke/pycopia | experimental/pycopia/_unittest/test_ipv4.py | Python | lgpl-2.1 | 3,102 |
import frappe
def execute():
updated_list = []
for je in frappe.db.sql_list("""select name from `tabJournal Entry` where voucher_type='Credit Note' and docstatus < 2"""):
je = frappe.get_doc("Journal Entry", je)
original = je.total_amount
je.set_print_format_fields()
if je.total_amount != original:
upd... | ShashaQin/erpnext | erpnext/patches/v6_27/fix_total_amount_in_jv_for_credit_note.py | Python | agpl-3.0 | 545 |
def f(x):
import math
return 10*math.e**(math.log(0.5)/5.27 * x)
def radiationExposure(start, stop, step):
'''
Computes and returns the amount of radiation exposed
to between the start and stop times. Calls the
function f (defined for you in the grading script)
to obtain the value of the f... | emyarod/OSS | 1_intro/6.00.1x/Week 3/Problem Set 3/radiationExposure.py | Python | mit | 935 |
import os
from django.utils.translation import ugettext_lazy as _
from openstack_dashboard import exceptions
{%- from "horizon/map.jinja" import server with context %}
{%- set app = salt['pillar.get']('horizon:server:app:'+app_name) %}
HORIZON_CONFIG = {
'dashboards': ({% if app.plugin is defined %}{% for plugin_... | Martin819/salt-formula-horizon | horizon/files/local_settings/robotice_settings.py | Python | apache-2.0 | 1,748 |
from yowsup.structs import ProtocolTreeNode
from .notification_contact import ContactNotificationProtocolEntity
class AddContactNotificationProtocolEntity(ContactNotificationProtocolEntity):
'''
<notification offline="0" id="{{NOTIFICATION_ID}}" notify="{{NOTIFY_NAME}}" type="contacts"
t="{{TIMESTA... | colonyhq/yowsup | yowsup/layers/protocol_contacts/protocolentities/notification_contact_add.py | Python | gpl-3.0 | 1,271 |
#!/usr/bin/env python
##################################################################
# Copyright (c) 2012, Sergej Srepfler <sergej.srepfler@gmail.com>
# February 2012 - March 2014
# Version 0.2.9, Last change on Mar 06, 2014
# This software is distributed under the terms of BSD license.
########################... | dgudtsov/hsstools | pyprotosim/example/radius_acct_start_client.py | Python | gpl-3.0 | 3,972 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 12, transform = "None", sigma = 0.0, exog_count = 100, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_None/trend_ConstantTrend/cycle_12/ar_12/test_artificial_32_None_ConstantTrend_12_12_100.py | Python | bsd-3-clause | 265 |
import pytest
import sqlalchemy as sa
from sqlalchemy_continuum import version_class
from tests import TestCase, uses_native_versioning, create_test_cases
class JoinTableInheritanceTestCase(TestCase):
def create_models(self):
class TextItem(self.Model):
__tablename__ = 'text_item'
... | kvesteri/sqlalchemy-continuum | tests/inheritance/test_join_table_inheritance.py | Python | bsd-3-clause | 7,059 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Refrescador automatico de clines
#Creado por Dagger - https://github.com/gavazquez
import ReloadCam_Main, ReloadCam_Helper
def GetVersion():
return 2
#Filename must start with Server, classname and argument must be the same!
class Satna(ReloadCam_Main.Server):
... | DaggerES/ReloadCam | DELETED_ReloadCam_Server_Satna.py | Python | gpl-3.0 | 1,429 |
"""
sentry.runner.commands.queues
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2016 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import click
from sentry.runner.decorators import configuration
@click.group(... | looker/sentry | src/sentry/runner/commands/queues.py | Python | bsd-3-clause | 1,980 |
from abstract import AbstractBucke
class AmazonBucket(AbstractBucket):
"""
TODO: this class will implement a bucket for amazon cloud storage
"""
def delete_object(self, path):
raise NotImplemented
def list_current_dir(self):
raise NotImplemented | Sybrand/digital-panda | digitalpanda/bucket/amazon.py | Python | mit | 269 |
#!/usr/bin/python
#
# Note: This implementation is being phased out, you should instead look at
# the DynamoDB2_* examples for the new implementation.
#
from troposphere import Template, Ref, Output, Parameter
from troposphere.dynamodb import (Key, AttributeDefinition,
Provision... | Yipit/troposphere | examples/DynamoDB_Table_With_GlobalSecondaryIndex.py | Python | bsd-2-clause | 4,388 |
# coding: utf-8
"""
DLRN API
DLRN API client
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
class Params(object):
"""NOTE: This class is auto generated by the swagger code generator program... | javierpena/dlrnapi_client | dlrnapi_client/models/params.py | Python | apache-2.0 | 7,405 |
import pytest
from anchore_engine.db import Image, get_thread_scoped_session
from anchore_engine.services.policy_engine.engine.policy.gates.gems import (
BadVersionTrigger,
BlacklistedGemTrigger,
GemCheckGate,
NoFeedTrigger,
NotLatestTrigger,
NotOfficialTrigger,
)
from anchore_engine.subsys imp... | anchore/anchore-engine | tests/integration/services/policy_engine/engine/policy/gates/test_gems.py | Python | apache-2.0 | 4,814 |
"""Token object and related objects needed by the RETE algorithm."""
from collections import namedtuple
from collections.abc import Mapping
from enum import Enum
from pyknow.fact import Fact
class TokenInfo(namedtuple('_TokenInfo', ['data', 'context'])):
"""Tag agnostig version of Token with inmutable data."""
... | buguroo/pyknow | pyknow/matchers/rete/token.py | Python | lgpl-3.0 | 3,078 |
#!/usr/bin/env python
#coding: utf-8
#Filename: pickling.py
import cPickle as p
shoplist = ['apple', 'mango', 'banana']
txt = 'shoplist.txt'
f = file(txt, 'w')
p.dump(shoplist, f)
f.close()
del shoplist
f = file(txt)
storedlist = p.load(f)
print storedlist | daya-prac/Python-prac | python/pickling.py | Python | gpl-2.0 | 259 |
# Copyright 2011 David Malcolm <dmalcolm@redhat.com>
# Copyright 2011 Red Hat, Inc.
#
# This 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) a... | jasonxmueller/gcc-python-plugin | maketreetypes.py | Python | gpl-3.0 | 4,002 |
from django import template
from django.urls import reverse
from django.apps import apps as django_apps
from django.urls.exceptions import NoReverseMatch
register = template.Library()
class ContinuationAppointmentUrlError(Exception):
pass
class ContinuationAppointmentAnchor(template.Node):
"""Returns a rev... | botswana-harvard/edc-appointment | edc_appointment/templatetags/appointment_tags.py | Python | gpl-2.0 | 3,699 |
# -*- coding: utf-8 -*-
import unittest, cleancss
from textwrap import dedent
from StringIO import StringIO
class TestConvert(unittest.TestCase):
def test_01_convert(self):
ccss = StringIO()
ccss.write(dedent('''
// Comment
#header, #footer:
margin: 0
... | mtorromeo/py-cleancss | tests/__init__.py | Python | bsd-2-clause | 5,236 |
def main():
words = str(input("Enter a English word: ")).split()
for word in words:
print(word[1:] + word[0] + "ay", end = " ")
print ()
main() | cynthiacarter/Week-Four-Assignment | idk.py | Python | mit | 164 |
# 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... | sleepsonthefloor/openstack-dashboard | django-nova/src/django_nova/tests/view_tests/instance_tests.py | Python | apache-2.0 | 2,367 |
##############################################################################
# Copyright (c) 2013-2018, 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... | EmreAtes/spack | var/spack/repos/builtin/packages/perl-try-tiny/package.py | Python | lgpl-2.1 | 1,571 |
#!/usr/bin/env python
#
# Copyright 2005,2007,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at you... | owaiskhan/Retransmission-Combining | gr-uhd/examples/usrp_nbfm_ptt.py | Python | gpl-3.0 | 17,742 |
import django.views.generic as base_generic
from core.mixins import LoginPermissionRequiredMixin, update_permissions
from core.views import generic
from django.core.urlresolvers import reverse
from jsonattrs.mixins import JsonAttrsMixin, template_xlang_labels
from organization.views import mixins as organization_mixins... | Cadasta/cadasta-platform | cadasta/spatial/views/default.py | Python | agpl-3.0 | 8,398 |
# The contents of this file are subject to the BitTorrent Open Source License
# Version 1.1 (the License). You may not copy or use this file, in either
# source code or executable form, except in compliance with the License. You
# may obtain a copy of the License at http://www.bittorrent.com/license/.
#
# Software di... | sparkslabs/kamaelia_ | Sketches/RJL/bittorrent/BitTorrent/BitTorrent/RawServer.py | Python | apache-2.0 | 19,367 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-datafactory/azure/mgmt/datafactory/models/spark_source.py | Python | mit | 2,072 |
"""525. Contiguous Array
https://leetcode.com/problems/contiguous-array/
Given a binary array nums, return the maximum length of a contiguous subarray
with an equal number of 0 and 1.
Example 1:
Input: nums = [0,1]
Output: 2
Explanation: [0, 1] is the longest contiguous subarray with an equal number
of 0 and 1.
Exa... | isudox/leetcode-solution | python-algorithm/leetcode/problem_525.py | Python | mit | 971 |
# coding=utf-8
# Copyright 2022 TF.Text Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | tensorflow/text | tensorflow_text/core/pybinds/pywrap_fast_wordpiece_tokenizer_model_builder_test.py | Python | apache-2.0 | 2,309 |
# -*- coding: utf-8 -*-
from . import mrp_production
from . import procurement_order
from . import sale_order
| kittiu/sale-workflow | sale_mrp_link/models/__init__.py | Python | agpl-3.0 | 111 |
# 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... | ghchinoy/tensorflow | tensorflow/python/keras/utils/__init__.py | Python | apache-2.0 | 2,463 |
"""
A script to automate installation of tool repositories from a Galaxy Tool Shed
into an instance of Galaxy.
Galaxy instance details and the installed tools can be provided in one of three
ways:
1. In the YAML format via dedicated files (see ``tool_list.yaml.sample`` for a
sample of such a file)
2. On the command... | C3BI-pasteur-fr/Galaxy-playbook | galaxy-pasteur/roles/galaxy_tools/files/install_tool_shed_tools.py | Python | gpl-2.0 | 28,649 |
"""Tests for distutils.command.bdist_rpm."""
import unittest
import sys
import os
import tempfile
import shutil
from test.support import run_unittest
from distutils.core import Distribution
from distutils.command.bdist_rpm import bdist_rpm
from distutils.tests import support
from distutils.spawn import fi... | Orav/kbengine | kbe/src/lib/python/Lib/distutils/tests/test_bdist_rpm.py | Python | lgpl-3.0 | 5,002 |
"""
>>> basketball_team = ['Sue', 'Tina', 'Maya', 'Diana', 'Pat']
>>> bus = TwilightBus(basketball_team)
>>> bus.drop('Tina')
>>> bus.drop('Pat')
>>> basketball_team
['Sue', 'Maya', 'Diana']
"""
# BEGIN TWILIGHT_BUS_CLASS
class TwilightBus:
"""A bus model that makes passengers vanish"""
def __init__(self, pas... | Wallace-dyfq/example-code | 08-obj-ref/twilight_bus.py | Python | mit | 628 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.