code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from django.db import models
from django.contrib.auth import models as authmodels
from django.conf import settings
from signbank.video.fields import VideoUploadToFLVField
from signbank.dictionary.models import *
#from signbank.dictionary.models import Gloss
# models to represent the feedback from users in the site
im... | Woseseltops/signbank | signbank/feedback/models.py | Python | bsd-3-clause | 12,524 |
# Original code (pygame example): https://bitbucket.org/pygame/pygame/src/25e3f2cee879/examples/midi.py
# Is also found in the local installation at Python27/Lib/site-packages/pygame/examples/midi.py
# Object-oriented implementation of MIDI Keyboard exercise
import pygame
from pygame import midi
from pygame.locals i... | introprogramming/exercises | exercises/midi/midi2.py | Python | mit | 5,073 |
import itertools
import unittest
from ._testutil import RedisTest, run_until_complete, REDIS_VERSION
class SortedSetsCommandsTest(RedisTest):
@run_until_complete
def test_zadd(self):
key = b'key:zadd'
res = yield from self.redis.zadd(key, 1, b'one')
self.assertEqual(res, 1)
r... | iho/aioredis | tests/sorted_set_commands_test.py | Python | mit | 26,107 |
import datetime
import ops.cmd
import ops
import ops.db
import ops.project
IFCONFIG_TAG = 'OPS_IFCONFIG_DATA'
MAX_CACHE_SIZE = 5
def get_ifconfig(maxage=datetime.timedelta(seconds=0), targetID=None):
status_cmd = ops.cmd.getDszCommand('ifconfig')
return ops.project.generic_cache_get(status_cmd, cache_tag=IFCO... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Ops/PyScripts/lib/ops/networking/ifconfig.py | Python | unlicense | 634 |
import xmlrpclib
@auth.requires_login()
def index():
""" Whitelist the remote that clicks the button. """
response.title = 'Whitelist'
form = FORM.confirm('Add exception')
if form.accepted:
from firewall import Whitelist
whitelist = Whitelist()
whitelist.add(request.env.remote... | tessercat/ddj | controllers/whitelist.py | Python | mit | 353 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-06 16:53
from __future__ import unicode_literals
from django.db import migrations
import django.db.models.manager
class Migration(migrations.Migration):
dependencies = [
('events', '0022_auto_20160229_2111'),
]
operations = [
... | aapris/linkedevents | events/migrations/0023_auto_20160506_1953.py | Python | bsd-3-clause | 691 |
from __future__ import division
from random import shuffle, choice, randint, seed
from os.path import expanduser
from numpy import log10
from scipy import stats
import numpy as np
import time
import math
import copy
import sys
import os
from pprint import pprint as pp
mydir = expanduser("~/")
sys.path.append(mydir + ... | RoyBoy432/Emergence-Senescence | model/adaptn_rate/NOSSTOx2.py | Python | gpl-3.0 | 9,357 |
import threading
import traceback
from _shaded_thriftpy.server import TServer
from _shaded_thriftpy.transport import TTransportException
class TSingleThreadedServer(TServer):
"""Server that accepts a single connection and spawns a thread to handle it."""
def __init__(self, *args, **kwargs):
self.dae... | jwren/intellij-community | python/helpers/pydev/_pydev_comm/pydev_server.py | Python | apache-2.0 | 1,265 |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/google/cloud/language/client.py | Python | mit | 5,494 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Provides the web interface for changing internal_only property of a Bot."""
import logging
from google.appengine.api import taskqueue
from google.appeng... | modulexcite/catapult | dashboard/dashboard/change_internal_only.py | Python | bsd-3-clause | 6,872 |
#!/usr/bin/env python
import sys
import zlib
import struct
import array
from cStringIO import StringIO
def decode_varint(inf):
value = 0
base = 1
l = 0
while True:
raw_byte = inf.read(1)
if len(raw_byte) == 0:
return 0, 0
raw_byte = raw_byte[0]
l += 1
... | uniquelogin/mcproxy | decode_log.py | Python | mit | 6,217 |
from django import forms
from django.utils.translation import pgettext_lazy
from ...seo.models import SeoModel
from ..widgets import CharsLeftWidget
SEO_FIELD_HELP_TEXT = pgettext_lazy(
'Form field help text',
'If empty, the preview shows what will be autogenerated.')
MIN_DESCRIPTION_LENGTH = 120
MIN_TITLE_LE... | UITools/saleor | saleor/dashboard/seo/fields.py | Python | bsd-3-clause | 1,793 |
#
# This file is part of Team 1418 Dashboard
#
# Team 1418 Dashboard is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# Team 1418 Dashboard is distributed in the hope that it ... | frc1418/2014 | driver_station/src/ui/widgets/target_widget.py | Python | bsd-3-clause | 1,302 |
import unittest
from cStringIO import StringIO
from pysal.core.util.shapefile import noneMax, noneMin, shp_file, shx_file, NullShape, Point, PolyLine, MultiPoint, PointZ, PolyLineZ, PolygonZ, MultiPointZ, PointM, PolyLineM, PolygonM, MultiPointM, MultiPatch
import os
import pysal
class TestNoneMax(unittest.TestCase):... | chhao91/pysal | pysal/core/util/tests/test_shapefile.py | Python | bsd-3-clause | 16,457 |
# -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2015 TrustCode - www.trustcode.com.br #
# ... | alexsandrohaag/odoo-website-addons | website_crm_lead_creation/__openerp__.py | Python | agpl-3.0 | 1,917 |
"""
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... | azumimuo/family-xbmc-addon | plugin.video.salts/scrapers/directdl_scraper.py | Python | gpl-2.0 | 7,343 |
# -*- coding: utf-8 -*-
__author__ = 'Alexandre Proença' | pombredanne/django-drf-file-generator | tests/drf_gem_build_test/__init__.py | Python | mit | 57 |
# -*- coding:utf-8 -*-
import sys
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
Signal = pyqtSignal
Slot = pyqtSlot
# /////////////////////////////////////////////////////////////////////////////
# ?r???[???\?????邽?߂̃V?[???B ... | peace098beat/pyside_cookbook | FiFiSaliencyMap/image_viewer.py | Python | gpl-3.0 | 5,618 |
#
# Textbook example: Rabi oscillation in the dissipative Jaynes-Cummings model.
#
#
from qutip import *
from pylab import *
import time
def jc_integrate(N, wc, wa, g, kappa, gamma, psi0, use_rwa, tlist):
# Hamiltonian
idc = qeye(N)
ida = qeye(2)
a = tensor(destroy(N), ida)
sm = tensor(idc, des... | Vutshi/qutip | examples/ex_JC_model.py | Python | gpl-3.0 | 2,107 |
from __future__ import unicode_literals
import re
import sys
import argparse
from threading import Lock
from flask import Flask
from werkzeug.routing import BaseConverter
from werkzeug.serving import run_simple
from moto.backends import BACKENDS
from moto.core.utils import convert_flask_to_httpretty_response
HTTP_M... | jotes/moto | moto/server.py | Python | apache-2.0 | 3,436 |
# Copyright (C) IBM Corp. 2016.
#
# 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.
#
# This program is distributed in the... | open-power-host-os/builds | lib/iso_builder.py | Python | gpl-3.0 | 13,805 |
""""""
from __future__ import annotations
import logging
from typing import Any, Callable, Dict, List, Optional
from flask import Blueprint, Flask, g
from flask.helpers import _endpoint_from_view_func
from flask_login import current_user
from werkzeug.exceptions import Forbidden
from werkzeug.utils import import_stri... | abilian/abilian-core | src/abilian/web/admin/extension.py | Python | lgpl-2.1 | 6,377 |
# -*- coding: utf-8 -*-
"""
End-to-end tests for LibraryContent block in LMS
"""
import ddt
import textwrap
from ..helpers import UniqueCourseTest
from ...pages.studio.auto_auth import AutoAuthPage
from ...pages.studio.overview import CourseOutlinePage
from ...pages.studio.library import StudioLibraryContentXBlockEdit... | jazkarta/edx-platform-for-isc | common/test/acceptance/tests/lms/test_library.py | Python | agpl-3.0 | 13,076 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorflow/core/framework/reader_base.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protob... | nubbel/swift-tensorflow | PythonGenerated/tensorflow/core/framework/reader_base_pb2.py | Python | mit | 3,909 |
"""
Tests that verify that the admin view loads.
This is not inside a django app because it is a global property of the system.
"""
from django.test import TestCase, Client
from django.urls import reverse
from student.tests.factories import UserFactory, TEST_PASSWORD
from openedx.core.djangoapps.user_authn.views.logi... | cpennington/edx-platform | openedx/core/tests/test_admin_view.py | Python | agpl-3.0 | 1,689 |
# Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/adamatch | shared/train.py | Python | apache-2.0 | 5,855 |
import numpy as np
import matplotlib.pyplot as plt
import math
count_hubs = 3
results_1 = np.array([5, 6, 5, 6, 7, 5, 4, 5, 5, 5])
results_2 = np.array([5, 5, 4, 4, 5, 6, 5, 4, 4, 5])
results_3 = np.array([4, 5, 4, 4, 3, 4, 4, 3, 5, 4])
data = np.array([results_1, results_2, results_3])
for array in data:
print... | mauzeh/formation-flight | sandbox/plot_mean_sigma.py | Python | mit | 796 |
from PySide2.QtCore import QObject, Signal
from cmri.trajectory.generator import Generator
class QGenerator(Generator, QObject):
generated = Signal(dict)
def __init__(self):
super().__init__()
QObject.__init__(self)
self.auto_update = True
def generate(self):
... | nio1814/MRItrajectory | python/cmri/designer/trajectory/generator.py | Python | bsd-3-clause | 1,124 |
#!/usr/bin/python
import sys
import re
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
if len(sys.argv) != 2:
print 'Hand over a file as a first argument.'
sys.... | angajime/pylex | pylex.py | Python | mit | 961 |
import numpy as np
import pandas as pd
from skan import io
from skimage._shared._tempfile import temporary_file
def test_write_excel_tables():
num_sheets = np.random.randint(1, 4)
num_cols = np.random.randint(1, 5, size=num_sheets)
num_rows = np.random.randint(20, 40, size=num_sheets)
tables = []
... | jni/skan | src/skan/test/test_io.py | Python | bsd-3-clause | 1,558 |
import pytest
import openpnm as op
from openpnm.models.physics import source_terms
from numpy.testing import assert_allclose
import copy
class ReactiveTransportTest:
def setup_class(self):
self.net = op.network.Cubic(shape=[4, 4, 4])
self.geo = op.geometry.GenericGeometry(
network=sel... | PMEAL/OpenPNM | tests/unit/algorithms/ReactiveTransportTest.py | Python | mit | 11,928 |
def abs(x):
if x < 0:
return -x
else:
return x
| safl/chplforpyp-docs | docs/source/examples/func_decl.py | Python | apache-2.0 | 71 |
#!/usr/bin/python
import os, sys # low level handling, such as command line stuff
import string # string methods available
import re # regular expressions
import getopt # comand line argument handling
from low import * # custom functions, written by myself
from collections import defaultdict
im... | lotharwissler/bioinformatics | python/generic/add-basename-as-first-col.py | Python | mit | 2,589 |
from datetime import datetime
import pytz
from django.test import TestCase
from django.conf import settings
from django.test.client import RequestFactory
from django.contrib.auth.models import AnonymousUser
from django.utils import timezone
from django.utils.importlib import import_module
from django.contrib.auth.mode... | jamesmfriedman/django-easytz | easytz/tests.py | Python | apache-2.0 | 2,995 |
from django.contrib.auth.models import User
from django.db import models
POINT_CHOICES = (
(-1, -1),
(0, 0),
(1, 1),
)
class Debate(models.Model):
title = models.CharField(max_length = 200)
summary = models.TextField() #not for the first entry! just a summary, please
pub_date = models.DateTi... | SnacksOnAPlane/debately | models.py | Python | bsd-3-clause | 5,063 |
"""Constant class and associated."""
# --- import --------------------------------------------------------------------------------------
import numpy as np
from ._axis import Axis
from .. import units as wt_units
# --- define --------------------------------------------------------------------------------------
... | wright-group/WrightTools | WrightTools/data/_constant.py | Python | mit | 2,826 |
#!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_mopak_o_dcl
@file marine-integrations/mi/dataset/parser/test/test_mopak_o_dcl.py
@author Emily Hahn
@brief Test code for a mopak_o_dcl data parser
"""
import ntplib
import struct
import os
from datetime import datetime
import time
from nose.pl... | ooici/marine-integrations | mi/dataset/parser/test/test_mopak_o_dcl.py | Python | bsd-2-clause | 28,907 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess, json
# Using python pipe(sh)
def run_command(command):
try:
output = subprocess.check_output(command, shell=True).splitlines()
except subprocess.CalledProcessError as e:
output = ["아이디를확인해주십시오 데이터가존재하지않습니다".encode()]
return outpu... | Cazen/oozieslackbot | action/commonUtil.py | Python | mit | 869 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.tests.utils.package_tester import PackageTester
PackageTester().run_all_tests_for_package('randstad') | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/randstad/tests/all_tests.py | Python | gpl-2.0 | 243 |
#!/usr/bin/env python
# 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
# "L... | szha/mxnet | python/mxnet/numpy_extension/__init__.py | Python | apache-2.0 | 1,477 |
def theme(context):
# CMake theme:
# actions performing in cyan
performing="cyan"
# actions performed in green
performed="green"
# actions taking an unknown time
untimed="blue"
# If the user do not ask for his own colormap
if not context["user_defined_colormaps"]:
# A pa... | nojhan/colout | colout/colout_cmake.py | Python | gpl-3.0 | 2,098 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-18 01:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stardate', '0007_auto_20160323_0203'),
]
operations = [
migrations.AddField(... | blturner/django-stardate | stardate/migrations/0008_blog_sync.py | Python | bsd-3-clause | 447 |
import numpy as np
import chess_ai_defs as ai
import time
from random import randrange
from multiprocessing import Pool
from threading import Lock
#globals/constants for use in the methods
MAX_DEPTH = 4 #best I've got so far (target is ~8-10) (real AI use ~12-14)
MAX_THREADS = 2 #number of threads to run, optimal valu... | ufieeehw/IEEE2015 | python/Chess/chessAI.py | Python | gpl-2.0 | 19,300 |
# -*- test-case-name: twisted.internet.test.test_inotify -*-
# Copyright (c) 2008-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This module provides support for Twisted to linux inotify API.
In order to use this support, simply do the following (and start a reactor
at some point)::
from twiste... | eunchong/build | third_party/twisted_10_2/twisted/internet/inotify.py | Python | bsd-3-clause | 13,540 |
# This file is Copyright (c) 2010 by the GPSD project
# BSD terms apply: see the file COPYING in the distribution root for details.
"""
gpsfake.py -- classes for creating a controlled test environment around gpsd.
The gpsfake(1) regression tester shipped with gpsd is a trivial wrapper
around this code. For a more int... | vyacht/carambola | package/vy-gpsd/src/gps/fake.py | Python | gpl-2.0 | 24,400 |
# coding=utf-8
"""
Test unit, using simple graph made in BPMNEditor editor for import/export operation
"""
import os
import unittest
import bpmn_python.bpmn_diagram_visualizer as visualizer
import graph.bpmn_diagram_rep as diagram
class BPMNEditorTests(unittest.TestCase):
"""
This class contains test for bpm... | krisss2121/bpmn-python | tests/xml_import_export/bpmn_editor_import_test.py | Python | gpl-3.0 | 2,218 |
# coding: utf-8
from __future__ import unicode_literals
from collections import OrderedDict
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.core.urlresolvers import (
NoReverseMatch, Resolver404, get_script_prefix, resolve
)
from django.db.models import Manager
from django.... | saukrIppl/seahub | thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/relations.py | Python | apache-2.0 | 18,087 |
# author David Sanchez david.sanchez@lapp.in2p3.fr
# ------ Imports --------------- #
import numpy
from Plot.PlotLibrary import *
from Catalog.ReadFermiCatalog import *
from environ import FERMI_CATALOG_DIR
# ------------------------------ #
#look for this 2FGL source
source = "2FGL J1015.1+4925"
#source = "1FHL J2158... | qpiel/python_estimation_source | Example/ExReadFermiCatalog.py | Python | gpl-3.0 | 1,737 |
from flask import Flask
from flask_bootstrap import Bootstrap
from flask_mail import Mail
from flask_moment import Moment
from flask_sqlalchemy import SQLAlchemy
from config import config
import chartkick
bootstrap = Bootstrap()
mail = Mail()
moment = Moment()
db = SQLAlchemy()
def create_app(config_name):
app ... | ASaiun/saiun_bysj | app/__init__.py | Python | apache-2.0 | 785 |
#!/usr/local/bin/python3.3
X = [1, 2, 3]
L = ['a', X, 'b']
D = {'x': X, 'y': 2}
X[1] = 'surprise'
print(X)
print(L)
print(D)
L = [1, 2, 3]
D = {'a': 1, 'b': 2}
A = L[:]
B = D.copy()
A[1] = 'Ni!'
B['c'] = 'spam'
print(A)
print(B)
print(L)
print(D)
L1 = [1, ('a', 3)]
L2 = [1, ('a', 3)]
print(L1 == L2)
print(L1 is L2... | eroicaleo/LearningPython | ch09/CoreType.py | Python | mit | 570 |
import unittest
import libpipe
from unittest.mock import patch, Mock
from libpipe.cmds.base import BaseCmd
import logging
from remsci.lib.utility import customLogging
customLogging.config()
log = logging.getLogger(__name__)
class CmdSample(BaseCmd):
NAME = 'tmp'
INVOKE_STR = 'tmp'
ARGUMENTS = [
... | muppetjones/rempipe | tests/cmds/test_base.py | Python | gpl-3.0 | 13,987 |
# Copyright 2013 OpenStack Foundation
# Copyright 2013 Red Hat, 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... | UTSA-ICS/keystone-SID | keystone/common/sql/migration_helpers.py | Python | apache-2.0 | 5,973 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | fajoy/nova | nova/cert/manager.py | Python | apache-2.0 | 2,453 |
# -*- coding: utf-8 -*-
"""
werkzeug.debug
~~~~~~~~~~~~~~
WSGI application traceback debugger.
:copyright: (c) 2010 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import mimetypes
from os.path import join, dirname, basename, isfile
from werkzeu... | calvinchengx/O-Kay-Blog-wih-Kay-0.10.0 | kay/lib/werkzeug/debug/__init__.py | Python | bsd-3-clause | 7,032 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [Extension('clpt_donnell_bc1_nonlinear',
['clpt_donnell_bc1_nonlinear.pyx'],
extra_compile_args=['/openmp',
'/O2', '/favor:INTEL64'... | albertoferna/compmech | compmech/conecyl/clpt/setup_clpt_donnell_bc1_nonlinear.py | Python | bsd-3-clause | 521 |
import os
import inspect
import uuid
import importlib.machinery
################################################################################
# There's a lot of extra book-keeping in some areas to work around the fact that
# Python <3.4 don't consistently provide __file__ as an absolute path.
#
# Specificall... | fifoforlifo/pynja | packages/pynja/root_paths.py | Python | apache-2.0 | 5,874 |
# -*- coding: utf-8 -*-
"""
DEPRECATED: These tests are not up-to-date to with the new API since 0.8, they should be removed.
"""
import os
os.environ['DJANGO_SETTINGS_MODULE'] = "project.settings_development"
#from django.test import TestCase
import unittest
from django.core.urlresolvers import reverse
from djangoc... | cible/djangocodemirror | djangocodemirror/tests.py | Python | mit | 8,221 |
import logging
from six import string_types
from cubepress.model.filter import Filter
from cubepress.model.util import valid_name
log = logging.getLogger(__name__)
class Level(object):
def __init__(self, hierarchy, parent, index, spec):
self.hierarchy = hierarchy
self.model = self.hierarchy.pro... | openspending/cubepress | cubepress/model/hierarchy.py | Python | mit | 2,880 |
# -*- coding: utf-8 -*-
"""
Protocol implementation for `Tokyo Tyrant <http://1978th.net/tokyotyrant/>`_.
Let's assume some defaults for our sandbox::
>>> TEST_HOST = '127.0.0.1'
>>> TEST_PORT = 1983 # default port is 1978
"""
import math
import socket
import struct
import exceptions
# Pyrant constant... | Reflejo/pyrant | pyrant/protocol.py | Python | apache-2.0 | 22,370 |
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... | indykish/servo | python/tidy.py | Python | mpl-2.0 | 4,530 |
# -*- coding: utf-8 -*-
# gthnk (c) Ian Dennis Miller
import os
import flask
import logging
from flaskext.markdown import Markdown
from mdx_linkify.mdx_linkify import LinkifyExtension
from mdx_journal import JournalExtension
from . import db, login_manager, bcrypt
from .models.day import Day
from .models.entry impo... | iandennismiller/gthnk | src/gthnk/server.py | Python | mit | 1,615 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import math
import os
import random
import zipfile
import tensorflow as tf
import numpy as np
from six.moves import urllib
from six.moves import xrange
url = 'http://mattmahoney.net/dc/'
#... | najeeb97khan/Tensorflow-CS20SI | Embeddings/embeddings_data.py | Python | mit | 2,980 |
# hammertime: A high-volume http fetch library
# Copyright (C) 2016- Delve Labs inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License.
#
# This program is dis... | delvelabs/hammertime | tests/kb_test.py | Python | gpl-2.0 | 1,628 |
"""Kernel Canonical Correlation Analysis (KCCA)"""
# Author: Huibin Shen <icdishb@gmail.com>
# License: BSD 3 clause
import cmath
import warnings
import numpy as np
from scipy import linalg
from ..utils import check_array, check_consistent_length
from ..utils.arpack import eigsh
from ..base import BaseEstimator
from... | icdishb/scikit-learn | sklearn/cross_decomposition/kernel_cca.py | Python | bsd-3-clause | 16,112 |
LANG_TEXT = {'en_EN': {'tr_TR': 'Turkish',
'fr_FR': 'French',
'fi_FI': 'Finnish',
'pt_PT': 'Portuguese',
'fy_x-FY': 'Frisian',
'it_IT': 'Italian',
'et_EE': 'Estonian',
'no_NO': 'Norwegian',
'nl_NL': 'Dutch',
'lv_LV': 'Lat... | kingvuplus/ts-gui-3 | lib/python/Components/language_cache.py | Python | gpl-2.0 | 50,254 |
"""PYTHON WRAPPER
Helper module for writing python wrappers for communications with
python.
"""
from excentury.command import trace, date
from excentury.lang import write_file
def _format_help(func):
"""Generate the help string for python functions. """
msg = func.doc
if func.param:
msg += '\n\... | jmlopez-rod/excentury | excentury/lang/python/python_writer.py | Python | bsd-2-clause | 4,072 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014, 2015 CERN.
#
# INSPIRE 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... | jalavik/inspire-next | inspire/modules/authors/workflows/authornew.py | Python | gpl-2.0 | 4,354 |
"""
Some fixture methods
"""
import os
import pytest
import rstview
from rstview import parser
class FixturesStorageParameters(object):
"""Mixin containing some basic settings"""
def __init__(self):
# Base fixture datas directory
self.tests_dir = 'project_test/tests'
self.fixtures_dir ... | sveetch/rstview | project_test/tests/conftest.py | Python | mit | 1,054 |
from django.contrib.auth import login, REDIRECT_FIELD_NAME
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt, csrf_protect
from django.views.decorators.http import require_POST
from social.actions import do_auth, do_complete, do_disconnect
from social.apps.d... | gquirozbogner/contentbox-master | third_party/social/apps/django_app/views.py | Python | apache-2.0 | 1,889 |
from core import send_request
from people import get_me
from projects import get_all_active_projects, get_project
from todo_lists import get_todo_list, get_todo, get_all_active_todo_lists
from stars import get_starred_projects
try:
from MY_BC import BC
except ImportError:
from core import MY_BC_NUMBER as BC
cl... | jstacoder/basehead | basehead/basecamp.py | Python | bsd-3-clause | 4,557 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2019-01-08 15:42
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('organization', '0019_auto_20190107_1423'),
]
operations = [
migrations.RemoveField(
model_name='organization',... | MuckRock/muckrock | muckrock/organization/migrations/0020_remove_organization_plan.py | Python | agpl-3.0 | 363 |
import unittest
class TestInject(unittest.TestCase):
def test_assign_injectables(self):
class WithInjectableConstructor(object):
def __init__(self, foo, bar):
from inject import assign_injectables
assign_injectables(self, locals())
foo = 'foo'
bar = 'bar'
under_test = WithInje... | rahulraj/Python-Utils | inject_test.py | Python | mit | 619 |
"""
[2015-03-32] Challenge 208 [Bonus] The Infinite Stallman Theorem
https://www.reddit.com/r/dailyprogrammer/comments/310525/20150332_challenge_208_bonus_the_infinite/
# [](#BonusIcon) _(Bonus)_: The Infinite Stallman Theorem
Loosely, the [*infinite monkey theorem*](http://en.wikipedia.org/wiki/Infinite_monkey_theor... | DayGitH/Python-Challenges | DailyProgrammer/DP20150332.py | Python | mit | 2,518 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import warnings
from pyasn1.codec.der import decoder, encoder
from pyasn... | Ayrx/cryptography | src/cryptography/hazmat/primitives/asymmetric/utils.py | Python | bsd-3-clause | 1,991 |
from scrapy import Spider
from scrapy.http import Request
from firmware.items import FirmwareImage
from firmware.loader import FirmwareLoader
class FoscamSpider(Spider):
name = "foscam"
allowed_domains = ["foscam.com"]
start_urls = [
"http://www.foscam.com/download-center/firmware-downloads.html"]... | firmadyne/scraper | firmware/spiders/foscam.py | Python | mit | 1,854 |
r"""
This module contains :py:meth:`~sympy.solvers.ode.dsolve` and different helper
functions that it uses.
:py:meth:`~sympy.solvers.ode.dsolve` solves ordinary differential equations.
See the docstring on the various functions for their uses. Note that partial
differential equations support is in ``pde.py``. Note t... | grevutiu-gabriel/sympy | sympy/solvers/ode.py | Python | bsd-3-clause | 330,846 |
def test_fake():
# fake test to pass py.test
assert True
| quantz-nl/pypeline | tests/test_fake.py | Python | gpl-3.0 | 66 |
import os
from setuptools import setup
from virtualmethod import __version__
def main():
cwd = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(cwd, 'README.txt')
readme = open(path, 'rb').read()
setup(
name = 'virtualmethod',
version = __version__,
description =... | bgreenlee/virtualmethod | setup.py | Python | apache-2.0 | 1,301 |
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.contrib.auth.forms import AuthenticationForm
from oscar.core.application import (
DashboardApplication as BaseDashboardApplication)
from oscar.core.loading import get_class
class DashboardApplication(BaseDashboardApp... | sonofatailor/django-oscar | src/oscar/apps/dashboard/app.py | Python | bsd-3-clause | 2,615 |
import unittest
import textwrap
import re
from rdp import GrammarBuilder, flatten, drop, epsilon, repeat, Terminal, Regexp, Parser, epsilon, Optional, ignore
from rdp.formatter import GrammarFormatter
from rdp import builtins
from rdp.indention import indent, INDENT, DEDENT
class TokenizerTest(unittest.TestCase):
... | emulbreh/rdp | rdp/tests/test_tokenizer.py | Python | mit | 1,849 |
"""
Various functions to dynamically import (abitrary names from) arbitrary files.
To import a file like it is a module, use `import_file`.
"""
from sys import version_info
def import_file(name, file):
"""
Import `file` as a module with _name_.
Raises an ImportError if it could not be imported.
"""... | ErwinJanssen/dymport.py | dymport/import_file.py | Python | mit | 1,209 |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
class JID(object):
"""
A representation of a Jabber ID, or JID.
Each JID may have three components: a user, a domain, and an optio... | skinkie/SleekXMPP--XEP-0080- | sleekxmpp/xmlstream/jid.py | Python | mit | 3,980 |
# -*- coding: utf-8 -*-
""" Python implementations of auxiliary pseudo-marginal MCMC samplers. """
__authors__ = 'Matt Graham'
__copyright__ = 'Copyright 2015, Matt Graham'
__license__ = 'MIT'
| matt-graham/auxiliary-pm-mcmc | auxpm/__init__.py | Python | mit | 194 |
"""
Lidar
"""
import time
import numpy as np
class RPLidar():
def __init__(self, port='/dev/ttyUSB0'):
from rplidar import RPLidar
self.port = port
self.frame = np.zeros(shape=365)
self.lidar = RPLidar(self.port)
self.lidar.clear_input()
time.sleep(1... | ricorx7/donkey | donkeycar/parts/sensors/lidar.py | Python | mit | 727 |
def _RELIC__word_list_prep():
file = open('stopwords.txt')
new_file = open('stopwords_new.txt', 'w')
for line in file:
if line.strip():
new_file.write(line)
file.close()
new_file.close()
| rapidclock/naive-bayes-classifier | rtml/utils/file_stripper.py | Python | mit | 200 |
# 2014-12-18
# build by qianqians
# deletenonespacelstrip
def deleteNoneSpacelstrip(str):
while(str.lstrip('\n') is not str):str = str.lstrip('\n')
while(str.lstrip('\t') is not str):str = str.lstrip('\t')
while(str.lstrip('\0') is not str):str = str.lstrip('\0')
while(str.lstrip('\n') is not str):str ... | yinchunlong/abelkhan-1 | juggle/parser/deletenonespacelstrip.py | Python | mit | 843 |
# -*- coding: utf-8 -*-
## Photini - a simple photo metadata editor.
## http://github.com/jim-easterbrook/Photini
## Copyright (C) 2012-22 Jim Easterbrook jim@jim-easterbrook.me.uk
##
## This program is free software: you can redistribute it and/or
## modify it under the terms of the GNU General Public License a... | jim-easterbrook/Photini | src/photini/technical.py | Python | gpl-3.0 | 46,176 |
#Author - Evan Leister
import vesa_reading_functions as vr
from subprocess import call
import sys
from time import time, clock
import glob
def move_files(fmt, sim_title):
print ('moving all ' + fmt + ' files to the directory ' + sim_title)
movestring = "cp " + "*" + fmt + " " + sim_title
call(movestring, s... | evanl/comparison_scripts | vesa_output_read.py | Python | mit | 2,487 |
# Run a test server at localhost:8080
from app import app
app.run(host='0.0.0.0', port=8080, debug=True)
| devcenter-square/states-cities | run.py | Python | mit | 105 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import six
from . import util
class Graph(object):
"""
Manages a single "line" in the resulting plo... | cpcloud/asv | asv/graph.py | Python | bsd-3-clause | 2,643 |
# Copyright 2016 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... | laosiaudi/tensorflow | tensorflow/contrib/metrics/python/ops/metric_ops_test.py | Python | apache-2.0 | 181,769 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-data-qna | google/cloud/dataqna_v1alpha/services/question_service/__init__.py | Python | apache-2.0 | 773 |
range = xrange; input = raw_input
for _ in range(int(input())):
print((lambda x, y: x + y)(*map(int, input().split())))
| knuu/competitive-programming | atcoder/other/tkppc_2015_a.py | Python | mit | 124 |
import http.client
import os
import shutil
import json
def inputDepot():
srv = input("Entrez l'addresse du serveur (sans le http://)(d pour utiliser le serveur minecraft.zgalaxy.fr) : ")
if srv == "d":
return ("minecraft.zgalaxy.fr", "/")
srv = srv.split("/")
serveur = ""
dossier = "/"
if len(srv) == 1:
serv... | zyuiop/McModInstaller | functions.py | Python | gpl-3.0 | 473 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | sharoonthomas/babel | babel/messages/tests/catalog.py | Python | bsd-3-clause | 12,785 |
#!/usr/bin/env python3
# Update plural forms expressions from the data collected by Unicode Consortium
# (see http://www.unicode.org/cldr/charts/supplemental/language_plural_rules.html),
# but from a JSON version by Transifex folks
import os.path
import sys
import urllib.request
import re
import gettext
import json
i... | vslavik/poedit | scripts/extract-fileviewer-mappings.py | Python | mit | 3,349 |
from bs4 import BeautifulSoup
from couchpotato.core.helpers.encoding import tryUrlencode, toUnicode
from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.torrent.base import TorrentProvider
import traceback
log = CPLog(__name__)
class BiTHDTV(To... | hamiltont/CouchPotatoServer | couchpotato/core/providers/torrent/bithdtv/main.py | Python | gpl-3.0 | 3,222 |
"""
test core resource system
"""
from rez.tests.util import TestBase
from rez.utils.resources import Resource, ResourcePool, ResourceHandle, \
ResourceWrapper
from rez.utils.schema import Required
from rez.exceptions import ResourceError
import rez.vendor.unittest2 as unittest
from rez.vendor.schema.schema import ... | rsjohnco/rez | src/rez/tests/test_resources_.py | Python | gpl-3.0 | 9,241 |
# Copyright 2012, 2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Node objects."""
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
str = None
__metaclass__ = type
__all__ = [
"NODE_TRA... | cloudbase/maas | src/maasserver/models/node.py | Python | agpl-3.0 | 32,077 |
'''
Copyright (C) 2015 Stanislavs Rubens (starub_at_protonmail_dot_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) any later version.
This p... | starub/tuna | dao/base_dao.py | Python | gpl-2.0 | 1,074 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.