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 math import pi, cos, sin
from random import random
class Point:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
filename = "sphere.vtk"
f = open(filename, "w")
print(filename)
vp = []
for i in range(10000):
z = random() * 2.0 - 1.0
s = random() * 2.0 * pi
... | kaityo256/paraview-sample | unstructured/sphere.py | Python | mit | 787 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# hashsync documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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
# au... | catlee/hashsync | docs/conf.py | Python | bsd-3-clause | 8,396 |
# -*- coding: utf-8 -*-
"""
Master logic to combine sequence_generator_logic and pulsed_measurement_logic to be
used with a single GUI.
QuDi 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... | drogenlied/qudi | logic/pulsed_master_logic.py | Python | gpl-3.0 | 45,610 |
"""Treadmill docker authz REST api.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import http.client
import flask
import flask_restplus as restplus
_URL = 'AuthZPlugin.AuthZRes'
def init(api, co... | Morgan-Stanley/treadmill | lib/python/treadmill/rest/api/docker_authz/authzres.py | Python | apache-2.0 | 1,151 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gregdek/ansible | lib/ansible/modules/network/f5/bigip_asm_policy_fetch.py | Python | gpl-3.0 | 21,007 |
from __future__ import absolute_import, division, print_function, unicode_literals
from aspen import renderers
class Renderer(renderers.Renderer):
def render_content(self, context):
return eval(self.compiled, globals(), context)
class Factory(renderers.Factory):
Renderer = Renderer
| eXcomm/gratipay.com | gratipay/renderers/eval_.py | Python | cc0-1.0 | 303 |
"""
Demo6 GameState
"""
import RoguePy.State.GameState as GameState
from RoguePy.Input import Keys
from RoguePy.UI import Elements
from RoguePy.libtcod import libtcod
class Demo6(GameState):
def __init__(self, name, manager):
super(self.__class__, self).__init__(name, manager)
def beforeLoad(self):
... | v4nz666/7drl2017 | RoguePy/Demo/GameStates/Demo6.py | Python | gpl-3.0 | 2,409 |
#!/usr/bin/env python3
import nikola.nikola
import os.path
import glob
used = []
exist = []
for tr in nikola.nikola.LEGAL_VALUES['TRANSLATIONS']:
if isinstance(tr, tuple):
used.append(tr[0])
used.append(tr)
for file in glob.glob(os.path.join('nikola', 'data', 'themes', 'base',
... | gwax/nikola | scripts/langstatus.py | Python | mit | 666 |
# Part of Cosmos by OpenGenus Foundation
# Python program for counting sort
# The main function that sort the given string arr[] in
# alphabetical order
def countSort(arr):
# The output character array that will have sorted arr
output = [0 for i in range(256)]
# Create a count array to store count of... | Jecoms/cosmos | code/sorting/counting_sort/countsort.py | Python | gpl-3.0 | 1,216 |
import logging
import os
import sys
import codecs
import json
from time import time
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from nose.plugins import Plugin
from nose.plugins.xunit import id_split, nice_classname, format_exception, exc_message, Tee
from nose.exc import Ski... | 2gis/lode_runner | lode_runner/plugins/json_reporter.py | Python | mpl-2.0 | 5,261 |
from __future__ import unicode_literals
import frappe
from frappe.data_migration.doctype.data_migration_connector.connectors.base import BaseConnection
import googleapiclient.discovery
import google.oauth2.credentials
from googleapiclient.errors import HttpError
import time
from datetime import datetime
from frappe.uti... | ESS-LLP/frappe | frappe/data_migration/doctype/data_migration_connector/connectors/calendar_connector.py | Python | mit | 8,438 |
from bluetooth import *
nearby_devices = discover_devices()
for device in nearby_devices:
print("%s - %s" % (lookup_name(device), device))
| zach-king/Python-Miscellaneous | Bluetooth/showdevices.py | Python | gpl-2.0 | 145 |
from . import sheet_geometry
| CellModels/tyssue | tyssue/geometry/__init__.py | Python | gpl-2.0 | 29 |
# proxy module
from __future__ import absolute_import
from apptools.appscripting.package_globals import *
| enthought/etsproxy | enthought/appscripting/package_globals.py | Python | bsd-3-clause | 106 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
from datetime import datetime, timedelta
import time
from sqlalchemy import Table, Column, Integer, Float, Unicode, DateTime, Date, func
from sqlalchemy.ext... | qk4l/Flexget | flexget/plugins/internal/api_bluray.py | Python | mit | 9,392 |
#!/usr/bin/python
# ---------------------------------------------------------------------
# ___ ___ _ ____
# / _ \/ _ \(_) __/__ __ __
# / , _/ ___/ /\ \/ _ \/ // /
# /_/|_/_/ /_/___/ .__/\_, /
# /_/ /___/
#
# bh1750.py
# Read data from a BH1750 digital light sensor.
#
# Author : Ma... | ThomasHangstoerfer/pyHomeCtrl | bh1750.py | Python | apache-2.0 | 2,676 |
# The Nexus software is licensed under the BSD 2-Clause license.
#
# You should have recieved a copy of this license with the software.
# If you did not, you can find one at the following link.
#
# http://opensource.org/licenses/bsd-license.php
entitylist.append(["testbow",(x,y,z),8,8,None])
self.client.sendServerMes... | TheArchives/Nexus | core/entities/testbow_create.py | Python | bsd-2-clause | 356 |
# Copyright (C) 2013-2016 2ndQuadrant Italia Srl
#
# This file is part of Barman.
#
# Barman 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... | hareevs/pgbarman | tests/test_infofile.py | Python | gpl-3.0 | 19,981 |
from __future__ import absolute_import
import json
import logging
from uuid import uuid4
from dateutil.parser import parse
from cassandra.cqlengine import columns, models
# from scrapi import events
# from scrapi import database # noqa
# from scrapi.util import copy_to_unicode
# from scrapi.processing.base import ... | kmjungersen/BenchmarkDB | BenchmarkDB/cassandradb/utils/_cassandra.py | Python | mit | 5,980 |
import re
from urllib.parse import urljoin
from sickchill import logger
from sickchill.helper.common import try_int
from sickchill.oldbeard import tvcache
from sickchill.oldbeard.bs4_parser import BS4Parser
from sickchill.providers.torrent.TorrentProvider import TorrentProvider
class Provider(TorrentProvider):
... | Vagab0nd/SiCKRAGE | sickchill/oldbeard/providers/horriblesubs.py | Python | gpl-3.0 | 6,132 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('artbot_website', '0002_auto_20160109_0625'),
]
operations = [
migrations.AddField(
model_name='event',
... | coreymcdermott/artbot | artbot_website/migrations/0003_auto_20160222_0746.py | Python | mit | 930 |
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | openstack/sahara | sahara/service/edp/binary_retrievers/sahara_db.py | Python | apache-2.0 | 937 |
import numpy as np
import dipsim.util as util
class Illuminator:
"""An Illuminator is specified by its illumination type (wide, sheet),
optical axis, numerical aperture, index of refraction of the sample, and
polarization.
"""
def __init__(self, illum_type='wide', theta_optical_axis=0, na=0.8,
... | talonchandler/dipsim | dipsim/illuminator.py | Python | mit | 1,561 |
from __future__ import division
PKG='test_controller'
import unittest
from diff_drive.mock_robot import MockRobot
class TestMockRobot(unittest.TestCase):
def setUp(self):
self.robot = MockRobot()
def testNoMotion(self):
self.robot.updateRobot(1)
ticks = self.robot.getTicks()
... | merose/diff_drive | tests/test_mock_robot.py | Python | bsd-3-clause | 1,587 |
from sklearn import datasets, svm
digits = datasets.load_digits()
X_digits = digits.data
y_digits = digits.target
svc = svm.SVC(C=1, kernel='linear')
score = svc.fit(X_digits[:-100], y_digits[:-100]).score(X_digits[-100:], y_digits[-100:])
print(score)
# split the data in folds that we use for training and testing
#... | Og192/Python | sklearnLearning/modelSelection/scoreAndCress-validated.py | Python | gpl-2.0 | 785 |
# -*- coding: utf-8 -*-
# Copyright 2013 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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 you... | unioslo/cerebrum | Cerebrum/modules/no/Indigo/bofhd_go_help.py | Python | gpl-2.0 | 1,063 |
import ael
import acm
import stat
import time
import shutil
import string
import HTI_functions
import HTI_DB_Functions
import datetime
from datetime import date
future_month_code_array = ['F','G','H','J','K','M','N','Q','U','V','X','Z']
call_month_code_array = ['A','B','C','D','E','F','G','H','I','J','K','L']
put_mont... | frederick623/HTI | fa_util_py/HTI_FeedTrade_EDD_Util.py | Python | apache-2.0 | 114,684 |
""" This module implements features specific for POP Processing """
# Michael Cohen <scudette@users.sourceforge.net>
# Gavin Jackson <Gavz@users.sourceforge.net>
#
# ******************************************************
# Version: FLAG $Version: 0.87-pre1 Date: Thu Jun 12 00:48:38 EST 2008$
# ************************... | backupManager/pyflag | src/plugins_old/NetworkForensics/ProtocolHandlers/POP.py | Python | gpl-2.0 | 9,518 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2013 CERN.
#
# Invenio 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 th... | zenodo/invenio | invenio/modules/formatter/format_elements/bfe_meta_opengraph_video.py | Python | gpl-2.0 | 5,334 |
#!/usr/bin/env python
import socket
TCP_IP = ''
TCP_PORT = 5005
BUFFER_SIZE = 1024
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((TCP_IP, TCP_PORT))
s.listen(1)
conn, addr = s.accept()
print 'Starting'
print 'Connection address:', addr
while 1:
data = conn.recv(BUFFER_SIZE)
if not data: break... | MichaelCoughlinAN/Odds-N-Ends | Python/test_server.py | Python | gpl-3.0 | 376 |
import os
import unittest
import numpy as np
from ..util import neighbor_equality
from ..weights import W
from .. import user
from ... import examples as pysal_examples
class Testuser(unittest.TestCase):
def setUp(self):
self.wq = user.queen_from_shapefile(
pysal_examples.get_path("columbus.sh... | sjsrey/pysal_core | pysal_core/weights/tests/test_user.py | Python | bsd-3-clause | 8,208 |
#!/usr/bin/python
import os, sys
#specify the location of ncs.py in ncs_lib_path
ncs_lib_path = ('../../../../')
sys.path.append(ncs_lib_path)
import ncs
def run(argv):
sim = ncs.Simulation()
regular_spiking_parameters = sim.addNeuron("regular_spiking","izhikevich",
{
"a": 0.02,
"b": 0.2,
... | BrainComputationLab/ncs | python/samples/models/izh/regular_spiking_izh.py | Python | bsd-2-clause | 938 |
from gpc.gpc import *
from gpc import spec_reader
def main():
log = Log('log')
storage = Storage('storage')
graph = spec_reader.graph_from_spec('simple.yaml')
runner = Runner(log, storage, graph)
runner.make('c')
responsible_runs = log.get_provenance(digest_file('c'))
print('The file ... | rasmuse/graph-prov-test | test.py | Python | lgpl-3.0 | 482 |
from setuptools import setup
import os
setup(
name='fbterminal',
version='0.2.1',
description='Access Facebook on Terminal',
packages=['fbterminal'],
license='MIT',
author='Akash Kothawale',
author_email='io@decached.com',
url='http://decached.com/fbterminal',
install_requires='reque... | decached/fbterminal | setup.py | Python | mit | 564 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
import time
from datetime import datetime, date, ... | ingadhoc/odoo-nautical | nautical_x/craft.py | Python | agpl-3.0 | 17,753 |
from datetime import datetime
from dateutil.tz import tzlocal
import json as _json
import dateutil.parser
def parse_date(datestr):
""" Parses an ISO 8601 formatted date from Gophish """
return dateutil.parser.parse(datestr)
class Model(object):
def __init__(self):
self._valid_properties = {}
... | GoSecure/api-client-python | gophish/models.py | Python | mit | 11,653 |
# PYTHON_VERSION>=3.7
from __future__ import annotations
from dataclasses import dataclass
from dataclasses import field
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import TYPE_CHECKING
from sqlalchemy import Column
from sqlalchemy import ForeignKey
... | sqlalchemy/sqlalchemy | test/ext/mypy/plugin_files/dataclasses_workaround.py | Python | mit | 1,848 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
from setuptools import setup
from setuptools import find_packages
from docs import getVersion
# Variables ==============================================... | WebArchivCZ/WA-KAT | setup.py | Python | mit | 1,679 |
import unittest
import decimal
import ddt
from mock import patch
from django.conf import settings
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from xmodule.modulestore.tests.django_utils import (
ModuleStoreTestCase, mixed_store_config
)
from util.testing import Url... | olexiim/edx-platform | common/djangoapps/course_modes/tests/test_views.py | Python | agpl-3.0 | 12,383 |
import flickrapi
import json
import csv
from datetime import date, timedelta
api_key = 'API-KEY'
api_secret = 'SECRET-KEY'
csv_path = 'flickr_helsinki.csv'
class Image:
def __init__(self, photo_id, lat, lon):
self.photo_id = photo_id
self.lat = lat
self.lon = lon
self.url = ''
def setImag... | jlevente/link-vgi | workshop/case_study/flickr.py | Python | gpl-3.0 | 1,576 |
import mandrill
import os
import logging
import jinja2
from totalimpactwebapp.testing import is_test_email
logger = logging.getLogger("ti.emailer")
def send(address, subject, template_name, context):
if is_test_email(address):
return False
templateLoader = jinja2.FileSystemLoader(searchpath="totali... | Impactstory/total-impact-webapp | emailer.py | Python | mit | 1,160 |
# Copyright 2018 WolkAbout Technology s.r.o.
#
# 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 l... | Wolkabout/WolkConnect-Python- | wolk/models/ActuatorStatus.py | Python | apache-2.0 | 1,190 |
from wikipediabase.util import get_article
def sort_by_length(*args):
key = lambda a: len(' '.join(get_article(a).paragraphs()))
return sorted(args, reverse=True, key=key)
def sort_named(named, *args):
# TODO: clean up, this was directly translated from Ruby WikipediaBase
article_lengths = {}
fo... | fakedrake/WikipediaBase | wikipediabase/sort_symbols.py | Python | apache-2.0 | 1,035 |
# -*- coding: utf-8 -*-
#
# This file is part of EUDAT B2Share.
# Copyright (C) 2016 CERN.
#
# B2Share 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... | emanueldima/b2share | b2share/modules/communities/errors.py | Python | gpl-2.0 | 1,826 |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
import os
from functools import partial
from collections import namedtuple
from time import sleep
from powerline.segments import shell, tmux, pdb, i3wm
from powerline.lib.vcs import get_fallb... | lukw00/powerline | tests/test_segments.py | Python | mit | 75,312 |
from unittest import TestCase
from StringIO import StringIO
from corehq.blobs.atomic import AtomicBlobs
from corehq.blobs.exceptions import InvalidContext, NotFound
from corehq.blobs.tests.util import TemporaryFilesystemBlobDB
class TestFilesystemBlobDB(TestCase):
@classmethod
def setUpClass(cls):
c... | qedsoftware/commcare-hq | corehq/blobs/tests/test_atomic.py | Python | bsd-3-clause | 1,865 |
import csv
import json
class UserSettings(object):
@staticmethod
def save_settings(new_settings):
f = open('settings.csv', "wb")
w = csv.writer(f)
for key, val in new_settings.items():
w.writerow([key, val])
f.close()
@staticmethod
def read_settings():
... | valuko/team_st33ve | settings.py | Python | mit | 1,207 |
#!/usr/bin/python
import unittest
import common
from autotest_lib.client.common_lib import error, utils
from autotest_lib.client.common_lib.test_utils import mock
from autotest_lib.client.common_lib.hosts import base_classes
class test_host_class(unittest.TestCase):
def setUp(self):
self.god = mock.mock... | wuzhy/autotest | client/common_lib/hosts/base_classes_unittest.py | Python | gpl-2.0 | 1,372 |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... | liosha2007/temporary-groupdocs-python3-sdk | groupdocs/models/TemplateFieldsResponse.py | Python | apache-2.0 | 1,158 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# -----------------------
# ----- rcmanager -----
# -----------------------
# An ICE component manager.
#
# Copyright (C) 2009-2015 by RoboLab - University of Extremadura
#
# This file is part of RoboComp
#
# RoboComp is free software: you can redistribute... | Kmayankkr/robocomp | tools/rcmanagerSimple/rcmanagersimple.py | Python | gpl-3.0 | 30,207 |
ISSUE = """\
- Bitbucket: https://bitbucket.org/{repo}/issue/{id}
- Originally reported by: {user}
- Originally created at: {created_on}
{body}
"""
COMMENT = """Original comment by {user}
{body}"""
def format_user(user_data, usermap):
if user_data is None:
return "Anonymous"
assert isinstance(us... | RonnyPfannschmidt/bitbucket_issue_migration | src/migrate_to_github/formating.py | Python | gpl-3.0 | 1,727 |
# -*- coding: utf-8 -*-
import codecs
import os
from mock import patch
import time
import unittest
from twisted.python.compat import long
from landscape.lib import testing
from landscape.lib.fs import append_text_file, append_binary_file, touch_file
from landscape.lib.fs import read_text_file, read_binary_file
clas... | CanonicalLtd/landscape-client | landscape/lib/tests/test_fs.py | Python | gpl-2.0 | 6,532 |
# -*- coding: utf-8 -*-
"""
Extensions to the argparse library for calmjs.
a.k.a. nyanpasu
"""
from __future__ import absolute_import
import argparse
import sys
import textwrap
from functools import partial
from os import linesep
from os.path import pathsep
from argparse import _
from argparse import Action
from arg... | calmjs/calmjs | src/calmjs/argparse.py | Python | gpl-2.0 | 9,195 |
'''Persistent token cache management for the Flickr API'''
import os.path
import logging
logging.basicConfig()
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.INFO)
__all__ = ('TokenCache', 'SimpleTokenCache')
class SimpleTokenCache(object):
'''In-memory token cache.'''
def __init__(self):
... | jwheare/digest | lib/flickrapi/tokencache.py | Python | bsd-3-clause | 2,638 |
from collections import Counter
from datetime import timedelta as td
from itertools import tee
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.db.models import Count
from django.http import HttpResponseBadRequest, HttpR... | BetterWorks/healthchecks | hc/front/views.py | Python | bsd-3-clause | 12,979 |
# Copyright 2021, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | google-research/mint | mint/core/multi_modal_model.py | Python | apache-2.0 | 2,064 |
#
# instdata.py - central store for all configuration data needed to install
#
# Erik Troan <ewt@redhat.com>
#
# Copyright 2001-2007 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public License
# al... | sergey-senozhatsky/anaconda-11-vlan-support | instdata.py | Python | gpl-2.0 | 10,561 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gstmanager.sbins.source import AudioSource
class AudioTestSource(AudioSource):
def __init__(self):
self.description = "Audio test Source class, generates 440Hz tone"
self.type = "audio"
sbin = "audiotestsrc"
AudioSource.__init__(se... | lucasa/landell_gst-gengui | sltv/gstmanager/sbins/sources/audiotest.py | Python | gpl-2.0 | 330 |
''' Mock implementations of the Data and DataFactory classes. '''
from smcity.models.data import Data, DataFactory
class MockData:
''' Mock implementation of the data class. '''
def __init__(self, data):
self.data = data
def get_content(self):
return self.data['content']
def get_dat... | ChaseSnapshot/smcity | smcity/models/test/mock_data.py | Python | unlicense | 1,636 |
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import datetime
def roundTimeDT(dt=None, dateDelta=None):
"""Round a datetime object to a multiple of a timedelta
:param dt: datetime.datetime object, default now.
:param dateDelta: timedelta object, we round ... | OCA/sale-workflow | sale_product_seasonality/utils.py | Python | agpl-3.0 | 1,102 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2013 Hector Martin "marcan" <hector@marcansoft.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 2 or vers... | yacoob/blitzloop | blitzloop/ffmsvideo.py | Python | gpl-2.0 | 4,227 |
from .wrapper import external_call
| crevetor/vcrwrapper | vcrwrapper/__init__.py | Python | gpl-2.0 | 35 |
# Copyright 2012-2019 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agree... | mesonbuild/meson | mesonbuild/compilers/mixins/xc16.py | Python | apache-2.0 | 4,081 |
#
# BitBake Toaster Implementation
#
# Copyright (C) 2013 Intel Corporation
#
# SPDX-License-Identifier: GPL-2.0-only
#
from __future__ import unicode_literals
from django.db import models, IntegrityError, DataError
from django.db.models import F, Q, Sum, Count
from django.utils import timezone
from django.uti... | schleichdi2/OPENNFR-6.3-CORE | bitbake/lib/toaster/orm/models.py | Python | gpl-2.0 | 69,776 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2017-09-06 22:08
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('ringapp', '0039_auto_20170216_1220'),
... | rschwiebert/RingApp | ringapp/migrations/0040_auto_20170906_2208.py | Python | mit | 962 |
# Copyright 2017 Tecnativa - Vicent Cubells
# Copyright 2020 Tecnativa - João Marques
# Copyright 2020 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.exceptions import ValidationError
from odoo.tests import common
class TestResPartnerRefUnique(common.Savepoi... | OCA/partner-contact | partner_ref_unique/tests/test_res_partner_ref.py | Python | agpl-3.0 | 4,681 |
# -*- coding: UTF-8 -*-
import gettext
import locale
import os
from Tools.Directories import SCOPE_LANGUAGE, resolveFilename
from time import time, localtime, strftime
LPATH = resolveFilename(SCOPE_LANGUAGE, "")
Lpackagename = "enigma2-locale-"
class Language:
def __init__(self):
gettext.install('enigma2', resol... | wetek-enigma/enigma2 | lib/python/Components/Language.py | Python | gpl-2.0 | 7,837 |
"""
components.verisure
~~~~~~~~~~~~~~~~~~~
Provides support for verisure components.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/verisure/
"""
import logging
import time
from datetime import timedelta
from homeassistant import bootstrap
from homeas... | nnic/home-assistant | homeassistant/components/verisure.py | Python | mit | 5,074 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
__author__ = "Bharat Medasani"
__copyright__ = "Copyright 2013, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "bkmedasani@lbl.gov"
__date__ = "Aug 2, 2013"
import os... | gmatteo/pymatgen | pymatgen/io/tests/test_zeopp.py | Python | mit | 11,239 |
../../../../../share/pyshared/twisted/test/reflect_helper_IE.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/twisted/test/reflect_helper_IE.py | Python | gpl-3.0 | 63 |
# Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import os
import flask
from digits import utils
from digits.utils.routing import request_wants_json
from digits.webapp import app, scheduler, autodoc
from digits.dataset import tasks
from forms import ImageClassificationDatasetForm
from job import ... | DESHRAJ/DIGITS | digits/dataset/images/classification/views.py | Python | bsd-3-clause | 9,125 |
# To experiment with this code freely you will have to run this code locally.
# We have provided an example json output here for you to look at,
# but you will not be able to run any queries through our UI.
# Importing the needed libraries
import json
import requests
# URL to use
URL = " http://musicbrainz.org/ws/2/... | eneskemalergin/MongoDB | Lesson1/musicbrainz.py | Python | mit | 1,650 |
#!/usr/bin/env python
# Class Based implementation of the BHS calendar
from datetime import datetime as dt
from datetime import timedelta as td
import csv, re
from icalendar import Calendar, Event
# What period is at what time? eg. period 1 from 8:40 - 9:45
from new_schedule_times import reg, l1, l2, l3, l4, l5, lunc... | alphydan/bhs-ical | new-bhs-cal/import_fun_and_stats.py | Python | gpl-2.0 | 13,512 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __openerp__.p... | emgirardin/compassion-modules | sbc_compassion/tests/test_tools.py | Python | agpl-3.0 | 5,172 |
import argparse
import codecs
import locale
import sys
from . import render
locale.setlocale(locale.LC_ALL, "")
def main():
parser = argparse.ArgumentParser(description="renders reStructuredText")
parser.add_argument("source",
nargs="?",
help="file to open and render",
)
args = par... | dstufft/recliner | recliner/__main__.py | Python | bsd-2-clause | 638 |
import os
import logging
from flask import Flask, abort, g
from config import config
from api_v1 import bp as api_v1_bp
from ui import bp as ui_bp
app = Flask(__name__)
app.config.from_object(config)
app.register_blueprint(api_v1_bp, url_prefix='/api/v1')
app.register_blueprint(ui_bp, url_path='/')
@app.before_fi... | sivel/sai | sai/__init__.py | Python | apache-2.0 | 978 |
# vim: set fileencoding=utf-8
from unittest import TestCase
from mock import patch
from regparser.layer.terms import ParentStack, Terms
from regparser.layer.def_finders import Ref
from regparser.tree.struct import Node
import settings
class LayerTermTest(TestCase):
def setUp(self):
self.original_ignores... | cmc333333/regulations-parser | tests/layer_terms_tests.py | Python | cc0-1.0 | 20,193 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
import Components.Netlink
import enigma
import os
class NetlinkReader():
def __init__(self):
from twisted.internet import reactor
self.nls = Components.Netlink.NetlinkSocket()
reactor.addReader(self)
def fileno... | atvcaptain/enigma2 | lib/python/Components/InputHotplug.py | Python | gpl-2.0 | 1,149 |
"""Kerasのoptimizer関連。"""
# pylint: disable=no-name-in-module,attribute-defined-outside-init,invalid-unary-operand-type
import tensorflow as tf
K = tf.keras.backend
@tf.keras.utils.register_keras_serializable(package="pytoolkit")
class SGDEx(tf.keras.optimizers.SGD):
"""重み別に学習率の係数を設定できるSGD。
lr_multipliersは、... | ak110/pytoolkit | pytoolkit/optimizers.py | Python | mit | 2,799 |
# 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... | Datera/cinder | cinder/tests/unit/message/test_defined_messages.py | Python | apache-2.0 | 1,787 |
# Author: Dennis Lutter <lad1337@gmail.com>
# Author: Jonathon Saine <thezoggy@gmail.com>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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 S... | WebSpider/SickRage | sickbeard/webapi.py | Python | gpl-3.0 | 117,264 |
# -*- coding: ascii -*-
import sys, os, os.path
import unittest, doctest
try:
import cPickle as pickle
except ImportError:
import pickle
from datetime import datetime, time, timedelta, tzinfo
import warnings
if __name__ == '__main__':
# Only munge path if invoked as a script. Testrunners should have setup... | lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/lib/pytz/tests/test_tzinfo.py | Python | mit | 28,136 |
from tg.configuration.utils import get_partial_dict
class Bunch(dict):
"""A dictionary that provides attribute-style access."""
def __getitem__(self, key):
return dict.__getitem__(self, key)
def __getattr__(self, name):
try:
return self[name]
except KeyError:
... | lucius-feng/tg2 | tg/util/bunch.py | Python | mit | 541 |
from .. import db
from .. import lp
def get_command():
return Command()
class Command(object):
name = 'fetch'
help = ('Download all valid blueprints from launchpad for projects '
'and save in a local file.')
def add_arguments(self, parser):
parser.add_argument('projects', nargs='... | markwash/hoke | hoke/commands/fetch.py | Python | bsd-2-clause | 721 |
from django.conf.urls import url
from .import views
#url(r'^view/(?P<article_id>[0-9]+)/$',views.view,name='view'),
urlpatterns=[
url(r'^$', views.index, name='index'),
url(r'^login/$', views.login, name='login'),
url(r'^logout/$', views.logout, name='logout'),
url(r'^dev/add/$', views.dev_... | zerovip/EMS | 环境监测系统/django/EMS/emsys/urls.py | Python | apache-2.0 | 1,465 |
# -*- coding: utf-8 -*-
#
# test_stdp_triplet_synapse.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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... | magnastrazh/NEUCOGAR | nest/serotonin/research/C/nest-2.10.0/pynest/nest/tests/test_stdp_triplet_synapse.py | Python | gpl-2.0 | 10,707 |
"""This module contains a tile cache handler."""
__author__ = 'Aaron Steele'
# MOL imports
import cache
# Standard Python imports
import hashlib
import logging
import os
import urllib
import webapp2
# Google App Engine imports
from google.appengine.api import memcache
from google.appengine.api import urlfetch
from ... | MapofLife/MOL | app/tile_handler.py | Python | bsd-3-clause | 3,335 |
import numpy as np
from util import load_csv
import sys
y = load_csv(sys.argv[1])
t = load_csv(sys.argv[2])
assert len(y) == len(t)
mse = np.sum((y - t)**2) / (2 *(len(y)))
print mse
| williamd4112/simple-linear-regression | score.py | Python | mit | 188 |
def main(request, response):
cookie = request.cookies.first("COOKIE_NAME", None)
response_headers = [("Content-Type", "text/javascript"),
("Access-Control-Allow-Origin", request.headers.get("Origin")),
("Access-Control-Allow-Credentials", "true")]
cookie_val... | peterjoel/servo | tests/wpt/web-platform-tests/workers/modules/resources/credentials.py | Python | mpl-2.0 | 452 |
# -*- coding: utf-8 -*-
"""
========
Logscale
========
For when linear is just not good enough.
You can set the `log_scale` property with a boolean, or specify a list of bools, or a list of parameter indexes,
or a list of parameter names, or a dictionary from parameter names to boolean values. Most things work, just ... | Samreay/ChainConsumer | examples/customisations/plot_logscale.py | Python | mit | 1,195 |
if False:
for i in [1,2]:
pass
else:
pass
| RedHatQE/python-moncov | test/code/if_false_for_some.py | Python | gpl-3.0 | 48 |
def getText(path, mediaType):
(usecontent, content) = useBodyContent(path, mediaType)
if usecontent:
return content
else:
return ""
def getMediaType(path):
return runTika("-d", path).rstrip()
def useBodyContent(path, mediaType):
if mediaType == "text/plain":
return contains... | materials-commons/materialscommons.org | backend/loader/tasks/extract.py | Python | mit | 1,402 |
#! /usr/bin/env python
#-*- coding: utf-8 -*-
# ***** BEGIN LICENSE BLOCK *****
#
#
# ***** END LICENSE BLOCK *****
__author__ = ""
__version__ = ""
__date__ = ""
__revision__ = ""
__copyright__ = ""
__license__ = ""
from bootstrap import db, app
from sqlalchemy.sql import func, select, desc
from flask import Bluep... | rodekruis/shelter-database | src/web/views/api/shelter_api_v02.py | Python | mit | 16,979 |
from django import forms
from .models import Policy, Operation
SIGNALS = (
('None', 'None'),
('lavfi.signalstats.BRNG', 'BRNG'),
('lavfi.cropdetect.y2', 'Crop Bottom'),
('lavfi.cropdetect.y1', 'Crop Top'),
('lavfi.cropdetect.x1', 'Crop Left'),
('lavfi.cropdetect.x2', 'Crop Right'),
('lavfi.... | yayoiukai/signalserver | policies/forms.py | Python | mit | 4,131 |
import plugin
import hashlib
import electrum
def pick(chars, word, i):
filtered = [w for w in word if w in chars]
if len(filtered) == 0:
print '>', repr(chars), repr(word), i
return ' '
else:
return filtered[i % len(filtered)]
def pick_vowel(word, i):
return pick('aeiouy', word, i)
def pick_conso... | arttukasvio/deterministic | name.py | Python | unlicense | 1,821 |
# -*- coding: utf-8 -*-
#
# python-loaders documentation build configuration file, created by
# sphinx-quickstart on Mon Sep 10 09:57:03 2012.
#
# 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.
... | FelixLoether/python-loaders | docs/conf.py | Python | mit | 7,808 |
from aod_visualisation import AodVisualisation
from vector_utils import normalise
import expt_data as d
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import rcParams
rcParams.update({'lines.linewidth': 3})
rcParams.update({'font.size': 20})
rcParams['svg.fonttype'] = 'none' # No text as paths. Ass... | GeoffEvans/aol_model | aol_model/aod_model_expt_comparison.py | Python | gpl-3.0 | 5,046 |
"""
"""
import argparse
import re
import json
import sys
import requests
url1 = 'http://127.0.0.1:8080/WebGoat/login.mvc'
url2 = 'http://127.0.0.1:8080/WebGoat/j_spring_security_check'
url3 = 'http://127.0.0.1:8080/WebGoat/'
payload1 = {'username':'webgoat','password':'webgoat'}
session = requests.Session()
first =... | mtesauro/gauntlt-demo | examples/webgoat/vuln-13/vuln-13.py | Python | mit | 979 |
# coding=utf-8
# !/usr/bin/env python
import sys
try:
from setuptools import setup
except ImportError:
sys.stderr.write('using distutils\n')
from distutils.core import setup
with open('requirements.txt') as f:
required = f.read().splitlines()
required = [ req.split('#egg=')[1] if '#' in req else r... | project-capo/amber-python-drivers | setup.py | Python | mit | 2,925 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from itertools import product
def palindrome(num):
n = str(num)
return n == n[::-1]
multiples = (
(a, b) for a, b in product(xrange(100, 1000), repeat=2) if palindrome(a*b)
)
print max(multiples, key=lambda (a, b): a*b)
| demonkit/projecteuler | pyimpl/4.py | Python | gpl-2.0 | 285 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.