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 |
|---|---|---|---|---|---|
# (C) British Crown Copyright 2014 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | mo-g/iris | lib/iris/tests/unit/fileformats/rules/test__make_cube.py | Python | gpl-3.0 | 2,483 |
import unittest
from unittest.mock import Mock
from test import support
from worklog import *
import models
class WorklogTests(unittest.TestCase):
@classmethod
def setUpClass(self):
# running the setup method only once
self.tasks = Entry.select()
self.stdout = None
self.stdin = None
self.task_name =... | squadran2003/worklog-with-database | tests.py | Python | mit | 4,551 |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from data_explorer.models.base_model_ import Model
from data_explorer.models.facet import Facet # noqa: F401,E501
from data_explorer import util
class FacetsResponse... | DataBiosphere/data-explorer | api/data_explorer/models/facets_response.py | Python | bsd-3-clause | 7,851 |
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from astropy.io import fits
from astropy.time import Time
'''
This program makes awesome plots of APOGEE CCFs compared to our BFs.
The idea is for you to run it once for each target.
'''
#plt.rc('font',**{'family':'sans-ser... | savvytruffle/cauldron | rvs/BF_CCF_plotter.py | Python | mit | 6,791 |
# 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
# distribu... | jarrodmcc/OpenFermion | src/openfermion/utils/_low_depth_trotter_error.py | Python | apache-2.0 | 16,047 |
# -*- 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):
# Changing field 'Monster.immunities'
db.alter_column('srd20_monster', 'immunities', self.gf('django.db.mod... | machinalis/django-srd20 | srd20/migrations/0028_auto__chg_field_monster_immunities.py | Python | bsd-3-clause | 14,391 |
import socket
import struct
#create and connect to the socket
def getSocket(host, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, int(port)))
return s
def recvMessage(s):
l = s.recv(4)
L = struct.unpack('<I',l)[0]
#print L
data = ''
while (len(data)<L):
... | idkwim/ictf-framework | services/poipoi/test/service.py | Python | gpl-2.0 | 537 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.contrib.postgres.fields
class Migration(migrations.Migration):
dependencies = [
('api', '0004_remove_client_war_participated'),
]
operations = [
migrations.AddField(
... | dborstelmann/Penguins-GH6 | api/migrations/0005_client_war_participated.py | Python | mit | 523 |
#!/usr/bin/env python3
#
# Copyright (c) 2019 Roberto Riggio
#
# 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 applicabl... | rriggio/empower-runtime | empower/managers/projectsmanager/projectshandler.py | Python | apache-2.0 | 26,352 |
__author__ = 'jbowman'
# https://pythonspot.com/inner-classes/
class Human:
def __init__(self, name):
self.name = name
self.head = self.Head()
def addhead(self):
self.head2 = self.Head()
class Head:
def __init__(self):
self.brain = self.Brain()
def t... | deo1/deo1 | Legacy/PythonTutorial/18InnerClasses.py | Python | mit | 630 |
# -*- coding: utf-8 -*-
# (c) 2012-2014, Michael DeHaan <[email protected]>
# (c) 2016 Toshio Kuratomi <[email protected]>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Sof... | bjolivot/ansible | test/units/module_utils/test_basic.py | Python | gpl-3.0 | 44,007 |
# Copyright (C) 2017 ABRT Team
# Copyright (C) 2017 Red Hat, Inc.
#
# This file is part of faf.
#
# faf 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) ... | abrt/faf | src/pyfaf/actions/check_repo.py | Python | gpl-3.0 | 3,131 |
"""
Copyright 2014
This file is part of Phase.
Phase 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 version.
Phase is distributed in the hope that... | phase-dev/phase | libphase/brute_forcer.py | Python | gpl-3.0 | 5,575 |
# 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 requir... | Nexenta/cinder | cinder/volume/drivers/coprhd/helpers/commoncoprhdapi.py | Python | apache-2.0 | 17,348 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Deepin, Inc.
# 2011 Hou Shaohui
#
# Author: Hou Shaohui <[email protected]>
# Maintainer: Hou ShaoHui <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Ge... | hillwoodroc/deepin-music-player | src/widget/tray.py | Python | gpl-3.0 | 4,642 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from zerver.lib.alert_words import (
add_user_alert_words,
alert_words_in_realm,
remove_user_alert_words,
user_alert_words,
)
from zerver.lib.test_helpers import (
get_user_profile_by_email,
mo... | jphilipsen05/zulip | zerver/tests/test_alert_words.py | Python | apache-2.0 | 9,107 |
# ***************************************************************************
# * *
# * Copyright (c) 2015 - FreeCAD Developers *
# * Author (c) 2015 - Przemo Fiszt < [email protected]> *
# * ... | wood-galaxy/FreeCAD | src/Mod/Fem/FemCommands.py | Python | lgpl-2.1 | 7,121 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
import sys
import logging
import getpass
from optparse import OptionParser
import sleekxmpp
from... | tiancj/emesene | emesene/e3/xmpp/SleekXMPP/examples/echo_component.py | Python | gpl-3.0 | 4,190 |
#!/usr/bin/env python
"""Compatibility check of synchronous interface automata"""
__author__ = "Simon Maurer"
__version__ = "0.9.0"
__maintainer__ = "Simon Maurer"
__email__ = "[email protected]"
__status__ = "Prototype"
import igraph, sia
import sys, argparse
import igraph.vendor.texttable
sys.settrace
parser =... | moiri/streamix-sia | check_sia.py | Python | gpl-2.0 | 1,575 |
#!/usr/bin/env python2
import sys
from pwn import log
from pycparser import parse_file
import pycparser
import json
import os.path
FAKE_LIBC = "c_code/utils/fake_libc_include"
class information:
def __init__(self):
self.isptr = False
self.name = ""
self.type = ""
self.isfunct = F... | sigttou/analyzecrypt.py | get_functions.py | Python | mit | 2,513 |
import swiftclient
def connect(creds):
"""
Construct a connection value from a container
"""
return swiftclient.Connection(
authurl=creds.authurl,
user=creds.user,
key=creds.password,
auth_version=creds.auth_version,
tenant_name=creds.tenant_name,
os_opt... | x86Labs/wal-e | wal_e/blobstore/swift/calling_format.py | Python | bsd-3-clause | 433 |
# Copyright 2018 Verily Life Sciences 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 t... | verilylifesciences/variant-qc | sql/characterize_genotypes_test.py | Python | apache-2.0 | 5,161 |
# views.py
from flask import render_template
from app import app
@app.route('/')
def index():
return render_template("index.html")
@app.route('/about')
def about():
return render_template("about.html")
| rayidghani/CharBucks | app/views.py | Python | mit | 214 |
import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="font", parent_name="box.hoverlabel", **kwargs):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/box/hoverlabel/_font.py | Python | mit | 1,855 |
# Purely included to allow for app install.
| shaunsephton/django-snippetscream | snippetscream/models.py | Python | bsd-3-clause | 44 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Bezleputh
#
# This file is part of weboob.
#
# weboob 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 License, or
# (at your opt... | Konubinix/weboob | modules/agendadulibre/browser.py | Python | agpl-3.0 | 2,003 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import numpy as np
import pytest
from astropy import units as u
from astropy.utils import iers
from astropy.time import Time
from astropy.table import Table
try:
import h5py # pylint: disable=W0611 # noqa
except ImportError:
... | dhomeier/astropy | astropy/time/tests/test_mask.py | Python | bsd-3-clause | 6,709 |
# coding=utf-8
#
# <BestRussianTV plugin for XBMC>
# Copyright (C) <2011> <BestRussianTV>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# ... | tatigo/XBMC-BestRussianTVPlugin | ArcSearch.py | Python | gpl-3.0 | 5,298 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | aselle/tensorflow | tensorflow/python/estimator/canned/boosted_trees_test.py | Python | apache-2.0 | 58,435 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ghchinoy/tensorflow | tensorflow/python/feature_column/sequence_feature_column.py | Python | apache-2.0 | 22,673 |
from __future__ import unicode_literals
import logging
import struct
import boto3
import gzip
import io
import msgpack
import numpy as np
logger = logging.getLogger(__name__)
def get_inputs_from_s3():
s3 = boto3.resource('s3', region_name='eu-west-1')
bucket = s3.Bucket('chessbot')
logger.info("Fetch... | srom/chessbot | classifier/train/load.py | Python | mit | 990 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-11-28 15:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('movies', '0004_auto_20161128_1544'),
]
operations = [
migrations.AddField(
... | pdevetto/super-duper-disco | movies/migrations/0005_movie_titlehash.py | Python | gpl-3.0 | 496 |
# Copyright (c) David Wilson 2015
# Icarus 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 version.
# Icarus is distributed in the hope that it... | jeroanan/GameCollection | Tests/TestPlatform.py | Python | gpl-3.0 | 1,844 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | tersmitten/ansible | lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py | Python | gpl-3.0 | 22,189 |
import sys
def get_most_popular_destination(n):
destinations = {}
for i in range(n):
destination = input()
if destination in destinations:
destinations[destination] += 1
else:
destinations[destination] = 1
return max(destinations, key=destinations.get)
n =... | MightyPixel/algorithms | Interviews/Company_1/problem_01.py | Python | gpl-2.0 | 373 |
from expyriment import stimuli
from expyriment.misc import constants
from config import templatePicture, cardColor, picturesFolder
class LdCard(object):
def __init__(self, size, color=cardColor):
self._size = size
self._stimuli = (stimuli.Picture(templatePicture, position=None),
... | arnaudbore/declarativeTask | src/ld_card.py | Python | mit | 1,380 |
from django.urls import reverse_lazy
from django.views.generic import ListView
from django.views.generic.edit import UpdateView
from .models import Toy
class ToyEditView(UpdateView):
model = Toy
fields = '__all__'
template_name_suffix = '_edit'
success_url = reverse_lazy('toy:list')
class ToyListVi... | toystori/v2 | app/toy/views.py | Python | mit | 396 |
#############################################################################
##
## Copyright (c) 2014 Riverbank Computing Limited <[email protected]>
##
## This file is part of PyQt5.
##
## This file may be used under the terms of the GNU General Public License
## version 3.0 as published by the Free Softw... | dragondjf/PyQt5 | python2.7/PyQt5/uic/port_v2/as_string.py | Python | gpl-2.0 | 1,435 |
import _plotly_utils.basevalidators
class LatValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="lat", parent_name="layout.geo.center", **kwargs):
super(LatValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/layout/geo/center/_lat.py | Python | mit | 439 |
from django.contrib import admin
from django import forms
from django.utils.translation import ugettext_lazy as _
from ovp_core.models import Cause
class CauseInline(admin.TabularInline):
model = Cause
class CauseAdmin(admin.ModelAdmin):
fields = ['id', 'name', 'image']
list_display = ['id', 'name']
list_fil... | OpenVolunteeringPlatform/django-ovp-core | ovp_core/admin/cause.py | Python | agpl-3.0 | 480 |
"""Problem 78
10 September 2004
Let p(n) represent the number of different ways in which n coins can
be separated into piles. For example, five coins can separated into
piles in exactly seven different ways, so p(5)=7.
OOOOO
OOOO O
OOO OO
OOO O O
OO OO O
OO O O O
O O O O O
Find the least va... | feliposz/project-euler-solutions | python/euler78.py | Python | mit | 1,566 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from io import BytesIO
import os
import gzip
import tempfile
import unittest
import zlib
from django.core.exceptions import ImproperlyConfigured
from django.core.files import File
from django.core.files.move import file_move_safe
from django.core.files.b... | wfxiang08/django178 | tests/files/tests.py | Python | bsd-3-clause | 7,360 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.prompt
---------------------
Functions for prompting the user for project info.
"""
from __future__ import unicode_literals
import sys
from .compat import iteritems, read_response, is_string
from jinja2.environment import Environment
def prompt_for_co... | vincentbernat/cookiecutter | cookiecutter/prompt.py | Python | bsd-3-clause | 2,429 |
import ssl
import imp
import os
import tornado.web
import tornado.httpserver
import tornado.autoreload
import tornado.process
from DIRAC import S_OK, S_ERROR, gLogger, gConfig
from WebAppDIRAC.Core.HandlerMgr import HandlerMgr
from WebAppDIRAC.Core.TemplateLoader import TemplateLoader
from WebAppDIRAC.Lib.SessionData ... | atsareg/WebAppDIRAC | Core/App.py | Python | gpl-3.0 | 6,772 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Xeralux/tensorflow | tensorflow/python/eager/backprop_test.py | Python | apache-2.0 | 22,305 |
import queue
from threading import Thread
import requests
from .analyzer import Analyzer, init_start_url
import threading
from collections import namedtuple
from .structurers import ThreadSafeSet, FilterableList
__author__ = 'zz'
_sentinel = object()
Task = namedtuple('Task', ['url', 'response_gt', 'max_page'])
def... | littlezz/IslandCollection | core/engine.py | Python | mit | 5,666 |
# (c) 2014, Toshio Kuratomi <[email protected]>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later... | ravello/ansible | v2/ansible/compat/tests/unittest.py | Python | gpl-3.0 | 1,147 |
def f():
raise AssertionError('Silverlight test for throwing exception.')
| tempbottle/dlr | Src/Hosts/Silverlight/Tests/tests/regressions/fixtures/module_throw.py | Python | apache-2.0 | 79 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | mxm/incubator-beam | sdks/python/apache_beam/transforms/core.py | Python | apache-2.0 | 76,746 |
#!/usr/bin/python
import sqlite3
import accounts
import json
import time
#-----------------------------------------------------------------------------
class DB:
def __init__(self, config):
self.conn = sqlite3.connect(
config['DATABASE_FILE_ABS'],
isolation_level = "IMMEDIATE",
... | HackerspaceWroclaw/rejestruj | rejestruj/fdb.py | Python | gpl-3.0 | 7,382 |
from wedo2.bluetooth.bluetooth_io import BluetoothIO
from wedo2.input_output.data_format import DataFormat
from wedo2.input_output.input_format import InputFormat, InputFormatUnit
from wedo2.bluetooth.connect_info import ConnectInfo
from wedo2.utils import byte_utils
class LegoService(object):
def __init__(self... | jannopet/LEGO-WeDo-2.0-Python-SDK | wedo2/services/lego_service.py | Python | mit | 5,639 |
""" Adapter for pysqlite backend """
from current.db.pysqlite.pysqlite import PySqliteDB
## END OF LINE ##
| jjneely/current | current/db/pysqlite/__init__.py | Python | gpl-2.0 | 109 |
"""The tests for the analytics ."""
from unittest.mock import AsyncMock, Mock, PropertyMock, patch
import aiohttp
import pytest
from homeassistant.components.analytics.analytics import Analytics
from homeassistant.components.analytics.const import (
ANALYTICS_ENDPOINT_URL,
ANALYTICS_ENDPOINT_URL_DEV,
ATTR... | rohitranjan1991/home-assistant | tests/components/analytics/test_analytics.py | Python | mit | 18,101 |
#
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | ravibhure/ansible | test/units/modules/network/onyx/test_onyx_vlan.py | Python | gpl-3.0 | 3,728 |
#!/usr/bin/env python
#
# 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, softwa... | nikolay-fedotov/tempest | tempest/cmd/javelin.py | Python | apache-2.0 | 21,190 |
from setuptools import setup, Extension
from Cython.Distutils import build_ext
import numpy
import os
catchmod = Extension('pycatchmod._catchmod', ['pycatchmod/_catchmod.pyx'],
include_dirs=[numpy.get_include()])
weather_generator = Extension('pycatchmod._weather_generator', ['pycatchmod/_weather_... | jetuk/pycatchmod | setup.py | Python | gpl-3.0 | 1,639 |
import os
import platform
import sys
import threading
from concurrent.futures import ThreadPoolExecutor
from os import environ, path
from threading import Timer
import grpc
import ptvsd
from getgauge import handlers, logger, processor
from getgauge.impl_loader import copy_skel_files
from getgauge.messages import runne... | kashishm/gauge-python | start.py | Python | mit | 2,076 |
from django.conf import settings
from django.core import management
from django.core.management.base import BaseCommand
from fabric.api import local
from optparse import make_option
class Command(BaseCommand):
help = "Redeploy the current instance"
option_list = BaseCommand.option_list + (
make_opt... | yprez/django-sitepush | sitepush/management/commands/deploy_local.py | Python | isc | 1,686 |
from motherbrain.base import models
from motherbrain.base.models.processors import Compose, transform, compose
from motherbrain.models import helpers, legacy_helpers, url
def _type(settings):
order = settings.get('order')
_map = {'chart': ['love', 'numeric'],
'draft': ['recent', 'author'],
... | urlist/urlist | motherbrain/models/urlist.py | Python | gpl-3.0 | 3,009 |
# Copyright 2013 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 a... | citrix-openstack-build/neutron-lbaas | neutron_lbaas/services/loadbalancer/agent/agent.py | Python | apache-2.0 | 2,067 |
#!/usr/bin/env python
import os
import yaml
import logging
import pymysql
from connections import Connections
__dir__ = os.path.dirname(__file__)
config = yaml.safe_load(open(os.path.join(__dir__, "../default_config.yaml")))
try:
config.update(yaml.safe_load(open(os.path.join(__dir__, "../config.yaml"))))
except I... | wikimedia/analytics-quarry-web | quarry/web/killer.py | Python | mit | 1,430 |
"""
WSGI config for todoapp project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... | erdem/django-selenium-example | todoapp/todoapp/wsgi.py | Python | mit | 391 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Fakechroot(AutotoolsPackage):
"""fakechroot runs a command in an environment were is addit... | LLNL/spack | var/spack/repos/builtin/packages/fakechroot/package.py | Python | lgpl-2.1 | 1,005 |
import branca.element as be
# currently using the static info page ava_info_static.html
class SatSkredInfoPage():
def __init__(self):
self.f = be.Figure()
def make_header(self):
pass
def add_map(self, map_name="./ava_map.html", h="600px"):
self.f.html.add_child(be.Element("<H2>Ka... | kmunve/APS | aps/satskred/import_skreddb/make_satskred_infopage.py | Python | mit | 917 |
#!/usr/bin/python
#
# 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 b... | coxmediagroup/googleads-python-lib | examples/adwords/v201506/advanced_operations/add_click_to_download_ad.py | Python | apache-2.0 | 3,318 |
"""
Result backend for Easy-Job which use python logging
available options to use
* log_level: level of logging could be logging.DEBUG logging.ERROR or any other log level defined in logging module
default: logging.DEBUG
* logger: name of the logger to use, be cautious , the logger must already defined
... | inb-co/easy-job | easy_job/result_backends/log.py | Python | mit | 1,521 |
from django import forms
from crispy_forms.helper import FormHelper, Layout
from crispy_forms.layout import Field, Div, Row, HTML
from crispy_forms.bootstrap import FormActions, TabHolder, Tab
# from ..models import Pais
from django.utils.translation import ugettext_lazy as _
from apps.utils.forms import smtSave, btnCa... | upeu-jul-20161-epis-ads2/MedicFast | apps/atencion/forms/PaisForm.py | Python | bsd-3-clause | 894 |
from subprocess import Popen, PIPE
from tempfile import NamedTemporaryFile
class Statistic(object):
#TODO: move to a FileStatistic or something like that b/c
# it only deals with files and there are other stats which don't
def set_files(self, files):
self.files = files
#can be overriden by individua... | markdrago/caboose | src/stats/statistic.py | Python | mit | 832 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | sleepsonthefloor/openstack-dashboard | django-nova/src/django_nova/tests/view_tests/base.py | Python | apache-2.0 | 3,195 |
#!/usr/bin/env python
#
# Generate seeds.txt from Pieter's DNS seeder
#
NSEEDS=512
MAX_SEEDS_PER_ASN=2
MIN_BLOCKS = 200000
# These are hosts that have been observed to be behaving strangely (e.g.
# aggressively connecting to every node).
SUSPICIOUS_HOSTS = set([
"127.0.0.1" - наш ип основной ноды
])
import r... | freelion93/mtucicoin | contrib/seeds/makeseeds.py | Python | mit | 3,563 |
# Created By: Virgil Dupras
# Created On: 2008-07-21
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/g... | fokusov/moneyguru | core/gui/search_field.py | Python | gpl-3.0 | 729 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2000-2005 by Yasushi Saito ([email protected])
#
# Jockey 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 (at your option) any
# later vers... | BorgERP/borg-erp-6of3 | server/openerp/pychart/coord.py | Python | agpl-3.0 | 2,226 |
###########################################################
#
# Copyright (c) 2009, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | southpawtech/TACTIC-DEV | src/tactic/ui/startup/project_config_wdg.py | Python | epl-1.0 | 34,352 |
# Copyright 2012 Nebula, 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 agree... | yeming233/horizon | openstack_dashboard/dashboards/admin/dashboard.py | Python | apache-2.0 | 1,320 |
for _ in range(int(input())):
A, B = map(int, input().split())
print('Tuzik' if A % 2 == 0 or B % 2 == 0 else 'Vanka')
| knuu/competitive-programming | codechef/ltime26_puppygm.py | Python | mit | 127 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Michael Still
# 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/l... | sacharya/nova | nova/tests/virt/disk/test_loop.py | Python | apache-2.0 | 3,418 |
# Webhooks for external integrations.
from django.utils.translation import ugettext as _
from zerver.lib.actions import check_send_stream_message
from zerver.lib.response import json_success, json_error
from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
from zerver.lib.validator import c... | amanharitsh123/zulip | zerver/webhooks/helloworld/view.py | Python | apache-2.0 | 1,295 |
from grid.models import Grid
from django.contrib.auth.models import Group, User, Permission
from package.models import Category, PackageExample, Project
from grid.models import Element, Feature, GridPackage
from core.tests import datautil
def load():
category, created = Category.objects.get_or_create(
pk=... | noisy/steemprojects.com | feeds/tests/data.py | Python | mit | 6,035 |
# Copyright (c) 2016 Hitachi Data Systems.
# 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... | openstack/manila | manila/db/migrations/alembic/versions/a77e2ad5012d_add_share_snapshot_access.py | Python | apache-2.0 | 3,742 |
from pyccel.decorators import types
#==============================================================================
@types( int )
def sum_natural_numbers( n ):
x = 0
for i in range( 1, n+1 ):
x += i
return x
# ...
@types( int )
def factorial( n ):
x = 1
for i in range( 2, n+1 ):
x... | ratnania/pyccel | tests/epyccel/modules/loops.py | Python | mit | 2,225 |
# -*- coding:Utf8 -*-
# Exemple de serveur web ne délivrant plusieurs pages simples.
import cherrypy
class MonSiteWeb(object):
def index(self):
# Renvoi d'une page HTML contenant un lien vers une autre page
# (laquelle sera produite par une autre méthode) :
return '<h2>Veuillez <a href="... | widowild/messcripts | exercice/python3/chap17/site_web_02.py | Python | gpl-3.0 | 661 |
#-*- encoding: utf-8 -*-
import ConfigParser
import string
import os
import sys
cf = ConfigParser.ConfigParser()
cf.read("test.conf")
# 返回所有的section
s = cf.sections()
print 'section:', s
o = cf.options("db")
print 'options:', o
v = cf.items("db")
print 'db:', v
print '-' * 60
# 可以按照类型读取出来
db_host = cf.get("db", "db... | quchunguang/test | pythonchallenge/config.py | Python | mit | 845 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_generated/v2016_10_01/models/_key_vault_client_enums.py | Python | mit | 4,522 |
import functools
def normalizeCode(code):
lines = [l for l in code.split('\n')]
if len(lines) < 3:
raise ValueError("Invalid number of lines ({0})".format(len(lines)))
numChars = max([len(l) for l in lines])
# assure that all lines have the same amount of characters
def adjustLine(l):
... | M-Mueller/Python-Exercises | BankOCR.py | Python | mit | 2,891 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Docker.
#
# 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... | glenux/contrib-docker-registry | depends/docker-registry-core/docker_registry/core/lru.py | Python | apache-2.0 | 2,565 |
#!/usr/bin/env python
"""
Ex 1. Construct a script that retrieves NAPALM facts from two IOS routers, two Arista switches, and one Junos device.
pynet-rtr1 (Cisco IOS) 184.105.247.70
pynet-rtr2 (Cisco IOS) 184.105.247.71
pynet-sw1 (Arista EOS) 184.105.247.72
pynet-sw2 (Arista EOS) 184.105.247.73
juniper-srx... | jrslocum17/pynet_test | Bonus3/napalm_get_model.py | Python | apache-2.0 | 1,612 |
# -*- coding: utf8 -*-
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
import datetime
import pytz
from persistent.list import PersistentList
from pyramid.httpexceptions import HTTPFound
from dace.util import getSit... | ecreall/nova-ideo | novaideo/content/processes/advertising_management/behaviors.py | Python | agpl-3.0 | 7,840 |
from __future__ import absolute_import
from django.test import Client
from django.core.handlers.wsgi import WSGIRequest
from django.core.handlers.base import BaseHandler
from celery.utils.compat import WhateverIO
class RequestFactory(Client):
"""Class that lets you create mock Request objects for use in testing... | mozilla/firefox-flicks | vendor-local/lib/python/djcelery/tests/req.py | Python | bsd-3-clause | 2,380 |
#!/usr/bin/env python3
"""Project Euler - Problem 52 Module"""
import pelib
def problem52():
"""Problem 52 - Permuted multiples"""
x = 1
while True:
ss_str_2x = sorted(set(str(2 * x)))
ss_str_3x = sorted(set(str(3 * x)))
ss_str_4x = sorted(set(str(4 * x)))
ss_str_5x = sor... | rado0x54/project-euler | python/problem0052.py | Python | mit | 651 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import functools
def memoize(obj):
"""Memoize decorator, as seen on
`here <https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize>`_
"""
cache = obj._cache = {}
@functools.wraps(obj)
def memoizer(*args, **kwargs):
key = str(args) + s... | galactics/space-api | beyond/utils/memoize.py | Python | gpl-3.0 | 453 |
# Copyright 2018 Creu Blanca
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
group_stock_request_order = fields.Boolean(
implied_group='stock_request.group_stoc... | Vauxoo/stock-logistics-warehouse | stock_request/models/res_config_settings.py | Python | agpl-3.0 | 1,123 |
from sling import Application, logger
from sling import logger
from sling.ext import hello
import localmodule
app = Application([
hello,
])
# Other way of installing a module
app.add_module(localmodule)
# Install a Falcon middleware
class HelloMiddleware(object):
def process_request(self, req, res):
... | slinghq/sling | examples/app/app.py | Python | apache-2.0 | 1,030 |
# -*- coding: utf-8 -*-
class LineCallback(object):
def __init__(self, callback):
self.callback = callback
def Pinverified(self, pin):
self.callback("Enter PinCode '" + pin + "' to your mobile phone in 2 minutes")
def QrUrl(self, url):
self.callback("Login qrcode to your... | Hyunakyu/FFR | LineAlpha/LineApi/LineCallback.py | Python | gpl-3.0 | 435 |
# -*- coding: utf-8 -*-
import scrapy
from rrs.items import RrsItem, FoodItem
class OnepageSpider(scrapy.Spider):
name = "onepage"
allowed_domains = ["cd.meituan.com"]
start_urls = [
'http://cd.meituan.com/category/meishi/'
]
def parse(self, response):
for sel in response.css("d... | tensorchen/spider | rrs/rrs/spiders/one_page.py | Python | artistic-2.0 | 1,136 |
#
# SSSD LOCAL domain tests
#
# Copyright (c) 2015 Red Hat, Inc.
# Author: Michal Zidek <[email protected]>
#
# This 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 2 only
#
# This program is distribut... | sgallagher/sssd | src/tests/intg/test_local_domain.py | Python | gpl-3.0 | 2,993 |
def main() -> None:
N = int(input())
ans = 3 ** N
odd = 1
for a in map(int, input().split()):
if a % 2 == 0:
odd *= 2
print(ans - odd)
if __name__ == '__main__':
main()
| knuu/competitive-programming | atcoder/corp/code-festival-2017-qualc_b.py | Python | mit | 215 |
#!/usr/bin/env python
import optparse
from sys import *
import os,sys,re
from optparse import OptionParser
import glob
import subprocess
from os import system
import linecache
import time
import datetime
import calendar
#=========================
def setupParserOptions():
parser = optparse.OptionParser()
... | mcianfrocco/Cianfrocco-and-Leschziner-EMCloudProcessing | get_spot_histories_all_regions_all_zones.py | Python | mit | 5,680 |
from setuptools import setup
setup(
name='python-web-demo-flask',
packages=['demo'],
)
| Appdynamics/Python-Demo-App | setup.py | Python | mit | 96 |
import logging
from src import messagebus, pages
import time
import cherrypy
class WebUI():
@cherrypy.expose
def scan(self):
pages.postOnly()
pages.require("/admin/settings.edit")
import bluetoothctl
bt = bluetoothctl.Bluetoothctl()
try:
bt.start_scan()
... | EternityForest/KaithemAutomation | kaithem/src/btadmin.py | Python | gpl-3.0 | 2,025 |
"""
sentry.models.event
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import logging
from django.db import models
from django.utils import timezone
from django.utils.datastructures import SortedDict
from django.utils.tr... | rdio/sentry | src/sentry/models/event.py | Python | bsd-3-clause | 5,941 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.