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
# -*- coding: utf-8 -*- from django.db.utils import IntegrityError, ProgrammingError from south.utils import datetime_utils as datetime from south.db import db from south.v2 import DataMigration from django.db import models, connection from articles.models import Article class Migration(DataMigration): def get_fu...
urlist/devcharm
articles/migrations/0002_import_previous_articles.py
Python
gpl-3.0
18,116
""" Following code assumes a class named Widget that depends on other widgets Widget ctor takes a name, and function add_dependency(depends) marks widget as depends on all widgets in "depends" list When building a widget, you need to first build all the widgets it depends on. Implement widget so the following code w...
ynonp/python-examples
20_classes_lab/03.py
Python
mit
1,183
#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
phs/sauce
vendor/pump.py
Python
mit
23,100
######################################################### # The object (file object.py) class myObject: def __init__(self): # a global counter self.globalNumCalls = 0 def method1(self, string): self.globalNumCalls += 1 return len(string) def method2(self, number): se...
ActiveState/code
recipes/Python/347210_Exposing_Pyro_remote_object_web_service/recipe-347210.py
Python
mit
4,251
import json import os from django.urls import reverse as dj_reverse from rest_framework import serializers from rest_framework.reverse import reverse as drf_reverse from olympia import amo from olympia.amo.templatetags.jinja_helpers import absolutify, urlparams from olympia.files.models import FileUpload class Fil...
aviarypl/mozilla-l10n-addons-server
src/olympia/signing/serializers.py
Python
bsd-3-clause
3,251
# -*- coding: utf-8 -*- # # RERO ILS # Copyright (C) 2019 RERO # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, version 3 of the License. # # This program is distributed in the hope that...
rero/reroils-app
rero_ils/modules/acq_order_lines/models.py
Python
gpl-2.0
1,807
# Copyright (c) 2016 EMC Corporation. # 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 requ...
openstack/manila
manila/share/drivers/dell_emc/plugins/unity/connection.py
Python
apache-2.0
38,754
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('dj_phab', '0003_auto_20150317_1921'), ] operations = [ migrations.CreateModel( name='LastImportTracker', ...
TidalLabs/django-phabricator
dj_phab/migrations/0004_lastimporttracker.py
Python
bsd-3-clause
615
""" Vitality measures. """ # Copyright (C) 2012 by # Aric Hagberg <hagberg@lanl.gov> # Dan Schult <dschult@colgate.edu> # Pieter Swart <swart@lanl.gov> # All rights reserved. # BSD license. import networkx as nx __author__ = "\n".join(['Aric Hagberg (hagberg@lanl.gov)', 'Renato...
aureooms/networkx
networkx/algorithms/vitality.py
Python
bsd-3-clause
2,512
# -*- coding: utf-8 -*- import datetime from django.test import TestCase from oscar.forms import widgets class TestWidgetsDatetimeFormat(TestCase): def test_datetime_to_date_format_conversion(self): format_testcases = ( ('%Y-%m-%d', 'yyyy-mm-dd'), ('%Y-%m-%d %H:%M', 'yyyy-mm-dd'...
sonofatailor/django-oscar
tests/integration/forms/test_widget.py
Python
bsd-3-clause
2,358
# -*- coding: utf-8 -*- # # Meta test family (MTF) is a tool to test components of a modular Fedora: # https://docs.pagure.org/modularity/ # Copyright (C) 2017 Red Hat, 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 # ...
fedora-modularity/meta-test-family
moduleframework/environment_prepare/nspawn_prepare.py
Python
gpl-3.0
3,481
# This is helper cell that defines code checking (testing) function Check() # Please run it once, but you do not need to understand it. import re import sys import jinja2 from IPython.core import display from prog_edu_assistant_tools.magics import report, autotest, CaptureOutput from google.colab import _message as goo...
google/prog-edu-assistant
python/colab/preamble.py
Python
apache-2.0
4,093
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 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 the ## License, or (at your option) a...
PXke/invenio
invenio/modules/search/testsuite/test_views.py
Python
gpl-2.0
1,579
from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin __copyright__ = "Copyright 2011 Red Robot Studios Ltd." __license__ = "GPL v3.0 http://www.gnu.org/licenses/gpl.html" admin.autodiscover() urlpatterns = patterns('', (r'', include('openelm.public.urls')),...
andrewgleave/OpenElm
web/openelm/urls.py
Python
mit
693
from .. import Provider as CurrencyProvider class Provider(CurrencyProvider): # Format: (code, name) currencies = ( ("AED", "Dírham de los Emiratos Árabes Unidos"), ("AFN", "Afghaní"), ("ALL", "Lek albanés"), ("AMD", "Dram armenio"), ("ANG", "Florín de las Antillas Hola...
joke2k/faker
faker/providers/currency/es_ES/__init__.py
Python
mit
6,293
# -*- coding: utf-8 -*- # # Copyright (c) 2016-2017 Ircam # Copyright (c) 2016-2017 Guillaume Pellerin # Copyright (c) 2016-2017 Emilie Zawadzki # This file is part of mezzanine-organization. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public L...
Ircam-Web/mezzanine-organization
organization/media/views.py
Python
agpl-3.0
7,745
#!/usr/bin/env python # -*- coding: utf-8 -*- # :Id: $Id: punctuation_chars.py 8016 2017-01-17 15:06:17Z milde $ # :Copyright: © 2011, 2017 Günter Milde. # :License: Released under the terms of the `2-Clause BSD license`_, in short: # # Copying and distribution of this file, with or without modification, # are pe...
lmregus/Portfolio
python/design_patterns/env/lib/python3.7/site-packages/docutils/utils/punctuation_chars.py
Python
mit
6,364
# -*- coding: utf-8 -*- import asynctest import pytest from metadoc import Metadoc class MetadocModuleTest(asynctest.TestCase): def setUp(self): self.url = "https://theintercept.com/2016/11/26/laura-ingraham-lifezette/" article_path = "tests/fixtures/theintercept.com/laura-ingraham-lifezette.html" with o...
psolbach/metadoc
tests/test_module.py
Python
mit
2,837
# -*- coding: utf-8 -*- # © 2011-2014 Julius Network Solutions SARL <contact@julius.fr> # @author Mathieu Vatel <mathieu _at_ julius.fr> # © 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import models, api class Purchase...
Eficent/purchase-workflow
purchase_fiscal_position_update/models/purchase.py
Python
agpl-3.0
965
import asyncio import muffin from .. import app from ..common.handlers import FormHandler from ..common.exceptions import ValidationError, ProcessError from .models import User @app.register('/users/home/') @app.ps.session.user_pass() def home(request): return app.ps.jinja2.render('home.html') @app.register('...
drgarcia1986/cookiecutter-muffin
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/handlers.py
Python
mit
2,124
# -*- coding: utf-8 -*- """ *************************************************************************** JoinAttributes.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ************************...
fritsvanveen/QGIS
python/plugins/processing/algs/qgis/JoinAttributes.py
Python
gpl-2.0
4,394
from ctypes import c_uint, pointer import comtypes import comtypes.automation from comtypes.automation import VARIANT, DISPPARAMS from comtypes.automation import IEnumVARIANT from comtypes.automation import DISPATCH_METHOD from comtypes.automation import DISPATCH_PROPERTYGET from comtypes.automation import DISPATCH_PR...
tinkerinestudio/Tinkerine-Suite
TinkerineSuite/python/Lib/comtypes/client/lazybind.py
Python
agpl-3.0
9,245
""" INFORM notification +++++++++++++++++++ Send SNMP INFORM notification using the following options: * SNMPv2c * with community name 'public' * over IPv4/UDP * send INFORM notification * to a Manager at 195.218.195.228:162 * with TRAP ID 'coldStart' specified as an OID * include managed objects information: 1.3.6...
filippog/pysnmp
examples/v3arch/asyncore/agent/ntforg/v2c-inform.py
Python
bsd-3-clause
3,157
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """The database models for anomaly alerting threshold configs.""" import logging from google.appengine.ext import ndb # The parameters to use from anomaly...
benschmaus/catapult
dashboard/dashboard/models/anomaly_config.py
Python
bsd-3-clause
2,429
#importing modules import time import android #simplifying commands droid = android.Android() response = droid.dialogGetResponse().result def pause(a): time.sleep(a) def show(): droid.dialogShow() def alert(a, b): droid.dialogCreateAlert(a, b) def PositiveButton(a): droid.dialogSetPositiveButtonText(a) def N...
Foggalong/scraps
files/old/android/converter.py
Python
gpl-2.0
49,008
'''The implementation of the database system''' import os import fcntl import cPickle as pickle import zlib import hashlib from mavc import info from mavc import interface class FileDB(interface.BaseDB): '''Database based on local files Work under current dir Override methods to implement''' def _St...
hczhcz/mavc
module/database.py
Python
gpl-2.0
7,549
from openerp.osv import osv, fields class tapplicant(osv.osv): _inherit = 'tapplicant' def action_take_picture(self, cr, uid, ids, context=None): if context is None: context = {} res_model, res_id = self.pool.get( 'ir.model.data').get_object_reference(cr, uid, ...
nishad-jobsglobal/odoo-marriot
openerp/addons/tapplicant_webcam/tapplicant.py
Python
agpl-3.0
1,181
import toolib.debug as debug from Event import Event from EventVetoException import EventVetoException class EventDispatcher: def __init__(self): self._listenerDict = {} def registerListener(self, listenerClass, listener, index=None, forceAdd=0): assert debug.trace("%s, class=%s" % (listener.__class__, ...
onoga/toolib
toolib/event/EventDispatcher.py
Python
gpl-2.0
2,080
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel Corporation  # # 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 require...
ashaarunkumar/spark-tk
python/sparktk/frame/ops/append.py
Python
apache-2.0
2,162
movies = ["The Holy Grail", 1975, "Terry Jones & Terry Gilliam", 91, ["Graham Chapman", ["Michael Palin", "John Cleese", "Terry Gilliam", "Eric Idle", "Terry Jones"]]] print(movies) for each_item in movies: print(each_item)
bitfree/TIL
python/headfirst/example/chapter1/page54.py
Python
gpl-2.0
272
def autoretry_datastore_timeouts(attempts=5.0, interval=0.1, exponent=2.0): """ Copyright (C) 2009 twitter.com/rcb 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 ...
trosa/forca
gluon/contrib/gae_retry.py
Python
gpl-2.0
3,596
# -*- coding: utf-8 -*- ## ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS 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 versio...
ppiotr/Bibedit-some-refactoring
modules/webbasket/lib/webbasket_config.py
Python
gpl-2.0
6,805
# file: logitech_f310.py # author: Richard Willison (rwilliso@andrew.cmu.edu) # desc: Python wrapper class for a logitech f310 (xbox clone) # gamepad. from pygame import joystick class Logitech_F310(object): """Python wrapper class for a Logitech F310 (xbox clone) gamepad. - Use getButton() to retrieve the boolea...
conwill708/Silence
logitech_f310.py
Python
mit
4,743
# AtHomePowerlineServer - networked server for CM11/CM11A/XTB-232 X10 controllers # Copyright (C) 2014, 2015 Dave Hocker # # 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, version 3 of the Licen...
dhocker/athomepowerlineserver
helpers/sun_data.py
Python
gpl-3.0
3,610
from plenum.test import waits from plenum.test.checkpoints.helper import check_num_received_checkpoints, \ check_received_checkpoint_votes, check_stable_checkpoint, check_num_unstable_checkpoints from plenum.test.delayers import cDelay from plenum.test.helper import sdk_send_random_and_check from stp_core.loop.even...
evernym/plenum
plenum/test/checkpoints/test_lagged_checkpoint_completion.py
Python
apache-2.0
2,812
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE class SimulationPreChecks(object): def check_satisfies_model_interdependence(self, models): """Some models may require that other models be used in order to run properly. Check ...
christianurich/VIBe2UrbanSim
3rdparty/opus/src/urbansim/model_coordinators/simulation_pre_checks.py
Python
gpl-2.0
1,809
import jsonschema from enoslib.infra.enos_static.configuration import ( Configuration, NetworkConfiguration, MachineConfiguration, ) from ... import EnosTest class TestConfiguration(EnosTest): def test_from_dictionnary_minimal(self): d = {"resources": {"machines": [], "networks": []}} ...
BeyondTheClouds/enoslib
enoslib/tests/unit/infra/enos_static/test_configuration.py
Python
gpl-3.0
1,456
""" Manages downloading and updating applications throught he use of a zip file hosted on HomePi server. """ import datetime import os.path import zipfile import urllib2 #Test call to verify thins work. def print_info(archive_name): zf = zipfile.ZipFile(archive_name) for info in zf.infolist(): print...
leeclarke/homePi
src/python/zipInstall.py
Python
gpl-3.0
2,124
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext ext_modules = [Extension('fsdt_commons_bc3', ['fsdt_commons_bc3.pyx'], extra_compile_args=['/openmp', '/O2', '/favor:INTEL64'],...
albertoferna/compmech
compmech/conecyl/fsdt/setup_fsdt_commons_bc3.py
Python
bsd-3-clause
448
from rlib import jit from som.primitives.integer_primitives import IntegerPrimitivesBase as _Base from som.vmobjects.double import Double from som.vmobjects.integer import Integer from som.vmobjects.primitive import Primitive, TernaryPrimitive def get_printable_location_up(block_method): from som.vmobjects.metho...
SOM-st/PySOM
src/som/primitives/bc/integer_primitives.py
Python
mit
4,603
#Using this to simply fill up a text file with placeholder names def fill_names(filename, num_of_names, variation, gender = "none"): if gender == "male": if variation == "first": with open("./%s" % str(filename), "w") as opened_file: for i in range(1, num_of_names + 1): ...
scubadave/LordsAndLadies
file_filler.py
Python
gpl-2.0
2,456
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
Azure/azure-sdk-for-python
sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models.py
Python
mit
10,932
# -*- coding: utf-8 -*- # # Copyright 2017 Ricequant, 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 ...
xclxxl414/rqalpha
rqalpha/model/instrument.py
Python
apache-2.0
18,588
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla quis lorem ut libero malesuada feugiat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec rutrum congue leo eget malesuada. Cras ultricies ligula sed magna dictum porta." print 'original text: ', text list = text.split(' ') point...
pybursa/homeworks
i_pogorelko/hw3/3_7_reverse_adv.py
Python
gpl-2.0
1,495
#!/usr/bin/python # -*- coding: utf-8 -*- # ************************************************************************* # PyPS3patcher - Python patcher script for PS3 flash memory dump files # # Copyright (C) 2015 littlebalup@gmail.com # # This code is licensed to you under the terms of the GNU GPL, version 2; # see htt...
littlebalup/PyPS3tools
PyPS3patcher/patcher.py
Python
gpl-2.0
10,017
#!/usr/bin/python3 # Ylikuutio - A 3D game and simulation engine. # # Copyright (C) 2015-2022 Antti Nuortimo. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # ...
nrz/ylikuutio
code/python/create_yli_ontology_class.py
Python
agpl-3.0
14,641
#!/usr/bin/env python # Copyright (C) 2012 Andrea Valle # # This file is part of swgit. # # swgit 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...
andreav/swgit
core/GitCommit.py
Python
gpl-3.0
14,115
#!/usr/bin/env python2 import matplotlib.pyplot as plt import argparse import os import pandas as pd import numpy as np # %% parser = argparse.ArgumentParser( prog='plot_quad_data') parser.add_argument('file', type=str, help='Data file') args = parser.parse_args() data = pd.read_csv(os.path.join( args.file)...
jhu-asco/aerial_autonomy
scripts/analysis/test_exponential_filter.py
Python
mpl-2.0
826
from PyQt5.QtCore import QSortFilterProxyModel, QModelIndex, Qt from unittest import TestCase from unittest.mock import Mock from EveTypesModel import EveTypesModel from Schemes import Blueprint, MarketGroup from ItemStack import ItemStack class TestSchemesFilterModel(TestCase): def test_filterEmpty(self): flt ...
barsnadcat/evegant
SchemesFilterModel.py
Python
gpl-3.0
2,118
import yaml as yaml from astropy import units import re class DefaultParser: """Not invented here syndrome""" __check = {} __convert = {} __list_of_leaf_types = [] def __init__(self, default_dict): self.__register_leaf('list') self.__register_leaf('int') self.__r...
mklauser/tardis-OLD
tardis/io/default_config_parser.py
Python
bsd-3-clause
19,137
# -*- coding: utf-8 -*- # Copyright 2020 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...
googleads/google-ads-python
google/ads/googleads/v8/resources/types/user_location_view.py
Python
apache-2.0
1,907
import numpy as np from astropy.io import fits from astrometry.util.fits import fits_table def tractor_cat(fn): '''uses Dustin's fits_table() function to read his tractor catalog then returns it as dictionary of np arrays his fits_table handles booleans with weird values like 84 for "brick_primary", and conver...
legacysurvey/legacypipe
py/legacyanalysis/targets.py
Python
bsd-3-clause
9,925
import logging from itertools import islice import mwapi from ...datasources import Datasource, revision_oriented from ...dependencies import expand from ...errors import QueryNotSupported, RevisionNotFound, UserNotFound from .. import Extractor as BaseExtractor from . import datasources from .revision_oriented impor...
he7d3r/revscoring
revscoring/extractors/api/extractor.py
Python
mit
14,821
class NodeService: def __init__(self, soup): self.soup = soup self.node_list = [] def make(self): item_list = self.soup.find('ul', class_='goods_list').find_all('li', class_='_itemSection') if len(item_list) == 0: return for item in item_list: in...
robincloud/microbot
pybin/keyword/node.py
Python
apache-2.0
1,283
# Copyright (c) 2014 Rackspace, 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 wr...
obulpathi/poppy
poppy/model/helpers/cachingrule.py
Python
apache-2.0
2,543
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.website.website_generator import WebsiteGenerator from frappe.website.render import clear_cache from frappe.utils import today, cin...
RicardoJohann/frappe
frappe/website/doctype/blog_post/blog_post.py
Python
mit
6,471
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import yaml # Data from http://pyyaml.org/wiki/PyYAML data = {'name': 'Vorlin Laruknuzum', 'gold': 423, 'title': 'Acolyte', 'hp': [32, 71], 'sp': [1, 13], 'sex': 'Male', 'inventory': ['a Holy Book of Prayers (Words of Wisdo...
jeremiedecock/snippets
python/yaml/data_to_yaml_file.py
Python
mit
529
from . import signal_receivers
mrcrgl/gge-storage
pushover/__init__.py
Python
mit
30
from m2x_mqtt.v2.resource import Resource class Stream(Resource): """ Methods for interacting AT&T M2X Device Streams """ ITEM_PATH = 'devices/{device_id}/streams/{name}' COLLECTION_PATH = 'devices/{device_id}/streams' ITEMS_KEY = 'streams' ID_KEY = 'name' def __init__(self, api, device, ...
attm2x/m2x-python-mqtt
m2x_mqtt/v2/streams.py
Python
mit
1,951
from __future__ import absolute_import, print_function, unicode_literals from builtins import dict, str from os.path import join, dirname from nose.tools import raises from nose.plugins.attrib import attr from indra.statements import * from indra.databases import hgnc_client from indra.sources.signor.processor import...
pvtodorov/indra
indra/tests/test_signor.py
Python
bsd-2-clause
33,890
# 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...
rajalokan/nova
nova/tests/unit/api/openstack/placement/test_handler.py
Python
apache-2.0
6,812
'''pypi: Pipista added to Shellista! usage: pypi [download|search|version] module_name ''' from ... tools.toolbox import bash import os, os.path, sys, urllib2, requests, xmlrpclib alias = ['pypi'] def main(self, line): args = bash(line) print args if len(args) == 0: print '''usage: pipista download...
briarfox/ShellistaExt
ShellistaExt/plugins/extensions/pipista/pipista_plugin.py
Python
mit
6,859
from functools import wraps from social.utils import setting_name from social.strategies.utils import get_strategy DEFAULTS = { 'STORAGE': 'social.apps.tornado_app.models.TornadoStorage', 'STRATEGY': 'social.strategies.tornado_strategy.TornadoStrategy' } def get_helper(request_handler, name): return re...
HackerEcology/SuggestU
suggestu/social/apps/tornado_app/utils.py
Python
gpl-3.0
1,368
import os, sys #os.chdir('../../bayesian-belief-networks') from bayesian.bbn import build_bbn_from_conditionals as build_graph def indep_wrap(varName, d={}, p=0.5): d[varName]= [[[],{"H":p , "L":1.0-p}]] return d def one_cause_wrap(depVar, indepVar, d, p=0.5, neg=set()): if indepVar not in neg: ...
jac2130/BayesGame
Betting/PythonExcercises/ThreeVariableComplexity.py
Python
mit
1,065
"""Config flow to configure Philips Hue.""" import asyncio import json import os from aiohue.discovery import discover_nupnp import async_timeout import voluptuous as vol from homeassistant import config_entries from homeassistant.core import callback from homeassistant.helpers import aiohttp_client from .bridge imp...
Cinntax/home-assistant
homeassistant/components/hue/config_flow.py
Python
apache-2.0
8,488
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2013 Daniel Reis # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software...
raycarnes/project
project_sla/__openerp__.py
Python
agpl-3.0
5,303
# This example requires the 'members' privileged intents import discord from discord.ext import commands import random description = '''An example bot to showcase the discord.ext.commands extension module. There are a number of utility commands being showcased here.''' intents = discord.Intents.default() intents.me...
Harmon758/discord.py
examples/basic_bot.py
Python
mit
1,925
#!/usr/bin/env python # Copyright (c) 2012 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. """This script is used by chrome_tests.gypi's js2webui action to maintain the argument lists and to generate inlinable tests. """ ...
hgl888/chromium-crosswalk
tools/gypv8sh.py
Python
bsd-3-clause
2,927
import xmlrpclib client = xmlrpclib.ServerProxy('http://localhost:8000/') sNumber = client.randomNumberGenerator() print "Please guess a number between 0 and 100" while True: try: cNumber = int(raw_input("What is your guess?")) print client.comparison(sNumber, cNumber) if cNumber == sNumb...
suzanada/swe545_Assignment
assignment1Client.py
Python
mit
417
# Given a sorted array of strings that is interspersed with empty strings, # write a method to find the location of a given string. def sparse_search(needle, haystack): def rec(needle, haystack, l, r): if l > r: return -1 elif l == r: if haystack[l] == needle: return l else: return -1 m...
jdf3/CtCI
python/10-sorting-and-searching/sparsesearch.py
Python
apache-2.0
1,251
from __future__ import absolute_import from __future__ import division from peachpy import * from peachpy.x86_64 import * from common import butterfly, sqrt2_over_2 from common import butterfly, sqrt2_over_2, cos_npi_over_8, interleave def fft8_bitreverse(n): return int(format(n, "03b")[::-1], 2) def load_ym...
microblink/NNPACK
src/x86_64-fma/fft16x16.py
Python
bsd-2-clause
23,581
#!/usr/bin/python # Copyright: Ansible Project # 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', 'status': ['preview'], ...
alxgu/ansible
lib/ansible/modules/cloud/rackspace/rax_mon_check.py
Python
gpl-3.0
10,762
# -*- coding: utf-8 -*- # # Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com> # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. # See LICENSE for more details. # import...
rkokkelk/Gulliver
deluge/core/filtermanager.py
Python
gpl-3.0
9,642
#!/usr/bin/env python import io import json import subprocess pairs = [ ["en", "ru"], ["ru", "en"], ["en", "de"], ["de", "en"], ] n_objs = 8 def get_all_data(pairs, n_objs): text = {} for src, tgt in pairs: pair = f"{src}-{tgt}" cmd = f"sacrebleu -t wmt19 -l {pair} --echo s...
huggingface/pytorch-transformers
examples/legacy/seq2seq/test_data/fsmt/build-eval-data.py
Python
apache-2.0
877
#!/usr/bin/env python # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "Li...
noslowerdna/kafka
kafka-merge-pr.py
Python
apache-2.0
19,703
""" @file @brief Helpers about code. """ import os import re from pyquickhelper.filehelper import explore_folder_iterfile def enumerate_inspect_source_code(folder, file_pattern=".*[.]((py)|(ipynb))$", neg_pattern=".*(([-]checkpoint)|(_todo)|(_temp)).*", ...
sdpython/ensae_teaching_cs
src/ensae_teaching_cs/helpers/code_helper.py
Python
mit
2,395
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module contains classes and functions to standardize access to configuration files for Astropy and affiliated packages. .. note:: The configuration system makes use of the 'configobj' package, which stores configuration in a text format li...
aleksandr-bakanov/astropy
astropy/config/configuration.py
Python
bsd-3-clause
30,072
from race_game.race_game import run if __name__ == '__main__': run()
Jessime/MazeDay2017
src/race.py
Python
mit
74
import six from django.conf import settings from django.utils.module_loading import import_string def _get_backend(): return import_string(settings.SIOWORKERS_BACKEND)() # The url is added to job because worker needs to know which filetracker # server it should access. def run_sioworkers_job(job, **kwargs): ...
sio2project/oioioi
oioioi/sioworkers/jobs.py
Python
gpl-3.0
988
# -*- coding: utf-8 -*- # This library 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 2.1 of the License, or (at your option) any later version. # # This library is distribu...
wikier/keepalive
keepalive/__init__.py
Python
lgpl-2.1
1,008
import contextlib import os import threading import time from django.conf import settings from django.core.files.storage import default_storage as storage from django.db import models, transaction from django.utils import translation from django.utils.encoding import force_text import caching.base import elasticsearc...
harry-7/addons-server
src/olympia/amo/models.py
Python
bsd-3-clause
17,603
#!/usr/bin/python import logging import re import threading logging.basicConfig( level=logging.DEBUG, format='%(asctime)s %(levelname)s |%(name)s| %(message)s', filename='/tmp/mygoclient.log', filemode='a', ) logger = logging.getLogger(__name__) class signum(): ''' This class is mostly a memo ...
zapion/mygoclient
rules.py
Python
mit
8,473
# -*- coding: utf-8 -*- from __future__ import unicode_literals """ Created on April 19, 2012 @author: Young-Min Kim, Jade Tavernier """ from bilbo.extra.Name import Name from bilbo.extra.Place import Place from bilbo.extra.Properlist import Properlist import sys, os import re from codecs import open class Extract(ob...
OpenEdition/bilbo
src/bilbo/format/Extract.py
Python
gpl-2.0
17,526
#!/usr/bin/env python """ Create directory listing with md5 for github pages """ import os import hashlib def create_md5(fname): md5_file = fname + ".md5" hash_md5 = hashlib.md5() with open(fname, "rb") as f: for chunk in iter(lambda: f.read(4096), b""): hash_md5.update(chunk) md5 ...
marcelveldt/repository.marcelveldt
update-directory-structure.py
Python
apache-2.0
1,954
#!/usr/bin/python # # Copyright (C) 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 noti...
apyrgio/snf-ganeti
test/py/ganeti.rpc_unittest.py
Python
bsd-2-clause
35,167
import re from urllib.parse import urljoin from apistar import validators from apistar.compat import dict_type from apistar.document import Document, Field, Link, Section from apistar.schemas.jsonschema import JSON_SCHEMA, JSONSchema SCHEMA_REF = validators.Object( properties={'$ref': validators.String(pattern='^...
tomchristie/apistar
apistar/schemas/openapi.py
Python
bsd-3-clause
16,912
from common_fixtures import * # NOQA @pytest.fixture def new_sim_context(admin_client): uri = 'sim://' + random_str() sim_context = kind_context(admin_client, 'sim', uri=uri, uuid=uri) for i in ['host', 'pool', 'agent']: sim_context[i] = admin_client.wait_success(sim_context[i]) host = sim_...
alena1108/cattle
tests/integration/cattletest/core/test_host.py
Python
apache-2.0
3,572
# Copyright 2020 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/evoflow
tests/conftest.py
Python
apache-2.0
2,161
""" R0901 Too many ancestors """
landscape-test/all-messages
messages/pylint/R0901.py
Python
unlicense
34
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'ClientHandles' db.create_table('eff_clienthandles', ( ('id', self.gf('django.db....
machinalis/eff
eff_site/eff/migrations/0004_auto__add_clienthandles__add_handle__add_field_userprofile_user_type__.py
Python
gpl-3.0
15,765
"""Expose Konichiwa CLI""" from . import main if __name__ == '__main__': main()
olooney/the-perfect-hello-world
konichiwa/__main__.py
Python
apache-2.0
85
from mojo.events import addObserver, removeObserver, postEvent import vanilla class ServoDemo: """ ControlBoard "Servo" component demo Set a servo motor to the angle of a potentiometer. """ def __init__(self): # The name of the sensor (the potentiometer) ...
andyclymer/ControlBoard
Examples/Components/ServoMotor.py
Python
mit
1,472
from __future__ import division import argparse from Bio import SeqIO from datetime import datetime as dt import time import os import sys import gzip class main: def __init__(self): self.start = time.time() self.d_ = dt.today() self.timestarted = self.d_.strftime("%d-%m-%Y %H:%M:%S") self.parseArgs() def pa...
MG-group-tools/MGFunc
mgfunc_v2/swiss2tab.py
Python
gpl-3.0
7,278
#!/usr/bin/env python # coding: utf-8 # Copyright (C) 2014, 2015 Kano Computing Ltd. # License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2 # # A chapter of the story from linux_story.story.terminals.terminal_bernard import TerminalNanoBernard from linux_story.story.challenges.challenge_29 import Step1 as Next...
iamarf/terminal-quest
linux_story/story/challenges/challenge_28.py
Python
gpl-2.0
4,249
# capm.py: A Python class representing the CAPM model given # the risk free rate and market returns. The object # can be instantiated given Stock objects representing # the risk free and market data or their respective # ticker symbols. # # Calling asset_regression with a stock object or asset # dic...
jeromeku/Python-Financial-Tools
capm.py
Python
mit
4,933
# -*- coding: utf-8 -*- """ Copyright (C) 2012 Dariusz Suchojad <dsuch at zato.io> Licensed under LGPLv3, see LICENSE.txt for terms and conditions. """ from __future__ import absolute_import, division, print_function, unicode_literals # Bunch from bunch import Bunch # mock from mock import patch # Zato from zato....
alirizakeles/zato
code/zato-server/test/zato/server/service/internal/channel/test_amqp.py
Python
gpl-3.0
9,273
class ExtractionException(Exception): message = u"" details = u"" eType = "OTHER" def __init__(self): pass def __unicode__(self): return self.message class NameException(ExtractionException): eType = "NAME" message = "ERROR in name extraction: " details = u"" def ...
Learning-from-our-past/Kaira
books/greatfarmers/extraction/extractionExceptions.py
Python
gpl-2.0
3,130
# Generated by Django 2.2.19 on 2021-04-28 09:12 from django.db import migrations, models import image_cropping.fields class Migration(migrations.Migration): dependencies = [ ('markets', '0065_auto_20190426_1255'), ] operations = [ migrations.AlterField( model_name="logo", ...
uktrade/navigator
app/markets/migrations/0066_auto_20210428_0912.py
Python
mit
1,397
from functools import partial import pyhy.api.model from pyhy.api.model.object import HyvesObject def _createGOF(obj): def fn(self, obj_id): try: return self._objects.setdefault(obj, {})[obj_id] except KeyError: self._objects[obj][obj_id] = obj(obj_id, self) ret...
valhallasw/pyhy
pyhy/api/registry.py
Python
mit
992
# -*- coding: utf-8 -*- from setuptools import setup, find_packages REQUIRES = ( 'marshmallow>=2.1.0', 'mongoengine>=0.9.0', ) def read(fname): with open(fname) as fp: content = fp.read() return content setup( name='marshmallow-mongoengine', version='0.7.7', description='Mongoe...
touilleMan/marshmallow-mongoengine
setup.py
Python
mit
1,325