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 |
|---|---|---|---|---|---|
import os
import re
import time
import shutil
import pprint
import filecmp
import os.path
import tempfile
import unittest
import threading
import subprocess
from .fixtures import PACKAGESDIR
OUTPUTDIR = None
OUTPUTDIR_LOCK = threading.Lock()
def get_outputdir():
global OUTPUTDIR
if OUTPUTDIR:
return ... | rpm5/createrepo_c | acceptance_tests/tests/base.py | Python | gpl-2.0 | 12,537 |
# -*- coding: utf-8 -*-
# © 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3
def migrate(cr, version):
if not version:
return
cr.execute("""
UPDATE purchase_cost_distribution_expense AS exp
SET invoice_id = il.invoice_id
... | rosenvladimirov/addons | purchase_landed_cost_bg/migrations/8.0.2.0.0/post-migration.py | Python | agpl-3.0 | 431 |
import numpy as np
# for the double bounded trafo WITH DOUBLE PRECISION --> still goes wrong!
def i2e(v, u, l):
return l + 0.5 * (u - l) * (np.sin(v) + 1)
def e2i(v, u, l, eps2):
piby2 = 2. * np.arctan(1.)
distnn = 8. * np.sqrt(eps2)
vlimhi = piby2 - distnn
vlimlo = -piby2 + distnn
yy = 2.... | roofit-dev/parallel-roofit-scripts | int2ext_precision_problem_2.py | Python | apache-2.0 | 1,760 |
input = """
8 2 2 3 0 0
8 2 4 5 0 0
1 6 2 2 4 2
1 7 2 2 3 5
6 0 2 0 6 7 2 1
0
4 c
3 b
7 f
2 a
6 e
5 d
0
B+
0
B-
1
0
1
"""
output = """
COST 0@1
"""
| Yarrick13/hwasp | tests/asp/weakConstraints/optimization.example7.nonground.gringo.test.py | Python | apache-2.0 | 148 |
"""
Support for Modbus Coil sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.modbus/
"""
import logging
import voluptuous as vol
import homeassistant.components.modbus as modbus
from homeassistant.const import CONF_NAME, CONF_SLAVE
... | MungoRae/home-assistant | homeassistant/components/binary_sensor/modbus.py | Python | apache-2.0 | 2,068 |
#!/usr/bin/env python
"""Module containing definition of class Format."""
class Format:
"""
Class contains functions for formatting different types of values to specified form.
"""
@staticmethod
def decimal(decimal_value):
"""
Function formats decimal value to form with 8 decimal ... | classbench-ng/classbench-ng | lib/tuples_analyzer/value_formats/value_format.py | Python | gpl-3.0 | 487 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... | jsuter1/fail2ban | fail2ban/tests/action_d/test_smtp.py | Python | gpl-2.0 | 4,131 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-09-24 19:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('controlled_vocabularies', '0001_initial'),
]
opera... | unt-libraries/django-controlled-vocabularies | controlled_vocabularies/migrations/0002_auto_20180924_1938.py | Python | bsd-3-clause | 3,376 |
from django.conf.urls import patterns, url
from oscar.views.decorators import staff_member_required
from oscar.core.application import Application
from oscar.apps.dashboard.vouchers import views
class VoucherDashboardApplication(Application):
name = None
list_view = views.VoucherListView
create_view = v... | michaelBenin/django-oscar | oscar/apps/dashboard/vouchers/app.py | Python | bsd-3-clause | 1,211 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Lice... | andrewhart098/Lean | Algorithm.Python/QuandlImporterAlgorithm.py | Python | apache-2.0 | 2,560 |
from __future__ import unicode_literals
import warnings
from django import forms
from django.conf import settings
from django.contrib.admin.templatetags.admin_static import static
from django.contrib.admin.utils import (
display_for_field, flatten_fieldsets, help_text_for_field, label_for_field,
lookup_field,... | whitehorse-io/encarnia | pyenv/lib/python2.7/site-packages/django/contrib/admin/helpers.py | Python | mit | 14,964 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notic... | lanyuwen/openthread | tools/harness-automation/cases_R140/leader_7_1_7.py | Python | bsd-3-clause | 1,876 |
"""
The follwing constructor classes exists here:
+------------------------------------------+---------------------------------------+
| Class | Description |
+==========================================+=======================================+
| :py:class:`~... | jonathf/matlab2cpp | src/matlab2cpp/datatype.py | Python | bsd-3-clause | 10,324 |
import ctypes, ctypes.util, operator, sys
from . import model
if sys.version_info < (3,):
bytechr = chr
else:
unicode = str
long = int
xrange = range
bytechr = lambda num: bytes([num])
class CTypesType(type):
pass
class CTypesData(object):
__metaclass__ = CTypesType
__slots__ = ['__we... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/cffi/backend_ctypes.py | Python | mit | 41,745 |
"""
Robust location and covariance estimators.
Here are implemented estimators that are resistant to outliers.
"""
# Author: Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
from scipy import linalg
from scipy.stats import chi2
from . import empir... | BiaDarkia/scikit-learn | sklearn/covariance/robust_covariance.py | Python | bsd-3-clause | 31,108 |
#
# 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... | prestona/qpid-proton | proton-c/bindings/python/proton/wrapper.py | Python | apache-2.0 | 3,470 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2009-2013 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
pytest fixtures used as defined in conftest.py:
- gatewaywrapper
- author_testimg
"""
import omero
import Ice
from omero.gateway.sc... | jballanc/openmicroscopy | components/tools/OmeroPy/test/gatewaytest/test_connection.py | Python | gpl-2.0 | 8,155 |
#!/usr/bin/python
#
# Copyright: Ansible Team
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
... | bearstech/ansible | lib/ansible/modules/network/aruba/aruba_config.py | Python | gpl-3.0 | 14,483 |
# -*- coding: utf-8 -*-
import json
from ipware.ip import get_ip
from django.conf import settings
from django.http import Http404
from django.utils import translation
from django.shortcuts import get_object_or_404
from django.core import cache
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
f... | CivilHub/CivilHub | locations/api.py | Python | gpl-3.0 | 15,669 |
#!/usr/bin/python
# -*- coding:utf8 -*-
#'''
#Created on 2013-3-13
#
#@author: p2psec
#'''
import dpkt
import socket,thread
import pygeoip
import struct
import zlib
import ctypes
import numpy as np
import os,sys
import traceback
import time
from twisted.internet import protocol, reactor
from multiprocessing import Pro... | flyroom/ZeroAccessTracker | ZeroAccessCrawlNative.py | Python | gpl-2.0 | 7,343 |
import hashlib
print hashlib.md5("superman").hexdigest()
m = hashlib.md5()
m.update("super")
m.update("man")
print m.hexdigest()
print hashlib.algorithms
| quchunguang/test | testpy/test_md5.py | Python | mit | 157 |
# Copyright 2016 Matthias Gazzari
#
# 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... | qtux/instmatcher | tests/test_parser.py | Python | apache-2.0 | 21,291 |
"""
file: gnuplot.py
authors: Matt Rasmussen
date: 11/30/05
Plotting classes and functions: GNUPLOT wrapper
"""
#from rasmus import util # will not allow from plotting import * inside util
import sys, os, copy
import tempfile as temporaryfile
class Gnuplot:
class Plot:
def __init__(self, xlist, yl... | wutron/compbio | rasmus/gnuplot.py | Python | mit | 18,406 |
from parliament.models.document import *
from parliament.models.funding import *
from parliament.models.member import *
from parliament.models.party import *
from parliament.models.session import *
| kansanmuisti/kamu | parliament/models/__init__.py | Python | agpl-3.0 | 198 |
# Copyright 2014 Huawei Technologies Co. Ltd
#
# 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... | baigk/compass-core | compass/tests/db/api/test_network.py | Python | apache-2.0 | 5,728 |
# To kick off the script, run the following from the python directory:
# PYTHONPATH=`pwd` python qock.py start
# standard python libs
import logging
import time
# third party libs
import sys
from daemon import runner
from logging import handlers
from Qock import main_program
class App():
def __init__(self):
... | issess/qock | QockDaemon.py | Python | mit | 1,521 |
import datetime
import unittest
from django.test import TransactionTestCase
from django.db import connection, DatabaseError, IntegrityError, OperationalError
from django.db.models.fields import (BinaryField, BooleanField, CharField, IntegerField,
PositiveIntegerField, SlugField, TextField)
from django.db.models.fi... | Sonicbids/django | tests/schema/tests.py | Python | bsd-3-clause | 55,234 |
def main(request, response):
import simplejson as json
f = file('config.json')
source = f.read()
s = json.JSONDecoder().decode(source)
url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1])
url2 = "http://" + s['host'] + ":" + str(s['ports']['http'][0])
_CSP = "object-src " + url2
... | hgl888/web-testing-service | wts/tests/csp/csp_object-src_cross-origin_blocked-manual.py | Python | bsd-3-clause | 2,473 |
#! /usr/bin/python
#
# simple demo program to feed paper in the silhouette cameo.
# (C) 2015 juewei@fabmail.org
#
# Requires: python-usb # from Factory
from __future__ import print_function
import sys
sys.path.extend(['..','.']) # make it callable from top or misc directory.
from silhouette.Graphtec import Silhouet... | fablabnbg/inkscape-silhouette | misc/silhouette_move.py | Python | gpl-2.0 | 548 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, imageio contributors
# imageio is distributed under the terms of the (new) BSD License.
""" Plugin that uses ffmpeg to read and write series of images to
a wide range of video formats.
Code inspired/based on code from moviepy: https://github.com/Zulko/moviepy/
by Zulko
"... | blink1073/imageio | imageio/plugins/ffmpeg.py | Python | bsd-2-clause | 31,353 |
import SlickShell
import control.Assembly
import gtk
if __name__ == "__main__":
s = SlickShell.SlickShell() | RaumZeit/gdesklets-core | shell2/shell.py | Python | gpl-2.0 | 113 |
# Copyright (c) Paul R. Tagliamonte <tag@pault.ag>, 2015
#
# 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,... | paultag/python-muse | muse/scales/chromatic.py | Python | mit | 1,260 |
# Generated by Django 2.2.16 on 2020-10-15 10:19
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(setti... | edx/edx-platform | common/djangoapps/student/migrations/0036_userpasswordtogglehistory.py | Python | agpl-3.0 | 1,506 |
#!/usr/bin/env python
# badge_screen.py
#
# Copyright (C) 2015 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
#
import os
from gi.repository import Gtk, Gdk, GdkPixbuf, Pango
from kano_profile_gui.BadgeItem import BadgeItem
from kano_profile_gui.backend import cre... | rcocetta/kano-profile | kano_profile_gui/badge_screen.py | Python | gpl-2.0 | 10,581 |
from django import template
from django.utils.datastructures import MultiValueDict
from django.utils.html import conditional_escape as escape
from django.utils.encoding import smart_unicode, smart_str
from django.template.base import token_kwargs
import urllib
register = template.Library()
class QueryStringNode(temp... | team23/django_backend | django_backend/templatetags/django_backend_query_tags.py | Python | bsd-3-clause | 4,480 |
"""
Patterns structure.
"""
from __future__ import absolute_import, unicode_literals
import attr
import io
import logging
from psd_tools.compression import compress, decompress
from psd_tools.constants import ColorMode, Compression
from psd_tools.psd.base import BaseElement, ListElement
from psd_tools.validators impor... | psd-tools/psd-tools | src/psd_tools/psd/patterns.py | Python | mit | 7,229 |
"""
Support for Cover devices.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/cover/
"""
from datetime import timedelta
import functools as ft
import logging
import voluptuous as vol
from homeassistant.loader import bind_hass
from homeassistant.helpers... | persandstrom/home-assistant | homeassistant/components/cover/__init__.py | Python | apache-2.0 | 11,323 |
from draw import *
w = Window(title=__file__)
w.rect(50, 50, 100, 200)
w.rect(150, 150, 300, 250, color='orange', thickness=5)
w.rect(300, 300, 400, 550, color='blue', fill='cyan', thickness=3)
w.wait()
| ishirav/draw-and-learn | lessons/1/part-3.rectangles.py | Python | mit | 206 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import unicode_literals
import unittest
import os
from pymatgen.analysis.pourbaix.maker import PourbaixDiagram
from pymatgen.analysis.pourbaix.entry import PourbaixEntryIO, PourbaixEntry
from ... | setten/pymatgen | pymatgen/analysis/pourbaix/tests/test_analyzer.py | Python | mit | 3,970 |
#!/usr/bin/jython
import os
import sys
from java.io import FileOutputStream
import logging
import optparse
import getopt
import string
from os import walk
import csv
import sample_creating_csv_file
__all__ = []
__version__ = 0.1
__date__ = '15-03-2015'
__updated__ ='29-04-2016'
__author__='asini'
## related path
... | SiniAghilas/scripts | source/python/script_ff_dtw.py | Python | gpl-3.0 | 8,138 |
#!/usr/bin/python3
"""
Actual test of ID3
"""
from test.test_base import TestBase
class ID3Test(TestBase):
"""
Actual test using the id3-plugin
"""
TYPE = "id3"
LIBFS_SRC_DIR = "./test/data/src"
LIBFS_DB = "./test/data/testdb"
EXISTING_FILE = "%s/A Cappella/Artist A/2000/Album A/1 -- Track ... | ya-induhvidual/libfs | test/test_ID3.py | Python | mit | 612 |
#!/usr/bin/env python
"""
* =========================================================================
* This file is part of sio.lite-python
* =========================================================================
*
* (C) Copyright 2004 - 2014, MDA Information Systems LLC
*
* sio.lite-python is free softwar... | porglezomp/coda-oss | modules/python/sio.lite/tests/test_write_sio.py | Python | lgpl-3.0 | 1,628 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import subprocess
import json
from i3_wm_multi_disp_scripts import necessaryFuncs as nf
proc_out = subprocess.run(['i3-msg', '-t', 'get_workspaces'], stdout=subprocess.PIPE)
wkList = json.loads(proc_out.stdout.decode('utf-8'))
allWKNames = nf.getWKNames(wkList)
internalDisp... | sainathadapa/i3-wm-config | utils/connect_external_monitor.py | Python | unlicense | 820 |
# This python module is part of the oocs scanner for Linux.
# Copyright (C) 2015 Davide Madrisan <davide.madrisan.gmail.com>
from platform import release as kernel_release
from os.path import join
from oocs.filesystem import Filesystems, UnixFile
from oocs.io import Config, message_add, quote
class Kernel(object):
... | madrisan/pyoocs | oocs/kernel.py | Python | gpl-3.0 | 4,506 |
import os.path
import sys
abspath = os.path.abspath(os.path.dirname(__file__))
if abspath not in sys.path:
sys.path.insert(0, abspath)
| all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_3_0_0/__init__.py | Python | bsd-3-clause | 140 |
def extractSdsyuritranslationsBlogspotCom(item):
'''
Parser for 'sdsyuritranslations.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'trans... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractSdsyuritranslationsBlogspotCom.py | Python | bsd-3-clause | 576 |
from urllib.parse import quote
from bs4 import BeautifulSoup
from pysimplelog import Logger
from requests import get
from FoodScan.BarcodeSync.BarcodeDecoder.barcodeDecoder import BarcodeDecoder
from FoodScan.items import *
class DigitEye(BarcodeDecoder):
def __init__(self):
BarcodeDecoder.__init__(sel... | danielBreitlauch/FoodScan | FoodScan/BarcodeSync/BarcodeDecoder/digitEye.py | Python | mit | 1,378 |
from .buildapi_tasks import *
from .pulse_tasks import *
from .cleanup_tasks import *
from .classification_mirroring_tasks import *
from .tasks import *
| wlach/treeherder | treeherder/etl/tasks/__init__.py | Python | mpl-2.0 | 153 |
'''
OpenCV Camera: Implement CameraBase with OpenCV
'''
#
# TODO: make usage of thread or multiprocess
#
__all__ = ('CameraOpenCV')
from kivy.logger import Logger
from kivy.clock import Clock
from kivy.graphics.texture import Texture
from kivy.core.camera import CameraBase
try:
import opencv as cv
import op... | nuigroup/kivy | kivy/core/camera/camera_opencv.py | Python | lgpl-3.0 | 3,097 |
"""
Observe the effect in the perturbations of Laplacians
"""
import sys
import logging
import numpy
import scipy
import itertools
import copy
import matplotlib.pyplot as plt
from apgl.graph import *
from sandbox.util.PathDefaults import PathDefaults
from sandbox.misc.IterativeSpectralClustering import IterativeS... | charanpald/wallhack | wallhack/clusterexp/LaplacianExp.py | Python | gpl-3.0 | 2,822 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
class Pessoa(object):
orelhas = 2 # Essa variavel é comum a todas as instancias
def __init__(self, nome):
"""Essa funcao é executada na inicialização da classe"""
self.nome = nome
def __str__(self):
return '%s tem %s orelhas'%(self.nome, se... | rafaelhenrique/python_quickly_coding | classes/classe_teste4.py | Python | lgpl-3.0 | 595 |
from django.conf.urls import url
from django.contrib.auth.decorators import permission_required
from callback_caller.views import CallbackCall, CallEntryResult, TokenRequest, DirectCallRequest, DirectCallResult, \
DirectBackCallRequest, ClientStatusCallback
urlpatterns = [
url(r'^call/direct/$', DirectCallReq... | steppenwolf-sro/callback-schedule | callback_caller/urls.py | Python | mit | 965 |
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2006, Frank Scholz <coherence@beebits.net>
# Content Directory service
from twisted.web import resource
from coherence.upnp.core.soap_service import UPnPPublisher
from coherence.upnp.core import service
class FakeMediaRe... | sreichholf/python-coherence | coherence/upnp/services/servers/media_receiver_registrar_server.py | Python | mit | 2,116 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django.contrib import messages
from django.http import HttpRe... | shoopio/shoop | shuup/notify/admin_module/views/delete.py | Python | agpl-3.0 | 908 |
from main import ThePirateBay
def start():
return ThePirateBay()
config = [{
'name': 'thepiratebay',
'groups': [
{
'tab': 'searcher',
'subtab': 'providers',
'list': 'torrent_providers',
'name': 'ThePirateBay',
'description': 'The world\'s... | coolbombom/CouchPotatoServer | couchpotato/core/providers/torrent/thepiratebay/__init__.py | Python | gpl-3.0 | 1,222 |
from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource,
BLSTMLayer, DimshuffleLayer,
Bidirectio... | mmottahedi/neuralnilm_prototype | scripts/e418.py | Python | mit | 6,645 |
# Copyright (c) 2017-2018 {Flair Inc.} WESLEY PENG
#
# 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 agre... | WesleyPeng/uiXautomation | src/main/python/taf/foundation/plugins/web/selenium/controls/link.py | Python | apache-2.0 | 1,296 |
#!/usr/bin/env python
# cheat.py
__author__ = "Kody Brown (kody@bricksoft.com)"
__created__ = "10/23/2013"
__copyright__ = "(C) 2013 Kody Brown. Released under the MIT License."
__contributors__ = ["Kody Brown"]
__version__ = "0.21"
import glob
import os
import sys
import shutil, errno
from urllib.request import url... | kodybrown/cheats | python/cheats.py | Python | mit | 7,281 |
# coding: utf-8
class BaseError(Exception):
pass
class NotCommandError(BaseError):
pass
class FileNotFound(BaseError):
pass
class EnvironmentNotFound(BaseError):
pass
| hirokazumiyaji/pundler | pundler/exceptions.py | Python | mit | 191 |
from ..base import AST
CLASS = "statements.assignment"
class AssignmentStatement(AST):
"""
Assign statement class for AST.
interpret - runtime function for Evaluator (return variable by name from environment).
Example: x := 56
"""
def __init__(self, variable, aexp):
super().__init__(C... | PetukhovVictor/compiler | src/Parser/AST/statements/assignment.py | Python | mit | 445 |
#!/usr/bin/env python
#coding:utf-8
# Purpose: 2d vector math
# module belongs to package dxfwrite
# Created: 16.03.2010
# Copyright (C) 2010, Manfred Moitzi
# License: MIT License
"""
2d vector math module
"""
__author__ = "mozman <mozman@gmx.at>"
from math import hypot, atan2, sin, cos
def vector2d(vector):
""... | sbarton272/AcousticBarcodes-Explorations | barcodes/dxfwrite/dxfwrite/vector2d.py | Python | mit | 1,623 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import url, include
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse, reverse_lazy
from rest_framework.urlpatterns import format_suffix_patterns
... | hzlf/fprint-api | app/urls_api.py | Python | gpl-3.0 | 588 |
# -*- coding: utf-8 -*-
#===================================================
#
# theme_manager.py - This file is part of the amsn2 package
#
# Copyright (C) 2008 Wil Alvarez <wil_alejandro@yahoo.com>
#
# This script is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public ... | kakaroto/amsn2 | amsn2/core/theme_manager.py | Python | gpl-2.0 | 9,130 |
#!/usr/bin/env python
# Description: Attempts to resolve sequencing substitution errors.
import logging
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
from math import ceil, log10, sqrt, isnan
from collections import namedtuple
from itertools import izip, ifilter
from heap import Heap
f... | uubram/RTCR | rtcr/qmerge.py | Python | gpl-3.0 | 7,033 |
# -*- coding: utf-8 -*-
import jsonDB as db
import socket
import os
import imp
client = socket.gethostname()
def loadFromFile(filepath):
class_inst = None
expected_class = 'Main'
mod_name, file_ext = os.path.splitext(os.path.split(filepath)[-1])
if file_ext.lower() == '.py':
py_mod = imp.lo... | bitbyt3r/malarkey | malarkey/malarkey.py | Python | gpl-2.0 | 690 |
import re
from collections import namedtuple
Token = namedtuple('Token',
['type', 'value', 'lineno', 'columno'])
def tokens(source, definitions, ignore_case=True):
"""Yield a token if part of the source matched one
of the token definitions."""
re_definitions = [ (re.compile(t_def[0], re.I),
... | yeukhon/meme-lang | lexer.py | Python | apache-2.0 | 1,240 |
###########################################################
#
# Copyright (c) 2009, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | sadanandb/pmt | src/tactic/ui/widget/embed_wdg.py | Python | epl-1.0 | 3,664 |
#--* coding: utf-8 *--#
import os.path
basedir = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
#SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'storage.db')
SQLALCHEMY_DATABASE_URI = 'sqlite:////home/fabiomac/aula_flask/storage.db'
SQLALCHEMY_TRACK_MODIFICATIONS = True
SECRET_KEY = 'server... | fabiomac/apps | aula_flask/config.py | Python | mit | 327 |
from numpy import pi, sqrt, append, array, arange, cumsum, load
#from numpy import array
from scipy.integrate import ode, quad
from scipy.interpolate import interp1d
class background():
def __init__(self, *args, **kwargs):
##unpack the args tuple
h = args[0]
omega_m = args[1]
omega_rad = args[2]
chi0 = a... | bfollinprm/Nquintessence | class/source/background.py | Python | mit | 4,659 |
from django.http import HttpResponse
from cms.test_utils.testcases import CMSTestCase
from cms.test_utils.util.mock import AttributeObject
from menus.templatetags.menu_tags import PageLanguageUrl
from menus.utils import (simple_language_changer, find_selected,
language_changer_decorator)
cla... | vstoykov/django-cms | cms/tests/menu_utils.py | Python | bsd-3-clause | 3,494 |
import unittest2
import os
class TestInitWithArgs(unittest2.TestCase):
def setUp(self):
unittest2.TestCase.setUp(self)
self.cp = os.environ.get('stallone_cp', '')
def testWithArgsExtendClassPath(self):
import pystallone
args = ['-Xms64m']
if self.cp:
... | markovmodel/pystallone | pystallone/tests/00_test_init_with_args.py | Python | bsd-2-clause | 527 |
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('sedastrela.urls', namespace='sedastrela')),
]
| ondrejsika/sedastrela | sedastrela/root_urls.py | Python | mit | 209 |
import os
import urllib
from reportlab.lib import colors
from reportlab.lib.colors import HexColor
from reportlab.lib.enums import TA_CENTER, TA_RIGHT, TA_LEFT
from reportlab.lib.pagesizes import landscape as set_landscape, A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.unit... | MrLucasCardoso/easy_report | easy_report/builder.py | Python | mit | 14,095 |
from flask import current_app
def make_json(jsonstring, status_code=200, headers={}):
"""like jsonify, except accepts string, so we can do our own custom
json serialization. should move this to continuumweb later
"""
return current_app.response_class(response=jsonstring,
... | sahat/bokeh | bokeh/server/views/__init__.py | Python | bsd-3-clause | 471 |
#!/usr/bin/python
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | omererdem/honeything | src/cwmp/tr/rcommand.py | Python | gpl-3.0 | 5,433 |
# standard libraries
import contextlib
import copy
import gc
import random
import time
import typing
import unittest
import uuid
import weakref
# third party libraries
import numpy
# local libraries
from nion.data import DataAndMetadata
from nion.swift import Application
from nion.swift import Facade
from nion.swift.... | nion-software/nionswift | nion/swift/test/DocumentModel_test.py | Python | gpl-3.0 | 149,876 |
# Useful reading is https://zulip.readthedocs.io/en/latest/front-end-build-process.html
from __future__ import absolute_import
import os
import shutil
from typing import Dict, List, Any, Tuple
from django.conf import settings
from django.contrib.staticfiles.storage import ManifestStaticFilesStorage
from pipeline.stor... | dawran6/zulip | zerver/storage.py | Python | apache-2.0 | 3,942 |
import syntax_test
class TestMarkdownLight(syntax_test.SyntaxTestCase):
def setUp(self):
super().setUp()
self.set_syntax_file("Packages/MarkdownLight/MarkdownLight.tmLanguage")
def check_default(self, patterns):
self.check_in_single_scope(patterns, 'text')
def test_simple_text(sel... | bbtfr/MarkdownLight | tests/test_markdown_light.py | Python | mit | 22,066 |
import steel
from steel import bits
class Sample(steel.Structure):
title = steel.String(size=13, encoding='ascii')
size = steel.Integer(size=4)
loop_start = steel.Integer(size=4, default=0)
loop_end = steel.Integer(size=4, default=0xFFFFF)
@property
def data(self):
ind... | gulopine/steel | examples/mods/_669.py | Python | bsd-3-clause | 2,582 |
#
# 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 n... | lhfei/spark-in-action | spark-2.x/src/main/python/ml/binarizer_example.py | Python | apache-2.0 | 1,567 |
# -*- coding: utf-8 -*-
# Copyright 2009 Jordi Esteve <jesteve@zikzakmedia.com>
# Copyright 2013-2017 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api, tools
import os
class ConfigEsToponyms(models.TransientModel):
... | factorlibre/l10n-spain | l10n_es_toponyms/wizard/l10n_es_toponyms_wizard.py | Python | agpl-3.0 | 1,307 |
from django.http import JsonResponse
from django.shortcuts import get_object_or_404, render
from .models import Post, Category
def index(request):
return render(request, 'index.html', {})
def post_list(request):
queryset = Post.objects.all().order_by('-date')
posts = []
for item in queryset:
... | hackersvalley/hvalley | blog/views.py | Python | mit | 1,382 |
# -*- coding:utf-8 -*-
import json
import sys
from importlib import import_module
from importlib.util import find_spec
from owlmixin import OwlMixin, TOption
from owlmixin.util import load_json
from jumeaux.addons.res2res import Res2ResExecutor
from jumeaux.logger import Logger
from jumeaux.models import Res2ResAddOn... | tadashi-aikawa/gemini | jumeaux/addons/res2res/json.py | Python | mit | 2,536 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-27 22:26
from __future__ import unicode_literals
from django.db import migrations, models
import django_revision.revision_field
import edc_base.model_fields.hostname_modification_field
import edc_base.model_fields.userfield
import edc_base.model_fields.uu... | botswana-harvard/edc-identifier | edc_identifier/migrations/0006_auto_20161127_2226.py | Python | gpl-2.0 | 7,133 |
class AccountData:
def __init__(self, data):
self.firm = None
self.unrealized_pnl = 0
self.description = ""
self.account_number = None
self.timestamp = None
self.commissions = 0
self.realized_pnl = 0
self.total_pnl = 0
self.balance = 0
... | hftstrat/The-Gateway-code-samples | classes/account_data.py | Python | mit | 971 |
from pprint import pformat
import sys
from threading import Lock
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import socket
from django import http
from django.core import signals
from django.core.handlers import base
from django.core.urlresolvers import set_script_pref... | mitsuhiko/django | django/core/handlers/wsgi.py | Python | bsd-3-clause | 9,326 |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test node responses to invalid transactions.
In this test we connect to one node over p2p, and test tx... | randy-waterhouse/bitcoin | test/functional/p2p_invalid_tx.py | Python | mit | 6,847 |
#!/usr/bin/python
#Copyright (C) 2010 Louis-Frederic Coilliot
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
#This program is distributed in the hope that it will be useful,
#but W... | tomas-edwardsson/tommi-func | func/overlord/modules/getfile.py | Python | gpl-2.0 | 4,031 |
from message_queue.adapters.base_adapter import BaseAdapter
from message_queue.adapters.amqp_adapter import AMQPAdapter
| ingresse/message-queue-python | message_queue/adapters/__init__.py | Python | bsd-3-clause | 121 |
# coding: utf-8
from django.shortcuts import get_object_or_404
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from annoying.decorators import render_to
from blog.models import Category, Post
@ren... | lesthack/djangomx | djangomx/blog/views.py | Python | mit | 3,003 |
"""
Tests related to get lists of stuffs.
"""
from condor.models import Document, Bibliography, TermDocumentMatrix, \
RankingMatrix
def test_can_get_bibliographies(client):
res = client.get('/bibliography')
assert res.status_code == 200
def test_can_get_documents(client):
res = client.get('/documen... | odarbelaeze/condor-api | tests/test_getters.py | Python | mit | 7,134 |
print "I will now count my chickens:"
print "Hens", 25+30 / 6
print "Roosters", 100 - 25 * 3 % 4
print "Now I will count the eggs:"
print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6
print "Is it true that 3 + 2 < 5 - 7?"
print 3 + 2 < 5 - 7
print "What is 3 + 2?", 3 + 2
print "What is 5 - 7?", 5 - 7
print "Oh, that's why ... | BigBoss424/webtutorials | python/learnpythonhard/ex/ex3.py | Python | gpl-3.0 | 474 |
from globals import *
from globalfns import *
###############################################################################
# Command: Show message
###############################################################################
def do(ctxt):
format_timestamp(ctxt, ctxt)
header(ctxt, ctxt[SUBJECT], 'msg')
ctxt['th... | bruceg/ezmlm-browse | commands/showmsg.py | Python | gpl-2.0 | 709 |
from __future__ import absolute_import
from django.conf import settings
import logging
def _module_logger_helper(glob):
logger_path = '.'.join([settings.SURROUND_ROOT_LOGGER_NAME, glob['__name__']])
logger = logging.getLogger(logger_path)
entities = {}
entities['logger'] = logger
for level in ['... | sniegu/django-surround | surround/django/logging.py | Python | mit | 616 |
# -*- coding: utf-8 -*-
from .command import Command
from ..inputs.input_argument import InputArgument
from ..inputs.input_option import InputOption
from ..inputs.input_definition import InputDefinition
class ListCommand(Command):
def configure(self):
self.set_name('list')\
.set_definition(s... | Romibuzi/cleo | cleo/commands/list_command.py | Python | mit | 1,320 |
#
# Stats.py
#
# Author(s):
# Alessio Parma <alessio.parma@gmail.com>
# Artur Tolstenco <tartur88@gmail.com>
#
# Copyright (c) 2012-2016 Alessio Parma <alessio.parma@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentati... | pomma89/Dessert | Dessert.Benchmarks/Galois/Stats.py | Python | mit | 3,637 |
import datetime
from email import utils
import time
from lxml import etree
def generate_xml(show_info, episodes, type='audio'):
xml = etree.Element('rss', {'version': '2.0'})
channel = etree.Element('channel')
title = etree.Element('title')
title.text = show_info['title']
channel.append(title)
... | tori3852/ziniurrss | src/ziniurrss/feed.py | Python | mit | 2,969 |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.connection.ssh import Connection as SSHConnection
DOCUMENTATION = '''
connection: packer
short_description: ssh based connections for powershell via packer
description:
- This connection pl... | ricardclau/packer | provisioner/ansible/examples/connection-plugin/2.5.x/packer.py | Python | mpl-2.0 | 7,699 |
import unittest
from datetime import datetime, timedelta
from unittest.mock import patch
import responses
from config import TestingConfig
from frontstage import app, jwt, redis
from frontstage.common.session import Session
from frontstage.controllers import conversation_controller
from frontstage.exceptions.exceptio... | ONSdigital/ras-frontstage | tests/integration/controllers/test_conversation_controller.py | Python | mit | 4,813 |
from gpaw import GPAW, restart, FermiDirac
from ase import Atoms
from ase.calculators.test import numeric_force
from gpaw.test import equal
import numpy as np
a = 5.404
bulk = Atoms(symbols='Si8',
scaled_positions=[(0, 0, 0),
(0, 0.5, 0.5),
(0.... | robwarm/gpaw-symm | gpaw/test/si.py | Python | gpl-3.0 | 1,233 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.