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 |
|---|---|---|---|---|---|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | tbachman/group-based-policy-ui | gbpui/panels/policytargets/urls.py | Python | apache-2.0 | 4,078 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2018 Jonathan Peirce
# Distributed under the terms of the GNU General Public License (GPL).
"""Wrapper for all miscellaneous functions and classes from psychopy.tools
"""
# pylint: disable=W0611
# W0611 = Unused import %s
f... | hoechenberger/psychopy | psychopy/misc.py | Python | gpl-3.0 | 1,519 |
@mfunction("")
def plotProgresskMeans(X=None, centroids=None, previous=None, idx=None, K=None, i=None):
# PLOTPROGRESSKMEANS is a helper function that displays the progress of
# k-Means as it is running. It is intended for use only with 2D data.
# PLOTPROGRESSKMEANS(X, centroids, previous, idx, K, i)... | gedman4b/MachineLearning | coursera/KMeansClustering and PrincipalComponentAnalysis/plotProgresskMeans.py | Python | gpl-3.0 | 1,056 |
import unittest
import socket
from airpnp.config import Config
from airpnp.getnifs import NetworkInterface
from cStringIO import StringIO
def fake_network_interfaces():
lo = NetworkInterface("lo", 1)
lo.addresses[socket.AF_INET] = "127.0.0.1"
eth0 = NetworkInterface("eth0", 2)
eth0.addresses[socket.AF... | provegard/airpnp | test/test_config.py | Python | bsd-3-clause | 1,962 |
from django.db import models
from django.core.exceptions import ValidationError
# abstract models with common fields to be
# used as mix-ins
class Named(models.Model):
'''Abstract model with a 'name' field; by default, name is used as
the string display.'''
def __init__(self, *args, **kwargs):
su... | Princeton-CDH/winthrop-django | winthrop/common/models.py | Python | apache-2.0 | 2,609 |
# -*-coding: utf-8 -*-
import math
import numpy as np
import relations
def _avg_difference(npiece, side):
if side == relations.LEFT:
difference = npiece[:, 0] - npiece[:, 1]
elif side == relations.RIGHT:
difference = npiece[:, -1] - npiece[:, -2]
elif side == relations.UP:
differe... | typeinference/jigsaw-puzzle | src/measures.py | Python | mit | 1,631 |
#!usr/bin/env python3.7
#-*-coding:utf-8-*-
## TtgcBot - a bot for discord
## Copyright (C) 2017 Thomas PIOT
##
## 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... | ttgc/TtgcBot | src/utils/inits.py | Python | gpl-3.0 | 4,532 |
import json
from coalib.bearlib import deprecate_settings
from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.NpmRequirement import NpmRequirement
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
from coalib.results.Result import Result
from coala_utils.param_convers... | coala/coala-bears | bears/coffee_script/CoffeeLintBear.py | Python | agpl-3.0 | 15,184 |
#!/usr/bin/env python
from __future__ import unicode_literals
import argparse
import sys
from .parser import EmailParser
from .slack import Slack
def get_arg_parser():
parser = argparse.ArgumentParser()
parser.add_argument(
'-d', '--debug', action='store_true',
help='dry run, does not post t... | mikoim/email2slack | email2slack/__init__.py | Python | mit | 1,044 |
#! /usr/bin/env python3
"""Tool for measuring execution time of small code snippets.
This module avoids a number of common traps for measuring execution
times. See also Tim Peters' introduction to the Algorithms chapter in
the Python Cookbook, published by O'Reilly.
Library usage: see the Timer class.
Co... | theheros/kbengine | kbe/res/scripts/common/Lib/timeit.py | Python | lgpl-3.0 | 12,744 |
#
# 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 us... | lukecwik/incubator-beam | sdks/python/apache_beam/transforms/write_ptransform_test.py | Python | apache-2.0 | 4,233 |
import json
import logging
from pyramid.httpexceptions import HTTPBadRequest, HTTPForbidden
from sqlalchemy import or_, and_, not_
from lokp.config.customization import get_mandatory_keys
from lokp.models import Stakeholder, Activity, DBSession, Changeset, User, \
Profile
from lokp.views.base import BaseView
log... | CDE-UNIBE/lokp | lokp/review/review.py | Python | gpl-3.0 | 27,067 |
# 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... | jiajiechen/mxnet | example/recommenders/randomproj.py | Python | apache-2.0 | 6,041 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Zomboided
#
# 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)... | Zomboided/VPN-Manager | table.py | Python | gpl-2.0 | 5,150 |
#!/usr/bin/env python
import argparse
from donut.pymysql_connection import make_db
import re
import xml.etree.ElementTree as ET
def import_file(env, filename):
# Create reference to DB
db = make_db(env)
try:
db.begin()
tree = ET.parse(filename)
root = tree.getroot()
query ... | ASCIT/donut-python | donut/modules/editor/utils/media_wiki_import.py | Python | mit | 6,029 |
from sopel.module import commands
from sopel.config import ConfigurationError
from sopel.config.types import StaticSection, ValidatedAttribute
import urllib, json
class StreamSection(StaticSection):
url = ValidatedAttribute('url', default='http://example.com:8000/hello.ogg')
statsurl = ValidatedAttribute('sta... | Metastruct/hal1320 | stream.py | Python | mit | 1,263 |
import logging
import platform
import fluent.handler
import structlog
import log_config
import some_lib
_log = logging.getLogger(__name__)
def add_fluentd_logging():
format_for_nonstructured_messages = {
'event': '%(message)s',
#'message': '%(event)s',
'logger': '%(name)s',
'lev... | butla/experiments | structlog_demo/log_stuff_to_fluentd.py | Python | mit | 1,521 |
"""Django DDP API, Collections, Cursors and Publications."""
from __future__ import absolute_import
import collections
import traceback
import dbarray
from django.conf import settings
from django.db import connection, transaction
from django.db.models import aggregates, Q
from django.db.models.sql import aggregates as ... | PythonicNinja/django-ddp | dddp/api.py | Python | mit | 17,572 |
from ..fields import DataElementGroupField
from ..formals import KTZ1, Account3, GetSEPAAccountParameter1
from .base import FinTS3Segment, ParameterSegment
class HKSPA1(FinTS3Segment):
"""SEPA-Kontoverbindung anfordern, version 1
Source: FinTS Financial Transaction Services, Schnittstellenspezifikation, Mess... | raphaelm/python-fints | fints/segments/accounts.py | Python | lgpl-3.0 | 1,148 |
__author__ = 'Mayur M'
import ImgIO
def mult(image1, image2): # multiply two images
if image1.width == image2.width and image1.height == image2.height:
return_red = []
return_green = []
return_blue = []
for i in range(0, len(image1.red)):
tmp_r = image1.red[i] * image2... | mm10ws/ImPy | ImMult.py | Python | gpl-3.0 | 1,491 |
#
# Copyright (c) 2015, Scott J Maddox
#
# This file is part of Open Band Parameters Device Simulator (OBPDS).
#
# OBPDS 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... | scott-maddox/obpds | src/obpds/examples/cv_pn_diode.py | Python | agpl-3.0 | 1,635 |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# 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.absp... | smart-home-technology/it-btswitch-python | setup.py | Python | mit | 1,586 |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from os import listdir
files = listdir('./data/plots/')
colorarray = np.random.random_sample((10000, 3))
for f in files:
size = int(f.split('-')[0])
x, y, c = np.loadtxt('./data/plots/' + f, unpack=True)
fig = plt.fig... | kdungs/coursework-computational-physics | src/02/plot_forest.py | Python | mit | 630 |
"""
Test process list.
"""
import os
import lldb
import shutil
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ProcessListTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = True
@skipIfWindows ... | google/llvm-propeller | lldb/test/API/commands/platform/process/list/TestProcessList.py | Python | apache-2.0 | 1,007 |
# This script created a queue
#
# Author - Paul Doyle Nov 2015
#
#
import boto.sqs
import boto.sqs.queue
from boto.sqs.message import Message
from boto.sqs.connection import SQSConnection
from boto.exception import SQSError
import sys
import urllib2
# Get the keys from a specific url and then use them to connect to AW... | maciekzdaleka/lab11 | count-aws-msgs.py | Python | mit | 1,110 |
#!/usr/bin/python
#
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | GoogleCloudPlatform/datacatalog-connectors-bi | google-datacatalog-sisense-connector/tests/google/datacatalog_connectors/sisense/prepare/assembled_entry_factory_test.py | Python | apache-2.0 | 13,804 |
import os
import subprocess
import cv
import cv2
from pllm.vision import algo
try:
import tesseract
ts_native_available = True
except ImportError:
ts_native_available = False
tesseract_opts = {
'tessedit_char_whitelist': ('0123456789'
+ 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
... | sorki/pllm | pllm/vision/ocr.py | Python | bsd-3-clause | 3,206 |
import pygame
import random
# Initialize pygame and clock
pygame.init()
clock = pygame.time.Clock()
# Define colors with rgb values
white = (200, 200, 200)
black = (0, 0, 0)
red = (200, 0, 0)
green = (0, 140, 0)
# Screen dimensions
display_width = 800
display_height = 600
# Initialize game window and title
gameDisp... | foss-ag/workshop_minecraft-python | src/snake/snake.py | Python | gpl-3.0 | 4,954 |
import helper
from utils import *
import operator
import sys
NUMBER_OF_DAYS = 32
MIN_WAITTIME = 120
class Index():
def __init__(self):
self.operators = []
self.idx_for_operator_uri = {}
self.lines = []
self.idx_for_line_uri = {}
self.routes = []
self.idx_for_route_ur... | oooits72/rrrr | rrtimetable/rrtimetable/exporter/timetable4.py | Python | bsd-2-clause | 25,545 |
# Copyright 2000-2001 by Andrew Dalke.
# Revisions copyright 2008 by Peter Cock.
# All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Standard nucleotide and protein alphabets de... | BlogomaticProject/Blogomatic | opt/blog-o-matic/usr/lib/python/Bio/Alphabet/IUPAC.py | Python | gpl-2.0 | 4,629 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-orchestration-airflow | google/cloud/orchestration/airflow/service_v1beta1/__init__.py | Python | apache-2.0 | 3,035 |
import Tkinter
from Tkinter import Tk
root = Tk()
imgif = Tkinter.Image("photo", file="../data/img/icon_AddContact_np10888.gif")
imicon = "../Metadator.ico"
root.iconbitmap(imicon)
root.tk.call('wm','iconphoto',root._w,imgif)
root.mainloop() | Guts/Metadator | test/test_windows_icon.py | Python | gpl-3.0 | 246 |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico 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; eith... | pferreir/indico-backup | indico/MaKaC/statistics.py | Python | gpl-3.0 | 4,943 |
def test_basic_request(session, url):
resp = session.get(url('/'))
assert resp.status_code == 200
| markrwilliams/wip | wip/functional_test/basic_test.py | Python | bsd-3-clause | 106 |
#!/usr/bin/env python
from ConfigParser import ConfigParser
def get_api_keys(credentials_file=None):
"""Get API keys for apps that need only a single value to authenticate
"""
ini_parser = ConfigParser()
if credentials_file is None:
ini_parser.read('api_keys.ini')
else:
ini_parser.... | Serpens/pywebapis | get_credentials.py | Python | apache-2.0 | 468 |
import six
from swimlane.exceptions import ValidationError
from .base import MultiSelectField
class ValuesListField(MultiSelectField):
field_type = (
'Core.Models.Fields.ValuesListField, Core',
'Core.Models.Fields.ValuesList.ValuesListField, Core'
)
supported_types = six.string_types
... | Swimlane/sw-python-client | swimlane/core/fields/valueslist.py | Python | mit | 2,202 |
import datetime
from random import randint
from django.db.models import Count
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from movies import models, serializers
class RoleViewSet(viewsets.ViewSet):
@action(detail=False)
def d... | kinoreel/kinoreel-backend | movies/views.py | Python | mit | 5,563 |
"""
Windows Live Authentication using oAuth WRAP,
so much like Facebook
# NOT WORKING YET because Windows Live documentation and status is unclear. Is it in beta? I think it is.
"""
import urllib.parse
import urllib.request
from django.conf import settings
APP_ID = settings.LIVE_APP_ID
APP_SECRET = settings.LIVE_AP... | benadida/helios-server | helios_auth/auth_systems/live.py | Python | apache-2.0 | 2,129 |
from daisychain.steps.input import InMemoryInput
from daisychain.steps.pipes.json_convert import JsonLoad, JsonDump
import json
from .util import compare_trees
def test_load():
input_config = {'steps': {'step1': {'param1': 'value1'}, 'step2': {'param2': 'value2'}}}
pipe_input = InMemoryInput(output=json.dumps... | python-daisychain/daisychain | test/test_pipes__json_convert.py | Python | mit | 1,184 |
from abc import ABCMeta, abstractmethod
from custom_logging import getModuleLogger
class Ruleset(object):
"""Ruleset"""
__metaclass__ = ABCMeta
def __init__(self):
self.log = getModuleLogger(self)
self.set_propagation_model()
@abstractmethod
def name(self):
"""
:... | kate-harrison/west | west/ruleset.py | Python | gpl-2.0 | 2,670 |
#!/usr/bin/env python
"""
Created on 28.10.2014
@author: evg-zhabotinsky
"""
from test_mir_common import *
mir = tirpan_get_mir('test_mir17.py')
n = find_mir_nodes(mir,
x_call = func_checker('x'),
y_call = func_checker('y'),
z_call = func_checker('z'),
... | bronikkk/tirpan | tests/accept_mir17.py | Python | gpl-3.0 | 1,313 |
import os
import ycm_core
import logging
import subprocess
import re
vimvs_exe = ""
def Vimvs_getycm( filename ):
global vimvs_exe
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
p = subprocess.Popen([vimvs_exe, '-getycm=' + filename], stdout=subprocess.PI... | ruifig/czspas | .ycm_extra_conf.py | Python | mit | 1,206 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | bootswithdefer/ansible | v2/ansible/parsing/__init__.py | Python | gpl-3.0 | 7,960 |
##########################################################################
#
# Copyright (c) 2018, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | hradec/gaffer | python/GafferUITest/BackgroundMethodTest.py | Python | bsd-3-clause | 6,896 |
# This file is part of HamsiManager.
#
# Copyright (c) 2010 - 2015 Murat Demir <mopened@gmail.com>
#
# Hamsi Manager 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 yo... | supermurat/hamsi-manager | Core/MyConfigure.py | Python | gpl-3.0 | 5,028 |
#! /usr/bin/python3
"""
Streams Cron
"""
import time
import sys
import redis
import requests
import webhook
import conf
now = time.time()
wh = webhook.Webhook(conf.url_discord_webhook_news)
r = redis.StrictRedis(host='localhost', charset="utf-8", decode_responses=True, db=1)
twitch_api = "https://api.twitch.tv/kra... | xergio/discord-guild-notifications | streams.py | Python | unlicense | 920 |
import sys
import seq
import os
if __name__ == "__main__":
if len(sys.argv) != 4:
print("python "+sys.argv[0]+" table infile outfile")
sys.exit(0)
tab = open(sys.argv[1],"r")
idn = {}
for i in tab:
spls = i.strip().split("\t")
idn[spls[3]] = spls[4]
tab.close()
o... | FePhyFoFum/PyPHLAWD | src/change_id_to_name_fasta.py | Python | gpl-2.0 | 500 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.utils import add_to_date, date_diff, getdate, nowdate, get_last_day, formatdate, get_link_to_form
f... | gsnbng/erpnext | erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py | Python | agpl-3.0 | 3,965 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | tkaitchuck/nupic | py/nupic/frameworks/prediction/postprocess/inputpredictionstats.py | Python | gpl-3.0 | 38,969 |
"""
Collapser
---------
Module with utilities to collapse joining circunscriptions and parties.
"""
import numpy as np
import pandas as pd
from itertools import product
class Collapser():
def __init__(self, party_collapser={}, circ_collapser={}):
self.collapser_p = party_collapser
self.collaps... | tgquintela/ElectionsTools | ElectionsTools/Preprocess_votes/collapser.py | Python | mit | 3,611 |
# -*- coding: utf8 -*-
#
# Copyright (C) 2019 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Licen... | ndp-systemes/odoo-addons | ir_values_improved/__openerp__.py | Python | agpl-3.0 | 1,248 |
##########################################################################
#
# Copyright (c) 2012, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | hradec/gaffer | python/GafferUI/ToolPlugValueWidget.py | Python | bsd-3-clause | 2,330 |
# Copyright 2011 OpenStack LLC.
# 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 b... | termie/nova-migration-demo | nova/api/openstack/images.py | Python | apache-2.0 | 5,270 |
import sip
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtOpenGL import *
try:
#In case PyQwt is compiled with QtSvg
from PyQt4.QtSvg import *
except:
pass
| tonnrueter/pymca_devel | PyMca/Object3D/Object3DQt.py | Python | gpl-2.0 | 187 |
import os
import sys
import subprocess
import couchdb
import bcbio.pipeline.config_loader as cl
import optparse
from datetime import datetime
def find_proj_from_view(proj_db, proj_id):
"""Getting proj_id from the project database in statusdb via view"""
view = proj_db.view('project/project_name')
for proj ... | kate-v-stepanova/scilifelab | scripts/RNA_analysis/RNA_analysis.py | Python | mit | 3,410 |
from PySide.QtGui import QListWidgetItem, QListWidget
class ListBox(QListWidget):
def __init__(self, mylist, editcallback, *args):
super(ListBox, self).__init__()
self.mylist = mylist
self.doubleClicked.connect(editcallback)
self.build()
def build(self):
self.itemlist ... | katerina7479/kadre | view/widgets/listbox.py | Python | mit | 1,237 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-23 19:58
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | solvo/organilab | src/laboratory/migrations/0018_auto_20161223_1358.py | Python | gpl-3.0 | 843 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | kamcpp/tensorflow | tensorflow/python/training/supervisor_test.py | Python | apache-2.0 | 33,571 |
"""
Contour plots of unstructured triangular grids.
"""
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.tri as tri
import numpy as np
import math
# First create the x and y coordinates of the points.
n_angles = 48
n_radii = 8
min_radius = 0.25
radii = np.linspace(min_radius, 0... | yavalvas/yav_com | build/matplotlib/lib/mpl_examples/mplot3d/tricontour3d_demo.py | Python | mit | 960 |
#***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> *
#* ... | kkoksvik/FreeCAD | src/Mod/Arch/ArchAxis.py | Python | lgpl-2.1 | 21,853 |
from IPython.display import Javascript, display
__has_initialized__ = False
def init():
# FIXME
# Loads the JS extensions. This is still a bit of a
# hack: calls to methods cannot occur in the
# same cell as the import statement.
#
# Potential alternatives would be to re-factor the
# init... | zsameem/biojup | biojup/loader.py | Python | mit | 666 |
from django.shortcuts import redirect, get_object_or_404
from django.utils.safestring import mark_safe
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import Model
from . import models
from wiki.models import URLPath, Article
from categories.models import ArticleCategory
from django.util... | nert-gu/Xposition | src/wiki/plugins/metadata/views.py | Python | gpl-3.0 | 12,479 |
from django.test import TestCase
from django.urls import reverse
from apps.wagtailcms.models import CountryIndex, CountryPage
class CountryViewTestCase(TestCase):
fixtures = ["countries_and_regions"]
def test_with_country_page(self):
CountryPage.objects.create(
title="Myanmar Page", slu... | sinnwerkstatt/landmatrix | apps/landmatrix/tests/views/test_country_view.py | Python | agpl-3.0 | 1,065 |
"""Support for Lutron Caseta shades."""
import logging
from homeassistant.components.cover import (
ATTR_POSITION,
DOMAIN,
SUPPORT_CLOSE,
SUPPORT_OPEN,
SUPPORT_SET_POSITION,
SUPPORT_STOP,
CoverEntity,
)
from . import DOMAIN as CASETA_DOMAIN, LutronCasetaDevice
_LOGGER = logging.getLogger(... | GenericStudent/home-assistant | homeassistant/components/lutron_caseta/cover.py | Python | apache-2.0 | 2,427 |
#__all__ = ['errorbars', 'functions', 'grid', 'halolist', 'imapping', 'parameters', 'powerspectrum']
| tonyyli/imapper2 | __init__.py | Python | mit | 101 |
# coding=utf-8
"""Module of Data Types (eg. Temperature, Area, etc.)
Possesses capabilities for unit conversions and range checks.
It also includes descriptions of the data types and the units.
Properties:
TYPES: A tuple indicating all currently supported data types.
BASETYPES: A tuple indicating all base ty... | ladybug-analysis-tools/ladybug-core | ladybug/datatype/__init__.py | Python | gpl-3.0 | 901 |
##############################################################################################
# Copyright 2014-2015 Cloud Media Sdn. Bhd.
#
# This file is part of Xuan Automation Application.
#
# Xuan Automation Application is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | TheStackBox/xuansdk | Automation/automationApp/core/sceneController.py | Python | gpl-3.0 | 15,645 |
# 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/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_app_service_certificate_orders_operations.py | Python | mit | 93,863 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('polls.views',
url(r'^$', 'index', name='index'),
url(r'^(?P<poll_id>\d+)/$', 'detail', name='detail'),
url(r'^(?P<poll_id>\d+)/vote/$', 'vote', name='vote'),
# url(r'^(?P<poll_id>\d+)/vote/(?P<choice_id>\d+)/$', 'vote', name='vote'),
url(... | sourabhv/Django-PollApp | polls/urls.py | Python | mit | 379 |
import rdflib
g = rdflib.Graph()
g.parse('astronomical_database/data/rdf/astronomical_database.rdf')
result = g.query("""
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ontology: <urn://sedatar.org/astronomical_database#>
# All cla... | mathiasuhlenbrock/sedatar | astronomical_database/scripts/python/test_query.py | Python | gpl-3.0 | 1,551 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Team-XBMC
#
# 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... | BigNoid/service.library.data.provider | plugin.py | Python | gpl-2.0 | 8,430 |
import asyncio
import binascii
import logging
import os
from zigpy.exceptions import DeliveryError
import zigpy.application
import zigpy.device
import zigpy.util
import bellows.types as t
import bellows.zigbee.util
LOGGER = logging.getLogger(__name__)
class ControllerApplication(zigpy.application.ControllerApplica... | rcloran/bellows | bellows/zigbee/application.py | Python | gpl-3.0 | 10,988 |
#!/usr/bin/env python
import sys, json, tabulate
cutoff_less = 0.8
cutoff_more = 2.5
json_reference_fname = "provided/countries_provided.reference.json"
json_tocheck_fname = "provided/countries_provided.json"
alldata = json.load( open(json_tocheck_fname,"r") )
reference = json.load( open(json_reference_fname,"r") )
... | rinigus/osmscout-server | scripts/import/check_import.py | Python | gpl-3.0 | 1,197 |
#!/usr/bin/python
'''
Driver for waveshare pantilthat modified by Claude Pageau to
make compatible with pimoroni pantilthat that uses pan and tilt
servo min/max positions of -90 to +90 with 0 being servo center
Default settings can be overridden per help() function.
'''
import time
import math
import smbus
# =========... | pageauc/pi-timolo | source/pantilthat.py | Python | mit | 6,378 |
from django.contrib import messages
from django.contrib.auth.models import Group
from django.core.exceptions import ObjectDoesNotExist
from django.db import IntegrityError
from django.shortcuts import render, get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.utils.timezone im... | fsinfuhh/Bitpoll | bitpoll/invitations/views.py | Python | gpl-3.0 | 3,643 |
#
# units.py - unit convertion tables and functions
#
# Copyright (c) 2006,2007 Matt Gerassimoff
#
# This file is part of g2ools.
#
# g2ools 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 ... | msg/g2ools | nord/units.py | Python | gpl-2.0 | 13,543 |
# pragma: no testimport
name = 'test_import_pkg'
identifier = 'org.vistrails.tests.test_import_pkg'
version = '0.42'
import vistrails.tests.resources.import_targets.test1
import tests.resources.import_targets.test2
import module1
| Nikea/VisTrails | vistrails/tests/resources/import_pkg/test_import_pkg/__init__.py | Python | bsd-3-clause | 232 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nxtrobot import *
from time import sleep
#max_speed = 1023
#Conect left motor to port C
#Conect right motor to port B
robo=NXTRobot("00:16:53:0E:B5:80")#NXT ID <- Settings - NXT Version
robo.forward(1)
robo.backward(1)
robo.done()
| girafenok/robots | examples/nxt/robot/nxt_forward_backward.py | Python | gpl-2.0 | 285 |
from core.Util import import_submodules
_registered_datasets = {}
def register_dataset(name, **args):
name = name.lower()
def _register(dataset):
_registered_datasets[name] = (dataset, args)
return dataset
return _register
def load_dataset(config, subset, session, name):
if not hasattr(load_datase... | VisualComputingInstitute/TrackR-CNN | datasets/Loader.py | Python | mit | 627 |
#
#
# Copyright (C) 2007, 2008 Google Inc.
#
# 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) any later version.
#
# This program is distri... | vladimir-ipatov/ganeti | lib/serializer.py | Python | gpl-2.0 | 4,602 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '../ui/configForm.ui'
#
# Created: Tue Jan 5 22:30:55 2010
# by: PyQt4 UI code generator 4.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(self, Dialo... | Kelloggs/Star-Trek-Fortune | contents/code/configForm_ui.py | Python | lgpl-3.0 | 4,695 |
return a == True
| omaraboumrad/mastool | mastool/samples/return_equals_bool.py | Python | apache-2.0 | 17 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | diegocortassa/TACTIC | src/pyasm/widget/project_wdg.py | Python | epl-1.0 | 4,702 |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | kennho/oppia | integrations_dev/gcb_oppia_tag/coursebuilder/modules/oppia_tag/oppia_tag.py | Python | apache-2.0 | 4,971 |
from django.conf.urls.defaults import *
urlpatterns = patterns('users.views',
(r'^$', 'view_all_users', {'all_users_template':'all_users.html'}, 'all_users'),
(r'^(?P<user_id>\d+)/(?P<user_slug_name>[\w-]+)/$', 'view_userprofile', {'userprofile_template':'user_profile.html'}, 'user_profile'),
) | none-da/zeshare | users/urls.py | Python | bsd-3-clause | 304 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from ripozo.resources.relationships.list_relationship import ListRelationship
from ripozo.resources.resource_base import ResourceBase
import unittest2
class TestListRe... | vertical-knowledge/ripozo | ripozo_tests/unit/resources/relationships/list_relationship.py | Python | gpl-2.0 | 2,321 |
import backend
import collections
import copy
# Our equation may depend on Expressions, and those Expressions may have parameters
# (e.g. for time-dependent boundary conditions).
# In order to successfully replay the forward solve, we need to keep those parameters around.
# Here, we overload the Expression class to re... | live-clones/dolfin-adjoint | dolfin_adjoint/expressions.py | Python | lgpl-3.0 | 2,177 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | lukas-krecan/tensorflow | tensorflow/python/training/training_ops_test.py | Python | apache-2.0 | 7,380 |
#!/usr/bin/env python2
# -*- mode: python -*-
#
# Electrum - lightweight Fujicoin client
# Copyright (C) 2016 The Electrum developers
#
# 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 withou... | fujicoin/electrum-fjc | electrum/plugins/hw_wallet/plugin.py | Python | mit | 7,367 |
#!/usr/bin/env python
"""This script solves the Project Euler problem "Totient maximum". The problem
is: Find the value of n <= 1,000,000 for which n/phi(n) is a maximum.
"""
import argparse
import math
def main(args):
"""Totient maximum"""
n = 1
prime = 1
while True:
prime += 1
if ... | iansealy/projecteuler | 69.py | Python | gpl-3.0 | 1,398 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
censor things objectionable to you, rather than store/query/communicate them
the current library is old and might simply need to include regexes...
(Feature: Should add the ability to publish your router's censor settings - #E)
These functions operate very primatively,... | Thetoxicarcade/ac | congredi/storage/censor.py | Python | gpl-3.0 | 4,267 |
"""Certbot client."""
# version number like 1.2.3a0, must have at least 2 parts, like 1.2
__version__ = '0.20.0.dev0'
| jsha/letsencrypt | certbot/__init__.py | Python | apache-2.0 | 119 |
# -*- coding: utf-8 -*-
"""
Sahana Eden Volunteers Management
(Extends modules/eden/hrm.py)
@copyright: 2012-15 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the... | Lokke/eden | modules/s3db/vol.py | Python | mit | 53,300 |
import numpy as np
import xarray as xr
from numpy.fft import fftshift, ifftshift, fftn, ifftn
import astropy.constants as const
from astropy.cosmology import Planck15 as Cosmo
from scipy.signal.windows import blackmanharris, hanning, nuttall, gaussian
from astropy.convolution import convolve_fft
from .cosmo import get... | piyanatk/sim | opstats/foreground/filter.py | Python | mit | 13,768 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
from collections import namedtuple
import os
import shutil
import tempfile
import uuid
from concorde._concorde import _CCutil_gettsplib, _CCtsp_solve_dat
from concorde.util import write_tsp_file, EDGE_WEIGHT_TYPES
ComputedTour = namedtuple('Comp... | jvkersch/pytsp | concorde/tsp.py | Python | bsd-3-clause | 2,360 |
import re
import time
import codecs
import requests
import jsonschema
import dateutil.parser
from io import StringIO
def validate(instance, schema, *args, **kwargs):
"Wraps JSON schema validator to augment default values."
jsonschema.validate(instance, schema, *args, **kwargs)
for prop, attrs in schema['... | chop-dbhi/prov-extractor | prov_extractor/utils.py | Python | bsd-2-clause | 1,933 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from datetime import datetime
from logging import getLogger
import collections
from sqlalchemy.sql.expression import tuple_
from ggrc import db
from ggrc import models
from ggrc.automapper.rules import rul... | andrei-karalionak/ggrc-core | src/ggrc/automapper/__init__.py | Python | apache-2.0 | 10,202 |
#!/usr/bin/env python
# -*- coding: ascii -*-
'''
$Id: gen_tests.py,v 1.15 2005/01/07 04:51:30 zenzen Exp $
'''
import os
import os.path
import subprocess
import sys
from gen_tzinfo import allzones
import gen_tzinfo
zdump = os.path.abspath(os.path.join(
os.path.dirname(__file__), 'build', 'bin', 'zdump'
))
def ... | stub42/pytz | gen_tests.py | Python | mit | 1,260 |
# -*- encoding: utf-8 -*-
##############################################################################
# #
# OpenERP, Open Source Management Solution. #
# ... | sohovet/sohovet | sohovet_import_supplier_products/__openerp__.py | Python | agpl-3.0 | 2,509 |
from __future__ import absolute_import
import os
path = os.path
import unittest
from random import randrange
from myhdl import *
from myhdl import ConversionError
from myhdl.conversion._misc import _error
from .util import setupCosimulation
b = c = 2
def UnboundError1(a, out):
@instance
def logic():
... | j-marjanovic/myhdl | myhdl/test/conversion/toVerilog/test_infer.py | Python | lgpl-2.1 | 7,059 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.