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 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# vispy: gallery 2
# -----------------------------------------------------------------------------
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# ------------------------------------------------------------... | Eric89GXL/vispy | examples/basics/plotting/grid_x_y_viewbox.py | Python | bsd-3-clause | 1,194 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nicira Networks, 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.apac... | wallnerryan/quantum_migrate | quantum/tests/unit/test_l3_plugin.py | Python | apache-2.0 | 80,012 | 0.000087 |
from gevent.core import loop
count = 0
def incr():
global count
count += 1
loop = loop()
loop.run_callback(incr)
loop.run()
assert count == 1, count
| mgadi/naemonbox | sources/psdash/gevent-1.0.1/greentest/test__loop_callback.py | Python | gpl-2.0 | 161 | 0.006211 |
#!/usr/bin/env python
# Copyright 2021 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | googleapis/python-analytics-data | samples/snippets/run_report_with_property_quota.py | Python | apache-2.0 | 3,462 | 0.0026 |
__author__ = 'Xsank'
from handlers import IndexHandler
from handlers import WSHandler
handlers=[
(r"/",IndexHandler),
(r"/ws",WSHandler),
] | hanmichael/Pyrumpetroll | urls.py | Python | mit | 153 | 0.026144 |
# -*- coding: utf-8 -*-
'''
Nose wrapper that runs the test files using robot and then compare the
screenshots using perceptualdiff.
'''
import glob
import os
import subprocess
import string
import sys
import unittest
from robot.running.builder import TestSuiteBuilder
class TestRobotS2LScreenshot(unittest.TestCase)... | canaryhealth/RobotS2LScreenshot | test/test_robots2lscreenshot.py | Python | mit | 1,787 | 0.007834 |
# -*- coding: utf-8 -*-
import pytest
from cfme.configure import about
from utils import version
@pytest.mark.tier(3)
@pytest.mark.sauce
def test_version():
"""Check version presented in UI against version retrieved directly from the machine.
Version retrieved from appliance is in this format: 1.2.3.4
V... | dajohnso/cfme_tests | cfme/tests/configure/test_version.py | Python | gpl-2.0 | 641 | 0.00312 |
# -*- coding: utf-8 -*-
import os, io
from setuptools import setup
from SVNOnline.SVNOnline import __version__
here = os.path.abspath(os.path.dirname(__file__))
README = io.open(os.path.join(here, 'README.rst'), encoding='UTF-8').read()
CHANGES = io.open(os.path.join(here, 'CHANGES.rst'), encoding='UTF-8').read()
setu... | sintrb/SVNOnline | setup.py | Python | apache-2.0 | 1,012 | 0.000988 |
#!/usr/bin/env python
import sys
def parse_map_file(path):
map_grid = []
# Create a two-dimensional list based on the input data
with open(path, 'r') as f:
width, height = map(int, f.readline().split())
for line in f:
row = map(int, line.split())
map_grid.append(row... | baudm/sg-ski | sg-ski.py | Python | mit | 3,012 | 0.002988 |
#
# The Python Imaging Library
# $Id: ImagePath.py,v 1.2 2007/06/17 14:12:15 robertoconnor Exp $
#
# path interface
#
# History:
# 1996-11-04 fl Created
# 2002-04-14 fl Added documentation stub class
#
# Copyright (c) Secret Labs AB 1997.
# Copyright (c) Fredrik Lundh 1996.
#
# See the README file for ... | arpruss/plucker | plucker_desktop/installer/osx/application_bundle_files/Resources/parser/python/vm/PIL/ImagePath.py | Python | gpl-2.0 | 1,472 | 0.000679 |
from itertools import chain
import jellyfish # type: ignore
import pytest # type: ignore
import pytz
import us
# attribute
def test_attribute():
for state in us.STATES_AND_TERRITORIES:
assert state == getattr(us.states, state.abbr)
def test_valid_timezones():
for state in us.STATES_AND_TERRITO... | unitedstates/python-us | us/tests/test_us.py | Python | bsd-3-clause | 3,729 | 0.000268 |
import unittest
import os
import sys
import shutil
import string
from optparse import OptionParser
import ConfigParser
import logging
sys.dont_write_bytecode = True
sys.path.insert(0, os.path.abspath(".."))
sys.path.insert(0, os.path.abspath(os.path.join("..", "coshsh")))
import coshsh
from coshsh.generator import G... | lausser/coshsh | tests/test_logging.py | Python | agpl-3.0 | 4,032 | 0.010665 |
# jhbuild - a tool to ease building collections of source packages
# Copyright (C) 2001-2006 James Henstridge
# Copyright (C) 2008 Frederic Peters
#
# bot.py: buildbot control commands
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... | bboozzoo/jhbuild | jhbuild/commands/bot.py | Python | gpl-2.0 | 37,964 | 0.003293 |
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import Permission, Group
from rest_framework import serializers
from .models import User, Company
# Django models
class ContentTypeSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = ContentType... | sharestack/sharestack-api | sharestackapi/members/serializers.py | Python | mit | 1,298 | 0 |
import models
from django.contrib import admin
class ThumbnailInline(admin.StackedInline):
model = models.Thumbnail
fk_name = 'video'
extra = 0
class VideoAdmin(admin.ModelAdmin):
readonly_fields = ('video_id', 'youtube_url', 'swf_url',)
inlines = [ThumbnailInline]
list_filter = ('title', 'u... | laplacesdemon/django-youtube | django_youtube/admin.py | Python | bsd-3-clause | 684 | 0 |
"""Utility functions"""
import os
import difflib
def get_diff(str1, str2):
"""Returns git-diff-like diff between two strings"""
expected = str1.splitlines(1)
actual = str2.splitlines(1)
diff = difflib.unified_diff(expected, actual, lineterm=-0, n=0)
return ''.join(diff)
def ensure_directory(path)... | perfalle/smartbox | common/utils.py | Python | gpl-3.0 | 1,360 | 0.005147 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | QISKit/qiskit-sdk-py | qiskit/visualization/interactive/iplot_cities.py | Python | apache-2.0 | 3,026 | 0.00033 |
# DOENDO - A Python-Based Fortran Refactoring Tool
# Copyright (C) 2011 Felipe H. da Jornada <jornada@civet.berkeley.edu>
import re
import xml.dom.minidom
import analyze
import common
def rename(lines, doc, ren_dict, block=None):
'''
Rename a variable in a particular block
lines: line-oriented buffer to be al... | jornada/DOENDO | rename.py | Python | gpl-3.0 | 2,180 | 0.037156 |
# EF-SMT solver implementation
#
# This example shows:
# 1. How to combine 2 different solvers
# 2. How to extract information from a model
#
from pysmt.shortcuts import Solver, get_model
from pysmt.shortcuts import Symbol, Bool, Real, Implies, And, Not, Equals
from pysmt.shortcuts import GT, LT, LE, Minus, Times
fro... | idkwim/pysmt | examples/efsmt.py | Python | apache-2.0 | 2,475 | 0.00202 |
class Animal(object):
def __init__(self, name): # Constructor of the class
self.name = name
def talk(self): # Abstract method, defined by convention only
raise NotImplementedError("Subclass must implement abstract method")
class Cat(Animal):
def talk(self):
return self.meo... | mcdickenson/python-washu-2014 | day2/polymorphism.py | Python | mit | 771 | 0.035019 |
# 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... | tillahoffmann/tensorflow | tensorflow/python/framework/constant_op.py | Python | apache-2.0 | 9,632 | 0.007164 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | eunchong/build | third_party/buildbot_8_4p1/buildbot/schedulers/filter.py | Python | bsd-3-clause | 851 | 0.001175 |
import os
from werkzeug.utils import secure_filename
from flask import url_for
from .utils import convert_to_snake_case
from . import AbstractStorage, StorageExists, StorageNotExists, StorageNotAllowed
class LocalStorage(AbstractStorage):
def __init__(self, app):
super(LocalStorage, self).__init__(app)
... | Speedy1991/Flask-FileUpload | flask_fileupload/storage/storage.py | Python | mit | 1,614 | 0.003098 |
import numpy as np
import pickle
import glob
from matplotlib import rc
from lamost import load_spectra, load_labels
from TheCannon import continuum_normalization
from TheCannon import dataset
from TheCannon import model
rc('text', usetex=True)
rc('font', family='serif')
with np.load("test_data_raw.npz") as data:
... | annayqho/TheCannon | code/lamost/xcalib_5labels/cont_norm_test_obj.py | Python | mit | 747 | 0.005355 |
"""Utilities to help convert mp4s to fmp4s."""
import io
def find_box(segment: io.BytesIO, target_type: bytes, box_start: int = 0) -> int:
"""Find location of first box (or sub_box if box_start provided) of given type."""
if box_start == 0:
box_end = segment.seek(0, io.SEEK_END)
segment.seek(0... | tboyce021/home-assistant | homeassistant/components/stream/fmp4utils.py | Python | apache-2.0 | 5,317 | 0.001128 |
EQUALS = 'equals'
GT = 'gt'
LT = 'lt'
IN = 'in'
OPERATOR_SEPARATOR = '__'
REVERSE_ORDER = '-'
ALL_OPERATORS = {EQUALS: 1, GT: 1, LT: 1, IN: 1}
def split_to_field_and_filter_type(filter_name):
filter_split = filter_name.split(OPERATOR_SEPARATOR)
filter_type = filter_split[-1] if len(filter_split) > 0 else N... | Aplopio/rip | rip/filter_operators.py | Python | mit | 831 | 0.001203 |
# Giles: tanbo.py
# Copyright 2012 Phil Bordelon
#
# This program 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 later version.
# This progra... | sunfall/giles | giles/games/tanbo/tanbo.py | Python | agpl-3.0 | 15,089 | 0.00106 |
#!/usr/bin/env python
#
# Copyright (c) 2013 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.
"""Provisions Android devices with settings required for bots.
Usage:
./provision_devices.py [-d <device serial number>]
"""
... | benschmaus/catapult | devil/devil/android/tools/provision_devices.py | Python | bsd-3-clause | 23,798 | 0.00832 |
# coding=utf-8
# Author: Mr_Orange <mr_orange@hotmail.it>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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 versi... | Thraxis/pymedusa | sickbeard/clients/deluge_client.py | Python | gpl-3.0 | 9,733 | 0.001952 |
# -*- coding: utf-8 -*-
from datetime import date
from django import forms
from django.forms.util import ErrorList
from openedx.core.djangoapps.ga_operation.ga_operation_base_form import (GaOperationEmailField,
FIELD_NOT_INPUT, INVALID_EMAIL)
... | nttks/edx-platform | lms/djangoapps/ga_operation/forms/search_by_email_and_period_date_form.py | Python | agpl-3.0 | 1,730 | 0.001877 |
from dipy.align.transforms import regtransforms, Transform
import numpy as np
from numpy.testing import (assert_array_equal,
assert_array_almost_equal,
assert_almost_equal,
assert_equal,
assert_raises)
def test... | FrancoisRheaultUS/dipy | dipy/align/tests/test_transforms.py | Python | bsd-3-clause | 8,834 | 0 |
N = 46340
table = list(range(N))
for i in range(2,int(N**0.5)+1):
if table[i]:
for mult in range(i**2,N,i):
table[mult] = False
primetable= [p for p in table if p][1:]
p=0
a=196
if a<0:
p=1
a*=-1
b=''
while True:
if a in primetable:
b+=str(a)
break
for i in primetable:
if a % i ==0... | ytlai4851/Uva | Python/Q538.py | Python | gpl-2.0 | 392 | 0.076531 |
import datetime
import json
import mock
from socorro.cron.crontabber_app import CronTabberApp
from socorro.lib.datetimeutil import utc_now
from socorro.unittest.cron.jobs.base import IntegrationTestBase
from socorro.external.postgresql.dbapi2_util import (
execute_no_results,
execute_query_fetchall,
)
class... | Tayamarn/socorro | socorro/unittest/cron/jobs/test_featured_versions_automatic.py | Python | mpl-2.0 | 9,704 | 0.000309 |
"""Angles and anomalies.
"""
from astropy import units as u
from poliastro.core.angles import (
D_to_M as D_to_M_fast,
D_to_nu as D_to_nu_fast,
E_to_M as E_to_M_fast,
E_to_nu as E_to_nu_fast,
F_to_M as F_to_M_fast,
F_to_nu as F_to_nu_fast,
M_to_D as M_to_D_fast,
M_to_E as M_to_E_fast,
... | poliastro/poliastro | src/poliastro/twobody/angles.py | Python | mit | 6,419 | 0.000156 |
import pytest
from six.moves.urllib.parse import quote
from ...api import MissingEntry
from .base import BaseTestFormgrade
from .manager import HubAuthNotebookServerUserManager
@pytest.mark.formgrader
@pytest.mark.usefixtures("all_formgraders")
class TestGradebook(BaseTestFormgrade):
def _click_element(self, n... | EdwardJKim/nbgrader | nbgrader/tests/formgrader/test_gradebook_navigation.py | Python | bsd-3-clause | 12,452 | 0.004096 |
#!/usr/bin/python
#
# Copyright (C) 2020 abetusk
#
# This program 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 later version.
#
# This pro... | abetusk/dev | projects/pcbcnc/src/cnc3018pro.py | Python | agpl-3.0 | 8,180 | 0.025672 |
# how many routes are in a 20x20 lattice grid?
import time
start_time = time.clock()
field = []
sum = 0
for n in range(0,21):
field.append([1])
for i in range(1,21):
sum = field[n][i-1]
if n>0: sum += field[n-1][i]
field[n].append(sum)
print(field[20][20])
print("--- %s seconds ---" %... | Selen93/ProjectEuler | Python/Problem 15/Problem 15.py | Python | mit | 349 | 0.014327 |
#!/usr/bin/env python
# coding: utf-8
# Copyright 2014 The Crashpad 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/LICEN... | atom/crashpad | util/net/http_transport_test_server.py | Python | apache-2.0 | 6,017 | 0.010316 |
import datetime
import os
import re
class WLError(Exception):
"""Base class for all Writelightly exceptions."""
class WLQuit(WLError):
"""Raised when user sends a quit command."""
def lastday(*args):
"""Return the last day of the given month.
Takes datetime.date or year and month, returns an integer... | thesealion/writelightly | writelightly/utils.py | Python | mit | 3,963 | 0.005551 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2015, Thomas Scholtes.
#
# 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 limitation ... | kelvinhammond/beets | test/test_keyfinder.py | Python | mit | 2,610 | 0.000383 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the VSS path specification implementation."""
import unittest
from dfvfs.path import vshadow_path_spec
from tests.path import test_lib
class VShadowPathSpecTest(test_lib.PathSpecTestCase):
"""Tests for the VSS path specification implementation."""
def tes... | dc3-plaso/dfvfs | tests/path/vshadow_path_spec.py | Python | apache-2.0 | 2,586 | 0.00232 |
# -*- coding: utf-8 -*-
__author__ = 'chinfeng'
__gum__ = 'web_console'
from .server import WebConsoleServer | chinfeng/gumpy | plugins/web_console/__init__.py | Python | lgpl-3.0 | 110 | 0.009091 |
# Copyright 2019 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/clusterfuzz | src/clusterfuzz/_internal/tests/appengine/libs/crash_access_test.py | Python | apache-2.0 | 4,900 | 0.002653 |
"""
This page is in the table of contents.
The xml.py script is an import translator plugin to get a carving from an Art of Illusion xml file.
An import plugin is a script in the interpret_plugins folder which has the function getCarving. It is meant to be run from the interpret tool. To ensure that the plugin works... | natetrue/ReplicatorG | skein_engines/skeinforge-35/fabmetheus_utilities/geometry/solids/cube.py | Python | gpl-2.0 | 3,514 | 0.016221 |
"""
pybufrkit.mdquery
~~~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import
from __future__ import print_function
import logging
from pybufrkit.errors import MetadataExprParsingError
__all__ = ['MetadataExprParser', 'MetadataQuerent', 'METADATA_QUERY_INDICATOR_CHAR']
log = logging.getLogger(__file__)
METADA... | ywangd/pybufrkit | pybufrkit/mdquery.py | Python | mit | 1,958 | 0.003064 |
from main import KeyboardHandler
import threading
import thread
import pyatspi
def parse(s):
"""parse a string like control+f into (modifier, key).
Unknown modifiers will return ValueError."""
m = 0
lst = s.split('+')
if not len(lst):
return (0, s)
# Are these right?
d = {
"shif... | Oliver2213/Queriet | queriet/keyboard_handler/linux.py | Python | gpl-2.0 | 2,059 | 0.000486 |
# 1222, Fri 18 Dec 2015 (NZDT)
#
# build-cpldns.py: makes pypy cpldns module
#
# Copyright (C) 2016 by Nevil Brownlee, U Auckland | WAND
#
# 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... | nevil-brownlee/pypy-libtrace | lib/pldns/build-cpldns.py | Python | gpl-3.0 | 3,848 | 0.001559 |
from maya import OpenMaya
__all__ = [
"getSoftSelection"
]
def getSoftSelection():
"""
Query the soft selection in the scene. If no soft selection is made empty
lists will be returned. The active selection will be returned for easy
reselection. The data structure of the soft selection weight is ... | robertjoosten/rjSkinningTools | scripts/skinningTools/utils/api/selection.py | Python | gpl-3.0 | 1,916 | 0.000522 |
#!/usr/bin/python
#
# Config file test app (together with test.cfg file)
#
import os, sys
sys.path.append("..")
import configfile
cfg = configfile.ConfigFile("test.cfg")
cfg.setCfgValue("name1", "value1")
cfg.setCfgValue("name2", "value2")
cfg.selectSection("user")
cfg.setCfgValue("username", "janis")
cfg.setCfgV... | IECS/MansOS | tools/lib/tests/configtest.py | Python | mit | 1,154 | 0.001733 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, Polygon
from matplotlib import rc
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
from matplo... | atakan/Complex_Coeff_RKN | testing/timing_runs/400body_CPUtime_plot.py | Python | gpl-3.0 | 3,030 | 0.023432 |
"""
CLI management script. (Requires flask-script.)
"""
import os
# pylint: disable=no-name-in-module,import-error
from flask.ext.script import Manager
from flask.ext.migrate import MigrateCommand, Migrate
from componentsdb.app import default_app
from componentsdb.model import db
# Default to development environmen... | rjw57/componentsdb | manage.py | Python | mit | 717 | 0.001395 |
# 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/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_assignments_operations.py | Python | mit | 38,695 | 0.004032 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub. actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | Jorge-Rodriguez/ansible | lib/ansible/modules/windows/win_find.py | Python | gpl-3.0 | 9,583 | 0.002087 |
# A revised version of CPython's turtle module written for Brython
#
# Note: This version is not intended to be used in interactive mode,
# nor use help() to look up methods/functions definitions. The docstrings
# have thus been shortened considerably as compared with the CPython's version.
#
# All public methods/fu... | jonathanverner/brython | www/src/Lib/turtle.py | Python | bsd-3-clause | 53,120 | 0.004085 |
#!/usr/bin/env python2
"""
:Synopsis: Specialized Class for installing essential components.
:Install-logs: All logs are saved in the directory **hackademic-logs**.
"""
import os
import sys
import subprocess
from logging_manager import LoggingManager
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(_... | a0xnirudh/hackademic | ContainerManager/install.py | Python | gpl-3.0 | 4,749 | 0.000421 |
# Copyright 2013 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 telemetry import test
from telemetry.page import page
from telemetry.page import page_set
from telemetry.page import page_test
# pylint: disable=W0401,W0... | TeamEOS/external_chromium_org | content/test/gpu/gpu_tests/webgl_robustness.py | Python | bsd-3-clause | 2,603 | 0.002305 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014, 2015 CERN.
#
# INSPIRE 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... | jalavik/inspire-next | inspire/modules/harvester/definitions.py | Python | gpl-2.0 | 1,759 | 0 |
# Nix
# Copyright (c) 2017 Mark Biciunas.
#
# 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 distrib... | mbiciunas/nix | src/utility/nix_error.py | Python | gpl-3.0 | 1,070 | 0.001869 |
import json
import unittest
from io import BytesIO
import yaml
from django.http import HttpRequest
from django.test import RequestFactory, SimpleTestCase
from django.utils.encoding import force_bytes
from .duf_test_case import DUFTestCase
from django_url_framework.decorators import auto, json_action, yaml_action
from... | zeraien/django-url-framework | tests/test_controller_action_renderers.py | Python | mit | 11,896 | 0.010592 |
#encoding: utf-8
from responsemodule import IModule
import urllib
import httplib2
import socket
import xmltodict
import re
'''
Example config
[walpha]
app_id=1LALAL-2LALA3LAL4
timeout=6
'''
settings_name_g = u'walpha'
api_key_g = u'app_id'
timeout_g = u'timeout'
class Wolfram(IModule):
def __init__(self):
... | undu/query-bot | wolfram/wolfram.py | Python | mpl-2.0 | 4,435 | 0.006764 |
from collections import namedtuple
knapsack_item = namedtuple("knapsack_item", ["weight", "value"])
max_weight = 15
items = [
knapsack_item(weight=2, value=2),
knapsack_item(weight=1, value=2),
knapsack_item(weight=12, value=4),
knapsack_item(weight=1, value=1),
knapsack_item(weight=4, value=10),... | orion-42/numerics-physics-stuff | knapsack.py | Python | mit | 1,976 | 0.004049 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import unsmuggle_url
class JWPlatformIE(InfoExtractor):
_VALID_URL = r'(?:https?://(?:content\.jwplatform|cdn\.jwplayer)\.com/(?:(?:feed|player|thumb|preview)s|jw6|v2/media)/|jwplatform:)(?P<id>[a-zA... | spvkgn/youtube-dl | youtube_dl/extractor/jwplatform.py | Python | unlicense | 1,720 | 0.002326 |
# 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... | drpngx/tensorflow | tensorflow/contrib/opt/python/training/multitask_optimizer_wrapper_test.py | Python | apache-2.0 | 5,436 | 0.011038 |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import pyro.distributions.torch_patch # noqa F403
from pyro.distributions.torch import * # noqa F403
# isort: split
from pyro.distributions.affine_beta import AffineBeta
from pyro.distributions.asymmetriclaplace import (
As... | uber/pyro | pyro/distributions/__init__.py | Python | apache-2.0 | 5,185 | 0.000193 |
"""packet.py: Raw packet object."""
import logging
import struct
from codecs import encode
from moteconnection.connection import Dispatcher
log = logging.getLogger(__name__)
__author__ = "Raido Pahtma"
__license__ = "MIT"
class Packet(object):
def __init__(self, dispatch=0):
self._dispatch = dispatc... | proactivity-lab/python-moteconnection | moteconnection/packet.py | Python | mit | 1,781 | 0.001684 |
# -*- coding: utf-8 -*-
'''
The function cache system allows for data to be stored on the master so it can be easily read by other minions
'''
# Import python libs
import copy
import logging
# Import salt libs
import salt.crypt
import salt.payload
log = logging.getLogger(__name__)
def _auth():
'''
Return ... | victorywang80/Maintenance | saltstack/src/salt/modules/mine.py | Python | apache-2.0 | 6,869 | 0.000291 |
from unittest import TestCase
class TestLoadUser(TestCase):
def test_find_user(self):
from backend import load_user
user = load_user('Neill', 'password')
self.assertIsNotNone(user)
self.assertEqual(user.password, "Password")
user = load_user("Tony")
self.assertIsN... | neillc/memberdb-ng | backend/tests/test_load_user.py | Python | gpl-2.0 | 330 | 0 |
from django.conf.urls import patterns, url
from polls import views
urlpatterns = patterns('',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
url(r'^(?P<pk>\d+)/results/$', views.ResultsView.as_view(), name='results'),
url(r'^(?P<... | kwailamchan/programming-languages | python/django/polls/pollsite/polls/urls.py | Python | mit | 374 | 0.005348 |
from .ascendinggaugedstrategy import AscendingGaugedStrategy
from .gauge import AverageItemSize
class MinAverageItemSize(AscendingGaugedStrategy):
def _gauge(self, item):
return AverageItemSize(item)
| vialette/binreconfiguration | binreconfiguration/strategy/minaverageitemsize.py | Python | mit | 205 | 0.014634 |
"""
Backfill opportunity ids for Enterprise Coupons, Enterprise Offers and Manual Order Offers.
"""
import csv
import logging
from collections import Counter, defaultdict
from time import sleep
from uuid import UUID
from django.core.management import BaseCommand
from ecommerce.core.constants import COUPON_PRODUCT_C... | edx/ecommerce | ecommerce/enterprise/management/commands/backfill_opportunity_ids.py | Python | agpl-3.0 | 9,523 | 0.00231 |
#!/usr/bin/env python
#
###########################
# Sysusage info:
# 1) memory/swap usage
# 2) disk usage
# 3) load avarage
###########################
import re
import os
class MemoryUsage:
"""MEMORY USAGE STATISTICS:
memused - Total size of used memory in kilobytes.
memfree - T... | dorzheh/sysstat | SysUsage.py | Python | mit | 5,469 | 0.017188 |
# Unit tests for the boundary shape class and the boundary sphere class.
import unittest
import numpy as N
from tracer.spatial_geometry import generate_transform, rotx
from tracer.boundary_shape import *
class TestInBounds(unittest.TestCase):
def setUp(self):
self.points = N.array([
[0.,0.,0.... | yosefm/tracer | tests/test_boundary_surface.py | Python | gpl-3.0 | 4,024 | 0.012177 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, MySQLdb, csv
table_sql = """drop table if exists hotel;
create table hotel(
id int primary key,
Name varchar(255),
CardNo varchar(255),
Descriot varchar(255),
CtfTp varchar(255),
CtfId varchar(255),
Gender varchar(255),
Birthday v... | aaronzhang1990/workshare | test/python/restore_hotel_2000w_data.py | Python | gpl-2.0 | 2,060 | 0.004369 |
"""umongo fields"""
import collections
import datetime as dt
from bson import DBRef, ObjectId, Decimal128
import marshmallow as ma
# from .registerer import retrieve_document
from .document import DocumentImplementation
from .exceptions import NotRegisteredDocumentError, DocumentDefinitionError
from .template import ... | Scille/umongo | umongo/fields.py | Python | mit | 19,389 | 0.001238 |
import pygame
from pygame.locals import *
from math import sin
import states
class EndEvent(object):
text = [
"Ah, hello there. Welcome to the center of the moon!",
"Oh, me? I'm just the man in the moon. I live here.",
"Don't act so shocked! It's rude you know.",
"I don't g... | Cynerva/jttcotm | end.py | Python | bsd-3-clause | 3,326 | 0.001503 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This file is part of the prometeo project.
This program 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
option... | zuck/prometeo-erp | core/registration/models.py | Python | lgpl-3.0 | 1,316 | 0.003799 |
from data_importers.ems_importers import BaseHalaroseCsvImporter
FAL_ADMINAREAS = (
"Bo'ness",
"Bonnybridge",
"Denny",
"Falkirk Ward 1",
"Falkirk Ward 2",
"Falkirk Ward 3",
"Falkirk Ward 4",
"Falkirk Ward 5",
"Falkirk Ward 6",
"Falkirk Ward 7",
"Falkirk Ward 8",
"Falkirk... | DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_importers/management/commands/import_falkirk.py | Python | bsd-3-clause | 1,748 | 0.001144 |
# 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... | Huyuwei/tvm | vta/tests/python/integration/test_benchmark_topi_conv2d.py | Python | apache-2.0 | 10,351 | 0.003188 |
import sys
import os
import getpass
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS
from django.core import exceptions
from django.utils.text import capfirst
from django.utils.encoding import force_str
from django.contrib.auth.password_validation import validate... | lafranceinsoumise/api-django | agir/people/management/commands/createsuperperson.py | Python | agpl-3.0 | 6,404 | 0.001093 |
from SimpleCV.Tracking.TrackClass import Track, CAMShiftTrack, SURFTrack, LKTrack, MFTrack
from SimpleCV.Tracking.CAMShiftTracker import camshiftTracker
from SimpleCV.Tracking.LKTracker import lkTracker
from SimpleCV.Tracking.SURFTracker import surfTracker
from SimpleCV.Tracking.MFTracker import mfTracker
from SimpleCV... | tpltnt/SimpleCV | SimpleCV/Tracking/__init__.py | Python | bsd-3-clause | 355 | 0.002817 |
import chardet
from vint.ast.node_type import NodeType
from vint.ast.traversing import traverse, SKIP_CHILDREN
from vint.linting.level import Level
from vint.linting.lint_target import AbstractLintTarget
from vint.linting.policy.abstract_policy import AbstractPolicy
from vint.linting.policy_registry import register_po... | Kuniwak/vint | vint/linting/policy/prohibit_missing_scriptencoding.py | Python | mit | 1,557 | 0.001927 |
import inspect
import sys
import pytest
from numpy.core import arange
from numpy.testing import assert_, assert_equal, assert_raises_regex
from numpy.lib import deprecate
import numpy.lib.utils as utils
from io import StringIO
@pytest.mark.skipif(sys.flags.optimize == 2, reason="Python running -OO")
def test_lookfo... | abalkin/numpy | numpy/lib/tests/test_utils.py | Python | bsd-3-clause | 3,769 | 0.001061 |
import morepath
from more.jinja2 import Jinja2App
class App(Jinja2App):
pass
@App.path(path='')
class Root(object):
pass
@App.view(model=Root)
def hello_world(self, request):
return "Hello world!"
@App.html(template='base.html')
def main(request):
return {'name': 'matt'}
if __name__ == '__main... | makaimc/pycontacts | morepath_jinja_sqlalchemy/app.py | Python | mit | 417 | 0 |
'''
Created by auto_sdk on 2015.09.17
'''
from top.api.base import RestApi
class AreasGetRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.fields = None
def getapiname(self):
return 'taobao.areas.get'
| colaftc/webtool | top/api/rest/AreasGetRequest.py | Python | mit | 285 | 0.031579 |
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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.... | edespino/gpdb | src/test/tinc/tincrepo/mpp/models/regress/mpp_tc/regress_mpp_test_case.py | Python | apache-2.0 | 6,282 | 0.004935 |
import unittest
from src.Analyzer import plot_word_embeddings
from src.Labels import Labels
class AnalyzerTests(unittest.TestCase):
def test_plot_word_embeddings(self):
plot_word_embeddings("Doc2Vec", "Test", "Objective", "Subjective", [[-3.99940408, -1.43488923],[ 3.51106635, -2.01347499], [-1.14695001... | xyryx/SentimentAnalysis | tests/AnalyzerTests.py | Python | mit | 425 | 0.009412 |
#!/usr/bin/env python
#
# Freesound is (c) MUSIC TECHNOLOGY GROUP, UNIVERSITAT POMPEU FABRA
#
# Freesound 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 ... | MTG/pycompmusic | compmusic/extractors/imagelib/wav2png.py | Python | agpl-3.0 | 3,050 | 0.005246 |
import pytest
import numpy as np
import matplotlib.pyplot as plt
from neupy import plots
from base import BaseTestCase
class HintonDiagramTestCase(BaseTestCase):
single_thread = True
@pytest.mark.mpl_image_compare
def test_simple_hinton(self):
fig = plt.figure()
ax = fig.add_subplot(1, ... | itdxer/neupy | tests/plots/test_hinton.py | Python | mit | 1,732 | 0 |
#!/usr/bin/env python
# Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... | MTG/essentia | test/src/unittests/rhythm/test_superfluxextractor.py | Python | agpl-3.0 | 4,892 | 0.00879 |
# -*- coding: UTF-8 -*-
"""
Desc: django util.
Note:
---------------------------------------
# 2016/04/30 kangtian created
"""
from hashlib import md5
def gen_md5(content_str):
m = md5()
m.update(content_str)
return m.hexdigest()
| tiankangkan/paper_plane | k_util/hash_util.py | Python | gpl-3.0 | 257 | 0 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
from front.views import *
from front.views import views as front_views
from django.views.decorators.csrf import csrf_exempt
if not settings.DEBUG:
s = {'SSL': settings.ENABL... | Solanar/CMPUT410-Project | DisSoNet/DisSoNet/urls.py | Python | apache-2.0 | 2,954 | 0.003385 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from funcy import partial
from canopen_301_402.constants import *
from canopen_301_402.async.async_chain import AsyncChain
from canopen_301_402.async.sdo_write_object import SdoWriteObject
from canopen_301_402.can402.ops.notify_new_target import NotifyNewTarget
import s... | xaedes/canopen_301_402 | src/canopen_301_402/can402/ops/set_target.py | Python | mit | 1,247 | 0.022454 |
"""
This module contains tools used to get data using tourinsoft's API.
Request outputs JSON which is converted to a dictionary.
"""
import requests
URL = 'http://wcf.tourinsoft.com/Syndication/3.0/cdt72/'
EVENT_URL = 'e9a8e2bf-c933-4831-9ebb-87eec559a21a/'
PLACES_URL = '969e24f9-75a2-4cc6-a46c-db1f6ebbfe97/'
# sh... | Aluriak/24hducode2016 | src/source_tourinsoft/request_data.py | Python | unlicense | 2,237 | 0.000447 |
#!/usr/bin/env ../../jazzshell
"""
Supplies a set of admin operations for trained models.
============================== License ========================================
Copyright (C) 2008, 2010-12 University of Edinburgh, Mark Granroth-Wilding
This file is part of The Jazz Parser.
The Jazz Parser is free softw... | markgw/jazzparser | bin/models/chordlabel/admin.py | Python | gpl-3.0 | 5,587 | 0.00698 |
print("Salutations, Universe!")
| KuttKatrea/sublime-toolrunner | test/print.py | Python | mit | 32 | 0 |
class Solution:
def moveZeroes(nums):
j=1
for i in range(len(nums)-1):
if nums[i] == 0:
while j < len(nums):
if nums[j] == 0:
j+=1
else:
#swap
nums[i], nums[j]... | shobhitmishra/CodingProblems | LeetCode/Session3/testMoveZero.py | Python | mit | 422 | 0.021327 |
# Generated by Django 1.11.2 on 2017-08-08 03:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("institutions", "0010_auto_20170808_0252")]
operations = []
| watchdogpolska/feder | feder/institutions/migrations/0011_auto_20170808_0308.py | Python | mit | 211 | 0 |
#
import os
import unittest
class TestBase(unittest.TestCase):
@classmethod
def datafilename(cls, name):
fname = os.path.join(
os.path.dirname(__file__),
"data",
name,
)
assert os.path.exists(fname)
return fname
| deets/pyCamBam | tests/base.py | Python | gpl-2.0 | 295 | 0.00678 |
import wash
class Site(wash.Site):
def __init__(self, *args, **kwargs):
super(Site, self).__init__(*args, **kwargs)
self.court_id = self.__module__
self.courtLevel = 'C'
self.pubStatus = 'PUB'
self._set_parameters()
def _get_case_names(self):
path = "{base}/td[... | Andr3iC/juriscraper | opinions/united_states/state/washctapp_p.py | Python | bsd-2-clause | 397 | 0 |
#!/usr/bin/python3
# This code is available for use under CC0 (Creative Commons 0 - universal).
# You can copy, modify, distribute and perform the work, even for commercial
# purposes, all without asking permission. For more information, see LICENSE.md or
# https://creativecommons.org/publicdomain/zero/1.0/
# usage:
... | MSchuwalow/StudDP | studdp/picker.py | Python | mit | 5,867 | 0.002045 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.