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 |
|---|---|---|---|---|---|---|
import os
import shutil
import stat
from tests.conf_tests import TEST_DIR
def make_test_dir():
os.makedirs(TEST_DIR, exist_ok=True)
def remove_test_dir():
for test_path in [TEST_DIR]:
if os.path.isdir(test_path):
try:
shutil.rmtree(test_path)
except Permission... | globz-eu/infrastructure | chef-repo/cookbooks/chef_server/files/chef_server_scripts/tests/helpers.py | Python | gpl-3.0 | 1,116 | 0.000896 |
# 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/queries/saved_queries/api_tests.py | Python | apache-2.0 | 22,536 | 0.000932 |
import re
import sys
def lookup(address, port, s):
"""
Parse the pfctl state output s, to look up the destination host
matching the client (address, port).
Returns an (address, port) tuple, or None.
"""
# We may get an ipv4-mapped ipv6 address here, e.g. ::ffff:127.0.0.1.
# Th... | cortesi/mitmproxy | mitmproxy/platform/pf.py | Python | mit | 1,021 | 0.004897 |
# Copyright 2015 Agile Business Group <http://www.agilebg.com>
# Copyright 2021 Lorenzo Battistini @ TAKOBI
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import datetime
from dateutil.rrule import MONTHLY
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
... | OCA/l10n-italy | l10n_it_vat_statement_split_payment/tests/test_vat_statement_split.py | Python | agpl-3.0 | 10,516 | 0.000856 |
#! /usr/bin/env python
###############################################################################
#
# simulavr - A simulator for the Atmel AVR family of microcontrollers.
# Copyright (C) 2001, 2002 Theodore A. Roth
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of th... | simark/simulavr | regress/test_opcodes/test_RETI.py | Python | gpl-2.0 | 3,053 | 0.022601 |
"""Base class for Tasks."""
import abc
from oslo_log import log as logging
import six
import rq
from rq import Queue
from asciipic.common import exception
from asciipic import config as asciipic_config
from asciipic.common import tools
CONFIG = asciipic_config.CONFIG
LOG = logging.getLogger(__name__)
@six.add_met... | micumatei/asciipic | asciipic/tasks/base.py | Python | mit | 2,066 | 0 |
from app.entity.human.human_data import *
from core.entity.entity import *
class Human(Entity):
def __init__(self, human_data=None):
# type: (HumanData) -> None
Entity.__init__(self)
self.data = human_data or HumanData()
def update(self, delta):
pass
| Diralf/evolution | app/entity/human/human.py | Python | mit | 295 | 0 |
#!/usr/bin/python
"""This script run the pathologic """
try:
import copy, optparse, sys, re, csv, traceback
from os import path, _exit, rename
import logging.handlers
from glob import glob
import multiprocessing
from libs.python_modules.utils.errorcodes import *
from libs.python_modules.utils.sy... | kishori82/MetaPathways_Python.3.0 | libs/python_scripts/MetaPathways_rpkm.py | Python | mit | 16,444 | 0.024933 |
"""
Django settings for remembermyseries 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... | niksolaz/TvApp | remembermyseries/settings.py | Python | mit | 2,156 | 0 |
"""
:class:`~xblock.field_data.FieldData` subclasses used by the LMS
"""
from xblock.field_data import ReadOnlyFieldData, SplitFieldData
from xblock.fields import Scope
class LmsFieldData(SplitFieldData):
"""
A :class:`~xblock.field_data.FieldData` that
reads all UserScope.ONE and UserScope.ALL fields fr... | angelapper/edx-platform | lms/djangoapps/lms_xblock/field_data.py | Python | agpl-3.0 | 1,403 | 0.001426 |
import functools
import unittest2
from sentry import app
from sentry.db import get_backend
def with_settings(**settings):
def wrapped(func):
@functools.wraps(func)
def _wrapped(*args, **kwargs):
defaults = {}
for k, v in settings.iteritems():
defaults[k] = a... | dcramer/sentry-old | tests/__init__.py | Python | bsd-3-clause | 1,088 | 0.003676 |
"""
hierin heb ik een poging gedaan om een klasse voor knoppen te maken (het is overigens niet echt gelukt)
"""
from tkinter import *
class Knoppen:
def bericht(self):
print("werkt dit?")
def tweede(self):
print("test")
def __init__(self, master):
beeld = Frame(master)
... | ricardovandervlag/Project-2.1---Python | window.py | Python | gpl-3.0 | 947 | 0.004224 |
#!/usr/bin/python
name = raw_input("please enter your name:")
address = raw_input("please enter your address:")
print "my name is {} and i live in {}".format(name,address) | tuxfux-hlp-notes/python-batches | archieves/batch-65/second.py | Python | gpl-3.0 | 171 | 0.011696 |
import unittest
import time
from motherbrain.workers.monitor import MBObjectMonitor, MBMonitorMixin
class TestMBObjectMonitor(unittest.TestCase):
def test_track(self):
mon = MBObjectMonitor()
mon.track('foo-event')
mon.track('bar-event')
mon.track('foo-event')
foo_count ... | urlist/urlist | motherbrain/tests/monitor.py | Python | gpl-3.0 | 3,107 | 0 |
"""
Generic GeoRSS events service.
Retrieves current events (typically incidents or alerts) in GeoRSS format, and
shows information on events filtered by distance to the HA instance's location
and grouped by category.
For more details about this platform, please refer to the documentation at
https://home-assistant.io... | leppa/home-assistant | homeassistant/components/geo_rss_events/sensor.py | Python | apache-2.0 | 5,338 | 0.001124 |
class Spam(Eggs):
def spam_methods(self):
pass
class Eggs(Spam):
def spam_methods(self):
super(Eggs, self).spam_methods()
def my_methods(self):
pass
| asedunov/intellij-community | python/testData/override/circle_after.py | Python | apache-2.0 | 171 | 0.02924 |
# -*- coding: utf-8 -*-
from __future__ import print_function
# Form implementation generated from reading ui file 'acq4/analysis/modules/STDPAnalyzer/STDPPlotsTemplate.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
... | pbmanis/acq4 | acq4/analysis/modules/STDPAnalyzer/STDPPlotsTemplate.py | Python | mit | 3,796 | 0.003952 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2018-08-08 19:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Option... | WarwickAnimeSoc/aniMango | polls/migrations/0001_initial.py | Python | mit | 883 | 0.003398 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# SNABSuite -- Spiking Neural Architecture Benchmark Suite
# Copyright (C) 2017 Christoph Jenzen
#
# 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 F... | hbp-unibi/SNABSuite | plot/histogram.py | Python | gpl-3.0 | 2,636 | 0.003035 |
"""
A framework for data processing and data preparation DAG (directed acyclic graph) pipelines.
The examples in the documentation assume
>>> from __future__ import print_function
if running pre Py3K, as well as
>>> from dagpype import *
"""
import types
from . import _core
from . import _src
from . import _fi... | garywu/pypedream | pypedream/__init__.py | Python | bsd-3-clause | 1,083 | 0.003693 |
import unittest
from ctypes import *
try:
WINFUNCTYPE
except NameError:
# fake to enable this test on Linux
WINFUNCTYPE = CFUNCTYPE
import _ctypes_test
lib = CDLL(_ctypes_test.__file__)
class CFuncPtrTestCase(unittest.TestCase):
def test_basic(self):
X = WINFUNCTYPE(c_int, c_int, c_int)
... | xyuanmu/XX-Net | python3.8.2/Lib/ctypes/test/test_funcptr.py | Python | bsd-2-clause | 4,026 | 0.003974 |
<<<<<<< HEAD
<<<<<<< HEAD
from test.support import verbose, run_unittest, import_module, reap_children
#Skip these tests if either fcntl or termios is not available
fcntl = import_module('fcntl')
import_module('termios')
import errno
import pty
import os
import sys
import select
import signal
import socket
import uni... | ArcherSys/ArcherSys | Lib/test/test_pty.py | Python | mit | 33,998 | 0.003 |
from cvxopt import matrix, solvers
from apgl.data.Standardiser import Standardiser
import numpy
"""
Let's test the massively complicated bound on the clustering error
"""
numpy.set_printoptions(suppress=True, linewidth=150)
numC1Examples = 50
numC2Examples = 50
d = 3
numpy.random.seed(21)
center1 = numpy.array([-1... | charanpald/wallhack | wallhack/clusterexp/BoundExp2.py | Python | gpl-3.0 | 2,119 | 0.007079 |
#import RPi.GPIO as GPIO
import time
def ToString (List): # Coverts List to String
return ''.join(List)
def Setup ():
def Wait ():
reading_file=open('DataStore.txt', 'r')
lines=reading_file.readlines()
#print lines
GoodLine = lines[len(lines) - 1] #GoodLine is the last line of the file!
if len(l... | BostonA/SpudnikPi | Server.py | Python | apache-2.0 | 564 | 0.030142 |
input = """
1 2 2 1 3 4
1 3 2 1 2 4
1 4 0 0
1 5 2 1 6 7
1 6 2 1 5 7
1 7 0 0
1 8 2 1 9 10
1 9 2 1 8 10
1 10 0 0
1 11 2 1 12 13
1 12 2 1 11 13
1 13 0 0
1 14 1 0 2
1 15 1 0 5
1 16 1 0 8
1 17 1 0 11
1 18 1 0 2
1 19 1 0 5
1 20 1 0 2
1 21 1 0 5
1 22 1 0 8
1 23 1 0 11
1 21 2 1 19 20
1 24 1 1 18
1 23 1 0 8
1 25 1 1 18
1 26 1 0... | Yarrick13/hwasp | tests/asp/AllAnswerSets/tight/bug.learning.03.asp.test.py | Python | apache-2.0 | 599 | 0 |
from os import path
try:
from lib.settings_build import Configure
except ImportError:
import sys
from os.path import expanduser, join
sys.path.append(join(expanduser("~"), 'workspace/automation/launchy'))
from lib.settings_build import Configure
class Default(Configure):
def __init__(self):... | amites/nedcompost_wordpress | fabsettings.py | Python | gpl-2.0 | 1,613 | 0.0031 |
from PyQt4.QtGui import *
from electrum_frc.i18n import _
class HistoryWidget(QTreeWidget):
def __init__(self, parent=None):
QTreeWidget.__init__(self, parent)
self.setColumnCount(2)
self.setHeaderLabels([_("Amount"), _("To / From"), _("When")])
self.setIndentation(0)
def empt... | Kefkius/electrum-frc | gui/qt/history_widget.py | Python | gpl-3.0 | 765 | 0.001307 |
from unit_tests.util import *
from unit_tests.AmqpTestCase import AmqpTestCase
from host.implant.Worker import Worker
class TestWorker(AmqpTestCase):
"""
Tests the functionality of the Worker class to process AMQP messages.
"""
def __init__(self):
self.worker = None
def setup(self):
... | orlade/microsimmer | unit_tests/test_host/test_implant/TestWorker.py | Python | mit | 994 | 0.003018 |
from lixian_plugins.api import command
from lixian_cli_parser import command_line_parser, command_line_option
from lixian_cli_parser import with_parser
from lixian_cli import parse_login
from lixian_commands.util import create_client
@command(name='get-torrent', usage='get .torrent by task id or info hash')
@command... | GeassDB/xunlei-lixian | lixian_plugins/commands/get_torrent.py | Python | mit | 1,302 | 0.025346 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import Show, Episode, Category, ShowCategory
# Create custom admins with inlines for categories
class ShowCategoryInline(admin.TabularInline):
model = Category.shows.through
class EpisodeInline(admin.Ta... | KBIAnews/Podcasts | django-project/shows/admin.py | Python | mit | 719 | 0.008345 |
# -*- encoding: utf-8 -*-
# pilas engine - a video game framework.
#
# copyright 2010 - hugo ruscitti
# license: lgplv3 (see http://www.gnu.org/licenses/lgpl.html)
#
# website - http://www.pilas-engine.com.ar
'''
pilas.pilasverion
=================
Definición de la version actual de pilas y funciones para compararla... | irvingprog/pilas | pilas/pilasversion.py | Python | lgpl-3.0 | 1,208 | 0.000835 |
from django.conf.urls import include, patterns, url
from django.views.generic.base import RedirectView
from mdn.urls import mdn_urlpatterns
from webplatformcompat.routers import router
from .views import RequestView, ViewFeature
webplatformcompat_urlpatterns = patterns(
'',
url(r'^$', RequestView.as_view(
... | renoirb/browsercompat | webplatformcompat/urls.py | Python | mpl-2.0 | 1,187 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014 Smile (<http://www.smile.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Aff... | tiexinliu/odoo_addons | smile_module_record/__init__.py | Python | agpl-3.0 | 1,003 | 0 |
from boxbranding import getBoxType, getBrandOEM
from Components.About import about
class HardwareInfo:
device_name = None
device_version = None
def __init__(self):
if HardwareInfo.device_name is not None:
# print "using cached result"
return
HardwareInfo.device_name = "unknown"
try:
file = open("/pr... | BlackHole/enigma2-1 | lib/python/Tools/HardwareInfo.py | Python | gpl-2.0 | 1,714 | 0.032089 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("DummyClassifier" , "digits" , "sqlite")
| antoinecarme/sklearn2sql_heroku | tests/classification/digits/ws_digits_DummyClassifier_sqlite_code_gen.py | Python | bsd-3-clause | 137 | 0.014599 |
# coding=utf-8
import logging
import datetime
import os
filename = datetime.datetime.now().strftime("%Y-%m-%d")
path = './{0}.log'.format(filename)
logger = logging.getLogger("loggingmodule.NomalLogger")
formatter = logging.Formatter("[%(levelname)s][%(funcName)s][%(asctime)s]%(message)s")
handler = logging.FileH... | zhangxu273/JRQ-Order-Collector | JRQ Order Collector/Logger.py | Python | gpl-3.0 | 584 | 0.035959 |
from __future__ import absolute_import, unicode_literals
import logging
from django import forms
from django.contrib import messages
from django.http import Http404
from django.utils.encoding import smart_str
from easy_maps.models import Address
from . import lib
log = logging.getLogger(__name__)
class AddressFor... | jackton1/django_google_app | map_app/forms.py | Python | gpl-3.0 | 4,132 | 0 |
"""
Milestones management commands tests package initialization module
"""
| GbalsaC/bitnamiP | venv/src/edx-milestones/milestones/management/commands/tests/__init__.py | Python | agpl-3.0 | 75 | 0 |
import logging
from datetime import datetime
from flask import request
from dino import environ
from dino.exceptions import NoSuchRoomException
from dino.rest.resources.base import BaseResource
from dino.utils import b64d
from dino.utils.decorators import timeit
logger = logging.getLogger(__name__)
class JoinsInRo... | thenetcircle/dino | dino/rest/resources/joins.py | Python | apache-2.0 | 2,089 | 0.000479 |
import os
def exec_before_job(app, inp_data, out_data, param_dict, tool):
try:
refFile = param_dict['refGenomeSource']['indices'].value
except:
try:
refFile = param_dict['refGenomeSource']['ownFile'].dbkey
except:
out_data['output'].set_dbkey('?')
ret... | volpino/Yeps-EURAC | tools/sr_mapping/bowtie_wrapper_code.py | Python | mit | 507 | 0.005917 |
##
# Copyright (c) 2005-2017 Apple Inc. All rights reserved.
#
# 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... | macosforge/ccs-calendarserver | txweb2/dav/test/test_acl.py | Python | apache-2.0 | 15,068 | 0.001394 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import collections
import logging
from lxml.html import clean
import random
import re
import socket
import threading
import time
from email.header import decode_header
from email.utils import getaddresses, formataddr
fr... | Aravinthu/odoo | odoo/tools/mail.py | Python | agpl-3.0 | 22,248 | 0.003731 |
#!/usr/bin/env python
"""
plot magnetic lattice
"""
import matplotlib.pylab as plt
import numpy as np
f12 = 'AWDall.lat'
data12 = np.loadtxt(f12)
plt.plot(data12[:,0], data12[:,1], 'r-',
data12[:,0], data12[:,2], 'b-',
linewidth=2)
plt.xlim([110,240])
plt.ylim([1.5,1.53])
plt.legend([r'$a_u$',r'$a_d$'],1)
plt... | Archman/pandora | python/scripts/plotaw.py | Python | gpl-2.0 | 420 | 0.038095 |
# -*- coding: utf-8 -*-
#
# AWL simulator - labels
#
# Copyright 2012-2014 Michael Buesch <m@bues.ch>
#
# 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 ... | gion86/awlsim | awlsim/core/labels.py | Python | gpl-2.0 | 2,248 | 0.024466 |
import os
import sys
import numpy as np
import networkx as nx
import graph_partitioning.partitioners.utils as putils
import graph_partitioning.partitioners.scotch.scotch as scotch
import graph_partitioning.partitioners.scotch.scotch_data as sdata
class ScotchPartitioner():
def __init__(self, lib_path, virtualNo... | sbarakat/graph-partitioning | graph_partitioning/scotch_partitioner.py | Python | mit | 10,772 | 0.003992 |
class VideoFile(object):
def __init__(self, filename, position='random', vtype='file', startat=0):
self.filename = filename
self.position = str(position)
self.vtype = vtype
self.startat = startat
def get_input_line(self):
if self.vtype == 'file':
if self.star... | skawouter/piwall-ffmpeg-scenegenerator | vatypes.py | Python | gpl-3.0 | 1,444 | 0.004848 |
from __future__ import print_function
import argparse
import sys
from scipy import *
from scipy.sparse import *
__author__ = 'Sean M. Ryno'
__copyright__ = 'Copyright 2017, Sean M. Ryno'
__credits__ = 'Sean M. Ryno'
__license__ = 'GPL v3.0'
__version__ = '0.1'
__maintainer__ = 'Sean M. Ryno'
__email__ = ... | sryno/rynosm | topology_script/makeITP.py | Python | gpl-3.0 | 47,357 | 0.004392 |
#!/usr/bin/python
# by: Mohammad Riftadi <riftadi@jawdat.com>
# Testing Database instance for CPE Manager
from pymongo import MongoClient
import hashlib
client = MongoClient('mongodb://localhost:27017/')
dbh = client.jawdat_internal
#drop if collections exists
dbh.drop_collection("resetpass")
#drop if collections e... | riftadi/smallcorptools | sct_initdb.py | Python | mit | 11,668 | 0.02194 |
import os
import sys
import django
import datetime
from api.ecs_api import EcsApi
import log.log as log
from multiprocessing import Pool
from time import sleep
import subprocess
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0,BASE_DIR)
os.environ.setdefault("DJANGO_SETTINGS_MOD... | hyperwd/hwcram | crontab/cron.py | Python | mit | 1,727 | 0.012739 |
"""
Internet archive S3 web connector.
Copyright 2008-2010 Internet Archive.
Parts of this are derived from:
Python WebDAV Server.
Copyright (C) 1999 Christian Scholz (ruebe@aachen.heimat.de)
This library is free software; you can redistribute it and/or
modify it under the terms of the GN... | internetarchive/ias3 | s3path.py | Python | lgpl-2.1 | 1,384 | 0.000723 |
#!/usr/bin/env python
# encoding: utf-8
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Versi... | chrismattmann/NLTKRest | nltkrest/nltkrest/server.py | Python | apache-2.0 | 4,079 | 0.006129 |
# Copyright (c) 2012 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | hoangt/gem5v | src/mem/AddrMapper.py | Python | bsd-3-clause | 3,454 | 0.00029 |
#!/usr/bin/python3 -u
#
#
#
#################################################################################
# Start off by implementing a general purpose event loop for anyones use
#################################################################################
import sys
import atexit
import getopt
import os
impor... | beaker-project/beaker-core-tasks | virt/install/py3/zrhel5_write_consolelogs.py | Python | gpl-2.0 | 18,072 | 0.005035 |
from django.shortcuts import render
def home(request):
return render(request, 'home.html', {})
| Traviskn/django_starter_template | {{cookiecutter.project_name}}/{{cookiecutter.project_name}}/views.py | Python | mit | 101 | 0 |
#!/usr/bin/env python
print " Formated number:", "{:,}".format(102403)
| daltonmenezes/learning-C | src/Python/format/thousands_separator.py | Python | mit | 72 | 0 |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import remove_end
class CharlieRoseIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?charlierose\.com/(?:video|episode)(?:s|/player)/(?P<id>\d+)'
_TESTS = [{
'url': 'https://charlierose.com/videos/27996',
'md5': 'fda41d49... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/charlierose.py | Python | gpl-3.0 | 1,554 | 0.027027 |
import data
PRD = 'prd'
from utils import *
def test_messaging(IndivoClient):
try:
BODY = 'body'
SUBJECT = 'subject'
MSG_ID = 'message_id'
SEVERITY = 'severity'
admin_client = IndivoClient(data.machine_app_email, data.machine_app_secret)
admin_client.set_app_id(data.app_email)
ac... | newmediamedicine/indivo_server_1_0 | indivo/tests/integration/test_modules/messaging.py | Python | gpl-3.0 | 2,631 | 0.022045 |
# Portions Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# transaction.py - simple journaling scheme for mercurial
#
# This transaction scheme is intended to gracefully handle program
# errors and int... | facebookexperimental/eden | eden/hg-server/edenscm/mercurial/transaction.py | Python | gpl-2.0 | 25,993 | 0.000846 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2017-02-13 17:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('product', '0028_product_related_title'),
]
operations = [
migrations.RemoveF... | skylifewww/pangolin-fog | product/migrations/0029_auto_20170213_1741.py | Python | mit | 681 | 0.001468 |
from __future__ import unicode_literals
from django.db import models
from django.core.paginator import Paginator, PageNotAnInteger
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailimages.edit_... | samuelleeuwenburg/Samplate | event/models.py | Python | mit | 1,665 | 0.001201 |
#!/usr/bin/python
#Django Imports
from django.db import models
from django.db.models import Q
from django.conf import settings
#Python Imports
import datetime
#Local Imports
from utils.models import TimeStampedModel,ForUserQuerySet
import utils
class ScheduleQuerySet(ForUserQuerySet):
def pending(self,**kwargs... | tperrier/mwachx | contacts/models/visit.py | Python | apache-2.0 | 9,392 | 0.012777 |
#!/usr/bin/python2.5
#
# Copyright 2008 the Melange 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | jamslevy/gsoc | tests/svn_helper_test.py | Python | apache-2.0 | 2,452 | 0.006933 |
import csv
import sys
import numpy as np
import matplotlib.pyplot as plt
if len( sys.argv ) == 1:
print "Please enter the csv file you want to plot!"
sys.exit(0)
points = []
with open( sys.argv[1] ) as csvfile:
reader = csv.reader(csvfile)
points = [ int(c[1]) for c in reader]
print points
xs = range... | MichaelMGonzalez/MagneticFieldLocalization | Arduino/Odometer/Data/Plotter.py | Python | gpl-3.0 | 370 | 0.024324 |
# -*- coding: utf-8 -*-
# © 2016 Elico Corp (www.elico-corp.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models
import report_docx
class IrActionReportDocx(models.Model):
_inherit = 'ir.actions.report.xml'
# @api.model
# def _check_selection_field_valu... | luoguizhou/gooderp_addons | report_docx/report/ir_report.py | Python | agpl-3.0 | 941 | 0.001064 |
##############################################################################
#
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting f... | jeffery9/mixprint_addons | jasper_reports/JasperReports/RecordDataGenerator.py | Python | agpl-3.0 | 5,047 | 0.009709 |
from turbo.flux import Mutation, register, dispatch, register_dispatch
import mutation_types
@register_dispatch('user', mutation_types.INCREASE)
def increase(rank):
pass
def decrease(rank):
return dispatch('user', mutation_types.DECREASE, rank)
@register_dispatch('metric', 'inc_qps')
def inc_qps():
pa... | tao12345666333/app-turbo | demos/helloworld/store/actions.py | Python | apache-2.0 | 322 | 0.006211 |
from .cgc_exploit import CGCExploit
from .c_templates import c_template_type1
import logging
l = logging.getLogger("rex.exploit.cgc.cgc_type1_exploit")
class CGCType1Exploit(CGCExploit):
'''
A CGC exploit object, offers more flexibility than an Exploit object for
the sake of the game. This should repres... | shellphish/rex | rex/exploit/cgc/cgc_type1_exploit.py | Python | bsd-2-clause | 3,456 | 0.002025 |
"""
6 8 7 4 3 2
1. from right to left, find the first element which violates the increasing order, marked as N.
2. from right to left, find the first element which is larger that N, marked as M.
3. swap N and M.
> 7 8 6 4 3 2
4. reverse all digits on the right of M.
> 7 2 3 4 6 8
"""
class Solution:
... | linyaoli/acm | others/hard/next_permutation.py | Python | gpl-2.0 | 1,207 | 0.006628 |
from boxbranding import getBoxType
from twisted.internet import threads
from enigma import eDBoxLCD, eTimer
from config import config, ConfigSubsection, ConfigSelection, ConfigSlider, ConfigYesNo, ConfigNothing
from Components.SystemInfo import SystemInfo
from Tools.Directories import fileExists
import usb
def IconC... | OpenSPA/dvbapp | lib/python/Components/Lcd.py | Python | gpl-2.0 | 18,578 | 0.032189 |
#!/usr/bin/python
##############################################################################
# Copyright 2016-2017 Rigetti Computing
#
# 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 ... | balopat/pyquil | pyquil/tests/test_quil.py | Python | apache-2.0 | 11,288 | 0.001772 |
#!flask/bin/python
from flask import Flask, request
from flask_cors import cross_origin
import os
from subprocess import Popen, PIPE
app = Flask(__name__)
def play_video(url):
os.system('killall omxplayer.bin')
os.system('mkfifo /tmp/omx')
os.system('omxplayer -b "' + url + '" < /tmp/omx &')
os.system('echo ... | arnef/airpi | server/server.py | Python | mit | 1,658 | 0.018094 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# CherryMusic - a standalone music server
# Copyright (c) 2012 Tom Wallroth & Tilman Boerner
#
# Project page:
# http://fomori.org/cherrymusic/
# Sources on github:
# http://github.com/devsnd/cherrymusic/
#
# CherryMusic is based on
# jPlayer (GPL/MIT license) http://w... | SDM-OS/playlist | cherrymusicserver/sqlitecache.py | Python | gpl-3.0 | 32,587 | 0.00356 |
import json
from django.core.urlresolvers import reverse
from nose.tools import eq_, ok_
import mkt
from mkt.api.tests import BaseAPI
from mkt.api.tests.test_oauth import RestOAuth
from mkt.site.fixtures import fixture
from mkt.site.tests import ESTestCase, app_factory
from mkt.tvplace.serializers import (TVAppSeria... | washort/zamboni | mkt/tvplace/tests/test_views.py | Python | bsd-3-clause | 2,926 | 0 |
"""Output: List of direct and indirect dependencies."""
import re
import anymarkup
import itertools
from pathlib import Path
from tempfile import TemporaryDirectory
from f8a_worker.base import BaseTask
from f8a_worker.errors import TaskError
from f8a_worker.process import Git
from f8a_worker.utils import TimedCommand... | jpopelka/fabric8-analytics-worker | f8a_worker/workers/dependency_parser.py | Python | gpl-3.0 | 16,342 | 0.002509 |
# Copyright 2009, Mark Fassler
# 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, version 2 of the License.
import logging
import vtk
from jv.jvPaths import *
import xml.etree.ElementTree as ET
... | mfassler/jaivis | jv/xmlReader.py | Python | gpl-2.0 | 41,125 | 0.009532 |
from django.shortcuts import redirect
class RedirectFirstSubpageMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
# One-time configuration and initialization.
def __call__(self, request):
# Code to be executed for each request before
# the... | bnzk/djangocms-misc | djangocms_misc/basic/middleware/redirect_subpage.py | Python | mit | 1,271 | 0.001574 |
#!/usr/bin/env python3
import subprocess as sp
def main(args):
with open(args.disk, 'rb') as f:
f.seek(args.block * args.block_size)
block = (f.read(args.block_size)
.ljust(args.block_size, b'\xff'))
# what did you expect?
print("%-8s %-s" % ('off', 'data'))
return sp.run... | adfernandes/mbed | storage/filesystem/littlefsv2/littlefs/scripts/readblock.py | Python | apache-2.0 | 858 | 0.006993 |
"""
Django admin page for CourseOverviews, the basic metadata about a course that
is used in user dashboard queries and other places where you need info like
name, and start dates, but don't actually need to crawl into course content.
"""
from __future__ import absolute_import
from config_models.admin import Configura... | ESOedX/edx-platform | openedx/core/djangoapps/content/course_overviews/admin.py | Python | agpl-3.0 | 2,543 | 0.001573 |
"""Placeholder for testing.""" | tturpen/django-csaesrapp | apps/models.py | Python | bsd-2-clause | 30 | 0.033333 |
from opendc.models.cpu import CPU
from opendc.util import exceptions
from opendc.util.rest import Response
def GET(request):
"""Get the specs of a CPU."""
# Make sure required parameters are there
try:
request.check_required_parameters(
path={
'id': 'int'
... | atlarge-research/opendc-web-server | opendc/api/v1/specifications/cpus/id/endpoint.py | Python | mit | 747 | 0 |
# Copyright (c) 2014 - 2016 townhallpinball.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 rights to use, copy, modify, merge, p... | town-hall-pinball/project-omega | pin/lib/dmd.py | Python | mit | 6,277 | 0.000637 |
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import gettext_lazy as _
from devicedata.providers.base_provider import BaseDeviceInfo
from devicedata.providers.base_provider import BaseProvider
from devicedata.providers.base_provider import DeviceIn... | MPIB/Lagerregal | devicedata/providers/opsi.py | Python | bsd-3-clause | 6,368 | 0.003612 |
import cxmate
import logging
import seaborn as sns
from Adapter import IgraphAdapter
from handlers import CommunityDetectionHandlers
logging.basicConfig(level=logging.DEBUG)
# Label for CXmate output
OUTPUT_LABEL = 'out_net'
# Community detection algorithm name
ALGORITHM_TYPE = 'type'
# Palette name
PALETTE_NAME =... | idekerlab/graph-services | services/ig_community/service/test/myservice.py | Python | mit | 1,621 | 0.001851 |
bl_info = {
"name": "MSG",
"author": "jameswilddev",
"version": (0, 0, 0),
"blender": (2, 7, 0),
"location": "File > Export > MasSplat Geometry (.msg)",
"description": "Export triangles as MasSplat Geometry (.msg)",
"category": "Import-Export"
}
import bpy, struct, math, random
class ExportMSG(bpy.types... | jameswilddev/WalkingSimulator | tools/blenderMSG.py | Python | mit | 2,526 | 0.013856 |
from setuptools import setup
setup(setup_requires=["pbr>=2.0.0"], pbr=True)
| chipaca/snapcraft | tests/spread/plugins/v1/python/snaps/python-pbr/python3/setup.py | Python | gpl-3.0 | 77 | 0 |
#!/usr/bin/env python3
import sys
import re
from math import log, sqrt
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
RE_FP = r"[-+]?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?"
CAP_FP = "(%s)" % RE_FP
REGEXES = {"cap_fp" : CAP_FP}
PATTERN_SIEVE_SQ = re.compile(r"# Sieving... | mancoast/cado-nfs | scripts/opal-test/report.py | Python | lgpl-2.1 | 8,520 | 0.003756 |
# Copyright 2018 ETH Zurich
#
# 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, sof... | klausman/scion | python/topology/utils.py | Python | apache-2.0 | 2,247 | 0 |
#!/usr/bin/python
# Internet de las Cosas - http://internetdelascosas.cl
#
# Descripcion : Programa que permite obtener la lectura de un sensor DHT11
# Lenguaje : Python
# Autor : Jose Zorrilla <jzorrilla@iot.cl>
# Dependencias : Libreria de Adafruit https://github.com/adafruit/Adafruit_Python_DHT
# Web ... | luckyz/raspberry | dht11/dht11_examples/dht_log.py | Python | gpl-3.0 | 1,700 | 0.017647 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('rip', '0004_auto_20141218_1303'),
]
operations = [
migrations.AlterFie... | harinarayan/litmus | rip/migrations/0005_auto_20141218_1306.py | Python | gpl-2.0 | 769 | 0.0013 |
"""
Copyright (c) 2016 Gabriel Esteban
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute... | galaxyfeeder/CodeSubmission | main/admin.py | Python | mit | 1,131 | 0.007958 |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
DBSession = scoped_session(sessionmaker())
Base = declarative_base()
def initialize_sql(engine):
from user import User # NOQA
from contract import Contract # NOQA
from evaluation import Eval... | Backfeed/backfeed-protocol | backfeed_protocol/models/__init__.py | Python | gpl-3.0 | 850 | 0.001176 |
"""
Udacity CS253 - Lesson 5 - Homework 1
"""
import webapp2, handlers
app = webapp2.WSGIApplication([
('/', handlers.HomePage),
('/newpost', handlers.NewPostPage),
('/signup', handlers.SignupPage),
('/login', handlers.LoginPage),
('/logout', handlers.LogoutPage),
('/welcome', handlers.WelcomePage),
('... | vcelis/cs253 | lesson5/homework1/blog.py | Python | mit | 438 | 0.004566 |
from utils import peak_measurement, background_subtract
from utils import absolute_efficiency, isotope_activity
import SPEFile
class ReferenceBase(object):
"""
Generates a reference object that contains a reference mass and
concentrations. Mass is in kg and concentrations are in percent for
K-40 and p... | yarocoder/radwatch-analysis | Gamma_Reference.py | Python | mit | 4,730 | 0 |
# 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/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_workspace_connections_operations.py | Python | mit | 16,366 | 0.004827 |
# Copyright (c) 2015-2018 by the parties listed in the AUTHORS file.
# All rights reserved. Use of this source code is governed by
# a BSD-style license that can be found in the LICENSE file.
"""
sim_det_noise.py implements the noise simulation operator, OpSimNoise.
"""
import numpy as np
from ..op import Operator... | tskisner/pytoast | src/python/tod/sim_det_noise.py | Python | bsd-2-clause | 6,740 | 0.000445 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Samrai(AutotoolsPackage):
"""SAMRAI (Structured Adaptive Mesh Refinement Application Infra... | LLNL/spack | var/spack/repos/builtin/packages/samrai/package.py | Python | lgpl-2.1 | 4,890 | 0.004499 |
# 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 ... | sharadagarwal/autorest | AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/header_operations.py | Python | mit | 5,835 | 0.001714 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_fs_village_whip.iff"
result.attribute_template_id = 9
... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_fs_village_whip.py | Python | mit | 448 | 0.046875 |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""MSTIC S... | VirusTotal/msticpy | msticpy/sectools/__init__.py | Python | mit | 788 | 0 |
from . import accounting
from . import proc
from . import sessions
| borg-project/borg | borg/unix/__init__.py | Python | mit | 68 | 0.014706 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.