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 |
|---|---|---|---|---|---|---|
from django.contrib.auth.decorators import user_passes_test
from django.utils.decorators import method_decorator
from django.views.generic.base import TemplateView
def in_students_group(user):
if user:
return user.groups.filter(name='Alumnos').exists()
return False
def in_teachers_group(user):
i... | Videoclases/videoclases | quality_control/views/control_views.py | Python | gpl-3.0 | 1,076 | 0.001859 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 Google, 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
#
# ... | javrasya/watchdog | tests/__init__.py | Python | apache-2.0 | 951 | 0.001052 |
"""
Really could have implemented this all in javascript on the client side...
"""
from __future__ import print_function
import requests
from flask import Flask, redirect, url_for, request, session, abort, jsonify
import os
import sys
import logging
import json
STRAVA_CLIENT_ID = 1367
Flask.get = lambda self, path: s... | krujos/strava-private-to-public | private-to-public.py | Python | apache-2.0 | 3,601 | 0.002499 |
#/usr/bin/env python
import os
from setuptools import setup, find_packages
ROOT_DIR = os.path.dirname(__file__)
SOURCE_DIR = os.path.join(ROOT_DIR)
setup(
name="django_haikus",
description="Some classes for finding haikus in text",
author="Grant Thomas",
author_email="grant.thomas@wk.com",
url="ht... | wieden-kennedy/django-haikus | setup.py | Python | bsd-3-clause | 1,122 | 0.008021 |
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | eayunstack/ceilometer | ceilometer/api/app.py | Python | apache-2.0 | 3,764 | 0 |
#!/usr/bin/python3
import gui
gui.main()
| Koala-Kaolin/pyweb | src/__main__.py | Python | gpl-3.0 | 42 | 0 |
#!/usr/bin/python
import math
def trapezint(f, a, b, n) :
"""
Just for testing - uses trapazoidal approximation from on f from a to b with
n trapazoids
"""
output = 0.0
for i in range(int(n)):
f_output_lower = f( a + i * (b - a) / n )
f_output_upper = f( a + (i + 1) * (b - a) / ... | chapman-phys227-2016s/hw-1-seama107 | adaptive_trapezint.py | Python | mit | 1,279 | 0.013292 |
import difflib
import os
import pytest
from fusesoc.core import Core
def compare_fileset(fileset, name, files):
assert name == fileset.name
for i in range(len(files)):
assert files[i] == fileset.file[i].name
def test_core_info():
tests_dir = os.path.dirname(__file__)
cores_root = os.path.join... | imphil/fusesoc | tests/test_capi1.py | Python | gpl-3.0 | 10,310 | 0.012512 |
#
# distutils/version.py
#
# Implements multiple version numbering conventions for the
# Python Module Distribution Utilities.
#
# $Id$
#
"""Provides classes to represent module version numbers (one class for
each style of version numbering). There are currently two such classes
implemented: StrictVersion ... | prefetchnta/questlab | bin/x64bin/python/37/Lib/distutils/version.py | Python | lgpl-2.1 | 12,688 | 0.001497 |
from __future__ import unicode_literals
import os
import sys
from subprocess import PIPE, Popen
from django.apps import apps as installed_apps
from django.utils import six
from django.utils.crypto import get_random_string
from django.utils.encoding import DEFAULT_LOCALE_ENCODING, force_text
from .base import Command... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/django/core/management/utils.py | Python | mit | 3,739 | 0.001337 |
import logging
from django.conf import settings
from kombu import (Exchange,
Queue)
from kombu.mixins import ConsumerMixin
from treeherder.etl.common import fetch_json
from treeherder.etl.tasks.pulse_tasks import (store_pulse_jobs,
store_pulse_resultset... | akhileshpillai/treeherder | treeherder/etl/pulse_consumer.py | Python | mpl-2.0 | 4,116 | 0 |
import os
import json
from ...resources.base import SurvoxAPIBase
from ...resources.exception import SurvoxAPIRuntime, SurvoxAPINotFound
from ...resources.valid import valid_url_field
class SurvoxAPIDncList(SurvoxAPIBase):
"""
Class to manage DNC lists.
"""
def __init__(self, base_url=None, headers=... | cbeauvais/zAWygzxkeSjUBGGVsgMGTF56xvR | survox_api/resources/library/sample_dnc.py | Python | mit | 5,130 | 0.002534 |
# Copyright 2018 Dgraph Labs, 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 writ... | dgraph-io/pydgraph | pydgraph/__init__.py | Python | apache-2.0 | 849 | 0.001178 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-06-09 22:16
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('crowdsourcing', '0092_merge'),
('crowdsourcing', '0092_auto_20160608_0236'),
]
operati... | shirishgoyal/crowdsource-platform | crowdsourcing/migrations/0093_merge.py | Python | mit | 334 | 0 |
"""waybacktrack.py
Use this to extract Way Back Machine's
url-archives of any given domain!
TODO: reiterate entire design!
"""
import time
import os
import urllib2
import random
from math import ceil
try:
from cStringIO import StringIO as BytesIO
except ImportError:
from io import BytesIO
from lxml import htm... | rodricios/crawl-to-the-future | crawlers/Way-Back/waybacktrack.py | Python | gpl-2.0 | 7,577 | 0.006071 |
import json
from apiserver.model import Route
import utils
def test_post(app, apiusers, db, default_headers, post_geojson):
with app.test_client() as client:
res = client.get('/routes?api_key=' + apiusers['valid'].api_key, default_headers['get'])
assert res.status_code == 200
ret = post_g... | OpenBeta/beta | tests/test_api_routes.py | Python | gpl-3.0 | 1,343 | 0.001489 |
# -*- coding: utf-8 -*-
# © 2016 Antiun Ingenieria S.L. - Javier Iniesta
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models
| Endika/manufacture | mrp_sale_info/__init__.py | Python | agpl-3.0 | 165 | 0 |
import json
from flask import url_for
from flask_restplus import schemas
from udata.tests.helpers import assert200
class SwaggerBlueprintTest:
modules = []
def test_swagger_resource_type(self, api):
response = api.get(url_for('api.specs'))
assert200(response)
swagger = json.loads(re... | opendatateam/udata | udata/tests/api/test_swagger.py | Python | agpl-3.0 | 763 | 0 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | tomhenderson/ns-3-dev-git | src/topology-read/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 251,206 | 0.014602 |
# Copyright (C) 2013-2018 Samuel Damashek, Peter Foley, James Forcier, Srijay Kasturi, Reed Koser, Christopher Reffett, and Tris Wilson
#
# 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 v... | tjcsl/cslbot | cslbot/commands/botspam.py | Python | gpl-2.0 | 1,606 | 0.001868 |
"""Support for Nanoleaf Lights."""
import logging
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_HS_COLOR,
ATTR_TRANSITION, PLATFORM_SCHEMA, SUPPORT_BRIGHTNESS,
SUPPORT_COLOR, SUPPORT_COLOR_TEMP, SUPPORT_EFFECT,
SUPPORT_TRANSIT... | MartinHjelmare/home-assistant | homeassistant/components/nanoleaf/light.py | Python | apache-2.0 | 6,951 | 0 |
#!/usr/bin/python
import sys
import plugins
import flask
import argparse
import os
import urllib2, urllib
import threading
import time
import socket
import subprocess
import random
import json
import signal
import traceback
from uuid import uuid4 as generateUUID
from killerbee import kbutils
from beekeeperwids.utils.e... | riverloopsec/beekeeperwids | beekeeperwids/drone/daemon.py | Python | gpl-2.0 | 8,678 | 0.005646 |
__copyright__ = "Copyright 2017 Birkbeck, University of London"
__author__ = "Martin Paul Eve & Andy Byers"
__license__ = "AGPL v3"
__maintainer__ = "Birkbeck Centre for Technology and Publishing"
from django.db import models
from django.utils import timezone
from events import logic as event_logic
from utils import ... | BirkbeckCTP/janeway | src/proofing/models.py | Python | agpl-3.0 | 9,317 | 0.001717 |
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016, 2017
class DataAlreadyExistsError(RuntimeError):
def __init__(self, label):
self.message = str("Data with label '%s' already exists and cannot be added" % (label))
def get_patient_id(d):
return d['patient']['identifier']
def get_index_... | IBMStreams/streamsx.health | samples/HealthcareJupyterDemo/package/healthdemo/utils.py | Python | apache-2.0 | 2,562 | 0.015613 |
#!/usr/bin/env python
# encoding: utf-8
## Python impl of JFRED, developed by Robby Garner and Paco Nathan
## See: http://www.robitron.com/JFRED.php
##
## 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... | liber118/pyFRED | src/fred_rules.py | Python | apache-2.0 | 11,958 | 0.005101 |
#! /usr/bin/python3
def main():
try:
while True:
line1 = input().strip().split(' ')
n = int(line1[0])
name_list = []
num_list = [0]
for i in range(1, len(line1)):
if i % 2 == 1:
name_list.append(line1[i... | zyoohv/zyoohv.github.io | code_repository/tencent_ad_contest/tencent_contest/model/main.py | Python | mit | 1,329 | 0.000752 |
# coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import r... | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | orcid_api/models/contributor_orcid.py | Python | mit | 3,922 | 0.00051 |
import itertools
from .core import frequencies
from ..compatibility import map
def countby(func, seq):
""" Count elements of a collection by a key function
>>> countby(len, ['cat', 'mouse', 'dog'])
{3: 2, 5: 1}
>>> def iseven(x): return x % 2 == 0
>>> countby(iseven, [1, 2, 3]) # doctest:+SKIP
... | obmarg/toolz | toolz/itertoolz/recipes.py | Python | bsd-3-clause | 1,295 | 0 |
import six
from sqlalchemy_utils.utils import str_coercible
from .weekday import WeekDay
@str_coercible
class WeekDays(object):
def __init__(self, bit_string_or_week_days):
if isinstance(bit_string_or_week_days, six.string_types):
self._days = set()
if len(bit_string_or_week_day... | cheungpat/sqlalchemy-utils | sqlalchemy_utils/primitives/weekdays.py | Python | bsd-3-clause | 1,866 | 0 |
import os
import unittest
from dateutil.parser import parse as dtparse
import numpy as np
from pocean.dsg import ContiguousRaggedTrajectoryProfile
import logging
from pocean import logger
logger.level = logging.INFO
logger.handlers = [logging.StreamHandler()]
class TestContinousRaggedTrajectoryProfile(unittest.Tes... | joefutrelle/pocean-core | pocean/tests/dsg/trajectoryProfile/test_trajectoryProfile_cr.py | Python | mit | 4,960 | 0.000605 |
#!/usr/bin/env python3
####################################
# ACE3 automatic deployment script #
# ================================ #
# This is not meant to be run #
# directly! #
####################################
import os
import sys
import shutil
import traceback
import subprocess as ... | NemesisRE/ACE3 | tools/deploy.py | Python | gpl-2.0 | 1,499 | 0.002668 |
import re
from django.core.urlresolvers import reverse
def test_view_with_scss_file(client, precompiled):
"""
Test view that renders *SCSS file* that *imports SCSS file from another Django app*.
:param client: ``pytest-django`` fixture: Django test client
:param precompiled: custom fixture that asse... | kottenator/django-compressor-toolkit | tests/integration_tests/test_views.py | Python | mit | 3,738 | 0.002943 |
# Copyright (C) 2011, 2012 Abhijit Mahabal
#
# 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 (at your option) any later version.
#
# This program is distribu... | amahabal/PySeqsee | farg/core/ui/gui/__init__.py | Python | gpl-3.0 | 7,857 | 0.005982 |
from os.path import join
import pytest
from cobra.io import load_json_model, write_sbml_model
def test_load_json_model_valid(data_directory, tmp_path):
"""Test loading a valid annotation from JSON."""
path_to_file = join(data_directory, "valid_annotation_format.json")
model = load_json_model(path_to_fil... | opencobra/cobrapy | src/cobra/test/test_io/test_annotation_format.py | Python | gpl-2.0 | 944 | 0 |
# Copyright 2015 Tesora 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 a... | Tesora-Release/tesora-trove | trove/tests/scenario/runners/database_actions_runners.py | Python | apache-2.0 | 9,910 | 0 |
# Copyright 2015 Dell 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... | nikesh-mahalka/cinder | cinder/volume/drivers/dell/dell_storagecenter_iscsi.py | Python | apache-2.0 | 7,849 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-01 20:22
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('valet', '0003_sequence_driver'),
]
operations = [
migrations.RenameMo... | rayhu-osu/vcube | valet/migrations/0004_auto_20170801_1622.py | Python | mit | 418 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------------
# File Name: try.py
# Author: Zhao Yanbai
# Wed Dec 28 21:41:17 2011
# Description: none
# --------------------------------------------------------------------------
try:
s = input("Enter an i... | acevest/acecode | learn/python/try.py | Python | gpl-2.0 | 456 | 0.013158 |
from __future__ import absolute_import, division, print_function
import copy
from ._compat import iteritems
from ._make import NOTHING, _obj_setattr, fields
from .exceptions import AttrsAttributeNotFoundError
def asdict(
inst,
recurse=True,
filter=None,
dict_factory=dict,
retain_collection_types... | fnaum/rez | src/rez/vendor/attr/_funcs.py | Python | lgpl-3.0 | 9,725 | 0 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/veteran_reward/shared_antidecay.iff"
result.attribute_template_id =... | anhstudios/swganh | data/scripts/templates/object/tangible/veteran_reward/shared_antidecay.py | Python | mit | 459 | 0.045752 |
from __future__ import annotations
import numbers
from typing import (
TYPE_CHECKING,
overload,
)
import warnings
import numpy as np
from pandas._libs import (
lib,
missing as libmissing,
)
from pandas._typing import (
ArrayLike,
AstypeArg,
Dtype,
DtypeObj,
npt,
type_t,
)
from... | jorisvandenbossche/pandas | pandas/core/arrays/boolean.py | Python | bsd-3-clause | 23,248 | 0.000559 |
# -*- coding: utf-8 -*-
import csv
import json
from cStringIO import StringIO
from datetime import datetime
from django.conf import settings
from django.core import mail
from django.core.cache import cache
import mock
from pyquery import PyQuery as pq
from olympia import amo
from olympia.amo.tests import TestCase
fr... | andymckay/addons-server | src/olympia/zadmin/tests/test_views.py | Python | bsd-3-clause | 77,618 | 0.000013 |
import warnings
class DimensionSelection:
""" Instances of this class to be passed to construct_mdx function
"""
SUBSET = 1
EXPRESSION = 2
ITERABLE = 3
def __init__(self, dimension_name, elements=None, subset=None, expression=None):
warnings.warn(
f"class DimensionSelecti... | OLAPLINE/TM1py | TM1py/Utils/MDXUtils.py | Python | mit | 10,016 | 0.002895 |
import boto3
import numpy as np
import time
import json
import os
import pandas as pd
name = 'Flavio C.'
root_dir = '/document/'
file_name = 'augmented-data.png'
# Get all files in directory
meine_id_kartes = os.listdir(root_dir)
# get the results
client = boto3.client(
service_name='textract',
region_name='... | fclesio/learning-space | Python/textract_extraction.py | Python | gpl-2.0 | 1,358 | 0.002209 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
from os.path import abspath, join, dirname
from preggy import expect
... | BetterCollective/thumbor | tests/loaders/test_http_loader.py | Python | mit | 7,414 | 0.00054 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# t... | jakubbrindza/gtg | GTG/gtk/browser/browser.py | Python | gpl-3.0 | 61,395 | 0.000016 |
#-*- coding: utf-8 -*-
###########################################################################
## ##
## Copyrights Frederic Rodrigo 2011 ##
## ... | tkasp/osmose-backend | analysers/Analyser_Osmosis.py | Python | gpl-3.0 | 28,447 | 0.005765 |
import sys
import os
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler, FileModifiedEvent
class LessCompiler(FileSystemEventHandler):
def __init__(self, source):
self.source = source
FileSystemEventHandler.__init__(self)
def compile_css(s... | hzlf/openbroadcast | website/tools/suit/watch_less.py | Python | gpl-3.0 | 1,306 | 0 |
# Copyright 2015 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... | mortada/tensorflow | tensorflow/python/ops/rnn.py | Python | apache-2.0 | 44,560 | 0.004129 |
# coding: utf8
from pygrim import Server as WebServer
from routes import Routes
from test_iface import Test
from uwsgidecorators import postfork as postfork_decorator
# from pygrim.components.session import FileSessionStorage
# to create custom session handler, view, etc:
"""
class MySessionClass(SessionStorage):
... | ondrejkajinek/pyGrim | example/server.py | Python | mit | 1,308 | 0.000765 |
import parser
import logging
def test(code):
log = logging.getLogger()
parser.parser.parse(code, tracking=True)
print "Programa con 1 var y 1 asignacion bien: "
s = "program id; var beto: int; { id = 1234; }"
test(s)
print "Original: \n{0}".format(s)
print "\n"
print "Programa con 1 var mal: "
s = "program ;... | betoesquivel/PLYpractice | testingParser.py | Python | mit | 1,412 | 0.003541 |
from django.conf.urls.defaults import *
urlpatterns = patterns('member.views',
url(r'^$', 'login', name='passport_index'),
url(r'^register/$', 'register', name='passport_register'),
url(r'^login/$', 'login', name='passport_login'),
url(r'^logout/$', 'logout', name='passport_logout'),
url(r'^active/... | masiqi/douquan | member/urls.py | Python | mit | 478 | 0.002092 |
from __future__ import absolute_import
from sentry.testutils import TestCase
from .util import invalid_schema
from sentry.api.validators.sentry_apps.schema import validate_component
class TestImageSchemaValidation(TestCase):
def setUp(self):
self.schema = {
"type": "image",
"url"... | mvaled/sentry | tests/sentry/api/validators/sentry_apps/test_image.py | Python | bsd-3-clause | 966 | 0 |
from cog.models import *
from django.forms import ModelForm, ModelMultipleChoiceField, NullBooleanSelect
from django.db import models
from django.contrib.admin.widgets import FilteredSelectMultiple
from django import forms
from django.forms import ModelForm, Textarea, TextInput, Select, SelectMultiple, FileInput, Check... | sashakames/COG | cog/forms/forms_project.py | Python | bsd-3-clause | 9,756 | 0.005638 |
"""Connectors"""
__copyright__ = "Copyright (C) 2014 Ivan D Vasin"
__docformat__ = "restructuredtext"
import abc as _abc
import re as _re
from ... import plain as _plain
from .. import _std as _std_http
_BASIC_USER_TOKENS = ('user', 'password')
class HttpBasicClerk(_std_http.HttpStandardClerk):
"""An authen... | nisavid/bedframe | bedframe/auth/http/_basic/_connectors.py | Python | lgpl-3.0 | 1,567 | 0.000638 |
import re
# noinspection PyPackageRequirements
import wx
import gui.fitCommands as cmd
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
_t = wx.GetTranslation
class DroneSplitStack(ContextMenuSingle):
def __init__(self):
self.mainFrame = gui.mainFrame.Main... | pyfa-org/Pyfa | gui/builtinContextMenus/droneSplitStack.py | Python | gpl-3.0 | 3,081 | 0.002597 |
import numpy as np
### Digitised data for HL-1 i_Kr channel.
# I-V curves.
def IV_Toyoda():
"""Data points in IV curve for i_Kr.
Data from Figure 1E from Toyoda 2010. Reported as mean \pm SEM from
10 cells.
"""
x = [-80, -70, -60, -50, -40, -30, -20, -10, 0, 10, 20, 30, 40]
y = np.asarray([0... | c22n/ion-channel-ABC | docs/examples/hl1/data/ikr/data_ikr.py | Python | gpl-3.0 | 6,863 | 0.009617 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | jackemoore/cfclient-gps-2-ebx-io | lib/cflib/crazyflie/ablock.py | Python | gpl-2.0 | 17,198 | 0.005815 |
#!/usr/bin/env python
old_new_salaries = [
# (old_salary, new_salary)
(2401, 2507), (2172, 2883), (2463, 2867), (2462, 3325), (2949, 2974),
(2713, 3109), (2778, 3771), (2596, 3045), (2819, 2848), (2974, 3322),
(2539, 2790), (2440, 3051), (2526, 3240), (2869, 3635), (2341, 2495),
(2197, 2897), (2706... | OmniaGM/spark-training | quiz/quiz1/quiz.py | Python | mit | 628 | 0.007962 |
"""
prepare prediction:
filtered pws -> filtered pws
Uses:
PROCESSED_DATA_DIR/neural_networks/training_data_filtered.csv
"""
import os
import random
import logging
import platform
import pandas
from filter_weather_data.filters import StationRepository
from filter_weather_data import get_repository_parameters
from f... | 1kastner/analyse_weather_data | interpolation/interpolator/prepare/neural_network_single_group_filtered.py | Python | agpl-3.0 | 3,132 | 0.002554 |
''' Module '''
import re
import logging
class CurrentCost:
''' Class '''
'''
def __init__(self, data=None, logger=None):
''' Method '''
self._data = data
self.logger = logger or logging.getLogger(__name__)
self.time = None
self.uid = None
self.value = None
'''... | gljohn/meterd | meterd/parser/currentcost.py | Python | gpl-3.0 | 1,012 | 0.003953 |
from django.db import models
class Foo(models.Model):
name = models.CharField(max_length=5)
class Meta:
app_label = 'complex_app'
| openhatch/new-mini-tasks | vendor/packages/Django/tests/regressiontests/admin_scripts/complex_app/models/foo.py | Python | apache-2.0 | 148 | 0.006757 |
#!/usr/bin/env python3
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | lahwaacz/qutebrowser | scripts/dev/misc_checks.py | Python | gpl-3.0 | 5,504 | 0.000182 |
from django.test import TestCase
from django.test.client import RequestFactory
from myuw.dao.canvas import get_indexed_data_for_regid
from myuw.dao.canvas import get_indexed_by_decrosslisted
from myuw.dao.schedule import _get_schedule
from myuw.dao.term import get_current_quarter
FDAO_SWS = 'restclients.dao_implement... | fanglinfang/myuw | myuw/test/dao/canvas.py | Python | apache-2.0 | 1,890 | 0 |
# 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 it will be useful,
# bu... | adereis/avocado | avocado/utils/archive.py | Python | gpl-2.0 | 7,118 | 0.00014 |
## This file is part of Invenio.
## Copyright (C) 2009, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later versio... | PXke/invenio | invenio/legacy/bibcatalog/templates.py | Python | gpl-2.0 | 3,365 | 0.009807 |
# Copyright 2011 The greplin-twisted-utils Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | Cue/greplin-twisted-utils | src/greplin/net/dnsCache.py | Python | apache-2.0 | 2,900 | 0.01069 |
from django.contrib import admin
from django.contrib.auth.models import Group as AuthGroup
from sigma_core.models.user import User
from sigma_core.models.group import Group
from sigma_core.models.group_member import GroupMember
from sigma_core.models.group_field import GroupField
from sigma_core.models.group_field_val... | SRLKilling/sigma-backend | data-server/django_app/sigma_core/admin.py | Python | agpl-3.0 | 3,213 | 0.008092 |
import pytz
from datetime import datetime
from decimal import Decimal
from furs_fiscal.api import FURSInvoiceAPI
# Path to our .p12 cert file
P12_CERT_PATH = 'demo_podjetje.p12'
# Password for out .p12 cert file
P12_CERT_PASS = 'Geslo123#'
class InvoiceDemo():
def demo_zoi(self):
"""
Obtainin... | boris-savic/python-furs-fiscal | demos/invoice_demo.py | Python | mit | 1,878 | 0.004792 |
#!/usr/bin/python
import xml.dom.minidom
import sys
from optparse import OptionParser
import random
from hadoop_conf import *
chunk_size = []
def xml_children(node, children_name):
"""return list of node's children nodes with name of children_name"""
return node.getElementsByTagName(children_name)
def xml_text(... | toomanyjoes/mrperfcs386m | test/gen.py | Python | mit | 26,543 | 0.029951 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 5, transform = "None", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_None/trend_Lag1Trend/cycle_5/ar_/test_artificial_128_None_Lag1Trend_5__100.py | Python | bsd-3-clause | 260 | 0.088462 |
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | rhyolight/nupic.son | app/soc/views/user.py | Python | apache-2.0 | 4,262 | 0.005397 |
import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer
import json
import KVSHandler as handler
with open('config.json') as d:
config = json.load(d)
ip = config['ip']
port = int(config['port'])
def write(key, value):
global handler
return handler.write(key,value)
def delete(key):
global handler
ret... | f-apolinario/BFTStorageService | server/StorageService.py | Python | mit | 750 | 0.025333 |
import plotly.express as px
import plotly.graph_objects as go
from numpy.testing import assert_array_equal
import numpy as np
import pandas as pd
import pytest
def _compare_figures(go_trace, px_fig):
"""Compare a figure created with a go trace and a figure created with
a px function call. Check that all value... | plotly/python-api | packages/python/plotly/plotly/tests/test_core/test_px/test_px_functions.py | Python | mit | 11,286 | 0.00124 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 9.3 from Kane 1985."""
from __future__ import division
from sympy import cos, diff, expand, pi, solve, symbols
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import dot, dynamicsymbols
from util import msprint, subs, part... | nouiz/pydy | examples/Kane1985/Chapter5/Ex9.3.py | Python | bsd-3-clause | 3,590 | 0.002237 |
"""
Util class
"""
from django.forms import ModelForm, CharField, URLField, BooleanField
from django.db import models
from models import Entry
def getForm(user):
""" If no form is passed in to new/edit views, use this one """
class _Form(ModelForm):
class Meta:
model = Entry
fields = ('title', 'body',)
de... | manfredmacx/django-convo | convo/Convo.py | Python | mit | 2,261 | 0.037152 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Deepin, Inc.
# 2011 Hou Shaohui
#
# Author: Hou Shaohui <houshao55@gmail.com>
# Maintainer: Hou ShaoHui <houshao55@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Ge... | dragondjf/musicplayertest | constant.py | Python | gpl-2.0 | 1,831 | 0.004369 |
"""
WSGI config for mords_backend 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | TeppieC/M-ords | mords_backend/mords_backend/wsgi.py | Python | mit | 404 | 0 |
#!/usr/bin/python3
import os, sys, random
pandoraPath = os.getenv('PANDORAPATH', '/usr/local/pandora')
sys.path.append(pandoraPath+'/bin')
sys.path.append(pandoraPath+'/lib')
from pyPandora import Config, World, Agent, SizeInt
class MyAgent(Agent):
gatheredResources = 0
def __init__(self, id):
Age... | montanier/pandora | docs/tutorials/01_src/tutorial_pyPandora.py | Python | lgpl-3.0 | 2,012 | 0.011928 |
#!/usr/bin/env python
try:
from pyGCMMA import GCMMA
__all__ = ['GCMMA']
except:
__all__ = []
#end
| svn2github/pyopt | pyOpt/pyGCMMA/__init__.py | Python | gpl-3.0 | 112 | 0.017857 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | ingenieroariel/geonode | geonode/groups/tests.py | Python | gpl-3.0 | 22,844 | 0.000175 |
########################################################################
#
# File Name: HTMLTextAreaElement
#
#
### This file is automatically generated by GenerateHtml.py.
### DO NOT EDIT!
"""
WWW: http://4suite.com/4DOM e-mail: support@4suite.com
Copyright (c) 2000 Fourthought Inc, USA. All Ri... | alanjw/GreenOpenERP-Win-X86 | python/Lib/site-packages/_xmlplus/dom/html/HTMLTextAreaElement.py | Python | agpl-3.0 | 4,989 | 0.005813 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2017-2018 Nick Hall
#
# 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) a... | gramps-project/addons-source | GenealogyTree/gt_ancestor.py | Python | gpl-2.0 | 6,685 | 0.003141 |
"""
train supervised classifier with what's cooking recipe data
objective - determine recipe type categorical value from 20
"""
import time
from features_bow import *
from features_word2vec import *
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifie... | eifuentes/kaggle_whats_cooking | train_word2vec_rf.py | Python | mit | 1,909 | 0.002095 |
from gludb.simple import DBObject, Field
@DBObject(table_name='TopData')
class TopData(object):
name = Field('name')
| memphis-iis/GLUDB | tests/testpkg/module.py | Python | apache-2.0 | 123 | 0 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/ghost-userspace | experiments/scripts/shenango.py | Python | apache-2.0 | 4,128 | 0.009205 |
# -*- coding: utf-8 -*-
from flask import Flask, request
from fbmq import Page, QuickReply, Attachment, Template
import requests, records, re, json
from flask_restful import Resource, Api
token = '<auth token here>'
metricsData = {}
macid = 111111111111
pg = Page(token)
import time
db = records.Database('mysql://<user>... | Knapsacks/power-pi-v2 | facebook-messenger-bot/app.py | Python | mit | 5,321 | 0.004326 |
# coding: utf-8
from __future__ import unicode_literals
import unittest
import io
from lxml import isoschematron, etree
from packtools.catalogs import SCHEMAS
SCH = etree.parse(SCHEMAS['sps-1.3'])
def TestPhase(phase_name, cache):
"""Factory of parsed Schematron phases.
:param phase_name: the phase name
... | gustavofonseca/packtools | tests/test_schematron_1_3.py | Python | bsd-2-clause | 181,171 | 0.000746 |
from db.testing import DatabaseTestCase, TEST_DATA_PATH
import db.exceptions
import db.data
import os.path
import json
import mock
import copy
class DataDBTestCase(DatabaseTestCase):
def setUp(self):
super(DataDBTestCase, self).setUp()
self.test_mbid = "0dad432b-16cc-4bf0-8961-fd31d124b01b"
... | abhinavjain241/acousticbrainz-server | db/test/test_data.py | Python | gpl-2.0 | 14,021 | 0.003994 |
from . import RephoneTest
from re import match
class TestViews(RephoneTest):
def test_index(self):
with self.client:
response = self.client.get('/')
assert response.status_code == 303
def test_outbound(self):
with self.client:
response = self.client.post('... | rickmer/rephone | tests/test_views.py | Python | agpl-3.0 | 1,721 | 0.001162 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2012 ~ 2013 Deepin, Inc.
# 2012 ~ 2013 Hailong Qiu
#
# Author: Hailong Qiu <356752238@qq.com>
# Maintainer: Hailong Qiu <356752238@qq.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | linuxdeepin/deepin-media-player | src/widget/playlistview.py | Python | gpl-3.0 | 11,382 | 0.00541 |
'''
Created on 26 Mar 2013
@author: hoekstra
'''
from flask.ext.login import login_required
import requests
from linkitup import app
from linkitup.util.baseplugin import plugin
from linkitup.util.provenance import provenance
LLD_AUTOCOMPLETE_URL = "http://linkedlifedata.com/autocomplete.json"
@app.route('/linke... | Data2Semantics/linkitup | linkitup/linkedlifedata/plugin.py | Python | mit | 2,673 | 0.014964 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/btp_conversion_function1362.py | Python | mit | 14,003 | 0.000428 |
#! /usr/bin/env python
'''
oscutils.py -- Open Sound Control builtins for MFP
Copyright (c) 2013 Bill Gribble <grib@billgribble.com>
'''
from ..processor import Processor
from ..mfp_app import MFPApp
from ..bang import Uninit
class OSCPacket(object):
def __init__(self, payload):
self.payload = payloa... | bgribble/mfp | mfp/builtins/oscutils.py | Python | gpl-2.0 | 3,258 | 0.012277 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Ansible module to manage mysql replication
(c) 2013, Balazs Pocze <banyek@gawker.com>
Certain parts are taken from Mark Theunissen's mysqldb module
This file is part of Ansible
Ansible is free software: you can redistribute it and/or modify
it under the terms of the GNU... | andreaso/ansible | lib/ansible/modules/database/mysql/mysql_replication.py | Python | gpl-3.0 | 13,039 | 0.001534 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
"""
import numpy as np
from numpy.testing import assert_allclose
from cotede.fuzzy import fuzzyfy
CFG = {
"output": {
"low": {"type": "trimf", "params": [0.0, 0.225, 0.45]},
"medium": {"type": "trimf", "... | castelao/CoTeDe | tests/fuzzy/test_fuzzyfy.py | Python | bsd-3-clause | 2,666 | 0.001125 |
# -*- coding: utf-8 -*-
from django.db import models
from ..users.models import User
class Feedback(models.Model):
user = models.ForeignKey(User)
comments = models.CharField(max_length=50000)
date = models.DateTimeField(auto_now=True)
class Meta:
ordering = ["-date"]
def __str__(self):
... | jacobajit/ion | intranet/apps/feedback/models.py | Python | gpl-2.0 | 374 | 0 |
# 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... | swiftstack/swift | test/unit/account/test_server.py | Python | apache-2.0 | 135,836 | 0 |
from . import config
from django.shortcuts import render
from mwoauth import ConsumerToken, Handshaker, tokens
def requests_handshaker():
consumer_key = config.OAUTH_CONSUMER_KEY
consumer_secret = config.OAUTH_CONSUMER_SECRET
consumer_token = ConsumerToken(consumer_key, consumer_secret)
return Handsha... | harej/requestoid | authentication.py | Python | mit | 819 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------------------------------------------------*
#
# Options for all compilers
#
#----------------------------------------------------------------------------------------------------------------------*... | TrampolineRTOS/trampoline | goil/build/libpm/python-makefiles/default_build_options.py | Python | gpl-2.0 | 3,374 | 0.02786 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.