text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
"""Utility functions, node construction macros, etc."""
# Author: Collin Winter
# Local imports
from .pgen2 import token
from .pytree import Leaf, Node
from .pygram import python_symbols as syms
from . import patcomp
###########################################################
### Common node-construction "macros"
##... | 2ndy/RaspIM | usr/lib/python2.6/lib2to3/fixer_util.py | Python | gpl-2.0 | 14,225 | 0.002812 |
from .constants import ALL
from .tasks import Task
from .utils import import_attr
class Gator(object):
def __init__(
self, conn_string, queue_name=ALL, task_class=Task, backend_class=None
):
"""
A coordination for scheduling & processing tasks.
Handles creating tasks (with opt... | toastdriven/alligator | alligator/gator.py | Python | bsd-3-clause | 10,077 | 0 |
from temboo.Library.Utilities.XML.GetValuesFromXML import GetValuesFromXML, GetValuesFromXMLInputSet, GetValuesFromXMLResultSet, GetValuesFromXMLChoreographyExecution
from temboo.Library.Utilities.XML.RunXPathQuery import RunXPathQuery, RunXPathQueryInputSet, RunXPathQueryResultSet, RunXPathQueryChoreographyExecution
| jordanemedlock/psychtruths | temboo/core/Library/Utilities/XML/__init__.py | Python | apache-2.0 | 319 | 0.00627 |
# Copyright 2015 Andrea Frittoli <andrea.frittoli@gmail.com>
#
# 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... | andreafrittoli/eowyn | eowyn/api.py | Python | apache-2.0 | 4,364 | 0.000229 |
"""
@author:
"""
import bottle
# this variable MUST be used as the name for the cookie used by this application
COOKIE_NAME = 'sessionid'
def check_login(db, usernick, password):
"""returns True if password matches stored"""
def generate_session(db, usernick):
"""create a new session and add a cookie to t... | stevecassidy/pyunitgrading | tests/bad/single/43684882/comp249-psst-starter-master/users.py | Python | bsd-3-clause | 815 | 0.008589 |
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import subprocess
import sys
from textwrap import dedent
from twitter.common.contextutil import pushd
from pex.testing import temporary_content
def assert_entry_points(entry_... | mzdanieltest/pex | tests/test_bdist_pex.py | Python | apache-2.0 | 1,373 | 0.00874 |
# -*- coding: utf-8 -*-
"""This module defines functions generally useful in scikit-ci."""
import os
from .constants import SERVICES, SERVICES_ENV_VAR
def current_service():
for service, env_var in SERVICES_ENV_VAR.items():
if os.environ.get(env_var, 'false').lower() == 'true':
return servi... | scikit-build/scikit-ci | ci/utils.py | Python | apache-2.0 | 1,327 | 0 |
"""Example shows how to send requests and get responses."""
import asyncio
from obswsrc import OBSWS
from obswsrc.requests import ResponseStatus, StartStreamingRequest
from obswsrc.types import Stream, StreamSettings
async def main():
async with OBSWS('localhost', 4444, "password") as obsws:
# We can ... | KirillMysnik/obs-ws-rc | examples/2. Make requests/make_requests.py | Python | mit | 1,156 | 0 |
from json import loads
import codecs
import environ
FIXTURE_PATH = (environ.Path(__file__) - 1).path('fixtures')
def read_json(fpath):
with codecs.open(fpath, 'rb', encoding='utf-8') as fp:
return loads(fp.read())
def read_fixture(*subpath):
fixture_file = str(FIXTURE_PATH.path(*subpath))
retu... | Rustem/toptal-blog-celery-toy-ex | celery_uncovered/tricks/utils.py | Python | mit | 347 | 0 |
from typing import Callable, List, Dict, Optional
import numpy as np
from typeguard import check_argument_types
from neuralmonkey.model.model_part import ModelPart
from neuralmonkey.decoders.beam_search_decoder import (BeamSearchDecoder,
SearchStepOutput)
from ne... | bastings/neuralmonkey | neuralmonkey/runners/beamsearch_runner.py | Python | bsd-3-clause | 5,107 | 0.000587 |
class MyStuff(object):
def __init__(self):
self.tangerine = "And now a thousand years between"
def apple(self):
print "I am classy apples!"
| mrniranjan/python-scripts | reboot/practice6.py | Python | gpl-2.0 | 149 | 0.033557 |
# Copyright (c) 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 requir... | bigswitch/neutron | neutron/tests/functional/agent/test_ovs_flows.py | Python | apache-2.0 | 19,181 | 0.000209 |
from app.app_and_db import app
from flask import Blueprint, jsonify, render_template
import datetime
import random
import requests
dashboard = Blueprint('dashboard', __name__)
cumtd_endpoint = 'https://developer.cumtd.com/api/{0}/{1}/{2}'
cumtd_endpoint = cumtd_endpoint.format('v2.2', 'json', 'GetDeparturesByStop')
... | nickofbh/kort2 | app/dashboard/views.py | Python | mit | 1,414 | 0.019095 |
#! /usr/bin/env python
"""
Initialize, start, stop, or destroy WAL replication mirror segments.
============================= DISCLAIMER =============================
This is a developer tool to assist with development of WAL replication
for mirror segments. This tool is not meant to be used in production.
It is sug... | edespino/gpdb | gpAux/gpdemo/gpsegwalrep.py | Python | apache-2.0 | 24,714 | 0.005422 |
# This file is part of the dionaea honeypot
#
# SPDX-FileCopyrightText: 2009 Paul Baecher & Markus Koetter & Mark Schloesser
#
# SPDX-License-Identifier: GPL-2.0-or-later
from dionaea.core import connection
class echo(connection):
def __init__ (self, proto=None):
print("echo init")
connection.__ini... | dionaea-honeypot/dionaea | modules/python/dionaea/echo.py | Python | gpl-2.0 | 1,366 | 0.012445 |
from __future__ import absolute_import
from sqlalchemy import types
from sqlalchemy.dialects.postgresql import ARRAY
from sqlalchemy.dialects.postgresql.base import ischema_names, PGTypeCompiler
from sqlalchemy.sql import expression
from ..primitives import Ltree
from .scalar_coercible import ScalarCoercible
class ... | konstantinoskostis/sqlalchemy-utils | sqlalchemy_utils/types/ltree.py | Python | bsd-3-clause | 3,375 | 0 |
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from django.contrib.auth.decorators import login_required, user_passes_test
urlpatterns = patterns('',
url(r'^$', 'website.views.index', name='website_index'),
url(r'^termos/$',TemplateView.as_view(template_name='website/... | agendaTCC/AgendaTCC | tccweb/apps/website/urls.py | Python | gpl-2.0 | 603 | 0.008292 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-17 09:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [("impart", "0004_auto_20170117_0916")]
operations = [
mig... | jw/imagery | imagery/impart/migrations/0005_auto_20170117_0922.py | Python | mit | 621 | 0 |
from django.conf import settings
import factory
from pgallery.models import Gallery, Photo
class UserFactory(factory.django.DjangoModelFactory):
username = factory.Sequence(lambda n: "user_%d" % n)
email = factory.Sequence(lambda n: "user_%d@example.com" % n)
class Meta:
model = settings.AUTH_U... | zsiciarz/django-pgallery | tests/factories.py | Python | mit | 805 | 0 |
from utils import *
import sys
def clean_rec(d):
kwhs, kwhs_oriflag = d["kwhs"]
temps, temps_oriflag = d["temps"]
for i in range(len(temps_oriflag)):
t = temps[i]
if t < -60:
temps_oriflag[i] = False #Ain't no way that reading's real
temps[i] = 0
for i in range... | dssg/energywise | Code/clean_brecs.py | Python | mit | 947 | 0.01056 |
# Copyright 2020 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... | gunan/tensorflow | tensorflow/python/types/core.py | Python | apache-2.0 | 1,707 | 0.005858 |
#
# Copyright 2013 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | mattcaldwell/zipline | zipline/protocol.py | Python | apache-2.0 | 14,487 | 0 |
import alsaaudio
from math import pi, sin, pow
import getch
SAMPLE_RATE = 44100
FORMAT = alsaaudio.PCM_FORMAT_U8
PERIOD_SIZE = 512
N_SAMPLES = 1024
notes = "abcdefg"
frequencies = {}
for i, note in enumerate(notes):
frequencies[note] = 440 * pow(pow(2, 1/2), i)
# Generate the sine wave, centered at y=128 with 10... | zmarvel/playground | sound/testplay.py | Python | mit | 3,152 | 0.005076 |
#!/usr/bin/env python
from distutils.core import setup
setup(name='check_iftraffic_nrpe',
version='0.12.1',
description='Nagios NRPE plugin to check Linux network traffic',
scripts = ['check_iftraffic_nrpe.py'],
author='Samuel Krieg',
author_email='samuel.krieg+github@gmail.com',
u... | SamK/check_iftraffic_nrpe.py | setup.py | Python | gpl-3.0 | 524 | 0.015267 |
#!/usr/bin/env python2
from dbutil import *
def createTables():
""" Populate the array with names of sql DDL files """
for sqlFileName in ["Address.sql", "Electricity.sql", "CodeViolationsReport.sql",
"FireRescueEMSResponse.sql", "NaturalGasReport.sql",
"WaterRe... | aabmass/CIS4301-Project-GUL | backend/loaddb/createtables.py | Python | mit | 534 | 0.007491 |
"""Functions used by least-squares algorithms."""
from math import copysign
import numpy as np
from numpy.linalg import norm
from scipy.linalg import cho_factor, cho_solve, LinAlgError
from scipy.sparse import issparse
from scipy.sparse.linalg import LinearOperator, aslinearoperator
EPS = np.finfo(float).eps
# Fu... | jlcarmic/producthunt_simulator | venv/lib/python2.7/site-packages/scipy/optimize/_lsq/common.py | Python | mit | 20,742 | 0.001736 |
#!/usr/bin/env python
# http://pyrocko.org - GPLv3
#
# The Pyrocko Developers, 21st Century
# ---|P------/S----------~Lg----------
from __future__ import print_function
import sys
import re
import os.path as op
import logging
import copy
import shutil
from optparse import OptionParser
from pyrocko import util, trace,... | pyrocko/pyrocko | src/apps/fomosto.py | Python | gpl-3.0 | 36,133 | 0 |
import logging
from logging import config
import paramiko
import os
from read_config import *
class FileDownloader(object):
ip = None
port = None
user = None
password = None
local_file_path = None
remote_file_path = None
abs_file_list = []
ssh = None
logger = None... | 10177591/BnB-bot | utils/FileDownloader.py | Python | gpl-3.0 | 2,539 | 0.002757 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'AuthIdentity.last_verified'
db.add_column(
'se... | jean/sentry | src/sentry/south_migrations/0159_auto__add_field_authidentity_last_verified__add_field_organizationmemb.py | Python | bsd-3-clause | 52,679 | 0.000835 |
"""
사이트 관리 도구 어드민 페이지 설정.
"""
from django.contrib import admin
from modeltranslation.admin import TranslationAdmin
from .models import Category, GroupServicePermission, Service, TopBanner
class CategoryAdmin(TranslationAdmin):
"""
:class:`Category` 모델에 대한 커스텀 어드민.
`django-modeltranlation` 에서 제공하는 :clas... | hangpark/kaistusc | apps/manager/admin.py | Python | bsd-2-clause | 1,268 | 0.003061 |
from sklearn import datasets
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
loaded_data = datasets.load_boston()
data_X = loaded_data.data
data_y = loaded_data.target
model = LinearRegression()
model.fit(data_X, data_y)
print(model.predict(data_X[:4,:]))
print(data_y[:4])
print(mo... | shunliz/test | python/scikit/linear.py | Python | apache-2.0 | 505 | 0.011881 |
"""
Django settings for web project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import... | kantale/MutationInfo | web/web/settings.py | Python | mit | 2,056 | 0 |
from invoke import task, Collection
from invocations.checks import blacken
from invocations.packaging import release
from invocations import docs, pytest as pytests, travis
@task
def coverage(c, html=True):
"""
Run coverage with coverage.py.
"""
# NOTE: this MUST use coverage itself, and not pytest-co... | bitprophet/pytest-relaxed | tasks.py | Python | bsd-2-clause | 1,883 | 0 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2002 Ben Escoto <ben@emerose.org>
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License... | CloudBrewery/duplicity-swiftkeys | duplicity/tempdir.py | Python | gpl-2.0 | 9,197 | 0.001414 |
#
# zfcp.py - mainframe zfcp configuration install data
#
# Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. All rights reserved.
#
# 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 ver... | Rogentos/legacy-anaconda | storage/zfcp.py | Python | gpl-2.0 | 16,651 | 0.003784 |
import sys
sys.path.insert(1, "../../")
import h2o
def vec_show(ip,port):
# Connect to h2o
h2o.init(ip,port)
iris = h2o.import_frame(path=h2o.locate("smalldata/iris/iris_wheader.csv"))
print "iris:"
iris.show()
###################################################################
res = 2 -... | ChristosChristofidis/h2o-3 | h2o-py/tests/testdir_misc/pyunit_vec_show.py | Python | apache-2.0 | 516 | 0.00969 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Axel Tillequin (bdcht3@gmail.com)
# This code is part of Masr
# published under GPLv2 license
import gtk
from grandalf.graphs import Vertex,Edge,Graph
from grandalf.layouts import SugiyamaLayout
from grandalf.routing import *
from grandalf.utils import median_wh,Dot
f... | bdcht/masr | masr/plugins/graph/main.py | Python | gpl-2.0 | 5,512 | 0.02812 |
#!/usr/bin/env python3
# Copyright (C) 2018 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import base64
import os
import re
import socket
import sys
import subprocess
im... | x3ro/RIOT | tests/gnrc_sock_dns/tests/01-run.py | Python | lgpl-2.1 | 12,071 | 0.000331 |
import time
from datetime import datetime
class pyTemperature(object):
def __init__(self, date = datetime.now(), temp=None,pressure=None,humidity=None):
self.date = date
self.temperature = temp
self.pressure = pressure
self.humidity = humidity
def printTemperature(self):
... | mattcongy/piprobe | imports/pyTemperature.py | Python | mit | 507 | 0.013807 |
from core.himesis import Himesis, HimesisPostConditionPattern
import cPickle as pickle
from uuid import UUID
class HReconnectMatchElementsRHS(HimesisPostConditionPattern):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HReconnectMatchElementsRHS.
"""
... | levilucio/SyVOLT | GM2AUTOSAR_MM/merge_inter_layer_rules/Himesis/HReconnectMatchElementsRHS.py | Python | mit | 6,605 | 0.008176 |
"""
=====================================
Sensor space least squares regression
=====================================
Predict single trial activity from a continuous variable.
A single-trial regression is performed in each sensor and timepoint
individually, resulting in an Evoked object which contains the
regression c... | mne-tools/mne-tools.github.io | 0.15/_downloads/plot_sensor_regression.py | Python | bsd-3-clause | 2,578 | 0 |
from gitmostwanted.app import celery, db
from gitmostwanted.lib.github.api import user_starred, user_starred_star
from gitmostwanted.models.repo import Repo
from gitmostwanted.models.user import UserAttitude
@celery.task()
def repo_starred_star(user_id: int, access_token: str):
starred, code = user_starred(access... | kkamkou/gitmostwanted.com | gitmostwanted/tasks/github.py | Python | mit | 1,028 | 0.002918 |
from crm import model
from endpoints_proto_datastore.ndb import EndpointsModel
from google.appengine.api import search
from google.appengine.ext import ndb
from crm.model import Userinfo
from protorpc import messages
from crm.iograph import Edge
# The message class that defines the author schema
class AuthorSchema(m... | ioGrow/iogrowCRM | crm/iomodels/notes.py | Python | agpl-3.0 | 13,724 | 0.001749 |
from bson import ObjectId
from . import repeating_schedule
from state_change import StateChange
class StateChangeRepeating(StateChange):
def __init__(self, seconds_into_week, AC_target, heater_target, fan, id=None):
self.id = id
self.seconds_into_week = seconds_into_week
self.AC_target =... | IAPark/PITherm | src/shared/models/Mongo/state_change_repeating.py | Python | mit | 2,592 | 0.003086 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | NeCTAR-RC/horizon | openstack_dashboard/test/integration_tests/tests/test_users.py | Python | apache-2.0 | 1,687 | 0 |
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class TimeStampedModel(models.Model):
"""
An abstract base class model that provides self-updating "created" and "modified" fields.
"""
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeFiel... | joehalloran/shoppinglist_project | shoppinglist/core/models.py | Python | apache-2.0 | 368 | 0.027174 |
import errno
import glob
import platform
import re
import sys
import tempfile
import zipfile
from contextlib import contextmanager
from distutils.version import StrictVersion
import os
import requests
from xml.etree import ElementTree
IS_64_BIT = sys.maxsize > 2**32
IS_LINUX = platform.system().lower() == 'linux'
I... | kevbradwick/rockyroad | rockyroad/driver.py | Python | bsd-3-clause | 7,103 | 0.001971 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_magpie_ui
----------------------------------
Tests for :mod:`magpie.ui` module.
"""
import re
import unittest
from typing import TYPE_CHECKING
from six.moves.urllib.parse import urlparse
# NOTE: must be imported without 'from', otherwise the interface's test c... | Ouranosinc/Magpie | tests/test_magpie_ui.py | Python | apache-2.0 | 50,956 | 0.006084 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import codecs
import... | dbentley/pants | src/python/pants/backend/docgen/tasks/markdown_to_html.py | Python | apache-2.0 | 8,705 | 0.00919 |
import argparse
from pathlib import Path
from unittest import mock
import json
import os
import io
from urllib.request import urlopen
import pytest
import requests
import responses
from httpie.cli.argtypes import (
PARSED_DEFAULT_FORMAT_OPTIONS,
parse_format_options,
)
from httpie.cli.definition import parse... | jakubroztocil/httpie | tests/test_output.py | Python | bsd-3-clause | 18,705 | 0.00016 |
"""
Tests of student.roles
"""
import ddt
from django.test import TestCase
from courseware.tests.factories import UserFactory, StaffFactory, InstructorFactory
from student.tests.factories import AnonymousUserFactory
from student.roles import (
GlobalStaff, CourseRole, CourseStaffRole, CourseInstructorRole,
Or... | olexiim/edx-platform | common/djangoapps/student/tests/test_roles.py | Python | agpl-3.0 | 7,708 | 0.001816 |
import pigpio
import time
class LeftEncoder:
def __init__(self, pin=24):
self.pi = pigpio.pi()
self.pin = pin
self.pi.set_mode(pin, pigpio.INPUT)
self.pi.set_pull_up_down(pin, pigpio.PUD_UP)
cb1 = self.pi.callback(pin, pigpio.EITHER_EDGE, self.cbf)
self.tick = 0
... | MrYsLab/razmq | hardware_baseline/encoders/left_encoder.py | Python | gpl-3.0 | 491 | 0.004073 |
"""SCons.Tool.latex
Tool-specific initialization for LaTeX.
Generates .dvi files from .latex or .ltx files
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2017 The SCons Foundation
#... | mapycz/mapnik | scons/scons-local-3.0.1/SCons/Tool/latex.py | Python | lgpl-2.1 | 2,759 | 0.004349 |
#!/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 ***
#
... | valentin-krasontovitsch/ansible | lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py | Python | gpl-3.0 | 12,924 | 0.003327 |
#!/usr/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that ... | rdkdd/tp-spice | spice/lib/vm_actions_rv.py | Python | gpl-2.0 | 14,208 | 0.000352 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | pedrobaeza/odoo | addons/mrp_byproduct/mrp_byproduct.py | Python | agpl-3.0 | 8,828 | 0.006004 |
"""
WSGI config for yaco project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` set... | wavesoft/yaco | yaco/wsgi.py | Python | gpl-3.0 | 1,413 | 0.000708 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('forum', '0004_topic_update_index_date'),
]
database_operations = [
migrations.AlterModelTable('TopicFollowed', 'notification... | DevHugo/zds-site | zds/forum/migrations/0005_auto_20151119_2224.py | Python | gpl-3.0 | 594 | 0.001684 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutSets(Koan):
def test_sets_make_keep_lists_unique(self):
highlanders = ['MacLeod', 'Ramirez', 'MacLeod', 'Matunas',
'MacLeod', 'Malcolm', 'MacLeod']
there_can_only_be_only_one = set(highlanders)
... | iceout/python_koans_practice | python2/koans/about_sets.py | Python | mit | 1,706 | 0.001758 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "logger.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| h4/fuit-webdev | projects/logger/manage.py | Python | mit | 249 | 0 |
"""
WSGI config for my_doku_application 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_doku_application.settin... | jhcodeh/my-doku | my_doku_application/my_doku_application/wsgi.py | Python | mit | 413 | 0.002421 |
# vim: set et sw=4 sts=4 fileencoding=utf-8:
#
# Python header conversion
# Copyright (c) 2013,2014 Dave Hughes <dave@waveform.org.uk>
#
# Original headers
# Copyright (c) 2012, Broadcom Europe Ltd
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitte... | naziris/HomeSecPi | picamera/bcm_host.py | Python | apache-2.0 | 2,448 | 0.001634 |
"""
simple alignment baselines
"""
# TODO:
# - better implementions
from daeso.pair import Pair
def greedy_align_equal_words(corpus):
for graph_pair in corpus:
graph_pair.clear()
graphs = graph_pair.get_graphs()
target_nodes = graphs.target.terminals(with_punct=False,
... | emsrc/daeso-dutch | lib/daeso_nl/ga/kb/baseline.py | Python | gpl-3.0 | 8,138 | 0.010445 |
__version__ = '0.4'
__author__ = 'Martin Natano <natano@natano.net>'
_repository = None
_branch = 'git-orm'
_remote = 'origin'
class GitError(Exception): pass
def set_repository(value):
from pygit2 import discover_repository, Repository
global _repository
if value is None:
_repository = None
... | natano/python-git-orm | git_orm/__init__.py | Python | isc | 758 | 0.006596 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | google-research/language | language/labs/memory/synthetic_dataset.py | Python | apache-2.0 | 7,696 | 0.007277 |
# -*- coding: utf-8 -*-
#
# Cherokee-admin
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2010 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Softwa... | chetan/cherokee | admin/plugins/proxy.py | Python | gpl-2.0 | 10,677 | 0.018638 |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2020] EMBL-European Bioinformatics Institute
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... | RNAcentral/rnacentral-import-pipeline | tests/databases/intact/parser_test.py | Python | apache-2.0 | 8,022 | 0.002618 |
# coding=utf-8
# Run a test server.
from app import app
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=7000, debug=True)
| leitelm/RISE_scada | wsgi.py | Python | apache-2.0 | 189 | 0.021164 |
# Copyright 2016 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... | dongjoon-hyun/tensorflow | tensorflow/python/training/basic_loops.py | Python | apache-2.0 | 2,343 | 0.004695 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""module that copies from another module"""
from task_01.peanut import BUTTER
JELLY = BUTTER
| sdavlenov/is210-week-05-warmup | task_03.py | Python | mpl-2.0 | 142 | 0 |
from __future__ import absolute_import, division
import time
import os
try:
unicode
except NameError:
unicode = str
from . import LockBase, NotLocked, NotMyLock, LockTimeout, AlreadyLocked
class SQLiteLockFile(LockBase):
"Demonstrate SQL-based locking."
testdb = None
def __init__(self, path, t... | allieus/pylockfile | lockfile/sqlitelockfile.py | Python | mit | 5,541 | 0.000722 |
from django import db
from django.conf import settings
from django.core.management.base import NoArgsCommand
from data.models import FCNASpending
import csv
# National Priorities Project Data Repository
# import_fcna_spending.py
# Updated 7/23/2010, Joshua Ruihley, Sunlight Foundation
# Imports Federal Child Nutritio... | npp/npp-api | data/management/commands/import_fcna_spending.py | Python | mit | 1,982 | 0.007064 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2017 CERN.
#
# Zenodo is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later v... | slint/zenodo | zenodo/modules/support/config.py | Python | gpl-2.0 | 8,030 | 0 |
# -*- coding: utf-8 -*-
""" Tablib - JSON Support
"""
import decimal
import tablib
try:
import ujson as json
except ImportError:
import json
title = 'json'
extensions = ('json', 'jsn')
def date_handler(obj):
if isinstance(obj, decimal.Decimal):
return str(obj)
elif hasattr(obj, 'isoformat'... | 171121130/SWI | venv/Lib/site-packages/tablib/formats/_json.py | Python | mit | 1,312 | 0 |
# -*- coding: utf-8 -*-
""" Implements a Class for Representing a Simulated Senate Election. """
from collections import Counter
from random import random
from random import seed as set_seed
from time import asctime
from time import localtime
from aus_senate_audit.senate_election.base_senate_election import BaseSena... | berjc/aus-senate-audit | aus_senate_audit/senate_election/simulated_senate_election.py | Python | apache-2.0 | 3,665 | 0.004366 |
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
# Copyright 2017 IBM RESEARCH. 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/licen... | atilag/qiskit-sdk-py | qiskit/extensions/qasm_simulator_cpp/snapshot.py | Python | apache-2.0 | 2,505 | 0 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^carrinho/adicionar/(?P<slug>[\w_-]+)/$',
views.CreateCartItemView.as_view(), name='create_cartitem'),
url(r'^carrinho/$', views.CartItemView.as_view(),
name='cart_item')
]
| martini97/django-ecommerce | checkout/urls.py | Python | gpl-3.0 | 276 | 0 |
import geopandas as gpd
import numpy as np
import pandas as pd
import pytest
from distutils.version import LooseVersion
folium = pytest.importorskip("folium")
branca = pytest.importorskip("branca")
matplotlib = pytest.importorskip("matplotlib")
mapclassify = pytest.importorskip("mapclassify")
import matplotlib.cm as ... | jorisvandenbossche/geopandas | geopandas/tests/test_explore.py | Python | bsd-3-clause | 29,278 | 0.001366 |
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.db.models import Count
from django.urls import reverse_lazy
from django.utils.translation import ugettext as _
from django.shortcuts import render, get_object_or_404, redirect
from django... | nerosketch/djing | tariff_app/views.py | Python | unlicense | 5,574 | 0.001435 |
__all__ = ["Block", "Unknown", "Multitextured", "DataValues", "Stairs", "MultitexturedStairs", "Slab", "MultitexturedSlab", "Log"]
| scribblemaniac/MCEdit2Blender | blocks/__init__.py | Python | gpl-3.0 | 132 | 0.015152 |
#!/usr/bin/python
from gi.repository import Gtk, GObject
import time
import unittest
from testutils import setup_test_env
setup_test_env()
from softwarecenter.enums import XapianValues, ActionButtons
TIMEOUT=300
class TestCustomLists(unittest.TestCase):
def _debug(self, index, model, needle):
print ("... | vanhonit/xmario_center | test/gtk3/test_custom_lists.py | Python | gpl-3.0 | 1,958 | 0.005618 |
#!/usr/bin/python
"""
This is a wrapper to run the 'lacheck(1)' tool from the 'lacheck' package.
Why do we need this wrapper?
- lacheck does NOT report in its exit status whether it had warnings or not.
- it is too verbose when there are no warnings.
"""
import sys # for argv, exit, stderr
import subprocess # for ... | veltzer/riddling | scripts/wrapper_lacheck.py | Python | gpl-3.0 | 939 | 0 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import re
from flask import abort, redirect, request
from werkzeug.exceptions import NotFound
from indic... | DirkHoffmann/indico | indico/modules/categories/compat.py | Python | gpl-3.0 | 1,374 | 0.002183 |
import unittest
import flavio
from math import sqrt, pi
from flavio.physics.zdecays.gammazsm import Zobs, pb
from flavio.physics.zdecays.gammaz import GammaZ_NP
from flavio.physics.zdecays import smeftew
par = flavio.default_parameters.get_central_all()
class TestGammaZ(unittest.TestCase):
def test_obs_sm(self)... | flav-io/flavio | flavio/physics/zdecays/test_zdecays.py | Python | mit | 6,570 | 0.002435 |
# -*- coding: utf-8 -*-
"""
urwintranet.ui.views
~~~~~~~~~~~~~~~~~~
"""
from . import (auth, home, parts)
| jespino/urwintranet | urwintranet/ui/views/__init__.py | Python | apache-2.0 | 108 | 0 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from .common import BaseTest
import jmespath
class TestApacheAirflow(BaseTest):
def test_airflow_environment_value_filter(self):
session_factory = self.replay_flight_data('test_airflow_environment_value_filter')
p = sel... | thisisshi/cloud-custodian | tests/test_airflow.py | Python | apache-2.0 | 3,504 | 0.001427 |
"""
Created on Sep 14, 2015
@author: Mikhail
"""
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.expected_conditions import visibility_of_element_located, visibility_of
from selenium.common.exceptions import TimeoutException
__author__ = 'Mikhail'
class Page(object):
def... | MikeLaptev/sandbox_python | mera/selenium_training_automation/pages/page.py | Python | apache-2.0 | 913 | 0.001095 |
import os
import fnmatch
def find_files(directory, pattern):
for root, dirs, files in os.walk(directory):
for basename in files:
if fnmatch.fnmatch(basename, pattern):
filename = os.path.join(root, basename)
yield filename
for fname in find_files('... | Erotemic/local | misc/code/TAing/fixcmake.py | Python | gpl-3.0 | 478 | 0 |
from django.db import models
from django.conf import settings
from django.core.exceptions import ValidationError
from polymorphic import PolymorphicModel
from django.db.models import F
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from celery.exceptions import SoftTimeLimitExc... | dever860/cabot | cabot/cabotapp/models.py | Python | mit | 30,857 | 0.00188 |
from project import app
if __name__ == '__main__':
app.run()
| wolfram74/flask_exploration | run.py | Python | mit | 66 | 0 |
from collections import defaultdict, namedtuple
import regex as re
from gary import ignore_parens_list
Record = namedtuple('Record', ['dob', 'eng', 'pos', 'phn'])
@ignore_parens_list
def split_words(text:str) -> list:
return re.split('\s*;\s*', text)
class ShParser:
def __init__(self, text):
self.... | longnow/panlex-tools | libpython/gary/sh_parser.py | Python | mit | 1,521 | 0.007242 |
import numpy
from cupy._core._scalar import get_typename
# Base class for cuda types.
class TypeBase:
def __str__(self):
raise NotImplementedError
def declvar(self, x):
return f'{self} {x}'
class Void(TypeBase):
def __init__(self):
pass
def __str__(self):
return '... | cupy/cupy | cupyx/jit/_cuda_types.py | Python | mit | 3,661 | 0 |
#!/usr/bin/env python
# Generate the body of ieee.numeric_std and numeric_bit from a template.
# The implementation is based only on the specification and on testing (as
# the specifications are often ambiguous).
# The algorithms are very simple: carry ripple adder, restoring division.
# This file is part of GHDL.... | emogenet/ghdl | libraries/openieee/build_numeric.py | Python | gpl-2.0 | 32,279 | 0.004058 |
from venv import _venv
from fabric.api import task
@task
def migrate():
"""
Run Django's migrate command
"""
_venv("python manage.py migrate")
@task
def syncdb():
"""
Run Django's syncdb command
"""
_venv("python manage.py syncdb")
| pastpages/wordpress-memento-plugin | fabfile/migrate.py | Python | mit | 268 | 0 |
"""
basic set of `jut run` tests
"""
import json
import unittest
from tests.util import jut
BAD_PROGRAM = 'foo'
BAD_PROGRAM_ERROR = 'Error line 1, column 1 of main: Error: no such sub: foo'
class JutRunTests(unittest.TestCase):
def test_jut_run_syntatically_incorrect_program_reports_error_with_format_json(s... | jut-io/jut-python-tools | tests/jut_run_tests.py | Python | mit | 3,794 | 0.002636 |
# Our friend Monk has an exam that has quite weird rules. Each question has a difficulty level in the form of an
# Integer. Now, Monk can only solve the problems that have difficulty level less than X . Now the rules are-
#
# Score of the student is equal to the maximum number of answers he/she has attempted without sk... | OmkarPathak/Python-Programs | CompetitiveProgramming/HackerEarth/DataStructures/Arrays/P02_Mark-The-Answer.py | Python | gpl-3.0 | 1,372 | 0.008824 |
'''OpenGL extension ARB.robustness_isolation
This module customises the behaviour of the
OpenGL.raw.GL.ARB.robustness_isolation to provide a more
Python-friendly API
Overview (from the spec)
GL_ARB_robustness and supporting window system extensions allow
creating an OpenGL context supporting graphics reset noti... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/GL/ARB/robustness_isolation.py | Python | lgpl-3.0 | 1,604 | 0.015586 |
from setuptools import find_packages
from setuptools import setup
setup(
name='svs',
version='1.0.0',
description='The InAcademia Simple validation Service allows for the easy validation of affiliation (Student,'
'Faculty, Staff) of a user in Academia',
license='Apache 2.0',
classif... | its-dirg/svs | setup.py | Python | apache-2.0 | 1,148 | 0.000871 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | dayatz/taiga-back | taiga/export_import/services/store.py | Python | agpl-3.0 | 29,644 | 0.002699 |
#!/usr/bin/env python
"""list all previously made bookings"""
import os
import sys
import cgi
import datetime
import json
import shuttle
import shconstants
import smtplib
import shcookie
print "Content-type: text/html\r\n"
shuttle.do_login(shcookie.u, shcookie.p)
form = cgi.FieldStorage()
if 'action' in form:
a... | christianholz/QuickShuttle | bookings.py | Python | gpl-3.0 | 3,213 | 0.012138 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.