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 |
|---|---|---|---|---|---|
from django.test import TestCase
from mdot.mdot_rest_client.client import MDOT, ClientResource
class MdotClientErrorTest(TestCase):
def test_get_resource_by_id(self):
"""
WILL TEST retrieval of a resource by it's id.
"""
with self.settings(
RESTCLIENTS_MDOT_DAO_CLASS='M... | charlon/mdot | mdot/test/client_error_catching.py | Python | apache-2.0 | 8,028 |
import patches.base
import patches.utils
from turbogears import database
from datetime import datetime
from sqlobject import AND, IN, OR, NOT
class Patch(patches.base.Patch):
description = "Changes to the architecture of MicroSites to support the concepts of Pages, list_items, and rendered objects"
def apply(s... | thehub/hubspace | patches/022.py | Python | gpl-2.0 | 750 |
#!/usr/bin/env python3
"""A specialised io module for binary ``.ply`` files containing XYZRGB points.
Most uses of this module should go through :py:func:`read` to iterate over
points in the file, or :py:func:`write` to save an iterable of points.
Neither function accumulates much data in memory.
:py:class:`Increment... | borevitzlab/3D-tools | src/pointcloudfile.py | Python | gpl-3.0 | 9,952 |
import http_server
server = http_server.HTTPServer(8080)
server.run()
| serpis/pynik | httpsrv/main.py | Python | mit | 71 |
from __future__ import absolute_import, division, print_function
# import base64
from copy import copy
from functools import partial
import six
from google.protobuf.descriptor import FieldDescriptor
from google.protobuf.message import Message
__all__ = ('protobuf_to_dict',
'dict_to_protobuf',
'... | kszucs/proxo | proxo/protobuf.py | Python | apache-2.0 | 4,894 |
import os
import random
from itertools import chain, product
from collections import defaultdict, namedtuple
import numpy as np
from sequence import reverse_complement
SHAPE_PARAM_TYPE = 'float32'
def iter_fivemers(seq):
for start in xrange(len(seq) - 5 + 1):
yield seq[start:start+5]
return
ShapeD... | nboley/pyDNAbinding | pyDNAbinding/shape.py | Python | gpl-2.0 | 3,357 |
import logging
from math import floor
import pygame
from .core import King, BOARD_SIZE
logger = logging.getLogger(__name__)
# COLORS
# R G B
WHITE = (255, 255, 255)
BLUE = ( 0, 0, 255)
RED = (255, 0, 0)
BLACK = ( 0, 0, 0)
GOLD = (255, 215, 0)
YELLOW = (255, 255,... | sdolemelipone/draughts | draughts/graphics.py | Python | gpl-3.0 | 3,845 |
# Hardcoding is evil but at least it can be segregated.
server="127.0.0.1"
port="7890"
| bbulkow/MagnusFlora | led/ledlib/hardcode/fcserverconfig.py | Python | mit | 89 |
"""Screen database."""
import redis_client
import control
import re
from twisted.internet import defer
class ScreenDB(object):
"""A screen database."""
def __init__(self):
"""Default constructor."""
pass
def set_mode(self, screen, mode):
redis_client.connection.set('screen:{0}:mod... | prophile/compd | src/screen_db.py | Python | mit | 2,580 |
# -*- coding: utf-8 -*-
"""Tutorial on using the InfluxDB client."""
import argparse
from influxdb import InfluxDBClient
def main(host='localhost', port=8086):
"""Instantiate a connection to the InfluxDB."""
user = 'root'
password = 'root'
dbname = 'example'
dbuser = 'smly'
dbuser_password =... | omki2005/influxdb-python | examples/tutorial.py | Python | mit | 2,065 |
#########################################
## DennisX User-Managed MUD Server Kit ##
## room.py ##
## Room Handling ##
## Copyright 2013 PariahSoft LLC ##
#########################################
## **********
## Permission is hereby granted, free of charge, to a... | pariahsoft/DennisX | inc/room.py | Python | mit | 3,494 |
from collections import namedtuple
from datetime import datetime, timedelta
from django.db import models
from django.urls import reverse_lazy as reverse
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from djangocms_text_ckeditor.fields import HTMLField
from... | leprikon-cz/leprikon | leprikon/models/journals.py | Python | bsd-3-clause | 9,926 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ... | plumgrid/plumgrid-nova | nova/virt/xenapi/volume_utils.py | Python | apache-2.0 | 10,644 |
# Copyright 2016-2017 Florian Pigorsch & Contributors. All rights reserved.
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
from . import utils
class TracksDrawer:
def __init__(self):
self.poster = None
def draw(self, poster, d, w, h, offset_x,... | lefty01/GpxTrackPoster | src/grid_drawer.py | Python | mit | 3,173 |
#!/usr/bin/env python
##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatib... | pli3/e2-openwbif | plugin/controllers/views/web/loadepg.py | Python | gpl-2.0 | 5,152 |
from tests.unit.fixtures import mock_commands_po as mock_po
def test_get_value_method_delegates_to_webelement_with_correct_parameter(mock_po):
correct_parameter = 'value'
mock_po.webelement.get_attribute = lambda attr, log=True: attr
assert mock_po.get_value() == correct_parameter
| lukas-linhart/pageobject | tests/unit/commands/test_get_value.py | Python | mit | 297 |
"""Command-line user interface of igraph
The command-line interface launches a Python shell with the igraph
module automatically imported into the main namespace. This is mostly a
convenience module and it is used only by the C{igraph} command line
script which executes a suitable Python shell and automatically import... | janschulz/igraph | interfaces/python/igraph/app/shell.py | Python | gpl-2.0 | 18,023 |
"""
Copyright 2014-2021 University of Illinois
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 writ... | opena11y/fae2 | fae2/populate/pop_wcag.py | Python | apache-2.0 | 4,765 |
# -*- coding: utf8 -*-
"""
Инициализация класса графики.
"""
class ClsGUI(object):
"""
Главный класс GUI для приложения. Является точкой подключения всех
графических ресурсов.
"""
def __init__(self, root=None):
"""
Импорт всех возможных окон.
:param root:
:return:
... | prospero78/pyPC | pak_pc/pak_gui/mod_gui.py | Python | lgpl-3.0 | 2,287 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright © 2014 Martin Ueding <dev@martin-ueding.de>
# Licensed under The Lesser GNU Public License Version 2 (or later)
from setuptools import setup, find_packages
setup(
author="David Pine",
description="Least squares linear fit for numpy library of Python",
... | djpine/linfit | setup.py | Python | lgpl-2.1 | 560 |
from __future__ import absolute_import
from .base import Filter
import re
from sentry.utils.data_filters import FilterStatKeys
EXTENSION_EXC_VALUES = re.compile(
'|'.join(
(
re.escape(x)
for x in (
# Random plugins/extensions
'top.GLOBALS',
... | ifduyue/sentry | src/sentry/filters/browser_extensions.py | Python | bsd-3-clause | 3,977 |
import heapq
from .cfg import makeGraph, flattenDict
# Variables x and y can safely be merged when it is true that for any use of y (respectively x)
# that sees a definition of y, either there are no intervening definitions of x, or x was known
# to be equal to y *at the point of its most recent definition*
# Given t... | difcareer/Krakatau | Krakatau/java/mergevariables.py | Python | gpl-3.0 | 9,778 |
from Components.config import config, ConfigSubsection, ConfigSubList, ConfigInteger, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence, ConfigYesNo
import TitleCutter
class ConfigFixedText(ConfigText):
def __init__(self, text, visible_width=60):
ConfigText.__init__(self, default = text, fixed_size = ... | XTAv2/Enigma2 | lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py | Python | gpl-2.0 | 6,505 |
import re
from collections import Counter
from optparse import OptionParser
from ..feature_extractors import vocabulary, tokenizer
from ..util import file_handling as fh, defines
def prepare_data_for_rnn(datasets, min_threshold=1, n=1):
input_filename = defines.data_normalized_text_file
responses = fh.read_j... | dallascard/guac | core/rnn/extract_ngram_tokens_for_rnn.py | Python | apache-2.0 | 2,934 |
from django.contrib.auth import get_user_model
from django.views.generic import TemplateView
from rest_framework import viewsets
from rest_framework.permissions import IsAdminUser, DjangoModelPermissionsOrAnonReadOnly
from .models import Catastrophe
from .serializers import UserSerializer, CatastropheSerializer
cla... | MCGallaspy/catastrophe-clock | catastrophe_clock/views.py | Python | mit | 855 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-07-19 09:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('street_agitation_bot', '0011_agitationevent_agitators_limit'),
]
operations = [
... | Kurpilyansky/street-agitation-telegram-bot | street_agitation_bot/migrations/0012_auto_20170719_0929.py | Python | gpl-3.0 | 671 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 OpenStack 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... | nii-cloud/dodai-compute | nova/tests/utils.py | Python | apache-2.0 | 2,170 |
# This file is covered by the GPL as part of Rubber.
# (c) Emmanuel Beffara, 2002--2006
"""
Metapost support for Rubber.
The module parses input files for dependencies and does some checkings on
Metapost's log files after the process. Is it enough?
"""
import os, os.path
import re, string
from rubber import _
from r... | sre/rubber | src/converters/mpost.py | Python | gpl-2.0 | 6,296 |
import json
import urllib.request
class AppURLopener(urllib.request.FancyURLopener):
version = "App/1.7"
def search_song_lyrics(artist, song_name):
try:
opener = AppURLopener()
response = opener.open(
'http://api.lyricsnmusic.com/songs?' +
'api_key=d232f509b3d2f6a11fa... | SimeonRolev/RolevPlayerQT | RolevPlayer/RequestLyrics.py | Python | gpl-3.0 | 1,000 |
"""
Tests for ExtraFieldsTransformer.
"""
from django.test import override_settings
# pylint: disable=protected-access
from openedx.core.djangoapps.content.block_structure.factory import BlockStructureFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-... | eduNEXT/edx-platform | lms/djangoapps/course_api/blocks/transformers/tests/test_extra_fields.py | Python | agpl-3.0 | 1,963 |
# -*- coding: utf-8 *-*
# Copyright (c) 2013 Tisserant Pierre
#
# This file is part of Dragon dice simulator.
#
# Dragon dice simulator 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 ve... | TheLazyHase/dragon_dice_simulator | business/dice/face/special_on_melee/surprise.py | Python | gpl-3.0 | 1,092 |
#!/usr/bin/python
#
# Urwid container widget classes
# Copyright (C) 2004-2012 Ian Ward
#
# 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 Licen... | bk2204/urwid | urwid/container.py | Python | lgpl-2.1 | 84,505 |
import os
import subprocess
import psycopg2
import momoko
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.escape
from tornado import gen
from tornado.options import define, options
from handlers import (AuthCreateUserHandler,
AuthLoginHan... | freundallein/marynado | application.py | Python | apache-2.0 | 3,900 |
"""
Format the current file with black or isort.
Available in Tools/Python/Black and Tools/Python/Isort.
"""
from __future__ import annotations
import logging
import subprocess
import traceback
from functools import partial
from pathlib import Path
from tkinter import messagebox
from porcupine import menubar, tabs,... | Akuli/porcupine | porcupine/plugins/python_tools.py | Python | mit | 2,238 |
# This file is part of REXT
# core.Harvester.py - super class for harvester scripts
# Author: Ján Trenčanský
# License: GNU GPL v3
import cmd
import core.globals
import interface.utils
from interface.messages import print_error, print_help
class RextHarvester(cmd.Cmd):
host = ""
port = "80"
def __init_... | j91321/rext | core/Harvester.py | Python | gpl-3.0 | 1,762 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | mlperf/training_results_v0.7 | Google/benchmarks/maskrcnn/implementations/maskrcnn-research-TF-tpu-v4-512/object_detection/argmax_matcher.py | Python | apache-2.0 | 9,028 |
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------
# videolibrary.py - jsonrpc interface for XBMC-compatible remotes
# -----------------------------------------------------------------------
# $Id$
#
# JSONRPC and XBMC eventserver to be used for XBMC-compatible
# remo... | pacificIT/freevo2 | src/plugins/jsonrpc/videolibrary.py | Python | gpl-2.0 | 12,369 |
# ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | WCCCEDU/twitter-commons | src/python/twitter/common/log/initialize.py | Python | apache-2.0 | 9,100 |
# -*- coding: utf-8 -*-
from ckan_sdk import (Packages,
Groups,
Tags,
Resource)
import pprint
s = Packages()
pprint.pprint(s.get())
pprint.pprint(s.help)
pprint.pprint(s.resp)
# search
pprint.pprint(s.search(q='spending'))
pprint.pprint(s.help)
s = ... | rosscdh/ckan-parliament-uk | examples.py | Python | mit | 603 |
#! /usr/bin/python
import argparse
import logging
import os
import re
import subprocess
import sys
import xdg.BaseDirectory as xdgbase
import time
APP_NAME = 'nag'
def main():
App().Run()
class App(object):
def __init__(self):
self.key_sequence = KeySequence()
self.nag_interval = 300
self.nag_hea... | johnw42/nag | nag.py | Python | gpl-2.0 | 5,919 |
import sublime
import sublime_plugin
class CopyPathToClipboard(sublime_plugin.TextCommand):
def run(self, edit):
line_number, column = self.view.rowcol(self.view.sel()[0].begin())
line_number += 1
sublime.set_clipboard(self.view.file_name() + ':' + str(line_number)) | ice3/shellrc | config/sublime-text-2/Packages/User/copy_path_to_clipboard.py | Python | gpl-3.0 | 297 |
from django.core.exceptions import ValidationError
from django.db import connection
from django.db.models import (
CharField, ForeignKey, ManyToManyField, PROTECT, BooleanField)
from django.urls import reverse
from django.utils.html import strip_tags
from django.utils.safestring import mark_safe
from django.utils.t... | dezede/dezede | libretto/models/individu.py | Python | bsd-3-clause | 12,969 |
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import account_invoice
from . import l10n_br_account
from . import l10n_br_account_service
from . import product
from . import res_company
from . import res_partner
| thinkopensolutions/l10n-brazil | l10n_br_account_service/models/__init__.py | Python | agpl-3.0 | 307 |
""" Basic fields """
import pytz
import inspect
import datetime
import decimal
from pyramid.compat import NativeIO
from . import iso8601
from . import vocabulary
from .field import InputField
from .fieldset import Fieldset
from .directives import field
from .composite import CompositeField
from .interfaces import _, n... | djedproject/djed.form | djed/form/fields.py | Python | isc | 15,778 |
#!/usr/bin/python3
import os, os.path
import sys
sys.path=[os.path.dirname(__file__)]+sys.path
from subprocess import call, Popen, PIPE, STDOUT
from tm import imgWidthFilter, labelFilter, svgFilter
from MarkdownPP import MarkdownPP
from MarkdownPP.Modules import modules
# just for translations
from PyQt5 import QtCor... | csparkresearch/ExpEYES17-Qt | SPARK17/textManual/textManual.py | Python | mit | 4,975 |
# -*- coding: utf-8 -*-
# Copyright 2008 Jaap Karssenberg <jaap.karssenberg@gmail.com>
'''Test cases for the zim.fs module.'''
from __future__ import with_statement
import tests
import os
import time
import zim.fs
from zim.fs import *
from zim.errors import Error
def modify_file_mtime(path, func):
'''Helper fu... | Osndok/zim-desktop-wiki | tests/fs.py | Python | gpl-2.0 | 15,370 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import MySQLdb, sys
# for ide
if False:
from gluon import *
def clumusuario(email):
"""consulto usuario tabla clave unificada"""
dbmysql = MySQLdb.connect(
host=myconf.take('datos.clum_srv'),
port=int(myconf.take('datos.clum_port')),
... | redondomarco/useradm | src/models/unificada.py | Python | gpl-3.0 | 16,421 |
# ------------------------------------------------------------------------------
# Security Central
# ------------------------------------------------------------------------------
from .models import User
from pyramid.security import Allow, Everyone, Authenticated, ALL_PERMISSIONS
from pyramid.authentication import Se... | linuxsoftware/dominoes | davezdominoes/gamecoordinator/security.py | Python | agpl-3.0 | 5,040 |
from django.http import Http404
from django.shortcuts import get_object_or_404, render, redirect
from django.utils.encoding import force_text
from django.utils.text import capfirst
from django.contrib.contenttypes.models import ContentType
from django.contrib import messages
from django.contrib.auth.decorators import p... | benemery/wagtail | wagtail/wagtailsnippets/views/snippets.py | Python | bsd-3-clause | 8,696 |
import os
import re
import sys
import warnings
import numpy as np
import pandas as pd
from PySide import *
from PySide import QtGui
from PySide.QtCore import *
from PySide.QtCore import QUrl
from PySide.QtGui import *
from PySide.QtWebKit import QWebView
import math
# TODO: CLEAN OUTLIERS ON A PER 50m ... | BrettMontague/Wellplotting | Wellplotting v06.py | Python | gpl-3.0 | 39,201 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Gilles-Alexandre Quenot
#
# This file is part of weboob.
#
# weboob 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 License, or
# (at... | eirmag/weboob | modules/fortuneo/browser.py | Python | agpl-3.0 | 3,664 |
"""Tests for classes defined in fields.py."""
import datetime
import unittest
from pytz import UTC
from xmodule.fields import Date, Timedelta, RelativeTime
from xmodule.timeinfo import TimeInfo
class DateTest(unittest.TestCase):
date = Date()
def compare_dates(self, dt1, dt2, expected_delta):
self... | lduarte1991/edx-platform | common/lib/xmodule/xmodule/tests/test_fields.py | Python | agpl-3.0 | 8,266 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2013 NTT MCL, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# n... | Havate/havate-openstack | proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/dashboards/project/network_topology/panel.py | Python | apache-2.0 | 1,152 |
#
# boji.py - mock koji XML-RPC and bodhi RESTful interface
#
# Copyright 2011, Red Hat, 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 opt... | tflink/mock_fedorainfra | mock_fedorainfra/boji.py | Python | gpl-2.0 | 8,965 |
from .diagram_structures import Node, Connection
from .action_def import ACTION_TYPES
import PyQt5.QtCore as QtCore
class Diagram():
def __init__(self, **kwargs):
self.nodes = []
"""List of diagram nodes"""
self.connections = []
"""List of diagram connections"""
self.file =... | GeoMop/GeoMop | src/Analysis/ui/data/diagram.py | Python | gpl-3.0 | 3,096 |
# -*- coding: utf-8 -*-
"""
File name: __init__
Reference:
Introduction:
Date: 2016-05-20
Last modified: 2016-05-22
Author: enihsyou
"""
import algorithm.bubble_sort
import algorithm.build_in
import algorithm.cocktail_shaker_sort
import algorithm.heap_sort
import algorithm.insertion_sort
import algorithm.merge_sort
imp... | enihsyou/Sorting-algorithm | algorithm_Python/__init__.py | Python | mit | 677 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2012 ~ 2013 Deepin, Inc.
# 2012 ~ 2013 Hailong Qiu
#
# Author: Hailong Qiu <356752238@qq.com>
# Maintainer: Hailong Qiu <356752238@qq.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | linuxdeepin/deepin-media-player | src/widget/playlistview.py | Python | gpl-3.0 | 11,382 |
# -*- test-case-name: twisted.test.test_nmea -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""NMEA 0183 implementation
Maintainer: Bob Ippolito
The following NMEA 0183 sentences are currently understood::
GPGGA (fix)
GPGLL (position)
GPRMC (position and time)
GPGSA (acti... | ecolitan/fatics | venv/lib/python2.7/site-packages/twisted/protocols/gps/nmea.py | Python | agpl-3.0 | 7,960 |
from south.db import db
from django.db import models
from channelguide.channels.models import *
class Migration:
def forwards(self, orm):
# Adding model 'AddedChannel'
db.create_table('cg_channel_added', (
('timestamp', orm['channels.AddedChannel:timestamp']),
... | kmshi/miroguide | channelguide/channels/migrations/0001_initial.py | Python | agpl-3.0 | 14,056 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | luzheqi1987/nova-annotation | nova/tests/unit/integrated/v3/test_deferred_delete.py | Python | apache-2.0 | 1,615 |
# -*- coding: utf-8 -*-
from PyQt5 import QtCore, QtBluetooth
from PIL import Image,ImageDraw,ImageFont
import binascii
import time
from functools import reduce
class MetawatchThread(QtCore.QObject):
connected = QtCore.pyqtSignal()
disconnected = QtCore.pyqtSignal()
readyRead = QtCore.pyqtSignal()
error = Qt... | GFEeV/SUNHand | Devices/MetaWatch/metawatchThread.py | Python | gpl-3.0 | 5,970 |
# postgresql/pypostgresql.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: postgresql+pypostgresql
:name: py-postgresql
:dbap... | jessekl/flixr | venv/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/pypostgresql.py | Python | mit | 2,169 |
#-*- coding: utf-8 -*-
from django.db.models import Manager
from django.shortcuts import get_object_or_404
from django.db.models import Q
class TopicManager(Manager):
def _for_all(self):
return self.filter(Q(category__parent=None) | Q(category__parent__is_removed=False),
categ... | Si-elegans/Web-based_GUI_Tools | spirit/managers/topic.py | Python | apache-2.0 | 2,144 |
import pytest
from saleor.graphql.core.utils.reordering import perform_reordering
from saleor.product import models
SortedModel = models.AttributeValue
def _sorted_by_order(items):
return sorted(items, key=lambda o: o[1])
def _get_sorted_map():
return list(
SortedModel.objects.values_list("pk", "s... | maferelo/saleor | tests/api/test_core_reordering.py | Python | bsd-3-clause | 8,739 |
# Under MIT License, see LICENSE.txt
from Model.DataObject.BaseDataObject import catch_format_error
from Model.DataObject.DrawingData.BaseDataDraw import BaseDataDraw
__author__ = 'RoboCupULaval'
class DrawRectDataIn(BaseDataDraw):
def __init__(self, data_in):
super().__init__(data_in)
self._for... | RoboCupULaval/UI-Debug | Model/DataObject/DrawingData/DrawRectDataIn.py | Python | mit | 2,638 |
"""Reusable cryptopals module."""
from base64 import b64encode
from binascii import hexlify, unhexlify
def hex_to_base64(s):
"""Converts a hex string to base64."""
return b64encode(unhexlify(s))
def fixed_xor(s1, s2):
"""XORs two hex strings."""
return hexlify(''.join(chr(ord(c1) ^ ord(c2)) for c1, c... | dougludlow/cryptopals | sets/1/challenges/cryptopals.py | Python | mit | 520 |
import extractCsvData as CD
import config
class Singleton:
"""
A non-thread-safe helper class to ease implementing singletons.
This should be used as a decorator -- not a metaclass -- to the
class that should be a singleton.
The decorated class can define one `__init__` function that
takes onl... | iut-ibk/DynaMind-ToolBox | DynaMind-Performance-Assessment/3rdparty/CD3Waterbalance/WaterDemandModel/sampling_db.py | Python | gpl-2.0 | 5,979 |
#!/usr/env python
# -*- coding: utf-8 -*-
# =============================================================================
import ROOT
from ostap.core.core import cpp, hID, VE
import ostap.histos.histos
import ostap.histos.graphs
import ostap.histos.param
import ostap.histos.compare
# =================... | OstapHEP/ostap | ostap/histos/__init__.py | Python | bsd-3-clause | 472 |
''' Provide a base class for all Bokeh Server Protocol message types.
Boker messages are comprised of a sequence of JSON fragments. Specified as
Python JSON-like data, messages have the general form:
.. code-block:: python
[
# these are required
b'{header}', # serialized header dict
... | mindriot101/bokeh | bokeh/protocol/message.py | Python | bsd-3-clause | 8,808 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | ksrajkumar/openerp-6.1 | openerp/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py | Python | agpl-3.0 | 8,656 |
"""
Course API Serializers. Representing course catalog data
"""
import urllib
from django.urls import reverse
from edx_django_utils import monitoring as monitoring_utils
from rest_framework import serializers
from openedx.core.djangoapps.content.course_overviews.models import \
CourseOverview # lint-amnesty,... | eduNEXT/edx-platform | lms/djangoapps/course_api/serializers.py | Python | agpl-3.0 | 6,807 |
#! /usr/bin/env python
"""
Run tests.
"""
import sys
import os
import argparse
import inspect
import subprocess
import re
import dendropy
from dendropy import treecalc
from dendropy.interop import paup
class AnsiColorMeta(type):
##############################################################################
... | jeetsukumaran/treeshrew | test/scripts/run-tests.py | Python | gpl-2.0 | 19,904 |
import datetime
from dateutil import rrule
from django.conf import settings as django_settings
from django.contrib.contenttypes import fields
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import Q
from django.template.defaultfilters import date
from djang... | llazzaro/django-scheduler | schedule/models/events.py | Python | bsd-3-clause | 26,473 |
import itertools
import string
import unicodedata
from functools import partial
from random import choice, randrange
from unittest.mock import Mock
import pytest
from orderedset import OrderedSet
from notifications_utils import SMS_CHAR_COUNT_LIMIT
from notifications_utils.countries import Country
from notifications_... | alphagov/notifications-utils | tests/test_recipient_csv.py | Python | mit | 40,659 |
#!/usr/bin/env python
# This file is part of OMG-tools.
#
# OMG-tools -- Optimal Motion Generation-tools
# Copyright (C) 2016 Ruben Van Parys & Tim Mercy, KU Leuven.
# All rights reserved.
#
# OMG-tools is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# Lice... | meco-group/omg-tools | examples/ros_example/src/p3dx_motionplanner/src/controller.py | Python | lgpl-3.0 | 12,112 |
# -----------------------------------------------------------
# basic implementation of a queue for multiprocessing
#o
# (C) 2015-2017 Frank Hofmann, Berlin, Germany
# Released under GNU Public License (GPL)
# email frank.hofmann@efho.de
# -----------------------------------------------------------
# define basic modu... | hofmannedv/training-python | queue/queue-multiprocessing.py | Python | gpl-2.0 | 2,388 |
"""empty message
Revision ID: 40f48d69b68
Revises: 1265912a75
Create Date: 2016-03-30 14:12:17.280281
"""
# revision identifiers, used by Alembic.
revision = '40f48d69b68'
down_revision = '1265912a75'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please... | EnvGen/BARM_web_server | migrations/versions/40f48d69b68_.py | Python | gpl-2.0 | 1,339 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2009,2010,2011,2012,2013,2014,2015,2016,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... | quattor/aquilon | lib/aquilon/worker/commands/bind_client_cluster.py | Python | apache-2.0 | 2,797 |
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 - 2015 Bram Schoenmakers <me@bramschoenmakers.nl>
#
# 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 L... | MinchinWeb/topydo | topydo/lib/TodoListBase.py | Python | gpl-3.0 | 8,337 |
import sys
tests = [("testExecs/main.exe", "", {}), ]
longTests = []
if __name__ == '__main__':
import sys
from rdkit import TestRunner
failed, tests = TestRunner.RunScript('test_list.py', 0, 1)
sys.exit(len(failed))
| rvianello/rdkit | Code/Numerics/EigenSolvers/test_list.py | Python | bsd-3-clause | 228 |
"""Check that raise ... from .. uses a proper exception context """
# pylint: disable=unreachable, import-error
import socket, unknown
__revision__ = 0
class ExceptionSubclass(Exception):
""" subclass """
def test():
""" docstring """
raise IndexError from 1
raise IndexError from None
raise Ind... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/pylint/test/input/func_bad_exception_context_py30.py | Python | agpl-3.0 | 669 |
# -*- coding: utf-8 -*-
u"""Suddenly.
---
layout: post
source: Reference for Writers
source_url: http://bit.ly/1E94vyD
title: suddenly
date: 2014-06-10 12:31:19
categories: writing
---
“Sudden” means quickly and without warning, but using the word “suddenly” both
slows down the action and warns you... | jstewmon/proselint | proselint/checks/palahniuk/suddenly.py | Python | bsd-3-clause | 1,518 |
#!/usr/bin/python -OO
# This file is part of Archivematica.
#
# Copyright 2010-2012 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica 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, e... | artefactual/archivematica-history | src/MCPClient/lib/clientScripts/verifyAndRestructureTransferBag.py | Python | agpl-3.0 | 3,088 |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | pigeonflight/strider-plone | docker/appengine/google/appengine/ext/datastore_admin/backup_handler.py | Python | mit | 66,025 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
dataobject.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
****************************... | jarped/QGIS | python/plugins/processing/tools/dataobjects.py | Python | gpl-2.0 | 16,227 |
import cv2
import numpy as np
def fold_line(i, line):
x1, y1, x2, y2 = line
dx, dy = (x2 - x1, y2 - y1)
angle = np.arctan2(dy, dx) + (-1) ** i * np.pi / 4
leg = np.cos(np.pi / 4) * np.sqrt(dx ** 2 + dy ** 2)
x3 = x1 + np.cos(angle) * leg
y3 = y1 + np.sin(angle) * leg
line1 = [x1, y1, x3, y... | Billtholomew/Fractals | dragon.py | Python | mit | 876 |
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... | detiber/lib_openshift | test/test_v1beta1_deployment_rollback.py | Python | apache-2.0 | 1,366 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains th... | shirtsgroup/physical-validation | physical_validation/_version.py | Python | lgpl-2.1 | 18,480 |
"""
Updates a SiteConfiguration to include new DOT-specific OAUTH2 settings.
"""
import logging
from django.contrib.sites.models import Site
from django.core.management import BaseCommand
from oscar.core.loading import get_model
from ecommerce.core.models import SiteConfiguration
logger = logging.getLogger(__name__)... | eduNEXT/edunext-ecommerce | ecommerce/core/management/commands/update_site_oauth_settings.py | Python | agpl-3.0 | 3,215 |
from logpy.unification import unify, reify, _unify, _reify
from logpy import var
def test_reify():
x, y, z = var(), var(), var()
s = {x: 1, y: 2, z: (x, y)}
assert reify(x, s) == 1
assert reify(10, s) == 10
assert reify((1, y), s) == (1, 2)
assert reify((1, (x, (y, 2))), s) == (1, (1, (2, 2)))
... | cpcloud/logpy | logpy/tests/test_unification.py | Python | bsd-3-clause | 1,783 |
import threading
import time
class Thread(threading.Thread):
def run(self):
print("{} inicio".format(self.getName()))
time.sleep(1)
print("{} terminado".format(self.getName()))
if __name__ == "__main__":
for i in range(4):
thread = Thread(name="Thread {}".format(i+1))
t... | andresmtz98/GoogleNews_Scraper_Django | news/thread.py | Python | mit | 356 |
# -*- Mode: Python -*-
# GObject-Introspection - a framework for introspecting GObject libraries
# Copyright (C) 2008 Johan Dahlin
#
# 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; eithe... | jackjansen/gobject-introspection | giscanner/odict.py | Python | gpl-2.0 | 1,630 |
# Copyright 2014-2015 MongoDB, 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 to in writi... | elioth010/lugama | venv/lib/python2.7/site-packages/pymongo/settings.py | Python | gpl-2.0 | 3,353 |
import install
| oleiade/Elevator | fabfile/__init__.py | Python | mit | 15 |
# -*- coding: utf-8 -*-
from .generator import *
| nk113/django-ficuspumila | ficuspumila/core/common/fixtures/__init__.py | Python | bsd-3-clause | 49 |
# ----------------------------------------------------------------------------
# Copyright 2015-2016 Nervana Systems 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.apa... | matthijsvk/multimodalSR | code/Experiments/neon-master/neon/data/aeon_shim.py | Python | mit | 1,096 |
"""
This is some of the code behind 'cobbler sync'.
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 distribute... | nacc/cobbler | cobbler/modules/manage_in_tftpd.py | Python | gpl-2.0 | 6,507 |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
Custom storage for Documents to allow dynamic MEDIA_ROOT paths
"""
from django.core.files.storage import FileSystemStorage
from django.core.exceptions import SuspiciousOperation
from django.utils._os imp... | rogeriofalcone/treeio | documents/files.py | Python | mit | 679 |
#! /usr/bin/env python
""" detect arrow and direction printed on the side box
author: ren ye
changelog:
(2017-01-29) init
"""
import cv2
# import numpy as np
from cv_utils import *
# ## main ##
# picture folder
image_path = "image/arrow.png"
# image_path = "image/blue_right.png"
# #### load picture ####
img = cv2.i... | reinaldomaslim/Project_Bixi | bixi_vision/src/bixi_vision/arrow_detector.py | Python | gpl-3.0 | 1,344 |
#!/usr/bin/env python3
from os.path import basename
import apt
import glob
import json
import os
import subprocess as cmd
devices = []
for name in glob.glob('/sys/block/*'):
name = basename(name)
if name.startswith('sd'):
devices.append(name)
elif name.startswith('md'):
devices.append(nam... | fourdollars/dell-recovery | late/chroot_scripts/60-detect-no-recovery-patition.py | Python | gpl-2.0 | 3,106 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.