code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
Hardware file for the Superconducting Magnet (SCM)
QuDi is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QuDi is... | tobiasgehring/qudi | hardware/sc_magnet/magnet.py | Python | gpl-3.0 | 62,977 |
# -*- coding: utf-8 -*-
#
# codimension - graphics python two-way code editor and analyzer
# Copyright (C) 2010-2017 Sergey Satskiy <sergey.satskiy@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 Softw... | SergeySatskiy/codimension | codimension/utils/searchenv.py | Python | gpl-3.0 | 7,260 |
"""
This contains all error handling functions for the
logistic Environment Module.
"""
class Error(Exception):
"""Base class for exceptions in this module."""
pass
class ActionNotAList(Error):
"""Exception raised when goal is not plausible."""
def __str__(self):
return "Actions p... | MircoT/AI-Project-PlannerEnvironment | agents_dir/errorObjs.py | Python | mit | 1,779 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import django_countries.fields
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [migrations.swappable_dependency(settings.AUT... | rapidpro/ureport | ureport/countries/migrations/0001_initial.py | Python | agpl-3.0 | 2,161 |
'''
python src/train.py \
--train_dir=/raid/pengchong_data/tfmodel_test/ \
--dataset_dir=/raid/pengchong_data/Data/VOC/VOCdevkit/TFRecords/2007 \
--max_number_of_steps=100 \
--batch_size=2
'''
import os
import tensorflow as tf
from datasets import dataset_factory
from nets import nets_factory, yolo_v... | PaulChongPeng/YOLO2TensorFlow | src/train.py | Python | apache-2.0 | 11,468 |
"""
A Cobbler Profile. A profile is a reference to a distribution, possibly some kernel options, possibly some Virt options, and some kickstart data.
Copyright 2006-2008, Red Hat, Inc
Michael DeHaan <mdehaan@redhat.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GN... | rubenk/cobbler | cobbler/item_profile.py | Python | gpl-2.0 | 18,189 |
def encrypt(data, key):
data = data.upper()
result = ""
for char in data:
char_possition = ord(char)
char_new_possition = char_possition + key
if char_new_possition > 90:
char_new_possition -= 26
result += chr(char_new_possition)
return result
def decryp... | wilima/cryptography | cryptography/ciphers/shift.py | Python | mit | 770 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | QiJune/Paddle | python/paddle/fluid/tests/unittests/test_data_balance.py | Python | apache-2.0 | 8,145 |
import datetime
import boto.ec2
import boto.ec2.cloudwatch
import boto.ec2.autoscale
import boto.ses
from boto.ec2.autoscale import LaunchConfiguration, AutoScalingGroup
from boto.ec2.autoscale.tag import Tag
import boto.utils
from juliabox.plugins.compute_ec2 import CompEC2
from juliabox.jbox_util import LoggerMixin... | mdpradeep/JuliaBox | engine/src/juliabox/plugins/compute_ec2/awscluster.py | Python | mit | 10,721 |
# -*- coding: utf-8 -*-
import six
def isnum(data):
return isinstance(data, six.integer_types + (float,))
def isucode(data):
return isinstance(data, six.text_type)
def ucode(data, *args, **kwargs):
if isinstance(data, six.binary_type):
return data.decode(*args, **kwargs)
return data
| atzm/amazonas | amazonas/util/compat.py | Python | bsd-2-clause | 315 |
"""empty message
Revision ID: 6d8e9e4138bf
Revises: 445667ce6268
Create Date: 2016-03-03 10:36:03.205829
"""
# revision identifiers, used by Alembic.
revision = '6d8e9e4138bf'
down_revision = '445667ce6268'
from alembic import op
import app
import sqlalchemy as sa
def upgrade():
### commands auto generated by... | Maethorin/concept2 | migrations/versions/6d8e9e4138bf_.py | Python | mit | 760 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | eaplatanios/tensorflow | tensorflow/compiler/xla/python/xla_client.py | Python | apache-2.0 | 43,463 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-13 09:33
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('questionnaires', '0001_initial'),
]
operations = [
migrations.RenameModel(
... | warrenatmindset/DjangoFlowApp | questionnaires/migrations/0002_auto_20171113_0933.py | Python | mit | 440 |
from django.contrib.staticfiles.storage import StaticFilesStorage
from pipeline.storage import PipelineMixin
from storages.backends.s3boto import S3BotoStorage
class S3PipelineStorage(PipelineMixin, S3BotoStorage):
pass
class PipelineStorage(PipelineMixin, StaticFilesStorage):
pass | smallmultiples/smu-storage | __init__.py | Python | mit | 292 |
from typing import Optional, Callable
from slack_sdk.socket_mode.request import SocketModeRequest
class AsyncWebSocketMessageListener(Callable):
async def __call__(
client: "AsyncBaseSocketModeClient", # noqa: F821
message: dict,
raw_message: Optional[str] = None,
): # noqa: F821
... | slackhq/python-slackclient | slack_sdk/socket_mode/async_listeners.py | Python | mit | 580 |
import os
import subprocess
from collections import defaultdict
from datetime import datetime
import csv
from csv import DictReader
import math
from glob import glob
# Data locations
loc_train = "../data/train.csv"
loc_test = "../data/test.csv"
loc_labels = "../data/trainLabels.csv"
loc_best = "test.pred2... | timpalpant/KaggleTSTextClassification | others/tradeshift.py | Python | gpl-3.0 | 4,544 |
#!/usr/bin/env python
"""
Manipulates MacOS alias records.
"""
from classicbox.alias.record import Extra
from classicbox.alias.record import print_alias_record
from classicbox.alias.record import read_alias_record
from classicbox.alias.record import write_alias_record
from classicbox.io import BytesIO
import sys
de... | davidfstr/ClassicBox | alias_record.py | Python | gpl-2.0 | 3,197 |
from django.test import TestCase
from django.utils import timezone
from rest_framework_json_api.utils import format_relation_name
from rest_framework_json_api.serializers import ResourceIdentifierObjectSerializer
from example.models import Blog, Entry, Author
class TestResourceIdentifierObjectSerializer(TestCase):
... | hnakamur/django-rest-framework-json-api | example/tests/test_serializers.py | Python | bsd-2-clause | 2,803 |
#-*- coding:utf-8 -*-
'''
Linear Aggregation
NOTE: x_label should be `m * n` dataset.
'''
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
def linear_aggregation(dataset, x_test):
y_label = np.array([float(i) for i in dataset])
x_label = np.linspace(1, y_la... | Justontheway/data-science | python/regression/LinearAggregation.py | Python | apache-2.0 | 1,234 |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
class TermNotStarted(Exception):
pass
| uw-it-aca/canvas-analytics | data_aggregator/exceptions.py | Python | apache-2.0 | 131 |
# -*- coding: utf-8 -*-
##############################################################################
#
# ______ Releasing children from poverty _
# / ____/___ ____ ___ ____ ____ ___________(_)___ ____
# / / / __ \/ __ `__ \/ __ \/ __ `/ ___/ ___/ / __ \/ __ \
# / /___/ /_/ / / / / / / /_/... | ecino/compassion-switzerland | website_event_compassion/__manifest__.py | Python | agpl-3.0 | 3,522 |
#!/usr/bin/python
import picamera
import RPi.GPIO as GPIO
from LocalVariables import takepicture
camera = picamera.PiCamera()
def TakePicture():
camera.capture('image.jpg')
print('Picture Taken')
| Multipixelone/BlindRemote | TakePicture.py | Python | gpl-3.0 | 207 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0007_remove_post_post_num'),
]
operations = [
migrations.RemoveField(
model_name='post',
name... | paramsingh/backpage | app/migrations/0008_auto_20150117_2249.py | Python | mit | 457 |
#-*- encoding:utf-8 -*-
'''
Created on Dec 1, 2014
@author: letian
'''
import networkx as nx
from Segmentation import Segmentation
import numpy as np
import math
class TextRank4Sentence(object):
def __init__(self, stop_words_file = None, delimiters='?!;?!。;…\n'):
'''
`stop_words_file`:默认值为None... | MSC19950601/TextRank4ZH | textrank4zh/TextRank4Sentence.py | Python | mit | 6,656 |
# mysql/reflection.py
# Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import re
from ... import log, util
from ... import types as sqltypes
from .enum... | Haynie-Research-and-Development/jarvis | deps/lib/python3.4/site-packages/sqlalchemy/dialects/mysql/reflection.py | Python | gpl-2.0 | 16,703 |
print ("Welcome To Aboyun App")
print ("We are here to help you have a healthy pregnancy. :) ")
firsttrimester=["Nausea","Morning Sickness", "strange food cravings", "Unusual tiredness"]
secondtrimester=["swelling of feet or hands","dizziness","skin changes"]
thirdtrimester=["false labour contractions,back ache","bleed... | markessien/aboyun | aboyun.py | Python | mit | 891 |
"""Handles all processes to clouds.
The :py:class:`WorkerManager` class is a :py:class:`jacket.manager.Manager` that
handles RPC calls relating to creating instances. It is responsible for
building a disk image, launching it via the underlying virtualization driver,
responding to calls to check its state, attaching p... | HybridF5/jacket | jacket/worker/manager.py | Python | apache-2.0 | 4,440 |
from setuptools import setup, find_packages
def readme():
with open('./README.rst') as f:
return f.read()
setup(name='pInteServ',
version='0.131',
description='Module and cli for client/server directory sync.',
long_description=readme(),
url='https://github.com/paulcrook726/PiClou... | paulcrook726/pInteServ | src/setup.py | Python | gpl-2.0 | 848 |
"""
Django settings for HydaiNoWebsite project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ... | hydai/HydaiNoWebsite | HydaiNoWebsite/settings.py | Python | mit | 2,126 |
from .tools import tools_bp
from .heritability import heritability_bp
from .indel_primer import indel_primer_bp
| AndersenLab/CeNDR | base/views/tools/__init__.py | Python | mit | 112 |
import numpy as np
import cv2
from matplotlib import pyplot as plt
# This function looks for contours (consecutive points) that could potentially be the pupil and narrows contours by area size and location within the frame
def getContours(image):
global mask
# uses opencv function findContours to find co... | Qwertycal/19520-Eye-Tracker | Filtering/edgeDetection.py | Python | gpl-2.0 | 8,928 |
import traceback
from datetime import datetime
class Fixture(object):
def __init__(self, data):
"""Takes a dict converted from the JSON response by the API and wraps
the fixture data within an object.
:param data: The fixture data from the API's response.
:type data: dict
... | xozzo/pyfootball | pyfootball/models/fixture.py | Python | mit | 1,806 |
from codecs import open
import os
on_rtd = os.environ.get('READTHEDOCS') == 'True'
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst')) as f:
long_description = f.read()
if on_rtd:
requirements = ['psutil', 'xlrd>=1.0.0']
e... | anugrah-saxena/pycroscopy | setup.py | Python | mit | 3,107 |
#
# Generated by dumpDCWorkflow.py written by Sebastien Bigaret
# Original workflow id/title: OIEStudentApplicationWorkflow/OIEStudentApplicationWorkflow
# Date: 2008/05/28 15:48:39.623 GMT-5
#
# WARNING: this dumps does NOT contain any scripts you might have added to
# the workflow, IT IS YOUR RESPONSABILITY TO MAKE B... | uwosh/UWOshOIE | Extensions/OIEStudentApplicationWorkflow.py | Python | gpl-2.0 | 79,386 |
# -*- coding: utf-8 -*-
import scrapy
from scrapy import Selector
from libs.misc import get_spider_name_from_domain
from libs.polish import *
from novelsCrawler.items import NovelsCrawlerItem
class Novel101Spider(scrapy.Spider):
"""
classdocs
example: http://www.101novel.com/ck101/14744/
"""
d... | yytang2012/novels-crawler | novelsCrawler/spiders/c101nove.py | Python | mit | 2,957 |
"""
Google OpenId, OAuth2, OAuth1, Google+ Sign-in backends, docs at:
http://psa.matiasaguirre.net/docs/backends/google.html
"""
from requests import HTTPError
from social.backends.open_id import OpenIdAuth
from social.backends.oauth import BaseOAuth2, BaseOAuth1
from social.exceptions import AuthMissingParameter,... | HackerEcology/SuggestU | suggestu/social/backends/google.py | Python | gpl-3.0 | 5,709 |
# -*- coding: utf-8 -*-
# Copyright (c) 2006-2011 Mitch Garnaat http://garnaat.org/
#
# 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 r... | harshilasu/GraphicMelon | y/google-cloud-sdk/platform/gsutil/third_party/boto/tests/integration/s3/test_connection.py | Python | gpl-3.0 | 9,832 |
"""SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
... | theRealTacoTime/poclbm | socks.py | Python | gpl-3.0 | 13,397 |
# Neural Networks Demystified
# Part 2: Forward Propagation
#
# Supporting code for short YouTube series on artificial neural networks.
#
# Stephen Welch
# @stephencwelch
## ----------------------- Part 1 ---------------------------- ##
import numpy as np
# X = (hours sleeping, hours studying), y = Score on test
X =... | vbsteja/code | Python/ML_DL/DL/Neural-Networks-Demystified-master/partTwo.py | Python | apache-2.0 | 1,330 |
def minutes_string_to_seconds_int(minutes):
try:
return int(minutes) * 60
except ValueError:
return None
def replace_newlines_and_strip(text):
return text.replace("\n", "").strip()
def replace_double_slashes_with_https(url):
return url.replace("//", "https://")
| stevenvolckaert/plugin.video.vrt.nu | resources/lib/vrtplayer/statichelper.py | Python | gpl-3.0 | 298 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import random
import itertools
import numpy as np
import tensorflow as tf
from third_party.bi_att_flow.basic.read_data import DataSet
from third_party.bi_att_flow.my.tensorflow.general import get_initializer
... | google/active-qa | third_party/bi_att_flow/basic/model.py | Python | apache-2.0 | 21,148 |
import json
import logging
import mimetypes
import static_replace
import xblock.reference.plugins
from functools import partial
from requests.auth import HTTPBasicAuth
import dogstats_wrapper as dog_stats_api
from opaque_keys import InvalidKeyError
from django.conf import settings
from django.contrib.auth.models imp... | UXE/local-edx | lms/djangoapps/courseware/module_render.py | Python | agpl-3.0 | 35,275 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import six
import unittest
import pure_interface
class SomeOtherMetaClass(pure_interface.PureInterfaceType):
def __new__(mcs, name, bases, clsdict):
cls = pure_interface.PureInterfaceT... | tim-mitchell/pure_interface | tests/test_meta_classes.py | Python | mit | 2,516 |
import dedupe
import dedupe.api
import unittest
import itertools
import warnings
from collections import OrderedDict
def icfi(x):
return list(itertools.chain.from_iterable(x))
DATA_SAMPLE = [({'age': '27', 'name': 'Kyle'},
{'age': '50', 'name': 'Bob'}),
({'age': '27', 'name': 'Kyl... | datamade/dedupe | tests/test_api.py | Python | mit | 3,933 |
"""Some utility functions"""
# Authors: Eric Larson <larsoner@uw.edu>
#
# License: BSD (3-clause)
import warnings
import operator
from copy import deepcopy
import subprocess
import importlib
import os
import os.path as op
import inspect
import sys
import time
import tempfile
import traceback
import ssl
from shutil im... | drammock/expyfun | expyfun/_utils.py | Python | bsd-3-clause | 30,243 |
from django.utils.deprecation import MiddlewareMixin
from subdomains.middleware import SubdomainURLRoutingMiddleware
class SubdomainMiddleware(MiddlewareMixin, SubdomainURLRoutingMiddleware):
pass
| Ajapaik/ajapaik-web | ajapaik/ajapaik/middleware.py | Python | gpl-3.0 | 203 |
#!/usr/bin/env python3
#
# Copyright (C) 2009 Leandro Lisboa Penz <lpenz@lpenz.org>
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import re
... | lpenz/ftpsync | setup.py | Python | gpl-2.0 | 1,592 |
import pygame, sys, math, time
from Score import *
class Timer(Score):
def __init__(self, pos):
Score.__init__(self, pos)
self.startTime = time.clock()
self.image = self.font.render("Time: " + str(self.value), True, (0,0,255))
self.rect = self.image.get_rect(center = self.rect.cente... | KRHS-GameProgramming-2016/AstroDigger | Timer.py | Python | mit | 629 |
#!/usr/bin/env python
##########################################################################
# run/ec2-setup/spot.py
#
# Part of Project Thrill - http://project-thrill.org
#
# Copyright (C) 2015 Matthias Stumpp <mstumpp@gmail.com>
#
# All rights reserved. Published under the BSD-2 license in the LICENSE file.
#####... | manpen/thrill | run/ec2-setup/spot.py | Python | bsd-2-clause | 3,829 |
from mock import patch, Mock
from django import test
from django.core import exceptions
from django_google_maps import fields
class GeoPtFieldTests(test.TestCase):
def test_sets_lat_lon_on_initialization(self):
geo_pt = fields.GeoPt("15.001,32.001")
self.assertEqual(15.001, geo_pt.lat)
s... | desarrollosimagos/svidb | administrativo/django_google_maps/tests.py | Python | gpl-3.0 | 4,146 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2019-06-13 18:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0042_increase_env_variable_value_max_length'),
]
operations = [
... | rtfd/readthedocs.org | readthedocs/projects/migrations/0043_add-build-field.py | Python | mit | 500 |
import httplib2
import re
from django.conf import settings
from django.contrib.sites.models import Site
from django.http import HttpRequest
from django.utils.importlib import import_module
from oembed.constants import DOMAIN_RE, OEMBED_ALLOWED_SIZES, SOCKET_TIMEOUT
from oembed.exceptions import OEmbedHTTPException
... | 0101/djangoembed | oembed/utils.py | Python | mit | 5,373 |
from django import template
register = template.Library()
@register.tag
def capture(parser, token):
"""{% capture as [foo] %}"""
bits = token.split_contents()
if len(bits) != 3:
raise template.TemplateSyntaxError("'capture' node requires `as (variable name)`.")
nodelist = parser.parse(('endcap... | ericholscher/devmason-server | devmason_server/templatetags/capture.py | Python | mit | 682 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Make use of synaptic as backend."""
# Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de>
# Copyright (C) 2005-2007 Canonical
#
# Licensed under the GNU General Public License Version 2
#
# This program is free software; you can redistribute it and/or modify
# ... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/sessioninstaller/backends/synaptic.py | Python | mit | 3,567 |
'''
This module contains a number of tests that check hmf's results against those of genmf and/or CAMB.
Firstly we test transfer functions/power spectra against the output from CAMB to make sure we
are producing them correctly (with pycamb within hmf). We also check the normalisation of the
power spectrum done with h... | tbs1980/hmf | tests/test_genmf.py | Python | mit | 7,376 |
# Copyright (C) 2012 Aniket Panse <contact@aniketpanse.in
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This prog... | honeynet/beeswarm | beeswarm/drones/honeypot/tests/test_smtp.py | Python | gpl-3.0 | 7,214 |
"""
Unit tests for the module.
Thomas Ogden <t@ogden.eu>
"""
import os
import unittest
import numpy as np
from maxwellbloch import mb_solve, t_funcs, spectral, utility
# Absolute path of tests/json directory, so that tests can be called from
# different directories.
JSON_DIR = os.path.abspath(os.path.join(__file... | tommyogden/maxwellbloch | maxwellbloch/tests/test_mb_solve.py | Python | mit | 12,255 |
<<<<<<< HEAD
<<<<<<< HEAD
# Test the most dynamic corner cases of Python's runtime semantics.
import builtins
import contextlib
import unittest
from test.support import run_unittest, swap_item, swap_attr
class RebindBuiltinsTests(unittest.TestCase):
"""Test all the ways that we can change/shadow globals/builti... | ArcherSys/ArcherSys | Lib/test/test_dynamic.py | Python | mit | 13,577 |
#!/usr/bin/python -S
#
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Perform auto-approvals and auto-blocks on translation import queue"""
import _pythonpath
from lp.translations.scripts.import_queue_gardener import Impor... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/cronscripts/rosetta-approve-imports.py | Python | agpl-3.0 | 523 |
#! /usr/bin/env python3
import json
import pathlib
import platform
import shutil
import zipfile
import more_itertools # PyPI: more-itertools
import requests # PyPI: requests
import minecraft_data # https://github.com/fenhl/python-minecraft-data
def _download(url, local_filename=None): #FROM http://stackoverflow.com... | wurstmineberg/assets.wurstmineberg.de | build/build.py | Python | mit | 3,775 |
from django.conf.urls import include, url
from whattheadmin import views
urlpatterns = [
url(r'email/send', views.send_email, name='admin-new-email'),
url(r'', views.dashboard, name='admin-dashboard'),
] | mikeshultz/whatthediff | whattheadmin/urls.py | Python | gpl-2.0 | 212 |
# coding: utf-8
"""
Course Schedule and Details Settings page.
"""
from __future__ import unicode_literals
from bok_choy.promise import EmptyPromise
from .course_page import CoursePage
from .utils import press_the_notification_button
class SettingsPage(CoursePage):
"""
Course Schedule and Details Settings pa... | vismartltd/edx-platform | common/test/acceptance/pages/studio/settings.py | Python | agpl-3.0 | 4,906 |
#------------------------------------------------------------------------
#
# Register Gramplet
#
#------------------------------------------------------------------------
register(GRAMPLET,
id="Data Entry Gramplet",
name=_("Data Entry Gramplet"),
description = _("Gramplet for quick data entr... | gramps-project/addons-source | DataEntryGramplet/DataEntryGramplet.gpr.py | Python | gpl-2.0 | 761 |
import factory
from datetime import datetime
from django.utils.text import slugify
from django.utils.timezone import make_aware
from .. import models
class UserFactory(factory.DjangoModelFactory):
"""Factory for making demo users."""
class Meta:
model = models.User
# This next line is actual... | ProjectFacet/facet | project/editorial/tests/factories.py | Python | mit | 12,283 |
#! /usr/bin/env python2.6
#
# Delete a list of existing users from the running configuration using
# edit-config; protect the transaction using a lock.
#
# $ ./nc06.py broccoli bob alice
import sys, os, warnings
warnings.simplefilter("ignore", DeprecationWarning)
from ncclient import manager
template = """<config xm... | nnakamot/ncclient | examples/nc06.py | Python | apache-2.0 | 857 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Cranberry documentation build configuration file, created by
# cookiecutter pipproject
#
# 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.
#
#... | danielschwabacher/cranberry | docs/source/conf.py | Python | bsd-3-clause | 9,391 |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django.http import HttpResponse
from django.utils import simplejson
from Custom_Remotes.models import *
@login_required
def customRemotes(request):
con... | dandroid88/webmote | modules/Custom_Remotes/views.py | Python | gpl-3.0 | 4,617 |
# coding: utf-8
import sys
import importlib
import pandas as pd
import numpy as np
from collections import Counter
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
class Visual:
def __init__(self):
pass
def main(self):
# Read file
df = pd.read_csv('./log/ac... | iShoto/incoption | src/visual.py | Python | mit | 965 |
"""CSSStyleDeclaration implements DOM Level 2 CSS CSSStyleDeclaration and
extends CSS2Properties
see
http://www.w3.org/TR/1998/REC-CSS2-19980512/syndata.html#parsing-errors
Unknown properties
------------------
User agents must ignore a declaration with an unknown property.
For example, if the style sheet is::
... | kgn/cssutils | src/cssutils/css/cssstyledeclaration.py | Python | gpl-3.0 | 25,095 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py | Python | mit | 4,996 |
#!/usr/bin/env python
###
# (C) Copyright (2012-2015) Hewlett Packard Enterprise Development LP
#
# 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 limita... | miqui/python-hpOneView | examples/scripts/get-connectible-volume-templates.py | Python | mit | 3,774 |
# Copyright (C) 2011 Canonical Ltd.
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
#
# This file is part of cloud-init. See LICENSE file for license information.
"""
Scripts Per Boot
----------------
... | larsks/cloud-init | cloudinit/config/cc_scripts_per_boot.py | Python | gpl-3.0 | 1,232 |
import json
import datetime
from collections import defaultdict, Counter
from django.core.management.base import BaseCommand
from rrl import RateLimiter
from ...models import UsageReport, Profile
class Command(BaseCommand):
help = "aggregate usage reports for API keys"
def add_arguments(self, parser):
... | openstates/openstates.org | profiles/management/commands/aggregate_api_usage.py | Python | mit | 3,177 |
import math
def digitFactorialSum(n):
return sum([math.factorial(int(x)) for x in str(n)])
def repeatedLength(n):
repeatedList = []
while n not in repeatedList:
repeatedList.append(n)
n = digitFactorialSum(n)
return len(repeatedList)
if __name__ == "__main__":
cnt = 0
for i in... | python27/AlgorithmSolution | ProjectEuler/51_100/Problem#74.py | Python | agpl-3.0 | 411 |
# stdlibb
import time
# 3p
import mock
# project
from checks import AgentCheck
from tests.checks.common import AgentCheckTest
RESULTS_TIMEOUT = 5
CONFIG = {
'instances': [{
'name': 'conn_error',
'url': 'https://thereisnosuchlink.com',
'check_certificate_expiration': False,
'timeo... | Shopify/dd-agent | tests/checks/integration/test_http_check.py | Python | bsd-3-clause | 5,550 |
# -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
if __name__ == '__main__':
from os import getcwd
from os import sys
sys.path.append(getcwd())
from MOAL.helpers.text import gibberish3
from MOAL.helpers.display import Section
from MOAL.data_structures.hashes.hashtable import Na... | christabor/MoAL | MOAL/data_structures/hashes/hash_list.py | Python | apache-2.0 | 1,820 |
# 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... | airbnb/superset | tests/databases/api_tests.py | Python | apache-2.0 | 28,975 |
import StringIO
from pygments.formatters import HtmlFormatter
from pygments import highlight
from kallithea.lib.vcs.exceptions import VCSError
from kallithea.lib.vcs.nodes import FileNode
def annotate_highlight(filenode, annotate_from_changeset_func=None,
order=None, headers=None, **options):
"""
Re... | zhumengyuan/kallithea | kallithea/lib/vcs/utils/annotate.py | Python | gpl-3.0 | 7,104 |
"""Weather information for air and road temperature (by Trafikverket)."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from pytrafikverket.trafikverket_weather import TrafikverketWeather
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassis... | titilambert/home-assistant | homeassistant/components/trafikverket_weatherstation/sensor.py | Python | apache-2.0 | 5,526 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2017 Dean Jackson <deanishe@deanishe.net>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2017-12-10
#
"""Parse an OpenSearch for search and autosuggest URLs."""
from __future__ import print_function, absolute_import
import re
from urlp... | deanishe/alfred-searchio | src/lib/searchio/opensearch.py | Python | mit | 4,499 |
#!/usr/bin/env python3
# Copyright (c) 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the dumpwallet RPC."""
import os
from test_framework.test_framework import PivxTestFramework
fro... | Mrs-X/PIVX | test/functional/wallet_dump.py | Python | mit | 3,849 |
import pytest
import pytz
from datetime import date, datetime, timedelta, time
import icalendar
from khal.khalendar import backend
from khal.khalendar.event import LocalizedEvent
from khal.khalendar.exceptions import OutdatedDbVersionError, UpdateFailed
from .aux import _get_text
BERLIN = pytz.timezone('Europe/Ber... | dzoep/khal | tests/backend_test.py | Python | mit | 27,566 |
#!/usr/local/bin/python3
import logging
import time
import urllib3
import boto.route53
start_time = time.time()
# configuration
cfg_profile = 'Credential'
cfg_region = 'us-east-1'
cfg_zone = 'YOUR.DOMAIN'
cfg_record = 'A.YOUR.DOMAIN'
cfg_timeout = 300
aws_key = 'YOUR AWS KEY'
aws_secret = 'YOUR_AWS_SECRET'
# set up... | xinsnake/route53ddns-py | route53ddns.py | Python | mit | 1,825 |
# Copyright 2010-2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2015 Cloud Brewery Inc. (cloudbrewery.io)
#
# 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 co... | CloudBrewery/swift-container-keys | containerkeys/tests/base.py | Python | apache-2.0 | 2,905 |
'''
This file holds globally useful utility classes and functions, i.e., classes and
functions that are generic enough not to be specific to one app.
'''
import logging
import os
import re
import sys
from datetime import tzinfo, timedelta
from django.conf import settings
# Setup logging support.
LOGGER = logging.get... | MiltosD/CEF-ELRC | metashare/utils.py | Python | bsd-3-clause | 4,061 |
"""
CLUSTALW wrapper for python
author: Matt Rasmussen
date: 2/4/2007
"""
# python libs
import math
import os
# rasmus libs
from rasmus import treelib
from rasmus import util
# compbio imports
from . import fasta
# TODO: change removetmp to saveOutput
def clustalw(seqs, verbose=True, removetmp=Tru... | abhishekgahlot/compbio | compbio/clustalw.py | Python | mit | 5,028 |
# -*- coding: utf-8 -*-
"""Various text used throughout the website, e.g. status messages, errors, etc.
"""
# Status Messages
#################
# NOTE: in status messages, newlines are not preserved, so triple-quotes strings
# are ok
# Status message shown at settings page on first login
# (upon clicking primary em... | billyhunt/osf.io | website/language.py | Python | apache-2.0 | 8,196 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/python/data/kernel_tests/from_sparse_tensor_slices_test.py | Python | apache-2.0 | 8,944 |
import snap
import sys
num_nodes = int(sys.argv[1])
forward_prob = float(sys.argv[2])
backward_prob = float(sys.argv[3])
g = snap.GenForestFire(num_nodes, forward_prob,backward_prob)
print num_nodes
adj_list = []
for i in range(num_nodes):
adj_list.append([])
for EI in g.Edges():
source = EI.GetSrcNId()
sink = EI... | simp1eton/CS224W_Final_Project | OLD/forest_fire_5.py | Python | mit | 602 |
"""Unit tests for the ``gpgkeys`` paths.
@Requirement: Gpgkey
@CaseAutomation: Automated
@CaseLevel: Acceptance
@CaseComponent: API
@TestType: Functional
@CaseImportance: High
@Upstream: No
"""
from fauxfactory import gen_string
from nailgun import entities
from requests import HTTPError
from robottelo.constants... | sthirugn/robottelo | tests/foreman/api/test_gpgkey.py | Python | gpl-3.0 | 7,069 |
# -*- coding: utf-8 -*-
#
'''Script to convert Matplotlib generated figures into TikZ/PGFPlots figures.
'''
from matplotlib2tikz.__about__ import (
__author__,
__email__,
__copyright__,
__credits__,
__license__,
__version__,
__maintainer__,
__status__
... | dougnd/matplotlib2tikz | matplotlib2tikz/__init__.py | Python | mit | 518 |
pedidos = []
def criar_pedido(nome, sabor, observacao=None):
pedido = {}
pedido['nome'] = nome
pedido['sabor'] = sabor
pedido['observacao'] = observacao
return pedido
pedidos.append(criar_pedido('mario', 'pepperoni'))
pedidos.append(criar_pedido('marco', 'presunto', 'dobro de presunto'))
for ped... | americomflores/django-pizza | pyexamples/functions.py | Python | cc0-1.0 | 545 |
# Copyright 2013 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.
def memoize(fn):
'''Decorates |fn| to memoize.
'''
memory = {}
def impl(*args, **optargs):
full_args = args + tuple(optargs.iteritems())
if f... | jaruba/chromium.src | tools/json_schema_compiler/memoize.py | Python | bsd-3-clause | 434 |
import struct
import termios
import fcntl
import logging
import ctypes
import os
from functools import wraps
def set_size(fd, row, col, xpix=0, ypix=0):
winsize = struct.pack("HHHH", row, col, xpix, ypix)
fcntl.ioctl(fd, termios.TIOCSWINSZ, winsize)
def get_size(fd):
data = bytearray(8)
fcntl.ioctl(... | zydiig/Container | syscalls.py | Python | gpl-3.0 | 2,382 |
CSRF_ENABLED = True
DEBUG = True
SECRET_KEY = '6e9d6e59ad52278806294952fbd3a263'
SQLALCHEMY_DATABASE_URI = 'sqlite:///bizdb.db'
| akaak/flask-mega-tutorial | part-iii-forms/config.py | Python | bsd-3-clause | 130 |
import numpy as np
v1 = np.array([1, 2, 3])
v2 = np.array([4, 5, 6])
p = np.cross(v1, v2)
print(p)
"""<
[ 1 70 96]
>"""
| pythonpatterns/patterns | p0141.py | Python | unlicense | 122 |
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
# Provided as an attribute, so you can append to these instead
# of replicating them:
standar... | servee/django-servee-document | setup.py | Python | bsd-3-clause | 4,836 |
"""config.py Parse the daemon config file"""
__author__ = "Wim Leers (work@wimleers.com)"
__version__ = "$Rev$"
__date__ = "$Date$"
__license__ = "GPL"
import os
import os.path
import xml.etree.ElementTree as etree
from xml.parsers.expat import ExpatError
import re
import logging
from filter import *
# Define ex... | edx/fileconveyor | fileconveyor/config.py | Python | unlicense | 9,854 |
# Errors
# (C) Poren Chiang 2020
class WeatherParseError(ValueError):
"""Raised when the module failed to parse the source string."""
def __init__(self, *args, **kwargs):
super().__init__(*args)
self.text = kwargs.get('text')
| rschiang/ntu-weather | ntuweather/exceptions.py | Python | agpl-3.0 | 251 |
from querylist.dict import BetterDict
from querylist.fieldlookup import field_lookup
class QueryList(list):
"""A QueryList is an extension of Python's built in list data structure
that adds easy filtering, excluding, and retrieval of member objects.
>>> from querylist import QueryList
>>> sites = Que... | thomasw/querylist | querylist/list.py | Python | mit | 6,241 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.