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 _plotly_utils.basevalidators
class TickprefixValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="tickprefix", parent_name="carpet.baxis", **kwargs):
super(TickprefixValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_na... | plotly/python-api | packages/python/plotly/plotly/validators/carpet/baxis/_tickprefix.py | Python | mit | 456 |
# Copyright © 2016, Ugo Pozo
# 2016, Câmara Municipal de São Paulo
# utils.py - utility views.
# This file is part of Anubis.
# Anubis 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 vers... | cmspsgp31/anubis | anubis/views/utils.py | Python | gpl-3.0 | 1,558 |
import cis_publisher
# import cis_profile
import logging
import json
# import mock
# from moto import mock_lambda
# import boto3
logging.getLogger("cis_publisher").setLevel(logging.INFO)
class TestAuth0(object):
def test_auth0_convert(self):
az_data = {}
with open("tests/fixture/auth0_users.j... | mozilla-iam/cis | python-modules/cis_publisher/tests/test_auth0.py | Python | mpl-2.0 | 586 |
import platform
import textwrap
import pytest
from conans.test.assets.sources import gen_function_cpp
from conans.test.utils.tools import TestClient
pbxproj = textwrap.dedent("""
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 55;
objects = {
/*... | conan-io/conan | conans/test/functional/toolchains/apple/test_xcodetoolchain.py | Python | mit | 18,823 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
#import scrapy
from scrapy.item import Item, Field
class JustingItem(Item):
# define the fields for your item here like:
# name = scrapy.Field()
title = F... | jizhouli/justing-podcast-crawler | justing/justing/items.py | Python | gpl-2.0 | 407 |
# coding=utf-8
# Copyright 2020 The Real-World RL Suite 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 appl... | google-research/realworldrl_suite | realworldrl_suite/utils/accumulators.py | Python | apache-2.0 | 6,559 |
import unittest
converter = __import__("obj-to-sm-conversion")
model = """
# Blender v2.71 (sub 0) OBJ File:
# www.blender.org
mtllib object.mtl
o Cube
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -0.999999
v 0.999999 1.... | stbd/stoolbox | tests/obj-to-sm-test/conversion-test.py | Python | mit | 3,598 |
# -*- coding: utf-8 -*-
"""
This script works for foam phantom.
"""
import numpy as np
import glob
import dxchange
import matplotlib.pyplot as plt
import tomopy
from project import *
from simulator import *
from sinogram import *
from instrument import *
from sample import *
if __name__ == '__main__':
pad_leng... | mdw771/tomosim | foam_equal_flux.py | Python | apache-2.0 | 4,483 |
"""PyBDSF options
Options are essentially user-controllable parameters passed into PyBDSF
operations, and allow for end-users to control the exact details of how
calculations are done.
The doc string should give a short description of the option, followed by a
line break ('\n') then a long, detailed description. The ... | lofar-astron/PyBDSF | bdsf/opts.py | Python | gpl-3.0 | 100,879 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012 - INECO PARTNERSHIP LIMITED (<http://www.ineco.co.th>).
#
# This program is free software: you can redistribute it and/or modify
# it under... | jeffery9/mixprint_addons | ineco_signature/__openerp__.py | Python | agpl-3.0 | 1,449 |
# coding: latin-1
def addition (l1, l2):
"""cette fonction additionne deux listes"""
if len (l1) != len (l2) :
raise Exception ("listes de tailles différentes")
res = []
for i in range (0, len (l1)) :
res.append ( l1 [i] + l2 [i] )
return res | sdpython/teachpyx | _todo/programme/testunit1.py | Python | mit | 282 |
# Copyright 2010 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | rhyolight/nupic.son | app/soc/modules/gci/models/bulk_create_data.py | Python | apache-2.0 | 2,045 |
# This file is part of the MapProxy project.
# Copyright (C) 2011-2013 Omniscale <http://omniscale.de>
# 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/LIC... | olt/mapproxy | mapproxy/cache/geopackage.py | Python | apache-2.0 | 27,948 |
# 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... | googlei18n/fontmake | setup.py | Python | apache-2.0 | 2,638 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2005, 2006, 2007, 2008, 2010, 2011 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,... | CERNDocumentServer/invenio | modules/docextract/lib/refextract_config.py | Python | gpl-2.0 | 5,412 |
#!/usr/bin/env python
# coding: utf-8
#import pdb;pdb.set_trace()
## Listing and Info about Document List
#######################################
import sqlalchemy
from mozu_image_util_functions import include_keys, log
from RESTClient import __mozu_image_table_valid_keys__
@log
def count_total_files_documents(**kwa... | relic7/prodimages | mozu/mozu_exec.py | Python | mit | 14,615 |
#!/usr/bin/env python3
from sympy.abc import z
import matplotlib.pyplot as plt
import numpy as np
def fn(z, n):
f = 1
for i in range(1, n + 1):
f *= (z - i)
return f
def plot(fns, x, space):
G = 0
n = len(fns) - 1
plots = []
for i, fn in enumerate(fns):
B = i / n
... | aureooms-research/roots | sturm.py | Python | agpl-3.0 | 607 |
from django.contrib import admin
# Register your models here.
from .models import Area, Location, Category, Measurement
# Inlines
class LocationInline(admin.TabularInline):
model = Location
class MeasurementInline(admin.TabularInline):
model = Measurement
# Model Admins
class AreaModelAdmin(admin.Model... | dhruvaldarji/InternetProgramming | Assignment_6/measurements/admin.py | Python | mit | 720 |
""""""
from __future__ import annotations
import io
import logging
import os
import pathlib
from abilian.core.models.blob import Blob
from ..base import Service
logger = logging.getLogger(__name__)
try:
from clamd import ClamdUnixSocket
clamd = ClamdUnixSocket()
except ImportError:
clamd = None
CLAMD... | abilian/abilian-core | src/abilian/services/antivirus/service.py | Python | lgpl-2.1 | 3,647 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "socialcrawl.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| tobami/socialcrawl | manage.py | Python | mit | 254 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/solution.py | Python | mit | 2,076 |
"""
This is a basic model to test saving and loading boolean and date-related
types, which in the past were problematic for some database backends.
"""
from django.db import models
class Donut(models.Model):
name = models.CharField(max_length=100)
is_frosted = models.BooleanField(default=False)
has_sprin... | theo-l/django | tests/datatypes/models.py | Python | bsd-3-clause | 779 |
'''Test for generic utils
'''
import numpy as np
from chemlab.utils.celllinkedlist import CellLinkedList
from chemlab.libs.ckdtree import cKDTree
from chemlab.utils import distance_matrix
from chemlab.utils import pbc
from chemlab.utils import geometry
from chemlab.utils import neighbors
import time
from nose_paramet... | swails/chemlab | tests/test_utils.py | Python | gpl-3.0 | 3,301 |
from __future__ import absolute_import
import urlparse as _urlparse
def register_scheme(scheme):
for method in filter(lambda s: s.startswith('uses_'), dir(_urlparse)):
uses = getattr(_urlparse, method)
if scheme not in uses:
uses.append(scheme)
urlparse = _urlparse.urlparse
| mozilla/verbatim | vendor/lib/python/raven/utils/urlparse.py | Python | gpl-2.0 | 311 |
#! /usr/bin/env python
# coding: utf8
import os
import sys
# Python translation of Jaro-Winkler code found here:
# http://web.archive.org/web/20100227020019/http://www.census.gov/geo/msb/stand/strcmp.c
# This will be the 'oracle', against which we test our re-written and
# re-factored Jaro-Winkler functions. We confi... | richmilne/JaroWinkler | jaro/strcmp95.py | Python | gpl-3.0 | 10,016 |
__all__ = ['stack']
| Sriee/epi | data_structures/lib/__init__.py | Python | gpl-3.0 | 21 |
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
from hello import application
httpd = make_server('',8000,application)
print('Serving HTTP on port 8000...')
httpd.serve_forever()
#这里需要注意的是,作为一个服务器,只要是有访问服务器的动作,既是http请求,就会响应application函数当中的内容
#application 来自于hello.py当中的application方法
#environ则是用户提... | SoPudge/lxfpyanswer | 61WSGI-SERVER.py | Python | apache-2.0 | 461 |
#!/usr/bin/env python
from PyQt4 import QtCore, QtGui
def load_codepoints(font_name):
name = font_name.replace("-", "_")
module = "glyph.codepoints.%s" % name.lower()
try:
mod = __import__(module, globals(), locals(), [name], 0)
return getattr(mod, name)
except Exception as ex:
... | diegomvh/pyqt | widgets/glyph/glyph.py | Python | mit | 6,354 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from libmozdata.bugzilla import Bugzilla
from auto_nag.bzcleaner import BzCleaner
from auto_nag.people import People
... | mozilla/relman-auto-nag | auto_nag/scripts/has_str_no_range.py | Python | bsd-3-clause | 4,367 |
import boto3
#dynamodb = boto3.resource('dynamodb', region_name='us-east-1', endpoint_url="http://localhost:8000")
dynamodb = boto3.resource('dynamodb', region_name='us-east-1', endpoint_url="https://dynamodb.us-east-1.amazonaws.com")
table = dynamodb.create_table(
TableName='Ingredients',
Key... | bzcen/TreeHacks2016 | database/CreateIngredientsTable.py | Python | apache-2.0 | 865 |
#!/usr/bin/python3
# Copyright (c) 2017 Maen Artimy
#
# 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 use, copy, modify, ... | martimy/SANDProject | MentorExample1.py | Python | mit | 2,787 |
from functools import partial
from pubsub import pub
from threading import Lock
from threading import Thread
import wx
from spacq.gui.tool.box import Dialog, OK_BACKGROUND_COLOR, MessageDialog
from spacq.interface.units import Quantity, IncompatibleDimensions
from spacq.interface.resources import AcquisitionThread
""... | ghwatson/SpanishAcquisitionIQC | spacq/devices/cryomagnetics/gui/model4g.py | Python | bsd-2-clause | 18,135 |
import re
thisDict = {
"path": "thisDict",
"2": "2",
"3": "3",
"5": "5",
"7": "7",
"2 x 2": "{2} x {2}",
"3 x 2": "{3} x {2}",
"4": "{2 x 2}",
"6": "{3 x 2}",
"8": "{2 x 2} x {2}",
"16": "{2 x 2} x {2 x 2}",
"96": "{16} x {6}",
"thisModel.Root": "thisModel.Root: {96}... | CommonAccord/Cmacc-Org | Doc/G/NW-NDA/99/WiP/Schedule/String.py | Python | mit | 2,950 |
#!/usr/bin/env python
""" A unittest script for the MIMARKS module. """
import unittest
from cutlass import MIMARKS
class testMimarks(unittest.TestCase):
""" A unit test class for the MIMARKS class. """
def testRequiredFields(self):
""" Test the required_fields() static method. """
required ... | ihmpdcc/cutlass | tests/test_mimarks.py | Python | mit | 4,346 |
# BridgeDB by Nick Mathewson.
# Copyright (c) 2007-2009, The Tor Project, Inc.
# See LICENSE for licensing information
from __future__ import print_function
import doctest
import os
import random
import sqlite3
import tempfile
import unittest
import warnings
import time
from datetime import datetime
import bridgedb.... | wfn/bridgedb | lib/bridgedb/Tests.py | Python | bsd-3-clause | 30,756 |
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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... | pkilambi/ceilometer | ceilometer/tests/test_notification.py | Python | apache-2.0 | 15,817 |
class HashTable:
def __init__(self):
self.size = 11
self.slots = [None] * self.size
self.data = [None] * self.size
| robin1885/algorithms-exercises-using-python | source-code-from-author-book/Listings-for-Second-Edition/listing_5_6.py | Python | mit | 143 |
# coding: utf-8
from payu.experiment import Experiment
from payu.laboratory import Laboratory
import payu.subcommands.args as args
title = 'sweep'
parameters = {'description': 'Delete any temporary files from prior runs'}
arguments = [args.model, args.config, args.hard_sweep, args.laboratory]
def runcmd(model_type... | nicjhan/payu | payu/subcommands/sweep_cmd.py | Python | apache-2.0 | 491 |
#Created by Jere Lyytinen, VAMK, 2016
#All rights reserved
import re
from tkinter import *
from tkinter.ttk import *
import pymysql.cursors
class DBTest:
#Initiates things we'll use
def __init__(self, root):
self._create_tabs()
self._layout()
#Create tabs
def _create... | jerelyytinen/python_project | project.py | Python | gpl-3.0 | 50,662 |
# encoding: utf-8
"""
(C) 2012 by Maho (?ukasz Mach)
License: GPL
Poor man's i18n support for Pyjamas.
_("identifier") returns you translated version of "identifier". If you want
original (English) version, just do nothing. If you want other language
(eg. PL), please import translation_pl in... | pombredanne/pyjs | pyjswidgets/pyjamas/locale.py | Python | apache-2.0 | 685 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# libthumbor - python extension to thumbor
# http://github.com/heynemann/libthumbor
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 Bernardo Heynemann heynemann@gmail.com
"""libthumbor generic views tests"""
import os
... | thumbor/libthumbor | tests/test_generic_views.py | Python | mit | 5,325 |
import hashlib
import re
import os
import pickle
from functools import partial
from externals.lib.misc import file_scan, update_dict
import logging
log = logging.getLogger(__name__)
VERSION = "0.0"
# Constants --------------------------------------------------------------------
DEFAULT_DESTINATION = './files/'
DEF... | richlanc/KaraKara | website/karakara/scripts/hash_matcher.py | Python | gpl-3.0 | 3,469 |
__problem_title__ = "Finding numbers for which the sum of the squares of the digits is a square"
__problem_url___ = "https://projecteuler.net/problem=171"
__problem_description__ = "For a positive integer , let f( ) be the sum of the squares of the " \
"digits (in base 10) of , e.g. f(3) = 3 ... | jrichte43/ProjectEuler | Problem-0171/solutions.py | Python | gpl-3.0 | 917 |
import uuid
from collections import defaultdict
from typing import Any, Dict, Text
from rasa.shared.nlu.constants import (
INTENT_NAME_KEY,
ENTITIES,
ENTITY_ATTRIBUTE_TYPE,
ENTITY_ATTRIBUTE_VALUE,
INTENT,
TEXT,
PREDICTED_CONFIDENCE_KEY,
)
from rasa.nlu.emulators.emulator import Emulator
c... | RasaHQ/rasa_nlu | rasa/nlu/emulators/dialogflow.py | Python | apache-2.0 | 1,749 |
import Adafruit_BBIO.GPIO as GPIO
import time
from datetime import datetime
GPIO.setup("P9_11", GPIO.IN)
GPIO.add_event_detect("P9_11", GPIO.FALLING)
lluvia = 0.0
#Intervalo de Medicion en minutos
Int = 5
dir = "/root/datos/prec_pluvial/{}"
c = 0 #variable para controlar que no se guarden muchos datos a los 5 mi... | danivilla2191/Estaciones | pluviometro.py | Python | mit | 676 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from datetime import date
import frappe
from frappe import _
from frappe.core.doctype.role.role import get_users
from frappe.model.document import Document
from frappe.utils import add_days,... | frappe/erpnext | erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py | Python | gpl-3.0 | 7,268 |
# CloudScape Libraries
from cloudscape.common.vars import SYS_TYPE, LOG_DIR, SSH_AUTHKEYS, np
from cloudscape.common import config
from cloudscape.common.collection import Collection
# Log configuration section
CONFIG_LOG = {
'service': np('%s/service.log' % LOG_DIR),
'agent': np('%s/agent.l... | djtaylor/cloudscape-DEPRECATED | python/cloudscape/agent/config.py | Python | gpl-3.0 | 2,920 |
"""
========================================================
Building histograms using Rectangles and PolyCollections
========================================================
This example shows how to use a path patch to draw a bunch of
rectangles. The technique of using lots of Rectangle instances, or
the faster met... | BeckDevil/matplot | histogram/histogram.py | Python | gpl-3.0 | 1,733 |
#!/usr/bin/env python
# Copyright (C) 2011 by Kevin Nam Truong, Daniel Steinberg, Debasish Das, Juan Pineda, Melissa Miranda, and Victoria Pan
# 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 Softwar... | nilnullzip/StalkerBot | src/scrape_juan.py | Python | mit | 2,871 |
"""Template helper methods for rendering strings with Home Assistant data."""
from datetime import datetime
import json
import logging
import random
import re
import jinja2
from jinja2 import contextfilter
from jinja2.sandbox import ImmutableSandboxedEnvironment
from homeassistant.const import (
STATE_UNKNOWN, AT... | MungoRae/home-assistant | homeassistant/helpers/template.py | Python | apache-2.0 | 15,661 |
from dynamic_stack_decider import AbstractActionElement
from humanoid_league_msgs.msg import Strategy
class ChangeRole(AbstractActionElement):
def __init__(self, blackboard, dsd, parameters):
super().__init__(blackboard, dsd, parameters)
self.role = parameters.get('role', None)
def perform(s... | bit-bots/bitbots_behaviour | bitbots_body_behavior/src/bitbots_body_behavior/actions/change_role.py | Python | bsd-3-clause | 450 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import ckeditor.fields
class Migration(migrations.Migration):
dependencies = [
('administrador', '0012_auto_20160229_2159'),
]
operations = [
migrations.AlterField(
model... | gabrielf10/webAmpunc | administrador/migrations/0013_auto_20160229_2207.py | Python | bsd-3-clause | 678 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# turbasen.py documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 29 07:26:30 2016.
#
# 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
... | Turbasen/turbasen.py | docs/conf.py | Python | mit | 9,239 |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import pytest
def pytest_collection_modifyitems(items):
for item in items:
if item.nodeid.startswith("tests/nn"):
if "stage" not in item.keywords:
item.add_marker(pytest.mark.stage("unit"))... | uber/pyro | tests/nn/conftest.py | Python | apache-2.0 | 429 |
from app import app
from flask import render_template
@app.route('/')
def hello():
return render_template('index.html')
| texuf/myantname | routes/index.py | Python | mit | 128 |
# -*- coding: utf-8 -*-
"""
Created on August 4, 2012
@author: lucien
"""
import os
import re
import xml.etree.ElementTree as etree
_FILE_DIR = "/Users/lucien/Data/Gitonga/my clips/"
_OLD_EAFS = "temp"
_NEW_EAFS = "new3"
# orthographic correspondences
_SPELLING = [{
"ʰ": "h",
"ʷ": "w",
"ˠ": "w",
"ŋ"... | serapio/kwaras | src/langs/Gitonga.py | Python | mit | 2,030 |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | luotao1/Paddle | python/paddle/fluid/tests/unittests/mkldnn/test_sum_bf16_mkldnn_op.py | Python | apache-2.0 | 2,024 |
import pytest
from requests import ConnectionError
def test_unknown_virtual_host(docker_compose, nginxproxy):
r = nginxproxy.get("http://nginx-proxy/port")
assert r.status_code == 503
def test_forwards_to_web1(docker_compose, nginxproxy):
r = nginxproxy.get("http://web1.nginx-proxy.tld/port")
assert... | jwilder/nginx-proxy | test/test_nominal.py | Python | mit | 754 |
# A part of pdfrw (pdfrw.googlecode.com)
# Copyright (C) 2006-2012 Patrick Maupin, Austin, Texas
# MIT license -- See LICENSE.txt for details
from pdfrw.objects.pdfindirect import PdfIndirect
from pdfrw.objects.pdfobject import PdfObject
def _resolved():
pass
class PdfArray(list):
''' A PdfArray maps the PDF... | tajtiattila/pdfrw | pdfrw/objects/pdfarray.py | Python | mit | 1,905 |
"""
This module holds models related to benefits features and configurations
"""
from django import forms
from django.db import models
from django.db.models import UniqueConstraint
from django.urls import reverse
from polymorphic.models import PolymorphicModel
from sponsors.models.assets import ImgAsset, TextAsset, Fi... | manhhomienbienthuy/pythondotorg | sponsors/models/benefits.py | Python | apache-2.0 | 20,095 |
#
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The nxos lldp_global fact class
It is in this file the configuration is collected from the device
for a given resource, parsed, and the facts tree is populated
based on t... | thaim/ansible | lib/ansible/module_utils/network/nxos/facts/lldp_global/lldp_global.py | Python | mit | 3,929 |
from django_cassandra_engine.serializers import DjangoCassandraModelSerializer
from .models import CassandraAdventuresModel\
, CassandraAdventuresModel_M, CassandraFamilyMember
class CassandraFamilyMemberSerializer(DjangoCassandraModelSerializer):
class Meta:
model = CassandraFamilyMember
f... | LowerSilesians/drf-cassandra-boilerplate | drf_cassandra_boilerplate/api_sample/serializers.py | Python | apache-2.0 | 652 |
import re
from django import forms
from django.conf import settings
from django.template.defaultfilters import slugify
from tower import ugettext_lazy as _lazy
from kitsune.products.models import Product, Topic
from kitsune.sumo.form_fields import MultiUsernameField, StrippedCharField
from kitsune.wiki.config import... | philipp-sumo/kitsune | kitsune/wiki/forms.py | Python | bsd-3-clause | 12,054 |
__author__ = 'waqas'
| gettalent/one-signal-python-sdk | tests/__init__.py | Python | mit | 21 |
from django import template
from django.core.urlresolvers import reverse
register = template.Library()
@register.filter
def reverse_node(value):
return reverse('nodes:node', kwargs={'guid': value})
| DanielSBrown/osf.io | admin/nodes/templatetags/node_extras.py | Python | apache-2.0 | 205 |
<<<<<<< HEAD
<<<<<<< HEAD
"""Convenience functions for working with bzr.
This module does not include any tasks, only functions."""
import sys
if sys.version_info[0] == 3:
raise ImportError("Bazaar-NG is not available for Python 3")
from paver.options import Bunch
from bzrlib.builtins import cmd_branch, cmd_che... | ArcherSys/ArcherSys | Lib/site-packages/paver/bzr.py | Python | mit | 5,429 |
from threading import Thread, Event
from time import sleep
from ardas.sampler import W1Sampler
from ardas.sensor_tools import TempSensor, generate_w1temp_sensors
from ardas.samples_conditioners import generate_w1temp_sensor_samples_conditioners
from ardas.records_loggers import generate_w1temp_sensor_records_loggers
fr... | UMONS-GFA/ardas | ardas/logger.py | Python | gpl-3.0 | 2,773 |
"""The strategy for choosing arms"""
import random
from math import log
import scipy.stats
import kullback
class Policy:
"""Class that implements a generic index policy class."""
def __init__(self, num_arms, amplitude=1., lower=0.):
self.num_arms = num_arms
self.num_draws = dict()
sel... | charmasaur/digbeta | python/digbeta/policy.py | Python | gpl-3.0 | 3,492 |
import unicodenazi
import unittest
import warnings
from contextlib import contextmanager
@contextmanager
def catch_warnings():
"""Catch warnings in a with block in a list"""
filters = warnings.filters
warnings.filters = filters[:]
old_showwarning = warnings.showwarning
log = []
def showwarnin... | mitsuhiko/unicode-nazi | funktionspruefung.py | Python | bsd-3-clause | 2,403 |
import webapp2
from updateSchema import updateSchema
from google.appengine.ext import deferred
import logging
import config
class UpdateHandler(webapp2.RequestHandler):
def get(self):
logging.info("HIT HANDLER")
if config.isAdmin():
deferred.defer(updateSchema)
self.response... | hackatbrown/2015.hackatbrown.org | hack-at-brown-2015/updateSchemaHandler.py | Python | mit | 513 |
#!/usr/bin/python
#---------------------------
# mydata.py
#
# The class data defines operations to store data objects.
#
# Tim Riley
# 1/99
#-------------------------------------------------------------
import boolean
class mydata:
def __init__( self ):
self.data_anything = ''
self.state_string = 'null'
self.... | timhriley/appaserver | library/mydata.py | Python | gpl-3.0 | 1,436 |
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSHelperFn, AWSObject, AWSProperty
from .validators import integer
class AliasTarget(AWSHelperFn):
def __init__(self, hostedzoneid, dnsname, evaluatetargethealth=None):
self.d... | etuttle/troposphere | troposphere/route53.py | Python | bsd-2-clause | 1,577 |
# -*- coding:utf-8 -*-
#
# 通过直接计算的方式得到每个移位后的下标对应的原始下标
#
# 假设数组 s 长度为 n ,左移 k 位后的下标为 i ,那么有 i <- (i+k)%n
# 此时继续对移位到 i+k 位置,有 (i+k)%n <- (i+2k)%n ,这个过程直到重新回到需要
# 移动 i 的位置 (i+(a-1)k)%n <- (i+ak)%n = i ,即移动 a 次后完成一个移动循环,这时
# 如果 a < n ,则需要移动 i+1 、i+2、...、i+x-1,x 为移动循环的个数。
# 由 (i+ak)%n = i ,得到 ak % n = 0 ,那么 ak 为 k 的倍数也为 n 的... | fengyc/programming-pearls-2nd-python | samples/ch02/a2_1_b_rotate_move.py | Python | apache-2.0 | 1,669 |
# Content
OSTREE_TYPE_ID = 'ostree'
# Platform
CONTENT_DIR = 'content'
LINKS_DIR = 'links'
SHARED_STORAGE = '/var/lib/pulp/content/shared/%s' % OSTREE_TYPE_ID
# Notes
REPO_NOTE_OSTREE = 'OSTREE'
# Plugins
WEB_IMPORTER_TYPE_ID = 'ostree_web_importer'
WEB_DISTRIBUTOR_TYPE_ID = 'ostree_web_distributor'
CLI_WEB_DISTR... | ipanova/pulp_ostree | common/pulp_ostree/common/constants.py | Python | gpl-2.0 | 1,108 |
import socket
class Daemon(object):
BUF_SIZE = 4096
def __init__(self, host, port):
"""
create a udp socket bind to specific address
:param port:
:param host:
"""
self.addr = (host, port)
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
... | Alkaid-Benetnash/udp_punchhole | server.py | Python | mit | 871 |
# Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group 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
#
# Un... | sony/nnabla | python/src/nnabla/backward_function/binary_cross_entropy.py | Python | apache-2.0 | 1,097 |
# Primitive function: Abs
# Returns the absolute value of a number
__author__="Gonzalo"
from If import If
from Negate import Negate
from Positive import Positive
def Abs (a):
return If(Positive(a),a,Negate(a))
if __name__ == "__main__":
print(Abs(1))
| gcobos/rft | app/primitives/Abs.py | Python | agpl-3.0 | 267 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Sniff every types of files you want on your network interface and save it.
#
# 2015/10/10
# by Oros
#
# Setup :
# $ sudo apt-get install python-scapy dvi2ps
# http://secdev.org/projects/scapy/doc/usage.html
#
# Help :
# $ files_sniffer.py -h
#
# Default usage :
# Sniff every... | Oros42/files_sniffer | files_sniffer.py | Python | cc0-1.0 | 7,100 |
"""Python wrappers around Brain.
This file is MACHINE GENERATED! Do not edit.
"""
import collections as _collections
from google.protobuf import text_format as _text_format
from tensorflow.core.framework import op_def_pb2 as _op_def_pb2
# Needed to trigger the call to _set_call_cpp_shape_fn.
from tensorflow.python... | jjas0nn/solvem | tensorflow/lib/python2.7/site-packages/tensorflow/python/training/gen_training_ops.py | Python | mit | 122,715 |
#!/usr/bin/env python
import os
import argparse
from pkg_resources import parse_version
import IPython
parser = argparse.ArgumentParser()
parser.add_argument("-n", "--notebook", action='store_true',
help="Launches the example in a Jupyter notebook.")
args = parser.parse_args()
if __name__ == "__... | oliverlee/pydy | examples/chaos_pendulum/run.py | Python | bsd-3-clause | 575 |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | openstack/glance | glance/api/v2/image_members.py | Python | apache-2.0 | 19,582 |
import collections
import functools
import logging
import os
import re
import sqlalchemy as sa
from me import lib
BOOTSTRAP_FILE = 'bootstrap.sql'
NO_VERSION = lib.SentinelInt(-1)
SQL_VERSION_REGEX = re.compile(r'^\d+')
SQL_PERM_REGEX = re.compile(r'^[\w\s]+$')
log = logging.getLogger(__name__)
def _sorted_query(... | johnbenjaminlewis/me | me/sql.py | Python | mit | 9,057 |
import os
import pickle
from PyQt4 import QtGui
from Orange.base import Model
from Orange.widgets import widget, gui
from Orange.widgets.settings import Setting
class OWSaveClassifier(widget.OWWidget):
name = "Save Classifier"
description = "Save a trained classifier to an output file."
icon = "icons/S... | qPCR4vir/orange3 | Orange/widgets/classify/owsaveclassifier.py | Python | bsd-2-clause | 4,551 |
# -*- coding: utf-8 -*-
"""Helpers module."""
def sum_chars(char, other):
"""Sum the value of two string characters.
Args:
char (char): string of the integer.
other (char): string of the integer.
Returns:
(int): sum of the integer value of `x` and integer value of `y`.
"""
... | steenzout/python-barcode | steenzout/barcode/helpers.py | Python | mit | 352 |
# -*-coding:iso-8859-1 -*
try: #If needed, the _path module must add the path to the Narro directory to sys.path so that the Narro Engine can be imported as a package
import _path
except:
pass
from constantes import *
from narro.main import *
from narro.constantes import *
from gestionnaireEvenements import *
... | Rastagong/A-Scholar-In-The-Woods | Releases/Post Compo/Windows build/play.py | Python | mit | 507 |
from __future__ import division
from flask import Flask, request, render_template, jsonify, send_from_directory
import threading
import serial
import serial.tools.list_ports
import time
import glob
import json
import re
import os
import logging
import webbrowser
from enum import Enum
log = logging.getLogger('werkzeug'... | kammce/SJSU-DEV-Linux | tools/Telemetry/Telemetry.py | Python | gpl-2.0 | 7,623 |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
import loggi... | Azure/azure-sdk-for-python | sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_topics_async.py | Python | mit | 27,754 |
class JsonSerializer:
def __init__(self):
pass
def serialize(self, o):
properties = o.properties_to_serialize()
properties_dict = o.properties_dict() | scupid-admin/morph-python-sdk | morph/json_serializer.py | Python | mit | 182 |
# Copyright 2021 Berezi Amubieta - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Product Second UOM",
'version': '14.0.1.0.0',
"author": "Avanzosc",
"website": "http://www.avanzosc.es",
"category": "Product",
"depends": [
"product",
"st... | avanzosc/odoo-addons | product_second_uom/__manifest__.py | Python | agpl-3.0 | 495 |
import unittest
from tests.baseclass import ParserTest
from pykickstart import constants
from pykickstart.errors import KickstartParseError
from pykickstart import version # pylint: disable=unused-import
class Script_Includes_Percent_Sign(ParserTest):
def __init__(self, *args, **kwargs):
ParserTes... | jikortus/pykickstart | tests/post.py | Python | gpl-2.0 | 4,393 |
VERSION_FORMAT = 'v%s-%s-%s'
| andresriancho/docker-tag-naming | docker_tag_naming/constants.py | Python | gpl-2.0 | 29 |
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
from distutils.core import Extension
from Pyrex.Distutils import build_ext
#use default libevent include and library dirs
libevent_include_dirs = []
libevent_library_dirs = []
#uncomment these if you libevent is in a d... | concurrence/concurrence | setup.py | Python | bsd-3-clause | 1,940 |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.tapi_common_forwarding_direction import TapiCommonForwardingDirection # noqa: F401,E501
from t... | karthik-sethuraman/ONFOpenTransport | RI/flask_server/tapi_server/models/tapi_oam_oam_constraint.py | Python | apache-2.0 | 3,834 |
# Time: O(m + n)
# Space: O(1)
#
# Write an efficient algorithm that searches for a value in an m x n matrix.
# This matrix has the following properties:
#
# Integers in each row are sorted in ascending from left to right.
# Integers in each column are sorted in ascending from top to bottom.
# For example,
#
# Conside... | tudennis/LeetCode---kamyu104-11-24-2015 | Python/search-a-2d-matrix-ii.py | Python | mit | 1,094 |
#!/usr/bin/python3
"""planes GUI Widgets Demo
Copyright (c) 2014 Florian Berger <mail@florian-berger.de>
"""
# This file is part of planes.
#
# planes 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, eith... | flberger/planes | examples/gui_widgets.py | Python | gpl-3.0 | 7,228 |
from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
from Screens.InfoBar import InfoBar
from Plugins.Extensions.Infopanel.Console import Console
from Components.ConfigList import ConfigListScreen
from Components.Sources.List import List
from Screens.ChoiceBox import ChoiceBox
from Screens.Mess... | n3wb13/OpenNfrGui-5.0-1 | lib/python/Plugins/Extensions/Infopanel/TelnetCommand.py | Python | gpl-2.0 | 4,618 |
# Generated from java-escape by ANTLR 4.5
# encoding: utf-8
from __future__ import print_function
from antlr4 import *
from io import StringIO
package = globals().get("__package__", None)
ischild = len(package)>0 if package is not None else False
if ischild:
from .LaconicListener import LaconicListener
else:
fr... | cfbolz/parsimony | src/laconic/laconic_meta/LaconicParser.py | Python | mit | 83,986 |
# Copyright 2015 Mirantis 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... | NetApp/manila | manila/tests/api/v1/test_share_unmanage.py | Python | apache-2.0 | 8,333 |
# coding=utf-8
"""
instabot example
Workflow:
Comment medias by location.
"""
import argparse
import codecs
import os
import sys
from tqdm import tqdm
stdout = sys.stdout
sys.stdout = codecs.getwriter("utf8")(sys.stdout)
sys.path.append(os.path.join(sys.path[0], "../"))
from instabot import Bot # ... | ohld/instabot | examples/comment_medias_by_location.py | Python | apache-2.0 | 3,147 |
import difflib
from PySide import QtGui
class QtClassNamePrompter(object):
"""
Capable of providing a list of similar looking Qt class names to the
one you provide.
"""
@classmethod
def suggest_names_similar_to_this(cls, name):
all_qtgui_names = dir(QtGui)
lower_cased = [n.lo... | peterhoward42/qt-layout-gen | src/qtlayoutbuilder/lib/qtclassnameprompter.py | Python | mit | 1,034 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.