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 |
|---|---|---|---|---|---|
#####################################################################################
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# Unless a separate license agreement exists between you and Crossbar.io GmbH (e.g.
# you have purchased a commercial license), the license terms below apply.
#
# Should you enter ... | NinjaMSP/crossbar | crossbar/twisted/flashpolicy.py | Python | agpl-3.0 | 4,930 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2012 Rackspace Hosting
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ... | inkerra/cinder | cinder/volume/configuration.py | Python | apache-2.0 | 2,543 |
# -*- coding: utf-8 -*-
"""
requests.session
~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
from .defaults import defaults
from .models import Request
from .hooks import dispatch_hook
from .utils import header_expand
from .packages... | samabhi/pstHealth | venv/lib/python2.7/site-packages/requests/sessions.py | Python | mit | 9,484 |
import os
from django.core.exceptions import ImproperlyConfigured
def get_env_variable(var_name, default=None):
"""
Get the environment variable or return exception
"""
try:
return os.environ[var_name]
except KeyError:
if default is not None:
return default
else... | r0x73/django-template | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/config/settings/__init__.py | Python | mit | 441 |
#!/usr/bin/env python
'''Frame for single image debugging
'''
import wx
import matplotlib as mplt
mplt.use('WXAgg', warn=False)
from matplotlib import cm
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as N... | pshchelo/vampy | wxgui/debug.py | Python | bsd-3-clause | 3,703 |
from tests.oppia.awards.award_test_case import AwardsTestCase
class FinalQuizAwardsTest(AwardsTestCase):
'''
BADGE_AWARD_METHOD_FINAL_QUIZ
'''
def setUp(self):
super(FinalQuizAwardsTest, self).setUp()
self.set_badge_method('final_quiz')
# final quiz attempted and passed
def ... | DigitalCampus/django-oppia | tests/oppia/awards/test_final_quiz.py | Python | gpl-3.0 | 1,482 |
import click
from .dunders import dunder_dict, DunderSections
def print_dunder(dunder):
s = '''\
{method}: {reason}
section: {section}
Usage: {usage}
Example implementation:
{example}
''' \
.format(
method=dunder.method, reason=dunder.reason, section=dunder.section.value,
... | nhumrich/dunderdoc | dunderdoc/__main__.py | Python | mit | 1,332 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 202013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gr_unittest
from gnuradio import blocks
class qa_stream_to_tagged_stream (gr_unittest.TestCase):
def set... | jdemel/gnuradio | gr-blocks/python/blocks/qa_stream_to_tagged_stream.py | Python | gpl-3.0 | 1,207 |
from pycp2k.inputsection import InputSection
class _each126(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Just_energy = None
self.Powell_opt = None
self.Qs_scf = None
self.Xas_scf = None
self.Md = None
self.Pint = None
self.Meta... | SINGROUP/pycp2k | pycp2k/classes/_each126.py | Python | lgpl-3.0 | 1,114 |
import datetime
import hashlib
import ddt
import factory
import pytz
from django.contrib.auth.models import AnonymousUser
from django.core.cache import cache
from django.db.models import signals
from django.db.models.functions import Lower
from django.test import TestCase
from opaque_keys.edx.keys import CourseKey
fr... | msegado/edx-platform | common/djangoapps/student/tests/test_models.py | Python | agpl-3.0 | 18,375 |
# ============================================================================
#
# Copyright (C) 2007-2010 Conceptive Engineering bvba. All rights reserved.
# www.conceptive.be / project-camelot@conceptive.be
#
# This file is part of the Camelot Library.
#
# This file may be used under the terms of the GNU General... | kurtraschke/camelot | camelot/view/controls/delegates/booldelegate.py | Python | gpl-2.0 | 4,796 |
# Copyright 2019 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... | frreiss/tensorflow-fred | tensorflow/python/keras/mixed_precision/loss_scale.py | Python | apache-2.0 | 2,068 |
"""
This is your project's main settings file that can be committed to your
repo. If you need to override a setting locally, use local.py
"""
import os
import logging
# Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception.
from django.core.excepti... | georgiascott/sosleep | sosleep/settings/base.py | Python | bsd-3-clause | 10,029 |
# 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
# d... | BiznetGIO/horizon | horizon/test/test_dashboards/cats/kittens/urls.py | Python | apache-2.0 | 747 |
# -*- coding: utf-8 -*-
'''
realizer Add-on
Copyright (C) 2016 realizer
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 ... | tvaddonsco/tva-release-repo | matrix/plugin.video.realizerx/resources/lib/api/remotedb.py | Python | gpl-3.0 | 24,701 |
# $File: _ext_type.py
# $Date: Wed Feb 22 15:04:06 2012 +0800
#
# Copyright (C) 2012 the pynojo development team <see AUTHORS file>
#
# Contributors to this file:
# Kai Jia <jia.kai66@gmail.com>
#
# This file is part of pynojo
#
# pynojo is free software: you can redistribute it and/or modify
# it under the terms ... | zxytim/pynojo | pynojo/model/_ext_type.py | Python | gpl-3.0 | 2,330 |
from simplecoremidi import MIDISource, MIDIDestination
from musi import C, Buffer, Tap, If, Eval, Tempo, midi, math, waves, play, countdown, util
#
## Connect sequence emitter channel 1 to a synth (eg. Cheetah MS6)
# Connect sequence emitter channel 2 to a drum machine (eg. 606 preset in Live)
midi.DEBUG = True
kic... | sixohsix/musi | musi/examples/seq2.py | Python | mit | 2,265 |
from expr import Expr
from sympify import _sympify
def Rel(a, b, op):
"""
A handy wrapper around the Relational class.
Rel(a,b, op)
Example:
>>> from sympy import Rel
>>> from sympy.abc import x, y
>>> Rel(y, x+x**2, '==')
y == x + x**2
"""
return Relational(a,b,op)
def Eq(a,... | tarballs-are-good/sympy | sympy/core/relational.py | Python | bsd-3-clause | 4,051 |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divisi... | klahnakoski/SpotManager | vendor/jx_elasticsearch/es52/expressions/prefix_op.py | Python | mpl-2.0 | 1,813 |
import enum
from notaol.fdo.tokenmeta import TOKEN_METADATA
class Token(enum.Enum):
# TODO: put commonly used tokens here
pass
TOKEN_TO_DESC_MAP = dict([
(meta.token, meta.description) for meta in TOKEN_METADATA
])
| chfoo/notaol | notaol/fdo/token.py | Python | gpl-3.0 | 236 |
"""
Applies a (previously trained) Caffe classification model to new image data.
This code takes a brute-force approach to generating per-pixel predictions;
it simply extracts a tile around every pixel (that is sufficiently far away
from the image border) and runs each tile through Caffe.
This entails many repeated c... | openconnectome/ndod | maca/packages/dlod/src/deploy_classifier.py | Python | apache-2.0 | 8,756 |
from django.contrib.auth.models import User
from django.test.client import Client
from django.core.urlresolvers import reverse
from user.models import *
from behave import *
freds_question = None
@when("I'm looking at friend's public profile")
def step_impl(context):
c = Client()
public_profile = reverse('p... | hasadna/open-shot | user/features/steps/common.py | Python | bsd-3-clause | 1,435 |
__author__ = 'pvarenik'
from fixture.orm import ORMFixture
from model.group import Group
db = ORMFixture(host="127.0.0.1", name="addressbook", user="root", password="")
try:
l = db.get_contacts_not_in_group(Group(id="83"))
for e in l:
print(e)
print(len(l))
finally:
pass
#db.destroy()
| pvarenik/PyCourses | check_db_connection.py | Python | gpl-2.0 | 315 |
#!/usr/bin/env python
# Copyright (c) 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.
import os.path
import subprocess
import sys
import unittest
import PRESUBMIT
file_dir_path = os.path.dirname(os.path.abspath(__fi... | ric2b/Vivaldi-browser | chromium/chrome/browser/PRESUBMIT_test.py | Python | bsd-3-clause | 3,522 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from gaebusiness.business import CommandExecutionException, CommandParallel
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_not_required
from observacoe_app.commands import GetDonoObs
from tekton.gae.middl... | vinicius-carvalho/fatec-prog-script | backend/appengine/routes/observacoes/rest.py | Python | mit | 1,782 |
#!/usr/bin/env python3
#
# Copyright (C) 2007, 2012, 2017 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 3 as published by
# the Free Software Foundation.
#
# This... | UNINETT/nav | tools/eventgenerators/snmpevent.py | Python | gpl-2.0 | 2,774 |
import os
from setuptools import setup, find_packages
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
setup(name='pyAesCrypt',
version='6.0.0',
packages = find_packages(),
include_package_data=True,
description='Encrypt and decrypt files and strea... | marcobellaccini/pyAesCrypt | setup.py | Python | apache-2.0 | 911 |
"""
parser.http.bsouplxml.html module (imdb.parser.http package).
This module adapts the beautifulsoup interface to lxml.html module.
Copyright 2008 H. Turgut Uyar <uyar@tekir.org>
2008 Davide Alberani <da@erlug.linux.it>
This program is free software; you can redistribute it and/or modify
it under the ter... | nopjmp/SickRage | lib/imdb/parser/http/bsouplxml/html.py | Python | gpl-3.0 | 1,179 |
import os
from dataclasses import dataclass
from typing import Iterable
from dbt.contracts.graph.manifest import SourceFile
from dbt.contracts.graph.parsed import ParsedSqlNode, ParsedMacro
from dbt.contracts.graph.unparsed import UnparsedMacro
from dbt.exceptions import InternalException
from dbt.node_types import No... | analyst-collective/dbt | core/dbt/parser/sql.py | Python | apache-2.0 | 2,013 |
from .ots import OrderedTurtleSerializer
__version__ = '0.5.0' # Use bumpversion to update
| scriptotek/otsrdflib | otsrdflib/__init__.py | Python | mit | 93 |
"""
Monitors home energy use for the ELIQ Online service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.eliqonline/
"""
from datetime import timedelta
import logging
from urllib.error import URLError
import voluptuous as vol
from homeassistant.... | keerts/home-assistant | homeassistant/components/sensor/eliqonline.py | Python | apache-2.0 | 2,741 |
#!/usr/bin/python
#
# Web interface to Nutrimatic find-expr. (As seen on http://nutrimatic.org/)
#
# Expects to be run with the pathnames to the find-expr binary and the index.
# Normally this is done with a shell script wrapper which the web server runs.
import cgi
import cgitb; cgitb.enable()
import math
import res... | periodic1236/nutrimatic | cgi-search.py | Python | gpl-3.0 | 6,321 |
"""
Abacus
"""
p = {
"0":"* = ****",
"1":"* =* ***",
"2":"* =** **",
"3":"* =*** *",
"4":"* =**** ",
"5":" *= ****",
"6":" *=* ***",
"7":" *=** **",
"8":" *=*** *",
"9":" *=**** ",
}
if __name__ == '__main__':
try:
i = 0
while True:
result = [p[x] for x in raw_input().zfill(5)]
... | miyazaki-tm/aoj | Volume1/0128.py | Python | mit | 468 |
##############################################################################
# Ganga Project. http://cern.ch/ganga
#
# $Id: AthenaLCGRTHandler.py,v 1.51 2009-07-23 20:12:25 elmsheus Exp $
###############################################################################
# Athena LCG Runtime Handler
#
# ATLAS/ARDA
impor... | ganga-devs/ganga | ganga/GangaAtlas/Lib/Athena/AthenaLCGRTHandler.py | Python | gpl-3.0 | 39,662 |
# Given a variable, x, that stores the
# value of any decimal number, write Python
# code that prints out the nearest whole
# number to x.
# If x is exactly half way between two
# whole numbers, round up, so
# 3.5 rounds to 4 and 2.5 rounds to 3.
# You may assume x is not negative.
# Hint: The str function can convert... | JoseALermaIII/python-tutorials | pythontutorials/Udacity/CS101/Lesson 02 - Problem Set/Q9-Rounding Numbers.py | Python | mit | 741 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from weibowarchtml import WeibowarcHtml
USERNAME = ''
PASSWORD = ''
WeiboHtmlTest = WeibowarcHtml(username=USERNAME, password=PASSWORD)
def get_list_test():
count = 0
for followers in WeiboHtmlTest.get_follower_list():
print followers
count += 1
... | gwu-libraries/weibowarc | test/weiboarchhtml_test.py | Python | mit | 713 |
"""
Django settings for codeweekeu project.
"""
import sys
import os
from os.path import abspath, basename, dirname, join, normpath
########## PATH CONFIGURATION
# Absolute filesystem path to this Django project directory.
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Site name.
# SITE_NAME = basename(DJANGO_R... | joseihf/coding-events | codeweekeu/settings.py | Python | mit | 12,434 |
import numpy as np
from metaworld.policies.action import Action
from metaworld.policies.policy import Policy, assert_fully_parsed, move
class SawyerHandlePressSideV2Policy(Policy):
@staticmethod
@assert_fully_parsed
def _parse_obs(obs):
return {
'hand_pos': obs[:3],
'grip... | rlworkgroup/metaworld | metaworld/policies/sawyer_handle_press_side_v2_policy.py | Python | mit | 1,056 |
from urlparse import urlparse, parse_qs
from pyLibrary.dot import Null, coalesce, wrap
from pyLibrary.dot.dicts import Dict
_convert = None
_Log = None
def _late_import():
global _convert
global _Log
from pyLibrary import convert as _convert
from pyLibrary.debugs.logs import Log as _Log
_ = _con... | klahnakoski/MoDevETL | pyLibrary/parsers.py | Python | mpl-2.0 | 2,704 |
for astTuple in Query.input.tuples('ast'):
if type(astTuple.ast) is Field:
modifiers = astTuple.ast.modifiers
nonFinalPublic = modifiers.isSet(Modifier.ModifierFlag.Public) and not modifiers.isSet(Modifier.ModifierFlag.Final)
if not nonFinalPublic:
Query.input.remove(astTuple)
Q... | Vaishal-shah/Envision | InformationScripting/scripts/evaluation/nonFinalPublic.py | Python | bsd-3-clause | 345 |
import os, sys
import torch
from torch.utils.data import Dataset
import imageio as io
import cv2
from sklearn.model_selection import StratifiedKFold
import numpy as np
from numpy.lib.stride_tricks import as_strided
mean = [0.485, 0.456, 0.406]
std = [0.229, 0.224, 0.225]
def imread(p):
img = io.imread(p)
# o... | UCSB-VRL/action_recognition | code/dataset/data.py | Python | mit | 3,840 |
import re
import sys
import shutil
import os.path
import subprocess
import reindent
import untabify
def n_files_str(count):
"""Return 'N file(s)' with the proper plurality on 'file'."""
return "{} file{}".format(count, "s" if count != 1 else "")
def status(message, modal=False, info=None):
... | google/google-ctf | third_party/edk2/AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/patchcheck.py | Python | apache-2.0 | 4,898 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from contextlib import contextmanager
from twitter.common.contextutil import temporary_dir
from pex.compatibility import nested
from pex.environment import PEXEnvironment
from ... | rouge8/pex | tests/test_environment.py | Python | apache-2.0 | 3,792 |
"""The tests for SleepIQ binary sensor platform."""
import unittest
from unittest.mock import MagicMock
import requests_mock
from homeassistant.bootstrap import setup_component
from homeassistant.components.binary_sensor import sleepiq
from tests.components.test_sleepiq import mock_responses
from tests.common import... | kyvinh/home-assistant | tests/components/binary_sensor/test_sleepiq.py | Python | apache-2.0 | 1,837 |
# -*- coding: utf-8 -*-
from django.apps import AppConfig
class CUserConfig(AppConfig):
name = 'cuser'
label = 'cuser'
| Alir3z4/django-cuser | cuser/apps.py | Python | bsd-3-clause | 129 |
# This file is modified from scikits.cuda (https://github.com/lebedov/scikits.cuda)
# Copyright (c) 2009-2013, Lev Givon. 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 sourc... | wavelets/hebel | hebel/pycuda_ops/linalg.py | Python | gpl-2.0 | 7,038 |
#!/usr/bin/python
"""Test presentation of caret navigation by line."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(TypeAction("Line 1"))
sequence.append(KeyComboAction("Return"))
sequence.append(TypeAction("Line 2"))
sequence.append(KeyComboAction("Return"))
sequence.app... | chrys87/orca-beep | test/keystrokes/oowriter/document_nav_line.py | Python | lgpl-2.1 | 2,617 |
#!/usr/bin/env python
import sys
from compute import *
if len(sys.argv) != 2:
exit("Usage: compute_it.py <expression>")
#if 'C' in VALID_DNA:
# print "C is a base"
#if 'D' in VALID_DNA:
# print "D is a base"
#else:
# print "D is not a base"
#hello()
print compute(sys.argv[1])
#print sys.path
| pvanheus/python2015 | bin/compute_it.py | Python | gpl-3.0 | 310 |
self.description = "incoming package replaces symlink with directory (order 2)"
lp = pmpkg("pkg2")
lp.files = ["usr/lib/foo",
"lib -> usr/lib"]
self.addpkg2db("local", lp)
p1 = pmpkg("pkg1")
p1.files = ["lib/bar"]
self.addpkg2db("sync", p1)
p2 = pmpkg("pkg2", "1.0-2")
p2.files = ["usr/lib/foo"]
self.addp... | kylon/pacman-fakeroot | test/pacman/tests/sync702.py | Python | gpl-2.0 | 504 |
#!/usr/bin/env python
# Copyright (C) 2012 Tianyang Li
# tmy1018@gmail.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... | tianyang-li/bi-misc | flux_fastas.py | Python | gpl-3.0 | 1,017 |
# -*- coding: utf-8 -*-
#
# TGiT, Music Tagger for Professionals
# Copyright (C) 2013 Iconoclaste Musique 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... | Iconoclasteinc/tgit | tgit/version.py | Python | gpl-3.0 | 1,949 |
from xml.dom.pulldom import START_ELEMENT, END_ELEMENT, \
COMMENT, IGNORABLE_WHITESPACE, CHARACTERS
import _base
from html5lib.constants import voidElements
class TreeWalker(_base.TreeWalker):
def __iter__(self):
ignore_until = None
previous = None
for event in self.tree:
... | dewitt/webfingerclient-dclinton | third_party/html5lib/treewalkers/pulldom.py | Python | apache-2.0 | 1,837 |
# -*- coding:utf-8 -*-
from point import Point
from triangle import Triangle
from side import Side
class Triangulation(object):
""" Class that triangulates polygons with no hole """
# Used to verify if triangulation is counter clockwise
EPSILON = 0.0000000001
def __init__(self, points):
if ... | pantuza/art-gallery | src/triangulation.py | Python | gpl-2.0 | 8,722 |
#!/usr/bin/python
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# Author: Davide Guerri <davide.guerri@hp.com>
#
# This module 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 ... | kernow/ansible-modules-core | cloud/openstack/os_floating_ip.py | Python | gpl-3.0 | 6,989 |
from collections import defaultdict
from .item import Item, Manufactured
from .machine import Machine
def compute_flows(inputs, limits=set([])):
"""
Compute the entire set of operations and quantities/flows
to get from raw ingredients to
:param inputs: What items to produce
:type inputs: dict[It... | xvillaneau/YAFC | yafc/compute.py | Python | mit | 1,827 |
#!/usr/bin/env python
from setuptools import setup
from tippet import version
def readme():
with open('README.md') as f:
return f.read()
setup(
name = 'tippet',
version = version,
description = 'Manage project/file templates.',
long_description = readme(),
author = 'Jerry Baker',
... | kizbitz/tippet | setup.py | Python | apache-2.0 | 1,098 |
'''Diffusion mapping by Ann B Lee, March 2009. Last modified, JWR: 3/23/2009 ported to python'''
import numpy as nu
from scipy.cluster.vq import kmeans2
#from scipy.sparse.linalg import svds as svd
from scipy.linalg import svd
def diffuse(D,eps_val,neigen=None,t=None,threshold = 5E-6):
''' diffuse(D,eps_val,t,n... | drdangersimon/SSP_diffusion | diffuse.py | Python | unlicense | 8,653 |
from itertools import groupby
def extra_recs_filter(recs):
"""
Assume recs are sorted by timestamp
"""
for is_nearest_points_not_empty, group_recs in groupby(recs, key=lambda x: bool(x['nearest_points'])):
if is_nearest_points_not_empty:
for rec in group_recs:
yield... | AlexFridman/visits-detector | visits_detector/core/components/extra_recs_filter/extra_recs_filter.py | Python | mit | 548 |
# -*- coding: utf-8 -*-
"""
https://mitpress.mit.edu/sicp/full-text/book/book-Z-H-15.html#%_thm_2.42
"""
from Chapter2.themes.lisp_list_structured_data import (
append, cadr, car, cdr, lisp_list, list_ref, nil, print_lisp_list, rlength,
)
from Chapter2.themes.mapping_over_lists import map
from Chapter2.themes.neste... | aoyono/sicpy | Chapter2/exercises/exercise2_42.py | Python | mit | 1,961 |
import sys
import os
import os.path
import argparse
import pprint
import tables
import sqlite3
import numpy
tracks_id_count = 0
album_id_count = 0
artist_id_count = 0
pretty_print = pprint.PrettyPrinter(indent=4, width=80).pprint
pretty_print_err = pprint.PrettyPrinter(indent=4, width=80, stream=sys.stderr).pprint
T... | NoZip/soundcity | scripts/dump_msd.py | Python | mit | 10,807 |
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# ------------------------------------------------------... | crossroadchurch/paul | openlp/plugins/bibles/forms/bibleupgradeform.py | Python | gpl-2.0 | 28,609 |
import netifaces
import os
BLACK_ID = ('lo0', 'gif0')
BLACK_MAC = ('', '::1')
class Interface(object):
"""Network Interface Object"""
def __init__(self, id):
super(Interface, self).__init__()
self.id = id
_meta = netifaces.ifaddresses(self.id)
self.mac = _meta[18][0]['addr']
try:
self.broadcase... | kennethreitz-archive/macspoof | macspoof/interfaces.py | Python | mit | 1,440 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Red Hat, 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
#
#... | JioCloud/heat | heat/openstack/common/rpc/securemessage.py | Python | apache-2.0 | 18,032 |
# This file is part of Moksha.
# Copyright (C) 2008-2010 Red Hat, 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 b... | lmacken/moksha | moksha/api/widgets/stomp/stomp.py | Python | apache-2.0 | 8,069 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from django import forms
from django.utils.t... | Finntack/pootle | pootle/apps/accounts/forms.py | Python | gpl-3.0 | 1,510 |
# -*- coding: utf-8 -*-
"""
Real-time generators (infinite sequences) for monitoring file modifications.
"""
import os.path
import time
import autotest.search as search
def gen_follow(file, sleep_time=1, lastmod=time.time()):
"""
Generator that tracks a single file for modifications.
Yield's the file's f... | tapichu/pyautotest | autotest/realtime.py | Python | bsd-3-clause | 1,442 |
# Copyright (c) 2021 PaddlePaddle 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 appli... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/ipu/test_expand_op_ipu.py | Python | apache-2.0 | 6,008 |
import httplib
import json
import sys
import time
import urllib2
def get_status_code(host, path):
""" This function retreives the status code of a website by requesting
HEAD data from the host. This means that it only requests the headers.
If the host cannot be reached or something else goes wrong,... | SANDAG/DataSurfer | api/utilities/pdf_test.py | Python | mit | 2,085 |
"""
funciones para generar randoms
"""
import random
import string
def generate_string( length=10 ):
"""
Genera una cadena aleatoria usando las letras de ascii
Arguments
---------
length: int
longitud del la cadena a generar
Returns
-------
string
una cedena aleatoria
"""
return u''.join(
random.cho... | dem4ply/sebastian | snippet/sp_random.py | Python | gpl-2.0 | 381 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='qos-server',
version='1.0',
author='Alexandre Dulaunoy',
author_email='alexandre.dulaunoy@circl.lu',
maintainer='Alexandre Dulaunoy',
url='https://github.com/adulau/pdns-qof-server',
desc... | adulau/pdns-qof-server | setup.py | Python | bsd-3-clause | 896 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free ... | remb0/CouchPotatoServer | libs/guessit/transfo/post_process.py | Python | gpl-3.0 | 2,521 |
from django.conf import settings
import socket
import json
from django.utils.safestring import mark_safe
_exclude_from_context = ['request', 'csrf_input', 'DEFAULT_MESSAGE_LEVELS', 'False', 'True', 'None', 'view']
server_address = getattr(settings, 'DJANGO_ISOMORPHIC_SOCKET_PATH', '/tmp/template-server.sock')
BUFFER_... | OmegaDroid/django-jsx | django_jsx/client/template_client.py | Python | bsd-3-clause | 1,630 |
import _plotly_utils.basevalidators
class SizesrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="sizesrc", parent_name="sankey.link.hoverlabel.font", **kwargs
):
super(SizesrcValidator, self).__init__(
plotly_name=plotly_name,
pare... | plotly/plotly.py | packages/python/plotly/plotly/validators/sankey/link/hoverlabel/font/_sizesrc.py | Python | mit | 427 |
import math
# Type Annotations are awsome but 3.4 and 2.7 won't recognize them so hence this syntax
class Point(object):
def __init__(self, x=0.0, y=0.0): # type: (float, float) -> None
self.x = x
self.y = y
class Circle(object):
def __init__(self, x=0.0, y=0.0, radius=0.0): # type: (floa... | apolloFER/circle-web-app | api/circle.py | Python | gpl-3.0 | 933 |
from __future__ import absolute_import
from __future__ import unicode_literals
import difflib
def simple_merge(txt1, txt2):
"""Merges two texts"""
differ = difflib.Differ(charjunk=difflib.IS_CHARACTER_JUNK)
diff = differ.compare(txt1.splitlines(1), txt2.splitlines(1))
content = "".join([l[2:] for l i... | inflrscns/django-wiki | wiki/core/diff.py | Python | gpl-3.0 | 349 |
import unittest
from adyen.signers import HMACSha256
class TestHMACSha256(unittest.TestCase):
def test_sign(self):
"""Make sure the sign method works as expected.
The test data are taken from the Adyen documentation.
See https://docs.adyen.com/manuals/hpp-manual#pythonhmacsignature
... | oscaro/django-oscar-adyen | tests/test_signers_sha256.py | Python | bsd-3-clause | 2,670 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software with... | bencharb/AutobahnPython | examples/twisted/wamp/app/dbus/bridge.py | Python | mit | 4,764 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
orm.PartnerOrganization.objects.create(name='The Cheetah Fund', slug='cheetah',
... | onepercentclub/onepercentclub-site | apps/projects/migrations/0004_partner_organizations.py | Python | bsd-3-clause | 21,529 |
# -*- Python -*-
import os
import platform
import re
import subprocess
import locale
import lit.formats
import lit.util
from lit.llvm import llvm_config
# Configuration file for the 'lit' test runner.
# name: The name of this test suite.
config.name = 'lld'
# testFormat: The test format to use to interpret tests.... | endlessm/chromium-browser | third_party/llvm/lld/test/lit.cfg.py | Python | bsd-3-clause | 3,720 |
"""Generate some disassembly listing of some binary executable."""
__version__ = '0.1.0'
__title__ = 'Okita'
__name__ = 'okita'
__description__ = 'Generate some disassembly listing of some binary executable.'
__uri__ = 'https://github.com/Ge0/okita'
__author__ = 'Geoffrey ROYER'
__email__ = 'geoffrey.royer@gmail.com... | Ge0/okita | src/okita/__init__.py | Python | mit | 361 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Core iPOPO implementation
:author: Thomas Calmant
:copyright: Copyright 2016, Thomas Calmant
:license: Apache License 2.0
:version: 0.6.4
..
Copyright 2016 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not... | ahmadshahwan/ipopo | pelix/ipopo/core.py | Python | apache-2.0 | 44,994 |
# Copyright (c) 2017-2018 Cloudify Platform Ltd. 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 ... | cloudify-incubator/cloudify-utilities-plugin | cloudify_deployment_proxy/tests/base.py | Python | apache-2.0 | 2,461 |
#!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | JianfengXu/crosswalk-test-suite | cordova/cordova-webapp-android-tests/webapp/webapp_build.py | Python | bsd-3-clause | 2,183 |
# -*- coding: utf-8 -*-
#
# 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
#... | danielvdende/incubator-airflow | airflow/contrib/operators/hipchat_operator.py | Python | apache-2.0 | 5,234 |
from math import *
def f(e, x):
return abs(eval(e.replace('^', '**').replace('x', '('+str(x)+')')))
def solve(e, a, b):
N = 1999
t = f(e, a) + f(e, b)
for i in range(1, 2*N):
if i % 2 == 0:
t += 2*f(e, a + (b-a)*i/2/N)
else:
t += 4*f(e, a + (b-a)*i/2/N)
return (b-a)*t/6/N
def main():
##
with op... | Lipen/LipenDev | Azeroth/Northrend/TP Olymp/TaskE.py | Python | gpl-3.0 | 687 |
# -*- coding: utf-8 -*-
import unittest
import pygeoip
from tests.config import CITY_DB_PATH
class TestGeoIPTimeZoneFunctions(unittest.TestCase):
def setUp(self):
self.us_hostname = 'google.com'
self.us_ip = '64.233.161.99'
self.gb_hostname = 'bbc.com'
self.gb_ip = '212.58.253.68... | orbitvu/pygeoip | tests/test_tz.py | Python | lgpl-3.0 | 942 |
# Choregraphe bezier export in Python.
from naoqi import ALProxy
names = list()
times = list()
keys = list()
names.append("LShoulderPitch")
times.append([ 0.50000, 1.00000])
keys.append([ [ 1.39626, [ 3, -0.16667, 0.00000], [ 3, 0.16667, 0.00000]], [ 1.39626, [ 3, -0.16667, 0.00000], [ 3, 0.00000, 0.00000]]])
names.... | Rctue/nao-lib | gestures/SadGesture_1.py | Python | gpl-2.0 | 2,775 |
# Copyright 2018 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... | theflofly/tensorflow | tensorflow/contrib/distribute/python/mirrored_strategy_multigpu_test.py | Python | apache-2.0 | 64,615 |
import os
import os.path
import tempfile
import shutil
import unittest
from beets import config
from beets.library import Item, Album, Library
from beetsplug.importfeeds import ImportFeedsPlugin
class ImportfeedsTestTest(unittest.TestCase):
def setUp(self):
config.clear()
config.read(user=False)... | beetbox/beets | test/test_importfeeds.py | Python | mit | 2,123 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2017 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 ... | Glignos/inspire-next | inspirehep/modules/authors/views.py | Python | gpl-3.0 | 13,369 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10a1 on 2016-07-19 15:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0041_auto_20160707_1856'),
]
operations = [
migrations.AddFiel... | DLance96/ox-dashboard | dashboard/migrations/0042_studytableevent_notes.py | Python | mit | 467 |
#!/usr/bin/env python2.7
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | zhimingxie/grpc | test/core/end2end/gen_build_yaml.py | Python | apache-2.0 | 13,697 |
from PySide.QtGui import QTableWidget, QTableWidgetItem, QColor, QAbstractItemView
from PySide.QtCore import Qt
from angr.analyses.cfg.cfg_fast import MemoryData
from ...utils import filter_string_for_display
class QStringTableItem(QTableWidgetItem):
def __init__(self, mem_data, *args, **kwargs):
supe... | Ruide/angr-dev | angr-management/angrmanagement/ui/widgets/qstring_table.py | Python | bsd-2-clause | 3,604 |
"""Support for Nest Thermostat sensors."""
import logging
from homeassistant.components.climate.const import STATE_COOL, STATE_HEAT
from homeassistant.const import (
CONF_MONITORED_CONDITIONS, DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_TEMPERATURE,
STATE_OFF, TEMP_CELSIUS, TEMP_FAHRENHEIT)
from . import CONF_SENSORS... | jamespcole/home-assistant | homeassistant/components/nest/sensor.py | Python | apache-2.0 | 6,609 |
import asyncio
import collections
import inspect
import json
import time
from datetime import datetime
from typing import Dict, List, Union
from base58 import b58decode
from common.serializers.serialization import serialize_msg_for_signing
from stp_core.common.log import getlogger
from plenum.common.signer_did import... | TechWritingWhiz/indy-node | indy_client/agent/walleted.py | Python | apache-2.0 | 42,839 |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from .bayesian_monte_carlo_loop import BayesianMonteCarlo # noqa: F401
from .vanilla_bq_loop import VanillaBayesianQuadratureLoop # noqa: F401
from .wsabil_loop import WSABILLoop # noqa: F401
| EmuKit/emukit | emukit/quadrature/loop/__init__.py | Python | apache-2.0 | 309 |
###########################################
# Suppress matplotlib user warnings
# Necessary for newer version of matplotlib
import warnings
warnings.filterwarnings("ignore", category = UserWarning, module = "matplotlib")
#
# Display inline matplotlib plots with IPython
from IPython import get_ipython
get_ipython().run_... | rodrigomas/boston_housing | visuals.py | Python | mit | 5,018 |
# -*- coding: utf-8 -*-
#
# alan2 - An openbox menu builder
# Copyright (C) 2014 Semplice Project
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at you... | semplice/alan2 | alan/extensions/logout_vera.py | Python | gpl-3.0 | 4,182 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
Unit tests for the :class:`iris.common.mixin.CFVariableMixin`.
"""
# Import iris.tests first so that some things can be i... | rcomer/iris | lib/iris/tests/unit/common/mixin/test_CFVariableMixin.py | Python | lgpl-3.0 | 13,172 |
#!/usr/bin/python
# (c) 2017, Alberto Murillo <alberto.murillo.silva@intel.com>
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ver... | QijunPan/ansible | lib/ansible/modules/packaging/os/swupd.py | Python | gpl-3.0 | 9,552 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.