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 .class_exec_interface import ClassExecInterface
from .container_ability_interface import ContainerAbilityInterface
| SF-Zhou/quite | quite/gui/interfaces/ability_interfaces/__init__.py | Python | mit | 120 |
from datetime import datetime
from django.shortcuts import resolve_url as r
from django.test import TestCase
from eventex.subscriptions.models import Subscription
class SubscriptionModelTest(TestCase):
def setUp(self):
self.obj = Subscription(
name='Raffael Tancman',
cpf= '12345678... | rtancman/eventex | eventex/subscriptions/tests/test_model_subscription.py | Python | gpl-2.0 | 1,074 |
import collections
import itertools
import logging
import pykka
import mopidy
from mopidy import audio, backend, mixer
from mopidy.audio import PlaybackState
from mopidy.core.history import HistoryController
from mopidy.core.library import LibraryController
from mopidy.core.listener import CoreListener
from mopidy.co... | jcass77/mopidy | mopidy/core/actor.py | Python | apache-2.0 | 9,855 |
from django.http import HttpRequest, HttpResponseForbidden, HttpResponseNotAllowed
from django.template.response import TemplateResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework import status
from trashnetwork import admin_site, settings
from trashnetwork.util import view_utils
from dja... | TrashNetwork/trashnetwork-web | trashnetwork/view/admin/push_console.py | Python | gpl-3.0 | 2,150 |
#!/usr/bin/python
# Ubuntu Tweak - PyGTK based desktop configure tool
#
# Copyright (C) 2007-2008 TualatriX <tualatrix@gmail.com>
#
# Ubuntu Tweak 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 versio... | tualatrix/ubuntu-tweak-old | src/installer.py | Python | gpl-2.0 | 12,785 |
from tensorflow_recommenders_addons.embedding_variable.python.ops.embedding_variable_ops import *
from tensorflow_recommenders_addons.embedding_variable.python.ops.embedding_variable import *
from tensorflow_recommenders_addons.embedding_variable.python.optimizers.gradient_descent import *
from tensorflow_recommenders_... | tensorflow/recommenders-addons | tensorflow_recommenders_addons/embedding_variable/__init__.py | Python | apache-2.0 | 468 |
from __future__ import absolute_import
from typing import Any, Dict, List, Set, Tuple, TypeVar, Text, \
Union, Optional, Sequence, AbstractSet, Pattern, AnyStr
from typing.re import Match
from zerver.lib.str_utils import NonBinaryStr
from django.db import models
from django.db.models.query import QuerySet
from dja... | peguin40/zulip | zerver/models.py | Python | apache-2.0 | 56,005 |
#!/usr/bin/env python
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
requires = [
'mease==0.2.0',
]
setup(
name='django-mease',
version='0.2.0',
description="django-mease: Websocket integration made easy for Django",
... | florianpaquet/django-mease | setup.py | Python | mit | 1,103 |
import logging
FORMAT = '%(asctime)s:%(levelname)s:%(module)s.%(funcName)s:%(message)s'
logging.basicConfig(format=FORMAT, level=logging.INFO, datefmt='%H:%M:%S')
logger = logging.getLogger('yatsm')
| jmorton/yatsm | yatsm/log_yatsm.py | Python | mit | 200 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import xbmcgui
import xbmcplugin
import os
import xbmcaddon
import sys
import datetime
def addImageLink(name,url):
addon = xbmcaddon.Addon(id='plugin.image.icm')
iconimage=os.path.join(addon.getAddonInfo('path'),"icon.png")
liz=xbmcgui.ListItem(unicode(name), icon... | skudi/plugin.image.icm | addon.py | Python | gpl-2.0 | 1,450 |
from flask import Flask, flash, redirect, render_template, request, session, abort
from random import randint
import json
import schedule
import time
import pandas as pd
import numpy as np
from fbprophet import Prophet
import quandl
import matplotlib.pyplot as plt
import litecoinQuandl3
import bitcoinQuandl
app = Fla... | Virginia-Woolf-Squadron/Woolfey | server/python/index.py | Python | mit | 712 |
# Copyright 2017 Google Inc. / Arup
#
# 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 wr... | arupiot/deskcontrol | deskcontrol/modules/mqtt_module.py | Python | mit | 4,057 |
#!/usr/bin/env python3
"""
>>> baralho = Baralho()
>>> len(baralho)
52
>>> baralho[0]
Carta(valor='2', naipe='paus')
>>> baralho[-1]
Carta(valor='A', naipe='espadas')
>>> from random import choice
>>> choice(baralho) #doctest:+SKIP
Carta(valor='4', naipe='paus')
... | pythonprobr/notmagic | pt-br/baralho_mut.py | Python | mit | 4,149 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | rabipanda/tensorflow | tensorflow/contrib/py2tf/impl/naming_test.py | Python | apache-2.0 | 2,895 |
"""
class acting as a batch container.
implements the iterable interface
"""
import logging
logger = logging.getLogger(__name__)
class Batch:
def __init__(self, data, expected, mini_batch_size=-1):
self.data = data
self.expected = expected
if mini_batch_size == -1 or mini_batch_size > l... | mirkobronzi/ml-code | ml_code/batch/batch_handler.py | Python | apache-2.0 | 983 |
import unittest
from unittest.mock import Mock, patch, mock_open
from io import StringIO
from vasppy.poscar import Poscar
from vasppy.cell import Cell
import numpy as np
from collections import Counter
class PoscarTestCase( unittest.TestCase ):
def setUp( self ):
self.poscar = Poscar()
self.posca... | bjmorgan/vasppy | tests/test_poscar.py | Python | mit | 1,671 |
import sys
script, user_name = sys.argv
prompt = '>'
print 'Hi %s, I am %s \nSome quick Q\'s' % (user_name, script)
likes = raw_input("what are your likes" + prompt)
lives = raw_input("where do you live" + prompt)
compu = raw_input("what computer do you have" + prompt)
print 'typed the following %s, %s, %s' % (like... | vanonselenp/Learning | Python/LPTHW/ex14.py | Python | mit | 337 |
def agts(queue):
a = queue.add('dcdft_gpaw.py', ncpus=4, walltime=20)
queue.add('testdb.py', deps=a, ncpus=1, walltime=5)
queue.add('extract.py dcdft.db', deps=a, ncpus=1, walltime=5,
creates='exercise_dcdft.db_raw.txt')
| robwarm/gpaw-symm | doc/exercises/dcdft/submit.agts.py | Python | gpl-3.0 | 248 |
import os
from multiprocessing import Process
from Tribler.Core.Modules.process_checker import ProcessChecker, LOCK_FILE_NAME
from Tribler.Test.test_as_server import AbstractServer
def process_func():
while True:
pass
class TestProcessChecker(AbstractServer):
def tearDown(self, annotate=True):
... | MaxVanDeursen/tribler | Tribler/Test/Core/Modules/test_process_checker.py | Python | lgpl-3.0 | 2,323 |
# Time: O(n)
# Space: O(1)
#
# Given an array of n positive integers and a positive integer s,
# find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 0 instead.
#
# For example, given the array [2,3,1,2,4,3] and s = 7,
# the subarray [4,3] has the minimal length under the problem con... | yiwen-luo/LeetCode | Python/minimum-size-subarray-sum.py | Python | mit | 2,021 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-31 20:30
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import djangopypi2.apps.pypi_packages.models
class Migration(migrations.Migration):
initial ... | popen2/djangopypi2 | djangopypi2/apps/pypi_packages/migrations/0001_initial.py | Python | bsd-3-clause | 6,047 |
# shipHybridTrackingCD2
#
# Used by:
# Ship: Cormorant
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Small Hybrid Turret"),
"trackingSpeed", ship.getModifiedItemAttr("shipBonusCD2"), skill="Caldari Destroyer")
| Ebag333/Pyfa | eos/effects/shiphybridtrackingcd2.py | Python | gpl-3.0 | 320 |
# Python stubs generated by omniidl from example_echo.idl
import omniORB, _omnipy
from omniORB import CORBA, PortableServer
_0_CORBA = CORBA
_omnipy.checkVersion(3,0, __file__)
#
# Start of module "Example"
#
__name__ = "Example"
_0_Example = omniORB.openModule("Example", r"example_echo.idl")
_0_Example__POA = omni... | aayvazyan-tgm/CORBA | Python_Client/example_echo_idl.py | Python | apache-2.0 | 2,022 |
import re
list_re = re.compile(r'\((.*)\) \"(.*)\" \"(.*)\"')
class Response(object):
# There are three possible server completion responses
OK = "OK" # indicates success
NO = "NO" # indicates failure
BAD = "BAD" # indicates a protocol error
class ListResponse(object):
def __init__(self, li... | clara-labs/imaplib3 | imaplib3/response.py | Python | mit | 513 |
# 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 hope that it will be useful,
# bu... | fracpete/python-weka-wrapper3 | python/weka/flow/__init__.py | Python | gpl-3.0 | 804 |
# Copyright 2013 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.
import json
import logging
import socket
import sys
import time
from telemetry.core import bitmap
from telemetry.core import exceptions
from telemetry.core i... | mkaluza/external_chromium_org | tools/telemetry/telemetry/core/backends/chrome/inspector_backend.py | Python | bsd-3-clause | 11,399 |
#!/usr/bin/env python
import os
import xml.etree.ElementTree as ET
from os.path import join, dirname, exists
from os import makedirs
import zipfile
import xml_to_html
from os.path import expanduser
def main(toc_path, output_path):
tree = ET.parse(join(toc_path, "TOC.xml"))
root = tree.getroot()
#output file
... | hasadna/OpenPress | engine/sitemap-generator/toc_list.py | Python | mit | 1,457 |
#!/usr/bin/env python
""" Fix sphinx latex output for longtable
"""
import re
import sys
lt_LL = re.compile(
r"longtable}{(L+)}")
def replacer(match):
args = '|' + 'l|' * len(match.groups()[0])
return "longtable}{%s}" % args
if len(sys.argv) != 2:
raise RuntimeError("Enter path to tex file only")
f... | bthirion/nipy | tools/fix_longtable.py | Python | bsd-3-clause | 518 |
#
# Copyright 2017 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 ve... | miurahr/translate | translate/convert/yaml2po.py | Python | gpl-2.0 | 4,458 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# @name: Wascan - Web Application Scanner
# @repo: https://github.com/m4ll0k/Wascan
# @author: Momo Outaadi (M4ll0k)
# @license: See the file 'LICENSE.txt
from re import search,I
def sonicwall(headers,content):
_ = False
_ |= search(r"This request is blocked b... | m4ll0k/Spaghetti | plugins/fingerprint/waf/sonicwall.py | Python | gpl-3.0 | 501 |
from os import makedirs
from os.path import exists, join, abspath
import tempfile
import pytest
from dvt.cli import run_cli
class TestCli:
def test_help(self):
run_cli()
run_cli(["python"])
with pytest.raises(SystemExit):
run_cli(["python", "video-viz", "-h"])
with ... | statsmaths/dtv-toolkit | tests/test_cli.py | Python | gpl-3.0 | 1,267 |
# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistrib... | AVOXI/b2bua | sippy/SipExpires.py | Python | bsd-2-clause | 1,632 |
import platform
from setuptools import setup, find_packages
reqs = {
'Windows': ['pypiwin32', 'pyreadline'],
'Darwin': ['gnureadline']
}
setup(
name='vision',
version='0.11.15',
packages=find_packages(),
# This requires selenium
install_requires = [
'selenium==2.53.6',
'pi... | mieweb/vision | setup.py | Python | mit | 783 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Largest product in a grid
Problem 11
In the 20×20 grid below, four numbers along a diagonal
line have been marked in red.
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 ... | Ladeia/ProjectEuler | Problem011/Python/solution_1.py | Python | mit | 4,243 |
# A comment, this is so you can read your program later.
# Anything after the # is ignored by python.
print("I could have code like this.") # and the comment after is ignored
# You can also use a comment to "disable" or comment out a piece of code:
# print "This won't run."
print("This will run.") | Oreder/PythonSelfStudy | Exe_02.py | Python | mit | 302 |
from flask.ext.admin import BaseView, expose
from flask.ext.admin.contrib.sqla import ModelView
from flask.ext.admin.contrib.fileadmin import FileAdmin
from flask.ext.login import login_required, current_user
from webapp.extensions import admin_permission
from webapp.forms import CKTextAreaField
class CustomView(Bas... | nikitabrazhnik/flask2 | Module 3/Chapter13/Chapter 13/webapp/controllers/admin.py | Python | mit | 1,199 |
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import datetime
import hashlib
import struct
from asn1crypto.x509 import Certificate
from .._ffi import (
array_from_pointer,
buffer_from_bytes,
bytes_from_buffer,
cast,
deref,
is_null,
new,... | igor-rangel7l/igorrangel.repository | plugin.video.SportsDevil/service/oscrypto/_win/trust_list.py | Python | gpl-2.0 | 7,953 |
# -*- coding: utf-8 -*-
import os
import shutil
from sh import git
from mock import patch, PropertyMock
from django.test import TestCase
from django.core.urlresolvers import reverse
from waliki.models import Page
from waliki.git import Git
from waliki.settings import WALIKI_DATA_DIR, WALIKI_COMMITTER_EMAIL, WALIKI_COMM... | beres/waliki | tests/test_git.py | Python | bsd-3-clause | 14,590 |
import unittest
from collections import Counter
def isPermutePalindrome(string):
isEven = not len(string) % 2
cnt = Counter(string)
if isEven:
return reduce(lambda x, y: x and y % 2 == 0 , cnt.values(), True)
else:
# only one count can be odd
odds = filter(lambda x: x % 2 != 0, cnt.values())
return len(od... | jackchi/util | python/recursion/isPermPalindrome.py | Python | mit | 817 |
import contextlib
import math
import re
import sys
import types
from functools import reduce
import numpy as N
import scipy.special as SS
day = 24 * 3600
year = 365.25 * day
def dot(*args):
return reduce(N.dot, args)
def _setuprednoise(pulsar, components=10):
t = pulsar.toas()
minx, maxx = N.min(t), N... | jellis18/libstempo | libstempo/like.py | Python | mit | 24,256 |
# Copyright (c) 2019 J. Alvarez-Jarreta and C.J. Brasher
#
# This file is part of the LipidFinder software tool and governed by the
# 'MIT License'. Please see the LICENSE file that should have been
# included as part of this software.
"""Set of methods focused on creating a summary of the dataset:
> create_summary... | cjbrasher/LipidFinder | LipidFinder/PeakFilter/Summary.py | Python | mit | 2,682 |
import shutil, os
from io import BufferedReader
from tempfile import TemporaryFile
from urllib.parse import urlparse
import boto3, botocore
class FileResourceService:
def __init__(self,base=None,directory='.',cleanup=True):
self.base = base
self.directory = directory
self.separator = '/' if self.d... | alexmilowski/duckpond | duckpond/apps/service/resources.py | Python | apache-2.0 | 4,136 |
import numpy as np
import pandas as pd
from qsweepy.ponyfiles.data_structures import *
def data_abs(meas):
for i in range(len(meas)):
meas[i]=meas[i]-np.median(np.real(meas[i]))-1j*np.median(np.imag(meas[i]))
return meas
def fq_coil(p,x):
frb, Cc, EJ1, EJ2, EC, phi0=p[:6]
L = p[-1]
return... | ooovector/qtlab_replacement | fitters/multiqubit_spectra.py | Python | gpl-3.0 | 21,138 |
#!/usr/bin/env python
from setuptools import setup, find_packages
import sys
extra_kwargs = {}
if sys.version_info >= (3,):
extra_kwargs['setup_requires'] = ['setuptools']
classifiers = [
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
... | mlq/python-taiga | setup.py | Python | mit | 1,085 |
#!/usr/bin/python
# coding: utf8
from upload import create_file_list
import exifread
import math
import pexif
import re
import datetime
import time
from bs4 import BeautifulSoup
from geojson import FeatureCollection, Feature, LineString, Point
import json
def utc_to_localtime(utc_time):
utc_offset_timedelta = da... | DenisCarriere/mapillary | mapillary/geotag.py | Python | mit | 6,563 |
# -*- coding: utf-8 -*-
from purchasing_test.test_base import BaseTestCase
from purchasing_test.util import insert_a_user, insert_a_role
from purchasing_test.factories import UserFactory
class TestAdmin(BaseTestCase):
render_templates = False
def setUp(self):
super(TestAdmin, self).setUp()
se... | codeforamerica/pittsburgh-purchasing-suite | purchasing_test/integration/admin/test_admin.py | Python | bsd-3-clause | 1,723 |
"""
Settings file for OpenSlides' tests
"""
import os
from openslides.global_settings import * # noqa
# Path to the directory for user specific data files
OPENSLIDES_USER_DATA_PATH = os.path.realpath(os.path.dirname(__file__))
# SECURITY WARNING: Keep the secret key used in production secret!
SECRET_KEY = 'secret... | rolandgeider/OpenSlides | tests/old/settings.py | Python | mit | 1,040 |
import os
DEBUG = True
BIND_TO_OUTSIDE_IP = False
BIND_TO_PORT = 8080
ROOT_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "app")
RESOURCES_PATH = os.path.join(ROOT_PATH, "resources")
BASE_TEMPLATE_PATH = os.path.join(ROOT_PATH, "views")
SESSION_PATH = os.path.join(ROOT_PATH, "sessions")
ENV = "dev"
... | adampresley/bottlepy-bootstrap | config.py | Python | mit | 1,277 |
from axiom.dependency import installOn
from axiom.scheduler import SubScheduler
from xquotient.mimestorage import IncomingMIMEMessageStorer
from axiom.test.historic.stubloader import saveStub
msg = """\
Received: from psmtp.com ([64.18.1.159] helo=psmtp.com)
by divmod.com with ESMTP (Quotient beta 28 (0.9.2+bu... | twisted/quotient | xquotient/test/historic/stub_message5to6.py | Python | mit | 2,332 |
from __future__ import absolute_import, division, print_function
import copy
import linecache
import sys
import threading
import uuid
import warnings
from operator import itemgetter
from . import _config, setters
from ._compat import (
PY2,
isclass,
iteritems,
metadata_proxy,
ordered_dict,
se... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/attr/_make.py | Python | gpl-3.0 | 84,133 |
"""
picture.py
Author: Brendan
Credit: Ethan Adner
Assignment:
Use the ggame library to "paint" a graphical picture of something (e.g. a house, a face or landscape).
Use at least:
1. Three different Color objects.
2. Ten different Sprite objects.
3. One (or more) RectangleAsset objects.
4. One (or more) CircleAsset ... | AverageNormalSchoolBoy/Picture | picture.py | Python | mit | 1,917 |
# -*- encoding: utf-8 -*-
from . import models
from . import controllers
| cgstudiomap/cgstudiomap | main/local_modules/frontend_base/__init__.py | Python | agpl-3.0 | 74 |
# Copyright 2015-2016, 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 of conditions and ... | VcamX/grpc | src/python/grpcio/grpc/framework/face/interfaces.py | Python | bsd-3-clause | 23,423 |
# Generated by Django 2.1.2 on 2018-10-14 19:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('travel', '0004_auto_20180306_1507'),
]
operations = [
migrations.CreateModel(
name='ExternalRef... | dakrauth/travel | src/travel/migrations/0005_auto_20181014_1923.py | Python | mit | 3,131 |
from django import forms
from django.contrib import admin
from clusters.models import *
class ResourceSelectWidget(forms.MultiWidget):
choices = ()
def __init__(self, attrs=None):
all_resources = [('', '----------')] + [(rsc.id, rsc.name) for rsc in EconomicResourceType.objects.all()]
wra... | bhaugen/localecon | clusters/widgets.py | Python | mit | 1,367 |
import sys
import py, pytest
import _pytest.assertion as plugin
from _pytest.assertion import reinterpret, util
needsnewassert = pytest.mark.skipif("sys.version_info < (2,6)")
@pytest.fixture
def mock_config():
class Config(object):
verbose = False
def getoption(self, name):
if name =... | geraldoandradee/pytest | testing/test_assertion.py | Python | mit | 11,084 |
# @MUNTJAC_COPYRIGHT@
# @MUNTJAC_LICENSE@
from unittest import TestCase
from muntjac.data.container import IFilter
from muntjac.data.property import IProperty, ReadOnlyException
from muntjac.data.util.object_property import ObjectProperty
from muntjac.data.util.propertyset_item import PropertysetItem
class Abstract... | rwl/muntjac | muntjac/test/server/data/util/filter/abstract_filter_test.py | Python | apache-2.0 | 1,839 |
"""empty message
Revision ID: 4113a638fb78
Revises: None
Create Date: 2015-06-22 17:12:44.325000
"""
# revision identifiers, used by Alembic.
revision = '4113a638fb78'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###... | Backfeed/BF-API-Server | migrations/versions/4113a638fb78_.py | Python | mit | 3,798 |
"""
Contains methods for accessing weekly course highlights. Weekly highlights is a
schedule experience built on the Schedules app.
"""
from __future__ import absolute_import
import logging
from lms.djangoapps.courseware.model_data import FieldDataCache
from lms.djangoapps.courseware.module_render import get_module_f... | ESOedX/edx-platform | openedx/core/djangoapps/schedules/content_highlights.py | Python | agpl-3.0 | 4,096 |
# Copyright 2013 Openstack Foundation
# 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 applicab... | blamarvt/quark | quark/utils.py | Python | apache-2.0 | 877 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Analysis Preservation Framework.
# Copyright (C) 2014, 2015 CERN.
#
# CERN Analysis Preservation Framework 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; ... | crepererum/analysis-preservation.cern.ch | invenio_data/base/fixtures/websearch.py | Python | gpl-2.0 | 2,022 |
"""
Compatibility hacks to work around differences between Python versions.
"""
##############################################################################
from __future__ import absolute_import
LICENSE = """\
This file is part of pagekite.py.
Copyright 2010-2020, the Beanstalks Project ehf. and Bjarni Runar Einar... | pagekite/PyPagekite | pagekite/compat.py | Python | agpl-3.0 | 4,362 |
"""
This module is for inspecting OGR data sources and generating either
models for GeoDjango and/or mapping dictionaries for use with the
`LayerMapping` utility.
Author: Travis Pinney, Dane Springmeyer, & Justin Bronn
"""
from itertools import izip
# Requires GDAL to use.
from django.contrib.gis.gdal import DataSourc... | Shrews/PyGerrit | webapp/django/contrib/gis/utils/ogrinspect.py | Python | apache-2.0 | 9,049 |
"""Support for the Philips Hue lights."""
import asyncio
from datetime import timedelta
import logging
from time import monotonic
import random
import aiohue
import async_timeout
from homeassistant.helpers.entity_registry import async_get_registry as get_ent_reg
from homeassistant.helpers.device_registry import async... | Cinntax/home-assistant | homeassistant/components/hue/light.py | Python | apache-2.0 | 15,809 |
# flake8: noqa
from __future__ import unicode_literals
from .abc import (
ABCIE,
ABCIViewIE,
)
from .abcnews import (
AbcNewsIE,
AbcNewsVideoIE,
)
from .abcotvs import (
ABCOTVSIE,
ABCOTVSClipsIE,
)
from .academicearth import AcademicEarthCourseIE
from .acast import (
ACastIE,
ACastChan... | steebchen/youtube-dl | youtube_dl/extractor/extractors.py | Python | unlicense | 32,705 |
# 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... | openstack-packages/delorean | dlrn/migrations/versions/3c62b0d3ec34_initial_creation.py | Python | apache-2.0 | 2,338 |
"""
Methods for calculating Mutual Information in an embarrassingly parallel way.
Author: Daniel Homola <dani.homola@gmail.com>
License: BSD 3 clause
"""
import numpy as np
from scipy.special import gamma, psi
from sklearn.neighbors import NearestNeighbors
from joblib import Parallel, delayed
def get_mi_vector(MI_FS... | danielhomola/mifs | mifs/mi.py | Python | bsd-3-clause | 5,334 |
# Copyright 2019 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.
from __future__ import absolute_import
import datetime
import logging
import os
import platform
import re
import subprocess
import six
from telemetry.intern... | catapult-project/catapult | telemetry/telemetry/internal/backends/chrome/android_minidump_symbolizer.py | Python | bsd-3-clause | 9,601 |
import irclib
import urllib
import BeautifulSoup
class shorten:
def on_pubmsg(self, nick, connection, event):
message = event.arguments()[0]
source = event.source().split('!')[0]
if message.startswith(".shorten"):
try:
url = "http://is.gd/create.php?format=simple&url=" + message[9:]
open_Ur... | 013/BigBen | modules/pubmsg/shorten.py | Python | gpl-2.0 | 546 |
from wal_e import retries
from wal_e.worker.base import _Deleter
class Deleter(_Deleter):
def __init__(self, swift_conn, container):
super(Deleter, self).__init__()
self.swift_conn = swift_conn
self.container = container
@retries.retry()
def _delete_batch(self, page):
# sw... | modulexcite/wal-e | wal_e/worker/swift/swift_deleter.py | Python | bsd-3-clause | 573 |
import copy
import numpy as np
class History(object):
class EpochHistory(object):
"""
Allows access to the results from previous epochs.
Copies are made so client can't change the history.
"""
def __init__(self,rewards,scores):
self.reward = copy.deepcopy(rewards)
self.scores = copy.... | kandluis/machine-learning | prac4/practical4-code/history.py | Python | mit | 558 |
from libdotfiles.util import HOME_DIR, PKG_DIR, create_symlink, run
create_symlink(PKG_DIR / "locale.conf", HOME_DIR / ".config" / "locale.conf")
for lang in ["en_US", "pl_PL", "ja_JP"]:
run(
[
"sudo",
"sh",
"-c",
'sed -i "s/#%s.UTF-8/%s.UTF-8/" /etc/locale.g... | rr-/dotfiles | cfg/locale/__main__.py | Python | mit | 419 |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... | qtproject/qt-creator | tests/system/suite_editors/tst_generic_highlighter/test.py | Python | gpl-3.0 | 11,420 |
from feature.pca import PCA
from feature.Interests import Interest_points
from feature.MomentsCalculator import MomentsCalculator
NUM_EVECTS_PCA = 2
pc_analyzer = PCA(NUM_EVECTS_PCA)
moment_calc = MomentsCalculator()
interest_pt_analyzer = Interest_points()
| lisiyuan656/Gesture-Recognizer | feature/__init__.py | Python | gpl-2.0 | 267 |
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from datetime import timedelta
from cfme.optimize.bottlenecks import Bottlenecks
from utils import conf
from utils.appliance.implementations.ui import navigate_to
from utils.timeutil import parsetime
from utils.ssh import SSHClient
@pytest.fixture(scope="modul... | dajohnso/cfme_tests | cfme/tests/optimize/test_bottlenecks.py | Python | gpl-2.0 | 7,738 |
'''
jwmsession.menugen
Generate JWM menu, kind of like Debian's menu,
but with icons
Copyright 2014 joshiggins
This file is part of the KX Platform Suite.
KX Platform 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 Sof... | joshiggins/jwmsession | src/jwmsession/menugen.py | Python | gpl-3.0 | 2,780 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import re
from multiprocessing import Pool
from optparse import OptionParser
import time
pattern = re.compile(r'(^S\d+)(.+)(_R1|_R2)(_001.fastq|_001.fastq.gz)')
def parse_cmd():
usage = 'Quality Control for Illumina raw fastq reads data\nCMD: pyt... | longrw/mypython | single_sampleQC.py | Python | gpl-3.0 | 4,286 |
# -*- coding: utf-8 -*-
#
# tastic documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 20 12:22:41 2017.
#
# 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 file.
#
# Al... | thespacedoctor/tastic | docs/source/_api/conf.py | Python | mit | 11,872 |
######################################
########## RESAMPLING ###############
######################################
from resample import *
from wavToPng import *
inFile = "sa1.wav"
outFile44 = "sa1_out44.wav"
outFile20 = "sa1_out20.wav"
outFile16 = "sa1_out16.wav"
outFile8 = "sa1_out8.wav"
outFile4 = "sa1_out4.wav"
o... | matthijsvk/multimodalSR | code/audioSR/fixDataset/helpFunctions/resampleExperiment.py | Python | mit | 1,105 |
# Copyright 2015 Netflix, 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... | Netflix/sleepy-puppy | sleepypuppy/admin/capture/models.py | Python | apache-2.0 | 2,479 |
# -*- coding: utf-8 -*-
# This file is part of wger Workout Manager.
#
# wger Workout Manager 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 option) any ... | wger-project/wger | wger/mailer/management/commands/send-mass-emails.py | Python | agpl-3.0 | 1,413 |
from fabric.api import local
def css():
local('cp -r vendor/markdown-core/dist/css dist/')
local('cp -r vendor/markdown-core/dist/fonts dist/')
local('curl https://cdn.jsdelivr.net/jquery.ui/1.11.4/jquery-ui.min.css > dist/css/markdown-plus.css')
local('curl https://cdn.jsdelivr.net/jquery.layout/1.4.... | bnuzet/markpurcha | fabfile.py | Python | mit | 3,229 |
from main.logger_helper import L
from common import fix_module
while True:
try:
import prctl
from pydispatch import dispatcher
break
except ImportError as iex:
if not fix_module(iex):
break
import threading
import transport.mqtt_io
from pydispatch import dispatcher
fr... | dan-cristian/haiot | transport/__init__.py | Python | gpl-2.0 | 3,811 |
import pygame
class Board:
'''I create an instance of a chessboard for the N-queens problem.
Author : Subimal Deb (subimal.deb@gmail.com)
Date : 3rd January, 2013
Note: This code is to be reproduced only with the author's permission.
If used, cite it as the ... | subimal/RecreationalMath | NQueensProblem/Solver.py | Python | gpl-2.0 | 9,661 |
from osgeo import ogr, osr
import osgeo.gdalconst
def __getSpatialRefProj4(sProj4):
sr = osr.SpatialReference()
sr.ImportFromProj4(sProj4)
return sr
def initOgr():
ogr.RegisterAll()
def exportKml(wkt, proj4):
geom = ogr.CreateGeometryFromWkt(wkt)
sr = __getSpatialRefProj4(proj4)
geom.Assign... | faunalia/HealthQGIS | packaging/qgisconfig/python/plugins/openlayers_plugin/bindogr.py | Python | gpl-3.0 | 371 |
# Natural Language Toolkit: Semantic Interpretation
#
# Copyright (C) 2001-2017 NLTK Project
# Author: Ewan Klein <ewan@inf.ed.ac.uk>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
NLTK Semantic Interpretation Package
This package contains classes for representing semantic structure in
formu... | sdoran35/hate-to-hugs | venv/lib/python3.6/site-packages/nltk/sem/__init__.py | Python | mit | 2,409 |
from collections import namedtuple
from spinn import util
from spinn.data.arithmetic.base import FIXED_VOCABULARY
SENTENCE_PAIR_DATA = False
OUTPUTS = list(range(-10, 11))
LABEL_MAP = {str(x): i for i, x in enumerate(OUTPUTS)}
Node = namedtuple('Node', 'tag span')
def spans(transitions, tokens=None):
n = (len(... | nyu-mll/spinn | python/spinn/data/arithmetic/load_simple_data.py | Python | mit | 1,759 |
# -*- coding: utf-8 -*-
# Copyright 2016 Open Permissions Platform Coalition
# 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 appl... | openpermissions/repository-srv | repository/models/queries/asset.py | Python | apache-2.0 | 6,351 |
"""Utilities for Parallel Model Selection with IPython
Author: Olivier Grisel <olivier@ogrisel.com>
Licensed: Simplified BSD
"""
from collections import namedtuple
import os
from IPython.parallel import interactive
from IPython.parallel import TaskAborted
from scipy.stats import sem
import numpy as np
from sklearn.u... | adamwalz/Jupyter-Notebooks | machine_learning/tutorials/parallel_ml_tutorial/model_selection.py | Python | unlicense | 8,644 |
# coding=utf-8
import random
from django.http import HttpResponse
class LogMiddleware(object):
def process_request(self, request):
if random.randint(1, 5) == 2 and request.path == '/':
return HttpResponse('Perdeu')
def process_view(self, request, view_func, view_args, view_kwargs):
... | gileno/curso-citi | core/middleware.py | Python | cc0-1.0 | 444 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Stephen Fromm <sfromm@gmail.com>
# Copyright: (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import ab... | pmarques/ansible | lib/ansible/modules/assemble.py | Python | gpl-3.0 | 8,541 |
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 0.5, s, t 0.75, s, t 1, s, t 1.25, s, t 1.5, s, t 1.75, s, t 2.1, s, q"
... | dangillet/cocos | test/test_transition_jumpzoom.py | Python | bsd-3-clause | 1,283 |
from django.urls import reverse
from oppia.test import OppiaTestCase
from reports.models import DashboardAccessLog
class ContextProcessorTest(OppiaTestCase):
fixtures = ['tests/test_user.json',
'tests/test_oppia.json',
'tests/test_quiz.json',
'tests/test_permissio... | DigitalCampus/django-oppia | tests/oppia/test_context_processors.py | Python | gpl-3.0 | 2,547 |
from django.conf.urls import patterns, url
urlpatterns = patterns('help.views',
url(r'^$', 'home'),
url(r'^(?P<page>[\w\-]+)/$', 'markdown'),
)
| williamdev/RatticWeb | help/urls.py | Python | gpl-2.0 | 153 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for implementations of L{IReactorUNIX}.
"""
from stat import S_IMODE
from os import stat, close
from tempfile import mktemp
from socket import AF_INET, SOCK_STREAM, socket
from pprint import pformat
try:
from socket import AF_UNIX
... | nlloyd/SubliminalCollaborator | libs/twisted/internet/test/test_unix.py | Python | apache-2.0 | 19,682 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2018-2022 GEM Foundation
#
# OpenQuake 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 Licen... | gem/oq-engine | openquake/hmtk/plotting/patch.py | Python | agpl-3.0 | 3,730 |
from core.utils.date import now
from core.utils.misc import choicify
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from core.config import ACL_DEFAULT_VALUE, ACL_DEFAULT_EDITABLE
from .choices import ACCESS_LEVELS
class BaseShortcut(models.Model... | sololuz/cibb-web | app/core/base/models.py | Python | bsd-3-clause | 6,010 |
# Common dialog code.
#
# Copyright (C) 2007, 2008 Red Hat, Inc. All rights reserved.
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
... | ystk/debian-audit | system-config-audit/src/dialog_base.py | Python | gpl-2.0 | 5,208 |
# -*- coding: utf-8 -*-
import re
import urllib
from module.plugins.internal.Hoster import Hoster
class ShareplaceCom(Hoster):
__name__ = "ShareplaceCom"
__type__ = "hoster"
__version__ = "0.14"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?shareplace\.(com|org)/\?\w+'
__d... | fayf/pyload | module/plugins/hoster/ShareplaceCom.py | Python | gpl-3.0 | 2,152 |
from .. utils import TranspileTestCase, UnaryOperationTestCase, BinaryOperationTestCase, InplaceOperationTestCase
class NotImplementedTests(TranspileTestCase):
def test_truth(self):
self.assertCodeExecution("""
x = NotImplemented
print(x == True)
""")
class UnaryNotIm... | Felix5721/voc | tests/datatypes/test_NotImplemented.py | Python | bsd-3-clause | 3,814 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.