text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Telegram bot to play UNO in group chats
# Copyright (c) 2016 Jannes Höke <uno@jhoeke.de>
#
# 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 Foundatio... | SYHGroup/mau_mau_bot | utils.py | Python | agpl-3.0 | 3,582 | 0.000281 |
"""Provide a way to connect entities belonging to one device."""
from collections import OrderedDict
import logging
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple, Union
import attr
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
from homeassistant.core import Event, callback
impo... | tchellomello/home-assistant | homeassistant/helpers/device_registry.py | Python | apache-2.0 | 22,499 | 0.001022 |
#
# Copyright 2007 !j Incorporated
#
# This file is part of Canner.
#
# Canner 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.
#
# Cann... | pusateri/canner | canner/personalities/junos.py | Python | gpl-3.0 | 1,104 | 0.001812 |
# -*- coding: utf-8 -*-
from openerp.osv import osv, fields
import openerp.addons.product.product
class res_users(osv.osv):
_inherit = 'res.users'
_columns = {
'target_sales_invoiced': fields.integer('Invoiced in Sale Orders Target'),
}
| zbqf109/goodo | openerp/addons/sale_crm/res_users.py | Python | gpl-3.0 | 261 | 0.003831 |
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution ... | nijinashok/sos | sos/plugins/grub2.py | Python | gpl-2.0 | 2,119 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-30 23:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('games', '0012_remove_gamelink_accepted_at'),
]
ope... | Turupawn/website | games/migrations/0013_auto_20161001_0143.py | Python | agpl-3.0 | 561 | 0.001783 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 People Power Co.
# All rights reserved.
#
# This open source code was developed with funding from People Power Company
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# ... | umeckel/FS_coapy | coapy/connection.py | Python | bsd-3-clause | 41,116 | 0.004937 |
"""
URLs for LMS
"""
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.views.generic.base import RedirectView
from ratelimitbackend import admin
from django.conf.urls.static import static
import django.contrib.auth.views
from microsite_configuration import microsite
impo... | ovnicraft/edx-platform | lms/urls.py | Python | agpl-3.0 | 33,307 | 0.002252 |
#!/usr/bin/env python
# Copyright (C) 2013 Johannes Ring
#
# This file is part of DOLFIN.
#
# DOLFIN 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 optio... | maciekswat/dolfin_1.3.0 | site-packages/dolfin_utils/pjobs/slurm.py | Python | gpl-3.0 | 1,881 | 0.002127 |
# Copyright (c) 2003-2005 Jimmy Retzlaff, 2008 Konstantin Yegupov
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy... | pymedusa/SickRage | lib/unrar2/windows.py | Python | gpl-3.0 | 12,977 | 0.000848 |
import csv
from django.core.management.base import BaseCommand, CommandError
from torrent.models import Torrent
class Command(BaseCommand):
args = '<poll_id poll_id ...>'
help = 'Closes the specified poll for voting'
def handle(self, *args, **options):
with open("/home/dlemos/tmpfs/tmp/torrents_m... | xspager/openbaybrowser | csv_import/management/commands/import_csv.py | Python | mit | 1,058 | 0.021739 |
#!/usr/bin/env python
#
# euclid graphics maths module
#
# Copyright (c) 2006 Alex Holkner
# Alex.Holkner@mail.google.com
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version ... | RT-Thread/rtthread_fsl | utils/mdp/eMPL-pythonclient/euclid.py | Python | lgpl-2.1 | 69,409 | 0.003472 |
# Copyright 2015 Tesora Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | redhat-openstack/trove | trove/tests/scenario/groups/guest_log_group.py | Python | apache-2.0 | 9,327 | 0 |
from radar.api.serializers.fuan import FuanClinicalPictureSerializer
from radar.api.views.common import (
IntegerLookupListView,
PatientObjectDetailView,
PatientObjectListView,
StringLookupListView,
)
from radar.models.fuan import FuanClinicalPicture, RELATIVES, THP_RESULTS
class FuanClinicalPictureLi... | renalreg/radar | radar/api/views/fuan.py | Python | agpl-3.0 | 1,288 | 0.003106 |
from django import forms
from django.db import models
from .models import Subscription
from django.utils.translation import ugettext as _
class SubscriptionForm(forms.ModelForm):
class Meta:
model = Subscription
def clean(self):
cleaned_data = super(SubscriptionForm, self).clean()
if n... | luminousflux/lflux | lfluxproject/lsubscribe/forms.py | Python | mit | 846 | 0.00591 |
#!/usr/bin/env python
import errno
import os
import shutil
import subprocess
import sys
import tempfile
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
def main():
archive = sys.argv[1]
js_source_files = sys.argv[2:]
output_dir = tempfile.mkdtemp()
copy_js(js_source_files, output_dir)
call_asar(... | simongregory/electron | tools/js2asar.py | Python | mit | 1,415 | 0.013428 |
#!/usr/bin/env python
#
# Copyright 2004,2005,2007,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at ... | jarn0ld/gnuradio | gr-audio/examples/python/dial_tone.py | Python | gpl-3.0 | 2,150 | 0.002326 |
import meistermind
def show_menu (games):
print "Hello!"
print "Choose your game or press Q and Enter to quit."
for g in games:
print "\t" + g + ") " + games[g]
quit = False
while not (quit):
games = {
"1": "Meistermind",
"2": "No Game Here",
}
show_menu(games)
cho... | posiputt/Sandbox | games.py | Python | mit | 454 | 0.006608 |
import datetime
import numpy as np
from artist import Plot
from sapphire import Station
from sapphire.transformations.clock import datetime_to_gps, gps_to_datetime
from get_aligned_eventtimes import get_aligned, get_station_numbers
YEARS = range(2004, datetime.date.today().year + 1)
YEARS_TICKS = np.array([datetim... | HiSPARC/topaz | 130711_event_histogram/eventtime_histogram.py | Python | gpl-3.0 | 2,523 | 0.000793 |
# Copyright (c) 2009-2010 Aldo Cortesi
# Copyright (c) 2010 matt
# Copyright (c) 2010, 2012, 2014 dequis
# Copyright (c) 2010 Philip Kranz
# Copyright (c) 2010-2011 Paul Colomiets
# Copyright (c) 2011 osebelin
# Copyright (c) 2011 Mounier Florian
# Copyright (c) 2011 Kenji_Takahashi
# Copyright (c) 2011 Tzbob
# Copyrig... | kiniou/qtile | libqtile/xcbq.py | Python | mit | 31,290 | 0.000352 |
#
# Copyright (C) 2015 Dustin Spicuzza <dustin@virtualroadside.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later ve... | virtuald/pygi-composite-templates | gi_composites.py | Python | lgpl-2.1 | 9,156 | 0.000655 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-07-10 12:00
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('django_project', '0013_auto_20160710_1124'),
]
oper... | kunalsharma05/django-project | django_project/migrations/0014_auto_20160710_1200.py | Python | bsd-3-clause | 558 | 0.001792 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | tzpBingo/github-trending | codespace/python/tencentcloud/scf/v20180416/errorcodes.py | Python | mit | 27,390 | 0.001814 |
import unittest.mock
import time
import logging
import logging.handlers
import coderbot
logger = logging.getLogger()
class PIGPIOMock(object):
"""Implements PIGPIO library mock class
PIGPIO is the library used to access digital General Purpose IO (GPIO),
this mock class emulates the behaviour of the input... | CoderBotOrg/coderbot | test/pigpio_mock.py | Python | gpl-2.0 | 2,965 | 0.005059 |
import pygame
import tiles_basic
from tile import *
# NOTE: If you add new tiles, use t_init for regular tiles.
# tl_init and tr_init are for tiles that take up only half of the
# 16x16 tile, on the left or right side respectively.
TILES = {
# general purpose tiles
0x00: [t_init, [], None, ],
... | PerroTron/HostilPlanet | lib/tiles.py | Python | gpl-2.0 | 5,826 | 0.002575 |
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'esite.settings')
import django
django.setup()
from auto.models import Car
#
def add_car(make, model, km, year, color, eng, drive,trans, icolor):
c = Car.objects.get_or_create(make=make, model=model, kilometers=km, year=year, color=color, engine_size=eng,... | vollov/django-template | django/esite/populate_auto.py | Python | mit | 2,560 | 0.010938 |
class Solution:
# returns sum of contiguous non-empty subarray with greatest sum
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
sumCurr = 0
sumMax = -math.inf
for i in range(len(nums)):
sumCurr += nums[i]
if ... | SelvorWhim/competitive | LeetCode/MaximumSubarray.py | Python | unlicense | 588 | 0.003401 |
# -*- 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-websecurityscanner | samples/generated_samples/websecurityscanner_v1beta_generated_web_security_scanner_list_crawled_urls_async.py | Python | apache-2.0 | 1,618 | 0.001854 |
#!/usr/bin/env python
import sys
import csv
import os
import decimal
os.environ['DJANGO_SETTINGS_MODULE'] = 'pombola.settings'
sys.path.append('../../../')
sys.path.append('../../')
from django.utils.text import slugify
from pombola.core.models import Place
from pombola.place_data.models import Entry
place_kind_sl... | hzj123/56th | pombola/place_data/bin/import_place_data.py | Python | agpl-3.0 | 3,048 | 0.003609 |
from changes.api.serializer import Crumbler, register
from changes.models.node import Cluster
@register(Cluster)
class ClusterCrumbler(Crumbler):
def crumble(self, instance, attrs):
return {
'id': instance.id.hex,
'name': instance.label,
'dateCreated': instance.date_cre... | dropbox/changes | changes/api/serializer/models/cluster.py | Python | apache-2.0 | 336 | 0 |
from __future__ import absolute_import
import logging
import os
import shlex
import shutil
import sys
import traceback
from flask import current_app
from subprocess import PIPE, Popen, STDOUT
from uuid import uuid1
from freight.exceptions import CommandError
class Workspace(object):
log = logging.getLogger('wo... | klynton/freight | freight/utils/workspace.py | Python | apache-2.0 | 2,839 | 0 |
"""
Source: http://code.activestate.com/recipes/578225-linux-ioctl-numbers-in-python/
Linux ioctl numbers made easy
size can be an integer or format string compatible with struct module
for example include/linux/watchdog.h:
#define WATCHDOG_IOCTL_BASE 'W'
struct watchdog_info {
__u32 options; ... | datacode-taavi/python-spi | spi/ioctl_numbers.py | Python | mit | 1,678 | 0.004768 |
# # ===============================================================================
# # Copyright 2014 Jake Ross
# #
# # 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.apa... | USGSDenverPychron/pychron | pychron/experiment/notifier/user_notifier.py | Python | apache-2.0 | 6,871 | 0.001455 |
#! /usr/bin/env python
from openturns import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
# Instanciate one distribution object
dimension = 3
meanPoint = NumericalPoint(dimension, 1.0)
meanPoint[0] = 0.5
meanPoint[1] = -0.5
sigma = NumericalPoint(dimension, 1.0)
sigma[0] = 2.0
sig... | sofianehaddad/ot-svn | python/test/t_Mixture_std.py | Python | mit | 7,198 | 0.002779 |
import setuptools
import sys
import numpy as np
# NOTE: If edt.cpp does not exist:
# cython -3 --fast-fail -v --cplus edt.pyx
extra_compile_args = []
if sys.platform == 'win32':
extra_compile_args += [
'/std:c++11', '/O2'
]
else:
extra_compile_args += [
'-std=c++11', '-O3', '-ffast-math', '-pthread'
... | seung-lab/euclidean-distance-transform-3d | python/setup.py | Python | gpl-3.0 | 779 | 0.014121 |
import os
import random
import string
import warnings
import numpy as np
from astropy import log
from astropy.io import fits
import stingray
from .events import EventList
from .gti import cross_two_gtis
from .io import high_precision_keyword_read
from .lightcurve import Lightcurve
from .utils import genDataPath
HAS... | abigailStev/stingray | stingray/largememory.py | Python | mit | 34,861 | 0.000832 |
#!/usr/bin/env python
########################################################################
# $HeadURL$
# File : dirac-configure
# Author : Ricardo Graciani
########################################################################
"""
Main script to write dirac.cfg for a new DIRAC installation and initial downl... | vmendez/DIRAC | Core/scripts/dirac-configure.py | Python | gpl-3.0 | 20,061 | 0.037236 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the JSON output module."""
from __future__ import unicode_literals
import json
import os
import sys
import unittest
from dfvfs.lib import definitions as dfvfs_definitions
from dfvfs.path import factory as path_spec_factory
from plaso.formatters import mana... | rgayon/plaso | tests/output/json_out.py | Python | apache-2.0 | 4,842 | 0.002891 |
# -*- coding: utf-8 -*-
import os
import webapp2
from webapp2_extras import jinja2
import test_base
current_dir = os.path.abspath(os.path.dirname(__file__))
template_path = os.path.join(current_dir, 'resources', 'jinja2_templates')
compiled_path = os.path.join(current_dir, 'resources',
'... | adviti/melange | thirdparty/google_appengine/lib/webapp2/tests/extras_jinja2_test.py | Python | apache-2.0 | 3,283 | 0.000305 |
# Test mocks and helpers
from __future__ import absolute_import
from webob import Request
from xblock.runtime import DictKeyValueStore, KvsFieldData
from xblock.test.tools import TestRuntime
def make_request(body, method='POST'):
"""
Helper method to make request
"""
request = Request.blank('/')
r... | open-craft/xblock-poll | tests/utils.py | Python | agpl-3.0 | 708 | 0.002825 |
import logging
from django.conf import settings
from django.db import models
from mkt.site.mail import send_mail
from mkt.site.models import ModelBase
from mkt.users.models import UserProfile
from mkt.webapps.models import Webapp
from mkt.websites.models import Website
log = logging.getLogger('z.abuse')
class Abu... | tsl143/zamboni | mkt/abuse/models.py | Python | bsd-3-clause | 3,973 | 0 |
if __name__ == '__main__':
expenses_list = []
expenses = open('DummyExpense.csv', 'r')
#Skip header
expenses.readline()
for line in expenses.readlines():
expenses_list.append([elem.rsplit("\r\n")[0] for elem in line.split(',')])
expenses.close()
ctracts_list = []
ctracts = open('DummyCT.csv', 'r')
#S... | CSC301H-Fall2013/ElectionSimulation | Code/Database/Build/build_lists.py | Python | mit | 1,031 | 0.054316 |
# 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 program is distributed in the hope that it will be useful
# but... | rndusr/stig | stig/tui/scroll.py | Python | gpl-3.0 | 16,073 | 0.001058 |
#
# DAPLink Interface Firmware
# Copyright (c) 2016-2017, ARM Limited, All Rights Reserved
# SPDX-License-Identifier: Apache-2.0
#
# 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... | google/DAPLink-port | test/stress_tests/hid_usb_test.py | Python | apache-2.0 | 2,358 | 0.000424 |
"""Support for Xiaomi Cameras (HiSilicon Hi3518e V200)."""
import asyncio
import logging
from aioftp import Client, StatusCodeError
from haffmpeg.camera import CameraMjpeg
from haffmpeg.tools import IMAGE_JPEG, ImageFrame
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
fro... | kennedyshead/home-assistant | homeassistant/components/yi/camera.py | Python | apache-2.0 | 5,013 | 0.000798 |
# pylint: disable=missing-docstring
import unittest
import numpy as np
# pylint bug on next line
from tensorflow.python.client import device_lib # pylint: disable=no-name-in-module
from cleverhans.devtools.checks import CleverHansTest
HAS_GPU = 'GPU' in {x.device_type for x in device_lib.list_local_devices()}
class ... | openai/cleverhans | tests_tf/test_mnist_tutorial_keras.py | Python | mit | 2,129 | 0.003758 |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', ],
[TestAction.create_volume, 'volume1', 'flag=scsi'],
[TestAction.attach_volume, 'vm1', 'volume1'],
... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/vm_snapshots/paths/xsky_path20.py | Python | apache-2.0 | 1,808 | 0.017699 |
#!/usr/bin/env python
#
# Copyright (c) 2017 Stratosphere Laboratory.
#
# This file is part of ManaTI Project
# (see <https://stratosphereips.org>). It was created by 'Raul B. Netto <raulbeni@gmail.com>'
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gene... | stratosphereips/Manati | manati/share_modules/whois_distance.py | Python | agpl-3.0 | 12,100 | 0.007686 |
# coding: utf-8
import arctic
from email.utils import parseaddr
from setuptools import setup, find_packages
kwargs = {}
try:
from babel.messages import frontend as babel
kwargs['cmdclass'] = {
'extract_messages': babel.extract_messages,
'update_catalog': babel.update_catalog,
'compile_... | tim-tang/arctic-bear | setup.py | Python | mit | 1,115 | 0 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | UTSA-ICS/keystone-kerberos | keystone/contrib/revoke/core.py | Python | apache-2.0 | 9,529 | 0.000105 |
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | tseaver/google-cloud-python | bigquery/samples/tests/test_table_exists.py | Python | apache-2.0 | 1,098 | 0 |
##############################################################################
#
# Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | CompassionCH/compassion-switzerland | partner_communication_switzerland/wizards/child_order_picture.py | Python | agpl-3.0 | 4,752 | 0.00021 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Classes for signals to be sent upon voice-key trip events.
"""
from __future__ import absolute_import, print_function
import threading
class _BaseVoiceKeySignal(threading.Thread):
"""Class to support sending a signal upon detection of an event.
Non-blocking... | psychopy/versions | psychopy/voicekey/signal.py | Python | gpl-3.0 | 1,069 | 0 |
# This file is part of OtfBot.
#
# OtfBot 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.
#
# OtfBot is distributed in the hope that it... | Farthen/OTFBot | otfbot/plugins/ircClient/karma.py | Python | gpl-2.0 | 7,588 | 0.002899 |
from django.template.defaultfilters import make_list
from django.test import SimpleTestCase
from django.test.utils import str_prefix
from django.utils.safestring import mark_safe
from ..utils import setup
class MakeListTests(SimpleTestCase):
"""
The make_list filter can destroy existing escaping, s... | yephper/django | tests/template_tests/filter_tests/test_make_list.py | Python | bsd-3-clause | 1,654 | 0.004232 |
import praw, argparse, sys, json, re, os, time, traceback
from peewee import *
from logins import *
from var_dicts import *
user_agent = "StunfiskHelperBot v0.1.1 by /u/0ffkilter"
reddit = praw.Reddit(user_agent=user_agent)
reddit.login(bot_name, bot_password)
c_db = MySQLDatabase(database='stunbot', host='localhos... | 0ffkilter/StunfiskBot | StunfiskBot.py | Python | mit | 15,210 | 0.007692 |
# 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 use ... | cloudkick/libcloud | libcloud/storage/drivers/dummy.py | Python | apache-2.0 | 14,148 | 0.00417 |
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib import messages
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.contrib.auth.decorators import permission_required
from django.core.exceptions import PermissionDenied
from django.utils.translation i... | helenwarren/pied-wagtail | wagtail/wagtaildocs/views/documents.py | Python | bsd-3-clause | 5,054 | 0.001979 |
# Copyright (C) 2015 Igor Gnatenko
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be us... | jsilhan/dnf-plugins-extras | tests/test_repoclosure.py | Python | gpl-2.0 | 3,893 | 0.002312 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution Addon
# Copyright (C) 2009-2013 IRSID (<http://irsid.ru>),
# Paul Korotkov (korotkov.paul@gmail.com).
#
# This program is free software: you can redistribute it... | prospwro/odoo | addons/irsid_edu/models/module_work.py | Python | agpl-3.0 | 13,057 | 0.013965 |
#!/usr/bin/env python3
# Copyright 2021 The Pigweed Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google/pigweed | pw_build_mcuxpresso/py/pw_build_mcuxpresso/__main__.py | Python | apache-2.0 | 1,865 | 0 |
#!/usr/bin/env python2
##################################################
# GNU Radio Python Flow Graph
# Title: bladeRF_transceiver
# Author: Renzo Chan Rios
# Generated: Sun Mar 13 00:27:54 2016
##################################################
from gnuradio import analog
from gnuradio import blocks
from gnuradio i... | IronSlayer/bladeRF-Rpi2 | bladeRF_transceiver1.py | Python | gpl-3.0 | 12,438 | 0.004181 |
from django.urls import path, re_path, include
from django.utils.translation import ugettext_lazy as _
from . import views as www
urlpatterns = [
re_path(r'^$', www.Index.as_view(), name='index'),
re_path(_('^topic_collections_url$'), www.TopicCollections.as_view(),
name='topic_collections'),
r... | WebArchivCZ/Seeder | Seeder/www/urls.py | Python | mit | 3,183 | 0.002199 |
# -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
#
# Copyright (C) 2007 Austin <austiny@sohu.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or... | dardevelin/rhythmbox-gnome-fork | plugins/lyrics/WinampcnParser.py | Python | gpl-2.0 | 3,373 | 0.024311 |
from flask.ext import restful
from . import api
class Welcome(restful.Resource):
def get(self):
return api.send_static_file('index.html')
| modulo-/knoydart | api/api_0/apiRequest/Welcome.py | Python | apache-2.0 | 153 | 0 |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
"""
Python interface to KrisLibrary nonlinear, multidimensional root finding routines
"""
from sys import versi... | YilunZhou/Klampt | Python/klampt/src/rootfind.py | Python | bsd-3-clause | 3,866 | 0.016296 |
"""Support for monitoring energy usage using the DTE energy bridge."""
import logging
import requests
import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
STATE_CLASS_MEASUREMENT,
SensorEntity,
)
from homeassistant.const import CONF_NAME, HTTP_OK
import homeassistant.hel... | sander76/home-assistant | homeassistant/components/dte_energy_bridge/sensor.py | Python | apache-2.0 | 3,635 | 0.00055 |
# -*- coding: utf-8 -*-
import collections
import httplib as http
import pytz
from flask import request
from modularodm import Q
from framework.exceptions import HTTPError
from framework.auth.decorators import must_be_logged_in
from framework.auth.utils import privacy_info_handle
from framework.forms.utils import san... | himanshuo/osf.io | website/project/views/comment.py | Python | apache-2.0 | 8,683 | 0.000461 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | alexandrucoman/vbox-nova-driver | nova/utils.py | Python | apache-2.0 | 42,459 | 0.000377 |
import Queue as queue
import escp.messaging.rpc as rpc
import escp.messaging.wrappers as wrappers
import escp.tools.testing as testing
from escp.messaging.wrappers_testing import _construct_wrapper
@testing.fixture
def needs_rpc_client (_test, member = 'client', session = 'session', callback_agent = None, callbac... | cipriancraciun/extremely-simple-cluster-platform | components/py-messaging/sources/escp/messaging/rpc_testing.py | Python | gpl-3.0 | 2,789 | 0.062029 |
# -*- coding: utf-8 -*-
from .processor import QueryProcessor
class SQLiteQueryProcessor(QueryProcessor):
def process_column_listing(self, results):
"""
Process the results of a column listing query
:param results: The query results
:type results: dict
:return: The proc... | MakarenaLabs/Orator-Google-App-Engine | orator/query/processors/sqlite_processor.py | Python | mit | 424 | 0 |
from django.contrib.sites.models import _simple_domain_name_validator
from django.db import models
from django.utils.translation import pgettext_lazy
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class SiteSettings(models.Model):
domain = models.CharField(
pget... | car3oon/saleor | saleor/site/models.py | Python | bsd-3-clause | 811 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Nachi Ueno, NTT MCL, 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... | Frostman/eho-horizon | openstack_dashboard/dashboards/project/routers/urls.py | Python | apache-2.0 | 1,319 | 0.000758 |
import json
from globus_sdk.response import GlobusHTTPResponse
class TransferResponse(GlobusHTTPResponse):
"""
Base class for :class:`TransferClient <globus_sdk.TransferClient>`
responses.
"""
def __str__(self):
# Make printing responses more convenient. Relies on the
# fact that ... | aaschaer/globus-sdk-python | globus_sdk/transfer/response/base.py | Python | apache-2.0 | 407 | 0 |
import os
import numpy as np
class Dataset(object):
"""
This class represents a dataset and consists of a list of SongData along with some metadata about the dataset
"""
def __init__(self, songs_data=None):
if songs_data is None:
self.songs_data = []
else:
self... | Guitar-Machine-Learning-Group/guitar-transcriber | dataset.py | Python | mit | 2,586 | 0.001547 |
"""
WSGI config for websqlrunner 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.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | snava10/sqlRunner | websqlrunner/websqlrunner/wsgi.py | Python | apache-2.0 | 402 | 0 |
# -*- coding: utf-8 -*-
# Etalage -- Open Data POIs portal
# By: Emmanuel Raviart <eraviart@easter-eggs.com>
#
# Copyright (C) 2011, 2012 Easter-eggs
# http://gitorious.org/infos-pratiques/etalage
#
# This file is part of Etalage.
#
# Etalage is free software; you can redistribute it and/or modify
# it under the term... | Gentux/etalage | etalage/__init__.py | Python | agpl-3.0 | 990 | 0 |
# coding: utf-8
import logging
import os
import signal
import sys
import numpy as np
import pytest
import ray
import ray.cluster_utils
from ray.test_utils import SignalActor, put_object, wait_for_condition
SIGKILL = signal.SIGKILL if sys.platform != "win32" else signal.SIGTERM
logger = logging.getLogger(__name__)
... | richardliaw/ray | python/ray/tests/test_reference_counting_2.py | Python | apache-2.0 | 11,196 | 0 |
"""Platform for retrieving meteorological data from Environment Canada."""
import datetime
import re
from env_canada import ECData # pylint: disable=import-error
import voluptuous as vol
from homeassistant.components.weather import (
ATTR_FORECAST_CONDITION,
ATTR_FORECAST_PRECIPITATION_PROBABILITY,
ATTR_... | sdague/home-assistant | homeassistant/components/environment_canada/weather.py | Python | apache-2.0 | 8,104 | 0.000494 |
""" Use all available data for training """
import itertools
import logging
from pySPACE.missions.nodes.base_node import BaseNode
class AllTrainSplitterNode(BaseNode):
""" Use all available data for training
This node allows subsequent nodes to use all available labeled
data for training. Accordingl... | pyspace/test | pySPACE/missions/nodes/splitter/all_train_splitter.py | Python | gpl-3.0 | 2,977 | 0.011085 |
import csv
import os
import shutil
import tarfile
import tempfile
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Q
from django.utils.encoding import force_text
from oioioi.filetracker.client import get_client
from oioioi.filetracker.utils import dja... | sio2project/oioioi | oioioi/exportszu/utils.py | Python | gpl-3.0 | 6,333 | 0.000474 |
##############################################################################
#
# Copyright (C) Zenoss, Inc. 2015, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
#####################################... | krull/docker-zenoss4 | init_fs/usr/local/zenoss/ZenPacks/ZenPacks.zenoss.ZenJMX-3.12.1.egg/ZenPacks/zenoss/ZenJMX/tests/test_JMXDataSource.py | Python | gpl-3.0 | 960 | 0.001042 |
males['Age'].mean() | jorisvandenbossche/DS-python-data-analysis | notebooks/_solutions/pandas_03a_selecting_data2.py | Python | bsd-3-clause | 19 | 0.052632 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para peliculasaudiolatino
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import re
import sys
import urlparse
from core im... | ChopChopKodi/pelisalacarta | python/main-classic/channels/peliculasaudiolatino.py | Python | gpl-3.0 | 9,331 | 0.013631 |
#!/usr/bin/env python3
#
# Copyright (c) 2013-2016 Molly White
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software
# and associated documentation files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy, mod... | molly/GorillaBot | gorillabot/bot.py | Python | mit | 16,845 | 0.003443 |
"""
Program do gry w Blackjack (a.k.a. Oczko) w języku Python przy użyciu biblioteki PyGame
Projekt zaliczeniowy - Języki Skryptowe, Informatyka i Ekonometria, rok 1, WZ, AGH
Autorzy: Joanna Jeziorek, Mateusz Koziestański, Katarzyna Maciocha
III 2016
"""
import random as rd
import os
import sys
import pygame
from pygam... | Kotzyk/Projekt-Blackjack | blackjack.py | Python | gpl-3.0 | 25,701 | 0.004655 |
# -*- coding: utf-8 -*-
#
# COFFEE documentation build configuration file, created by
# sphinx-quickstart on Tue Sep 30 11:25:59 2014.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | gmarkall/COFFEE | doc/source/conf.py | Python | bsd-3-clause | 7,963 | 0.006405 |
from __future__ import absolute_import, division, unicode_literals
import json
import warnings
import re
from .support import get_data_files
from html5lib.tokenizer import HTMLTokenizer
from html5lib import constants
class TokenizerTestParser(object):
def __init__(self, initialState, lastStartTag=None):
... | youtube/cobalt | third_party/web_platform_tests/tools/html5lib/html5lib/tests/test_tokenizer.py | Python | bsd-3-clause | 6,544 | 0.000458 |
import logging
import simplejson
import urllib2
import datetime
import urlparse
from deploy import DEPLOY_STATUS
from google.appengine.api import urlfetch
import grequests
logging.basicConfig()
logger = logging.getLogger(__name__)
class RequestProcessor:
def __init__(self, url_list):
self.url_list = url_... | madhurrajn/samashthi | startnow/request_processor.py | Python | bsd-3-clause | 3,842 | 0.002603 |
# Copyright 2014 Rackspace 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 ... | eshijia/magnum | magnum/conductor/template_definition.py | Python | apache-2.0 | 21,199 | 0.000047 |
#!/usr/bin/env python
from __future__ import print_function
import ctypes
def main():
chpl = ctypes.cdll.LoadLibrary("chapel.so")
chpl.chpl_library_init.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_char_p)]
argv=(ctypes.c_char_p*1)()
argv[0] = "chapel"
chpl.chpl_library_init(0, argv)
pri... | chapel-lang/pychapel | module/ext/src/chapel/muahaha.py | Python | apache-2.0 | 444 | 0.011261 |
import mock
from opensearchsdk.apiclient.api_base import Manager
from opensearchsdk.tests import base
from opensearchsdk.v2.search import SearchManager
class AppTest(base.TestCase):
def setUp(self):
super(AppTest, self).setUp()
self.search_manager = SearchManager('', '')
mock_send = mock.... | yanheven/ali-opensearch-sdk | opensearchsdk/tests/v2/test_search.py | Python | apache-2.0 | 1,190 | 0 |
# Copyright (c) Matt Haggard.
# See LICENSE for details.
from distutils.core import setup
import os, re
def getVersion():
r_version = re.compile(r"__version__\s*=\s*'(.*?)'")
base_init = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'norm/__init__.py')
guts = open(base_init, 'r').read()
m ... | iffy/norm | setup.py | Python | mit | 737 | 0.006784 |
import config
import random
import re
import string
import sys
import traceback
from twisted.python import log
def generate_password(length = 12):
"""
Generate a random password, ASCII letters + digits only, default length 12
"""
return ''.join(random.choice(string.ascii_letters + string.digits) for _... | mmichie/luckystrike | luckystrike/util.py | Python | mit | 1,107 | 0.009033 |
# -*- coding: utf-8 -*-
from distutils.core import setup
from setuptools import find_packages
LONGDOC = """
A very simple python library, used to format datetime with *** time ago statement.
Install
pip install timeago
Usage
import timeago, datetime
d = datetime.datetime.now() + datetime.timedelta(seconds = 60... | avrong/timeago | setup.py | Python | mit | 1,607 | 0.018738 |
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GObject
import random
import re
import datetime
class GenrePop(Gtk.Popover):
"""Creates a popover to filter by genre"""
__gsignals__ = {
"genres-updated": (GObject.SIGNAL_RUN_FIRST, GObject.TYPE_NONE, (object,))
}
def... | Return0Software/Flix-with-Friends | src/gtk-gui/SearchBar.py | Python | gpl-2.0 | 11,298 | 0.002655 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Invenio error handlers."""
from __future__ import absolute_import, print_function... | inveniosoftware/invenio-theme | invenio_theme/views.py | Python | mit | 1,481 | 0 |
###
# Copyright (c) 2005, Jeremy Kelley
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions... | kg-bot/SupyBot | plugins/Holdem/config.py | Python | gpl-3.0 | 2,352 | 0.000425 |
import resource_monitor
import sys
import time
@resource_monitor.monitored(limits = {'wall_time': 1e6}) # wall_time in microseconds
def my_function(n):
sys.stdout.write("waiting for {time} seconds...".format(time=n))
time.sleep(n)
sys.stdout.write("done.\n")
return n
try:
(output, resources) = ... | nkremerh/cctools | resource_monitor/src/bindings/python3/example_simple_limit.py | Python | gpl-2.0 | 791 | 0.010114 |
import json
import logging
from community_csdt.src.models import database
class Page(object):
def __init__(self, parent, name):
self.__parent__ = parent
self.__name__ = name
def __getitem__(self, key):
log = logging.getLogger('csdt')
log.info("Page.__getitem__()")
log.... | electricity345/community.csdt | src/community_csdt/community_csdt/src/models/pages/page.py | Python | mit | 374 | 0.005348 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.