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 |
|---|---|---|---|---|---|---|
import time
from pygame.locals import *
import gui
MOUSE_LEFT_BUTTON = 1
MOUSE_MIDDLE_BUTTON = 2
MOUSE_RIGHT_BUTTON = 3
MOUSE_WHEELUP = 4
MOUSE_WHEELDOWN = 5
class Screen(object):
"""Base gui screen class
every game screen class should inherit from this one
"""
__triggers = []
... | pjotrligthart/openmoo2-unofficial | game/gui/screen.py | Python | gpl-2.0 | 8,413 | 0.006894 |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from dataclasses import dataclass
from pathlib import Path
from textwrap import dedent
from typing import Mapping, Optional, Tuple, cast
from pants.core.util_rules import subpro... | jsirois/pants | src/python/pants/backend/python/util_rules/pex_environment.py | Python | apache-2.0 | 10,132 | 0.003652 |
#!/usr/bin/env python3
import os
import pathlib
import sysconfig
import compileall
import subprocess
prefix = pathlib.Path(os.environ.get('MESON_INSTALL_PREFIX', '/usr/local'))
datadir = prefix / 'share'
destdir = os.environ.get('DESTDIR', '')
if not destdir:
print('Compiling gsettings schemas...')
subproces... | sramkrishna/eidisi | scripts/meson_post_install.py | Python | gpl-3.0 | 838 | 0.00358 |
from __future__ import unicode_literals
def execute():
"""Make standard print formats readonly for system manager"""
import webnotes.model.doc
new_perms = [
{
'parent': 'Print Format',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'System Manager',
'permlevel': 1,
'read': 1,
... | gangadhar-kadam/mtn-erpnext | patches/may_2012/std_pf_readonly.py | Python | agpl-3.0 | 718 | 0.044568 |
# Copyright 2016 Huawei Technologies India Pvt. Ltd.
# 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 requi... | dims/neutron | neutron/db/bgp_dragentscheduler_db.py | Python | apache-2.0 | 9,018 | 0 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("MLPRegressor" , "freidman1" , "mysql")
| antoinecarme/sklearn2sql_heroku | tests/regression/freidman1/ws_freidman1_MLPRegressor_mysql_code_gen.py | Python | bsd-3-clause | 128 | 0.015625 |
from __future__ import absolute_import
from datetime import timedelta
import pytest
import logging
import re
import mock
from tornado import gen
from tornado.ioloop import PeriodicCallback, IOLoop
from tornado.httpclient import HTTPError
import bokeh.server.server as server
from bokeh.application import Applicatio... | Ziqi-Li/bknqgis | bokeh/bokeh/server/tests/test_server.py | Python | gpl-2.0 | 22,987 | 0.002871 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apark263/tensorflow | tensorflow/python/autograph/pyct/static_analysis/type_info_test.py | Python | apache-2.0 | 6,883 | 0.004794 |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | radicalbit/ambari | ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_windows.py | Python | apache-2.0 | 3,411 | 0.007622 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | GabrielBrascher/cloudstack | test/selenium/smoke/TemplatesAndISO.py | Python | apache-2.0 | 6,757 | 0.027823 |
from unittest import TestCase
from django.conf import settings
from django.test.utils import override_settings
from mock import patch
from elastic_django.client import ElasticsearchClient
from elastic_django.exceptions import ElasticsearchClientConfigurationError
class ElasticsearchClientTestCase(TestCase):
de... | jose-lpa/elastic-django | tests/test_client.py | Python | bsd-3-clause | 2,202 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016, OVH SAS
#
# This file is part of ip-reputation-monitoring.
#
# ip-reputation-monitoring 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 L... | ovh/ip-reputation-monitoring | reputation/parsing/csv/blocklistde.py | Python | gpl-3.0 | 2,133 | 0.000469 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('home', '0001_initial'),
]
operat... | birkholz/homeboard | chores/migrations/0001_initial.py | Python | gpl-2.0 | 1,978 | 0.002022 |
# Define settings that are specific to the local environment.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'database.db',
}
}
INTERNAL_IPS = ('127.0.0.1',)
from custom_settings import INSTALLED_APPS
INSTALLED_APPS += (
# 'debug_toolbar',
)
| django-settings/django-settings | myproject/myproject/local_settings.py | Python | unlicense | 301 | 0.003322 |
import operator
import random
import pytest
from diofant import (And, Eq, Equality, FiniteSet, Float, Function, Ge,
GreaterThan, Gt, I, Implies, Integer, Interval, Le,
LessThan, Lt, Ne, Not, Or, Rational, Rel, Relational,
StrictGreaterThan, StrictLessThan... | diofant/diofant | diofant/tests/core/test_relational.py | Python | bsd-3-clause | 22,310 | 0.000359 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | adel-boutros/qpid-dispatch | tests/system_tests_multi_tenancy.py | Python | apache-2.0 | 35,894 | 0.004987 |
import numpy as N
from mplstereonet import stereonet_math
from scipy.stats import chi2
from numpy.testing import assert_array_almost_equal
from .geom.util import vector, unit_vector, dot
def quaternion(vector, angle):
"""
Unit quaternion for a vector and an angle
"""
return N.cos(angle/2)+vector*N.sin... | davenquinn/Attitude | attitude/stereonet.py | Python | mit | 7,069 | 0.014854 |
#
# Copyright 2009 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 i... | MatthewWilkes/mw4068-packaging | src/melange/src/soc/tasks/helper/__init__.py | Python | apache-2.0 | 654 | 0.004587 |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | miyakz1192/neutron | neutron/tests/api/test_extra_dhcp_options.py | Python | apache-2.0 | 4,030 | 0.000248 |
# Copyright (c) 2011 The Chromium OS Authors.
#
# SPDX-License-Identifier: GPL-2.0+
#
import command
import re
import os
import series
import subprocess
import sys
import terminal
import checkpatch
import settings
def CountCommitsToBranch():
"""Returns number of commits between HEAD and the tracking branch.
... | lkylei/ten_thousand | roms/u-boot/tools/patman/gitutil.py | Python | gpl-2.0 | 18,813 | 0.002232 |
# Copyright 2010-2012 Opera Software ASA
#
# 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 ... | operasoftware/tlscommon | test_results.py | Python | apache-2.0 | 4,642 | 0.019604 |
import game
import server
class tt2(game.Game):
class TT2Process(server.GameProcess):
def memory_percent_usage(self):
return 0.0
def __init__(self, server, name):
game.Game.__init__(self, server, name)
self.process_class = self.TT2Process
def get_option(self, query)... | GamesCrafters/GamesmanClassic | src/py/games/tt2.py | Python | gpl-2.0 | 963 | 0.001038 |
#! /usr/bin/env python
"""Post a new MT entry"""
# username, password, blogid, publish
from settings import *
import types
import xmlrpclib
def post(content):
"""Post an entry to a blog. Return postid on success."""
content.check()
weblogContent = { 'title' : content.getTitle(),
... | false-git/mail2entry | postentry.py | Python | gpl-2.0 | 621 | 0.011272 |
# 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/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py | Python | mit | 15,615 | 0.004163 |
# -*- coding: utf-8 -*-
# ########################################################################
# #
# #
# #####################################################################... | damdam-s/rma | product_warranty/models/return_instruction.py | Python | agpl-3.0 | 2,163 | 0 |
import ast
from frontend.context import Context
from frontend.stubs.stubs_paths import libraries
class ImportHandler:
"""Handler for importing other modules during the type inference"""
@staticmethod
def get_ast(path, module_name):
"""Get the AST of a python module
:param path: t... | gitsimon/spadup-lyra | frontend/import_handler.py | Python | mpl-2.0 | 1,952 | 0.002049 |
# 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 tests.testing_utils import testing
import highend
class TestLogin(testing.AppengineTestCase):
app_module = highend.app
def test_login(self):
... | nicko96/Chrome-Infra | appengine/chromium_cq_status/tests/login_test.py | Python | bsd-3-clause | 563 | 0.003552 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| jsfenfen/django-calaccess-raw-data | example/manage.py | Python | mit | 304 | 0 |
import verifytree.VerifyTree as P
import pytest
import os
import logging
import smtplib
from mock import Mock
from mock import patch, call
from mock import MagicMock
from mock import PropertyMock
class Testverifytree:
def setup(self):
self.p = P.VerifyTree()
| virantha/verifytree | test/test_verifytree.py | Python | apache-2.0 | 275 | 0 |
# encoding: 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):
# Deleting model 'LikedComment'
db.delete_table('forum_likedcomment')
# Deleting... | CLLKazan/iCQA | qa-engine/forum/migrations/0019_auto__del_likedcomment__del_comment__add_field_node_abs_parent__chg_fi.py | Python | gpl-3.0 | 27,368 | 0.008112 |
#!/usr/bin/env python
#
# This is be used to verify that all the dependant libraries of a Mac OS X executable
# are present and that they are backwards compatible with at least 10.5.
# Run with an executable as parameter
# Will return 0 if the executable an all libraries are OK
# Returns != 0 and prints some textura... | battlesnake/OpenSCAD | scripts/macosx-sanity-check.py | Python | gpl-2.0 | 4,696 | 0.010009 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import time
import datetime
import inspect
import simplejson as json
def outnode(data):
"""Outnode"""
a = int(data[2])
b = int(data[3])
c = int(data[4])
d = int(data[5])
e = int(data[6])
f = int(data[7])
g = int(data[8])
... | artekw/sensmon | sensnode/decoders/outnode.py | Python | mit | 761 | 0.015769 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 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,... | Lilykos/invenio | invenio/legacy/bibedit/cli.py | Python | gpl-2.0 | 10,826 | 0.002402 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import with_statement
import time
from collections import OrderedDict
import numpy as np
from pyqtgraph.WidgetGroup import WidgetGroup
from acq4.devices.DAQGeneric import DAQGeneric, DAQGenericTask, DAQGenericTaskGui, DataMapping
from acq4... | acq4/acq4 | acq4/devices/AxoPatch200/AxoPatch200.py | Python | mit | 25,005 | 0.012478 |
'''
Copyright 2013 Jonathan Morgan
This file is part of http://github.com/jonathanmorgan/conv2wp.
conv2wp is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your optio... | jonathanmorgan/conv2wp | b2e/b2e_importer.py | Python | gpl-3.0 | 77,772 | 0.019454 |
__author__ = 'asdf2014'
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
def modified_huber_loss(y_true, y_pred):
z = y_pred * y_true
loss = -4 * z
loss[z >= -1] = (1 - z[z >= -1]) ** 2
loss[z >= 1.] = 0
return loss
xmin, xmax = -4, 4
xx = np.linspace(xmin, xmax, 100)
plt.plo... | MasteringSpark/FirstStep | src/main/python/scikit/loss_function.py | Python | apache-2.0 | 918 | 0.002179 |
# -*- coding: utf-8 -*-
'''
Covenant Add-on
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 prog... | felipenaselva/felipe.repository | plugin.video.streamhub/resources/lib/sources/en/watchfree.py | Python | gpl-2.0 | 8,466 | 0.012521 |
import logging
import logging.handlers
import os
import sys
LOG_FORMAT = '[%(asctime)s] %(levelname)s: %(message)s'
MAX_LOG_SIZE = 1024 * 1024 * 10
LOG_BACKUP_COUNT = 5
LOG_PATH = log_path = os.path.join(os.path.expanduser('~'), '.tomviz', 'logs')
LOG_PATHS = {
'stderr': '%s/stderr.log' % LOG_PATH,
'stdout': ... | cryos/tomviz | acquisition/tomviz/__init__.py | Python | bsd-3-clause | 2,177 | 0 |
from __future__ import absolute_import
# Copyright (c) 2010-2016 openpyxl
from warnings import warn
from .numbers import BUILTIN_FORMATS, BUILTIN_FORMATS_REVERSE
from .proxy import StyleProxy
from .cell_style import StyleArray
class StyleDescriptor(object):
def __init__(self, collection, key):
self.col... | aragos/tichu-tournament | python/openpyxl/styles/styleable.py | Python | mit | 2,984 | 0.002011 |
# AMDG
import unittest
from datetime import datetime
from balance import BasicLoader, RepayLoader
from base_test import BaseTest
class LoaderTests(BaseTest, unittest.TestCase):
def test_basic_loader(self):
loader = BasicLoader('tests/data/basic_loader')
entries, errors = loader.load(return_errors=... | pilliq/balance | tests/test_loaders.py | Python | mit | 1,764 | 0.004535 |
import re
import json
import itertools
from .common import InfoExtractor
from .subtitles import SubtitlesInfoExtractor
from ..utils import (
compat_urllib_request,
compat_str,
get_element_by_attribute,
get_element_by_id,
orderedSet,
ExtractorError,
)
class DailymotionBaseInfoExtractor(InfoEx... | ashutosh-mishra/youtube-dl | youtube_dl/extractor/dailymotion.py | Python | unlicense | 8,993 | 0.003114 |
#==================================
#Author Bjorn Burr Nyberg
#University of Bergen
#Contact bjorn.nyberg@uni.no
#Copyright 2013
#==================================
'''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 Sof... | BJEBN/Geometric-Analysis | Scripts/Old Scripts/Extract_Non_Duplicate_Nodes.py | Python | gpl-3.0 | 2,434 | 0.013969 |
from . import test_l10n_br_hr
from . import test_hr_employee_dependent
| OCA/l10n-brazil | l10n_br_hr/tests/__init__.py | Python | agpl-3.0 | 71 | 0 |
#!/usr/bin/env python
#
# Copyright 2015 BMC Software, 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 applicab... | jdgwartney/boundary-api-cli | tests/unit/boundary/cli_test.py | Python | apache-2.0 | 2,812 | 0.001067 |
#!/usr/bin/env python
import xml.etree.ElementTree as ET
class brocade_maps_ext(object):
"""Auto generated class.
"""
def __init__(self, **kwargs):
self._callback = kwargs.pop('callback')
def maps_get_all_policy_input_rbridge_id(self, **kwargs):
"""Auto Generated Code
... | BRCDcomm/pynos | pynos/versions/ver_6/ver_6_0_1/yang/brocade_maps_ext.py | Python | apache-2.0 | 12,855 | 0.0021 |
##############################################################################
#
# Copyright (c) 2008-2012 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
# General contacts <info@alistek.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take th... | iw3hxn/LibrERP | report_aeroo/wizard/report_print_by_action.py | Python | agpl-3.0 | 2,640 | 0.006061 |
# Patchless XMLRPC Service for Django
# Kind of hacky, and stolen from Crast on irc.freenode.net:#django
# Self documents as well, so if you call it from outside of an XML-RPC Client
# it tells you about itself and its methods
#
# Brendan W. McAdams <brendan.mcadams@thewintergrp.com>
# SimpleXMLRPCDispatcher lets us r... | SolusOS-discontinued/RepoHub | buildfarm/views.py | Python | mit | 5,488 | 0.030977 |
import tkinter as tk
from tkinter import *
import spotipy
import webbrowser
from PIL import Image, ImageTk
import os
from twitter import *
from io import BytesIO
import urllib.request
import urllib.parse
import PIL.Image
from PIL import ImageTk
import simplejson
song1 = "spotify:artist:58lV9VcRSjABbAbfWS6skp"
song2 = ... | AndrewKLeech/Pip-Boy | Game.py | Python | mit | 42,161 | 0.0347 |
from collections import deque
from hiku.denormalize.graphql import DenormalizeGraphQL
class DenormalizeEntityGraphQL(DenormalizeGraphQL):
def __init__(self, graph, result, root_type_name):
super().__init__(graph, result, root_type_name)
self._type = deque([graph.__types__[root_type_name]])
| vmagamedov/hiku | hiku/federation/denormalize.py | Python | bsd-3-clause | 314 | 0 |
def test():
for i in xrange(int(5e3)):
t = []
for j in xrange(int(1e4)):
#t[j] = 'x'
t.append('x')
t = ''.join(t)
test()
| svaarala/duktape | tests/perf/test-string-array-concat.py | Python | mit | 174 | 0.011494 |
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Model, NOT_PROVIDED, DateTimeField
from django.utils import timezone
from django.utils.encoding import smart_text
def track_field(field):
"""
Returns whether the given field should be tracked by... | kbussell/django-auditlog | src/auditlog/diff.py | Python | mit | 5,123 | 0.002733 |
"""
Middleware that checks user standing for the purpose of keeping users with
disabled accounts from accessing the site.
"""
from django.conf import settings
from django.http import HttpResponseForbidden
from django.utils.deprecation import MiddlewareMixin
from django.utils.translation import ugettext as _
from ope... | cpennington/edx-platform | common/djangoapps/student/middleware.py | Python | agpl-3.0 | 1,580 | 0.001266 |
from __future__ import print_function, division
from .str import StrPrinter
from sympy.utilities import default_sort_key
class LambdaPrinter(StrPrinter):
"""
This printer converts expressions into strings that can be used by
lambdify.
"""
def _print_MatrixBase(self, expr):
return "%s(%s)... | Shaswat27/sympy | sympy/printing/lambdarepr.py | Python | bsd-3-clause | 8,389 | 0.006556 |
import logging
import time
import types
from autotest.client.shared import error
from virttest import utils_misc, utils_test, aexpect
def run(test, params, env):
"""
KVM migration test:
1) Get a live VM and clone it.
2) Verify that the source VM supports migration. If it does, proceed with
... | spcui/tp-qemu | qemu/tests/migration.py | Python | gpl-2.0 | 9,706 | 0.000309 |
from __future__ import unicode_literals
template = {
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation Sample Template to create a KMS Key. The Fn::GetAtt is used to retrieve the ARN",
"Resources": {
"myKey": {
"Type": "AWS::KMS::Key",
"Properties... | william-richard/moto | tests/test_cloudformation/fixtures/kms_key.py | Python | apache-2.0 | 1,645 | 0.000608 |
"""The www.cartoonmad.com analyzer.
[Entry examples]
- http://www.cartoonmad.com/comic/5640.html
- https://www.cartoonmad.com/comic/5640.html
"""
import re
from urllib.parse import parse_qsl
from cmdlr.analyzer import BaseAnalyzer
from cmdlr.autil import fetch
class Analyzer(BaseAnalyzer):
"""The www.... | civalin/cmdlr | src/cmdlr/analyzers/cartoonmad.py | Python | mit | 3,587 | 0.000561 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TODO prog_base.py - A starting template for Python scripts
#
# Copyright 2013 Robert B. Hawkins
#
"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how to use this script. This docstring
will be printed by ... | braynebuddy/PyBrayne | act_twitter.py | Python | gpl-3.0 | 3,157 | 0.009819 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import uuid
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
('invite', '0001_initial'),
]
operations = [
migrations.DeleteModel('PasswordRe... | unt-libraries/django-invite | invite/migrations/0002_abstract_invitation.py | Python | bsd-3-clause | 1,634 | 0.002448 |
import os
import webapp2
from app import routes
webapp2_config = {'webapp2_extras.sessions':
{'secret_key': 'hfgskahjfgd736987qygukr3279rtigu',
'webapp2_extras.jinja2': {'template_path': os.path.join(os.path.abspath(os.path.dirname(__file__)), 'templates')}}}
application = webapp2.WSGIApplication(debug=True, c... | Terhands/saskdance | app/main.py | Python | gpl-3.0 | 373 | 0.010724 |
from mimetypes import guess_type
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from django.http import Http404
from django.template import TemplateDoesNotExist, RequestContext, NodeList
from ella.core.models import Listing, Category
from ella.core.conf import core_... | petrlosa/ella | ella/core/feeds.py | Python | bsd-3-clause | 4,034 | 0.001735 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# 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, eithe... | quinox/weblate | weblate/accounts/models.py | Python | gpl-3.0 | 26,496 | 0 |
# Copyright 2014 DreamHost, LLC
#
# Author: DreamHost, 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 applicabl... | markmcclain/astara | akanda/rug/api/configuration.py | Python | apache-2.0 | 6,984 | 0.000143 |
import io
import json
class Stream(object):
__shortname__ = "stream"
"""
This is a base class that should be inherited when implementing
different stream types. Should only be created by plugins.
"""
def __init__(self, session):
self.session = session
def __repr__(self):
... | ethanhlc/streamlink | src/streamlink/stream/stream.py | Python | bsd-2-clause | 915 | 0 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | Nitaco/ansible | lib/ansible/module_utils/network/ios/ios.py | Python | gpl-3.0 | 5,949 | 0.002858 |
# 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/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py | Python | mit | 5,627 | 0.004087 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from elftools.elf.elffile import ELFFile
from elftools.common.exceptions import ELFError
from elftools.elf.segments import NoteSegment
class ReadELF(object):
def __init__(self, file):
self.elffile = ELFFile(file)
def get_build(self):
f... | somat/samber | elf.py | Python | mit | 861 | 0.003484 |
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.models import NOT_PROVIDED
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_rename_table = "RENAME TABLE %(old_table)s TO %(new_table)s"
sql_alter_column_null = "MODIFY %(column)s %(type)s NULL"
sql_alter_column_... | cyaninc/django-mysql-pymysql | src/mysql_pymysql/schema.py | Python | bsd-3-clause | 2,073 | 0.00193 |
from django.db import models
from customer.models import Customer
from product.models import Product
from django.utils import timezone
# Create your models here.
class OrderStatus:
IN_BASKET = 0
PAYED = 1
class Order(models.Model):
customer = models.ForeignKey(Customer)
product = models.ForeignKey(P... | MahdiZareie/PyShop | shop/models.py | Python | mit | 691 | 0.001447 |
# -*- coding: utf-8 -*-
"""
Go to Google Bookmarks: https://www.google.com/bookmarks/
On the bottom left, click "Export bookmarks": https://www.google.com/bookmarks/bookmarks.html?hl=en
After downloading the html file, run this script on it to get the addresses
This script is based on https://gist.github.com/endolit... | marado/stars-to-addresses | stars-to-addresses.py | Python | gpl-3.0 | 5,571 | 0.009514 |
#### 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 = Weapon()
result.template = "object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_s11_training.iff"
res... | obi-two/Rebelion | data/scripts/templates/object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_s11_training.py | Python | mit | 490 | 0.044898 |
# Copyright 2019 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | Sutto/cloud-custodian | tools/c7n_azure/tests_azure/test_filters_marked_for_op.py | Python | apache-2.0 | 3,258 | 0.002762 |
#!/usr/bin/python3
import os
import sys
import subprocess
import unittest
def testequal(a,b):
if (a==b):
print ("SUCCESS")
else:
print ("FAIL")
def getPortal():
output=subprocess.check_output(["iscsi-ls","iscsi://localhost:3260"])
print (output)
target=output[7:-25]
#Test if iSCSI portal is created (last par... | raqet/acquisition-client | testing/test-iscsi.py | Python | gpl-3.0 | 1,527 | 0.061559 |
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.decorators import action
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from rdmo.core.exports import XMLResponse
from rdmo.core.permis... | rdmorganiser/rdmo | rdmo/conditions/viewsets.py | Python | apache-2.0 | 2,141 | 0.000934 |
from yowsup.layers.protocol_contacts.protocolentities.iq_sync_get import GetSyncIqProtocolEntity
from yowsup.structs import ProtocolTreeNode
from yowsup.layers.protocol_contacts.protocolentities.test_iq_sync import SyncIqProtocolEntityTest
class GetSyncIqProtocolEntityTest(SyncIqProtocolEntityTest):
def setUp(self... | felix-dumit/campusbot | yowsup2/yowsup/layers/protocol_contacts/protocolentities/test_iq_sync_get.py | Python | mit | 810 | 0.011111 |
from django.conf.urls.defaults import *
import views
urlpatterns = patterns('',
url(r'^$', views.fuse_index),
url(r'^/(?P<dir_name>[^/]+)$', views.fuse_artist),
)
| MechanisM/musicdb | musicdb/classical/fuse_urls.py | Python | agpl-3.0 | 173 | 0.00578 |
from oioioi.base.permissions import make_request_condition
from oioioi.base.utils import request_cached
from oioioi.problems.models import Problem
from oioioi.testrun.utils import testrun_problem_instances
from oioioi.zeus.models import ZeusProblemData
def is_zeus_problem(problem):
try:
return bool(proble... | papedaniel/oioioi | oioioi/zeus/utils.py | Python | gpl-3.0 | 1,047 | 0.000955 |
######################################################################
# This file should be kept compatible with Python 2.3, see PEP 291. #
######################################################################
import sys, os
# find_library(name) returns the pathname of a library, or None.
if os.name == "nt":
d... | justathoughtor2/atomicApe | cygwin/lib/python2.7/ctypes/util.py | Python | gpl-3.0 | 9,752 | 0.002051 |
import asyncio
from unittest import mock
import pytest
from waterbutler.core import utils
class TestAsyncRetry:
@pytest.mark.asyncio
async def test_returns_success(self):
mock_func = mock.Mock(return_value='Foo')
retryable = utils.async_retry(5, 0, raven=None)(mock_func)
x = await r... | TomBaxter/waterbutler | tests/core/test_utils.py | Python | apache-2.0 | 2,451 | 0 |
##
# Copyright (c) 2015-2017 Apple 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 l... | macosforge/ccs-calendarserver | txdav/common/datastore/podding/migration/test/test_migration.py | Python | apache-2.0 | 30,577 | 0.002943 |
# record.py
# -------------------------
# Fall 2012; Alex Safatli
# -------------------------
# Software package for handling
# the recording and calculating
# of player scores for the Eclipse
# board game, along with keeping
# track of individual matches.
# Imports
import os, cPickle, datetime
# Match class. Encaps... | AlexSafatli/EclipseBoardGame | record.py | Python | gpl-2.0 | 2,974 | 0.014459 |
# -*- coding:utf8 -*-
# File : tfutils.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 1/31/17
#
# This file is part of TensorArtist.
import re
import tensorflow as tf
class TArtGraphKeys:
PLACEHOLDERS = 'placeholders'
TART_VARIABLES = 'tart_variables'
INFERENCE_SUMMARIES = 'infer... | vacancy/TensorArtist | tartist/nn/tfutils.py | Python | mit | 2,691 | 0.00223 |
#!/usr/bin/env python
# cardinal_pythonlib/sqlalchemy/dump.py
"""
===============================================================================
Original code copyright (C) 2009-2021 Rudolf Cardinal (rudolf@pobox.com).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version ... | RudolfCardinal/pythonlib | cardinal_pythonlib/sqlalchemy/dump.py | Python | apache-2.0 | 19,483 | 0 |
# -*- coding: utf-8 -*-
"""
MediaProvider
A device centric multimedia solution
----------------------------------------------------------------------------
(C) direct Netware Group - All rights reserved
https://www.direct-netware.de/redirect?mp;core
The following license agreement remains valid unless any additions o... | dNG-git/mp_core | src/dNG/data/upnp/search/common_mp_entry_segment.py | Python | gpl-2.0 | 16,034 | 0.005987 |
# Copyright: (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = typ... | caphrim007/ansible | lib/ansible/plugins/action/__init__.py | Python | gpl-3.0 | 50,188 | 0.003447 |
import time, os
import io
import time
import picamera
os.putenv('SDL_VIDEODRIVER', 'fbcon')
os.putenv('SDL_FBDEV' , '/dev/fb1')
os.putenv('SDL_MOUSEDRV' , 'TSLIB')
os.putenv('SDL_MOUSEDEV' , '/dev/input/touchscreen')
os.putenv('SDL_AUDIODRIVER' , 'alsa')
# Create an in-memory stream
#my_stream = io.BytesIO(... | lumened/touch-flux | src/demo.py | Python | gpl-2.0 | 805 | 0.012422 |
# Function to scan for pseudolandmarks along the y-axis
import cv2
import os
import numpy as np
from plantcv.plantcv._debug import _debug
from plantcv.plantcv import params
from plantcv.plantcv import outputs
from plantcv.plantcv import fatal_error
def y_axis_pseudolandmarks(img, obj, mask, label="default"):
"""... | danforthcenter/plantcv | plantcv/plantcv/y_axis_pseudolandmarks.py | Python | mit | 9,161 | 0.002729 |
# stdlib
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
# third party
from nacl.signing import VerifyKey
from pydantic import BaseModel
from pydantic.error_wrappers import ValidationError as PydanticValidationError
# relative
from .....common.message import Immediat... | OpenMined/PySyft | packages/syft/src/syft/core/node/common/node_service/generic_payload/syft_message.py | Python | apache-2.0 | 3,573 | 0.002239 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_flaskpypi
----------------------------------
Tests for `flaskpypi` module.
"""
import pytest
from flaskpypi import flaskpypi
# Code from https://wiki.python.org/moin/PyPISimple
from xml.etree import ElementTree
from urllib.request import urlopen
def get_distri... | waynew/flaskpypi | tests/test_flaskpypi.py | Python | bsd-3-clause | 752 | 0.00266 |
# Copyright 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 ... | shakamunyi/neutron-vrrp | neutron/db/migration/alembic_migrations/versions/19180cf98af6_nsx_gw_devices.py | Python | apache-2.0 | 3,313 | 0.000906 |
#!/usr/bin/python
# Google Spreadsheet DHT Sensor Data-logging Example
# Depends on the 'gspread' and 'oauth2client' package being installed. If you
# have pip installed execute:
# sudo pip install gspread oauth2client
# Also it's _very important_ on the Raspberry Pi to install the python-openssl
# package becau... | mh03r932/raspi2dht11 | examples/google_spreadsheet_twosens.py | Python | mit | 6,208 | 0.016591 |
# Copyright (c) 2007 Enough Project.
# See LICENSE for details.
"""The things a keymap does:
1. Pass given keys to 'next' keymap (considered more 'specific') which
is stronger/overrides the keymap itself.
2. If the next keymap does not know the key, then it tries to handle
it itself according to a map it holds th... | krfkeith/enough | gui/Keymap.py | Python | gpl-3.0 | 10,827 | 0.002586 |
import jarray
g = gs.open(gs.args[0])
istates = gs.associated(g, "initialState", True).getInitialStates()
ssrv = gs.service("stable")
def copy_path(values, coreNodes):
n = len(coreNodes)
path = jarray.zeros(n, 'b')
i = 0
for idx in coreNodes:
path[i] = values[idx]
i += 1
retur... | ComputationalSystemsBiology/GINsimScripts | stable_core/stable_core.py | Python | gpl-3.0 | 2,265 | 0.007947 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "TootList.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| gkoehler/TootList | TootList/manage.py | Python | mit | 257 | 0 |
import random
from datetime import date, timedelta, datetime
from django.core.urlresolvers import reverse
from ._utils import generate_random_event, TestCase, hours_ago, hours_ahead
from ..models import Event
class EventManagerTestCase(TestCase):
def test_upcoming_future(self):
event_future = generate_ra... | armstrong/armstrong.apps.events | armstrong/apps/events/tests/managers.py | Python | apache-2.0 | 2,622 | 0.002288 |
"""
Iterator based sre token scanner
"""
import sre_parse, sre_compile, sre_constants
from sre_constants import BRANCH, SUBPATTERN
from re import VERBOSE, MULTILINE, DOTALL
import re
__all__ = ['Scanner', 'pattern']
FLAGS = (VERBOSE | MULTILINE | DOTALL)
class Scanner(object):
def __init__(self, lexicon, flags=FL... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-0.96/django/utils/simplejson/scanner.py | Python | bsd-3-clause | 2,009 | 0.002987 |
from django.conf.urls import patterns, url
import views as views
urlpatterns = patterns('',
#url(r'^$', views.index, name='index'),
#url(r'index.html', views.index, name='index')
)
| jxp360/golfapp | golfapp/apps/piffycup/urls.py | Python | gpl-2.0 | 191 | 0.026178 |
import requests
from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
OAuth2CallbackView)
from .provider import BasecampProvider
class BasecampOAuth2Adapter(OAuth2Ad... | Alexander-M-Waldman/local_currency_site | lib/python2.7/site-packages/allauth/socialaccount/providers/basecamp/views.py | Python | gpl-3.0 | 1,123 | 0 |
from traceback import format_exc
from django.core.management.base import BaseCommand
from ...toolbox import send_scheduled_messages
class Command(BaseCommand):
help = 'Sends scheduled messages (both in pending and error statuses).'
def add_arguments(self, parser):
parser.add_argument(
... | idlesign/django-sitemessage | sitemessage/management/commands/sitemessage_send_scheduled.py | Python | bsd-3-clause | 1,014 | 0.001972 |
# -*- coding: utf-8 *-*
# This file is part of wger Workout Manager.
#
# wger Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any ... | DeveloperMal/wger | wger/exercises/management/commands/download-exercise-images.py | Python | agpl-3.0 | 5,449 | 0.002936 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" Topological sort """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ imp... | aldebaran/qibuild | python/qisys/sort.py | Python | bsd-3-clause | 4,651 | 0.00172 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.