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 shelve
import os
# Many more at:
# http://www.garykessler.net/library/file_sigs.html
# http://www.garykessler.net/library/magic.html
smudges = {
'jpg': {
'offset': 0,
'magic': '\xFF\xD8\xFF'
},
'png': {
'offset': 0,
'magic': '\x89\x50\x4E\x47\x0D\x0A\x1A\x0A'
... | leonjza/filesmudge | filesmudge/populate.py | Python | mit | 1,009 |
# -*- coding: utf-8
"""
ain7/news/models.py
"""
#
# Copyright © 2007-2018 AIn7 Devel Team
#
# 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 y... | ain7/www.ain7.org | ain7/news/models.py | Python | lgpl-2.1 | 6,657 |
# Load the siteconf module
from django.conf import settings
from django.utils.importlib import import_module
SITECONF_MODULE = getattr(settings, 'AUTOLOAD_SITECONF', settings.ROOT_URLCONF)
import_module(SITECONF_MODULE)
| luxnovalabs/enjigo_door | web_interface/autoload/models.py | Python | unlicense | 220 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | mit0110/oppia | core/domain/exp_domain_test.py | Python | apache-2.0 | 69,795 |
# Copyright 2015 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... | HaebinShin/tensorflow | tensorflow/python/training/coordinator_test.py | Python | apache-2.0 | 6,639 |
import os
from ._base import DanubeCloudCommand, CommandError
class Command(DanubeCloudCommand):
help = 'Check the existence of SECRET_KEY in local_settings.py and generate one if needed.'
def handle(self, *args, **options):
try:
from core import local_settings
except ImportError... | erigones/esdc-ce | core/management/commands/secret_key.py | Python | apache-2.0 | 1,138 |
# Copyright 2017-18 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import date
from odoo.tests.common import TransactionCase
class TestStockRemovalLocationByPriority(TransactionCase):
def setUp(sel... | Vauxoo/stock-logistics-warehouse | stock_removal_location_by_priority/tests/test_stock_removal_location_by_priority.py | Python | agpl-3.0 | 5,936 |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
# Used in the tests for run_python_module
import sys
print("runmod2: passed %s" % sys.argv[1])
| blueyed/coveragepy | tests/modules/pkg1/runmod2.py | Python | apache-2.0 | 251 |
# coding: utf-8
testinfo = "s, t 0.77, s, q"
tags = "animation"
from nose.tools import nottest
import summa
from summa.director import director
from summa.sprite import Sprite
import pyglet
from customstuff import TimedScene
import os
pyglet.resource.path.append(
os.path.join(os.path.dirname(os.path.realpath(_... | shackra/thomas-aquinas | tests/test_animation.py | Python | bsd-3-clause | 852 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-01 08:13
from __future__ import unicode_literals
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
... | bugulin/gymgeek-web | accounts/migrations/0001_initial.py | Python | apache-2.0 | 3,127 |
class ValidationError(Exception):
def __init__(self, data):
self.data = data
class BadConfiguration(Exception):
pass
class BadValidation(Exception):
pass
| hugollm/lie2me | lie2me/exceptions.py | Python | mit | 179 |
###############################################################################
# Name: osutil.py #
# Purpose: Text Utilities. #
# Author: Cody Precord <cprecord@editra.org> ... | ktan2020/legacy-automation | win/Lib/site-packages/wx-3.0-msw/wx/tools/Editra/src/ebmlib/osutil.py | Python | mit | 4,134 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('companies', '0003_auto_20170814_0301'),
]
operations = [
migrations.AlterField(
model_name='company',
... | proevo/pythondotorg | companies/migrations/0004_auto_20170821_2000.py | Python | apache-2.0 | 573 |
#-*- coding: utf-8 -*-
from django.core import urlresolvers
from django.conf import settings
from django.core.files.base import ContentFile
from django.db import models
from django.utils.translation import ugettext_lazy as _
from filer.fields.multistorage_file import MultiStorageFileField
from filer.models import mixin... | maykinmedia/django-filer | filer/models/filemodels.py | Python | bsd-3-clause | 9,937 |
# -*- coding: utf-8 -*-
"""
MoinMoin - bootstrap theme, based on codereading5
@copyright: 2012 speirs http://www.codereading.com
@copyright: 2013 Luca Barbato
@license: GNU GPL, see COPYING for details.
"""
from MoinMoin.theme import ThemeBase
from MoinMoin.action import get_available_actions
from M... | lu-zero/moinmoin-bootstrap | bootstrap.py | Python | gpl-2.0 | 32,867 |
# Copyright (c) 2013 OpenStack, LLC.
#
# 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... | tucbill/manila | manila/api/openstack/__init__.py | Python | apache-2.0 | 4,673 |
from django.conf.urls.defaults import *
from django.contrib import admin
from ummeli.vlive import views
from django.views.generic.simple import redirect_to
admin.autodiscover()
urlpatterns = patterns('',
# url(r'^ummeli/', include('ummeli.foo.urls')),
# Uncomment the admin/doc line below to enable admin docu... | praekelt/ummeli | ummeli/mobi_urls.py | Python | bsd-3-clause | 839 |
# -*- 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... | kevin8909/xjerp | openerp/addons/stock/product.py | Python | agpl-3.0 | 30,499 |
#######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
######################################################... | syurkevi/arrayfire-python | arrayfire/statistics.py | Python | bsd-3-clause | 3,560 |
#!/usr/bin/env python
# encoding: utf-8
"""
problem_22.py
Created by James Jones on 2015-02-04.
Problem 22 from https://projecteuler.net/problem=22
Description:
Using names.txt, a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical ... | outcast/projecteuler | 22/problem_22.py | Python | unlicense | 1,417 |
# coding=utf-8
from fsfunc import fs
from kernel.filesystem import root_iNode_name
from utils.decorator.synchronizer import syncClassBase,sync,sync_
class session(syncClassBase):
'''A wrapper for fsfunc that record working directory'''
def __init__(self,io):
syncClassBase.__init__(self)
self.f... | levythu/swift-layerC | kernel/filesystem/session.py | Python | gpl-2.0 | 710 |
###############################################################################
##
## Copyright (C) 2014-2015, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | hjanime/VisTrails | vistrails/core/repository/poster/streaminghttp.py | Python | bsd-3-clause | 11,197 |
def test_python2_is_installed(host):
python_file = host.file("/usr/bin/python2")
assert python_file.exists
| samvarankashyap/linch-pin | docs/source/examples/workspaces/testinfra/hooks/testinfra/test_python.py | Python | gpl-3.0 | 115 |
import hashlib
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.colors as colors
import matplotlib.cm as cm
from matplotlib.patches import Rectangle
import os
import shutil
import tempfile
fro... | mbaldessari/sarstats | sar_grapher.py | Python | gpl-2.0 | 10,858 |
#----------------------------------------------------------------------
# Copyright (c) 2015 Inria by David Margery
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including without ... | tcmitchell/geni-tools | src/gcf/geni/am/test_ams.py | Python | mit | 1,765 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sitecheck', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='ApiClientState',
fields=[
('id', models.AutoFie... | tykling/tlsscout | src/ssllabs/migrations/0001_initial.py | Python | bsd-3-clause | 1,636 |
try:
from functools import singledispatch
except ImportError:
from singledispatch import singledispatch
from . import ffi, librtmp
from .aval import AVal
from .compat import is_py2, bytes, range
from .exceptions import AMFError
AMF_STRING_TYPES = (librtmp.AMF_STRING, librtmp.AMF_LONG_STRING)
AMF_OBJECT_DICT_T... | Autotonic/piny-librtmp | rtmp/librtmp/amf.py | Python | mit | 4,625 |
__source__ = 'https://leetcode.com/problems/island-perimeter/'
# Time: O(n)
# Space: O(1)
#
# Description: Leetcode # 463. Island Perimeter
# Though: what if theres' a lake?
# Lake: [[0,1,0,0],[1,0,1,0],[0,1,0,0],[1,1,0,0]]
# No Lake: [[0,1,0,0],[1,1,1,0],[0,1,0,0],[1,1,0,0]]
# -> both works
# You are given a map i... | JulyKikuAkita/PythonPrac | cs15211/IslandPerimeter.py | Python | apache-2.0 | 5,998 |
#! /usr/bin/env python
from zplot import *
t = table('verticalintervals.data')
canvas = pdf('verticalintervals.pdf')
d = drawable(canvas, coord=[50,30],
xrange=[0,t.getmax('nodes')], yrange=[0,900])
axis(d, xtitle='Nodes', xauto=[0,t.getmax('nodes'),1],
ytitle='Throughput (MB)', yauto=[0,900,300])
... | z-plot/z-plot | examples/basics-pdf/verticalintervals.py | Python | bsd-3-clause | 478 |
import logging
from typing import List
from lxml.builder import E
from .e2b_resources import build_messageheader, build_safetyreport, print_root
from .models.e2b import TrackedEntity
log = logging.getLogger(__name__)
def run(
tracked_entities: List[TrackedEntity],
*,
sender_id: str,
receiver_id: st... | dhis2/dhis2-python | dhis2_core/src/dhis2/e2b/r2.py | Python | bsd-3-clause | 737 |
# Copyright 2013 Mellanox Technologies, 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 t... | onecloud/neutron | neutron/plugins/mlnx/mlnx_plugin.py | Python | apache-2.0 | 23,950 |
# -*- coding: utf-8 -*-
# Copyright 2011 Jiří Janoušek <janousek.jiri@gmail.com>
# Copyright 2014 Jaap Karssenberg <jaap.karssenberg@gmail.com>
import gtk
import gobject
from zim.objectmanager import ObjectManager
from zim.gui.widgets import ScrolledTextView, ScrolledWindow, TableVBox
# Constants for grab-focus-... | Osndok/zim-desktop-wiki | zim/gui/objectmanager.py | Python | gpl-2.0 | 6,852 |
import unittest
from simple_dargparse_test import SimpleDargparseTest
###############################################################################
all_suites = [
unittest.TestLoader().loadTestsFromTestCase(SimpleDargparseTest)
]
###############################################################################
# b... | cwahbong/dargparse | dargparse/tests/test_suite.py | Python | mit | 511 |
# Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | tseaver/gcloud-python | logging/google/cloud/logging/handlers/handlers.py | Python | apache-2.0 | 5,412 |
class Actor():
def __init__(self, assumptions, noiseGenerator, uniformNoiseGenerator):
self.assumptions = assumptions
self.noiseGenerator = noiseGenerator
self.uniformNoiseGenerator = uniformNoiseGenerator
class Fundamentalist(Actor):
def price(self, data):
return data['currentP... | jfarid27/CFP-Simplified | simulation/CFP/Actor.py | Python | gpl-3.0 | 879 |
from math import sqrt
def cp437(string):
"""Converts utf8 to codepage 437"""
return ''.join([chr(ord(c.encode('cp437'))) for c in string])
def rect(x, y, width, height):
result = []
for i in range(width):
for j in range(height):
result.append((i + x, j + y))
return result
... | JoshuaSkelly/lunch-break-rl | utils.py | Python | mit | 1,404 |
from collections import namedtuple
from django.utils.translation import ugettext as _, pgettext
Variable = namedtuple(
'Variable',
['label', 'multiplier', 'format_value', 'format_transfer', 'metric_label', 'imperial_label']
)
Constraint = namedtuple(
'Constraint',
['label', 'format_value', 'format_ran... | consbio/seedsource-core | seedsource_core/django/seedsource/report_config.py | Python | bsd-3-clause | 6,847 |
from django.db import models
class Photo(models.Model):
photo_text = models.CharField(max_length=200)
image = models.ImageField()
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.photo_text
class Comment(models.Model):
photo = models.ForeignKey(Photo)
co... | louismerlin/merlin-hub | hub/multim/models.py | Python | mit | 476 |
#!/usr/bin/env python
"""
@package ion.agents.platform.responses
@file ion/agents/platform/responses.py
@author Carlos Rueda
@brief Some constants for responses from platform agents/drivers.
"""
from ion.agents.instrument.common import BaseEnum
__author__ = 'Carlos Rueda'
__license__ = 'Apache 2.0'
class Nor... | ooici/marine-integrations | mi/platform/responses.py | Python | bsd-2-clause | 1,069 |
# -*- coding: uَtَf-8 -*-
َfrom daَteَtime imporَt daَteَtime
َfrom odoo imporَt hَtَtp, َtools, _
َfrom odoo.hَtَtp imporَt requesَt, rouَte
َfrom odoo.addons.websiَte_sale.conَtrollers.main imporَt WebsiَteSale as Base
class WebsiَteSale(Base):
deَf _geَt_mandaَtory_shipping_َfields(selَf):
reَturn ["... | mohamedhagag/dvit-odoo | dvit_hora_address/controllers/controllers.py | Python | agpl-3.0 | 4,583 |
#!/usr/local/munki/munki-python
from CoreFoundation import CFPreferencesCopyAppValue
from distutils.version import LooseVersion
import logging
import os
import plistlib
import sys
# Stolen from offset's offset
if not os.path.exists(os.path.expanduser('~/Library/Logs')):
os.makedirs(os.path.expanduser('~/Library/L... | aysiu/OldMunkiPackages | payload/usr/local/omp/OldMunkiPackages.py | Python | apache-2.0 | 12,313 |
"""
.. todo::
WRITEME
"""
import numpy as N
import copy
from theano import config
import theano.tensor as T
from pylearn2.utils.rng import make_np_rng
class CosDataset(object):
"""
Makes a dataset that streams randomly generated 2D examples.
The first coordinate is sampled from a uniform distribution... | skearnes/pylearn2 | pylearn2/datasets/cos_dataset.py | Python | bsd-3-clause | 3,767 |
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | afrolov1/nova | nova/tests/integrated/test_servers.py | Python | apache-2.0 | 20,095 |
from .conll import ConllTree
from copy import deepcopy
del_roles = ["aux", "auxpass", "punct", "det", "predet", "cc", "quantmod", "tmod", "prep", "prt"]
attr_roles = ["arg", "acop", "mod", "amod", "nn", "neg", "expl", "poss", "possessive", "attr", "cop"]
append_roles = ["appos", "num", "number", "ref", "sdep"]
coord_r... | greedyrook/pypatent | pypatent/parser/reduce.py | Python | mit | 1,304 |
"""engine.SCons.Tool.sunar
Tool-specific initialization for Solaris (Forte) ar (library archive). If CC
exists, static libraries should be built with it, so that template
instantians can be resolved.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic S... | aubreyrjones/libesp | scons_local/scons-local-2.3.0/SCons/Tool/sunar.py | Python | mit | 2,571 |
from module import Klass
from math import pi as PI
from matrix import MAT1, MAT2
def class_decorator(cls):
cls.__call__ = lambda self: print('Cabbage!')
return cls
@class_decorator
class Class(Klass):
@property
def property(self):
temp, ellipsis = self._property
return {temp} if te... | petervaro/python | tests/Python3.py | Python | gpl-3.0 | 1,285 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br)
#
# This file is part of libSigNetSim.
#
# libSigNetSim 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 Fou... | msreis/SigNetSim | signetsim/views/edit/ModelSpeciesForm.py | Python | agpl-3.0 | 3,480 |
import sys
import common.stuck
def init_yappi():
import atexit
import yappi
print('[YAPPI START]')
# yappi.set_clock_type('')
yappi.start()
@atexit.register
def finish_yappi():
print('[YAPPI STOP]')
yappi.stop()
print('[YAPPI WRITE]')
stats = yappi.get_func_stats()
for stat_type in ['pstat', 'c... | fake-name/ReadableWebProxy | runFetchAgent.py | Python | bsd-3-clause | 918 |
#!/usr/bin/python
#
# input format:
# lines of verilog binary strings, e.g.
# 1001_10101_10011_1101
# comments beginning with # sign
# lines with just whitespace
#
# output format:
# a module that implements a rom
#
# usage: bsg_ascii_to_rom.py <filename> <modulename>
#
# to compress out zero entries with a def... | litex-hub/pythondata-cpu-blackparrot | pythondata_cpu_blackparrot/system_verilog/black-parrot/external/basejump_stl/bsg_mem/bsg_ascii_to_rom.py | Python | bsd-3-clause | 1,921 |
#!/usr/bin/env python3
import os
import subprocess
prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr')
datadir = os.path.join(prefix, 'share')
# Packaging tools define DESTDIR and this isn't needed for them
if 'DESTDIR' not in os.environ:
print('Compiling gsettings schemas...')
schema_dir = os.path.join... | bitseater/weather | meson/post_install.py | Python | gpl-3.0 | 765 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-03-15 08:59
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app', '0116_tag'),
]
operations = [
migrati... | malaonline/Server | server/app/migrations/0117_auto_20160315_1659.py | Python | mit | 2,385 |
#!/usr/bin/env python
"""This script solves the Project Euler problem "Prime pair sets". The problem
is: Find the lowest sum for a set of five primes for which any two primes
concatenate to produce another prime.
"""
from __future__ import division
import argparse
import math
from collections import defaultdict
def... | iansealy/projecteuler | 60.py | Python | gpl-3.0 | 3,556 |
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium import webdriver
import sys
class FunctionalTest(StaticLiveServerTestCase):
@classmethod
def setUpClass(cls):
for arg in sys.argv:
if 'liveserver' in arg:
cls.server_url = 'http://' + arg... | walkerSong/superlists | functional_tests/base.py | Python | gpl-2.0 | 914 |
import argparse
from collections import OrderedDict
import matplotlib.pyplot as plt
import seaborn as sns
from aod_cells.schemata import *
# plot_params = dict(cmap=plt.cm.gray, vmin=0, vmax=1)
plot_params = dict(cmap=plt.cm.gray)
plot_paramsP = dict(cmap=sns.blend_palette(['yellow', 'deeppink'], as_cmap=True), zord... | cajal/cell_detector | scripts/label_cells.py | Python | mit | 8,354 |
#!/usr/bin/python
# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
f = open(sys.argv[1] + ".cc", "w")
f.write("""\
#include <stdio.h>
int main() {
puts("Hello %s");
return 0;
}
""" % sys.argv[1])... | dtebbs/gyp | test/rules/src/rule.py | Python | bsd-3-clause | 331 |
#===islucyplugin===
# -*- coding: utf-8 -*-
# note_plugin.py
# 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.
# ... | XtremeTeam/Lucy-bot | brain/plugins/note.py | Python | gpl-2.0 | 8,369 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11b1 on 2017-06-18 18:47
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('gwasdb', '0004_remove_snp_name'),
]
operations = [
migrations.RemoveField(
... | 1001genomes/AraGWAS | aragwas_server/gwasdb/migrations/0005_auto_20170618_1847.py | Python | mit | 908 |
# encoding: utf-8
"""
API classes for dealing with presentations and other objects one typically
encounters as an end-user of the PowerPoint user interface.
"""
from __future__ import absolute_import
import os
from pptx.opc.constants import RELATIONSHIP_TYPE as RT
from pptx.opc.package import OpcPackage
from pptx.p... | Hitachi-Data-Systems/org-chart-builder | pptx/package.py | Python | apache-2.0 | 2,601 |
#encoding: utf-8
"""Tornado handlers for the terminal emulator."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import tornado
from tornado import web
import terminado
from ..base.handlers import IPythonHandler
class TerminalHandler(IPythonHandler):
"""Rend... | madelynfreed/rlundo | venv/lib/python2.7/site-packages/IPython/html/terminal/handlers.py | Python | gpl-3.0 | 861 |
import numpy as np
import json
import datetime
import os, glob
from SEDMDb.SedmDb import SedmDB
from pandas import DataFrame
import psycopg2
from psycopg2 import extras
from sqlalchemy.exc import IntegrityError
import requests
import SEDMrph.fitsutils as fitsutils
db = SedmDB(host='localhost', dbname='sedmdb')
def ... | scizen9/kpy | flask/model.py | Python | gpl-2.0 | 25,935 |
from verbs.baseforms import forms
class CoverForm(forms.VerbForm):
name = "Cover"
slug = "cover"
add_conditional_statement = forms.CharField()
edit_what_remark = forms.CharField()
comment_why = forms.CharField()
duration_min_time = forms.IntegerField() | Bionetbook/bionetbook | bnbapp/bionetbook/_old/verbs/forms/cover.py | Python | mit | 281 |
#!/usr/bin/python
import re
import ipaddress as ip
import argparse
import config as cfg
import sys
#Adds libs dir to sys.path
sys.path.insert( 0, cfg.libdir )
#import expect module
import expect
#Dictionary to store all url objects
urls = {}
#Dictionary to store all addresses objects
ipobjectsbyip = {}
#Dictionary t... | abdulet/fwbuilder | modules/csv2checkpoint/csv2checkpoint-dbedit.py | Python | gpl-3.0 | 19,025 |
from django.contrib.auth.models import AbstractBaseUser, UserManager
from django.db import models
class CustomUserNonUniqueUsername(AbstractBaseUser):
"""
A user with a non-unique username.
This model is not invalid if it is used with a custom authentication
backend which supports non-unique... | yephper/django | tests/auth_tests/models/invalid_models.py | Python | bsd-3-clause | 638 |
# -*- coding: utf-8 -*-
from os import environ
from subprocess import PIPE, Popen
from sys import exit
args = [environ["CORGI"], "match", "[ \\t\\n\\r]", "\n"]
proc = Popen(args, stdout=PIPE)
stdout = proc.stdout.read().decode("UTF-8")
proc.wait()
if stdout != "\n":
exit(1)
exit(0)
# vim: tabstop=4 shiftwidth=4 ... | SumiTomohiko/corgi | tests/test_charset080.py | Python | mit | 344 |
from . import PqsoDerivative
from pyRSD.rsd.tools import k_AP, mu_AP
class dPqso_db1(PqsoDerivative):
"""
The partial derivative of :func:`QuasarSpectrum.power` with respect to
``b1``
"""
param = 'b1'
@staticmethod
def eval(m, pars, k, mu):
kprime = k_AP(k, mu, m.alpha_perp, m.al... | nickhand/pyRSD | pyRSD/rsd/power/qso/derivatives/b1.py | Python | gpl-3.0 | 813 |
"""Supplementary tools for the `iris` EOF analysis interface."""
# (c) Copyright 2013-2016 Andrew Dawson. All Rights Reserved.
#
# This file is part of eofs.
#
# eofs 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 Founda... | ajdawson/eofs | lib/eofs/tools/iris.py | Python | gpl-3.0 | 11,172 |
#!/usr/bin/env python
import cv2
import numpy as np
import multiprocessing
from time import sleep, time
from .tools import PiCameraOperations
from ..ktrafficlight import TrafficLight
from ..pathsandnames import PathsAndNames
from .picamera_simulation import PiCameraSimulation
class Capturador(multiprocessing.Process... | AlvaroRQ/prototipo | ownLibraries/shutterFiles/capturador.py | Python | gpl-3.0 | 5,811 |
# coding=utf-8
# Based on the SQuAD evaluation script from:
# https://github.com/allenai/bi-att-flow/blob/master/squad/evaluate-v1.1.py
# 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
#
# h... | google-research/xtreme | third_party/evaluate_squad.py | Python | apache-2.0 | 4,175 |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from ggrc import db
from ggrc.models.mixins import (
Base, Titled, Described,... | uskudnik/ggrc-core | src/ggrc_workflows/models/cycle_task_group.py | Python | apache-2.0 | 1,394 |
def Setup(Settings,DefaultModel):
# finetune_tests_COOK.py
Settings["experiment_name"] = "Finetuning-tests_big_cca_10hrs_experiment_COOK"
Settings["graph_histories"] = ['together'] #['all','together',[],[1,0],[0,0,0],[]]
n = 0
Settings["models"][n]["model_type"] = 'simple_cnn_with_top'
Settin... | previtus/MGR-Project-Code | Settings/independent_experiments/finetunning_tests/finetune_tests_COOK.py | Python | mit | 1,395 |
import logging
from github3 import GitHub
import config
from plugins.repository.helper import *
class BitBucketHelper(RepositoryHelper):
def __init__(self, repo_url=None):
self.repo_url = repo_url
def can_process(self, url):
if "bitbucket.com" in url:
self.repo_url = url
... | softwaresaved/software-assessment-framework | plugins/repository/bitbucket.py | Python | bsd-3-clause | 985 |
from itertools import product
import warnings
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.colors import same_color
import pytest
from numpy.testing import assert_array_equal
from ..palettes import color_palette
from ..relational import (
_Relati... | iproduct/course-social-robotics | 11-dnn-keras/venv/Lib/site-packages/seaborn/tests/test_relational.py | Python | gpl-2.0 | 56,653 |
# encoding: utf-8
# module samba.dcerpc.lsa
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/lsa.so
# by generator 1.135
""" lsa DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class LUID(__talloc.Object):
# no doc
def __init__(self, *args, **kwargs): # real signature unknown
... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/lsa/LUID.py | Python | gpl-2.0 | 734 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
################################################################################
# DChars Copyright (C) 2012 Suizokukan
# Contact: suizokukan _A.T._ orange dot fr
#
# This file is part of DChars.
# DChars is free software: you can redistribute it and/or modify
# ... | suizokukan/anceps | dchars/languages/grc/dstring.py | Python | gpl-3.0 | 27,522 |
ranged_attacker = "ranged attacker"
melee_attacker = "melee attacker"
healer = 'healer'
dismantling_attacker = 'dismantler'
general_attacker = 'general attacker'
tough_attacker = 'tough guy'
work_and_carry_attacker = 'multi-purpose attacker'
civilian = 'civilian'
scout = 'scout'
| daboross/screeps-warreport | warreport/constants.py | Python | mit | 280 |
"""
Test lldb data formatter subsystem.
"""
from __future__ import print_function
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class SkipSummaryDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
... | apple/swift-lldb | packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py | Python | apache-2.0 | 7,621 |
# -*- python -*-
# Package : omniidl
# typecode.py Created on: 1999/12/2
# Author : David Scott (djs)
#
# Copyright (C) 2003-2012 Apasphere Ltd
# Copyright (C) 1999 AT&T Laboratories Cambridge
#
# This file is part of omniidl.
#
# omniidl is... | yeewang/omniORB | src/lib/omniORB/python/omniidl_be/cxx/dynskel/typecode.py | Python | gpl-2.0 | 35,087 |
# Copyright (c) 2010-2012 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | mjwtom/swift | swift/common/middleware/recon.py | Python | apache-2.0 | 16,726 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2020_07_01/operations/_express_route_cross_connection_peerings_operations.py | Python | mit | 22,763 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''Ripyl protocol decode library
can.py test suite
'''
# Copyright © 2013 Kevin Thibedeau
# This file is part of Ripyl.
# Ripyl 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 Fre... | kevinpt/ripyl | test/test_can.py | Python | lgpl-3.0 | 3,681 |
from twisted.internet import protocol
from twisted.python import log
class PokerBotProcess(protocol.ProcessProtocol):
def __init__(self, game_key, bot, on_connect, logger):
self.game = game_key
self.bot = bot
self.on_connect = on_connect
self.logger = logger
def connectionMade... | gnmerritt/poker-plumbing | pipes/processes.py | Python | mit | 1,025 |
"""Let's Encrypt client crypto utility functions
.. todo:: Make the transition to use PSS rather than PKCS1_v1_5 when the server
is capable of handling the signatures.
"""
import logging
import os
import time
import Crypto.Hash.SHA256
import Crypto.PublicKey.RSA
import Crypto.Signature.PKCS1_v1_5
import M2Crypt... | diracdeltas/lets-encrypt-preview | letsencrypt/client/crypto_util.py | Python | apache-2.0 | 6,343 |
# -*- coding: utf-8 -*-
import smtplib
from email.mime.text import MIMEText
from email.Utils import formatdate
from logbook import Logger
from thekraken.settings import MAIL
log = Logger('thekraken.report')
def send_report(subject, body):
"""Informs about an error"""
msg = MIMEText(body, 'html', _charset=... | sharkerz/thekraken | thekraken/report.py | Python | gpl-2.0 | 820 |
from tapiriik.settings import WEB_ROOT
from tapiriik.services.service_base import ServiceAuthenticationType, ServiceBase
from tapiriik.services.interchange import UploadedActivity, ActivityType, ActivityStatistic, ActivityStatisticUnit
from tapiriik.services.api import APIException, UserException, UserExceptionType, AP... | dlenski/tapiriik | tapiriik/services/VeloHero/velohero.py | Python | apache-2.0 | 12,643 |
from fabric.api import local
def tests():
commands = [
"export PYTHONPATH=.",
"export ASYNC_TEST_TIMEOUT=60",
"coverage run --source=. -m unittest discover -s tests/",
"coverage report -m",
]
local(' ; '.join(commands))
| joelmir/tornado-simple-api | fabfile.py | Python | mit | 265 |
import tensorflow as tf
from tensorflow.contrib import slim as slim
from avb.ops import *
import math
def encoder(x, config, eps=None, is_training=True):
output_size = config['output_size']
c_dim = config['c_dim']
df_dim = config['df_dim']
z_dist = config['z_dist']
z_dim = config['z_dim']
eps_d... | LMescheder/AdversarialVariationalBayes | avb/avb/models/full0_ac.py | Python | mit | 1,962 |
#-*- coding: utf-8 -*-
"""OAuth 2.0 Authorization"""
try: import simplejson as json
except ImportError: import json
from django.http import HttpResponseRedirect
try:
from django.http.request import absolute_http_url_re # Django 1.5+
except ImportError:
from django.http import absolute_http_url_re
from urll... | RaduGatej/SensibleData-Platform | sensible_data_platform/oauth2app/authorize.py | Python | mit | 12,944 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Vauxoo
# Author : Yanina Aular <yani@vauxoo.com>
# Osval Reyes <osval@vauxoo.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the term... | Endika/rma | crm_rma_claim_make_claim/models/__init__.py | Python | agpl-3.0 | 1,040 |
# coding: utf-8
#
# Copyright 2017 The Oppia 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 requi... | himanshu-dixit/oppia | core/domain/question_services_test.py | Python | apache-2.0 | 4,658 |
"""This class manages dataset downloads concurrently and processes progress
output."""
import wx
from retriever.lib.download import DownloadThread
class DownloadManager:
def __init__(self, parent):
self.dialog = None
self.worker = None
self.queue = []
self.downloaded = set()
... | embaldridge/retriever | app/download_manager.py | Python | mit | 4,858 |
#!/usr/bin/env python3
"""Split VCF into singleton vs other duplicated categories
Usage:
<program> input_vcf input_categories
Input and output VCFs can be compressed with gzip, ending in .gz
"""
# Modules
from collections import defaultdict
from collections import Counter
import gzip
import sys
# Functions
d... | enormandeau/stacks_workflow | 00-scripts/10_split_vcf_in_categories.py | Python | gpl-3.0 | 1,776 |
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# Name: sfp_duckduckgo
# Purpose: Queries DuckDuckGo's API for information abotut the target.
#
# Author: Steve Micallef <steve@binarypool.com>
#
# Created: 21/07/2015
# Copyright: (... | Wingless-Archangel/spiderfoot | modules/sfp_duckduckgo.py | Python | gpl-2.0 | 4,048 |
import platform
if platform.python_implementation() == 'PyPy':
def compress(*a, **kw):
from lz4framed import compress as _compress
return _compress(*a, **kw)
def decompress(*a, **kw):
from lz4framed import decompress as _decompress
return _decompress(*a, **kw)
else:
from ... | douban/dpark | dpark/utils/lz4wrapper.py | Python | bsd-3-clause | 396 |
import imboclient.test.integration.config as config
import imboclient.client as imbo
import os
import json
class TestClient:
def setup(self):
self._host = config.server['host'] + ":" + config.server['port']
self._public = config.server['public']
self._private = config.server['private']
... | imbo/imboclient-python | imboclient/test/integration/test_client.py | Python | mit | 4,827 |
#!/usr/bin/env python
import django
from django.conf import settings
TEMPLATE_CONTEXT_PROCESSORS = [
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.tz',
... | JaapJoris/django-pandocfield | runtests.py | Python | gpl-3.0 | 2,001 |
# -*- coding: utf-8 -*-
"""
@file: tasks.py
@author: lyn
@contact: tonylu716@gmail.com
@python: 3.5
@editor: Vim
@create: 3/29/17 2:20 AM
@description:
用于反爬虫的一些异步任务,主要是刷新数据表中某些临时记录。
"""
from __future__ import absolute_import, unicode_literals
from celery import task as celery_task
from .model... | lyn716/deep_stack | django_server/RobotKiller/tasks.py | Python | apache-2.0 | 1,115 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Test components of specific crowdsourcing tasks.
"""
import json
import os
import unittest
import pandas as pd
imp... | facebookresearch/ParlAI | tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static_analysis.py | Python | mit | 5,770 |
"""todoApp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | rusia-rak/todoApp | core/urls.py | Python | mpl-2.0 | 990 |
from OpenGL.GL import *
from pyrr import Quaternion, Vector3, Matrix44
from PySide import QtCore
from PySide.QtGui import (
QWidget,
QHBoxLayout,
QVBoxLayout,
QToolBar,
QIcon,
QFileDialog,
QTableWidget,
QAbstractItemView,
QHeaderView,
QLabel,
QCheckBox,
QSlider,
QLine... | mkovacs/sphaira | sphaira/layer.py | Python | lgpl-3.0 | 8,379 |
# This file is part of MyPaint.
# Copyright (C) 2009 by Martin Renold <martinxyz@gmx.ch>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) ... | benosteen/mypaint | gui/brushcreationwidget.py | Python | gpl-2.0 | 9,333 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.