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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Vertice:
def __init__(self, id, latitude, longitude):
self.id = id
self.latitude = latitude
self.longitude = longitude | Raul3212/TopicosAvancadosBD | dev/model/Vertice.py | Python | gpl-3.0 | 198 | 0.005051 |
import logging
from mobilebdd.drivers.android import AndroidWebDriver, SelendroidWebDriver
from mobilebdd.drivers.desktop import DesktopChromeWebDriver, DesktopInternetExplorerWebDriver, DesktopFirefoxWebDriver
from mobilebdd.drivers.ios import iOSWebDriver
from mobilebdd.drivers.mobileweb import ChromeWebDriver, WebV... | PhoenixWright/MobileBDDCore | mobilebdd/drivers/drivers.py | Python | apache-2.0 | 3,463 | 0.002599 |
import functools
from framework.auth import Auth
from website.archiver import (
StatResult, AggregateStatResult,
ARCHIVER_NETWORK_ERROR,
ARCHIVER_SIZE_EXCEEDED,
ARCHIVER_FILE_NOT_FOUND,
ARCHIVER_FORCED_FAILURE,
)
from website import (
mails,
settings
)
from osf.utils.sanitize import unesc... | erinspace/osf.io | website/archiver/utils.py | Python | apache-2.0 | 10,456 | 0.002965 |
from django.conf.urls import *
from django.contrib.auth import views as auth_views
from businesstest.views import Messages
urlpatterns = patterns("businesstest.views",
# (r"messages/$", "message_list"),
(r"messages/$", Messages.as_view(), {}, "messages"),
(r"(\d+)/$", "test"),
(r"test_done/$", "test_do... | pythonbyexample/PBE | dbe/businesstest/urls.py | Python | bsd-3-clause | 619 | 0.006462 |
"""
Tests for install.py for SUSE based Linux distributions
"""
import os
import shutil
from unittest import mock
import pytest
from install import Cmd, CmdError, RemoteFileNotFoundError
pytestmark = pytest.mark.skipif(
not pytest.helpers.helper_is_suse(),
reason="Tests for openSUSE/SUSE"
)
def test_rpm_do... | junaruga/rpm-py-installer | tests/test_install_suse.py | Python | mit | 1,463 | 0 |
"""'d987888a7460' - Tags table."""
import sqlalchemy as sa
from alembic import op
#from lib.util_datetime import tzware_datetime
#from lib.util_sqlalchemy import AwareDateTime
"""
Tags table
Revision ID: d987888a7460
Revises: 216ce379d3f0
Create Date: 2016-11-01 14:13:28.216736
"""
# Revision identifiers, used by ... | hoytnix/hoyt.io | flask-server/hoyt/migrations/versions/d987888a7460_tags_table.py | Python | gpl-3.0 | 1,553 | 0.003863 |
# -*- coding: utf-8 -*-
# Copyright (c) 2006 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing the Editor Calltips configuration page.
"""
from __future__ import unicode_literals
from PyQt5.Qsci import QsciScintilla
from QScintilla.QsciScintillaCompat import QSCINTILLA_VERSION
from .Con... | davy39/eric | Preferences/ConfigurationPages/EditorCalltipsPage.py | Python | gpl-3.0 | 2,886 | 0.003465 |
import webapp2
import json
from collections import defaultdict
from generic_handler import GenericHandler
from google.appengine.api import users
from google.appengine.ext import ndb
from handler_utils import is_int
from handler_utils import GetPairIdFromRequest
from handler_utils import GetTourneyWithIdAndMaybeReturnS... | aragos/tichu-tournament | api/src/movement_handler.py | Python | mit | 5,763 | 0.011279 |
# -*- coding: utf-8 -*-
dCellSize = 20
WindowWidth = 400
WindowHeight = 400
class SCell(object):
def __init__(self, xmin, xmax, ymin, ymax):
self._iTicksSpentHere = 0
self._left = xmin
self._right = xmax
self._top = ymin
self.bottom = ymax
def Update(self):
self._iTicksSpentHere... | crazyskady/ai-game-python | Chapter08/CMapper.py | Python | mit | 1,821 | 0.031851 |
import locale
import os
import uuid
import pytest
from funcy import cached_property
from dvc.utils import env2bool
from .base import Base
from .path_info import CloudURLInfo
TEST_AWS_REPO_BUCKET = os.environ.get("DVC_TEST_AWS_REPO_BUCKET", "dvc-temp")
TEST_AWS_ENDPOINT_URL = "http://127.0.0.1:{port}/"
class S3(Ba... | dmpetrov/dataversioncontrol | tests/remotes/s3.py | Python | apache-2.0 | 4,225 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author:
# Mateusz Kruszyński <mateusz.kruszynski@gmail.com>
#
import time
from obci.utils import tags_helper
from multiplexer.multiplexer_constants import peers, types
from obci.logic import logic_helper
from obci.logic.logic_decision_peer import LogicDecision
from ob... | BrainTech/openbci | obci/logic/logic_speller_peer.py | Python | gpl-3.0 | 1,099 | 0.002732 |
"""Functions to make simple plots with M/EEG data
"""
from __future__ import print_function
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com... | cmoutard/mne-python | mne/viz/misc.py | Python | bsd-3-clause | 19,712 | 0 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 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... | dset0x/invenio-checker | invenio_checker/workflows/base_bundle.py | Python | gpl-2.0 | 847 | 0.001181 |
# -*- coding: utf-8 -*-
import numpy as np
from numpy import linalg as la
from math import exp,pi
import time
from optparse import OptionParser
import json
import os
import gnm
'''
Calculating the auto-corrolation time which is an ill-posed problem.
Generating the theoretical (quadrature) curve for the auto-corrolati... | mugurbil/gnm | examples/exp_time_series/acor_sample.py | Python | mit | 2,362 | 0.023709 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Last-Updated : <2013/08/18 22:47:11 by samui>
import sys,os
def mkdir(folder):
if not os.path.isdir(folder):
os.system("mkdir {0}".format(folder))
if __name__ == "__main__":
data_file = os.path.abspath(sys.argv[1])
root,ext = os.path.splitext(os.p... | samui13/Gnuplot3D | script/split3D.py | Python | mit | 1,765 | 0.015864 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Gengeo(AutotoolsPackage):
"""GenGeo is a library of tools for creating complex particle
... | LLNL/spack | var/spack/repos/builtin/packages/gengeo/package.py | Python | lgpl-2.1 | 1,514 | 0.001982 |
#!/usr/bin/env python
# convertAWT.py - Mass Table Conversion Utility
import os
massFile = 'AWTMass-2003.dat'
newFile = os.path.join('..', 'nmrfreq', 'masstable.py')
def main():
with open(massFile, 'r') as file:
massDict = extractMasses(file)
writeToFile(newFile, massDict, massFile)
def extractMa... | mmoran0032/NMRpy | data/AWTconvertTable.py | Python | mit | 1,558 | 0 |
import json
import requests
class SlackNotification(object):
icon_url = "https://github-bogdal.s3.amazonaws.com/freepacktbook/icon.png"
def __init__(self, slack_url, channel):
self.slack_url = slack_url
self.channel = channel
if not self.channel.startswith("#"):
self.chann... | bogdal/freepacktbook | freepacktbook/slack.py | Python | mit | 1,181 | 0.000847 |
import unittest
import sys
import os
from Infrastructure.FileUtilities import FileUtilities
from Infrastructure.TipsManager import TipsManager
class TestsTipsManage(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.fileUtilities = FileUtilities()
def test_random_tip_from_file(self):
... | MobProgramming/MobTimer.Python | tests/Infrastructure/TipsManager/test_TipsManager.py | Python | mit | 1,455 | 0.002062 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import networkx as nx
# REF [site] >> https://networkx.github.io/documentation/latest/tutorial.html
def basic_operation_tutorial():
# Create a graph.
G = nx.Graph()
# Nodes.
G.add_node(1)
G.add_nodes_from([2, 3])
H = nx.path_graph(10) # Creates a graph.
G.add_no... | sangwook236/SWDT | sw_dev/python/ext/test/graph/networkx/networkx_basic.py | Python | gpl-3.0 | 9,760 | 0.029816 |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin, GroupAdmin
from django.contrib.auth.admin import Group as AuthGroup
from .models import User
class Group(AuthGroup):
class Meta:
proxy = True
app_label = "accounts"
verbose_name_plural = "Группы"
verb... | escsun/radio-shop | accounts/admin.py | Python | gpl-3.0 | 722 | 0.001408 |
#encoding=utf-8
# python3
import asyncio
@asyncio.coroutine
def hello():
print("Hello world!")
# 异步调用asyncio.sleep(1):
r = yield from asyncio.sleep(1)
print("Hello again!")
# 获取EventLoop:
loop = asyncio.get_event_loop()
# 执行coroutine
loop.run_until_complete(hello())
loop.close()
| solvery/lang-features | python/use_lib/asyncio_1.py | Python | gpl-2.0 | 314 | 0.010067 |
# This file is generated from pydcs_export.lua
class Weapons:
AB_250_2___144_x_SD_2__250kg_CBU_with_HE_submunitions = {"clsid": "{AB_250_2_SD_2}", "name": "AB 250-2 - 144 x SD-2, 250kg CBU with HE submunitions", "weight": 280}
AB_250_2___17_x_SD_10A__250kg_CBU_with_10kg_Frag_HE_submunitions = {"clsid": "{AB_2... | pydcs/dcs | dcs/weapons_data.py | Python | lgpl-3.0 | 212,933 | 0.006115 |
#!/usr/bin/python
import os
import sys
import grp
import pwd
import traceback
import utils
import hooking
DEV_MAPPER_PATH = "/dev/mapper"
DEV_DIRECTLUN_PATH = '/dev/directlun'
def createdirectory(dirpath):
# we don't use os.mkdir/chown because we need sudo
command = ['/bin/mkdir', '-p', dirpath]
retcod... | DragonRoman/rhevm-utils | 3.0/hooks/directlun/before_vm_migrate_destination.py | Python | gpl-3.0 | 3,145 | 0.00318 |
import numpy as np
from PyQt5.QtWidgets import (QWidget, QProgressBar, QLabel, QCheckBox,
QPushButton, QSpinBox, QVBoxLayout, QFormLayout)
from .matplotlib import QMatplotlib
from qtgui.utils import QObserver
from tools.train import Training, TrainingController
from dltb.network import Ne... | Petr-By/qtpyvis | qtgui/widgets/training.py | Python | mit | 6,290 | 0.00159 |
from setuptools import setup, find_packages
setup(
name='pulp_ostree_common',
version='1.0.0a1',
packages=find_packages(),
url='http://www.pulpproject.org',
license='GPLv2+',
author='Pulp Team',
author_email='pulp-list@redhat.com',
description='common code for pulp\'s ostree support',
)... | dkliban/pulp_ostree | common/setup.py | Python | gpl-2.0 | 321 | 0 |
# -:- coding: utf-8 -:-#
"""
A resolver to query top-level domains via publicsuffix.org.
"""
from __future__ import absolute_import
NAME = "publicsuffix"
HELP = "a resolver to query top-level domains via publicsuffix.org"
DESC = """
This resolver returns a PTR record pointing to the top-level domain of the
hostname i... | skion/junkdns | src/resolvers/publicsuffix.py | Python | mit | 5,429 | 0.004421 |
#
# Copyright (C) 2003-2006 Greg Landrum and Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
"""unit testing code for fin... | greglandrum/rdkit | rdkit/Chem/Fingerprints/UnitTestFingerprints.py | Python | bsd-3-clause | 2,918 | 0.011309 |
from otp.ai.AIBaseGlobal import *
import DistributedCCharBaseAI
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State
from direct.fsm import State
from direct.task import Task
import random
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
impo... | ksmit799/Toontown-Source | toontown/classicchars/DistributedGoofySpeedwayAI.py | Python | mit | 6,450 | 0.004186 |
# Copyright (c) 2013 eBay Software 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
#
# Unl... | CMSS-BCRDB/RDS | trove/guestagent/datastore/experimental/couchbase/system.py | Python | apache-2.0 | 2,404 | 0.000832 |
#!/usr/bin/env python3
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# 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... | cylc/cylc | tests/functional/xtriggers/02-persistence/faker_fail.py | Python | gpl-3.0 | 873 | 0 |
#!/usr/bin/env python3
"""Script to generate unannotated baseline stubs using stubgen.
Basic usage:
$ python3 scripts/create_baseline_stubs.py <project on PyPI>
Run with -h for more help.
"""
import argparse
import os
import re
import shutil
import subprocess
import sys
from typing import Optional, Tuple
PYRIGHT_C... | google/intellij-community | python/helpers/typeshed/scripts/create_baseline_stubs.py | Python | apache-2.0 | 6,346 | 0.001733 |
"""
.. module:: views.reports.procedure
:synopsis: Indivo view implementations for the procedure report.
.. moduleauthor:: Daniel Haas <daniel.haas@post.harvard.edu>
.. moduleauthor:: Ben Adida <ben@adida.net>
"""
from django.http import HttpResponseBadRequest, HttpResponse
from indivo.lib.view_decorators import ... | newmediamedicine/indivo_server_1_0 | indivo/views/reports/procedure.py | Python | gpl-3.0 | 2,013 | 0.007452 |
""" Management command to link program enrollments and external student_keys to an LMS user """
from uuid import UUID
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand, CommandError
from lms.djangoapps.program_enrollments.api import link_program_enrollments
User = g... | cpennington/edx-platform | lms/djangoapps/program_enrollments/management/commands/link_program_enrollments.py | Python | agpl-3.0 | 4,440 | 0.004054 |
from __future__ import absolute_import
from proteus import *
from proteus.default_n import *
try:
from .rdls_p import *
from .vortex2D import *
except:
from rdls_p import *
from vortex2D import *
timeIntegration = NoIntegration
stepController = Newton_controller
# About the nonlinear solver
multilevel... | erdc/proteus | proteus/tests/elliptic_redist/RDLS/rdls_n.py | Python | mit | 1,916 | 0.014614 |
#!/usr/bin/python
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
""" Module: itim
============
"""
from __future__ import print_function
from multiprocessing import Process, Queue
import numpy as np
try:
from __builtin__ import zi... | balazsfabian/pytim | pytim/itim.py | Python | gpl-3.0 | 16,238 | 0.000308 |
from kvmap.code.projections import *
from urllib2 import urlopen
from httplib import HTTPConnection
from threading import Thread
from kivy.logger import Logger
from kivy.loader import Loader
from os.path import join, dirname
import time, os
import hashlib
try:
from pyproj import Proj
from xml.etree import Element... | jchome/LocalGuide-Mobile | kvmap/overlays/WMSOverlayServer.py | Python | gpl-2.0 | 5,614 | 0.020485 |
dict([(k, chr(k + 65)) for k in range(10)]) | asedunov/intellij-community | python/testData/intentions/convertDictComp_after.py | Python | apache-2.0 | 43 | 0.023256 |
# -*- coding: utf-8 -*-
from .api_server import API
app = API()
| business-factory/captain-hook | hooks/app.py | Python | mit | 66 | 0 |
# Copyright 2017 Okia SPRL (https://okia.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import TransactionCase
from odoo.exceptions import ValidationError
class TestCreditControlPolicyLevel(TransactionCase):
post_install = True
at_install = False
def test_check... | ddico/account-financial-tools | account_credit_control/tests/test_res_partner.py | Python | agpl-3.0 | 1,262 | 0 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import psycopg2
from psycopg2.extras import Json
def con():
psycopg2.extensions.register_adapter(dict, Json)
psycopg2.extensions.register_adapter(list, Json)
conn = psycopg2.connect(dbname='cy', host='localhost', user='postgres', password='postgres')
... | g0v/sunshine.cy | parser/property/db_settings.py | Python | cc0-1.0 | 337 | 0.005935 |
import os
import urllib.request, urllib.error, urllib.parse
import shutil
import tempfile
import zipfile
import re
import logging
logger = logging.getLogger()
import xml.etree.cElementTree as ET
from util import stripInvalidXmlEntities
import awsSecrets
ICTRP_SECRETS = awsSecrets.getSecrets()
def nctList():
lo... | gertvv/ictrp-retrieval | listRecords.py | Python | mit | 3,167 | 0.007578 |
from __future__ import annotations
import contextlib
import os.path
import shutil
import sys
import pytest
from pre_commit import parse_shebang
from pre_commit.envcontext import envcontext
from pre_commit.envcontext import Var
from pre_commit.util import make_executable
def _echo_exe() -> str:
exe = shutil.whi... | pre-commit/pre-commit | tests/parse_shebang_test.py | Python | mit | 4,687 | 0 |
# -*- 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):
# Changing field 'FilterListItemCopy.date_created'
db.alter_column('api_... | haystack/eyebrowse-server | api/migrations/0003_auto__chg_field_filterlistitemcopy_date_created.py | Python | mit | 6,965 | 0.007466 |
from __future__ import absolute_import
import logging
try:
from redis import Redis
from rq import Queue
except ImportError:
Redis = None
Queue = None
from kaneda.exceptions import ImproperlyConfigured
from .base import BaseQueue
class RQQueue(BaseQueue):
"""
RQ queue
:param queue: que... | APSL/kaneda | kaneda/queues/rq.py | Python | mit | 1,504 | 0.003989 |
from .persistent_homology import PersistentHomology
__name__ = 'OpenTDA'
__version__ = 0.1
__all__ = ['PersistentHomology']
| outlace/OpenTDA | tda/__init__.py | Python | apache-2.0 | 126 | 0 |
import requests
def login(output_file):
r = requests.get('http://quickstart.cloudera:8888/accounts/login/?next=/')
tmp = r.text.split('csrfmiddlewaretoken')
tmp = tmp[1].split("value='")
tmp = tmp[1].split("'")
token = tmp[0]
cookie = r.cookies
data = {'username':'cloudera','password':'cloudera','csrfmiddlewa... | BRiDGEIris/cgs-apps | code/apps/variants/tests/local_login.py | Python | apache-2.0 | 561 | 0.046346 |
from datetime import datetime, timedelta
import logging
from urllib import urlencode
from django.http import Http404
from django.utils import html
from django.utils.safestring import mark_safe
import pytz
from corehq import Domain
from corehq.apps import reports
from corehq.apps.app_manager.models import get_app, Form,... | puttarajubr/commcare-hq | corehq/apps/reports/models.py | Python | bsd-3-clause | 31,850 | 0.001601 |
import sys
import subprocess
MODULES = [
"scipy.cluster",
"scipy.cluster.vq",
"scipy.cluster.hierarchy",
"scipy.constants",
"scipy.fft",
"scipy.fftpack",
"scipy.fftpack.convolve",
"scipy.integrate",
"scipy.interpolate",
"scipy.io",
"scipy.io.arff",
"scipy.io.harwell_boe... | WarrenWeckesser/scipy | scipy/_lib/tests/test_import_cycles.py | Python | bsd-3-clause | 1,306 | 0 |
"""setup.py"""
from setuptools import setup
with open("README.md") as readme_file:
README = readme_file.read()
test_requirements = ["mock", "pytest", "responses", "testfixtures", "requests", "pyzmq"]
# Async requirements
test_requirements.extend(["pytest-asyncio", "aiohttp", "tornado", "websockets"])
setup(
... | bcb/jsonrpcclient | setup.py | Python | mit | 1,595 | 0.001881 |
import webapp2, logging
from database import get_feed_source_by_name, store_feed_source, \
get_feed_source_by_url, change_feed_source_url
class AddHandler(webapp2.RequestHandler):
def post(self):
from database import FeedSource
name = self.request.get('name')
url = self.request.get('url')
frequency_... | phistuck/FrequentFeedScraper | add_handler.py | Python | mit | 1,694 | 0.020661 |
#!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2017 VoltDB Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitati... | deerwalk/voltdb | tests/sqlcoverage/schema/joined-matview-string-schema.py | Python | agpl-3.0 | 3,168 | 0 |
"""Configuration classes."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys
from . import types as t
from .util import (
find_python,
generate_pip_command,
ApplicationError,
)
from .util_common import (
docker_qualify_image,
get_docke... | azaghal/ansible | test/lib/ansible_test/_internal/config.py | Python | gpl-3.0 | 13,139 | 0.00274 |
# Copyright (C) Mesosphere, Inc. See LICENSE file for details.
"""MesosDNS mock endpoint"""
import copy
import logging
import re
from exceptions import EndpointException
from mocker.endpoints.recording import (
RecordingHTTPRequestHandler,
RecordingTcpIpEndpoint,
)
# pylint: disable=C0103
log = logging.getL... | asridharan/dcos | packages/adminrouter/extra/src/test-harness/modules/mocker/endpoints/mesos_dns.py | Python | apache-2.0 | 5,228 | 0.001148 |
# -*- coding: utf-8 -*-
import sys
import pytest
from textdata.eval import evaluation
_PY2 = sys.version_info[0] == 2
_PY26 = sys.version_info[:2] == (2, 6)
def test_evaluation_natural():
cases = [
(' 1 ', 1),
(' 1.1 \n ', 1.1),
(' gizmo \n\t \n', 'gizmo'),
]
if not _PY26:
... | jonathaneunice/textdata | test/test_eval.py | Python | apache-2.0 | 2,704 | 0.001109 |
#!/usr/bin/env python
#
# dfu.py: Access USB DFU class devices
# Copyright (C) 2009 Black Sphere Technologies
# Copyright (C) 2012 Transition Robotics Inc.
# Written by Gareth McMullin <gareth@blacksphere.co.nz>
# Modified by Piotr Esden-Tempski <piotr@esden.net>
#
# This program is free software: you can redistribut... | mmoiozo/mavcourse | sw/tools/dfu/dfu.py | Python | gpl-2.0 | 7,206 | 0.005551 |
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | danakj/chromium | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py | Python | bsd-3-clause | 4,329 | 0.003234 |
from django.contrib import admin
# Register your models here.
from .models import DbQuery, StarsFilter
admin.site.register(DbQuery)
admin.site.register(StarsFilter) | mavrix93/LightCurvesClassifier | lcc_web/web/interface/admin.py | Python | mit | 167 | 0.005988 |
from rest_framework import serializers
from drf_haystack.serializers import HaystackSerializerMixin
from .models import {{ cookiecutter.model_name }}
from .search_indexes import {{ cookiecutter.model_name }}Index
class {{ cookiecutter.model_name }}Serializer(serializers.ModelSerializer):
class Meta:
mod... | rickydunlop/cookiecutter-django-app-template-drf-haystack | {{cookiecutter.app_name}}/serializers.py | Python | mit | 771 | 0.022049 |
import socket
import asyncore
import pickle
from minissl.AbstractConnection import AbstractConnection
class PickleStreamWrapper(asyncore.dispatcher_with_send, AbstractConnection):
"""Buffers a stream until it contains valid data serialized by pickle.
That is a big of an ugly glue code I had to come up with i... | vsaw/miniSSL | minissl/TcpDispatcher.py | Python | mit | 3,729 | 0.001341 |
import hashlib
from vkAPI.mixins import *
from vkAPI.utils import *
class Session(object):
"""A Session object where you should put a default params which will always send"""
API_URL = 'https://api.vk.com/method/'
def __init__(self, access_token=None, secret=None):
"""
:except kwargs: su... | sakost/vkAPI | vkAPI/API.py | Python | apache-2.0 | 5,360 | 0.002425 |
# 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... | annarev/tensorflow | tensorflow/python/ops/math_ops.py | Python | apache-2.0 | 186,089 | 0.003353 |
# -*- coding: utf-8 -*-
from south.v2 import DataMigration
class Migration(DataMigration):
def forwards(self, orm):
orm.Boundary.objects.filter(category='Zip Code').update(sort_order=5)
def backwards(self, orm):
pass
models = {
u'auth.group': {
'Meta': {'object_name':... | johnsonc/OTM2 | opentreemap/treemap/migrations/0061_change_zip_code_sort_order.py | Python | gpl-3.0 | 20,859 | 0.008102 |
# 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... | scripnichenko/nova | nova/api/openstack/compute/legacy_v2/contrib/flavormanage.py | Python | apache-2.0 | 4,241 | 0.000472 |
import importlib
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from ckeditor_link import conf
from django import template
from django.template.defaultfilters import stringfilter
try:
module_name, class_name = conf.CKEDITOR_LINK_MODEL.rsplit(".", 1)
... | benzkji/django-ckeditor-link | ckeditor_link/templatetags/ckeditor_link_tags.py | Python | gpl-2.0 | 3,359 | 0.001191 |
#!/usr/bin/python
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
log = logging.getLogger('PersistenceEngine')
log.setLevel(logging.ERROR)
log.addHandler(NullHandler())
import time
import threading
import traceback
class PersistenceEngine(threading.Thread):
... | dustcloud/dustlink | DustLinkData/PersistenceEngine.py | Python | bsd-3-clause | 4,768 | 0.014681 |
#!/usr/bin/python
#
# Copyright (c) SAS Institute 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... | sassoftware/amiconfig | amiconfig_test/plugin_disablesshpasswdauth_test.py | Python | apache-2.0 | 1,526 | 0.001966 |
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
def printLegend(rowLabels,colLabels,params):
fig = plt.figure()
col_labels=colLabels
row_labels=rowLabels
table_vals=params
the_table = plt.table(cellText=table_vals,
colWidths = [0.2]*4,
rowLabels=row_labels,
colLabels=col_labels,... | ehudmagal/robotqcapp | Utils/RobotQAUtils/graphics/drawTable.py | Python | bsd-3-clause | 435 | 0.036782 |
# Copyright 2019 Red Hat, 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... | mahak/neutron | neutron/tests/unit/db/test_ovn_revision_numbers_db.py | Python | apache-2.0 | 12,345 | 0 |
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import os
import shutil
from collections import defaultdict
from cerbero.build import recipe
from cerbero.build.source import SourceType
from cerbero.build.cookbook import CookBook
from cerbero.config import Platform
from cerbero.enums import License
from c... | flexVDI/cerbero | recipes/custom.py | Python | lgpl-2.1 | 2,085 | 0.003357 |
from __future__ import absolute_import
# System modules
import argparse
import sys
import os
import textwrap
# LLDB modules
from . import configuration
def create_parser():
parser = argparse.ArgumentParser(
description='description',
prefix_chars='+-',
add_help=False)
group = None
... | google/llvm-propeller | lldb/packages/Python/lldbsuite/test/dotest_args.py | Python | apache-2.0 | 11,181 | 0.003935 |
from collections import Counter
from imblearn.datasets import make_imbalance
from imblearn.metrics import classification_report_imbalanced
from imblearn.pipeline import make_pipeline
from imblearn.under_sampling import ClusterCentroids
from imblearn.under_sampling import NearMiss
import matplotlib.pyplot as plt
from ... | shunw/pythonML_code | eg2_real_world_data.py | Python | mit | 4,961 | 0.01794 |
a, b = map(int,raw_input().split())
i=0
while(i<a):
j=0
c=[]
if(i%2==0):
while(j<b):
c.append('#')
j=j+1
print (''.join(c))
else:
k = int(i/2)
if (k%2==0):
while(j<(b-1)):
c.append(".")
j=j+1
c.append("#")
print (''.join(c))
else:
c.append('#')
while(j<(b-1)):
c.append("."... | Sarthak30/Codeforces | fox_and_snake.py | Python | gpl-2.0 | 361 | 0.113573 |
# table_plugin.py - sublime plugins for pretty print text table
# Copyright (C) 2012 Free Software Foundation, Inc.
# Author: Valery Kocubinsky
# Package: SublimeTableEditor
# Homepage: https://github.com/vkocubinsky/SublimeTableEditor
# This file is part of SublimeTableEditor.
# SublimeTableEditor is free softwar... | SublimeText-Markdown/TableEditor | table_plugin.py | Python | gpl-3.0 | 18,180 | 0.000935 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
### #FIXME admin.autodiscover()
import views as htcondor_views
#from ..api.htcondorapi import views as htcondorapi_views
urlpatterns = patterns('',
### H... | kiae-grid/panda-bigmon-core | core/htcondor/urls.py | Python | apache-2.0 | 526 | 0.013308 |
from __future__ import unicode_literals
from django.apps import AppConfig
class RegisterConfig(AppConfig):
name = 'register'
| nanomolina/JP | src/odontology/register/apps.py | Python | apache-2.0 | 132 | 0 |
"""API Handler Class"""
# standard library
import gzip
import os
import shutil
from logging.handlers import RotatingFileHandler
from typing import Optional
class RotatingFileHandlerCustom(RotatingFileHandler):
"""Logger handler for ThreatConnect Exchange File logging."""
def __init__(
self,
f... | kstilwell/tcex | tcex/logger/rotating_file_handler_custom.py | Python | apache-2.0 | 3,432 | 0.001166 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | petrus-v/server-tools | disable_openerp_online/__openerp__.py | Python | agpl-3.0 | 1,917 | 0 |
# -*- coding: utf-8 -*-
# wasp_general/network/web.py
#
# Copyright (C) 2016 the wasp-general authors and contributors
# <see AUTHORS file>
#
# This file is part of wasp-general.
#
# Wasp-general is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as pub... | a1ezzz/wasp-general | wasp_general/network/web/request.py | Python | lgpl-3.0 | 4,630 | 0.023542 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-11-12 18:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0005_auto_20161113_0317'),
]
operations = [
migrations.RenameField(... | sparcs-kaist/heartbeat-server | apps/core/migrations/0006_auto_20161113_0341.py | Python | mit | 645 | 0 |
# -*- coding: utf-8 -*-
# <markment - markdown-based documentation generator for python>
# Copyright (C) <2013> Gabriel Falcão <gabriel@nacaolivre.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 Fou... | grahamc/markment | tests/unit/test_html_rendering.py | Python | mit | 7,784 | 0.000257 |
# Copyright (C) 2013-2015 Computer Sciences 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 a... | b-long/ezbake-platform-services | efe/frontend_app/modules/ezRPStaticFileStore.py | Python | apache-2.0 | 9,011 | 0.003884 |
import re
from __future__ import print_function
HEADER_TEMPLATE=r"""/*
Copyright 2016, Austen Satterlee
This file is part of VOSIMProject.
VOSIMProject 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... | austensatterlee/VOSIMSynth | scripts/add_file.py | Python | gpl-3.0 | 5,486 | 0.006744 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
CERTitude: the seeker of IOC
Copyright (c) 2016 CERT-W
Contact: cert@wavestone.com
Contributors: @iansus, @nervous, @fschwebel
CERTitude is under licence GPL-2.0:
This program is free software; you can redistribute it and/or
modify it under... | CERT-W/certitude | components/interface/web.py | Python | gpl-2.0 | 40,631 | 0.003323 |
# -*- coding: utf-8 -*-
from django.core import urlresolvers
def custom_processor(request):
proc_data = dict()
resolver = urlresolvers.get_resolver(None)
patterns = sorted(
(key, val[0][0][0]) for key, val in resolver.reverse_dict.iteritems() if isinstance(key, basestring))
proc_data['pat'] ... | codeboy/coddy-sitetools | sitetools/coddy_site/procesors.py | Python | bsd-3-clause | 486 | 0.004115 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2016-12-06 09:04
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cms', '0016_auto_20160608_1535'),
('maps', '0002_au... | rouxcode/django-cms-plugins | cmsplugins/maps/migrations/0003_googlemap_cms_page.py | Python | mit | 601 | 0.001664 |
# 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... | nathanbjenx/cairis | cairis/test/test_UseCaseContribution.py | Python | apache-2.0 | 3,094 | 0.007434 |
# Copyright (C) 2008 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | Eforcers/inbox-cleaner | src/lib/gdata/apps/audit/service.py | Python | mit | 9,512 | 0.006308 |
# proxy module
from apptools.logger.util import *
| enthought/etsproxy | enthought/logger/util.py | Python | bsd-3-clause | 50 | 0 |
import game as game
import pytest
import sys
sys.path.insert(0, '..')
def trim_board(ascii_board):
return '\n'.join([i.strip() for i in ascii_board.splitlines()])
t = trim_board
def test_new_board():
game.Board(3,3).ascii() == t("""
...
...
...
""")
game.Board(4,3).ascii() == t("""
.... | fweidemann14/x-gewinnt | game/test_game.py | Python | gpl-3.0 | 3,095 | 0.008401 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-11 11:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('equinox_api', '0004_operation_description'),
]
operations = [
migrations.Add... | ivanprjcts/equinox-spring16-API | equinox_spring16_api/equinox_api/migrations/0005_application_new_att.py | Python | lgpl-3.0 | 463 | 0 |
#!/usr/bin/env python
"""Mixin tests for storing Foreman rules in the relational db."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from grr_response_core.lib import rdfvalue
from grr_response_server import foreman_rules
from grr.test_lib import test_l... | dunkhong/grr | grr/server/grr_response_server/databases/db_foreman_rules_test.py | Python | apache-2.0 | 2,967 | 0.005056 |
#0y0r1+syp0ry1+0267*y0r-7i+Psr+1ge
| fixbugs/py-fixbugs-tools | test/75f6.py | Python | gpl-3.0 | 37 | 0.027027 |
import json
import pprint
from a2qt import QtWidgets
from a2widget.key_value_table import KeyValueTable
from a2widget.a2text_field import A2CodeField
_DEMO_DATA = {
'Name': 'Some Body',
'Surname': 'Body',
'Street. Nr': 'Thingstreet 8',
'Street': 'Thingstreet',
'Nr': '8',
'PLZ': '12354',
... | ewerybody/a2 | ui/a2widget/demo/key_value_table_demo.py | Python | gpl-3.0 | 1,931 | 0 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^', include('authenticate.urls')),
(r'^', include('analytics.urls')),
(r'^admin/', include(admin.site.urls)),
(r'^api/', include('rest_framework.urls', namespace='res... | whitews/BAMA_Analytics | BAMA_Analytics/urls.py | Python | bsd-2-clause | 338 | 0.002959 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ignorance documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... | snark/ignorance | docs/conf.py | Python | isc | 8,405 | 0.005354 |
import csv
import json
import numpy as np
import pandas as pd
def read_delim(filepath):
"""
Reads delimited file (auto-detects delimiter + header). Returns list.
:param filepath: (str) location of delimited file
:return: (list) list of records w/o header
"""
f = open(filepath, 'r')
diale... | FordyceLab/AcqPack | acqpack/utils.py | Python | mit | 6,206 | 0.004351 |
import math
import random
import numpy as np
import IMP
import IMP.core
import IMP.test
def _get_beta(N, b):
return 3. / (2. * N * b**2)
def _get_score(z, N, b):
beta = _get_beta(N, b)
return beta * z**2 - math.log(2 * beta * z)
def _get_derv(z, N, b):
beta = _get_beta(N, b)
return 2 * beta *... | shanot/imp | modules/core/test/test_surface_tethered_chain.py | Python | gpl-3.0 | 3,454 | 0.00029 |
# coding: utf-8
"""
Salt Edge Account Information API
API Reference for services # noqa: E501
OpenAPI spec version: 5.0.0
Contact: support@saltedge.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class SimplifiedAttempt... | ltowarek/budget-supervisor | third_party/saltedge/swagger_client/models/simplified_attempt.py | Python | mit | 31,285 | 0.000064 |
"""make banner url longger
Revision ID: e567bd5c0b
Revises: 23ab90c01600
Create Date: 2015-02-01 13:15:59.075956
"""
# revision identifiers, used by Alembic.
revision = 'e567bd5c0b'
down_revision = '23ab90c01600'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.alter_column('banners', 'link_ur... | toway/towaymeetups | mba/alembic/versions/20150201_e567bd5c0b_make_banner_url_long.py | Python | gpl-3.0 | 479 | 0.004175 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.