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 |
|---|---|---|---|---|---|
"""Skeleton for 'multiprocessing.managers' stdlib module."""
import threading
import queue
import multiprocessing
import multiprocessing.managers
class BaseManager(object):
def __init__(self, address=None, authkey=None):
self.address = address
def start(self, initializer=None, initargs=None):
... | asedunov/intellij-community | python/helpers/python-skeletons/multiprocessing/managers.py | Python | apache-2.0 | 1,616 |
from .symbol import *
from .ast import *
from .graph import Graph
def recurse(nt, node, g):
if isinstance(node, AstUnary):
op = recurse(nt, node.op, g)
elif isinstance(node, AstBinary):
a = recurse(nt, node.a, g)
b = recurse(nt, node.b, g)
if isinstance(node, AstSquares):
... | giannitedesco/pylr | bootstrap/grammar.py | Python | gpl-3.0 | 21,703 |
import logging
import sys
from cliff.app import App
from cliff.commandmanager import CommandManager
class RedditApiCli(App):
log = logging.getLogger(__name__)
def __init__(self):
super(RedditApiCli, self).__init__(
description='Reddit API CLI',
version='0.1',
com... | gobins/python-redditcli | redditcli/main.py | Python | apache-2.0 | 893 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 OpenStack Foundation
#
# 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... | armando-migliaccio/neutron | neutron/db/migration/alembic_migrations/versions/2032abe8edac_lbaas_add_status_des.py | Python | apache-2.0 | 1,580 |
import os
import os.path
from freight.constants import PROJECT_ROOT
from freight.exceptions import CommandError
class UnknownRevision(CommandError):
pass
class Vcs(object):
ssh_connect_path = os.path.join(PROJECT_ROOT, "bin", "ssh-connect")
def __init__(self, workspace, url, username=None):
se... | getsentry/freight | freight/vcs/base.py | Python | apache-2.0 | 1,987 |
"""Start a tcp gateway."""
import click
from mysensors.cli.helper import (
common_gateway_options,
handle_msg,
run_async_gateway,
run_gateway,
)
from mysensors.gateway_tcp import AsyncTCPGateway, TCPGateway
def common_tcp_options(func):
"""Supply common tcp gateway options."""
func = click.op... | theolind/pymysensors | mysensors/cli/gateway_tcp.py | Python | mit | 1,102 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01/aio/operations/_network_management_client_operations.py | Python | mit | 49,275 |
from sympy.core import pi, oo, symbols, Function, Rational, Integer, GoldenRatio, EulerGamma, Catalan, Lambda, Dummy
from sympy.functions import Piecewise, sin, cos, Abs, exp, ceiling, sqrt
from sympy.utilities.pytest import raises
from sympy.printing.ccode import CCodePrinter
from sympy.utilities.lambdify import imple... | ichuang/sympy | sympy/printing/tests/test_ccode.py | Python | bsd-3-clause | 8,389 |
"""
@file
@brief Various helpers about files
"""
import os
import stat
import warnings
from io import BytesIO, StringIO
from .synchelper import explore_folder_iterfile
from .internet_helper import read_url
from .file_info import is_file_string, is_url_string
def change_file_status(folder, status=stat.S_IWRITE, s... | sdpython/pyquickhelper | src/pyquickhelper/filehelper/anyfhelper.py | Python | mit | 8,411 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations, models
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
... | stvstnfrd/edx-platform | openedx/core/djangoapps/django_comment_common/migrations/0001_initial.py | Python | agpl-3.0 | 1,395 |
# coding: utf8
"""
Семантический анализатор
"""
from string import uppercase
from PropositionTree import PropositionTree
from PropositionTreeNode import PropositionTreeNode
from PropositionTreeNodeType import PropositionTreeNodeType
from PropositionTreeNodeSide import PropositionTreeNodeSide
from TreeNodeConcept impor... | rimsleur/qsl | interpreter/SemanticAnalyzer.py | Python | gpl-2.0 | 87,380 |
from dataAccess import DataAccess
from databaseCreation import Ability
from databaseCreation import Weakness
from databaseCreation import Flaw
from databaseCreation import Perk
from databaseCreation import AttackFlaw
from databaseCreation import AttackPerk
from databaseCreation import CharacterWeakness
from databaseCre... | capchu/TextRPGOnline | rpgonline/addBaseData.py | Python | gpl-3.0 | 7,804 |
# Generated by Django 2.2.13 on 2020-08-30 15:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tooltips', '0010_auto_20200821_1049'),
]
operations = [
migrations.AlterField(
model_name='tooltip',
name='color',
... | flavoi/diventi | diventi/tooltips/migrations/0011_auto_20200830_1750.py | Python | apache-2.0 | 1,014 |
# -*- Mode: Python; test-case-name: flumotion.test.test_pb -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public Licen... | flyapen/UgFlu | flumotion/test/test_pb.py | Python | gpl-2.0 | 21,373 |
# Copyright 2015 Intel Corp.
#
# 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, soft... | zhimin711/nova | nova/tests/unit/servicegroup/test_api.py | Python | apache-2.0 | 2,053 |
from mmd.molecule import Molecule
from mmd.postscf import PostSCF
water = """
0 1
O 0.000000 -0.075791844 0.000000
H 0.866811829 0.601435779 0.000000
H -0.866811829 0.601435779 0.000000
"""
# init molecule and build integrals
mol = Molecule(geometry=water,basis='sto-3g')
# do the SCF
mol... | jjgoings/McMurchie-Davidson | examples/cis_and_tdhf.py | Python | bsd-3-clause | 510 |
# encoding: utf-8
import datetime
import os
from pysteam import shortcuts
import paths
from logs import logger
def default_backups_directory():
return os.path.join(paths.application_data_directory(), 'Backups')
def backup_filename(user, timestamp_format):
timestamp = datetime.datetime.now().strftime('%Y%m%d%H... | scottrice/Ice | ice/backups.py | Python | mit | 1,971 |
# Copyright (c) 2014 OpenStack Foundation.
#
# 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 ... | Hybrid-Cloud/cinder | cinder/hacking/checks.py | Python | apache-2.0 | 18,896 |
#! /usr/bin/env python
# encoding: utf-8
# DC 2008
# Thomas Nagy 2010 (ita)
import re
from waflib import Utils, Task, TaskGen, Logs
from TaskGen import feature, before, after, extension
from waflib.Tools import ccroot
IS_MODULE_R = re.compile('module ([a-z]*)')
USE_MODULE_R = re.compile('use ([a-z]*)')
@extension('... | mattaw/SoCFoundationFlow | admin/waf/waf-1.8.14/demos/fortran/mod/fakecc.py | Python | apache-2.0 | 1,284 |
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license
from scapy.packet import *
from scapy.fields import *
_rtp_payload_types = {
# http://www.iana.org/assignments/rtp-p... | bacemtayeb/Tierra | src/lib/scapy/layers/rtp.py | Python | gpl-3.0 | 1,384 |
from geoscript import render
from geoscript.util import deprecated
@deprecated
def draw(g, size=(500,500)):
"""Use :func:`geoscript.render.draw`"""
render.draw(g, size=size)
@deprecated
def plot(geoms, size=(500,500)):
"""Use :func:`geoscript.render.plot`"""
render.plot(geoms, size=size)
| jericks/geoscript-py | geoscript/viewer.py | Python | mit | 299 |
"""
Support for Belkin WeMo lights.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/light.wemo/
"""
import logging
from datetime import timedelta
import homeassistant.util as util
import homeassistant.util.color as color_util
from homeassistant.componen... | MungoRae/home-assistant | homeassistant/components/light/wemo.py | Python | apache-2.0 | 4,507 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-09 16:09
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('wagtaildocs', '0007_merge'),
... | terotic/digihel | digi/migrations/0008_auto_20160909_1909.py | Python | mit | 3,342 |
#!/usr/bin/env python3
import ephem
from ephem import cities
import argparse
import datetime
import re
import sys
# Slop allowed in phase calculation, in percent:
PHASESLOP = 5
def find_rise_set(observer, body, rise, start, end, targetaz, phase, slop):
# convert angles to radians
slop *= ephem.pi / 180
... | akkana/scripts | astro/rise_set_az.py | Python | gpl-2.0 | 6,024 |
#!/usr/bin/env python
# coding: utf-8
"""
Github version of hyperparameter optimization for Vowpal Wabbit via hyperopt
"""
__author__ = 'kurtosis'
from hyperopt import hp, fmin, tpe, rand, Trials, STATUS_OK
from sklearn.metrics import roc_curve, auc, log_loss, precision_recall_curve
import numpy as np
from datetime ... | pombredanne/vowpal_wabbit | utl/vw-hyperopt.py | Python | bsd-3-clause | 15,623 |
"""
This module is for inspecting OGR data sources and generating either
models for GeoDjango and/or mapping dictionaries for use with the
`LayerMapping` utility.
"""
from django.utils.six.moves import zip
# Requires GDAL to use.
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.gdal.field import O... | Proggie02/TestRepo | django/contrib/gis/utils/ogrinspect.py | Python | bsd-3-clause | 8,925 |
# Doubting Thomas Explorer:
# A set of scripts to explore the bible through cross references
# thomascsv.py -- uses doubtingthomas.py gathering of verses and formats to csv
#
# Author: Owen Auch
# Matthew 28:17 -- "When they saw him, they worshiped him; but some doubted."
from doubtingthomas import *
import csv
import... | owenauch/doubting-thomas-explorer | scripts/thomascsv.py | Python | mit | 2,557 |
# -*- coding: utf-8 -*-
##############################################################################
#
# GNU Health: The Free Health and Hospital Information System
# Copyright (C) 2011-2014 Sebastian Marro <smarro@gnusolidario.org>
#
# This program is free software: you can redistribute it and/or modify
# ... | kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/health_reporting/__init__.py | Python | gpl-3.0 | 1,589 |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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... | NeCTAR-RC/swift | swift/common/ring/builder.py | Python | apache-2.0 | 45,777 |
# Copyright 2022 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 writ... | googleapis/python-compute | samples/ingredients/disks/empty_disk.py | Python | apache-2.0 | 2,249 |
# User creation text spoke
#
# Copyright (C) 2013-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distrib... | sujithshankar/anaconda | pyanaconda/ui/tui/spokes/user.py | Python | gpl-2.0 | 7,348 |
from django.utils.translation import ugettext_lazy as _
from oscar.core.loading import get_class
ReportCSVFormatter = get_class(
'dashboard.reports.reports', 'ReportCSVFormatter')
class OrderDiscountCSVFormatter(ReportCSVFormatter):
filename_template = 'order-discounts-for-offer-%s.csv'
def generate_cs... | michaelkuty/django-oscar | src/oscar/apps/dashboard/offers/reports.py | Python | bsd-3-clause | 970 |
from django import get_version, forms
from django.forms import Widget
from django import utils
from django.utils.encoding import force_text
import copy
from distutils.version import StrictVersion
try:
import simplejson as json
except ImportError:
import json
if StrictVersion(get_version()) < StrictVersion('1.9.... | valttin/django-bl-check | blacklist_check/widgets.py | Python | bsd-3-clause | 6,375 |
# -*- coding: utf-8 -*-
from learning_journal.models import Entry, DBSession
def test_create_entry(dbtransaction):
"""Test for a change of state of the model."""
new_model = Entry(title="jill", text='jello')
assert new_model.id is None
DBSession.add(new_model)
DBSession.flush()
assert new_mode... | wohlfea/learning_journal | learning_journal/tests/test_models.py | Python | mit | 337 |
from django.conf.urls import url
urlpatterns = [
url(r'^forge/$', 'add_new_relationship', prefix='cripts.relationships.views'),
url(r'^breakup/$', 'break_relationship', prefix='cripts.relationships.views'),
url(r'^get_dropdown/$', 'get_relationship_type_dropdown', prefix='cripts.relationships.views'),
... | lakiw/cripts | cripts/relationships/urls.py | Python | mit | 758 |
import argparse
import sys
import polypy
import polypy_test
def forkexec(test, env):
if sys.version_info >= (3,0): #IAM: (3, 2) might be more accurate...
with open(test) as testf:
code = compile(testf.read(), test, 'exec') #IAM: explicit compile makes debugging easier.
exec(code, ... | SRI-CSL/libpoly | test/python/check.py | Python | lgpl-3.0 | 1,801 |
import unittest
from datetime import date, timedelta
from wtforms import ValidationError
from application.frontend.validators import ValidateDateNotInFuture
from application.frontend import field_helpers
class FakeField(object):
def __init__(self, data):
self.data = data
def data(self):
ret... | LandRegistry/casework-frontend-alpha | tests/test_validators.py | Python | mit | 1,158 |
import json
import requests
from transliterate import translit
_eng_chars = "~!@#$%^&qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:\"|ZXCVBNM<>?"
_rus_chars = "ё!\"№;%:?йцукенгшщзхъфывапролджэячсмитьбю.ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭ/ЯЧСМИТЬБЮ,"
_trans_table = dict(zip(_eng_chars, _rus_chars))
def _fix_layout(s):
... | bashkirtsevich/autocode | text_preprocessing/es_predict.py | Python | gpl-3.0 | 1,121 |
import os.path
import types
import copy
from config import DATA_ARCHIVE_ROOT
from dataload import get_data_folder
from utils.common import SubStr
from utils.dataload import (load_start, load_done,
tab2dict, tab2list, value_convert, normalized_value,
list2dict, dic... | gkarthik/mygene.hub | src/dataload/sources/ensembl/ensembl_base.py | Python | gpl-3.0 | 7,621 |
# 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/environments/env_test.py | Python | apache-2.0 | 32,068 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('people', '0007_auto_20160321_1805'),
('about', '0001_initial'),
# had to be specified manually to ... | ghostwords/localore | localore/about/migrations/0002_aboutpagerelatedperson.py | Python | mpl-2.0 | 1,092 |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/w2.py | Python | mit | 11,733 |
"""
sentry.models.authenticator
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2016 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import os
import hmac
import time
import base64
import hashlib
import six
from u2flib_server impor... | alexm92/sentry | src/sentry/models/authenticator.py | Python | bsd-3-clause | 20,330 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-01-13 17:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('chat', '0001_initial'),
]
operations = [
migrations.AddField(
m... | tndatacommons/tndata_backend | tndata_backend/chat/migrations/0002_auto_20170113_1728.py | Python | mit | 663 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-08-09 17:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('osf', '0048_merge_20170804_0910'),
]
operations = [
migrations.AddField(
... | mfraezz/osf.io | osf/migrations/0049_preprintprovider_preprint_word.py | Python | apache-2.0 | 579 |
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2013-2017, OVH SAS.
# 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, t... | arnaudmorin/python-ovh | tests/test_client.py | Python | bsd-3-clause | 16,541 |
#!/usr/bin/python
import ldtp
import ldtputils
import os
import tempfile
import shutil
import xml.parsers.expat
import gda
main_window = '*Glom*'
initial_dialog = 'WelcometoGlom'
central_info = []
# Radio button texts in the database creation dialog
backend_create_db_button_texts = {
'PostgresCentral': [
'Creat... | GNOME/glom | ldtp/common.py | Python | gpl-3.0 | 7,507 |
#!/usr/bin/env python2.7
from __future__ import print_function
import socket
import time
import json
in_addr = ('localhost', 1921)
out_addr = ('localhost', 1922)
confirm_send = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
health_recvr = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
health_recvr.bind(in_addr)... | pioneers/forseti | octopus_tester.py | Python | apache-2.0 | 674 |
import json
from django.db import models
import requests
from Suchary.settings import GCM_API_KEY
class Device(models.Model):
registration_id = models.TextField()
android_id = models.TextField(unique=True)
alias = models.TextField(blank=True)
version = models.CharField(max_length=20)
model = mod... | jchmura/suchary-django | api/models.py | Python | mit | 1,121 |
# Copyright 2015 VMware, 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 applica... | gandelman-a/neutron-lbaas | neutron_lbaas/services/loadbalancer/drivers/vmware/edge_driver.py | Python | apache-2.0 | 8,963 |
import sys
import xml.etree.ElementTree as ET
# This program should be run like:
# python2 clean_up_process_with_id.py $id
args = sys.argv
id = '-' + args[1] + '-'
root = ET.parse('/etc/guacamole/noauth-config.xml').getroot()
for child in root:
if id in child.attrib['name']:
root.remove(child)
br... | Calvin-CS/Agora | scripts/clean_up_process_with_id.py | Python | gpl-3.0 | 399 |
from Products.Archetypes.browser.validation import InlineValidationView as _IVV
from Acquisition import aq_inner
from Products.CMFCore.utils import getToolByName
import json
SKIP_VALIDATION_FIELDTYPES = ('image', 'file', 'datetime', 'reference')
class InlineValidationView(_IVV):
def __call__(self, uid, fname, v... | veroc/Bika-LIMS | bika/lims/browser/validation.py | Python | agpl-3.0 | 962 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
__doc__ = """
gyptest.py -- test runner for GYP tests.
"""
import os
import optparse
import subprocess
import sys
class CommandRunner:
"... | zoobab/gyp | gyptest.py | Python | bsd-3-clause | 7,940 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para Pelisxporno
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import re
from core import config
from core import logger
f... | ChopChopKodi/pelisalacarta | python/main-classic/channels/pelisxporno.py | Python | gpl-3.0 | 3,341 |
from sympy import (symbols, Symbol, nan, oo, zoo, I, sinh, sin, acot, pi, atan,
acos, Rational, sqrt, asin, acot, cot, coth, E, S, tan, tanh, cos,
cosh, atan2, exp, log, asinh, acoth, atanh, O, cancel, Matrix, re, im,
Float, Pow, gcd)
from sympy.utilities.pytest import XFAIL
def test_sin():
... | flacjacket/sympy | sympy/functions/elementary/tests/test_trigonometric.py | Python | bsd-3-clause | 27,259 |
# pylint: disable=I0011,W0613,W0201,W0212,E1101,E1103
from __future__ import absolute_import, division, print_function
import numpy as np
from ..component_link import ComponentLink
from ..data import ComponentID, DerivedComponent
from ..data import Data, Component
from ..data_collection import DataCollection
from ..... | stscieisenhamer/glue | glue/core/tests/test_link_manager.py | Python | bsd-3-clause | 8,367 |
# -*- coding: utf-8 -*-
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def delete_messages_sent_to_stream_stat(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
UserCount = apps.get_model(... | jackrzhang/zulip | analytics/migrations/0009_remove_messages_to_stream_stat.py | Python | apache-2.0 | 1,151 |
# -*- coding: utf-8 -*-
# czat/views.py
from django.shortcuts import render
# from django.http import HttpResponse
from django.contrib.auth import login, logout
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.contrib import messages
from czat.models import Wiadomosc
def... | koduj-z-klasa/python101 | docs/webdjango/czat1/views.py | Python | mit | 1,817 |
# -*- coding: utf-8 -*-
"""
pyedna.serv
-------------
This module contains functions within the EzDnaServApi, mainly used for
direct interaction with eDNA services, such as pushing data in real-time.
:copyright: (c) 2017 Eric Strong.
:license: Refer to LICENSE.txt for more information.
"""
imp... | drericstrong/pyedna | pyedna/serv.py | Python | agpl-3.0 | 13,816 |
import xml.etree.ElementTree as ET
tree = ET.parse('case1.xml')
root = tree.getroot()
output = root.find('data')
time_list_integer = []
val_list_integer = []
for var in output:
for i in range(len(var)):
if var[i].tag == 'vaname' and var[i].text == 'HR':
time_text = var[i+1].text
val... | ScreenBasedSimulator/BioGears-Paper | cae-simulations/xml_process.py | Python | mit | 1,116 |
#!flask/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(S... | rkk09c/Flask_Boilerplate | db_create.py | Python | mit | 484 |
import argparse
import os.path
import json
import urllib
from two1.commands.config import Config
from two1.lib.wallet import Wallet
from two1.lib.bitrequests import BitTransferRequests
wallet = Wallet()
username = Config().username
requests = BitTransferRequests(wallet, username)
def get_geocode(address, host):
... | chrisguida/geocode-21bc | static/client.py | Python | mit | 1,661 |
# Copyright 2013-2020 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 PerlPerlVersion(PerlPackage):
"""Parse and manipulate Perl version strings"""
homepag... | iulian787/spack | var/spack/repos/builtin/packages/perl-perl-version/package.py | Python | lgpl-2.1 | 654 |
# 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/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/__init__.py | Python | mit | 3,231 |
"""
WSGI config for django_silky 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/2.0/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.wsgi... | crunchr/silk | project/wsgi.py | Python | mit | 386 |
from .base import BaseProject
class Flotilla():
def add_module(self, klass):
if not hasattr(self, "project"):
self.project = BaseProject()
self.project.add_module(klass)
def run(self):
self.project.run()
flotilla = Flotilla()
| offmessage/blackpearl | blackpearl/projects/simple.py | Python | mit | 294 |
# Copyright 2014 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.
from integration_tests import chrome_proxy_measurements as measurements
from integration_tests import chrome_proxy_pagesets as pagesets
from telemetry import... | ltilve/chromium | tools/chrome_proxy/integration_tests/chrome_proxy_benchmark.py | Python | bsd-3-clause | 6,442 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''BaseHandler
'''
import logging
import time
from twork.errors import (ArgumentNotFoundError,
ArgumentTypeError,
ArgumentEmptyError,
)
from twork.utils.common import parse_web_input
from tw... | bufferx/twork | scaffold/twork_app/twork_app/web/action/base.py | Python | apache-2.0 | 1,484 |
# -*- coding: utf-8 -*-
import random
from decimal import Decimal
from helper import IcebergUnitTestCase, get_api_handler
from helpers.login_utils import IcebergLoginUtils
class ProductChannelTests(IcebergUnitTestCase):
@classmethod
def setUpClass(cls):
cls.my_context_dict = {}
cls._objects_to... | Iceberg-Marketplace/Iceberg-API-PYTHON | tests/test_channels.py | Python | mit | 14,433 |
# Copyright 2013-2015 Massachusetts Open Cloud Contributors
#
# 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 applicab... | henn/hil | tests/deployment/headnodes.py | Python | apache-2.0 | 2,516 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2012 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... | jirikuncar/invenio-demosite | invenio_demosite/testsuite/regression/test_batchuploader.py | Python | gpl-2.0 | 12,757 |
states = {
'Oregon': 'OR',
'Florida': 'FL',
'California': 'CA',
'New York': 'NY',
'Michigan': 'MI'
}
cities = {
'CA': 'San Francisco',
'MI': 'Detroit',
'FL': 'Jacksonville'
}
cities['NY'] = 'New York'
cities['OR'] = 'Portland'
print '-' * 10
print "NY State has: ", cities['NY']
print ... | chrisortman/CIS-121 | k0765065/lpthw/ex39.py | Python | mit | 1,130 |
# Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Optional, TYPE_CHECKING
from UM.Qt.QtApplication import QtApplication
from UM.Math.Vector import Vector
from UM.Resources import Resources
from UM.View.RenderPass import RenderPass
from UM.View.GL.OpenG... | Patola/Cura | cura/PickingPass.py | Python | lgpl-3.0 | 3,145 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('authsys', '0004_auto_20160411_1537'),
]
operations = [
migrations.CreateModel(
name='machine_info',
... | yangxianbo/jym | authsys/migrations/0005_auto_20160411_2326.py | Python | gpl-3.0 | 2,079 |
'''
Code for creating 10x10 degree tiles of aboveground+belowground carbon accumulation rate
and plantation category out of the plantation geodatabase.
Its outputs are two sets of tiles at the full extent of planted forest features (not masked by mangrove or
non-mangrove natural forest): above+belowground carbon accumu... | sgibbes/carbon-budget | data_prep/mp_plantation_preparation.py | Python | apache-2.0 | 26,910 |
#!/usr/bin/env python3
import sys, os
#Otherwise it will look in the symlinked path for imports
sys.path.append(os.getcwd())
from errorTestTools import *
exCode = runTests({
"0. Valid INIT" : ["0 0.0 0.0 0.0 0", "0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","7.0e9","7.0e9","7.0e9"],
... | SixTrack/SixTrack | test/error_init/errorTests.py | Python | lgpl-2.1 | 1,100 |
from __future__ import with_statement
import os
import sys
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
PROJECT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(PROJECT_DIR)
# this is the Alembic Config object, w... | logston/plog-work | alembic/env.py | Python | bsd-3-clause | 2,348 |
class AddAuthTokenMiddleware(object):
"""
Adds auth_token cookie to response
"""
def process_response(self, request, response):
if hasattr(request, 'user') and request.user and request.user.is_authenticated():
auth_token = request.user.auth_token
if auth_token:
... | jessamynsmith/eggtimer-server | periods/middleware.py | Python | mit | 400 |
__author__ = 'student'
import random
import matplotlib.pyplot as plt
random.seed(0)
n1 = 100
values = [random.normalvariate(0, 1) for i in range(n1)]
plt.hist(values, bins = 100)
plt.show()
random.seed(0)
n2 = 1000
values = [random.normalvariate(0, 1) for i in range(n2)]
plt.hist(values, bins = 100)
plt.show()
rando... | YellowNettle/Labs-16 | 1.py | Python | gpl-3.0 | 562 |
from __future__ import absolute_import
from __future__ import division
import logging
import random
import time
from builtins import map
from builtins import object
from builtins import range
from fn import _
from past.utils import old_div
from .technique import SearchTechnique
from .technique import register
log =... | jansel/opentuner | opentuner/search/differentialevolution.py | Python | mit | 5,491 |
"""
Copyright (C) 2017 Charles Schaff, David Yunis, Ayan Chakrabarti,
Matthew R. Walter. See LICENSE.txt for details.
"""
# Generates test data for a given map. The data consists of tuples
# of the form:
# - a (x,y) location in the map
# - the distance to each beacon from this location
# - the number of i... | cbschaff/NBP | src/gen_test_data.py | Python | gpl-3.0 | 1,816 |
from sso.services import BaseService
class DummyService(BaseService):
""" Always passes, good for a test service """
pass
ServiceClass = 'DummyService'
| nikdoof/test-auth | app/sso/services/dummy/__init__.py | Python | bsd-3-clause | 163 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import json
from typing import List, Optional, Sequence
from idb.common.types import Address, CompanionInfo, ScreenDim... | facebook/FBSimulatorControl | idb/grpc/target.py | Python | mit | 3,146 |
# Copyright 2014 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 agr... | askdaddy/PerfKitBenchmarker | perfkitbenchmarker/packages/fortran.py | Python | apache-2.0 | 884 |
#!/usr/bin/env python
"""Parse an object catalog data, returning a list of data dictionaries, one per object.
History:
2003-11-04 ROwen
2003-11-18 ROwen Modified to use SeqUtil instead of MathUtil.
2004-02-23 ROwen Preference files are now read with universal newline support
on Python 2.3 or ... | r-owen/stui | TUI/TCC/Catalog/ParseCat.py | Python | bsd-3-clause | 10,117 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | timsnyder/bokeh | bokeh/core/tests/test_enums.py | Python | bsd-3-clause | 11,575 |
from __future__ import unicode_literals
import datetime
import os
import subprocess
from django.utils.lru_cache import lru_cache
def get_version(version=None):
"Returns a PEP 386-compliant version number from VERSION."
version = get_complete_version(version)
# Now build the two parts of the version num... | simbha/mAngE-Gin | lib/django/utils/version.py | Python | mit | 2,279 |
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Version 2.0 (the "Lice... | sparkslabs/kamaelia_ | Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Internet/NewDP.MS.py | Python | apache-2.0 | 3,037 |
"""
Django settings for dashboard project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
ADMINS =... | caneruguz/share-analytics | service/service/settings/base.py | Python | apache-2.0 | 4,791 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | OmeGak/indico-plugins | vc_dummy/setup.py | Python | gpl-3.0 | 1,523 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields
class MrpConfigSetting... | alfredoavanzosc/odoomrp-wip-1 | mrp_operations_extension/models/res_config.py | Python | agpl-3.0 | 544 |
# -*- coding: utf-8 -*-
"""Jobs for security groups."""
from time import sleep
from botocore.exceptions import ClientError
from ..aws import securitygroup
from .exceptions import ResourceAlreadyExists
from .exceptions import ResourceDoesNotExist
from .exceptions import ResourceHasDependency
from .exceptions import... | jtpaasch/armyguys | armyguys/jobs/securitygroups.py | Python | mit | 8,848 |
# -*- 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 field 'XForm.require_auth'
db.add_column(u'logger_xform', 'require_auth',
sel... | awemulya/fieldsight-kobocat | onadata/apps/logger/south_migrations/0045_auto__add_field_xform_require_auth.py | Python | bsd-2-clause | 12,190 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | Karel-van-de-Plassche/bokeh | bokeh/application/handlers/code.py | Python | bsd-3-clause | 6,686 |
from googleplaces import GooglePlaces, types, lang
import json
import urllib
def attraction_list():
YOUR_API_KEY = 'AIzaSyBwNcWLEs2CtcXgjur6nbR8JwGsiK-0HGw'
google_places = GooglePlaces(YOUR_API_KEY)
LOCATION = app.send_location()
QUERY = 'attraction'
MyUrl = ('https://maps.googleapis.com/maps/api/place/texts... | angelica1997/Vacation-Planner | attractions.py | Python | mit | 990 |
SITE_ID = 1
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sites',
'django.contrib.auth',
'django.contrib.admin',
'appconf.tests',
]
TEST_RUNNER = 'discover_runner... | bop/foundation | lib/python2.7/site-packages/appconf/test_settings.py | Python | gpl-2.0 | 358 |
from django.http import HttpResponseRedirect
from google.appengine.api import users
from blog.models import Post
import settings
def login_required(func):
def _wrapper(request, *args, **kwargs):
user = users.get_current_user()
if user:
return func(request, *args, **kwargs)
... | lvbeck/niubi | common/auth.py | Python | apache-2.0 | 2,078 |
# Copyright 2014 Ahmed El-Hassany
#
# 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 wri... | jmiserez/sts | tests/unit/sts/entities/controllers_test.py | Python | apache-2.0 | 4,168 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# <https://code.activestate.com/recipes/580709-lines-of-code-loc/>
# Basic Lines-Of-Code counter in Python source files, reporting the
# number of blank, comment and source code lines and total number of
# lines in all Python files scanned.
# Usage example:
# % python ... | KamilKwiatkowski123/Repozytorium | recipe-580709-1.py | Python | gpl-3.0 | 4,433 |
#! /usr/bin/env python3
import cgi
import html
import os
import sys
import http.cookies
import time
import traceback
import plotter_interface as pl
from lib.graph.point import point
from lib import const, web
os.chdir(const.SITE_DIR)
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
seed = cookie.get... | Alexponomarev7/plotter | cgi-bin/preview.py | Python | mit | 4,971 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.