code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
"""Mock UI tests."""
def test_something_ui():
pass
| not-raspberry/pytest_reorder | tests/sample_test_suites/nested/app_1/tests/ui/test_some_ui.py | Python | mit | 57 |
from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.sqlite3.introspection import (
DatabaseIntrospection, FlexibleFieldLookupDict,
)
from django.utils import six
class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict):
"""
Sublcass that includes updates the `base_data_types_reverse` ... | aisipos/django | django/contrib/gis/db/backends/spatialite/introspection.py | Python | bsd-3-clause | 3,027 |
# GNU Enterprise Forms - GF Object Hierarchy - Box
#
# Copyright 2001-2007 Free Software Foundation
#
# This file is part of GNU Enterprise
#
# GNU Enterprise 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; ei... | HarmonyEnterpriseSolutions/harmony-platform | src/gnue/forms/GFObjects/GFVBox.py | Python | gpl-2.0 | 1,438 |
from unittest import TestCase
import deepchem as dc
import numpy as np
from deepchem.data import NumpyDataset
from deepchem.data.datasets import Databag
from deepchem.models.tensorgraph.layers import Dense, ReduceMean, SoftMax, SoftMaxCrossEntropy
from deepchem.models.tensorgraph.layers import Feature, Label, Reshape
... | ktaneishi/deepchem | deepchem/utils/test/test_generator_evaluator.py | Python | mit | 5,930 |
#!/usr/bin/env python
# Copyright 2017 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 ... | googleapis/python-bigquery-datatransfer | samples/snippets/quickstart.py | Python | apache-2.0 | 1,759 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-10-06 16:11
from __future__ import unicode_literals
from django.db import migrations
import share.robot
class Migration(migrations.Migration):
dependencies = [
('share', '0001_initial'),
('djcelery', '0001_initial'),
]
operatio... | zamattiac/SHARE | providers/edu/ucf/migrations/0001_initial.py | Python | apache-2.0 | 646 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from .scene import SceneManager | jsa4000/OpenGL-Python | zero/system/geometry/__init__.py | Python | apache-2.0 | 121 |
#!/usr/bin/env python
# Author: Marcos Almeida Jr
#
# This file is part of Sick Beard.
#
# Sick Beard 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... | VeNoMouS/Sick-Beard | autoProcessTV/utorrentToSickBeard.py | Python | gpl-3.0 | 4,105 |
import colorsys
def scale_rgb_tuple(rgb, down=True):
if not down:
return tuple([int(c*255) for c in rgb])
return tuple([round(float(c)/255, 2) for c in rgb])
def hex_to_rgb(hex_str):
if hex_str.startswith('#'):
hex_str = hex_str[1:]
return tuple([int(hex_str[i:i + 2], 16) for i in xr... | ldmoray/KivyMeep | webcolors.py | Python | mit | 610 |
# Generated by Django 3.0.7 on 2020-08-03 08:42
from django.db import migrations, models
import weblate.utils.validators
class Migration(migrations.Migration):
dependencies = [
("trans", "0093_auto_20200730_1432"),
]
operations = [
migrations.AddField(
model_name="project",... | nijel/weblate | weblate/trans/migrations/0094_project_language_aliases.py | Python | gpl-3.0 | 752 |
"""Support for sending data to Emoncms."""
import logging
from datetime import timedelta
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (
CONF_API_KEY,
CONF_WHITELIST,
CONF_URL,
STATE_UNKNOWN,
STATE_UNAVAILABLE,
CON... | fbradyirl/home-assistant | homeassistant/components/emoncms_history/__init__.py | Python | apache-2.0 | 2,980 |
# coding=utf-8
import logging, commands, os, pexpect, sys, time
from app.modules.common.pipelines import *
from app.modules.common.tasks import *
from app.modules.common.errors import *
from app.modules.common.utils import *
from pexpect import *
log = logging.getLogger(__name__)
class ImportOraclePipeLine(Pipelin... | ssls/beetle-agent | app/modules/database/pipelines_oracle.py | Python | mit | 21,156 |
import _plotly_utils.basevalidators
class AlignValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="align", parent_name="sankey.node.hoverlabel", **kwargs
):
super(AlignValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | plotly/python-api | packages/python/plotly/plotly/validators/sankey/node/hoverlabel/_align.py | Python | mit | 588 |
from django.contrib import admin
from .models import Member, Rol, Theatre, Genre, Play, Image
admin.site.register(Member)
admin.site.register(Rol)
admin.site.register(Theatre)
admin.site.register(Genre)
admin.site.register(Play)
admin.site.register(Image)
| nicolas471/consultorio | web/admin.py | Python | gpl-3.0 | 257 |
# Copyright 2020 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Flags: -expose-wasm --wasm-gdb-remote --wasm-pause-waiting-for-debugger test/debugging/wasm/gdb-server/test_files/test_memory.js
import struct
import sy... | youtube/cobalt | third_party/v8/test/debugging/wasm/gdb-server/memory.py | Python | bsd-3-clause | 3,599 |
# bigbob2b.py
# Case Study 2 - multiple robots (method 2)
import math, sys, os
sys.path.append('/usr/local/lib/python2.7/site-packages/')
from playercpp import *
# Make proxies for Client, Sonar, Position2d
robot = PlayerClient("localhost",6665);
sp = RangerProxy(robot,0);
lp = RangerProxy(robot,1);
pp = Position2dP... | lsa-pucrs/Player-Stage-Manual | code/Ch8.6/bigbob2b.py | Python | gpl-3.0 | 2,088 |
import ocl
import camvtk
import time
import vtk
import datetime
import math
if __name__ == "__main__":
p = ocl.Epos()
print("initial Epos() is ",p, "with dia=",p.d)
for n in range(0,30):
print(p.d," : ",p)
p.d = p.d - 0.25
p.setD()
raw_input("Press Enter ... | aewallin/opencamlib | examples/python/offset-ellipse/epos_test.py | Python | lgpl-2.1 | 336 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Author: Norin (copied it)
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 versio... | Norin-Radd/plugin.video.pitchfork | resources/lib/directory.py | Python | gpl-2.0 | 2,439 |
import sys
import math
import random
import os
import wx
import wx.grid
from layout import CircleLayout
import justify
from renderer import WxLayoutRenderer
from tree_editor import TreeEditor
import tree_editor
import tree
VERSION = '0.1'
PROPERTIES=['hue', 'layout']
class EditNodeDialog(wx.Dialog):
de... | ejrh/snowflake | main.py | Python | gpl-2.0 | 21,164 |
##
# Copyright 2009-2017 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | ULHPC/easybuild-easyblocks | easybuild/easyblocks/p/python_meep.py | Python | gpl-2.0 | 5,553 |
from flask import request, jsonify
from mysite import app, wclient
from mysite.models import Status
from mysite.weibo import Client
# from mysite.models import weibo
from . import weibo
@weibo.route("/read_status_list")
def read_status_list():
status_list = wclient.get('statuses/mentions/ids')
return jsonify(status_... | liyigerry/caixiang | mysite/views/weibo/read_status_list.py | Python | mit | 325 |
import os
import subprocess
from plank import task, depends
@task
def unit_tests():
# Run tests in subprocess since we've imported some of the code we are testing
# and coverage will not accurately reflect the lines we test
exit_status = subprocess.check_call(['py.test', '--cov', 'plank', '--cov-report='... | atbentley/plank | planks.py | Python | mit | 1,270 |
# (C) British Crown Copyright 2010 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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) any l... | jkettleb/iris | lib/iris/tests/test_pp_to_cube.py | Python | lgpl-3.0 | 9,321 |
# -*- coding: utf-8 -*-
"""
TabbedCode specs
=================
"""
import os
from docutils.parsers.rst import Directive
from docutils import nodes
from sphinx.util.osutil import copyfile
CSS_FILE = 'tabbedcode.css'
JS_FILE = 'tabbedcode.js'
class TabbedCodeDirective(Directive):
"""
This directive is intended ... | ianclegg/eventuate | src/sphinx/_ext/tabbedcode.py | Python | apache-2.0 | 1,718 |
#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['deformable_ompl'],
package_dir={'': 'src'}
)
setup(**d)
| WPI-ARC/deformable_planners | deformable_ompl/setup.py | Python | bsd-2-clause | 224 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | vsajip/babel3 | babel/messages/tests/pofile.py | Python | bsd-3-clause | 19,864 |
# -*- coding: utf-8 -*-
# setup.py
#
# Copyright (C) 2009-2010 Damien Churchill <damoxc@gmail.com>
#
# 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, or (at your option)
# any l... | damoxc/fbuploader | setup.py | Python | gpl-3.0 | 1,250 |
"""
Helper functions for creating Form classes from Django models
and database field objects.
"""
from __future__ import unicode_literals
from collections import OrderedDict
from itertools import chain
import warnings
from django.core.exceptions import (
ImproperlyConfigured, ValidationError, NON_FIELD_ERRORS, F... | runekaagaard/django-contrib-locking | django/forms/models.py | Python | bsd-3-clause | 54,740 |
#!/usr/bin/env python3
import sys, json
def crawl(obj):
if isinstance(obj, int) or isinstance(obj, float):
return obj
sum = 0
if isinstance(obj, list):
for a in obj:
sum += crawl(a)
if isinstance(obj, dict):
for a in obj.values():
sum += crawl(a)
re... | msullivan/advent-of-code | 2015/A12a.py | Python | mit | 504 |
# Copyright (c) 2019 Sebastian Wojciechowski.
#
# This file is part of Bodhi.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later v... | Conan-Kudo/bodhi | bodhi/server/migrations/versions/f8a44498c806_remove_legacy_old_updateid.py | Python | gpl-2.0 | 1,353 |
# -*- coding: utf-8 -*-
# Copyright 2016 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class HrEmployee(models.Model):
_inherit = 'hr.employee'
employee_number = fields.Char(copy=False)
@api.model
def c... | VitalPet/addons-onestein | hr_employee_number/models/hr_employee.py | Python | agpl-3.0 | 1,051 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
import lxml.etree
from turbogears.database import session
from bkr.ser... | jtoppins/beaker | IntegrationTests/src/bkr/inttest/server/test_tasks.py | Python | gpl-2.0 | 1,769 |
__source__ = 'https://leetcode.com/problems/min-stack/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/min-stack.py
# Time: O(n)
# Space: O(1)
# Stack
#
# Description: Leetcode # 155. Min Stack
#
# Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
#
# push(x) ... | JulyKikuAkita/PythonPrac | cs15211/MinStack.py | Python | apache-2.0 | 4,930 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | benoitsteiner/tensorflow-xsmm | tensorflow/python/ops/linalg/linear_operator_full_matrix.py | Python | apache-2.0 | 6,537 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
AutoincrementalField.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******************... | dracos/QGIS | python/plugins/processing/algs/qgis/AutoincrementalField.py | Python | gpl-2.0 | 2,809 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'GameTree.views.home', name='home'),
# url(r'^GameTree/', include('GameTree.foo.urls')),
... | yeaske/GameTree | GameTree/urls.py | Python | apache-2.0 | 562 |
from django.conf.urls import url
from fundraiser_app import views
urlpatterns = [
url(r'^$', views.FMItemListView.as_view(), name='fmitem_list'),
url(r'^about/$', views.AboutView.as_view(), name='about'),
url(r'^fmitem/(?P<pk>\d+)$', views.FMItemDetailView.as_view(), name='fmitem_detail'),
url(r'^fmite... | CarlGraff/fundraisermemorial | fundraiser_app/urls.py | Python | mit | 663 |
from OpenGLCffi.GL import params
@params(api='gl', prms=['location', 'x'])
def glUniform1i64NV(location, x):
pass
@params(api='gl', prms=['location', 'x', 'y'])
def glUniform2i64NV(location, x, y):
pass
@params(api='gl', prms=['location', 'x', 'y', 'z'])
def glUniform3i64NV(location, x, y, z):
pass
@params(api... | cydenix/OpenGLCffi | OpenGLCffi/GL/EXT/AMD/gpu_shader_int64.py | Python | mit | 3,996 |
#!/usr/bin/env python
import json
import os
import stat
from Pegasus.DAX3 import ADAG, Job, File, Link
class DockerApp(object):
def __init__(self, appfile, map, transfer=False):
self.data = json.load(open(appfile))
self.map = map
self.transfer = transfer
if not os.path.exists("wrappers"):
os.mkdir("wrapp... | boutiques/schema | tools/pegasus/dockerapp.py | Python | gpl-2.0 | 2,102 |
import lxml.html
from .bills import NHBillScraper
from .legislators import NHLegislatorScraper
from .committees import NHCommitteeScraper
metadata = {
'abbreviation': 'nh',
'name': 'New Hampshire',
'capitol_timezone': 'America/New_York',
'legislature_name': 'New Hampshire General Court',
'legislatu... | cliftonmcintosh/openstates | openstates/nh/__init__.py | Python | gpl-3.0 | 3,210 |
#!/usr/bin/env python
###############################################################################
# #
# stackedBarGraph.py - code for creating purdy stacked bar graphs #
# ... | lionelBytes/CSERF | stacked_bar_graph.py | Python | gpl-2.0 | 12,103 |
#!/usr/bin/python
# Copyright (c) 2012 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.
import android_commands
import constants
import logging
import os
import run_tests_helper
import subprocess
import time
class FakeDns... | paul99/clank | build/android/fake_dns.py | Python | bsd-3-clause | 2,149 |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
# 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):
# Adding... | thiagof/treeio | treeio/messaging/south_migrations/0001_initial.py | Python | mit | 16,396 |
# 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... | hfp/tensorflow-xsmm | tensorflow/python/layers/normalization.py | Python | apache-2.0 | 15,335 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Anscombe'] , ['LinearTrend'] , ['Seasonal_MonthOfYear'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Anscombe/model_control_one_enabled_Anscombe_LinearTrend_Seasonal_MonthOfYear_SVR.py | Python | bsd-3-clause | 164 |
import string
t = string.Template('$var')
print(t.pattern.pattern)
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_text/string_template_defaultpattern.py | Python | apache-2.0 | 69 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 17 11:08:30 2014
@author: Fabrizio Coccetti (fabrizio.coccetti@centrofermi.it) [www.fc8.net]
Query Run Db and extract Transfer and DQM data
"""
import os
import MySQLdb
from datetime import datetime
import ConfigParser
import pickle
import logging
i... | centrofermi/e3monitor | apps/e3db.py | Python | gpl-3.0 | 5,727 |
#!/usr/bin/python
"""
Start IPython cluster.
"""
import sys, logging, os
from optparse import OptionParser
from ConfigParser import SafeConfigParser as ConfigParser
from lofarpipe.support.clusterhandler import ClusterHandler
parser = OptionParser()
parser.add_option(
"--config", help="Pipeline configuration file... | jjdmol/LOFAR | CEP/Pipeline/deploy/deprecated/start_cluster.py | Python | gpl-3.0 | 938 |
# Code copied from http://djangosnippets.org/snippets/19/
# License information from http://djangosnippets.org/about/tos/ :
# I hate legal-speak as much as anybody, but on a site which is geared
# toward sharing code there has to be at least a little bit of it, so
# here goes:
#
# By creating an account here you agre... | RobFisher/mailshare | mailshareapp/plaintext.py | Python | bsd-3-clause | 2,330 |
#!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... | fedaykinofdune/octocoin | contrib/pyminer/pyminer.py | Python | mit | 6,435 |
import StringIO
import re
import codecs
import inspect
import os
import traceback
from collections import defaultdict
from jinja2 import Environment
from jinja2 import FileSystemLoader
from nose.exc import SkipTest
from nose.plugins import Plugin
import sys
from datetime import datetime
__version__ = '0.1.0'
TEST_ID ... | telefonicaid/nose-html-reporting | src/nose_html_reporting/__init__.py | Python | bsd-2-clause | 8,592 |
# Copyright (c) 2013 VMware, 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... | cloudbase/cinder | cinder/volume/drivers/vmware/volumeops.py | Python | apache-2.0 | 70,976 |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from indico.core import signals
from indico.util.decorators import classproperty
from indico.util.signals ... | indico/indico | indico/util/rules.py | Python | mit | 4,314 |
from scipy.linalg import eigh
from numpy.linalg import matrix_rank
from numpy import dot,conj,amax,argmin,zeros,eye,append,shape,diag,ones
from matplotlib.mlab import find
import copy
import warnings
import code
def argsort(seq):
return sorted(range(len(seq)),key=seq.__getitem__)
def bunch(instat,Nsamp,indices=Fa... | bdallapi/gpvmc | tools/vmc_legacy_utils/vmc_utils.py | Python | mit | 2,702 |
import citySimulator as cs
commercialComp = {'commercial':7, 'nonCommercial':1, 'industrial': 1}
nonCommercialComp = {'nonCommercial':8, 'commercial':1}
industrialComp = {'nonCommercial':1, 'industrial':8}
commercial = cs.regionType('commercial', '#ff0000', commercialComp)
nonCommercial = cs.regionType('nonCom... | ranjeethmahankali/CitySimulator | fractalConcept/testCitySimpleLines.py | Python | apache-2.0 | 1,395 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Nicira, 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/lic... | wallnerryan/quantum_migrate | quantum/plugins/nicira/nicira_nvp_plugin/common/metadata_access.py | Python | apache-2.0 | 7,472 |
#!/usr/bin/env python3
# Copyright (c) 2017-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test that we don't leak txs to inbound peers that we haven't yet announced to"""
from test_framework.m... | midnightmagic/bitcoin | test/functional/p2p_leak_tx.py | Python | mit | 2,153 |
#!/usr/bin/env python3
#
# Copyright 2016 Sarah Sharp <sharp@otter.technology>
#
# 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 ... | sarahsharp/foss-heartbeat | ghscraper.py | Python | gpl-3.0 | 12,052 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Pierre Haessig — March 2014
"""
Qt adaptation of Gael Varoquaux's tutorial to integrate Matplotlib
http://docs.enthought.com/traitsui/tutorials/traits_ui_scientific_app.html#extending-traitsui-adding-a-matplotlib-figure-to-our-application
based on Qt-based code shared by Did... | marshallmcdonnell/interactive_plotting | TraitsUI/matplotlib/traitsui_mpl_qt_test.py | Python | mit | 2,981 |
__version__ = "1.0b2.dev11"
| pyohio/symposion | symposion/__init__.py | Python | bsd-3-clause | 28 |
import django
from django.db import models
from django.db.models.sql.query import LOOKUP_SEP
from django.db.models.deletion import Collector
from django.db.models.fields.related import ManyToOneRel
from django.contrib.auth import get_permission_codename
from django.forms.forms import pretty_name
from django.utils impor... | iedparis8/django-xadmin | util.py | Python | bsd-3-clause | 19,511 |
```
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Integers in each row are sorted from left to right.
The first integer of each row is greater than the last integer of the previous row.
For example,
Consider the following matrix:
[
[1, 3, 5,... | UmassJin/Leetcode | Array/Search_in_2D_matrix.py | Python | mit | 999 |
from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt
from PyQt5.QtWidgets import QDialog
from urh.ui.ui_advanced_modulation_settings import Ui_DialogAdvancedModSettings
class AdvancedModulationOptionsController(QDialog):
pause_threshold_edited = pyqtSignal(int)
message_length_divisor_edited = pyqtSignal(int)
... | splotz90/urh | src/urh/controller/AdvancedModulationOptionsController.py | Python | gpl-3.0 | 1,420 |
# 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... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/python/ops/tensor_array_grad.py | Python | bsd-2-clause | 9,083 |
from numpy import array, arctan2, arcsin
from bullet.bullet import Vector3, Quaternion, Transform
from cycgkit.cgtypes import quat, mat4, vec3
radian = 0.0174532925
FOVconst = 57.295780490442972
defaultMass = 1.0
defaultGravity = 9.8
class eVec3(vec3):
def __init__(self, *args):
super(eVec3, self).__ini... | jr-garcia/Engendro3D | e3d/commonValues.py | Python | mit | 3,654 |
import sys, serial
import HotRod
def processCmdline(args):
i = 0
flags = []
files = []
port = ''
while i < len(args):
if args[i][0] == '-':
if args[i][1] == 'p':
i += 1
port = args[i]
else:
flags.append(args[i])
... | fizzymagic/HotRod | SetupHotRod/SetupHotRod.py | Python | gpl-3.0 | 2,773 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import sys
from setuptools import setup, find_packages
PACKAGE_NAME = 'mozrunner'
PACKAGE_VERSION = '6.12'
desc = """R... | cstipkovic/spidermonkey-research | testing/mozbase/mozrunner/setup.py | Python | mpl-2.0 | 1,848 |
from django.conf import settings
from django.core.paginator import Paginator, EmptyPage
def paginate(request, items, per_page=settings.DEFAULT_PER_PAGE,
page_key='page'):
paginator = Paginator(items, per_page)
try:
page_number = int(request.GET[page_key])
page = paginator.page(pa... | frague59/wagtailpolls | wagtailpolls/pagination.py | Python | bsd-3-clause | 438 |
import plotly.tools as tls
import pandas as pd
from sqlalchemy import create_engine # database connection
import datetime as dt
from IPython.display import display
import plotly.plotly as py # interactive graphing
import plotly.graph_objs as go
from plotly.graph_objs import Bar, Scatter, Marker, Layout, Histogram, Box... | bottydim/detect-credit-card-fraud | ccfd_dnn/db_export.py | Python | mit | 6,348 |
#!/usr/bin/python
# Copyright (c) 2013 The Bitsend Core developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import json
from urllib import urlopen
import requests
import getpass
from string import Template
import sys
i... | JohnMnemonick/UralsCoin | qa/pull-tester/pull-tester.py | Python | mit | 8,944 |
try:
import winsound
except ImportError:
pass
import sys
import threading
def play(wav_file):
sound_thread = SoundThread(wav_file)
sound_thread.start()
class SoundThread(threading.Thread):
def __init__(self, wav_file):
threading.Thread.__init__(self)
self.wav_file = wav_file
... | RainDogSoftware/pingpung | pingpung/pplib/audio.py | Python | gpl-2.0 | 674 |
# -*- coding: utf-8 -*-
"""
remotely
~~~~~~~~
:copyright: (c) 2012 by Kefei Dan Zhou
:license: ISC, see LICENSE for more details.
"""
__title__ = 'remotely'
__version__ = '0.2.0'
__author__ = 'Kefei Dan Zhou'
__copyright__ = 'Copyright 2012 Kefei Dan Zhou'
from .remotely import remotely
from .remotely import Remo... | dzhou/remotely | remotely/__init__.py | Python | bsd-3-clause | 428 |
# -*- coding: utf-8 -*
from __future__ import absolute_import, unicode_literals
import base64
import collections
import json
import unittest
import warnings
from datetime import date, datetime
from decimal import Decimal
# non-standard import name for ugettext_lazy, to prevent strings from being picked up for transla... | Toshakins/wagtail | wagtail/wagtailcore/tests/test_blocks.py | Python | bsd-3-clause | 106,304 |
import shapefile, sys
import Image, ImageDraw
import argparse
def longest_len(list):
return len(max(list, key=len))
def clear_file():
with open(args['output'] + '.txt', 'w') as text_file:
text_file.write('')
def print_or_fout(str):
if args['output'] != False:
with open(args['output'] + '.txt', 'a') as ... | mfurlend/shp2png | shp2png.py | Python | apache-2.0 | 6,022 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'The NBDiff Team'
__email__ = 'tavisharmstrong@gmail.com'
__version__ = '1.0.4'
| tarmstrong/nbdiff | nbdiff/__init__.py | Python | mit | 140 |
#!/usr/bin/env python
# encoding: utf-8
"""
@version: python.3.6
@author: zhangjiaheng
@software: PyCharm
@time: 2017/9/19 14:17
"""
import unittest,sys
from test_case.page_obj import login_page
from models import myunit,function
from time import sleep
class TestLogin(myunit.MyTest):
'''登录'''
def test_login(... | 18701016443/mayi | mayi/test_case/test_login.py | Python | mit | 829 |
from .. import Provider as InternetProvider
class Provider(InternetProvider):
user_name_formats = (
'{{last_name}}.{{first_name_female}}',
'{{last_name}}.{{first_name_male}}',
'{{first_name_female}}.{{last_name}}',
'{{first_name_male}}.{{last_name}}',
'{{first_name}}##',
... | danhuss/faker | faker/providers/internet/sl_SI/__init__.py | Python | mit | 983 |
'''
New Integration Test for enabled nested virt
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
def test():
host = test_lib.lib_get_all_hosts_from_plan()[0]
cmd = 'cat /sys/module/kvm_intel/parameters/nested'
cmd_out = t... | zstackorg/zstack-woodpecker | integrationtest/vm/basic/test_nested_virt.py | Python | apache-2.0 | 985 |
# -*- coding: 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):
# Adding field 'TagValue.data'
db.add_column('sentry_filtervalue', 'data',
self.gf('dj... | beni55/sentry | src/sentry/migrations/0096_auto__add_field_tagvalue_data.py | Python | bsd-3-clause | 28,624 |
from __future__ import absolute_import
__all__ = ['ProviderManager']
from freight.exceptions import InvalidProvider
class ProviderManager(object):
def __init__(self):
self.providers = {}
def add(self, name, cls):
self.providers[name] = cls
def get(self, name, **kwargs):
try:
... | klynton/freight | freight/providers/manager.py | Python | apache-2.0 | 451 |
import json
def getName(self):
return "JSON"
def getDescription(self):
return "Pretty print a JSON string"
def convert(self, stringToConvert):
textJ = json.loads(unicode(str(stringToConvert), errors='replace'))
output = str(json.dumps(textJ, indent=4))
return output
| mcancellieri/server-swiss-army-knife | py/src/plugins/JSON.py | Python | gpl-2.0 | 290 |
#!/usr/bin/python
import unittest
import time
from throttle import throttle
class TestThrottle(unittest.TestCase):
@throttle(1)
def increment(self):
""" Simple function that
increments a counter when
called, used to test the
debounce function decorator """
... | AdoHaha/jourapp | helperpython/test_throttle.py | Python | mit | 1,354 |
# 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/resources/v2018_05_01/operations/_providers_operations.py | Python | mit | 16,244 |
# -*- coding: utf-8 -*-
"""
This example demonstrates the SpinBox widget, which is an extension of
QDoubleSpinBox providing some advanced features:
* SI-prefixed units
* Non-linear stepping modes
* Bounded/unbounded values
"""
import initExample ## Add path to library (just for examples; you do not need this)
... | UpSea/thirdParty | pyqtgraph-0.9.10/examples/SpinBox.py | Python | mit | 4,046 |
# -*- coding: utf-8 -*-
# Copyright 2016-2021 The pyXem developers
#
# This file is part of pyXem.
#
# pyXem 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 optio... | pycrystem/pycrystem | pyxem/generators/integration_generator.py | Python | gpl-3.0 | 11,204 |
default_app_config = 'ofahrtbase.apps.OfahrtbaseConfig'
| d120/pyofahrt | ofahrtbase/__init__.py | Python | agpl-3.0 | 56 |
"""
WSGI config for mclarkpw project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
import sys
# Activate your virtual env
activate_env="/var/envs/mclarkpw/bin/activate_... | m-clark/mclarkpw | mclarkpw/mclarkpw/production.wsgi.py | Python | mit | 551 |
# -*- coding: utf-8; mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; truncate-lines: 0 -*-
# vi: set fileencoding=utf-8 filetype=python expandtab tabstop=4 shiftwidth=4 softtabstop=4 cindent:
# :mode=python:indentSize=4:tabSize=4:noTabs=true:
#-----------------------------------------------------... | luksan/kodos | modules/flags.py | Python | gpl-2.0 | 1,969 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2010, 2011, 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, or (at your optio... | chokribr/invenio | invenio/legacy/batchuploader/cli.py | Python | gpl-2.0 | 6,648 |
# -*- coding: utf-8 -*-
import datetime
import os
import numpy as np
import pandas as pd
from decouple import config
from WindAdapter.enums import Header
from WindAdapter.enums import OutputFormat
DATA_DICT_PATH = config('DATA_DICT_PATH', default='data_dict.csv')
DATA_DICT_PATH_TYPE_ABS = config('DATA_DICT_PATH_TYP... | iLampard/WindAdapter | WindAdapter/helper.py | Python | mit | 4,406 |
__author__ = 'fgarcia'
| candango/socialspider | diasporapy/engine/components/__init__.py | Python | apache-2.0 | 23 |
"""This script evaluates scipy's implementation of hyp2f1 against mpmath's.
Author: Albert Steppi
This script is long running and generates a large output file. With default
arguments, the generated file is roughly 700MB in size and it takes around
40 minutes using an Intel(R) Core(TM) i5-8250U CPU with n_jobs set to... | grlee77/scipy | scipy/special/_precompute/hyp2f1_data.py | Python | bsd-3-clause | 12,050 |
from astropy.io import fits
import numpy as np
from desitarget import desi_mask
tt = fits.getdata('targets-dr2-0.2.2.fits')
bgs = np.where( (tt.DESI_TARGET & desi_mask.BGS_ANY) != 0 )[0]
url = "http://legacysurvey.org/viewer/?ra={ra}&dec={dec}&zoom=15&layer=decals-dr2p"
for i in bgs[0:100]:
print url.format(ra=tt... | moustakas/moustakas-projects | legacysurvey/decals_cutouts.py | Python | gpl-2.0 | 505 |
# Django settings for tango_with_django_project project.
import os
PROJECT_PATH = os.getcwd()
TEMPLATE_PATH = os.path.join(PROJECT_PATH, 'templates')
STATIC_PATH = os.path.join(PROJECT_PATH, 'static')
DATABASE_PATH = os.path.join(PROJECT_PATH, 'rango.db')
#MEDIA_URL = '/media/' #code shouldn't be here!!!
#MEDIA_RO... | Kentoseth/rangoapp | tango_with_django_project/tango_with_django_project/settings.py | Python | mit | 6,169 |
from pythonforandroid.toolchain import PythonRecipe, shprint
import sh
class FlaskRecipe(PythonRecipe):
version = '0.10.1' # The webserver of 'master' seems to fail
# after a little while on Android, so use
# 0.10.1 at least for now
url = 'https://github.com/p... | inclement/python-for-android | pythonforandroid/recipes/flask/__init__.py | Python | mit | 606 |
from celery.task import Task
from celery.registry import tasks
from django.conf import settings
from django.core.management.base import NoArgsCommand
from mailer.engine import send_all
from mailer.models import Message
PAUSE_SEND = getattr(settings, "MAILER_PAUSE_SEND", False)
class RetryDeferred(Task):
name = ... | code06/django-mailer | mailer/tasks.py | Python | mit | 843 |
# check flag example
class GetFlag():
DEBUG = False
def recv_until_colon(self, s):
ret = ""
while True:
data = s.recv(1)
if len(data) == 0:
raise Exception("Socket is broken. socket.recv() returns empty string.")
ret += data
if r... | diegorusso/ictf-framework | services/driller/scripts/getflag.py | Python | gpl-2.0 | 5,169 |
# 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 law or agreed to in... | yeming233/rally | tests/unit/common/db/test_sqlalchemy/test_api.py | Python | apache-2.0 | 2,631 |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
import ez_setup
ez_setup.use_setuptools()
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from ... | hishnash/inspyred | setup.py | Python | mit | 4,344 |
class TransformCSV:
def __init__(self):
pass
def process(self, data):
self.data = data
newdata = []
count = 0
for row in data:
if count == 0:
count = count + 1
else:
x = {'ORDER_ID': row[0], 'ORDER_LINE_ID': row[1... | ThomasSt0rm/etl-python | transformer/transformer.py | Python | apache-2.0 | 886 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.