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 |
|---|---|---|---|---|---|
b"aaað"
b"24sd" | IllusionRom-deprecated/android_platform_tools_idea | python/testData/inspections/PyByteLiteralInspection/src/test.py | Python | apache-2.0 | 15 |
#!/usr/bin/env python3
"""Document models for mongoengine"""
from mongoengine import Document, ListField, StringField
class ICS(Document):
"""
Model for links to ics feeds
These links are accessed by the celery worker to refresh the calendar from the ics feeds
Should be kept in sync with the resource ... | olinlibrary/ABE | abe/document_models/ics_documents.py | Python | agpl-3.0 | 721 |
# -*- coding: utf-8 -*-
#
# higix Core API documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 10 16:25:29 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file... | tumluliu/higix-rest-api | docs/conf.py | Python | mit | 10,534 |
# 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 t... | alexpilotti/python-keystoneclient | keystoneclient/auth/cli.py | Python | apache-2.0 | 3,126 |
# -*- coding: utf-8 -*-
"""
Platform independent terminal interface module.
It imports the appropriate operating system specific implementation.
"""
#
# (C) Pywikibot team, 2003-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
import sys
if sys.platf... | Wesalius/EloBot | pywikibot/userinterfaces/terminal_interface.py | Python | gpl-3.0 | 519 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-29 14:12
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('gestion_cartera', '0004_auto_20160717_1737'),
]
operations = [
migrations.AlterModel... | exildev/Piscix | gestion_cartera/migrations/0005_auto_20160829_1412.py | Python | mit | 488 |
# Copyright (c) 2013 OpenStack Foundation
# 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 ... | virtualopensystems/neutron | neutron/plugins/ml2/rpc.py | Python | apache-2.0 | 11,139 |
import logging
import os
class GerritsshException(Exception):
'''
Base class for each of the package's exceptions.
'''
pass
def _getversion():
import json
with open(os.path.join(os.path.dirname(__file__), 'METADATA'), 'rt') as f:
pkg_metadata = json.load(f)
return pkg_metadat... | kdopen/gerritssh | gerritssh/__init__.py | Python | apache-2.0 | 1,554 |
from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType, ContentTypeManager
from django.contrib.contenttypes.views import shortcut
from django.contrib.sites.shortcuts import get_current_site
from django.db.utils import IntegrityError, OperationalError, ProgrammingError
from d... | filias/django | tests/contenttypes_tests/test_models.py | Python | bsd-3-clause | 11,243 |
import numpy as np
import collections
from textwrap import dedent
__all__ = ['OLDGLSL', 'RefVar', 'Visual', 'CompoundVisual']
# HACK: if True, activate the OpenGL ES syntax, which is deprecated in the
# desktop version. However with the appropriate #version command in the shader
# most drivers should accept this synt... | rossant/galry | galry/visuals/visual.py | Python | bsd-3-clause | 30,868 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012-2019 Budget Insight
#
# This file is part of a weboob module.
#
# This weboob module 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... | laurentb/weboob | modules/aviva/browser.py | Python | lgpl-3.0 | 6,128 |
# ----------------------------------------------------------------------------
# Copyright 2014 Nervana Systems Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | nhynes/neon | neon/util/persist.py | Python | apache-2.0 | 6,793 |
# Django Imports
from django.db.models.signals import post_save
from django.dispatch import receiver
# Python Imports
import datetime
from logging import getLogger
# Local Imports
from ava_core.evaluate.models import EvaluateController, EvaluateTest
from ava_core.evaluate.tasks import task_ava_evaluate_controller_run, ... | alzeih/ava | ava_core/evaluate/signals.py | Python | gpl-3.0 | 1,834 |
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from config import basedir
from werkzeug.contrib.fixers import ProxyFix
app = Flask(__name__)
app.wsgi_app = ProxyFix(app.wsgi_app)
app.config.from_object('config')
db = SQLAlchemy(app)
lm = LoginManager()
lm... | te11ur/twitter_watcher | app/__init__.py | Python | mit | 399 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-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... | laurentb/weboob | weboob/tools/value.py | Python | lgpl-3.0 | 9,930 |
"""utilities for fetching build dependencies."""
#-----------------------------------------------------------------------------
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
#
# This bundling code is largely adapted from pyzmq-static's get.sh by
# Brandon Craig-Rhodes,... | tempbottle/pycapnp | buildutils/bundle.py | Python | bsd-2-clause | 5,759 |
#!/usr/bin/python
# this module return full taxonomy lineage. Cannot handle multiple genbank info in one file. should be one genbank id in each file
import urllib
import cStringIO
import pycurl
def get_taxonomy(locus,taxon):
#flist = [locus,taxon]
flist = []
buf = cStringIO.StringIO()
c = pycurl.Curl()... | germs-lab/RefSoil | compare_refseq/taxonomy_finder.py | Python | gpl-2.0 | 3,607 |
#! /usr/bin/env python3
def init(loop, opts):
pass
def enqueue(records):
for rec in records:
print(str(rec))
| lablup/logger | logger/outputs/stdout.py | Python | apache-2.0 | 127 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "synmorf.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure ... | mrxkollo/Suvepraktika-2017 | manage.py | Python | mit | 827 |
#!/usr/bin/env python
from __future__ import with_statement
import os
import sys
import errno
from fuse import FUSE, FuseOSError, Operations
class Passthrough(Operations):
def __init__(self, root):
self.root = root
# Helpers
# =======
def _full_path(self, partial):
if partial.star... | tcpaiva/labelfs | src/archive/sk.py | Python | gpl-3.0 | 3,982 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp.tests.common import TransactionCase
class T... | kittiu/sale-workflow | partner_prospect/tests/test_partner_prospect.py | Python | agpl-3.0 | 2,677 |
import logging
import datetime
import os
import shlex
import click
import blessings
from pyvodb.load import get_db
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
def main():
return cli(obj={})
class AliasedGroup(click.Group):
"""Allow short aliases of commands"""
# http://click.pocoo.or... | pyvec/pyvodb | pyvodb/cli/top.py | Python | mit | 2,870 |
<<<<<<< HEAD
<<<<<<< HEAD
from test.test_json import PyTest, CTest
class JSONTestObject:
pass
class TestRecursion:
def test_listrecursion(self):
x = []
x.append(x)
try:
self.dumps(x)
except ValueError:
pass
else:
self.fail("didn't r... | ArcherSys/ArcherSys | Lib/test/test_json/test_recursion.py | Python | mit | 9,158 |
'''
@author: Frank
'''
import os.path
import zstacklib.utils.xmlobject as xmlobject
import zstacklib.utils.linux as linux
import zstacklib.utils.shell as shell
import zstacklib.utils.log as log
import zstacklib.utils.lock as lock
import zstacklib.utils.ssh as ssh
import zstacklib.utils.http as http
import ... | zstackio/zstack-woodpecker | zstackwoodpecker/zstackwoodpecker/setup_actions.py | Python | apache-2.0 | 46,769 |
from template_tests.test_response import test_processor_name
from django.template import RequestContext
from django.template.backends.django import DjangoTemplates
from django.template.library import InvalidTemplateLibrary
from django.test import RequestFactory, ignore_warnings, override_settings
from django.utils.dep... | gannetson/django | tests/template_backends/test_django.py | Python | bsd-3-clause | 4,791 |
from collections import namedtuple, defaultdict
MagnetParam = namedtuple('MagnetParam', ['key', 'value'])
class MagnetUriError(Exception):
pass
def is_valid_magnet_uri(uri):
return uri.startswith('magnet:?')
def magnet_uri_split(uri):
if not is_valid_magnet_uri(uri):
raise MagnetUriError("Not a... | bsandrow/bttools | bttools/magnet.py | Python | mit | 2,606 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
import sys
PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
if PY3:
import urllib.parse as urlparse # Es muy lento en PY2. En PY3 es nativo
else:
impor... | alfa-addon/addon | plugin.video.alfa/channels/youjizz.py | Python | gpl-3.0 | 4,871 |
import nesoni
from nesoni import config, runr
@config.help(
'(Deprecated) Create a file of proportions of poly-A reads.'
)
@config.String_flag('norm_file', 'Normalization file.')
@config.Positional('all', 'Output from "nesoni count:" using all reads.')
@config.Positional('polya', 'Output from "nesoni count:" using on... | Victorian-Bioinformatics-Consortium/tail-tools | tail_tools/proportions.py | Python | gpl-2.0 | 7,922 |
"""
Tests for schedules signals
"""
import datetime
from unittest.mock import patch
import ddt
import pytest
from pytz import utc
from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
from lms.djangoapps.courseware.models import Dyn... | eduNEXT/edunext-platform | openedx/core/djangoapps/schedules/tests/test_signals.py | Python | agpl-3.0 | 9,649 |
import abc
from functools import reduce
import hearthbreaker.constants
from hearthbreaker.constants import CARD_RARITY, MINION_TYPE
from hearthbreaker.game_objects import Bindable, GameObject, GameException, Hero
def _battlecry_targetable(target):
return target.player is target.player.game.current_player or not t... | bingshuika/hearthbreaker-new | hearthbreaker/cards/base.py | Python | mit | 26,680 |
import unittest
try:
import simplejson as json
except ImportError:
import json
from uuid import uuid4
from alerta.app import app, db
class PluginsTestCase(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
app.config['AUTH_REQUIRED'] = False
app.config['PLUGINS... | skob/alerta | tests/test_plugins.py | Python | apache-2.0 | 2,083 |
# Copyright 2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Job for merging translations."""
__metaclass__ = type
__all__ = [
'POFileStatsJob',
]
import logging
from storm.locals import (
And,
Int,
Reference,
... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/translations/model/pofilestatsjob.py | Python | agpl-3.0 | 3,952 |
#!/usr/bin/env python
"""
rss_collector is part of the miner project
(c) Mark Menkhus, 2015
Licensed under the apache license, see LICENSE.md
"""
import sys
import collector_database
class rss_collector:
""" rss_collector: contains the methods to use rss and isolates
from the implementatio... | menkhus/miner | miner/rss_collector.py | Python | apache-2.0 | 2,029 |
# -*- coding: utf-8 -*-
import os
import cherrypy
from urllib import urlencode
from httplib2 import Http
from Cheetah.Template import Template
current_dir = os.path.dirname(os.path.abspath(__file__))
class Root(object):
@cherrypy.expose
def index(self):
path = os.path.join(current_dir, "template", "index.h... | gmunoz1979/js-sharepoint.com-oauth2 | demo/server.py | Python | mit | 1,604 |
import logging
from django.utils.translation import ugettext_lazy as _
from django.db.models import F, TextChoices
from orgs.mixins.models import OrgModelMixin
from common.db import models
from common.utils import lazyproperty
from assets.models import Asset, SystemUser, Node, FamilyMixin
from .base import BasePermi... | jumpserver/jumpserver | apps/perms/models/asset_permission.py | Python | gpl-3.0 | 6,271 |
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
class FakturPajakMasukan(models.Model):
_name = "l10n_id.faktur_pajak_masukan"
_description = "Faktur Pajak Masukan"
_inherit ... | open-synergy/opnsynid-l10n-indonesia | l10n_id_taxform_faktur_pajak_masukan/models/faktur_pajak_masukan.py | Python | agpl-3.0 | 1,599 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ImportFile.import_tag'
db.add_column('importer_importfile', 'import_tag',
... | hzlf/openbroadcast | website/apps/importer/migrations/0012_auto__add_field_importfile_import_tag.py | Python | gpl-3.0 | 8,423 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
compat_urllib_request,
)
from ..utils import (
ExtractorError,
)
class UdemyIE(InfoExtractor):
IE_NAME = 'udemy'
_VALID_URL = r'https?://www\.udemy\.com/(?:[^#]+#/lectu... | utamaro/youtube-dl | youtube_dl/extractor/udemy.py | Python | unlicense | 7,277 |
# 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 __future__ import absolute_import
import os
import sys
import unittest
import kinow_client
from kinow_client.rest import A... | kinow-io/kinow-python-sdk | test/test_feature_values_api.py | Python | apache-2.0 | 1,520 |
"""Test Python for System Administrator Prerequisites
usage: nosetests -v test_prerequisites.py
expected output:
test_prerequisites.test_imports('nose',) ... ok
test_prerequisites.test_imports('psutil',) ... ok
test_prerequisites.test_imports('scipy',) ... ok
test_prerequisites.test_imports('matplotlib',) ... ... | ioggstream/python-course | python-for-sysadmin/test_prerequisites.py | Python | agpl-3.0 | 1,382 |
paths_wordpress = {'wp-login.php':
['index.php','license.txt','readme.html',
'wp-activate.php', 'wp-app.php',
'wp-blog-header.php', 'wp-comments-post.php',
'wp-config-sample.php', 'wp-cron.php',
'wp-links-opml.php', 'wp-load.php',
'wp-mail.php',
'wp-pass.php', 'wp-register.php',
'wp-settings.php', 'wp-signup.ph... | JordiGoPython/Python-Hack-Example | TransversalDirectory.py | Python | gpl-2.0 | 1,799 |
#!/usr/bin/env python
"""
$push is similar to $addToSet. The difference is that rather than accumulating only unique values
it aggregates all values into an array.
Using an aggregation query, count the number of tweets for each user. In the same $group stage,
use $push to accumulate all the tweet texts for each user... | dvu4/Data-Wrangling-with-MongoDB | Lesson_5_Analyzing_Data/14-Using_push/push.py | Python | agpl-3.0 | 2,726 |
#
# Copyright 2013-2015 University of Southern California
#
# 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... | ini-bdds/ermrest | ermrest/ermpath/__init__.py | Python | apache-2.0 | 788 |
"""Defines the unit tests for the :mod:`colour.io.ocio` module."""
from __future__ import annotations
import numpy as np
import os
import unittest
from colour.io import process_image_OpenColorIO
from colour.utilities import full, is_opencolorio_installed
__author__ = "Colour Developers"
__copyright__ = "Copyright 2... | colour-science/colour | colour/io/tests/test_ocio.py | Python | bsd-3-clause | 3,439 |
"""
Transition Pathway Plot
=======================
"""
from msmbuilder.example_datasets import FsPeptide
from msmbuilder.featurizer import DihedralFeaturizer
from msmbuilder.decomposition import tICA
from msmbuilder.cluster import MiniBatchKMeans
from msmbuilder.msm import MarkovStateModel
import numpy as np
import ... | msmexplorer/msmexplorer | examples/plot_tpaths.py | Python | mit | 1,087 |
#!/usr/bin/env python
# Created on: August 2, 2013
__author__ = "Sven Kreiss, Kyle Cranmer"
__version__ = "0.1"
import optparse
parser = optparse.OptionParser(version=__version__)
parser.add_option("-c", "--interpcode", dest="interpcode", default=4, type="int", help="InterpCode to be investigated.")
parser.add_op... | svenkreiss/decouple | Plot/plotInterpCode.py | Python | mit | 7,815 |
import idaapi
from ATFGen.app import run
run() | goodwinxp/ATFGenerator | ATFGenLauncher.py | Python | mit | 47 |
"""
Scan the directory of nep files and extract their metadata. The
metadata is passed to Jinja for filling out `index.rst.tmpl`.
"""
import os
import sys
import jinja2
import glob
import re
def render(tpl_path, context):
path, filename = os.path.split(tpl_path)
return jinja2.Environment(
loader=jin... | tynn/numpy | doc/neps/tools/build_index.py | Python | bsd-3-clause | 3,077 |
# -*- coding: utf-8 -*-
"""Tests around locally cached cookiecutter template repositories."""
import io
import os
import pytest
from cookiecutter import repository, exceptions
@pytest.fixture
def template():
return 'cookiecutter-pytest-plugin'
@pytest.fixture
def cloned_cookiecutter_path(user_config_data, t... | luzfcb/cookiecutter | tests/repository/test_determine_repo_dir_finds_subdirectories.py | Python | bsd-3-clause | 2,194 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2014 Thomas Voegtlin
#
# 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 y... | Gamecredits-Universe/Gamecredits-electrum-client | gui/qt/qrwindow.py | Python | gpl-3.0 | 2,760 |
# Created by DrLecter, based on DraX' scripts
# This script is part of the L2J Official Datapack Project
# Visit us at http://www.l2jdp.com/
# See readme-dp.txt and gpl.txt for license and distribution details
# Let us know if you did not receive a copy of such files.
import sys
from com.l2scoria.gameserver.model.ques... | zenn1989/scoria-interlude | L2Jscoria-Game/data/scripts/village_master/orc_occupation_change_2/__init__.py | Python | gpl-3.0 | 3,955 |
# -*- coding: utf-8 -*-
# All configuration values have a default; values that are commented out
# serve to show the default.
#
# Options here are applied and assumed to be those required when the builder is set the "html".
# For common options see conf.py.in. This file is presumed to be "execfiled" by the main conf.py... | dymkowsk/mantid | docs/conf-html.py | Python | gpl-3.0 | 1,547 |
# Currently meant only for CellDensityTest
# Will be made generic soon
from tabulate import tabulate
#==============================================================================
class TxtTable:
"""
Displays data in table inside text file
Note: can be extended in future to provide more flexibility
"... | pedroernesto/morphounit | morphounit/plots/plot_txt_table.py | Python | bsd-3-clause | 2,843 |
#!/usr/bin/env python
# mirrormeta.py
#
# Copyright (c) 2007,2009 Benjamin Kramer
#
# 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 rig... | d0k/mirrormeta | mirrormeta.py | Python | mit | 6,310 |
# Major, Minor
VERSION = (1, 4) | duointeractive/python-bluefin | bluefin/__init__.py | Python | bsd-3-clause | 31 |
class NotSupportedDayError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(" ".join([" Day ", value, " is not supported "]))
| rakeshsingh/trend-in | trendin/exceptions.py | Python | mit | 193 |
"""
Utility functions related to urls.
"""
import sys
import six
from importlib import import_module
from django.conf import settings
from django.urls import set_urlconf
if six.PY3:
from importlib import reload # pylint: disable=no-name-in-module,redefined-builtin
def reload_django_url_config():
"""
... | cpennington/edx-platform | common/djangoapps/util/url.py | Python | agpl-3.0 | 833 |
# Copyright (c) 2008 Joost Cassee
# Licensed under the terms of the MIT License (see LICENSE.txt)
from django.db import models
from django.contrib.admin import widgets as admin_widgets
from tinymce import widgets as tinymce_widgets
try:
from south.modelsinspector import add_introspection_rules
add_introspectio... | djorda9/Simulated-Conversations | vagrant/tinymce/models.py | Python | mit | 900 |
# -*- coding: utf-8
# 3 Spheres have an initial velociries: 0, +5, -5
# Their positions and velocities are checking during free fall
# Checks the correctness of NewtonIntegrator and GravityEngine
## Omega
o=Omega()
## PhysicalParameters
Density=2400
frictionAngle=radians(35)
sphereRadius=0.05
tc = 0.001
en = 0.3
e... | anna-effeindzourou/trunk | scripts/checks-and-tests/checks/checkGravity.py | Python | gpl-2.0 | 3,036 |
class Team:
"""
GitHub Team
https://developer.github.com/v3/orgs/teams/
Attributes:
id: GitHub internal id
url: "https://api.github.com/teams/1"
name: The name of the team
slug: Team name uri
description: The description of the team.
privacy: The level o... | codex-bot/github | github/data_types/team.py | Python | mit | 1,793 |
import os
from os.path import join
from ipdb import set_trace
root_folder = join("/", "home", "torbjone", "work",
"spike_sorting", "neuron_models")
model_folders = ['MediumSimple', 'SmallSimple',
'SmallComplex', 'MediumComplex', 'Large']
folders = [join(root_folder, x) for x in model_fo... | espenhgn/ViSAPy | examples/example_in_vitro_MEA/neuron_models/edit_text.py | Python | gpl-2.0 | 1,499 |
"""
django-helpdesk - A Django powered ticket tracker for small enterprise.
templatetags/saved_queries.py - This template tag returns previously saved
queries. Therefore you don't need to modify
any views.
"""
from django.template import Library
from dj... | vladyslav2/django-helpdesk-optimizated | helpdesk/templatetags/saved_queries.py | Python | bsd-3-clause | 823 |
#legacy
# Mal ein bisschen Gespiele im DOM-Baum
# sample_xml_imagecabin.htm
from xml.etree import cElementTree as ET
doc=ET.ElementTree()
doc.parse('sample_xml_imagecabin.htm')
tabs=doc.findall('body/table')
print(tabs) | BackupTheBerlios/hiss | hostmodule/core/grepnode.py | Python | gpl-3.0 | 219 |
print("123"[0:1])
print("123"[0:2])
print("123"[:1])
print("123"[1:])
# Idiom for copying sequence
print("123"[:])
print("123"[:-1])
# Weird cases
print("123"[0:0])
print("123"[1:0])
print("123"[1:1])
print("123"[-1:-1])
print("123"[-3:])
print("123"[-3:3])
print("123"[0:])
print("123"[:0])
print("123"[:-3])
prin... | turbinenreiter/micropython | tests/basics/string_slice.py | Python | mit | 555 |
# Useful reading is:
# https://zulip.readthedocs.io/en/latest/subsystems/html-css.html#front-end-build-process
import os
from typing import Optional
from django.conf import settings
from django.contrib.staticfiles.storage import ManifestStaticFilesStorage
if settings.DEBUG:
from django.contrib.staticfiles.finder... | showell/zulip | zerver/lib/storage.py | Python | apache-2.0 | 2,688 |
__author__ = "saeedamen" # Saeed Amen
#
# Copyright 2016 Cuemacro
#
# 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 applicabl... | cuemacro/findatapy | findatapy/timeseries/retstats.py | Python | apache-2.0 | 5,869 |
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it w... | marcosbontempo/inatelos | poky-daisy/scripts/lib/mic/3rdparty/pykickstart/urlgrabber/sslfactory.py | Python | mit | 3,151 |
import subprocess
import time
import sys
import os
PYTHON_VERSION = sys.version_info[0]
CACHE = {}
CACHE_MAX_AGE = 60*60*48 # 48h
try:
import json
except:
import simplejson as json
def cache_load(cf):
if not os.path.isfile(cf): return
global CACHE
f = open(cf, 'r')
try: CACHE = json.load(f)
except: pass
... | nwinter/bantling | scripts/whois/_1_query.py | Python | mit | 1,484 |
# Copyright 2015 datawire. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | datawire/adaptive | examples/petstore/petstore_impl.py | Python | apache-2.0 | 2,117 |
"""
Peter Kutschera, 2013-09-11
Time-stamp: "2014-05-21 12:32:20 peter"
The server gets an ICMM worldstate URL and calculates an indicator
Execution example (Change service part):
https://pinguin2.ait.ac.at/~peter/indicators/pywps.cgi?service=WPS&request=Execute&version=1.0.0&identifier=OverallTime&datainputs=ICMMwor... | crismaproject/BasicIndicators | wps/processes/OverallTime.py | Python | gpl-2.0 | 3,676 |
#!/usr/bin/python
#
# Copyright 2013 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | matiasherranz/keyczar | python/tests/keyczar_tests/interop_test.py | Python | apache-2.0 | 12,050 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | pwong-mapr/private-hue | desktop/libs/liboozie/src/liboozie/oozie_api_test.py | Python | apache-2.0 | 8,040 |
import math
def main():
values = []
for n in range(1, 101):
for r in range(n + 1):
if combination(n, r) > 1000000:
values.append(n)
print(len(values))
def combination(n, r):
if r > n:
raise Exception("R must be less than or equal to N")
return int(math.factorial(n) / (math.factorial(r) * math.factoria... | ZachOhara/Project-Euler | python/p051_p060/problem053.py | Python | gpl-3.0 | 367 |
#!/usr/bin/env python
# encoding: utf-8
"""
Defines various nose unit tests
"""
import numpy as np
from .mh import MHSampler
from .ensemble import EnsembleSampler
from .ptsampler import PTSampler
logprecision = -4
def lnprob_gaussian(x, icov):
return -np.dot(x, np.dot(icov, x)) / 2.0
def lnprob_gaussian_nan... | askielboe/JAVELIN | javelin/emcee/tests.py | Python | gpl-2.0 | 8,409 |
#!/usr/bin/env python
import sys
STRTAG = "<s"
ENDTAG = "</s>"
stc = None
for l in sys.stdin:
l = l.strip().split()
# print >> sys.stderr, l[0]
if l[0].startswith(STRTAG):
stc = ""
elif stc != None and l[0] == ENDTAG:
if stc != "":
print stc
stc = None
elif stc != None and l[0][0] != '<'... | ai-ku/upos_2014 | src/scripts/sketct2tok.py | Python | mit | 364 |
from unittest import TestCase
from mock import patch, Mock
from pulp_ostree.common import constants
from pulp_ostree.plugins.importers.web import WebImporter, entry_point
class TestImporter(TestCase):
@patch('pulp_ostree.plugins.importers.web.read_json_config')
def test_entry_point(self, read_json_config):... | jeremycline/pulp_ostree | plugins/test/unit/plugins/importers/test_web.py | Python | gpl-2.0 | 2,375 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'AbstractInput.multi'
db.add_column('workflows_abstractinput', 'multi', self.gf('django.db.... | anirudhvenkats/clowdflows | workflows/migrations/0009_auto__add_field_abstractinput_multi.py | Python | gpl-3.0 | 13,612 |
"""Tests for algorithms for computing symbolic roots of polynomials. """
from sympy import (S, symbols, Symbol, Wild, Rational, sqrt,
powsimp, sin, cos, pi, I, Interval, re, im, exp, ZZ, Piecewise,
acos, root)
from sympy.polys import Poly, cyclotomic_poly, intervals, nroots, RootOf
from sympy.polys.polyroots... | AunShiLord/sympy | sympy/polys/tests/test_polyroots.py | Python | bsd-3-clause | 22,400 |
# nvlbugzilla.py - a Python interface to Novell Bugzilla using xmlrpclib.
#
# Copyright (C) 2009 Novell Inc.
# Author: Michal Vyskocil <mvyskocil@suse.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 F... | openSUSE/python-bugzilla | bugzilla/nvlbugzilla.py | Python | gpl-2.0 | 2,821 |
#!/usr/bin/python2.7
print "__init__"
# __all__ = ['p2']
from big import *
| qrsforever/workspace | python/learn/base/module/l1/pack/__init__.py | Python | mit | 78 |
from django.shortcuts import render
from rest_framework import generics, serializers
from beacon.models import Inquiry, Reply
class InquirySerializer(serializers.ModelSerializer):
class Meta:
model = Inquiry
class ReplySerializer(serializers.ModelSerializer):
class Meta:
model = Reply
cl... | SorenOlegnowicz/tracker | tracker/api/views.py | Python | agpl-3.0 | 739 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-25 09:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('songs', '0002_polymorphism'),
]
operations = [
migrations.RenameField(
... | ahmedaljazzar/fairuze | songs/migrations/0003_auto_20170825_0925.py | Python | agpl-3.0 | 1,373 |
import json
import os
from gcp_census.model.table import Table
from gcp_census.model.view import View
class FilesystemModelProvider(object):
def __init__(self, model_directory):
self.model_directory = model_directory
def list_tables(self):
for table in self.__list_files('.json'):
... | ocadotechnology/gcp-census | gcp_census/model/filesystem_model_provider.py | Python | apache-2.0 | 1,524 |
# -*- coding: utf-8 -*-
import os
import time
from fabric.api import local, run, cd
from fabric import colors
from fabric.context_managers import settings
from fabric.contrib.console import confirm
from fabric.contrib import django
from fabric.contrib.files import exists
from fabric.utils import abort
from fabric.oper... | frecar/django-fabric | django_fabric/base.py | Python | mit | 6,326 |
# Copyright (c) 2015 Parallels IP Holdings GmbH
# 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
#
# U... | Datera/cinder | cinder/volume/drivers/vzstorage.py | Python | apache-2.0 | 29,648 |
#-----------------------------------------------------------------------------
# Copyright (c) 2010-2012 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distributed as part of this software.
#-----... | ellisonbg/pyzmq | zmq/tests/__init__.py | Python | lgpl-3.0 | 7,203 |
#!/usr/bin/python2.7
import os, re, shutil, binascii
import lib.misc as misc
import lib.config as config
import lib.message as message
def check_filesystem():
message.sub_info('Checking')
corrupted = False
for sdir in ('bin', 'sbin', 'usr/bin', 'usr/sbin', 'etc', 'lib', 'usr/lib'):
full_dir = mis... | clearkimura/Customizer | src/actions/common.py | Python | gpl-2.0 | 2,773 |
from st2common.runners.base_action import Action
class PrintPythonVersionAction(Action):
def run(self, value1):
return {"context_value": value1}
| StackStorm/st2tests | packs/fixtures/actions/render_config_context.py | Python | apache-2.0 | 160 |
# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
import os, re
import pytest
from pytest import xfail
from jenkinsflow.flow import serial, parallel
from .cfg import ApiType
from .framework import api_select
from .framework.utils ... | lhupfeldt/jenkinsflow | test/multiple_invocations_test.py | Python | bsd-3-clause | 10,382 |
import numpy as np
import pytest
from pandas import DataFrame, NaT, date_range
import pandas.util.testing as tm
@pytest.fixture
def float_frame_with_na():
"""
Fixture for DataFrame of floats with index of unique strings
Columns are ['A', 'B', 'C', 'D']; some entries are missing
A... | toobaz/pandas | pandas/tests/frame/conftest.py | Python | bsd-3-clause | 10,626 |
from ops.data import OpsClass, OpsField, DszObject, DszCommandObject, cmd_definitions
import dsz
class AuditingEventData(DszObject, ):
def __init__(self, dszpath='', cmdid=None, opsclass=None, parent=None, debug=False):
DszObject.__init__(self, dszpath, cmdid, dszauditevent, parent, debug)
def __get... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Ops/PyScripts/lib/ops/data/audit.py | Python | unlicense | 1,505 |
#!/usr/bin/env python2
from distutils.core import setup
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.command.install_data import install_data
from distutils.command.build import build
from distutils.dep_util import newer
from distutils.log import warn, info, error
from distu... | albfan/terminator | setup.py | Python | gpl-2.0 | 9,520 |
#!/usr/bin/env python
"""
Static site server script
Usage: python ./scripts/server.py [OPTIONS]
"""
import argparse
import subprocess
import py_server
import signal
def handler(signum, frame):
subprocess.call('docker-compose stop server', shell=True)
if __name__ == '__main__':
parser = argparse.ArgumentP... | CoastalResilienceNetwork/GeositeFramework | scripts/server.py | Python | gpl-3.0 | 769 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | nudles/incubator-singa | test/python/test_metric.py | Python | apache-2.0 | 2,514 |
# Dissemin: open access policy enforcement tool
# Copyright (C) 2014 Antonin Delpeuch
#
# This program 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 2
# of the License, or (at your opti... | Lysxia/dissemin | publishers/tests.py | Python | agpl-3.0 | 1,666 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | mistercrunch/panoramix | tests/integration_tests/reports/api_tests.py | Python | apache-2.0 | 49,946 |
#-*-coding: utf-8 -*-
import hashlib
import json
import os
import sys
class Fname:
def __init__(self, dict_string):
# dict_string for encryption
self._dict_string_length = len(dict_string)
self._dict_num = []
for char in dict_string: self._dict_num.append(ord(char)-31)
# d... | moretv/cobweb | server/Cobweb/Fname.py | Python | gpl-2.0 | 2,906 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'resources\ui\instructions.ui'
#
# Created: Wed Jul 12 17:05:00 2017
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_Instructions(object... | GunfighterJ/FitScan | src/fitscan/views/ui_instructions.py | Python | gpl-3.0 | 1,942 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
(c) 2014 - Copyright Joshua Santos
Author: Joshua Santos <nerdsville@nerdsville.net>
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2, o... | fedora-infra/elections | tests/test_flask_irc.py | Python | gpl-2.0 | 8,374 |
__author__ = 'Dmitry Golubkov'
__email__ = 'dmitry.v.golubkov@cern.ch'
class DefaultRouter(object):
def db_for_read(self, model, **hints):
try:
return model._meta.db_name
except AttributeError:
return 'default'
def db_for_write(self, model, **hints):
try:
... | retmas-dv/panda-deft | deftcore/deftcore/routers.py | Python | apache-2.0 | 778 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.