code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import sys
import os
def get_activity_lib_dir(activity_name):
from jnius import autoclass
# Get the actual activity instance:
activity_class = autoclass(activity_name)
if activity_class is None:
return None
activity = None
if hasattr(activity_class, "mActivity") and \
act... | kivy/python-for-android | pythonforandroid/recipes/android/src/android/_ctypes_library_finder.py | Python | mit | 2,516 |
# -*- coding: utf-8 -*-
"""Given a json formatted plain text content provide a werkzeug http response"""
from restfulcomm.services.superbaseservice import BaseService
from restfulcomm.http.jsonresponse import JsonResponse
from werkzeug.datastructures import Headers
from werkzeug.wrappers import Response
class PlainJs... | westial/restfulcomm | restfulcomm/services/plainjsontohttpresponseservice.py | Python | gpl-3.0 | 1,186 |
#!/bin/env python
"""
Spacewalk external inventory script
=================================
Ansible has a feature where instead of reading from /etc/ansible/hosts
as a text file, it can query external programs to obtain the list
of hosts, groups the hosts are in, and even variables to assign to each host.
To use thi... | xiaoshaozi52/ansible | contrib/inventory/spacewalk.py | Python | gpl-3.0 | 8,569 |
from umlfri2.application.commands.diagram import AddConnectionPointCommand
from umlfri2.types.geometry import PathBuilder, Point
from ..drawingareacursor import DrawingAreaCursor
from .action import Action
class AddConnectionPointAction(Action):
def __init__(self, connection, index):
super().__init__()
... | umlfri/umlfri2 | umlfri2/application/drawingarea/actions/addconnectionpoint.py | Python | gpl-3.0 | 2,416 |
from copy import deepcopy
from indy_node.test import waits
from stp_core.loop.eventually import eventually
from plenum.common.constants import VERSION
from indy_node.test.upgrade.helper import bumpedVersion, checkUpgradeScheduled, \
check_no_loop, sdk_ensure_upgrade_sent
from indy_node.server.upgrade_log import U... | spivachuk/sovrin-node | indy_node/test/upgrade/test_pool_upgrade_no_loop_unsuccessful.py | Python | apache-2.0 | 1,293 |
import datetime
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.contrib.auth.models import Permission
from crashstats.crashstats.decorators import pass_default_context
from crashstats.supersearch.models import SuperSearchUnredacted
from crashstats.tokens impor... | spthaolt/socorro | webapp-django/crashstats/profile/views.py | Python | mpl-2.0 | 1,168 |
import bottle
import sqlite3
bottle.debug(True)
datoteka_baze = "fejsbuk.sqlite"
############################
@bottle.route('/prijatelji/<id>')
@bottle.view('prijatelji')
def index(id):
c = baza.cursor()
c.execute("""SELECT ime, priimek FROM osebe WHERE id = ?""", [id])
oseba = c.fetchone()
if oseba ... | ZarabecB11/fejsbuk | fejsbuk.py | Python | mit | 896 |
# Django settings for protocoller project.
import os
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
ADMINS = (
('Dmitry Sukhov', 'dmitry.sukhov@gmail.com'),
)
MANAGERS = ADMINS
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(SITE_ROOT, 'db', ... | quoter/protocoller | src/protocoller/settings.py | Python | mit | 6,715 |
# there is no specific likelihood code for this experiment, because it
# falls in the category of CMB experiments described in the "newdat"
# format. The class below inherits the properties of a general class
# "Likelihood_newdat", which knows how to deal with all experiments in
# "newdat" format.
from montepython.lik... | baudren/montepython_public | montepython/likelihoods/spt/__init__.py | Python | mit | 400 |
"""
Fuctions for reading and writing Rowland NMR Toolkit (RNMRTK) files
"""
from __future__ import division
__developer_info__ = """
Information of the Rowland NMR Toolkit file format
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"""
import numpy as np
from warnings import warn
from . import fileiobase
#####... | atomman/nmrglue | nmrglue/fileio/rnmrtk.py | Python | bsd-3-clause | 22,342 |
#! /usr/bin/env python3
# Copyright (c) 2014, HashFast Technologies LLC
# 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. Redistributions of source code must retain the above copyright
# ... | Thireus/hashfast-tools | soak.py | Python | bsd-3-clause | 5,318 |
from django.conf import settings
from django.http import Http404
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
from opaque_keys.edx.keys import CourseKey
from rest_framework import parsers, permissions, status, viewsets
from rest_framework.authentication import SessionAuthenticatio... | jolyonb/edx-platform | cms/djangoapps/api/v1/views/course_runs.py | Python | agpl-3.0 | 3,833 |
# -*- coding: utf-8 -*-
# Tests ported from tests/test_models.py and tests/test_user.py
import os
import json
import datetime as dt
import urlparse
from django.utils import timezone
import mock
import itsdangerous
import pytest
import pytz
from framework.auth.exceptions import ExpiredTokenError, InvalidTokenError, Ch... | cwisecarver/osf.io | osf_tests/test_user.py | Python | apache-2.0 | 67,959 |
MAX_CACHE=8 # cache all combinators up to this length
import re
# this is used for reading in the search basis
combinator2program = {'S':'S',
'K':'K',
'I':'..SKK',
'B':'..S.KSK',
'C':'..S..S.K..S.KSKS.KK',
'W'... | piantado/pychuriso | src/combinators.py | Python | gpl-3.0 | 4,823 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | Eficent/eficent-odoo-addons-wip | hr_timesheet_report/__init__.py | Python | agpl-3.0 | 1,001 |
# 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... | ccrouch/python-tuskarclient | tuskarclient/shell.py | Python | apache-2.0 | 7,272 |
#!/usr/bin/python
#
# bashreadline Print entered bash commands from all running shells.
# For Linux, uses BCC, eBPF. Embedded C.
#
# This works by tracing the readline() function using a uretprobe (uprobes).
#
# Copyright 2016 Netflix, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")... | zaafar/bcc | tools/bashreadline.py | Python | apache-2.0 | 1,528 |
import pygtk
import gtk, gobject, cairo
import os
import math
#playstation analog stick drawing
#==================================
class Psanalog(gtk.DrawingArea):
SIZE = 48
ARCSIZE = 5
SCALE = SIZE/255.0
__gsignals__ = {"expose-event":"override"}
def __init__(self):
gtk.DrawingArea.... | pengumc/crobot | python/buttonbar.py | Python | gpl-3.0 | 4,587 |
#
# This file is part of do-mpc
#
# do-mpc: An environment for the easy, modular and efficient implementation of
# robust nonlinear model predictive control
#
# Copyright (c) 2014-2019 Sergio Lucia, Alexandru Tatulea-Codrean
# TU Dortmund. All rights reserved
#
# do-mpc is free sof... | do-mpc/do-mpc | testing/test_DIP.py | Python | lgpl-3.0 | 3,999 |
"""
Common code for NetLogger parsers
"""
__author__ = 'Dan Gunter <dkgunter@lbl.gov>'
__rcsid__ = '$Id: base.py 28287 2011-08-18 03:42:53Z dang $'
import calendar
from Pegasus.netlogger.configobj import ConfigObj, Section
import glob
import imp
from itertools import starmap
import os
from Queue import Queue, Empty
i... | elainenaomi/sciwonc-dataflow-examples | sbbd2016/experiments/1-postgres/3_workflow_full_10files_primary_nosh_nors_annot_with_proj_3s/pegasus.bDkvI/pegasus-4.6.0/lib/python2.7/dist-packages/Pegasus/netlogger/parsers/base.py | Python | gpl-3.0 | 23,291 |
import re
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from codecs import open
with open('shareplum/version.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
setup(
name=... | jasonrollins/shareplum | setup.py | Python | mit | 1,314 |
# goscale/utils/json_pretty.py
"""
Add the line to settings.py::
SERIALIZATION_MODULES = {'json-pretty': 'goscale.utils.json_pretty'}
And call dumpdata as follows::
./manage.py dumpdata --format=json-pretty <app_name>
"""
import codecs
import json
from django.core.serializers.json import Seri... | sternoru/goscalecms | goscale/utils/json_pretty.py | Python | bsd-3-clause | 680 |
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | OptoFidelity/cerbero | cerbero/bootstrap/windows.py | Python | lgpl-2.1 | 8,500 |
#
# Copyright 2017-2020 Universidad Complutense de Madrid
#
# This file is part of Megara DRP
#
# SPDX-License-Identifier: GPL-3.0+
# License-Filename: LICENSE.txt
#
"""
Interpolation method based on:
'Hex-Splines: A Novel Spline Family for Hexagonal Lattices'
van de Ville et al. IEEE Transactions on Image Processing ... | sergiopasra/megaradrp | megaradrp/processing/hexgrid.py | Python | gpl-3.0 | 2,811 |
"""
This file contains the Detection Calibration sub-class as part of the System Class
This class handles changes to detection settings that are used to detect embryos
"""
__author__ = "Corwin Perren"
__copyright__ = "None"
__credits__ = [""]
__license__ = "GPL (GNU General Public License)"
__version__ = "0.1 ... | SARL-Engineering/PickAndPlate | Interface/System/DetectionCalibration/DetectionCalibrationCore.py | Python | gpl-3.0 | 17,726 |
import struct
import array
import ipaddress
from mitmproxy.net import tcp
from mitmproxy.net import check
from mitmproxy.types import bidi
class SocksError(Exception):
def __init__(self, code, message):
super().__init__(message)
self.code = code
VERSION = bidi.BiDi(
SOCKS4=0x04,
SOCKS5=... | dwfreed/mitmproxy | mitmproxy/net/socks.py | Python | mit | 7,048 |
#!/usr/bin/env python
# Landsat Util
# License: CC0 1.0 Universal
import argparse
import textwrap
import json
from dateutil.parser import parse
import pycurl
from downloader import Downloader, IncorrectSceneId
from search import Search
from utils import reformat_date, convert_to_integer_list, timer, exit
from mixin... | recombinators/little-worker | app/landsat-util/landsat/landsat.py | Python | mit | 8,925 |
__author__ = 'ismailsunni'
from django.conf.urls import patterns, url
from geosafe.views.analysis import (
AnalysisListView,
AnalysisCreateView,
AnalysisDetailView,
impact_function_filter,
layer_tiles, layer_metadata, layer_archive, layer_list, rerun_analysis,
analysis_json, toggle_analysis_sav... | ismailsunni/geonode | geosafe/urls.py | Python | gpl-3.0 | 2,500 |
# This file is part of pybliographer
#
# Copyright (C) 1998-2004 Frederic GOBRY
# Email : gobry@pybliographer.org
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | zkota/pyblio-1.3 | Legacy/Iterator.py | Python | gpl-2.0 | 2,270 |
import datetime
import os
import sys
from sphinx_gallery.sorting import ExplicitOrder
from sphinx_gallery.sorting import NumberOfCodeLinesSortKey
sys.path.insert(0, os.path.abspath("../"))
import sparsereg
project = "Sparsereg"
copyright = "{}, Markus Quade".format(datetime.datetime.now().year)
author = "Markus Qua... | Ohjeah/sparsereg | docs/conf.py | Python | mit | 1,599 |
from haystack import indexes
from . import models
class DocumentIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True)
summary = indexes.CharField(model_attr='summary')
type_name = indexes.CharField(model_attr='type_name')
number = indexes.IntegerField(model_attr='nu... | notanumber/xapian-haystack | tests/xapian_tests/search_indexes.py | Python | gpl-2.0 | 4,979 |
from ilbagorithm import LBAlgorithm
import random
class WeightRoundRobin(LBAlgorithm):
def getServer(self,services,service):
service.incrementLastSrv()
servers = service.getServers()
server = None
for i in range(len(servers)):
server_aux = service.getServer(service.getLastSrv())
print "----------------... | whinedo/sdnlb | sdnlb/algorithms/weight_round_robin.py | Python | gpl-3.0 | 1,208 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 Malcolm Ramsay <malramsay64@gmail.com>
#
# Distributed under terms of the MIT license.
"""Test interactive bokeh configurations run."""
import subprocess
def test_interactive_null():
import statdyn.figures.interactive_config #... | malramsay64/MD-Molecules-Hoomd | test/bokeh_test.py | Python | mit | 775 |
# coding=utf-8
"""InaSAFE Disaster risk tool by Australian Aid - Metadata for Flood Vector
Impact on OSM Buildings using QGIS libraries.
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as pu... | cchristelis/inasafe | safe/impact_functions/inundation/flood_vector_building_impact/metadata_definitions.py | Python | gpl-3.0 | 4,402 |
## INFO ########################################################################
## ##
## COUBLET ##
## ======= ... | petervaro/coublet | views/stream.py | Python | mit | 3,574 |
import unittest
from conans.model.options import OptionsValues, PackageOptions, Options, PackageOptionValues,\
option_undefined_msg
from conans.model.ref import ConanFileReference
from conans.errors import ConanException
class OptionsTest(unittest.TestCase):
def setUp(self):
package_options = Package... | birsoyo/conan | conans/test/model/options_test.py | Python | mit | 12,823 |
from sfepy.base.base import *
from sfepy.base.ioutils import read_dict_hdf5, write_dict_hdf5
from sfepy.homogenization.utils import iter_sym
##
# 09.07.2007, c
class Coefficients( Struct ):
##
# 09.07.2007, c
def from_file_hdf5( filename ):
obj = Coefficients()
obj.__dict__ = read_dict_hdf... | olivierverdier/sfepy | sfepy/homogenization/coefficients.py | Python | bsd-3-clause | 8,810 |
#!/usr/bin/env python2
'''
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
"License")... | alexryndin/ambari | ambari-common/src/main/repo/install_ambari_tarball.py | Python | apache-2.0 | 8,647 |
# Copyright 2012 - 2020 Christoph Reiter, Nick Boultbee
#
# 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.
from typing i... | Mellthas/quodlibet | quodlibet/plugins/__init__.py | Python | gpl-2.0 | 17,428 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 Rackspace Hosting Inc. All Rights Reserved.
# Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | ntt-sic/taskflow | taskflow/jobs/jobboard.py | Python | apache-2.0 | 3,294 |
"""
Author: Andres Andreu < andres at neurofuzzsecurity dot com >
Company: neuroFuzz, LLC
Date: 7/25/2016
Last Modified: 8/18/2016
returns random values to be used as User-Agent ID strings
BSD 3-Clause License
Copyright (c) 2016, Andres Andreu, neuroFuzz LLC
All rights reserve... | dre/neurofuzz_toolkit | libs/nftk_useragents.py | Python | bsd-3-clause | 10,222 |
# Configure Matplotlib options
from setup_matplotlib import *
from matplotlib.ticker import MaxNLocator
from matplotlib.patches import Rectangle, FancyBboxPatch
import planckStyle as s
from pylab import *
import numpy as np
import GetDistPlots, os
import matplotlib.pyplot as plt
from matplotlib.backends.back... | zqhuang/COOP | lib/pyplot_scripts/PlanckFig_DE_pca.py | Python | gpl-3.0 | 3,973 |
from .base import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
if DEBUG:
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
else:
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# Parse database configuration from $DATABASE_URL
import dj_database_url
DATABASES['default'] = dj_database_url.confi... | azul-cloud/serendipity | settings/production.py | Python | mit | 720 |
import numpy as np
import theano.tensor as T
from pymanopt import Problem
from pymanopt.solvers import TrustRegions
from pymanopt.manifolds import Euclidean, Product
if __name__ == "__main__":
# Generate random data
X = np.random.randn(3, 100)
Y = X[0:1, :] - 2*X[1:2, :] + np.random.randn(1, 100) + 5
... | j-towns/pymanopt | examples/regression_offset_theano.py | Python | bsd-3-clause | 1,037 |
"""
================================================================================
Music theory Python package, diatonic module.
Copyright (C) 2008-2009, Bart Spaans
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
... | SIGN-UP/walkingbass | mingus/core/diatonic.py | Python | gpl-3.0 | 4,324 |
from lxml import etree
from odoo.osv import orm
from odoo.addons.base.models.ir_model import FIELD_TYPES
from odoo import models, fields, tools, api, _
from odoo.exceptions import UserError, ValidationError
class FreeSelection(fields.Selection):
def convert_to_cache(self, value, record, validate=True):
... | pledra/odoo-product-configurator | product_configurator/wizard/product_configurator.py | Python | agpl-3.0 | 39,473 |
from os.path import exists
from setuptools import setup
setup(name='logic',
version='0.1.10',
description='Logic Programming in python',
url='http://github.com/logpy/logpy',
author='Matthew Rocklin',
author_email='mrocklin@gmail.com',
license='BSD',
packages=['logpy'],
i... | cpcloud/logpy | setup.py | Python | bsd-3-clause | 483 |
print "Mary had a little lamb."
print "Its fleece was white as %s." % 'snow'
print "And everywhere that Mary went."
print "." * 10 #What'd that do?
end1 = "C"
end2 = "h"
end3 = "e"
end4 = "e"
end5 = "s"
end6 = "e"
end7 = "B"
end8 = "u"
end9 = "r"
end10 = "g"
end11 = "e"
end12 = "r"
# watch that coma at the end. try r... | neosilver-gk/lpthw | ex7.py | Python | gpl-2.0 | 543 |
# -*- encoding: utf-8 -*-
#===============================================================================
# INFINITE SQUARE WELL WITH COMPARISON WITH ANALITICAL SOLUTIONS
#-------------------------------------------------------------------------------
# The program calculates the first 4 eigenfunctions of the infinit... | frapa/compy | examples/shooting_problem.py | Python | gpl-3.0 | 1,070 |
import os
import io
import shutil
import tempfile
import unittest
from functools import partial
from pathlib import Path
from nbformat import validate
try:
from unittest.mock import patch
except ImportError:
from mock import patch
from .. import engines
from ..log import logger
from ..iorw import load_noteb... | nteract/papermill | papermill/tests/test_execute.py | Python | bsd-3-clause | 16,273 |
"""Helper functions, etc."""
__all__ = [
'DownloadError',
'download',
'form',
]
import contextlib
import logging
import pathlib
from concurrent import futures
from garage.http import clients
LOG = logging.getLogger(__name__)
_CHUNK_SIZE = 10 * 1024
class DownloadError(Exception):
pass
def dow... | clchiou/garage | py/garage/garage/http/utils.py | Python | mit | 6,625 |
import sys
import six
import numpy as np
from json import dump, load
from contextlib import contextmanager
from collections import Counter, defaultdict
from subprocess import CalledProcessError
from pysam import (
AlignmentFile, CMATCH, CINS, CDEL, CREF_SKIP, CSOFT_CLIP, CHARD_CLIP, CPAD,
CEQUAL, CDIFF)
from... | acorg/dark-matter | dark/sam.py | Python | mit | 48,541 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012, Almar Klein
#
# Visvis is distributed under the terms of the (new) BSD License.
# The full license can be found in 'license.txt'.
""" Module wibjects
All wibjects are inserted in this namespace, thereby providing
the user with a list of all wibjects. All wibjects are also... | chiluf/visvis.dev | wibjects/__init__.py | Python | bsd-3-clause | 842 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 7, transform = "Anscombe", sigma = 0.0, exog_count = 100, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_ConstantTrend/cycle_7/ar_12/test_artificial_32_Anscombe_ConstantTrend_7_12_100.py | Python | bsd-3-clause | 268 |
#!/usr/bin/env python
import Adafruit_BBIO.GPIO as GPIO
import time
red_pin = "P8_10"
green_pin = "P8_12"
blue_pin = "P8_14"
GPIO.setup(red_pin, GPIO.OUT)
GPIO.output(red_pin, GPIO.LOW)
GPIO.setup(green_pin, GPIO.OUT)
GPIO.output(green_pin, GPIO.LOW)
GPIO.setup(blue_pin, GPIO.OUT)
GPIO.output(blue_pin, GPIO.LOW)
... | swbooking/RobotMaria | snippets/rgb_led/rgb_led.py | Python | mit | 701 |
# -*- encoding: utf-8 -*-
"""
lunaport.domain.test
~~~~~~~~~~~~~~~~~~~~
descr
"""
import os
import datetime as dt
import pprint
import json
import StringIO
import copy
import itertools
pp = pprint.PrettyPrinter(indent=4).pprint
import pytz
import dateutil.parser
import msgpack
from lunapark_client.tank i... | greggyNapalm/lunaport_server | lunaport_server/domain/test.py | Python | apache-2.0 | 21,665 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | bealdav/OpenUpgrade | addons/hr_evaluation/hr_evaluation.py | Python | agpl-3.0 | 19,434 |
#
#
# Copyright (C) 2006, 2007, 2010, 2011, 2012, 2013 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
... | apyrgio/ganeti | lib/storage/drbd.py | Python | bsd-2-clause | 37,368 |
from luminescence.filesystem.yamlfile import yamlfile
from yaml.error import MarkedYAMLError
class file_spec():
def should_open_files(self):
yamlfile("test/fixtures/presentation.yaml")
def should_raise_exception_if_file_does_not_exists(self):
try:
yamlfile("test/fixtures/f... | pmatiello/luminescence | test/luminescence_spec/filesystem_spec/yamlfile_spec.py | Python | mit | 1,148 |
import re
from collections import defaultdict
from collections import Counter
import simplejson as json
from datetime import datetime
# Create a dict keyed on metric type
posts = defaultdict(list)
with open('data/altmetric_com.txt', 'r') as content_file:
i = 0
for p in content_file:
line = p.split()
... | jalperin/duplication_paper | read_altmetric.com.py | Python | gpl-2.0 | 2,429 |
#!/usr/bin/env python3
# Copyright 2021 The CFU-Playground 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 a... | google/CFU-Playground | .github/scripts/generate_ci_matrix.py | Python | apache-2.0 | 3,604 |
"""Suppoort for Amcrest IP camera binary sensors."""
from datetime import timedelta
import logging
from amcrest import AmcrestError
from homeassistant.components.binary_sensor import (
BinarySensorDevice, DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_MOTION)
from homeassistant.const import CONF_NAME, CONF_BINARY_SENSOR... | jabesq/home-assistant | homeassistant/components/amcrest/binary_sensor.py | Python | apache-2.0 | 3,618 |
#filerem
from os import *
from shutil import *
def rfile(name):
remove(name)
return
def rdir(fname):
rmtree(fname)
return
| javrikkh/pyos | newdos/filerem.py | Python | apache-2.0 | 149 |
# -*- coding: utf-8 -*-
from openerp.osv import fields, osv
class AccountPaymentConfig(osv.TransientModel):
_inherit = 'account.config.settings'
_columns = {
'module_payment_transfer': fields.boolean(
'Wire Transfer',
help='-This installs the module payment_transfer.'),
... | orchidinfosys/odoo | addons/payment/models/res_config.py | Python | gpl-3.0 | 1,197 |
import oauth
from djpcms.contrib.social import OAuthProvider
DEFAULT_GOOGLE_SCOPE_SERVICES = ['http://finance.google.com/finance/feeds/']
class Google(OAuthProvider):
REQUEST_TOKEN_URL = 'https://www.google.com/accounts/OAuthGetRequestToken'
AUTHORIZATION_URL = 'https://www.google.com/accounts/OAuthAuthori... | strogo/djpcms | djpcms/contrib/social/providers/google.py | Python | bsd-3-clause | 1,085 |
# Copyright 2015 Metaswitch Networks
#
# 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 w... | Symmetric/calico-docker | calico_containers/calico_ctl/pool.py | Python | apache-2.0 | 3,637 |
"""
Copyright (c) 2015 SONATA-NFV
ALL RIGHTS RESERVED.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | sonata-nfv/son-qual | qual-stress-mano-framework/son-stress-mano/setup.py | Python | apache-2.0 | 2,634 |
# GridCal
# Copyright (C) 2022 Santiago Peñate Vera
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This pr... | SanPen/GridCal | src/GridCal/Engine/Devices/load.py | Python | lgpl-3.0 | 9,713 |
# Copyright 2015 Google 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/LICENSE-2.0
#
# Unless required by applicable law or a... | sachinpro/sachinpro.github.io | tensorflow/python/ops/variable_scope.py | Python | apache-2.0 | 47,372 |
__author__ = 'ross'
import ConfigParser
class config:
def __init__(self):
self.site_refresh_time = 10 # 10 seconds default
self.hb_danger_time = 60 # 60 seconds default
self.hb_warning_time = 30 # 30 seconds default
self.hb_dead_time = 86400 # 1 day default (86400 seconds)
... | RossBarnie/rmt | web/server/config.py | Python | gpl-2.0 | 2,245 |
import unittest
import idlelib.CallTips as ct
CTi = ct.CallTips() # needed for get_entity test in 2.7
import textwrap
import types
import warnings
default_tip = ''
# Test Class TC is used in multiple get_argspec test methods
class TC(object):
'doc'
tip = "(ai=None, *args)"
def __init__(self,... | nmercier/linux-cross-gcc | win32/bin/Lib/idlelib/idle_test/test_calltips.py | Python | bsd-3-clause | 7,325 |
from couchpotato.core.downloaders.base import Downloader
from couchpotato.core.helpers.encoding import isInt
from couchpotato.core.logger import CPLog
import json
import requests
import traceback
log = CPLog(__name__)
class Synology(Downloader):
protocol = ['nzb', 'torrent', 'torrent_magnet']
log = CPLog(__... | lebabouin/CouchPotatoServer-develop | couchpotato/core/downloaders/synology/main.py | Python | gpl-3.0 | 5,726 |
# Generated by Django 2.0.5 on 2018-05-31 10:51
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [("payments", "0003_auto_20180418_1512")]
operations = [
migrations.RenameField... | lafranceinsoumise/api-django | agir/payments/migrations/0004_auto_20180531_1251.py | Python | agpl-3.0 | 1,343 |
"""
This platform provides support for sensor data from RainMachine.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.rainmachine/
"""
import logging
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatc... | jamespcole/home-assistant | homeassistant/components/rainmachine/sensor.py | Python | apache-2.0 | 2,697 |
__author__ = "Andrey Nikishaev"
__copyright__ = "Copyright 2010, http://creotiv.in.ua"
__license__ = "GPL"
__version__ = "0.3"
__maintainer__ = "Andrey Nikishaev"
__email__ = "creotiv@gmail.com"
__status__ = "Production"
"""
Simple local cache.
It saves local data in singleton dictionary with convenient interface
Exa... | ActiveState/code | recipes/Python/577492_Simple_local_cache_cache/recipe-577492.py | Python | mit | 2,724 |
from .models import XFormsSession, XFORMS_SESSION_SMS
from datetime import datetime
from corehq.apps.cloudcare.touchforms_api import get_session_data
from touchforms.formplayer.api import (
XFormsConfig,
DigestAuth,
get_raw_instance,
InvalidSessionIdException,
)
from touchforms.formplayer import sms as ... | SEL-Columbia/commcare-hq | corehq/apps/smsforms/app.py | Python | bsd-3-clause | 7,366 |
from elasticsearch import Elasticsearch
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib.dates import AutoDateLocator, AutoDateFormatter
import numpy as np
import datetime as dt
import math
import json
import pprint
with open("config", "r+") as txt:
contents = li... | robogen/CMS-Mining | RunScripts/es_kevent.py | Python | mit | 4,748 |
import unittest
"""
Given n non negative integers representing an elevation map where width of each bar is 1,
compute how much water it is able to trap after raining.
Input: 2 0 2
Output: 2
Input: 3 0 0 2 0 4
Output: 10
"""
"""
Approach:
1. A bar can store water if there are taller bars to its left and right.
2. We ca... | prathamtandon/g4gproblems | Arrays/trapping_rain_water.py | Python | mit | 1,387 |
"""
URL mapping for user interface.
"""
from django.conf import settings
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.contrib.staticfiles.views import serve
from django.views.generic import TemplateView
from ui.views import HowView
urlpatterns = [
url(r'... | btimby/cloudstrype | web/cloudstrype/ui/urls.py | Python | mit | 792 |
#!/home/squirrel/virtualenvs/cosy_env/bin/python
"""
Test Call Script for cosy
@Author:
@Date:
"""
################## Packages #################################### Packages #################################### Variables ##################
import sys
sys.path.append("/home/squirrel/dev/cosy/cosy") # append python p... | jobcpf/cosy | bin/testcosy.py | Python | bsd-3-clause | 1,922 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to us... | EmanueleCannizzaro/scons | test/CC/SHCC.py | Python | mit | 2,436 |
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask import current_app
from flask.ext.login import UserMixin
from . import db, login_manager
class Role(db.Model):
__tablename__ = 'roles'
id = db.Column(db.I... | ZhuangER/Flask-Gallery | app/models.py | Python | mit | 2,041 |
def generate(fname='/etc/passwd'):
"""``chmod`` like a UNIX command with mask ``0777``
Args:
fname(str): file name
"""
sc = """
mov r0, pc
add r0, #12
mov r1, #255
add r1, #255
add r1, #1
mov r7, #15
svc 1
b after_1
chmod_1:
.asciz "%s\x00"
after_1:
""" %... | sigma-random/ARMSCGen | shellcodes/thumb/chmod.py | Python | gpl-2.0 | 343 |
#! /usr/bin/python
#coding=utf-8
import os
import struct
file1 = "classes.dex"
file2 = "classescp.dex"
f1 = open(file1, 'rb')
f2 = open(file2, 'rb')
# f1.seek(709456)
end = 580208
start = 580208
# f2.seek(start)
len1 = os.path.getsize(file1)
len2 = os.path.getsize(file2)
if len1 < len2:
len = len... | peterdocter/DexParse | diff.py | Python | apache-2.0 | 646 |
from distutils.core import setup
from distutils.extension import Extension
import numpy as np
try:
from Cython.Build import cythonize
except ImportError:
use_cython = False
ext = 'c'
else:
use_cython = True
ext = 'pyx'
filenames = [ "base",
"BayesianNetwork",
"FactorGra... | Geoion/pomegranate | setup.py | Python | mit | 1,432 |
from pygenius import *
#Bambu's Golden Era Shower
#s = song.song(489522)
#Cool Calm Pete's 2 A.M.
#s = song.song(255949)
#Blue Scholar's Sagab
s = song(3893)
#prints the song title
print s.name
#prints the lyrics
for i in s.lyrics:
print i
#concatenate the lyrics into one string
str = cat_lyrics(s)
print str
... | aorti017/pygenius | example.py | Python | bsd-3-clause | 890 |
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'myGates.views.home_view'),
url(r'^login/$', 'myGates.views.loginview'),
url(r'^a... | anywonder/piGates | myGates/urls.py | Python | apache-2.0 | 2,458 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2016 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 2 of the
# License, or (at your option) any later... | nikpap/inspire-next | tests/unit/dojson/test_dojson_dois.py | Python | gpl-2.0 | 3,169 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/polyaxon/polyaxonfile/manager/workflows.py | Python | apache-2.0 | 5,178 |
from __future__ import unicode_literals
import glob
import gzip
import os
import warnings
import zipfile
from itertools import product
from django.apps import apps
from django.conf import settings
from django.core import serializers
from django.core.exceptions import ImproperlyConfigured
from django.core.management.b... | bretlowery/snakr | lib/django/core/management/commands/loaddata.py | Python | bsd-3-clause | 12,973 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2016 by Wilbert Berendsen
#
# 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
... | dliessi/frescobaldi | frescobaldi_app/documenttooltip.py | Python | gpl-2.0 | 4,790 |
import os
from unittest import mock
import pytest
from testfixtures import ShouldRaise
from testfixtures import StringComparison as S
import pgctl.config as C
class example1:
config = C.Config('example1')
ini = '''\
[example1]
pgdir = mypgdir
pgconf = my.conf
services_list =
first
second
third
... | Yelp/pgctl | tests/unit/config.py | Python | mit | 7,253 |
import argparse
from goetia import libgoetia
from goetia.dbg import dBG
from goetia.hashing import StrandAware, FwdLemireShifter, CanLemireShifter
from goetia.parsing import iter_fastx_inputs, get_fastx_args
from goetia.storage import *
from goetia.timer import measure_time
parser = argparse.ArgumentParser()
group = ... | camillescott/boink | benchmarks/benchmark-dbg-insert.py | Python | mit | 1,086 |
"""Constants for the Adax integration."""
from typing import Final
ACCOUNT_ID: Final = "account_id"
DOMAIN: Final = "adax"
| Danielhiversen/home-assistant | homeassistant/components/adax/const.py | Python | apache-2.0 | 124 |
import configparser
import os
import pathlib
import shutil
import sys
def install_gdsdiff() -> None:
home = pathlib.Path.home()
git_config_path = home / ".gitconfig"
git_attributes_path = home / ".gitattributes"
if git_config_path.exists():
git_config_str = open(git_config_path).read()
el... | gdsfactory/gdsfactory | gdsfactory/install.py | Python | mit | 3,210 |
# Copyright 2013 Max Bittman, Barath Raghavan, De Novo Group, et al.
#
# 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... | denovogroup/pox | pox/pilo/__init__.py | Python | apache-2.0 | 757 |
import os,glob
filenames = [os.path.splitext(os.path.basename(f))[0] for f in glob.glob(os.path.dirname(__file__)+"/*.py")]
filenames.remove('__init__')
__all__ = filenames
| jchristman/PyDA | disassembler/formats/__init__.py | Python | bsd-3-clause | 173 |
# Online training of a logistic regression model
# using Assumed Density Filtering (ADF).
# We compare the ADF result with MCMC sampling
# of the posterior distribution
# Dependencies:
# !pip install git+https://github.com/blackjax-devs/blackjax.git
# !pip install jax_cosmo
# Author: Gerardo Durán-Martín (@gerdm)... | probml/pyprobml | scripts/dummy.py | Python | mit | 6,950 |
import os
import sys
import subprocess
from config import gen_config as gc
from scripts.export.genomes import genome_fetch as gf
"""
A collection of functions to validate files with a new genome download
"""
# -----------------------------------------------------------------------------
def validate_sequence_file... | Rfam/rfam-production | utils/genome_validation.py | Python | apache-2.0 | 3,312 |
__author__ = "Andre Merzky"
__copyright__ = "Copyright 2012-2013, The SAGA Project"
__license__ = "MIT"
""" Provides a number of call decorators. """
import re
import inspect
import saga.exceptions as se
import saga.task as st
# ------------------------------------
# decorator, which switches method t... | PanDAWMS/pilot | saga/adaptors/cpi/decorators.py | Python | apache-2.0 | 4,143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.