text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
import unittest
class TestExample(unittest.TestCase):
@classmethod
def setUpClass(cls):
print("**************************************** setUpClass ****************************************")
@classmethod
def tearDownClass(cls):
print("***************************... | Ernestyj/PyStudy | DataScience/python/tools/test/test_example.py | Python | apache-2.0 | 577 | 0.003466 |
#!/usr/bin/env python3
"""
Check of automatic algorithm rollover scenario.
"""
import collections
import os
import shutil
import datetime
import random
import subprocess
from subprocess import check_call
from dnstest.utils import *
from dnstest.keys import Keymgr
from dnstest.test import Test
from dnstest.module im... | CZ-NIC/knot | tests-extra/tests/modules/onlinesign_rollovers/test.py | Python | gpl-3.0 | 7,474 | 0.006422 |
import numpy as np
import pytest
from numpy.testing import assert_allclose
try:
import scipy
except ImportError:
HAS_SCIPY = False
else:
HAS_SCIPY = True
import astropy.units as u
from astropy.timeseries.periodograms.lombscargle import LombScargle
from astropy.timeseries.periodograms.lombscargle._statisti... | MSeifert04/astropy | astropy/timeseries/periodograms/lombscargle/tests/test_statistics.py | Python | bsd-3-clause | 7,519 | 0.000532 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-21 19:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('books', '0007_auto_20170821_2052'),
]
operations = [
migrations.AlterField(... | ludwiktrammer/tikn | apps/books/migrations/0008_auto_20170821_2100.py | Python | gpl-3.0 | 534 | 0.001873 |
#!/usr/bin/env python
"""
.. py:currentmodule:: FileFormat.Results.Phirhoz
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
MCXRay phirhoz result file.
"""
# Script information for the file.
__author__ = "Hendrix Demers (hendrix.demers@mail.mcgill.ca)"
__version__ = ""
__date__ = ""
__copy... | drix00/pymcxray | pymcxray/FileFormat/Results/Phirhoz.py | Python | apache-2.0 | 2,697 | 0.002595 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.forms import ModelForm
from django.views.generic.list import ListView,View
import abc
import datetime
from django.utils import timezone
from django.core.validators import RegexValidator
from django.core.urlresolve... | adelinesharla/CtrlVET | cadastro/models.py | Python | gpl-3.0 | 12,567 | 0.05463 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('layers', '24_to_26'),
]
operations = [
migrations.CreateModel(
name='QGISServerLayer',
fields=[
... | kartoza/geonode | geonode/qgis_server/migrations/0001_initial.py | Python | gpl-3.0 | 597 | 0.00335 |
"""
A set of built-in default checks for the platform heartbeat endpoint
Other checks should be included in their respective modules/djangoapps
"""
from datetime import datetime, timedelta
from time import sleep, time
from django.conf import settings
from django.core.cache import cache
from django.db import connectio... | lduarte1991/edx-platform | openedx/core/djangoapps/heartbeat/default_checks.py | Python | agpl-3.0 | 4,002 | 0.004248 |
import argparse
import requests
import logging
import pip._internal
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Get the nth version of a given package')
parser.add_argument('--package', type=str, required=True, help='The PyPI you want to inspect')
parser.add_argument('--nth_l... | zsdonghao/tensorlayer | docker/pypi_list.py | Python | apache-2.0 | 1,987 | 0.003523 |
# pylint: disable=C0103,R0801
import sqlalchemy
import migrate
meta = sqlalchemy.MetaData()
# define the previous state of tenants
tenant = {}
tenant['id'] = sqlalchemy.Column('id', sqlalchemy.Integer, primary_key=True,
autoincrement=True)
tenant['name'] = sqlalchemy.Column('name', sqlalchemy.String(255)... | HugoKuo/keystone-essex3 | keystone/backends/sqlalchemy/migrate_repo/versions/005_add_tenants_uid.py | Python | apache-2.0 | 996 | 0.002008 |
from pygame import *
from key_dict import *
''' The player class '''
class Cursor:
def __init__(self, x, y, size):
self.x = int(x)
self.y = int(y)
self.size = size
self.speed = 1
self.cooldown = 0
self.block = 0
self.menu_switch = {'Build' : True}
se... | erikjuhani/thefortressheart | cursor.py | Python | gpl-3.0 | 2,603 | 0.006915 |
# ==============================================================================
# Copyright 2019 - Philip Paquette
#
# NOTICE: 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 rest... | diplomacy/research | diplomacy_research/models/policy/token_based/v004_language_model/tests/test_model.py | Python | mit | 4,186 | 0.005256 |
#!/usr/bin/env python3
# Developer virtualenv setup for Certbot client
"""Aids in creating a developer virtual environment for Certbot.
When this module is run as a script, it takes the arguments that should
be passed to pip to install the Certbot packages as command line
arguments. If no arguments are provided, all C... | letsencrypt/letsencrypt | tools/venv.py | Python | apache-2.0 | 8,641 | 0.002315 |
# The name of the dashboard to be added to HORIZON['dashboards']. Required.
DASHBOARD = 'help_about'
DISABLED = False
# A list of applications to be added to INSTALLED_APPS.
ADD_INSTALLED_APPS = [
'openstack_dashboard.dashboards.help_about',
]
| ging/horizon | openstack_dashboard/enabled/_35_help_about.py | Python | apache-2.0 | 250 | 0 |
from django.conf.urls import url
from core.views.generic import get_dashboard, delete
from users.views.individuals import RegisterView
from users.views.base import LoginView, logout_user
from core.views.display import IndexView
urlpatterns = [#url(r'^$', LoginView.as_view(), name='index'),
url(... | acuriel/nahuatilli | core/urls.py | Python | gpl-3.0 | 840 | 0.007143 |
from requests import HTTPError
from database import Database
import simplejson as json
db = Database.getDatabaseConnection()["cras"]
from log_session import LogSession
import datetime
class DB:
def __init__(self):
pass
@staticmethod
def add_user(user_id, user_name, mail,picture,fcm_token):
... | tweiss1234/Cras | db_actions.py | Python | apache-2.0 | 5,095 | 0.005299 |
# -*- coding: utf-8 -*-
#
# This file is based upon the file generated by sphinx-quickstart. However,
# where sphinx-quickstart hardcodes values in this file that you input, this
# file has been changed to pull from your module's metadata module.
#
# This file is execfile()d with the current directory set to its contai... | GCStokum/ECS-Game | ecs-0.1/docs/source/conf.py | Python | mit | 8,695 | 0.00483 |
# -*- coding: utf-8 -*-
#
# 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
#... | artwr/airflow | airflow/contrib/operators/gcs_operator.py | Python | apache-2.0 | 5,140 | 0.000778 |
from rest_framework import serializers
from emotion_annotator.models import FrameEmotions
class FrameEmotionsSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = FrameEmotions
fields = ('video', 'frameTime', 'emotionType')
| dumoulinj/ers | ers_backend/emotion_annotator/serializers.py | Python | mit | 267 | 0.007491 |
import unittest
import copy
import gc
import rpy2.rinterface as rinterface
rinterface.initr()
class SexpTestCase(unittest.TestCase):
def testNew_invalid(self):
x = "a"
self.assertRaises(ValueError, rinterface.Sexp, x)
def testNew(self):
sexp = rinterface.baseenv.get("letters")
... | lbouma/Cyclopath | pyserver/bin/rpy2/rinterface/tests/test_Sexp.py | Python | apache-2.0 | 4,549 | 0.005935 |
from chainer import function
class Flatten(function.Function):
"""Flatten function."""
def forward(self, inputs):
self.retain_inputs(())
self._in_shape = inputs[0].shape
return inputs[0].ravel(),
def backward(self, inputs, grads):
return grads[0].reshape(self._in_shape),... | kashif/chainer | chainer/functions/array/flatten.py | Python | mit | 1,211 | 0 |
#!/usr/bin/env python
"""
.. py:currentmodule:: FileFormat.SimulationParameters
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
MCXRay simulation parameters input file.
"""
# Script information for the file.
__author__ = "Hendrix Demers (hendrix.demers@mail.mcgill.ca)"
__version__ = ""
__d... | drix00/pymcxray | pymcxray/FileFormat/SimulationParameters.py | Python | apache-2.0 | 15,335 | 0.004695 |
"""
Unit tests for email feature flag in new instructor dashboard.
Additionally tests that bulk email is always disabled for
non-Mongo backed courses, regardless of email feature flag, and
that the view is conditionally available when Course Auth is turned on.
"""
from __future__ import absolute_import
from django.ur... | jolyonb/edx-platform | lms/djangoapps/instructor/tests/test_email.py | Python | agpl-3.0 | 7,373 | 0.003119 |
from SimpleLexicon import SimpleLexicon
from LOTlib.Evaluation.EvaluationException import RecursionDepthException
class RecursiveLexicon(SimpleLexicon):
"""
A lexicon where word meanings can call each other. Analogous to a RecursiveLOTHypothesis from a LOTHypothesis.
To achieve this, we require the LOThy... | ebigelow/LOTlib | LOTlib/Hypotheses/Lexicon/RecursiveLexicon.py | Python | gpl-3.0 | 1,491 | 0.004695 |
# flake8: noqa
"""
Public testing utility functions.
"""
from pandas.util.testing import (
assert_frame_equal, assert_index_equal, assert_series_equal)
| GuessWhoSamFoo/pandas | pandas/testing.py | Python | bsd-3-clause | 158 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-03-21 12:36
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [("clusters", "0020_emr_release_model")]
operations = [
mi... | mozilla/telemetry-analysis-service | atmo/clusters/migrations/0021_rename_cluster_emr_release.py | Python | mpl-2.0 | 1,083 | 0.001847 |
from gettext import gettext as _
SECTION_ROOT = 'puppet'
DESC_ROOT = _('manage Puppet bindings')
def ensure_puppet_root(cli):
"""
Verifies that the root of puppet-related commands exists in the CLI,
creating it using constants from this module if it does not.
:param cli: CLI instance being configure... | ammaritiz/pulp_puppet | pulp_puppet_extensions_consumer/pulp_puppet/extensions/consumer/structure.py | Python | gpl-2.0 | 635 | 0 |
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.mail import Mail
from flask.ext.moment import Moment
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from config import config
bootstrap = Bootstrap()
mail = Mail()
moment = Moment()
db = SQLAlchemy()
... | sb2gh/flask_login_1 | app/__init__.py | Python | mit | 988 | 0 |
import subprocess
def convert_chinese(text):
return subprocess.getoutput("echo '%s' | opencc -c hk2s.json" % text) | josherich/mindynode-parsers | mindynode_nltk/utils/opencc.py | Python | mit | 117 | 0.025641 |
import sqlite3
from config import appConfig
def createTBLS(path=None):
conn = sqlite3.connect(path)
cursor = conn.cursor()
cursor.execute("""CREATE TABLE links(id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE NOT NULL,
name TEXT NOT NULL
);""")
c... | Mohamad1994HD/LinkArchiever | app/createDBTables.py | Python | gpl-3.0 | 1,118 | 0.006261 |
"""This module is part of Swampy, a suite of programs available from
allendowney.com/swampy.
Copyright 2011 Allen B. Downey
Distributed under the GNU General Public License at gnu.org/licenses/gpl.html.
"""
import math
from World import World
class CellWorld(World):
"""Contains cells and animals that move betwe... | simontakite/sysadmin | pythonscripts/thinkpython/CellWorld.py | Python | gpl-2.0 | 6,080 | 0.004441 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# a... | PisiLinux-PyQt5Port/package-manager | src/settingsdialog.py | Python | gpl-2.0 | 20,739 | 0.003809 |
#!/usr/bin/python3
import os, sys, random
import argparse
# this script processes all the log simulations in one dir, and writes the values of one particular attribute into one single file.
def prepareProcess(inputDir,simulationFile, separator, output, attribute ):
output = open(output, 'w')
simulation = open(inpu... | montanier/pandora | bin/joinResults.py | Python | lgpl-3.0 | 2,368 | 0.029561 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
PyCOMPSs Testbench Arguments Warnings
=====================================
"""
# Imports
import unittest
from modules.testArgumentError import testArgumentError
def main():
suite = unittest.TestLoader().loadTestsFromTestCase(testArgumentError)
unittest.TextTes... | mF2C/COMPSs | tests/sources/python/8_argument_error/src/args_error.py | Python | apache-2.0 | 392 | 0.002551 |
import os
from configurations import values
from boto.s3.connection import OrdinaryCallingFormat
from {{cookiecutter.app_name}}.config.common import Common
try:
# Python 2.x
import urlparse
except ImportError:
# Python 3.x
from urllib import parse as urlparse
class Production(Common):
# Honor th... | amitassaraf/angular2-django-boilerplate | {{cookiecutter.github_repository_name}}/src/{{cookiecutter.app_name}}/config/production.py | Python | mit | 3,763 | 0.000797 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from ansible.module_utils.basic import AnsibleModule
import git
import itertools
import multiprocessing
import os
import signal
import time
DOCUMENTATION = """
---
module: git_requirements
short_description: Module to run a multithreaded git clone
options:
repo_info:
d... | stackforge/os-ansible-deployment | playbooks/library/git_requirements.py | Python | apache-2.0 | 10,270 | 0 |
import os;
f = open('depsVerified', 'w');
f.write('ok');
f.close(); | krahman/node-java | touch.py | Python | mit | 68 | 0.073529 |
from django.db import models
from django.utils import timezone
# Create your models here.
def formatDateTime(dateTime):
return timezone.localtime(dateTime).strftime("%Y-%m-%d %H:%M:%S")
class Beacon(models.Model):
macAddr = models.CharField(max_length=20, unique=True)
uuid = models.UUIDField(editable=... | SmartcitySantiagoChile/onlineGPS | beacon/models.py | Python | mit | 2,058 | 0.006317 |
import json
import os
from processes.postgres import Postgres
from processes.gather_exception import GatherException
try:
DB_SERVER = os.environ['DB_SERVER']
DB_PORT = os.environ['DB_PORT']
DB_DATABASE = os.environ['DB_DATABASE']
DB_USER = os.environ['DB_USER']
DB_PASSWORD = os.environ['DB_PASSW... | kinoreel/kino-gather | processes/insert_movies.py | Python | mit | 3,618 | 0.003317 |
"""A modest set of tools to work with Django models."""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant f... | damienjones/sculpt-model-tools | setup.py | Python | lgpl-2.1 | 1,198 | 0.022538 |
from JumpScale import j
descr = """
This jumpscript returns network info
"""
category = "monitoring"
organization = "jumpscale"
author = "kristof@incubaid.com"
license = "bsd"
version = "1.0"
roles = []
def action():
return j.sal.nettools.getNetworkInfo()
if __name__ == "__main__":
print(action())
| Jumpscale/jumpscale_core8 | apps/agentcontroller/jumpscripts/jumpscale/network_info.py | Python | apache-2.0 | 312 | 0.003205 |
# pack.py -- For dealing with packed git objects.
# Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
# Copyright (C) 2008-2013 Jelmer Vernooij <jelmer@jelmer.uk>
#
# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
# General Public License as public by the Free Software Foundation; ... | muhkuh-sys/org.muhkuh.tools-flasher | jonchki/dulwich/pack.py | Python | gpl-2.0 | 68,723 | 0.000029 |
#!/usr/bin/env python
"""
Copyright 2010-2018 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 appli... | SCECcode/BBP | bbp/comps/bbtoolbox_cfg.py | Python | apache-2.0 | 5,200 | 0.000769 |
#! /usr/bin/env python
###############################################################################
#
# simulavr - A simulator for the Atmel AVR family of microcontrollers.
# Copyright (C) 2001, 2002 Theodore A. Roth
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of th... | zouppen/simulavr | regress/test_opcodes/test_LD_X_decr.py | Python | gpl-2.0 | 3,080 | 0.017857 |
import sys
import lofarpipe.support.lofaringredient as ingredient
from lofarpipe.support.baserecipe import BaseRecipe
from lofarpipe.support.remotecommand import RemoteCommandRecipeMixIn
from lofarpipe.support.remotecommand import ComputeJob
from lofarpipe.support.data_map import DataMap, validate_data_maps, \
... | kernsuite-debian/lofar | CEP/Pipeline/recipes/sip/master/imager_finalize.py | Python | gpl-3.0 | 7,155 | 0.004612 |
"""
Functions and decorators for making sure the parameters they work on are of
iterable types.
Copyright 2014-2015, Outernet Inc.
Some rights reserved.
This software is free software licensed under the terms of GPLv3. See COPYING
file that comes with the source code, or http://www.gnu.org/licenses/gpl.txt.
"""
impor... | Outernet-Project/librarian | librarian/core/utils/iterables.py | Python | gpl-3.0 | 2,296 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright 2011 Yaşar Arabacı
This file is part of packagequiz.
packagequiz 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... | yasar11732/arch-package-quiz | packagequiz/questionGenerator.py | Python | gpl-3.0 | 4,801 | 0.005626 |
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2017 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
import functools
from gevent import lock
from bliss.config.conductor.client import Lock
from bliss.config.channels import Cache
from bli... | tiagocoutinho/bliss | bliss/common/shutter.py | Python | lgpl-3.0 | 10,215 | 0.004307 |
#!/usr/bin/env python3
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This is generated, do not edit. Update BuildConfigGenerator.groovy and
# 3ppFetch.template instead.
import argparse
import json
imp... | chromium/chromium | third_party/android_deps/libs/io_github_java_diff_utils_java_diff_utils/3pp/fetch.py | Python | bsd-3-clause | 2,503 | 0 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from django.utils.translation import ugettext as _
class UserProfile(models.Model):
'''
... | duoduo369/django-scaffold | myauth/models.py | Python | mit | 1,991 | 0.00387 |
from __future__ import print_function
import sys
sys.path.append('..') # help python find cyton.py relative to scripts folder
from openbci import cyton as bci
import logging
import time
def printData(sample):
# os.system('clear')
print("----------------")
print("%f" % (sample.id))
print(sample.chann... | OpenBCI/OpenBCI_Python | scripts/test.py | Python | mit | 937 | 0.004269 |
from src import model as mdl
class LaTeXPrinter(object):
def __init__(self, target_file_path):
self._target_file_path = target_file_path
def run(self):
with open(self._target_file_path, 'w') as output:
text = self._generate_text()
output.write(text)
def _generate... | diegoberaldin/PyRequirementManager | src/controller/printers.py | Python | gpl-3.0 | 4,793 | 0.000417 |
#import logging
#logging.basicConfig(level=logging.INFO, datefmt='%H:%M:%S',
# format='%(asctime)s %(levelname)s: %(message)s')
import unittest
import SocketServer, socket
import random, time
import threading
import cStringIO
from datetime import datetime
from shapy import register_settings
registe... | praus/shapy | tests/emulation/test_shaping.py | Python | mit | 3,245 | 0.010478 |
import os
import jug.backends.redis_store
import jug.backends.file_store
import jug.backends.dict_store
from jug.backends.redis_store import redis
import pytest
if not os.getenv('TEST_REDIS'):
redis = None
try:
redisConnectionError = redis.ConnectionError
except:
redisConnectionError = SystemError
@pytes... | luispedro/jug | jug/tests/test_store.py | Python | mit | 3,891 | 0.003084 |
#!/usr/bin/python3
import sys
def process_import(filename, statement):
statement = statement.replace(",", " ")
modules = statement.split()
for module in modules[1:]:
print('"%s" -> "%s"' % (filename, module))
def process_from(filename, statement):
statement = statement.replace(",", " ")
m... | WeCase/WeCase | utils/depgraph.py | Python | gpl-3.0 | 898 | 0.004454 |
"""
A pretty-printing dump function for the ast module. The code was copied from
the ast.dump function and modified slightly to pretty-print.
Alex Leone (acleone ~AT~ gmail.com), 2010-01-30
"""
from ast import *
def dump(node, annotate_fields=True, include_attributes=False, indent=' '):
"""
Return a format... | Suor/flaws | astpp.py | Python | bsd-2-clause | 2,283 | 0.001752 |
# flake8: noqa: F401
from pandas.core.arrays.sparse.accessor import SparseAccessor, SparseFrameAccessor
from pandas.core.arrays.sparse.array import (
BlockIndex,
IntIndex,
SparseArray,
_make_index,
)
from pandas.core.arrays.sparse.dtype import SparseDtype
| TomAugspurger/pandas | pandas/core/arrays/sparse/__init__.py | Python | bsd-3-clause | 273 | 0.003663 |
from stard.services import BaseService
class Service(BaseService):
def init_service(self):
self.children = {self.service('child')}
| DexterLB/stard | src/stard/test_samples/father.py | Python | mit | 144 | 0.006944 |
# -*- coding: utf-8 -*-
from itertools import chain
from django.contrib.sites.models import Site
from django.core.urlresolvers import NoReverseMatch, reverse_lazy
from django.forms.widgets import Select, MultiWidget, TextInput
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
... | amaozhao/basecms | cms/forms/widgets.py | Python | mit | 10,371 | 0.004339 |
from django.forms import Media
from wagtail.admin.staticfiles import versioned_static
# Feature objects: these are mapped to feature identifiers within the rich text
# feature registry (wagtail.core.rich_text.features). Each one implements
# a `construct_options` method which modifies an options dict as appropriate t... | timorieber/wagtail | wagtail/admin/rich_text/editors/draftail/features.py | Python | bsd-3-clause | 2,173 | 0.001381 |
from contextlib import closing
from flask import current_app
from summer.app import create_app
from summer.db.connect import connect_db
def init_db():
app = create_app('product')
_context = app.app_context()
_context.push()
with closing(connect_db()) as db:
with open('./summer/schema.sql', mo... | zhongql/summer | tool/initdb.py | Python | mit | 448 | 0.002232 |
from Model import *
| joshrule/LOTlib | LOTlib/Projects/NumberGame/__init__.py | Python | gpl-3.0 | 21 | 0 |
# Copyright 2015 Internap.
#
# 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, so... | idjaw/netman | netman/api/api_utils.py | Python | apache-2.0 | 3,822 | 0.00157 |
##############################################################################
# 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... | krafczyk/spack | var/spack/repos/builtin/packages/bwtool/package.py | Python | lgpl-2.1 | 1,568 | 0.000638 |
import bleach
from pyramid.config import Configurator
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.session import UnencryptedCookieSessionFactoryConfig
from sqlalchemy import engine_from_config
from .models import (
DBSession,... | ethan-nelson/osm-tasking-manager2 | osmtm/__init__.py | Python | bsd-2-clause | 7,927 | 0.007191 |
# DJANGO 1.10.5 LOCAL SETTINGS
# https://docs.djangoproject.com/en/1.10/topics/settings/
# ==================================================================================================
from .base import *
DEBUG = True
# APP CONFIGURATION
# https://docs.djangoproject.com/en/1.10/ref/applications
# =============... | justinmnoor/geodjangotemplate | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/settings/local.py | Python | mit | 457 | 0.002188 |
"""
Created on Mar 8, 2014
@author: jtaghiyar
"""
from helpers import validate_argument
import logging
class Plumber(object):
"""
pipe components into a pipeline based on the given configuration and
generate a python script.
"""
def __init__(self, pipeline_script, workflow=None):
## the ... | jtaghiyar/kronos | kronos/plumber.py | Python | mit | 28,257 | 0.008635 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import urlparse
def uc2utf8(input):
## argh! this feels wrong, but seems to be needed.
if type(input) == unicode:
return input.encode('utf-8')
else:
return input
class URL:
"""
This class is for wrapping URLs into objects. It's use... | wasw100/pycaldav | pycaldav/lib/url.py | Python | gpl-3.0 | 5,906 | 0.004233 |
import notorm
import momoko
from tornado import gen
import psycopg2.extras
class AsyncRecord(notorm.record):
@gen.coroutine
def update(self, **args):
for k,v in args.items():
setattr(self, k, v)
cursor = yield notorm.db.execute(
self.update_... | subssn21/notorm | notorm/momoko.py | Python | mit | 919 | 0.015234 |
from pylons import tmpl_context as c
from adhocracy.lib.auth import can
from util import render_tile, BaseTile
class VariantRow(object):
def __init__(self, tile, variant, poll):
self.tile = tile
self.variant = variant
self.poll = poll
if tile.frozen:
freeze_time = til... | DanielNeugebauer/adhocracy | src/adhocracy/lib/tiles/selection_tiles.py | Python | agpl-3.0 | 2,711 | 0.000369 |
from __future__ import absolute_import
# Start a Celery worker by executing:
# celery -A proj worker -l info
# Import available tasks
from proj.tasks import add, mul, xsum, fib
# Test short-running tasks
add.delay(2, 2)
mul.delay(10, 12)
xsum.delay(range(100))
fib.delay(10)
# Test medium-running tasks
fib.delay(35)... | tjanez/celery-demo-app | test/test.py | Python | gpl-3.0 | 350 | 0.002857 |
import cherrypy
from cherrypy._cpcompat import ntou
from cherrypy.test import helper
class ETagTest(helper.CPWebCase):
@staticmethod
def setup_server():
class Root:
@cherrypy.expose
def resource(self):
return "Oh wah ta goo Siam."
@cherrypy.expose... | heytcass/homeassistant-config | deps/cherrypy/test/test_etags.py | Python | mit | 3,093 | 0 |
import unittest
import matmath
import numpy as np
import math
class TestMatrix(unittest.TestCase):
def testRotX(self):
mat = matmath.xRotationMatrix(math.radians(90))
pt = np.array([1, 0, 0, 1])
npt = pt.dot(mat)
np.testing.assert_almost_equal(npt, [1, 0, 0, 1])
pt = np.ar... | daryllstrauss/tango | test_mat.py | Python | mit | 2,661 | 0.001127 |
# 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)
from spack import *
class Voropp(MakefilePackage):
"""Voro++ is a open source software library for the computation o... | iulian787/spack | var/spack/repos/builtin/packages/voropp/package.py | Python | lgpl-2.1 | 1,349 | 0.001483 |
# Copyright (c) 2012 Roberto Alsina y otros.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights to use, copy, modify, merge, pub... | servalproject/nikola | nikola/plugins/compile_rest/youtube.py | Python | mit | 2,306 | 0 |
def process(self):
#GUJARATI VOWEL SIGN CANDRA E
#GUJARATI VOWEL CANDRA E
self.edit("GUJARATI")
self.edit("LETTER")
self.edit("DIGIT")
self.processAs("Helper Indic")
self.edit("VOWEL SIGN", "sign")
self.edit("VOWEL")
self.edit("SIGN")
self.edit("THREE-DOT NUKTA ABOVE", "threedotnuk... | LettError/glyphNameFormatter | Lib/glyphNameFormatter/rangeProcessors/gujarati.py | Python | bsd-3-clause | 668 | 0.008982 |
# -*- mode: python; indent-tabs-mode: nil; tab-width: 2 -*-
"""
aria_api.py - implements handlers which are for the Aria to talk to helvetic.
"""
from __future__ import absolute_import
from base64 import b16encode
from crc16 import crc16xmodem
from datetime import timedelta
from decimal import Decimal
from django.cont... | micolous/helvetic | helvetic/views/aria_api.py | Python | agpl-3.0 | 5,411 | 0.030309 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# *************************************... | sbesson/zeroc-ice | scripts/IceGridAdmin.py | Python | gpl-2.0 | 11,612 | 0.007492 |
print("My script") | ildar-band/rd90 | rd90.py | Python | mit | 18 | 0.055556 |
# $Id$
#
import inc_const as const
PJSUA = ["--null-audio --max-calls=1 $SIPP_URI"]
PJSUA_EXPECTS = [[0, const.STATE_CONFIRMED, "v"]]
| nigusgirma/https-svn.pjsip.org-repos-pjproject-trunk- | tests/pjsua/scripts-sipp/uas-answer-200-reinvite-without-sdp.py | Python | gpl-2.0 | 136 | 0 |
import paho.mqtt.publish as publish
import paho.mqtt.client as mqtt
import socket
import json
from datetime import datetime
import configparser
'''
Author: GYzheng, guanggyz@gmail.com
###Server side
We have two topic, one is from client to server, the other one is from client to server
1. Server->Client : sc_topic ... | iamgyz/remote-system-control | server.py | Python | mit | 2,750 | 0.020364 |
from bravado_core.spec import Spec
import mock
from pyramid.config import Configurator
from pyramid.registry import Registry
import pytest
from swagger_spec_validator.common import SwaggerValidationError
import pyramid_swagger
from pyramid_swagger.model import SwaggerSchema
@mock.patch('pyramid_swagger.register_api_... | analogue/pyramid_swagger | tests/includeme_test.py | Python | bsd-3-clause | 3,308 | 0 |
# -*- coding: utf-8 -*-
import cStringIO
import datetime
from itertools import islice
import json
import xml.etree.ElementTree as ET
import logging
import re
import werkzeug.utils
import urllib2
import werkzeug.wrappers
from PIL import Image
import openerp
from openerp.addons.web.controllers.main import WebClient
fr... | minhphung171093/GreenERP_V8 | openerp/addons/website/controllers/main.py | Python | agpl-3.0 | 20,190 | 0.003566 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 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 Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opti... | willprice/weboob | weboob/browser/elements.py | Python | agpl-3.0 | 9,532 | 0.001154 |
from P_14 import *
print("Shape of data: {}".format(iris_dataset["data"].shape))
input()
| TNT-Samuel/Coding-Projects | Machine Learning with Python/Chapter 1/P_15.py | Python | gpl-3.0 | 90 | 0 |
# encoding: utf-8
"""Gherkin step implementations for chart data features."""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
import datetime
from behave import given, then, when
from pptx.chart.data import (
BubbleChartData, Category, CategoryChartData, XyChartData
)... | biggihs/python-pptx | features/steps/chartdata.py | Python | mit | 7,361 | 0 |
# -*- coding: utf-8 -*-
import pytest
from irc3.plugins import slack
pytestmark = pytest.mark.asyncio
async def test_simple_matches(irc3_bot_factory):
bot = irc3_bot_factory(includes=['irc3.plugins.slack'])
plugin = bot.get_plugin(slack.Slack)
setattr(plugin, 'config', {'token': 'xoxp-faketoken'})
as... | gawel/irc3 | tests/test_slack.py | Python | mit | 2,123 | 0 |
import six
try:
from logging import NullHandler
except ImportError: # Python 2.6
from logging import Handler
class NullHandler(Handler):
def emit(self, record):
pass
try:
from urllib import urlencode as format_query
except ImportError:
from urllib.parse import urlencode as form... | feus4177/socketIO-client-2 | socketIO_client/symmetries.py | Python | mit | 897 | 0.001115 |
from random import randint
from position import Position, Size
from block import Room, Block
class Room(object):
def __init__(self, pos_row=0, pos_col=0, rows=1, cols=1, fill=Block.empty,
left=Room.left, right=Room.right,
top=Room.top, bottom=Room.bottom,
top_le... | f0lie/RogueGame | src/room.py | Python | mit | 3,171 | 0 |
#!/usr/bin/python3
## @package domomaster
# Master daemon for D3 boxes.
#
# Developed by GreenLeaf.
import sys;
import os;
import random;
import string;
from hashlib import sha1
from subprocess import *
import socket;
sys.path.append("/usr/lib/domoleaf");
from DaemonConfigParser import *;
MASTER_CONF_FILE_BKP ... | V-Paranoiaque/Domoleaf | domomaster/usr/bin/domomaster/domomaster_postinst.py | Python | gpl-3.0 | 4,613 | 0.017993 |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Create missing snapshot revisions.
Create Date: 2017-01-05 23:10:37.257161
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
from ggrc.mi... | VinnieJohns/ggrc-core | src/ggrc/migrations/versions/20170105231037_579239d161e1_create_missing_snapshot_revisions.py | Python | apache-2.0 | 1,087 | 0.0046 |
# -*- coding: utf-8 -*-
# Copyright (C) 2017 Matthias Luescher
#
# Authors:
# Matthias Luescher
#
# This file is part of edi.
#
# edi 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... | lueschem/edi | edi/commands/version.py | Python | lgpl-3.0 | 1,351 | 0 |
#!/bin/python
import sys
import vlc
import os
import re
from tempfile import *
from gtts import gTTS
from remote2text import RGBRemote2Text
parser = RGBRemote2Text(verbose=True)
while True:
ir_out = input()
response = parser.process(ir_out)
if response:
tts = gTTS(text=response, lang='pt')
... | Macmod/rgb-remote-tts | remote-gtts/remote2gtts.py | Python | mit | 507 | 0 |
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.db.models import Max, F
from django.shortcuts import render, get_object_or_404, redirect
from django.utils.decorators import method_decorator
from django.views.generic.edit i... | everypony/ponyFiction | ponyFiction/views/chapter.py | Python | gpl-3.0 | 5,461 | 0.001492 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2004-2007 Donald N. Allingham
# Copyright (C) 2010 Brian G. Matherly
# Copyright (C) 2014 Paul Franklin
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publ... | beernarrd/gramps | gramps/gen/display/name.py | Python | gpl-2.0 | 45,844 | 0.004319 |
from .enums import IncrementalSearchDirection
from .filters import SimpleFilter, Never
__all__ = (
'SearchState',
)
class SearchState(object):
"""
A search 'query'.
"""
__slots__ = ('text', 'direction', 'ignore_case')
def __init__(self, text='', direction=IncrementalSearchDirection.FORWARD, ... | ddalex/python-prompt-toolkit | prompt_toolkit/search_state.py | Python | bsd-3-clause | 1,105 | 0.002715 |
"""
This module provides loaders for local file system and over http
local and remote access
"""
import os
import hmac
import urllib
#import urllib2
import requests
import urlparse
import time
import pkg_resources
from io import open, BytesIO
try:
from boto import connect_s3
s3_avail = True
except ImportError... | jcushman/pywb | pywb/utils/loaders.py | Python | gpl-3.0 | 9,733 | 0.002055 |
"""
logitech-m720-config - A config script for Logitech M720 button mappings
Copyright (C) 2017 Fin Christensen <christensen.fin@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 ver... | fin-ger/logitech-m720-config | setup.py | Python | gpl-3.0 | 2,072 | 0.02027 |
import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="family",
parent_name="layout.ternary.aaxis.title.font",
**kwargs
):
super(FamilyValidator, self).__init__(
plotly_name=p... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/ternary/aaxis/title/font/_family.py | Python | mit | 553 | 0 |
"""TailorDev Biblio
Bibliography management with Django.
"""
__version__ = "2.0.0"
default_app_config = "td_biblio.apps.TDBiblioConfig"
| TailorDev/django-tailordev-biblio | td_biblio/__init__.py | Python | mit | 139 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.