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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
from binary_tools.constants import *
from binary_tools.binary import kicks
from binary_tools.binary.orbits import *
import matplotlib.pyplot as plt
from scipy.stats import maxwell
from scipy.integrate import quad
import random as rd
import numpy as np
__author__ = "Kaliroe Pappas"
__credits__ = [... | orlox/binary_tools | binary/tests/test_kicks.py | Python | gpl-3.0 | 32,399 |
import yaml
class BuildTestError(Exception):
"""Class responsible for error handling in buildtest. This is a sub-class
of Exception class."""
def __init__(self, msg, *args):
"""This class is used for printing error message when exception is raised.
:param msg: message to print
:t... | shahzebsiddiqui/BuildTest | buildtest/exceptions.py | Python | gpl-3.0 | 1,473 |
#-----------------------------------------------------------------------------
# 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/protocol/tests/test_receiver.py | Python | bsd-3-clause | 5,446 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-08-01 19:33
from __future__ import unicode_literals
from django.db import migrations, models
from seqr.models import Individual as SeqrIndividual
def reset_invalid_case_review_status(apps, schema_editor):
# We get the model from the versioned app registr... | macarthur-lab/xbrowse | seqr/migrations/0045_auto_20180801_1933.py | Python | agpl-3.0 | 1,427 |
from Crypto import Random
from src.aes import encrypt_message, decrypt_message
def test_integrity():
plaintext = 'Test Text'
key = Random.new().read(16)
# Ensure that D(k, E(k, p)) == p
assert decrypt_message(key, encrypt_message(key, plaintext)) == plaintext
def test_privacy():
plaintext = 'T... | MichaelAquilina/CryptoTools | src/tests/aes_test.py | Python | mit | 561 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-07 12:52
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contests', '0001_initial'),
]
operations = [
migrations.RemoveField(
mo... | owaiswiz/CodeCheck | contests/migrations/0002_remove_contestrecord_contest.py | Python | mit | 391 |
from collections import Counter
from data import DataPoint
import json
import pprint
def load_json_files(datasource_name_and_location, verbose=False):
# Load data into memory (our data is small enough to safely fit in memory)
scraped_pages = {}
for name, filepath in datasource_name_and_location:
w... | npoznans/python_etl | bayes_evening_workshop/Naive_Bayes_Evening_Workshop/datasource.py | Python | mit | 1,461 |
"""
Unit tests for the stem.util.conf class and functions.
"""
import unittest
import stem.util.conf
class TestConf(unittest.TestCase):
def tearDown(self):
# clears the config contents
test_config = stem.util.conf.get_config("unit_testing")
test_config.clear()
test_config.clear_listeners()
def ... | meganchang/Stem | test/unit/util/conf.py | Python | lgpl-3.0 | 7,606 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Wed May 11 00:26:36 2011
# by: The Resource Compiler for PyQt (Qt v4.7.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x01\xbc\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x... | wummel/linkchecker-gui | linkcheck_gui/linkchecker_rc.py | Python | gpl-3.0 | 52,169 |
# -*- coding: utf-8 -*-
"""Here is a very basic handling of accounts.
If you have your own account handling, don't worry,
just switch off account handling in
settings.WIKI_ACCOUNT_HANDLING = False
and remember to set
settings.WIKI_SIGNUP_URL = '/your/signup/url'
SETTINGS.LOGIN_URL
SETTINGS.LOGOUT_URL
"""
from __futur... | jandebleser/django-wiki | src/wiki/views/accounts.py | Python | gpl-3.0 | 4,850 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, with_statement, unicode_literals
from behave import step_registry
from behave.textutil import text as _text
import copy
import difflib
import itertools
import logging
import os.path
import six
from six.moves import zip
import sys
import time
import traceb... | kymbert/behave | behave/model.py | Python | bsd-2-clause | 64,982 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Test the glm utilities.
"""
import numpy as np
from nibabel import load, Nifti1Image, save
from ..glm import GeneralLinearModel, data_scaling, FMRILinearModel
from nipy.io.nibcompat import get_affine... | arokem/nipy | nipy/modalities/fmri/tests/test_glm.py | Python | bsd-3-clause | 11,236 |
import pytest
from numpy.testing import assert_almost_equal
from pyproj.crs import GeographicCRS
from pyproj.crs.coordinate_operation import (
AlbersEqualAreaConversion,
AzumuthalEquidistantConversion,
EquidistantCylindricalConversion,
GeostationarySatelliteConversion,
HotineObliqueMercatorBConvers... | ocefpaf/pyproj | test/crs/test_crs_coordinate_operation.py | Python | isc | 22,662 |
#!/usr/bin/python
import os
import socket
import sys
import random
import threading
import webbrowser
from geventwebsocket.handler import WebSocketHandler
from gevent import pywsgi
import gevent
FILE = 'plot.html'
PORT = 8000
def handle(ws):
if ws.path == '/echo':
while True:
m = ws.wait... | eyllanesc/Arduino | ethernet/web/Server_web.py | Python | mit | 1,858 |
#!/usr/bin/python
######################################################################
# Name: plot_phasespace
# Author: A. Marocchino
# Date: 2017-11-02
# Purpose: plot phase space for architect
# Source: python
#####################################################################
### loa... | albz/Architect | utils/python_utils/general_plot_utilities/plot_phasespace.py | Python | gpl-3.0 | 2,234 |
from aiorm import orm
class Table:
def __init__(self, **kwargs):
for key, val in kwargs.items():
if not hasattr(self.__class__, key):
raise RuntimeError('Column {} not declared')
setattr(self, key, val)
def __repr__(self):
return '<Table {} #{}>'.form... | mardiros/aiorm | aiorm/tests/fixtures/sample.py | Python | bsd-3-clause | 2,559 |
def init_actions_(service, args):
"""
this needs to returns an array of actions representing the depencies between actions.
Looks at ACTION_DEPS in this module for an example of what is expected
"""
return {
'test': ['install']
}
def init(job):
service = job.service
repo = serv... | Jumpscale/ays_jumpscale8 | tests/test_services/test_network_configuration/actions.py | Python | apache-2.0 | 6,909 |
# -*- coding: utf-8 -*-
class WechatSogouBase(object):
"""基于搜狗搜索的的微信公众号爬虫接口 基类
"""
pass
| kiruto/Weixin-Article-Spider | wechatsogou/base.py | Python | gpl-3.0 | 140 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0015_auto_20151215_1531'),
]
operations = [
migrations.RenameField(
model_name='experiment',
... | niekas/dakis | dakis/core/migrations/0016_auto_20151215_1534.py | Python | agpl-3.0 | 400 |
"""
:codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>`
"""
import pytest
import salt.states.nexus as nexus
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {nexus: {}}
def test_downloaded():
"""
Test to ensures that the artifact from ne... | saltstack/salt | tests/pytests/unit/states/test_nexus.py | Python | apache-2.0 | 1,201 |
"""
File extension / MIME content-type mapping table.
Converted from:
http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
(excluding vnd. tree types)
"""
# NOTE:
# For some reason, this file raises a syntax error when used with Python 2.6 on Linux.
# 2.7 os OK, though.
from __future__ import unico... | gklyne/annalist | src/annalist_root/miscutils/FileMimeTypes.py | Python | mit | 22,676 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2017 Roberto Alsina and others.
# 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 t... | andredias/nikola | nikola/plugins/command/bootswatch_theme.py | Python | mit | 4,564 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Common/Shared code related to the Settings dialog
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.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 Softw... | falkTX/Cadence | src/shared_settings.py | Python | gpl-2.0 | 12,056 |
from django.core.management.base import LabelCommand
from django_countries.data import COUNTRIES
from corehq.apps.domain.models import Domain
class Command(LabelCommand):
help = "Migrates old django domain countries from string to list. Sept 2014."
args = ""
label = ""
def handle(self, *args, **option... | puttarajubr/commcare-hq | corehq/apps/domain/management/commands/migrate_domain_countries.py | Python | bsd-3-clause | 1,890 |
""" Django admin pages for student app """
from functools import wraps
from config_models.admin import ConfigurationModelAdmin
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.sites import NotRegistered
from django.contrib.admin.utils import unquote... | appsembler/edx-platform | common/djangoapps/student/admin.py | Python | agpl-3.0 | 21,267 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2018 David Arroyo Menéndez
# Author: David Arroyo Menéndez <davidam@gnu.org>
# Maintainer: David Arroyo Menéndez <davidam@gnu.org>
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... | davidam/python-examples | nlp/gensim/quick-example.py | Python | gpl-3.0 | 1,552 |
#! /usr/bin/env python
"""
Main execution script for fMRI analysis in the Lyman ecosystem.
"""
import os
# Needed currently to avoid crash in model code
# Also nipype parallelism doesn't play well with this
os.environ["MKL_NUM_THREADS"] = "1"
import sys
import shutil
import os.path as op
from textwrap import dedent
... | tuqc/lyman | scripts/run_fmri.py | Python | bsd-3-clause | 23,212 |
#!/usr/bin/env python3
"""
bootstrap.py will set up a virtualenv for you and update it as required.
Usage:
bootstrap.py # update virtualenv
bootstrap.py fake # just update the virtualenv timestamps
bootstrap.py clean # delete the virtualenv
bootstrap.py -h | --help # p... | oriel-hub/api | deploy/bootstrap.py | Python | gpl-2.0 | 2,753 |
"""
WSGI config for libre_time project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "libre_time.settings")
from django.... | burke-software/libre_time | libre_time/wsgi.py | Python | gpl-3.0 | 395 |
#!/usr/bin/python
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 appl... | sarvesh-ranjan/swift | test/functional/test_container.py | Python | apache-2.0 | 57,148 |
import doctest
import pytest
from insights.parsers import max_uid, ParseException, SkipException
from insights.parsers.max_uid import MaxUID
from insights.tests import context_wrap
def test_max_uid():
with pytest.raises(SkipException):
MaxUID(context_wrap(""))
with pytest.raises(ParseException):
... | RedHatInsights/insights-core | insights/parsers/tests/test_max_uid.py | Python | apache-2.0 | 635 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.osv import fields, osv
class product_template(osv.osv):
_inherit = "product.template"
def _bom_orders_count(self, cr, uid, ids, field_name, arg, context=None):
Bom = self.pool('mrp.bom')
... | vileopratama/vitech | src/addons/mrp/product.py | Python | mit | 3,210 |
print "How old are you?",
age = raw_input()
print "How tall are you?",
height = raw_input()
print "How much do you weigh?",
weight = raw_input()
print "So, you're %r old, %r tall and %r heavy." % (age, height, weight) | chrisortman/CIS-121 | ipwth/ex6.py | Python | mit | 218 |
# Generated by Django 1.11.3 on 2018-01-25 18:36
import django.db.models.deletion
import django_extensions.db.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0007_auto_20171004_1133'),
('publisher', '0063_auto_20171219_1841'),
... | edx/course-discovery | course_discovery/apps/publisher/migrations/0064_auto_20180125_1836.py | Python | agpl-3.0 | 2,112 |
from flask import (
render_template,
)
from notifications_python_client.errors import HTTPError
from app.main import main
from app.main.forms import ForgotPasswordForm
from app import user_api_client
@main.route('/forgot-password', methods=['GET', 'POST'])
def forgot_password():
form = ForgotPasswordForm()
... | gov-cjwaszczuk/notifications-admin | app/main/views/forgot_password.py | Python | mit | 760 |
# eliteBonusGunshipArmorExplosiveResistance1
#
# Used by:
# Ship: Vengeance
type = "passive"
def handler(fit, ship, context):
fit.ship.boostItemAttr("armorExplosiveDamageResonance", ship.getModifiedItemAttr("eliteBonusGunship1"),
skill="Assault Frigates")
| Ebag333/Pyfa | eos/effects/elitebonusgunshiparmorexplosiveresistance1.py | Python | gpl-3.0 | 289 |
from lxml import etree
import sys
from chatbot.core import Chatbot
class ReadChatbotDefinitionException(Exception):
def __init__(self, message):
self.message = message
def load(filename,context={}):
c = Chatbot(context=context)
c.load(filename)
return c
'''
try:
parser = etree.XMLParser()
... | rdorado79/chatbotlib | chatbot/loader.py | Python | mit | 1,057 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Clear Groups for Odoo
# Copyright (C) 2016 Bytebrand GmbH (<http://www.bytebrand.net>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser ... | mohamedhagag/community-addons | hr_employee_time_clock/models/hr_timesheet_dh.py | Python | agpl-3.0 | 14,162 |
from ..group import GROUP_ATTR_DEFAULTS
from ..utils.text import bold, mark_for_translation as _
from ..utils.ui import io
from .nodes import _attribute_table
GROUP_ATTRS = sorted(list(GROUP_ATTR_DEFAULTS) + ['nodes'])
GROUP_ATTRS_LISTS = ('nodes',)
def bw_groups(repo, args):
if not args['groups']:
for ... | bundlewrap/bundlewrap | bundlewrap/cmdline/groups.py | Python | gpl-3.0 | 953 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013, Big Switch Networks, 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/... | neumerance/deploy | openstack_dashboard/dashboards/project/firewalls/views.py | Python | apache-2.0 | 10,365 |
#! /usr/bin/env python
# This script is taken from Django Rest Framework
# (https://github.com/tomchristie/django-rest-framework/blob/master/runtests.py)
from __future__ import print_function
import os
import subprocess
import sys
import pytest
PYTEST_ARGS = {
"default": ["tests", "--tb=short", "-s", "-rw"],
... | ArabellaTech/universal_notifications | runtests.py | Python | mit | 3,526 |
class OAuthRequestTokenMixin(object):
oauth_request_endpoint = 'https://www.google.com/accounts/OAuthGetRequestToken'
oauth_callback = None
def get_oauth_callback(self):
if self.oauth_callback:
url = self.oauth_callback
else:
raise ImproperlyConfigured('Provide o... | allanlei/django-openauth | openauth/oauth/providers/google.py | Python | bsd-3-clause | 956 |
#
# _libtorrent.py
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
# Deluge is free software.
#
# You may redistribute it and/or modify it under the terms of the
# GNU General Public License, as published by the Free Software
# Foundation; either version 3 of the License, or (at your option)
# any later v... | voltaicsca/deluge | deluge/_libtorrent.py | Python | gpl-3.0 | 2,017 |
# May you do good and not evil
# May you find forgiveness for yourself and forgive others
# May you share freely, never taking more than you give. -- SQLite source code
#
# As we enjoy great advantages from the inventions of others, we should be glad
# of an opportunity to serve others by an invention of ours, and thi... | Sunzhifeng/peewee | peewee.py | Python | mit | 154,702 |
#!/usr/bin/python
import os
import logging
logging.basicConfig(level=logging.ERROR)
import json
import gzip
import base64
import web
# own modules
import tk_web
from CustomExceptions import *
from DataLogger import DataLogger as DataLogger
from TimeseriesStats import TimeseriesStats as TimeseriesStats
urls = (
"/... | gunny26/datalogger | datalogger/DataLoggerWebApp3.py | Python | apache-2.0 | 13,645 |
# coding=utf-8
from django.db import models
from videoclases.models.evaluation.criteria import Criteria
class CriteriaResponse(models.Model):
value = models.DecimalField(max_digits=10, decimal_places=3)
criteria = models.ForeignKey(Criteria)
def __str__(self):
return "{0}, valor: {1}".format(sel... | Videoclases/videoclases | videoclases/models/evaluation/criteria_response.py | Python | gpl-3.0 | 462 |
################################################################################
# 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... | greghogan/flink | flink-python/pyflink/table/tests/test_calc.py | Python | apache-2.0 | 8,853 |
# -*- coding: utf-8 -*-
import json
from cli_common.log import get_logger
from cli_common.pulse import create_consumer
from cli_common.taskcluster import get_service
from pulselistener import task_monitoring
logger = get_logger(__name__)
class Hook(object):
'''
A taskcluster hook, used to build a task
'... | lundjordan/services | src/pulselistener/pulselistener/hook.py | Python | mpl-2.0 | 3,063 |
#!/usr/bin/env python
#
# Copyright (c) Greenplum Inc 2008. All Rights Reserved.
#
"""
TODO: module docs
"""
import sys
import os
import stat
try:
from pygresql import pgdb
from gppylib.commands.unix import UserId
except ImportError, e:
sys.exit('Error: unable to import module: ' + str(e))
from gppylib i... | edespino/gpdb | gpMgmt/bin/gppylib/db/dbconn.py | Python | apache-2.0 | 9,237 |
from django import forms
from django.contrib.admin.forms import AdminAuthenticationForm
class CustomAdminAuthenticationForm(AdminAuthenticationForm):
def clean_username(self):
username = self.cleaned_data.get('username')
if username == 'customform':
raise forms.ValidationError('custom ... | mzdaniel/oh-mainline | vendor/packages/Django/tests/regressiontests/admin_views/forms.py | Python | agpl-3.0 | 357 |
import importlib
from admino.serializers import FormSerializer
from django.forms import BaseForm
from django.utils.functional import Promise
from django.utils.encoding import force_unicode
def import_from_string(module_path):
"""
Attempt to import a class from a string representation.
"""
try:
... | erdem/django-admino | admino/utils.py | Python | mit | 665 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('ossuo', '0007_auto_20150326_1142'),
]
operations = [
migrations.AlterField(
mod... | spketoundi/CamODI | waespk/core/migrations/0008_wagtailimage_verbosename_changes.py | Python | mit | 1,236 |
#!/usr/bin/env python3
"""Example for aiohttp.web basic server
with table definition for routes
"""
import textwrap
from aiohttp import web
async def intro(request):
txt = textwrap.dedent("""\
Type {url}/hello/John {url}/simple or {url}/change_body
in browser url bar
""").format(url='127.0.... | arthurdarcet/aiohttp | examples/web_srv_route_table.py | Python | apache-2.0 | 1,408 |
import functools
import gc
import gevent
import logging
import pymongo
from pymongo.errors import AutoReconnect, ConnectionFailure, OperationFailure, TimeoutError
import signal
import sys
loggers = {}
def get_logger(name):
"""
get a logger object with reasonable defaults for formatting
@param name used to... | gitkewl/hydra | utils.py | Python | bsd-2-clause | 8,735 |
import os
from django.template import Context, Engine, TemplateDoesNotExist
from django.template.loader_tags import ExtendsError
from django.template.loaders.base import Loader
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango21Warning
from .utils import ROOT... | denis-pitul/django | tests/template_tests/test_extends.py | Python | bsd-3-clause | 7,062 |
clouthes = ["T-Shirt","Sweater"]
print("Hello, welcome to my shop\n")
while (True):
comment = input("Welcome to our shop, what do you want (C, R, U, D)? ")
if comment.upper()=="C":
new_item = input("Enter new item: ")
clouthes.append(new_item.capitalize())
elif comment.upper()=="R":
print(end='')
elif comment... | hanamvu/C4E11 | SS3/clothes_shop.py | Python | gpl-3.0 | 1,117 |
from __future__ import unicode_literals
from django.test import TestCase
from .models import Flea, House, Person, Pet, Room
class UUIDPrefetchRelated(TestCase):
def test_prefetch_related_from_uuid_model(self):
Pet.objects.create(name='Fifi').people.add(
Person.objects.create(name... | yephper/django | tests/prefetch_related/test_uuid.py | Python | bsd-3-clause | 4,869 |
from __future__ import absolute_import
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
class User(models.Model):
name = models.TextField()
last_name = models.TextField()
groups = models.ManyToManyField... | AltSchool/dynamic-rest-client | tests/models.py | Python | mit | 2,837 |
#!/usr/bin/env python
''' ISEG VDS HV power supply control '''
import struct
import pynetvme as net_pvme
import pyusbvme as usb_pvme
from iseg_VHS_regs import *
def build_reg(*args):
val= 0
for i in args:
val|= i
return val
def s2_to_f(val):
s = struct.pack('=HH', val[1], val[0])
retu... | andalexo/bgv | vme_trig/Iseg_VHS.py | Python | mit | 13,989 |
# Copyright 2012 OpenStack Foundation
#
# 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... | klmitch/keystone | keystone/token/provider.py | Python | apache-2.0 | 25,492 |
import sys
import MySQLdb
"""
This file contains the scripts for migrating the old Zeeguu database to the new version for this project.
"""
"""
For now fixed code for the below information of database
"""
host = "localhost"
database = 'zeeguu_test'
user = "root"
password = "12345678"
def main():
"""
This co... | mircealungu/Zeeguu-Core | tools/migrations/teacher_dashboard_migration_1/upgrade.py | Python | mit | 3,594 |
from base import Task
from common import phases
from common.tasks.packages import InstallPackages
from common.exceptions import TaskError
class CheckGuestAdditionsPath(Task):
description = 'Checking whether the VirtualBox Guest Additions image exists'
phase = phases.preparation
@classmethod
def run(cls, info):
... | brianspeir/Vanilla | vendor/bootstrap-vz/providers/virtualbox/tasks/guest_additions.py | Python | bsd-3-clause | 2,179 |
# -*- coding: utf-8 -*-
"""
chemspipy.objects
~~~~~~~~~~~~~~~~~
Objects returned by ChemSpiPy API methods.
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import warnings
from .utils import memoized_property
class Compound(object):
""" A class... | mcs07/ChemSpiPy | chemspipy/objects.py | Python | mit | 5,218 |
import os
import bz2
def split_xml(filename):
''' The function gets the filename of wiktionary.xml.bz2 file as input and creates
smallers chunks of it in a the diretory chunks
'''
# Check and create chunk diretory
if not os.path.exists("chunks"):
os.mkdir("chunks")
# Counters
pagec... | Hunsu/WikiBot | WikiBot/splitXML.py | Python | gpl-3.0 | 1,234 |
#!/usr/bin/python
from random import randint
from time import sleep
d = open('guess_score.txt', 'a+')
f = open('guess_score.txt', 'a+')
highscore = f.read()
f.close()
if (not str(highscore)):
highscore = 0
print("===== Guess 1.0 =====")
print("I have a number from 0 to 100 in my mind.")
print("High Score: " + str(hi... | koyuawsmbrtn/guess | guess.py | Python | gpl-2.0 | 834 |
import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="family",
parent_name="scatterpolargl.marker.colorbar.tickfont",
**kwargs
):
super(FamilyValidator, self).__init__(
plotl... | plotly/python-api | packages/python/plotly/plotly/validators/scatterpolargl/marker/colorbar/tickfont/_family.py | Python | mit | 607 |
import _plotly_utils.basevalidators
class ZValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="z", parent_name="densitymapbox", **kwargs):
super(ZValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_ty... | plotly/plotly.py | packages/python/plotly/plotly/validators/densitymapbox/_z.py | Python | mit | 387 |
#!/usr/bin/env python
# Copyright (C) 2017 Francisco Acosta <francisco.acosta@inria.fr>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import os
import sys
sys.path.append(os.path.join(os.enviro... | dailab/RIOT | tests/xtimer_usleep/tests/01-run.py | Python | lgpl-2.1 | 1,745 |
from InstagramAPI.src.http.Response.Objects.User import User
from .Response import Response
class autoCompleteUserListResponse(Response):
def __init__(self, response):
self.expires = None
self.users = None
if self.STATUS_OK == response['status']:
self.expires = response['expi... | danleyb2/Instagram-API | InstagramAPI/src/http/Response/autoCompleteUserListResponse.py | Python | mit | 676 |
from django.conf import settings
DJANGO_DATA_SYNC_SETTINGS = getattr(settings, 'DJANGO_DATA_SYNC', {})
NOTIFICATIONS_SETTINGS = {
'function': DJANGO_DATA_SYNC_SETTINGS.get('NOTIFICATIONS', {}).get('function'),
'usernames': DJANGO_DATA_SYNC_SETTINGS.get('NOTIFICATIONS', {}).get('usernames', []),
'groups_n... | vittoriozamboni/django-data-sync | django_data_sync/settings.py | Python | mit | 1,025 |
try:
# Python 3 imports
from urllib.error import URLError
from urllib.parse import urlencode
from urllib.request import urlopen
except ImportError:
# Python 2 imports
from urllib import urlencode
from urllib2 import URLError
from urllib2 import urlopen
import errno
import json
from cont... | ericdwang/pybart | pybart/api.py | Python | bsd-3-clause | 5,348 |
"""Define constants for the SimpliSafe component."""
from datetime import timedelta
DOMAIN = "simplisafe"
DATA_CLIENT = "client"
DEFAULT_SCAN_INTERVAL = timedelta(seconds=30)
TOPIC_UPDATE = "update"
| fbradyirl/home-assistant | homeassistant/components/simplisafe/const.py | Python | apache-2.0 | 203 |
from django.db import connection
from django.db.backends.base.introspection import BaseDatabaseIntrospection
from django.test import SimpleTestCase
class SimpleDatabaseIntrospectionTests(SimpleTestCase):
may_require_msg = (
'subclasses of BaseDatabaseIntrospection may require a %s() method'
)
def... | theo-l/django | tests/backends/base/test_introspection.py | Python | bsd-3-clause | 1,705 |
"""Tests for 'site'.
Tests assume the initial paths in sys.path once the interpreter has begun
executing have not been removed.
"""
import unittest
import test.support
from test.support import captured_stderr, TESTFN, EnvironmentVarGuard
import builtins
import os
import sys
import re
import encodings
import urllib.re... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.5.9/Python-3.5.9/Lib/test/test_site.py | Python | apache-2.0 | 19,655 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@... | ghtmtt/QGIS | python/plugins/db_manager/db_plugins/postgis/info_model.py | Python | gpl-2.0 | 12,237 |
# Tcp Chat server
import socket, select
#Function to broadcast chat messages to all connected clients
def broadcast_data (sock, message):
#Do not send the message to master socket and the client who has send us the message
for socket in CONNECTION_LIST:
if socket != server_socket and socket != sock :
... | zengchunyun/s12 | day5/char.py | Python | gpl-2.0 | 2,535 |
from openerp.osv import fields, osv
import os, inspect, subprocess, shutil
class server_general(osv.osv):
_name = 'server.general'
def action_start_server_all(self, cr, uid, ids, context=None):
currentPath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
absf... | jmesteve/saas3 | openerp/addons_extra/server_manager/server_general.py | Python | agpl-3.0 | 1,620 |
# Generated by Django 2.2.10 on 2020-03-27 09:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('confirmation', '0006_realmcreationkey_presume_email_valid'),
]
operations = [
migrations.AlterField(
model_name='confirmation',... | showell/zulip | confirmation/migrations/0007_add_indexes.py | Python | apache-2.0 | 1,139 |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
import requests
def query(params, lang='en'):
"""
Simple Mediawiki API wrapper
"""
url = 'https://%s.wikipedia.org/w/api.php' % lang
finalparams = {
'action': 'query',
'format': 'json',
}
finalparams.update(params)
resp =... | bfontaine/wptranslate | wptranslate/mediawiki.py | Python | mit | 477 |
import _plotly_utils.basevalidators
class ShowgridValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(self, plotly_name="showgrid", parent_name="layout.xaxis", **kwargs):
super(ShowgridValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/layout/xaxis/_showgrid.py | Python | mit | 452 |
# -*- coding: utf-8 -*-
import cv2
img1 = cv2.imread('image-1.jpg')
img2 = cv2.imread('image-2.jpg')
img3 = cv2.imread('image-3.jpg')
img4 = cv2.imread('image-4.jpg')
img5 = cv2.vconcat([img1, img2])
img6 = cv2.vconcat([img3, img4])
img7 = cv2.hconcat([img5, img6])
cv2.imwrite('output.jpg', img7)
| karaage0703/python-image-processing | photo_cat.py | Python | mit | 300 |
"""Django Endless Pagination Vue documentation build configuration file."""
from __future__ import unicode_literals
AUTHOR = 'Francesco Banconi and Martin Peveri'
APP = 'Django Endless Pagination Vue'
TITLE = APP + ' Documentation'
VERSION = '1.0'
# Add any Sphinx extension module names here, as strings. They can ... | mapeveri/django-endless-pagination-vue | doc/conf.py | Python | mit | 1,929 |
import logging
from enum import Enum
from importlib.util import module_from_spec, spec_from_file_location
from pathlib import Path
from types import FunctionType
from typing import Optional
from jinja2 import pass_context, pass_environment, pass_eval_context
from pydantic import BaseModel, ValidationError
from .commo... | samuelcolvin/harrier | harrier/extensions.py | Python | mit | 7,622 |
import serial
from mock import patch
from ..core.Threadable import Threadable
from ..trajectory.Servo import Servo
from vehicle_robot_vehicle import RobotVehicleTestCase
class TestVehicleRobotVehicleArduino(RobotVehicleTestCase):
def setUp(self):
self.set_arguments([
"--motor-speed-pwms", "0", ... | timvandermeij/mobile-radio-tomography | tests/vehicle_robot_vehicle_arduino.py | Python | gpl-3.0 | 3,366 |
# -*- coding: utf-8 -*-
# Copyright 2017 - 2021 Avram Lubkin, All Rights Reserved
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
**Enlighten manager submodule**
... | Rockhopper-Technologies/enlighten | enlighten/_manager.py | Python | mpl-2.0 | 11,023 |
#!/home/jt/code/armyguys/venv/bin/python3.4
# $Id: rst2xetex.py 7038 2011-05-19 09:12:02Z milde $
# Author: Guenter Milde
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing XeLaTeX source code.
"""
try:
import locale
locale.setlocale(lo... | jtpaasch/armyguys | venv/bin/rst2xetex.py | Python | mit | 811 |
from rest_framework import serializers
from .models import Rate
class RateSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Rate
fields = ('date', 'eur_rate', 'gbp_rate')
| Hawk94/coin_tracker | main/rates/serializers.py | Python | mit | 216 |
from __future__ import absolute_import
import os
import time
from math import pi
import numpy as nm
from sfepy.base.base import Struct, output, get_default
from sfepy.applications import PDESolverApp
from sfepy.solvers import Solver
from six.moves import range
def guess_n_eigs(n_electron, n_eigs=None):
"""
G... | lokik/sfepy | sfepy/physics/schroedinger_app.py | Python | bsd-3-clause | 7,582 |
#!/usr/bin/env python
#
# Copyright 2008-2009 Jose Fonseca
#
# This program 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 option) any later version.
#
# ... | tlecomte/friture | scripts/gprof2dot.py | Python | gpl-3.0 | 71,118 |
import bpy
from bpy.props import StringProperty
class AdvancedSettings(bpy.types.Operator):
bl_idname = "coa_tools.advanced_settings"
bl_label = "Advanced Settings"
bl_description = ""
bl_options = {"REGISTER","UNDO"}
obj_name = StringProperty()
@classmethod
def poll(c... | ndee85/coa_tools | Blender/coa_tools/operators/advanced_settings.py | Python | gpl-3.0 | 4,663 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("RandomForestRegressor" , "diabetes" , "sqlite")
| antoinecarme/sklearn2sql_heroku | tests/regression/diabetes/ws_diabetes_RandomForestRegressor_sqlite_code_gen.py | Python | bsd-3-clause | 137 |
"""
Path to various datasets
Need to clean up once the package is well rewritten
"""
from os import getenv
from os.path import join
# This should be moved to __inti__.py in the future
_parent_path = getenv('ASTRODATA', '/Users/Benjamin/AstroData')
# HSTFOS
def hstfos_path():
"""Path to HST FOS data
"""
r... | guangtunbenzhu/BGT-Cosmology | Spectroscopy/datapath.py | Python | mit | 1,350 |
from args import *
from model import *
import rnn
import treelstm
from util import *
| robinjia/nectar | nectar/theanoutil/__init__.py | Python | mit | 85 |
#!/usr/bin/python3
import libdivvun
spec = libdivvun.ArCheckerSpec("sme.zcheck")
smegram = spec.getChecker("smegram", True)
def test(got, want):
if got != want:
print("Wanted '{}' but got '{}'".format(want, got))
assert(got == want)
inp = "ja seammas ballat ođđa dieđuiguin"
for _ in range(1, 1... | divvun/divvun-gramcheck | test/checker/test-python-bindings.py | Python | gpl-3.0 | 593 |
#!/usr/bin/env python
# OpenCenter(TM) is Copyright 2013 by Rackspace US, Inc.
##############################################################################
#
# OpenCenter is licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.... | rcbops/opencenter-client | setup.py | Python | apache-2.0 | 2,240 |
# -*- coding: utf-8 -*-
import sys
import os
import watson_developer_cloud
sys.path.insert(0, os.path.abspath('../watson_developer_cloud/'))
from recommonmark.parser import CommonMarkParser
source_parsers = {
'.md': CommonMarkParser
}
# -- General configuration ------------------------------------------------
... | semplea/characters-meta | python/alchemy/docs/conf.py | Python | mit | 9,085 |
import sys
import re
import socket
from urllib2 import urlopen, Request, URLError, HTTPError
from urllib import quote, quote_plus, urlencode
from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
socket.setdefaulttimeout(15)
class Search:
def __init__(self):
return NotImplemented
def search(terms... | correl/Transmission-XBMC | resources/lib/search.py | Python | mit | 7,795 |
import sys, string
import pythoncom
import win32api
from win32com.adsi import *
verbose_level = 0
server = '' # Must have trailing /
local_name = win32api.GetComputerName()
def DumpRoot():
"Dumps the root DSE"
path = "LDAP://%srootDSE" % server
rootdse = ADsGetObject(path)
for item in rootdse.Get("SupportedLDA... | leighpauls/k2cro4 | third_party/python_26/Lib/site-packages/win32comext/adsi/demos/test.py | Python | bsd-3-clause | 7,239 |
#!/usr/bin/env python
#
# Copyright (c) Greenplum Inc 2009. All Rights Reserved.
#
# This is a private script to be called by gpaddconfig
# The script is executed on a single machine and gets a list of data directories to modify from STDIN
# With the script you can either change the value of a setting (and comment out... | zhangh43/incubator-hawq | tools/sbin/gpaddconfig.py | Python | apache-2.0 | 2,748 |
# coding: utf-8
from __future__ import print_function
import os
import numpy as np
import time
np.random.seed(1337)
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.utils.np_utils import to_categorical
from keras.layers import Dense, Flatten, Activation
... | irisliu0616/Short-text-Classification | Model/20News/20news_SVM.py | Python | mit | 8,631 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.