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 |
|---|---|---|---|---|---|
# stripe_donations/models.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from django.db import models, transaction
from django.db.models import Sum, Q
from datetime import datetime, timezone
from exception.models import handle_exception, handle_record_found_more_than_one_exception
# from organization... | wevote/WeVoteServer | stripe_donations/models.py | Python | mit | 98,833 |
# coding: utf-8
"""the interface for bdf_test"""
from __future__ import (nested_scopes, generators, division, absolute_import,
print_function, unicode_literals)
import os
import sys
from six import PY2
import pyNastran
from pyNastran.bdf.test.test_bdf import run_lots_of_files
from pyN... | saullocastro/pyNastran | pyNastran/bdf/test/bdf_test.py | Python | lgpl-3.0 | 6,105 |
from django.db import models
from django.db.models import F
from django.utils import timezone
class Domain(models.Model):
"""
Model to represent hostnames and domains
"""
name = models.CharField(max_length=300, db_index=True)
wildcard = models.BooleanField(
default=False,
help_text... | revsys/revsys-redirect | redirect/models.py | Python | bsd-3-clause | 2,928 |
from Components.config import config, ConfigSubsection, ConfigText, configfile, getConfigListEntry, ConfigSelection
from Components.ConfigList import ConfigListScreen
from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaBlend
from Components.MenuList import MenuList
from Components.Lab... | atvcaptain/enigma2 | lib/python/Plugins/Extensions/Infopanel/SoftcamPanel.py | Python | gpl-2.0 | 7,770 |
# -*- coding: utf-8 -*-
'''The app module, containing the app factory function.'''
from flask import Flask, render_template
from enma.settings import ProdConfig
from enma.assets import assets
from enma.extensions import (
bcrypt,
cache,
db,
login_manager,
migrate,
debug_toolbar,
)
from enma imp... | steffen-mehner/Tests | enma/app.py | Python | bsd-3-clause | 1,474 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | roadmapper/ansible | lib/ansible/modules/network/vyos/vyos_config.py | Python | gpl-3.0 | 11,766 |
#!/usr/bin/env python
"""
tamarin-cleandot.py
A postprocesser for Tamarin's dot output. The idea is to provide a drop-in
replacement for the dot program that takes care of the cleanup.
Its first aim is to provide more structure in the graphs by clustering possible
threads by using a heuristic. For now, this is done ... | rsasse/tamarin-prover | misc/cleandot/tamarincleandotlib.py | Python | gpl-3.0 | 55,234 |
# Copyright (c) 2008, Aldo Cortesi. 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, modify,... | cortesi/qtile | libqtile/sh.py | Python | mit | 10,101 |
from collections import Sequence, Hashable
from numbers import Integral
from functools import reduce
class _PListBuilder(object):
"""
Helper class to allow construction of a list without
having to reverse it in the end.
"""
__slots__ = ('_head', '_tail')
def __init__(self):
self._head... | jml/pyrsistent | pyrsistent/_plist.py | Python | mit | 8,002 |
# -*- coding: utf-8 -*-
import openerp
from openerp.http import request
from openerp.osv import osv
from openerp import SUPERUSER_ID
from openerp.tools.translate import _
from datetime import datetime
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
import werkzeug.urls
import urllib2
import simplejson
impor... | chand3040/sree_odoo | openerp/addons/google_account/google_account.py | Python | agpl-3.0 | 8,952 |
"""
Scrapy core exceptions
These exceptions are documented in docs/topics/exceptions.rst. Please don't add
new exceptions here without documenting them there.
"""
# Internal
class NotConfigured(Exception):
"""Indicates a missing configuration situation"""
pass
# HTTP and crawling
class IgnoreRequest(Except... | mzdaniel/oh-mainline | vendor/packages/scrapy/scrapy/exceptions.py | Python | agpl-3.0 | 1,254 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utility script to create a pypi-like directory structure (localpi)
from a number of Python packages in a directory of the local filesystem.
DIRECTORY STRUCTURE (before):
+-- downloads/
+-- alice-1.0.zip
+-- alice-1.0.tar.gz
+-- ... | metaperl/behave | bin/make_localpi.py | Python | bsd-2-clause | 9,075 |
import unittest
from coalib.core.CircularDependencyError import CircularDependencyError
class CircularDependencyErrorTest(unittest.TestCase):
def test_default_message(self):
with self.assertRaises(CircularDependencyError) as cm:
# test the default case (names is None)
raise Circu... | arjunsinghy96/coala | tests/core/CircularDependencyErrorTest.py | Python | agpl-3.0 | 707 |
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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 versi... | gemrb/gemrb | gemrb/GUIScripts/pst/GUIWORLD.py | Python | gpl-2.0 | 4,353 |
"""Summary."""
import unittest
from click.testing import CliRunner
class TestCommand(unittest.TestCase):
"""
Summary.
Attributes:
runner (TYPE): Description
"""
def setUp(self):
"""
Summary.
Returns:
TYPE: Description
"""
self.runner ... | ojengwa/ibu | tests/test_specs.py | Python | mit | 482 |
# flake8: noqa
from .test_settings import * # noqa
# These endpoints will throw an error on the django debug panel
EXCLUDED_DEBUG_URLS = [
"/content/storage",
]
def custom_show_toolbar(request):
return not any(request.path.startswith(url) for url in EXCLUDED_DEBUG_URLS)
LANGUAGES += (('ar', ugettext('Arab... | fle-internal/content-curation | contentcuration/contentcuration/dev_settings.py | Python | mit | 1,411 |
import unittest
from QuickSort import QuickSort
class QuickSortTester(unittest.TestCase):
def setUp(self):
self.qs = QuickSort()
def test_partition(self):
arr = [10, 5, 2, 90, 61, 32, 3]
#pivot point is 10
#after partition array should be
#[5, 2, 3, 10, 90, 61, 32]
... | nicangeli/Algorithms | arrays/quick_sort/tests.py | Python | mit | 1,602 |
from Bio import SeqIO
from fast5tools.samclass import *
def alignment_summary(sam):
'''sam is Sam object'''
for read in sam:
print ("\t").join([str(e) for e in [read.get_qname_field(), read.get_rname_field(), read.get_pos_field(), read.get_read_len(), read.get_AS_field(), read.get_SEQ_len(), read.get_S... | JohnUrban/fast5tools | fast5tools/samops.py | Python | mit | 3,541 |
# -*- coding: utf-8 -*-
__author__ = 'Ponomarev Dmitry <demdxx@gmail.com>'
__lincese__ = 'MIT'
from django.conf import settings
#
# Базовые настройки как у всех кэшей
#
CORSCACHE_DEFAULT_TIME = getattr(settings,'CORSCACHE_DEFAULT_TIME',3600)
CORSCACHE_DEFAULT_CACHE = getattr(settings,'CORSCACHE_DEFAULT_CACHE','defau... | demdxx/django-cors-cache | corscache/conf.py | Python | mit | 4,953 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# 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, eithe... | miumok98/weblate | weblate/trans/data.py | Python | gpl-3.0 | 2,875 |
# -*- coding: utf-8 -*-
#
# Schema Registry documentation build configuration file, created by
# sphinx-quickstart on Wed Dec 17 14:17:15 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fil... | quantiply-fork/schema-registry | docs/conf.py | Python | apache-2.0 | 8,507 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2005 Norwegian University of Science and Technology
# Copyright (C) 2008-2011 UNINETT
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License ve... | sigmunau/nav | python/nav/report/report.py | Python | gpl-2.0 | 14,137 |
# 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-guestconfig/azure/mgmt/guestconfig/operations/__init__.py | Python | mit | 1,177 |
#!/usr/bin/env python
#a Imports
import pygame
import sys
import socket
import bezier
#for i in range(11):
# for j in range(11):
# print i,j,bp.coord(i/10.0,j/10.0)
# pass
# pass
#asdjh
#a Drawing functions
#c c_screen
class c_screen( object ):
def __init__( self, screen ):
self.scree... | embisi-github/gjslib | tests/bezier_test.py | Python | apache-2.0 | 3,695 |
from imc import async
from imc.auth import Auth
class LockServer:
def __init__(self,proxy,idendesc):
self._proxy = proxy
self._idendesc = idendesc
self.client_linkmap = set()
self._proxy.register_call('lockserver/','connect_client',
self.connect_cl... | taiwan-online-judge/taiwan-online-judge | src/py/imc/lockserver.py | Python | mit | 2,236 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
T... | TheWardoctor/Wardoctors-repo | plugin.video.salts/scrapers/xmovies8_scraper.py | Python | apache-2.0 | 5,391 |
import ssl
import json
import smtpd
import asyncore
import datetime
import pytest
import gevent
from tests.util.base import default_account
from tests.api.base import api_client, new_api_client
from tests.api_legacy.base import api_client as api_legacy_client
__all__ = ['api_client', 'api_legacy_client', 'default_ac... | Eagles2F/sync-engine | tests/security/test_smtp_ssl.py | Python | agpl-3.0 | 3,497 |
# !/usr/bin/env python
# _*_ coding:utf-8 _*_
from rest_framework import viewsets, permissions
from ops.serializers import *
from ops.models import *
from rest_framework import status
from django.http import Http404
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framewor... | jinjin123/devops2.0 | devops/ops/api/assets_api.py | Python | mit | 26,159 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | stonebig/bokeh | bokeh/command/subcommands/serve.py | Python | bsd-3-clause | 24,231 |
##
# Copyright 2009-2016 Ghent University
#
# This file is part of hanythingondemand
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundati... | boegel/hanythingondemand | hod/config/autogen/hadoop.py | Python | gpl-2.0 | 7,045 |
import os
import sys
import time
import yaml
import logging
import logging.handlers
import queue
import datetime
import re
from fatsecret import Fatsecret
from PyQt5.QtCore import (QObject, QThread, pyqtSlot, pyqtSignal, Qt)
from PyQt5.QtWidgets import (QWidget, QLabel, QMessageBox, QListWidget,
... | n0bel/PiFoodScale | PiFoodScale.py | Python | mit | 26,753 |
import Globals
from Products.ZenModel.ZenPack import ZenPack as ZenPackBase
from Products.ZenUtils.Utils import unused, zenPath
import os
unused(Globals)
_plugins = [
'rig_host_app_transform1.py',
'copy_server_config_file.sh',
]
class ZenPack(ZenPackBase):
def install(self, app):
super(Zen... | jcurry/ZenPacks.Markit.RigHost | ZenPacks/Markit/RigHost/__init__.py | Python | gpl-2.0 | 1,531 |
import csv, codecs, cStringIO
import requests
import urllib
import sys
import json
import rdflib
class UTF8Recoder:
"""
Iterator that reads an encoded stream and reencodes the input to UTF-8
"""
def __init__(self, f, encoding):
self.reader = codecs.getreader(encoding)(f)
def __iter__(self)... | mr-justin/open-conference-data | iswc-metadata/src/todo/libx.py | Python | mit | 7,706 |
#!/usr/bin/env python
import datetime
import os
import re
from peewee import *
from markdown import markdown
from blog import app
from werkzeug.security import generate_password_hash, check_password_hash
import pinyin
db = SqliteDatabase('blog.db')
class BaseModel(Model):
class Meta:
... | benshen/tiny-flask-blog | blog/models.py | Python | mit | 5,274 |
MONGO_ADDRESS = "192.169.1.1:27017"
MONGO_DB_NAME = "db"
RFCLIENT_RFSERVER_CHANNEL = "rfclient<->rfserver"
RFSERVER_RFPROXY_CHANNEL = "rfserver<->rfproxy"
RFTABLE_NAME = "rftable"
RFCONFIG_NAME = "rfconfig"
RFISL_NAME = "rfisl"
RFISLCONF_NAME = "rfislconf"
RFSERVER_ID = "rfserver"
RFPROXY_ID = "rfproxy"
DEFAULT_RFC... | CPqD/RouteFlow | rflib/defs.py | Python | apache-2.0 | 2,033 |
from os.path import expanduser
home = expanduser("~")
code = ''
try:
import urllib2
response = urllib2.urlopen('https://raw.githubusercontent.com/Stasadance/SVG-Exporter/master/src/Exporter.py')
code = response.read()
except:
file = open(home + '/SVG-Exporter.py', 'r')
code = file.read()
file.c... | Stasadance/SVG-Exporter | SVG_Exporter.py | Python | mit | 413 |
# Original author: yasunorikudo
# (https://github.com/yasunorikudo/chainer-ResNet)
import chainer
import chainer.functions as F
from chainer import initializers
import chainer.links as L
class BottleNeckA(chainer.Chain):
def __init__(self, in_size, ch, out_size, stride=2, groups=1):
super(BottleNeckA, s... | anaruse/chainer | examples/imagenet/resnet50.py | Python | mit | 3,641 |
from collections import OrderedDict
from django.core.cache import cache
from django.conf import settings
import jingo
import jinja2
from bedrock.firefox.models import FirefoxOSFeedLink
from bedrock.firefox.firefox_details import firefox_desktop, firefox_android, firefox_ios
from bedrock.base.urlresolvers import reve... | TheJJ100100/bedrock | bedrock/firefox/helpers.py | Python | mpl-2.0 | 9,609 |
#!/usr/bin/env python
"""Profiler for Robot Framework `run` and `rebot`.
Usage: profiler.py run|rebot [options] arguments
"""
import cProfile
import pstats
import os
from os.path import abspath, dirname, join
import sys
import tempfile
rootdir = dirname(dirname(abspath(__file__)))
sys.path.insert(0, join(rootdir, '... | userzimmermann/robotframework-python3 | proto/profiler.py | Python | apache-2.0 | 924 |
#!/usr/bin/env python
'''
Created on 1 aug 2011
Add in crontab like this:
*/1 * * * * zabbix /usr/local/bin/haproxy-poller.py /usr/local/etc/haproxy-poller.ini http://<proxy-ip>:<stats-port> <zabbix-server> <zabbix-port>
@author: Johan
'''
import subprocess
import urllib2
import sys
import os
import time
import re
... | pida42/Zabbix-Addons | Network/Proxy/HAProxy_01/haproxy-poller.py | Python | mit | 6,735 |
import warnings
from collections import OrderedDict
from copy import copy, deepcopy
from datetime import datetime, timedelta
from distutils.version import LooseVersion
from textwrap import dedent
import numpy as np
import pandas as pd
import pytest
import pytz
from xarray import Coordinate, Dataset, IndexVariable, Va... | chunweiyuan/xarray | xarray/tests/test_variable.py | Python | apache-2.0 | 81,631 |
"""!
@brief Segmentation example of Hodgkin-Huxley oscillatory network for image segmentation.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
import numpy
import os.path
import pickle
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.animation a... | annoviko/pyclustering | pyclustering/nnet/examples/hhn_segmentation.py | Python | gpl-3.0 | 7,472 |
from .wikipedia import *
from .exceptions import *
__version__ = (1, 3, 1)
| somenice/Pablo | Wikipedia/wikipedia/__init__.py | Python | mit | 76 |
# Copyright (c) 2014 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the impl... | kgiusti/gofer | test/unit/messaging/test_consumer.py | Python | lgpl-2.1 | 6,743 |
#!/usr/bin/env python
# Copyright 2017, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... | philcleveland/grpc | tools/line_count/collect-history.py | Python | bsd-3-clause | 2,402 |
"""Test config entries API."""
import asyncio
from collections import OrderedDict
from unittest.mock import patch
import pytest
import voluptuous as vol
from homeassistant import config_entries as core_ce
from homeassistant.config_entries import HANDLERS
from homeassistant.setup import async_setup_component
from hom... | persandstrom/home-assistant | tests/components/config/test_config_entries.py | Python | apache-2.0 | 9,960 |
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | openstack/os-brick | os_brick/initiator/connectors/huawei.py | Python | apache-2.0 | 7,842 |
from distutils.core import setup
setup(name='asterix',
version='0.3',
description=
'Framework for communication with smartcards based on pyscard.',
author='Petr Tobiska',
author_email='petr.tobiska@gmail.com',
url='https://github.com/suma12/asterix',
packages=['asterix'],
... | suma12/asterix | setup.py | Python | lgpl-2.1 | 1,747 |
import random
from lneurons_class import LNeurons
from wordbooks import wordbooks_ask
from wordbooks import convert_word
# For initialization all parameters are prompted.
print("Welcome to Leif's neuron based language recognizer with dynamically "
"stacked pattern size. Everything should be quite self explanator... | SkalliDeVarg/language-recognizer | language_recognition.py | Python | gpl-3.0 | 6,722 |
# This file is part of PyEMMA.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA 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 versi... | marscher/PyEMMA | pyemma/coordinates/data/data_in_memory.py | Python | lgpl-3.0 | 10,525 |
# 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 ... | balajikris/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/UrlMultiCollectionFormat/autoresturlmutlicollectionformattestservice/operations/__init__.py | Python | mit | 564 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 Joshua Harlan Lifton.
# See LICENSE.txt for details.
"For use with a computer keyboard (preferably NKRO) as a steno machine."
from plover.machine.base import StenotypeBase
from plover.misc import boolean
from plover.oslayer.keyboardcontrol import KeyboardCapture
class Ke... | nimble0/plover | plover/machine/keyboard.py | Python | gpl-2.0 | 4,253 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | ajayaa/keystone | keystone/server/backends.py | Python | apache-2.0 | 2,399 |
from collections import defaultdict
from typing import Any, Mapping
from dvc.output import ARTIFACT_SCHEMA, Output
from .base import Dependency
from .param import ParamsDependency
from .repo import RepoDependency
# NOTE: schema for dependencies is basically the same as for outputs, but
# without output-specific entr... | dmpetrov/dataversioncontrol | dvc/dependency/__init__.py | Python | apache-2.0 | 2,264 |
# -*- coding: utf-8 -*-
from pyload.plugin.internal.SimpleHoster import SimpleHoster
class DataportCz(SimpleHoster):
__name = "DataportCz"
__type = "hoster"
__version = "0.41"
__pattern = r'http://(?:www\.)?dataport\.cz/file/(.+)'
__config = [("use_premium", "bool", "Use premium account i... | ardi69/pyload-0.4.10 | pyload/plugin/hoster/DataportCz.py | Python | gpl-3.0 | 2,069 |
"""
Provides generic filtering backends that can be used to filter the results
returned by list views.
"""
from __future__ import unicode_literals
import operator
from functools import reduce
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.constants import LO... | jpadilla/django-rest-framework | rest_framework/filters.py | Python | bsd-2-clause | 11,863 |
class DLNode(object):
def __init__(self):
self.key = None
self.value = None
self.prev = None
self.next = None
class LRUCache(object):
def __init__(self, capacity):
"""
:type capacity: int
"""
self.head = DLNode()
self.tail = DLNode()
... | daicang/Leetcode-solutions | 146-lru-cache.py | Python | mit | 1,792 |
from function import Function
import tic
import ast
class Program(Function):
def __init__(self, prog, error_handler):
self.func = prog
self.name = prog.name
self.variables = []
self.scan_vars()
if len(prog.name) > 8:
error_handler.handle(tic.Error("A pro... | maximaximal/TiSuite | TiC/ti82-toolkit/program.py | Python | gpl-2.0 | 385 |
from __future__ import annotations
import itertools
import random
import struct
from abc import ABCMeta
from math import cos, sin
from pathlib import Path
from typing import List, Optional, Union
from PIL import Image
import elma.packing
from elma.constants import VERSION_ELMA
from elma.render import LevelRenderer
fr... | sigvef/elma | elma/models.py | Python | mit | 27,072 |
# Copyright (c) 2013 Rackspace Hosting
# 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 req... | qwefi/nova | nova/cells/weights/mute_child.py | Python | apache-2.0 | 2,545 |
from sentry.models import Project
from sentry.plugins import Plugin
class PluginList(object):
def __init__(self, request, project, plugins):
self._request = request
self._project = project
self._plugins = plugins
self._cache = {}
def __getitem__(self, slug):
if slug no... | Kronuz/django-sentry | sentry/middleware.py | Python | bsd-3-clause | 1,698 |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
from datetime import timedelta
from flask import url_for, request
import math
import time
def format_date_time(time):
return time.strftime("%Y-%m-%d %H:%M:%S")
def format_date_time_millis(date):
return date.strftime("%Y-%m-%d %H:%M:%S.%f")[:-3]
def fo... | mourningsun75/openmoves | filters.py | Python | mit | 3,741 |
# vim: set encoding=utf-8
# Copyright (c) 2016 Intel 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | ashaarunkumar/spark-tk | python/sparktk/frame/ops/cumulative_percent.py | Python | apache-2.0 | 2,550 |
# -*- mode: python ; coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright © 2014 Tomás Godoi, <tomastxg@gmail.com>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/copyleft/agpl.html
import os
from aqt import mw
from aqt.utils import showInfo
from aqt.qt import *
import aqt
from PyQt4 import Q... | tomasxcd/anki2ccs | anki/intinc/intinc/util.py | Python | apache-2.0 | 1,586 |
import pytest
from ..types.dependencies import DependencyEmbedder, DependencyEmbedderError
pytestmark = [pytest.mark.setone, pytest.mark.working]
class TestDependencyEmbedder:
@pytest.mark.parametrize('base_path, t, expected', [
('treatment', 'treatment', [
'treatment.treatment_type',
... | 4dn-dcic/fourfront | src/encoded/tests/test_dependencies.py | Python | mit | 5,056 |
''' Byteorder utilities for system - numpy byteorder encoding
Converts a variety of string codes for little endian, big endian,
native byte order and swapped byte order to explicit numpy endian
codes - one of '<' (little endian) or '>' (big endian)
'''
from __future__ import division, print_function, absolute_import
... | sargas/scipy | scipy/io/matlab/byteordercodes.py | Python | bsd-3-clause | 1,873 |
#!/usr/bin/env python
# This file is part of Responder, a network take-over set of tools
# created and maintained by Laurent Gaffie.
# email: laurent.gaffie@gmail.com
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free... | tholum/PiBunny | system.d/library/tools_installer/tools_to_install/responder/servers/SMB.py | Python | mit | 17,744 |
"""
Module for testing the Reader class.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import pytest
from surprise import Reader
def test_params():
"""Test Reader parameters"""
with pytest.raises(ValueError):
Reader(name='wrong_nam... | NicolasHug/Surprise | tests/test_reader.py | Python | bsd-3-clause | 2,198 |
import os
from uuid import uuid4
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from model_utils.models import TimeStampedModel
def get_random_filename(instance, file_name):
ext = file_name.split('.')[-1]
file_name = '%s.%s' %... | zhiwehu/s3filesmanager | s3filesmanager/models.py | Python | mit | 832 |
# -*- coding: utf-8 -*-
import pytest
from thefuck.shells import Fish
@pytest.mark.usefixtures('isfile', 'no_memoize', 'no_cache')
class TestFish(object):
@pytest.fixture
def shell(self):
return Fish()
@pytest.fixture(autouse=True)
def Popen(self, mocker):
mock = mocker.patch('thefuc... | mcarton/thefuck | tests/shells/test_fish.py | Python | mit | 3,392 |
#Liður 5 - Heiltölur. Gert af Guðmundi
from gudmundur_func import *
class Lidur5:
def Main(self):
tolur = [];
for i in range(7):
#bæta við tölu í listann að vali notanda
tolur.append(intInput("Sláðu inn tölu " + str(i + 1) + ": "));
print("Minnsta talan er "+ str(mi... | Natsumi2813/Hopverkefni_B | Lidur5.py | Python | gpl-3.0 | 516 |
# This file is part of beets.
# Copyright 2012, Adrian Sampson.
#
# 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, ... | MusikPolice/beets | test/test_mb.py | Python | mit | 11,026 |
"""
* Copyright 2009 Mark Renouf
*
* 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, s... | Hasimir/pyjs | pyjswidgets/pyjamas/media/VideoElement.py | Python | apache-2.0 | 1,500 |
from django.conf.urls import patterns, include, url
from rest_framework import routers, serializers, viewsets
#from clients import views as clientsViews
#from projects import views as projectsViews
from tecnocrowd_backend import views
from django.contrib import admin
admin.autodiscover()
router = routers.DefaultRoute... | DesarrolloWeb2015/backend | tecnocrowd/urls.py | Python | apache-2.0 | 972 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: mnist-visualizations.py
"""
The same MNIST ConvNet example, but with weights/activations visualization.
"""
import tensorflow as tf
from tensorpack import *
from tensorpack.dataflow import dataset
IMAGE_SIZE = 28
def visualize_conv_weights(filters, name):
"... | eyaler/tensorpack | examples/basics/mnist-visualizations.py | Python | apache-2.0 | 4,834 |
# Copyright 2020 The TensorFlow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | tensorflow/graphics | tensorflow_graphics/projects/points_to_3Dobjects/transforms/transforms.py | Python | apache-2.0 | 12,632 |
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from common import public
class cdfy_sfgk():
"""开庭公告"""
need_check_ziduan = [
]
pass
#######################################################
#######################################################
| mefly2012/platform | src/parse_validate/cdfy_sfgk.py | Python | apache-2.0 | 308 |
""" This script parse and download the attachments of an email """
# coding:utf-8
import os
import poplib
import email
import time
from datetime import datetime
from email._parseaddr import parsedate_tz
import util
from Preprocess import main as predo
import const
__author__ = "Aiden"
__date__ = "2016-12-28"
__copyrig... | Macchiatto/mail-attachments-downloader | mail.py | Python | apache-2.0 | 6,437 |
# Copyright (C) 2011 Google Inc. All rights reserved.
# Copyright (C) 2011 Code Aurora Forum. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain th... | Debian/openjfx | modules/web/src/main/native/Tools/Scripts/webkitpy/tool/commands/suggestnominations_unittest.py | Python | gpl-2.0 | 5,071 |
from __future__ import division
import paddle.fluid as fluid
import numpy as np
import os
# cudnn is not better when batch size is 1.
use_cudnn = False
if 'ce_mode' in os.environ:
use_cudnn = False
def cal_padding(img_size, stride, filter_size, dilation=1):
"""Calculate padding size."""
valid_filter_size... | kuke/models | fluid/PaddleCV/gan/cycle_gan/layers.py | Python | apache-2.0 | 5,513 |
from news_spider import news_spider
from video_spider import video_spider
import re
import sys
def custom_encode(strings):
temp_str = strings
while True:
try:
pass
temp_str.encode('gbk')
except:
info = sys.exc_info()
pat = re.compile(r'u\d+'... | softtyphoon/tz | tools/17173/ymxk/release/game_spider.py | Python | gpl-2.0 | 1,948 |
#!/usr/bin/python
# Copyright (c) 2008,2010,2011,2012,2013 Alexander Belchenko
# All rights reserved.
#
# Redistribution and use in source and binary forms,
# with or without modification, are permitted provided
# that the following conditions are met:
#
# * Redistributions of source code must retain
# the above cop... | ageek/arduino | unchecked-examples/ATTiny85--Nokia5110LCD/tinytemplate-master/firmware/tools/hex2dump.py | Python | gpl-3.0 | 3,958 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Estado():
"""
Representa um estado dentro de uma árvore de estados para resolver o problema de
atravessar missionários e canibais para a outra margem do rio.
Um estado contém a quantinade de missionários à esquerda do rio (missionarios_esq... | thiagopnobre/missionarios_canibais | missionarios_canibais.py | Python | mit | 6,801 |
from django.test import TestCase
from rest_framework import serializers
from api.serializers.data_objects import DataObjectSerializer
from api.serializers.tasks import *
from api.models.tasks import *
from api.models.task_attempts import *
from api.models.data_objects import DataObject, FileResource
from api.models.da... | StanfordBioinformatics/loom | server/loomengine_server/api/test/serializers/test_tasks.py | Python | agpl-3.0 | 3,093 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Florent Fourcot
#
# 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 your op... | yannrouillard/weboob | modules/leclercmobile/backend.py | Python | agpl-3.0 | 3,777 |
# -*- 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.
import json
import pytest
from shuup.admin.modules.products.mass_... | shoopio/shoop | shuup_tests/admin/test_product_mass_edit.py | Python | agpl-3.0 | 2,956 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010-2013 Código Sur Sociedad Civil.
# All rights reserved.
#
# This file is part of Cyclope.
#
# Cyclope 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 Foundat... | CodigoSur/cyclope | cyclope/apps/staticpages/admin.py | Python | gpl-3.0 | 4,331 |
from struct import pack
from sqlite3 import Binary
def pts(c):
return ["dd",[c.X,c.Y]]
def pt4mp(c):
return ["Bidd",[1,1,c.X,c.Y]]
def mp(coordinates):
partCount=coordinates.partCount
i=0
out = ["I",[0]]
while i<partCount:
pt = coordinates.getPart(i)
[ptrn,c]=pt4mp(pt... | calvinmetcalf/arcsqlite | wkb.py | Python | mit | 3,451 |
import asyncio
import logging
import urllib.parse
from typing import Mapping, Optional, Dict, Any, Awaitable, Callable
import routes
from pyrsistent import pmap
from solo.server.response import Response
from solo.server.statuses import Http4xx, Http3xx, NotFound, Redirect
from solo.server.definitions import MatchedRo... | avanov/solo | solo/server/handler/http_handler.py | Python | mit | 5,911 |
from btmux_template_io.common_calcs import calc_walk_mp_from_engine_rating, \
calc_run_speed_from_walk_mp
from . common import add_basic_crit
def populate_movement_and_engine(xml_root, unit_obj):
"""
.. warning:: This must be called after populate_gyro()!
:param lxml.etree.Element xml_root: The root... | gtaylor/btmux_template_io | btmux_template_io/parsers/ssw/populators/engines.py | Python | bsd-3-clause | 3,241 |
from decimal import Decimal
from pybeans.const import UNDEFINED
__all__ = [
'AnyNode',
'StrNode',
'UnicodeNode',
'IntNode',
'BoolNode',
'FloatNode',
'DecimalNode',
'TupleNode',
'ListNode',
'DictNode',
'BeanNode',
'Registry',
]
class AnyNode(object):
decode = None... | cordis/pybeans | pybeans/nodes.py | Python | mit | 1,708 |
# Copyright (C) 2016 Midokura SARL.
#
# 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 writin... | openstack/tap-as-a-service | neutron_taas/services/taas/service_drivers/service_driver_context.py | Python | apache-2.0 | 2,240 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | tejaswi2492/pmip6ns3.13new | src/wimax/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 734,594 |
#!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.path.abspath('lib'))
from ansible.release import __version__, __author__
try:
from setuptools import setup, find_packages
except ImportError:
print("Ansible now needs setuptools in order to build. Install it using"
" your package man... | Censio/ansible-dev | setup.py | Python | gpl-3.0 | 2,025 |
# Copyright 2012 OpenStack Foundation
# Copyright 2012 Nebula, 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
#
# Unle... | mrunge/openstack_horizon | openstack_horizon/dashboards/admin/instances/tables.py | Python | apache-2.0 | 7,738 |
# -*- coding: utf-8 -*-
'''
Finite state machine library.
'''
class anything_else_cls:
'''
This is a surrogate symbol which you can use in your finite state machines
to represent "any symbol not in the official alphabet". For example, if your
state machine's alphabet is {"a", "b", "c",... | ferno/greenery | greenery/fsm.py | Python | mit | 29,641 |
"""Twilio Call platform for notify component."""
import logging
import urllib
import voluptuous as vol
from homeassistant.components.twilio import DATA_TWILIO
import homeassistant.helpers.config_validation as cv
from homeassistant.components.notify import (
ATTR_TARGET,
PLATFORM_SCHEMA,
BaseNotificationS... | fbradyirl/home-assistant | homeassistant/components/twilio_call/notify.py | Python | apache-2.0 | 1,891 |
#!/usr/bin/env python3
import csv
import sqlite3
# requires python3
# requires sqlite3
#
sqldb = sqlite3.connect(':memory:')
def main:
while True:
input_location = input("Please provide the pathname of the file you wish to extract data from. Enter a blank line when you are done.")
if input_location = False:
... | fedallah/dsperf | pytest_2.py | Python | mit | 1,084 |
# This script runs through all the html files in notebooks/, and adds
# in code to allow toggling of output.
import os
import re
import sys
# Find all files to work with.
path_to_notebooks = '/srv/projects/intro_programming/intro_programming/notebooks/'
filenames = []
for filename in os.listdir(path_to_notebooks):
... | nntisapeh/intro_programming | scripts/show_hide_output.py | Python | mit | 3,228 |
#!/usr/bin/env python
# coding=utf-8
from google.appengine.ext import webapp
from google.appengine.api import memcache
from google.appengine.ext import db
from google.appengine.ext.webapp import util
from v2ex.babel import Avatar
from v2ex.babel.security import *
from v2ex.babel.da import *
class AvatarHand... | qhm123/the10000 | avatar.py | Python | bsd-3-clause | 1,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.