text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from abc import ABCMeta, abstractmethod, abstractproperty
from ruleset import Ruleset
from device import Device
from propagation_model import PropagationModel
from region import Region
from boundary import Boundary
from data_map import DataMap2D, DataMap3D, DataMap2DWithFixedBoundingBox
from population import Populatio... | kate-harrison/west | west/data_management.py | Python | gpl-2.0 | 23,067 | 0.00065 |
import unittest
import ray
from ray.rllib.agents.pg import PGTrainer, DEFAULT_CONFIG
from ray.rllib.utils.test_utils import framework_iterator
class LocalModeTest(unittest.TestCase):
def setUp(self) -> None:
ray.init(local_mode=True)
def tearDown(self) -> None:
ray.shutdown()
def test_l... | richardliaw/ray | rllib/tests/test_local.py | Python | apache-2.0 | 696 | 0 |
"""
The wrapper for Postgres through SQLAchemy
__author__ = "Alex Xiao <http://www.alexxiao.me/>"
__date__ = "2018-11-03"
__version__ = "0.1"
Version:
0.1 (03/11/2018 AX) : init
"""
from urllib.parse import quote_plus
from sqlalchemy import create_engine, text
import pandas
from ax.log import ge... | axxiao/toby | ax/wrapper/sqlalchemy.py | Python | mit | 1,716 | 0.004662 |
#!/usr/bin/env python
'''
BlueBanana Rat Config Decoder
'''
__description__ = 'BlueBanana Rat Config Extractor'
__author__ = 'Kevin Breen http://techanarchy.net http://malwareconfig.com'
__version__ = '0.1'
__date__ = '2014/04/10'
#Standard Imports Go Here
import os
import sys
import string
from zipfile import ZipFi... | 1ookup/RATDecoders | BlueBanana.py | Python | gpl-2.0 | 3,304 | 0.030266 |
#!/usr/bin/env python
#
# Copyright 2011 Markus Pielmeier
#
# This file is part of minecraft-world-io.
#
# minecraft-world-io 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... | marook/minecraft-world-io | src/test/marook_test/minecraft_test/tag_test/test_entities.py | Python | gpl-3.0 | 1,426 | 0.002805 |
#!/usr/bin/python
import os, sys, shutil, collections
from optparse import OptionParser
# Fix for python 2
try:
input = raw_input
except NameError:
pass
def find_recursive(root, subpath, maxdepth=4):
queue = collections.deque([(root, 0)])
if 'PATH' in os.environ:
envpath = os.environ['PATH'].split(':')
... | rokuz/omim | tools/android/set_up_android.py | Python | apache-2.0 | 3,533 | 0.016417 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2022 Roberto Alsina and others.
# 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
# the rights t... | getnikola/nikola | nikola/plugins/task/copy_files.py | Python | mit | 2,163 | 0.000463 |
import pdb
class TimingDiagram:
def print_diagram(self, xtsm_object):
pdb.set_trace()
seq = xtsm_object.XTSM.getActiveSequence()
cMap=seq.getOwnerXTSM().getDescendentsByType("ChannelMap")[0]
#channelHeir=cMap.createTimingGroupHeirarchy()
#channelRes=cMap.findTiming... | gemelkelabs/timing_system_software | server_py_files/utilities/timing_diagram.py | Python | mit | 5,170 | 0.00793 |
# 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... | wolverineav/neutron | neutron/_i18n.py | Python | apache-2.0 | 1,355 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-24 07:00
from __future__ import unicode_literals
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.fields
class Migration(migrations.Migration):
dependencies = [
('home', '0004_auto_20170524_0608'),
]
... | cts-admin/cts | cts/home/migrations/0005_auto_20170524_0700.py | Python | gpl-3.0 | 708 | 0.001412 |
#!/usr/bin/env python
'''
Creates an html treemap of disk usage, using the Google Charts API
'''
import json
import os
import subprocess
import sys
def memoize(fn):
stored_results = {}
def memoized(*args):
try:
return stored_results[args]
except KeyError:
result = store... | geekoftheweek/disk-treemap | treemap.py | Python | mit | 2,734 | 0.001829 |
#!/usr/bin/python
"""Test of tree output using Firefox."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(PauseAction(3000))
sequence.append(KeyComboAction("<Alt>b"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAct... | GNOME/orca | test/keystrokes/firefox/ui_role_tree.py | Python | lgpl-2.1 | 5,957 | 0.002686 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitsend Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test ZMQ interface
#
from test_framework.test_framework import BitsendTestFramework
from test_framew... | madzebra/BitSend | qa/rpc-tests/zmq_test.py | Python | mit | 3,224 | 0.006514 |
string = (input("What is your string?\n"))
string.replace('K', 'M'[max])
string.replace('O', 'Q'[max])
string.replace('E', 'G'[max])
print(string) | AustinHartman/randomPrograms | stringRep.py | Python | gpl-3.0 | 148 | 0.006757 |
from enigma import eComponentScan, iDVBFrontend
from Components.NimManager import nimmanager as nimmgr
from Tools.Transponder import getChannelNumber
class ServiceScan:
Idle = 1
Running = 2
Done = 3
Error = 4
Errors = {
0: _("error starting scanning"),
1: _("error while scanning"),
2: _("no resource manag... | mrnamingo/vix4-34-enigma2-bcm | lib/python/Components/ServiceScan.py | Python | gpl-2.0 | 7,567 | 0.037531 |
import statistics
from datetime import datetime
class Benchmark():
def __init__(self, n_runs: int = 5, print_checkpoint: bool = True):
self.n_runs = n_runs
self.print_checkpoint = print_checkpoint
@staticmethod
def log(message: str) -> None:
print('[%s] - %s' % (datetime.now(), m... | numerai/submission-criteria | tests/benchmark_base.py | Python | apache-2.0 | 1,174 | 0.000852 |
# Copyright (C) 2015 Twitter, Inc.
"""Container for all targeting related logic used by the Ads API SDK."""
from twitter_ads.http import Request
from twitter_ads.resource import resource_property, Resource, Persistence
from twitter_ads import API_VERSION
from twitter_ads.utils import FlattenParams
import json
class... | twitterdev/twitter-python-ads-sdk | twitter_ads/targeting.py | Python | mit | 998 | 0 |
from __future__ import unicode_literals
def device_from_request(request):
"""
Determine's the device name from the request by first looking for an
overridding cookie, and if not found then matching the user agent.
Used at both the template level for choosing the template to load and
also at the ca... | TecnoSalta/bg | mezzanine/utils/device.py | Python | bsd-2-clause | 2,013 | 0 |
from setuptools import setup
setup(
setup_requires=['pbr', ],
pbr=True,
auto_version="PBR",
)
| rocktavious/pyversion | setup.py | Python | mit | 107 | 0 |
#!/usr/bin/env python3
# encoding: utf-8
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
#
# Calamares is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# t... | maui-packages/calamares | src/modules/fstab/main.py | Python | gpl-3.0 | 5,216 | 0.000767 |
#!/bin/env python
# -*- python -*-
#
# Copyright 2003,2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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 (... | manojgudi/sandhi | modules/gr36/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py | Python | gpl-3.0 | 4,373 | 0.011891 |
# -*- coding: utf-8 -*-
#-------------------------------------------------
#-- osm map importer
#--
#-- microelly 2016 v 0.4
#--
#-- GNU Lesser General Public License (LGPL)
#-------------------------------------------------
'''import data from openstreetmap'''
#http://api.openstreetmap.org/api/0.6/map?bbox=11.74182,... | microelly2/geodata | geodat/import_osm.py | Python | lgpl-3.0 | 23,641 | 0.05022 |
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# uobjnew Summarize object allocations in high-level languages.
# For Linux, uses BCC, eBPF.
#
# USAGE: uobjnew [-h] [-T TOP] [-v] {java,ruby,c} pid [interval]
#
# Copyright 2016 Sasha Goldshtein
# Licensed under the Apache License, Version 2.0 ... | mkacik/bcc | tools/uobjnew.py | Python | apache-2.0 | 5,131 | 0.000974 |
import pytest
from apispec import yaml_utils
def test_load_yaml_from_docstring():
def f():
"""
Foo
bar
baz quux
---
herp: 1
derp: 2
"""
result = yaml_utils.load_yaml_from_docstring(f.__doc__)
assert result == {"herp": 1, "derp": 2}
... | marshmallow-code/apispec | tests/test_yaml_utils.py | Python | mit | 908 | 0.001116 |
#!/usr/bin/env python
"""This is a game called Tetros made with Tkinter graphics (quite similar to Tetris)."""
# Import modules
from tkinter import *
from tkinter import filedialog
from tkinter import messagebox
from tkinter.ttk import *
import random
import math
import time
import cmath
import copy
import sys
import w... | Advait-M/Tetros | src/Tetros.py | Python | gpl-3.0 | 64,805 | 0.001836 |
import pygame.time
class Animation:
"""
Class that defines simple looped frame-by-frame animations
on art-assets and plays them when prompted to.
"""
def __init__(self, sprite):
"""
Create a new animation.
:param sprite: Asset sprite that will play the animation.
:... | EricHripko/TheQuestOfTin | tqot/animation.py | Python | gpl-3.0 | 2,600 | 0.000385 |
#!/usr/bin/env python
import pantilthat
import time
import sys
import math
import servo_ranges
def tick():
time.sleep(0.010)
class Shelf(object):
def __init__(self, num, start, end, tilt):
self.count = num; # num of records
self.pan_start = start; # degress +
self.pan_end = end; # degrees -
self.tilt_pos =... | valentingalea/vinyl-shelf-finder | pantilthat/finder.py | Python | mit | 2,511 | 0.024691 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
def install(country=None):
records = [
# address template
{'doctype':"Address Template", "country": count... | gangadharkadam/v5_erp | erpnext/setup/page/setup_wizard/install_fixtures.py | Python | agpl-3.0 | 12,019 | 0.018055 |
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function
import os
import re
import sys
# Check Sphinx version
import sphinx
if sphinx.__version__ < "1.0.1":
raise RuntimeError("Sphinx 1.0.1 or newer required")
needs_sphinx = '1.0'
# ---------------------------------------------... | DailyActie/Surrogate-Model | 01-codes/numpy-master/doc/source/conf.py | Python | mit | 9,985 | 0.001202 |
#
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is d... | kbrebanov/ansible | lib/ansible/plugins/action/ce.py | Python | gpl-3.0 | 3,950 | 0.002025 |
from pathlib import Path
from django.utils import timezone
import factory
from photonix.accounts.models import User
from photonix.photos.models import Library, LibraryUser, Photo, PhotoFile, Tag, PhotoTag, Task
class UserFactory(factory.django.DjangoModelFactory):
class Meta:
model = User
username ... | damianmoore/photo-manager | tests/factories.py | Python | agpl-3.0 | 2,156 | 0.000464 |
import numpy as np
import torch
import torch.nn as nn
from itertools import product
from torch.nn import functional as F
#import pytorch_fft.fft as fft
# def laplace():
# return np.array([[0.25, 0.5, 0.25], [0.5, -3.0, 0.5], [0.25, 0.5, 0.25]]).astype(np.float32)[None, None, ...]
def laplace():
return np.arr... | atlab/attorch | attorch/regularizers.py | Python | mit | 3,598 | 0.002779 |
# -*- coding: utf-8 -*-
#
#
# Author: Guewen Baconnier
# Copyright 2010-2012 Camptocamp SA
# Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
#... | Therp/stock-logistics-warehouse | __unported__/stock_available_immediately/__openerp__.py | Python | agpl-3.0 | 1,363 | 0 |
from organise import app
app.run()
| msanatan/organise | run.py | Python | mit | 36 | 0 |
#
# Copyright (C) 2006, 2013 Red Hat, Inc.
# Copyright (C) 2006 Daniel P. Berrange <berrange@redhat.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 2 of the License, or
# (... | aurex-linux/virt-manager | virtManager/engine.py | Python | gpl-2.0 | 41,820 | 0.001124 |
# vim:fileencoding=utf-8:noet
try:
import vim
except ImportError:
vim = object() # NOQA
from powerline.bindings.vim import getbufvar
from powerline.segments.vim import window_cached
@window_cached
def ctrlp(pl, side):
'''
Highlight groups used: ``ctrlp.regex`` or ``background``, ``ctrlp.prev`` or ``background... | keelerm84/powerline | powerline/segments/plugin/ctrlp.py | Python | mit | 2,722 | 0.031227 |
#!/usr/bin/env python3
import os
from construct import Adapter, Const, GreedyBytes, Int32ul, Struct, this
from .common import ZeroString, PreallocatedArray, test_folder, mkdir_p
from .encryption import EncryptedBlock
RES_ENCRYPTION = 23, 9782, 3391, 31
# noinspection PyPep8,PyUnresolvedReferences
ResourceEntry = ... | domi-id/across | across/res.py | Python | mit | 2,378 | 0.002103 |
class Comp1Plugin(object):
def __init__(self):
self.version = '1.4'
class Comp2Plugin(object):
def __init__(self):
self.version = '1.4'
| DailyActie/Surrogate-Model | 01-codes/OpenMDAO-Framework-dev/openmdao.test/src/openmdao/test/plugins/foo2/foo.py | Python | mit | 162 | 0 |
from django.db import models
from constituencies.models import Constituency
from uk_political_parties.models import Party
from elections.models import Election
class Person(models.Model):
name = models.CharField(blank=False, max_length=255)
remote_id = models.CharField(blank=True, max_length=255, null=True)... | JustinWingChungHui/electionleaflets | electionleaflets/apps/people/models.py | Python | mit | 1,603 | 0.001871 |
from bot.server import main
main()
| fedorlol/Tolyan | bot/__main__.py | Python | gpl-3.0 | 36 | 0 |
import math
class segment_tree():
def __init__(self,a):
self.a = a
self.root = self.build(0,len(a)-1)
def build(self,left,right):
if left == right:
node = {}
node['value'] = self.a[left]
node['left'] = None
node['right'] = None
... | saisankargochhayat/algo_quest | hackerearth/segment_tree_problem.py | Python | apache-2.0 | 1,757 | 0.036426 |
# 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... | yanchen036/tensorflow | tensorflow/contrib/distributions/python/ops/bijectors/weibull.py | Python | apache-2.0 | 5,266 | 0.003608 |
# -*- coding: utf-8 -*-
"""
zang.inboundxml.elements.play
~~~~~~~~~~~~~~~~~~~
Module containing `Play` inbound xml element
"""
from zang.inboundxml.elements.base_node import BaseNode
class Play(BaseNode):
_allowedContentClass = ()
def __init__(self, url, loop=None):
if url is None:
rai... | jaymin-panchal/zang-python | zang/inboundxml/elements/play.py | Python | mit | 599 | 0 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from zope.interface import implements
from twisted.internet import defer
from twisted.trial import unittest
from twisted.words.protocols.jabber import sasl, sasl_mechanisms, xmlstream, jid
from twisted.words.xish import domish
NS_XMPP_SASL = 'urn... | skycucumber/Messaging-Gateway | webapp/venv/lib/python2.7/site-packages/twisted/words/test/test_jabbersasl.py | Python | gpl-2.0 | 8,748 | 0.002743 |
if __name__ == '__main__':
a = int(raw_input())
b = int(raw_input())
print a + b
print a - b
print a * b
| LuisUrrutia/hackerrank | python/introduction/python-arithmetic-operators.py | Python | mit | 126 | 0.007937 |
"""
Manila configuration - file ``/etc/manila/manila.conf``
=======================================================
The Manila configuration file is a standard '.ini' file and this parser uses
the ``IniConfigFile`` class to read it.
Sample configuration::
[DEFAULT]
osapi_max_limit = 1000
osapi_share_base... | wcmitchell/insights-core | insights/parsers/manila_conf.py | Python | apache-2.0 | 1,598 | 0.001252 |
#!/usr/bin/env python
"""
This module reads all Gerber and Excellon files and stores the
data for each job.
--------------------------------------------------------------------
This program is licensed under the GNU General Public License (GPL)
Version 3. See http://www.fsf.org for details of the license.
Rugged Ci... | fightingwalrus/gerbmerge | gerbmerge/jobs.py | Python | gpl-3.0 | 52,296 | 0.015049 |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... | sailfish-sdk/sailfish-qtcreator | tests/system/suite_tools/tst_codepasting/test.py | Python | gpl-3.0 | 11,988 | 0.004922 |
# Copyright (c) 2016 Mirantis, 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... | olivierlemasle/murano | murano/tests/unit/dsl/test_statics.py | Python | apache-2.0 | 4,079 | 0 |
# Natural Language Toolkit: Paradigm Visualisation
#
# Copyright (C) 2005 University of Melbourne
# Author: Will Hardy
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
# Front end to a Python implementation of David
# Penton's paradigm visualisation model.
# Author:
#
# Run: To run, first load a... | RensaProject/nodebox_linguistics_extended | nodebox_linguistics_extended/parser/nltk_lite/contrib/paradigm.py | Python | gpl-2.0 | 24,313 | 0.00473 |
# pylint: disable=W0611
# coding: utf-8
'''
Window
======
Core class for creating the default Kivy window. Kivy supports only one window
per application: please don't try to create more than one.
'''
__all__ = ('Keyboard', 'WindowBase', 'Window')
from os.path import join, exists
from os import getcwd
from kivy.core... | aron-bordin/kivy | kivy/core/window/__init__.py | Python | mit | 57,469 | 0.000331 |
# encoding: utf-8
# Copyright 2013–2017 California Institute of Technology. ALL RIGHTS
# RESERVED. U.S. Government Sponsorship acknowledged.
from .setuphandlers import publish
from edrn.rdf import DEFAULT_PROFILE
from plone.dexterity.utils import createContentInContainer
from edrn.rdf.labcascollectionrdfgenerator impo... | EDRN/CancerDataExpo | src/edrn.rdf/edrn/rdf/upgrades.py | Python | apache-2.0 | 2,788 | 0.002154 |
#<pycode(py_choose)>
class Choose:
"""
Choose - class for choose() with callbacks
"""
def __init__(self, list, title, flags=0, deflt=1, icon=37):
self.list = list
self.title = title
self.flags = flags
self.x0 = -1
self.x1 = -1
self.y0 = -1
self.y1 = -1
self.width = -1
self... | nihilus/src | pywraps/py_choose.py | Python | bsd-3-clause | 1,595 | 0.016928 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Django_study.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| zhangyage/Python-oldboy | day13/Django_study/manage.py | Python | apache-2.0 | 255 | 0 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def hasPathSum(self, root, sum):
"""
:type root: TreeNode
:type sum: int
:rtype: bool
... | hawkphantomnet/leetcode | PathSum/Solution.py | Python | mit | 625 | 0.0048 |
#!/usr/bin/env python
"""
a simple script can run and test your html rendering classes.
Uncomment the steps as you add to your rendering.
"""
import codecs
import cStringIO
# importing the html_rendering code with a short name for easy typing.
import html_render as hr
## writing the file out:
def render(page, fil... | AmandaMoen/AmandaMoen | code/session06/run_html_render.py | Python | gpl-2.0 | 5,015 | 0.004786 |
# coding: utf-8
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class WidgetHomeRail(object):
"""
NOTE: This class is au... | kinow-io/kinow-python-sdk | kinow_client/models/widget_home_rail.py | Python | apache-2.0 | 5,545 | 0.000361 |
# -*- coding: utf-8 -*-
##############################################################################
# 2014 E2OpenPlugins #
# #
# This file is open source software; you can redistribute... | MDXDave/ModernWebif | plugin/controllers/models/owibranding.py | Python | gpl-2.0 | 15,558 | 0.03349 |
"""Unittests that do not require the server to be running an common tests of responses.
The TestCase here just calls the functions that provide the logic to the ws views with DummyRequest
objects to mock a real request.
The functions starting with `check_...` are called with UnitTest.TestCase instance as the first
ar... | mtholder/pyraphyletic | phylesystem_api/tests.py | Python | bsd-2-clause | 7,707 | 0.001946 |
from setuptools import setup, find_packages
import os
ROOT = os.path.dirname(os.path.realpath(__file__))
setup(
name='grab',
version='0.6.22',
description='Web Scraping Framework',
long_description=open(os.path.join(ROOT, 'README.rst')).read(),
url='http://grablib.org',
author='Gregory Petukho... | liorvh/grab | setup.py | Python | mit | 1,293 | 0 |
"""List iSCSI Snapshots."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
from SoftLayer import utils
import click
@click.command()
@click.argument('iscsi-identifier')
@environment.pass_env... | cloudify-cosmo/softlayer-python | SoftLayer/CLI/snapshot/list.py | Python | mit | 1,122 | 0 |
from .frontend import JSON_Editor, mode, Page
from . import frontend
from .character import Character
from .util import load_json, debug
class CHARACTERS(JSON_Editor):
def __init__(self):
self._name = 'character'
JSON_Editor.__init__(self)
self._icons = 'avatars'
self._obj = Charac... | ajventer/ezdm | ezdm_libs/all_characters.py | Python | gpl-3.0 | 1,127 | 0.000887 |
# Eve W-Space
# Copyright 2014 Andrew Austin and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | marbindrakon/eve-wspace | evewspace/search/registry.py | Python | apache-2.0 | 3,019 | 0.002981 |
class CheckoutDiscardMixin():
def discard_all_unstaged(self):
"""
Any changes that are not staged or committed will be reverted
to their state in HEAD. Any new files will be deleted.
"""
self.git("clean", "-df")
self.git("checkout", "--", ".")
def checkout_file... | ypersyntelykos/GitSavvy | core/git_mixins/checkout_discard.py | Python | mit | 589 | 0 |
import serial
import serial.tools.list_ports
import copy
import numpy as np
import math
import random
class AsciiSerial:
def __init__(self):
self._graphsChannels = {'graph1': None, 'graph2': None, 'graph3': None, 'graph4': None}
self._enChannels = {'graph1': False, 'graph2': False, 'graph3': Fals... | INTechSenpai/moon-rover | debug_tools/python_debug_console/AsciiSerial.py | Python | gpl-3.0 | 11,638 | 0.003268 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-11-10 08:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reporte', '0001_initial'),
]
operations = [
migrations.AlterField(
... | vpadillar/pventa | reporte/migrations/0002_auto_20161110_0819.py | Python | mit | 504 | 0.001984 |
import os
from pathlib import Path
import gi
import logging
from gi.repository import Gtk
import json_config
from .login_window import LoginWindow
TOP_DIR = os.path.dirname(os.path.abspath(__file__))
config = json_config.connect('config.json')
gi.require_version('Gtk', '3.0')
class WatsonCredentialsDialog(Gtk.Dia... | betterclever/susi_linux | main/renderer/configuration_window.py | Python | apache-2.0 | 8,711 | 0 |
# -*- coding: utf-8 -*-
from django import forms
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.utils.translation import ugettext as _
from filer.admin.fileadmin import FileAdmin
from filer.models import Image
class ImageAdminForm(forms.ModelForm):
subject_location = forms.Ch... | mkoistinen/django-filer | filer/admin/imageadmin.py | Python | bsd-3-clause | 1,629 | 0 |
from django.conf import settings
from django.contrib.auth.views import (
LoginView, LogoutView, redirect_to_login as redirect_to_intercept,
)
from django.core.exceptions import PermissionDenied, ValidationError
from django.template.response import TemplateResponse
from django.urls import Resolver404, resolve, rever... | tejo-esperanto/pasportaservo | core/middleware.py | Python | agpl-3.0 | 6,047 | 0.002481 |
from setuptools import setup, find_packages
import sys, os
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.rst')).read()
except IOError:
README = ''
version = "0.0.1"
TEST_REQUIREMENTS = [
'numpy',
'pillow',
'webtest'
]
setup(
name='tgext.matpl... | amol-/tgext.matplotrender | setup.py | Python | mit | 1,201 | 0.003331 |
#!/usr/bin/env python
from os.path import join, dirname
from cloudify import ctx
ctx.download_resource(
join('components', 'utils.py'),
join(dirname(__file__), 'utils.py'))
import utils # NOQA
# Most images already ship with the following packages:
#
# python-setuptools
# python-backports
# python-b... | cloudify-cosmo/cloudify-manager-blueprints | components/python/scripts/bootstrap_validate.py | Python | apache-2.0 | 1,334 | 0 |
"""
===========
gaussfitter
===========
.. codeauthor:: Adam Ginsburg <adam.g.ginsburg@gmail.com> 3/17/08
Latest version available at <http://code.google.com/p/agpy/source/browse/trunk/agpy/gaussfitter.py>
"""
import numpy
from numpy.ma import median
from numpy import pi
#from scipy import optimize,stats,pi
from mpfi... | kirillzhuravlev/atrex | Software/gaussfitter.py | Python | lgpl-3.0 | 23,723 | 0.024702 |
#Copyright ReportLab Europe Ltd. 2000-2016
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/widgets/grids.py
__version__='3.3.0'
from reportlab.lib import colors
from reportlab.lib.validators import isNumber, isColorOrNone, isB... | EduPepperPDTesting/pepper2013-testing | lms/djangoapps/reportlab/graphics/widgets/grids.py | Python | agpl-3.0 | 18,133 | 0.013511 |
import os
import time
import traceback
from lib.FileManager.FM import REQUEST_DELAY
from lib.FileManager.workers.baseWorkerCustomer import BaseWorkerCustomer
class CreateCopy(BaseWorkerCustomer):
def __init__(self, paths, session, *args, **kwargs):
super(CreateCopy, self).__init__(*args, **kwargs)
... | LTD-Beget/sprutio-rpc | lib/FileManager/workers/ftp/createCopy.py | Python | gpl-3.0 | 6,690 | 0.003101 |
from __future__ import unicode_literals
from django.db.models import fields
from django.utils.translation import ugettext_lazy as _
from ...models.field import FieldDefinition
class _BooleanMeta:
defined_field_category = _('Boolean')
class BooleanFieldDefinition(FieldDefinition):
class Meta(_BooleanMeta):... | charettes/django-mutant | mutant/contrib/boolean/models.py | Python | mit | 610 | 0 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Hardwarerelease.medium'
db.add_column('ashop_hardwarerelease', 'medium', self.gf('django.d... | hzlf/openbroadcast | website/apps/ashop/migrations/0015_auto__add_field_hardwarerelease_medium.py | Python | gpl-3.0 | 23,666 | 0.007817 |
import random
import re
from io import BytesIO
from typing import Awaitable, List
import matplotlib.pyplot as plt
import seaborn as sns
from curio.thread import async_thread
from curious.commands import Context, Plugin
from curious.commands.decorators import autoplugin, ratelimit
from yapf.yapflib.style import CreateP... | SunDwarf/Jokusoramame | jokusoramame/plugins/misc.py | Python | gpl-3.0 | 5,938 | 0.000168 |
import collections
import datetime
import mock
import pytz
from babel import dates, Locale
from schema import Schema, And, Use, Or
from modularodm import Q
from modularodm.exceptions import NoResultsFound
from nose.tools import * # noqa PEP8 asserts
from framework.auth import Auth
from framework.auth.core import Use... | brandonPurvis/osf.io | tests/test_notifications.py | Python | apache-2.0 | 59,970 | 0.003035 |
import pyxel
from pyxel.ui import Widget
from .constants import OCTAVE_BAR_BACKGROUND_COLOR, OCTAVE_BAR_COLOR
class OctaveBar(Widget):
def __init__(self, parent, x, y):
super().__init__(parent, x, y, 4, 123)
self.add_event_handler("mouse_down", self.__on_mouse_down)
self.add_event_handle... | ferriman/SSandSP | pyxel-test/venv/lib/python3.8/site-packages/pyxel/editor/octave_bar.py | Python | gpl-3.0 | 1,129 | 0.000886 |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
import os
from functools import partial
from collections import namedtuple
from time import sleep
from platform import python_implementation
from powerline.segments import shell, tmux, pdb, i... | bezhermoso/powerline | tests/test_segments.py | Python | mit | 79,449 | 0.022501 |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2017-2020)
#
# This file is part of GWpy.
#
# GWpy 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)... | gwpy/gwpy | gwpy/timeseries/io/wav.py | Python | gpl-3.0 | 3,595 | 0 |
# -*- encoding: utf-8 -*-
"""Test for Roles CLI
@Requirement: Filter
@CaseAutomation: Automated
@CaseLevel: Acceptance
@CaseComponent: CLI
@TestType: Functional
@CaseImportance: High
@Upstream: No
"""
from robottelo.cli.base import CLIReturnCodeError
from robottelo.cli.factory import (
make_filter,
make... | Ichimonji10/robottelo | tests/foreman/cli/test_filter.py | Python | gpl-3.0 | 6,479 | 0 |
if __name__ == '__main__':
s = input()
is_list = list(zip(*[[c.isalnum(), c.isalpha(), c.isdigit(), c.islower(), c.isupper()] for c in s]))
print_list = [True if True in is_result else False for is_result in is_list]
for result in print_list:
print(result)
| nifannn/HackerRank | Practice/Python/Strings/string_validators.py | Python | mit | 281 | 0.007117 |
#!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PARAMETERS = None
ADB_CMD = "adb"
def doCMD(cmd):
# Do not need handle timeout in this short script, let tool... | crosswalk-project/crosswalk-test-suite | embeddingapi/embedding-api-android-tests/inst.apk.py | Python | bsd-3-clause | 3,916 | 0.001277 |
def run():
import sys, os
try:
uri = sys.argv[1]
except IndexError:
uri = os.getcwd()
import gtk
from .app import App
from uxie.utils import idle
application = App()
idle(application.open, uri)
gtk.main()
| baverman/fmd | fmd/run.py | Python | mit | 262 | 0.007634 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2014-2016 Alex Forencich
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 the... | Diti24/python-ivi | ivi/agilent/agilentE4431B.py | Python | mit | 1,495 | 0.001338 |
from django.contrib import admin
from .models import User
class UserAdmin(admin.ModelAdmin):
list_display = ('username', 'email', 'is_active', 'is_staff', 'validated')
admin.site.register(User, UserAdmin)
| gitaarik/jazzchords | apps/users/admin.py | Python | gpl-3.0 | 213 | 0 |
# test slices; only 2 argument version supported by Micro Python at the moment
x = list(range(10))
# Assignment
l = list(x)
l[1:3] = [10, 20]
print(l)
l = list(x)
l[1:3] = [10]
print(l)
l = list(x)
l[1:3] = []
print(l)
l = list(x)
del l[1:3]
print(l)
l = list(x)
l[:3] = [10, 20]
print(l)
l = list(x)
l[:3] = []
print(... | hiway/micropython | tests/basics/list_slice_assign.py | Python | mit | 622 | 0.017685 |
import test.support
# Skip tests if _multiprocessing wasn't built.
test.support.import_module('_multiprocessing')
# Skip tests if sem_open implementation is broken.
test.support.import_module('multiprocessing.synchronize')
# import threading after _multiprocessing to raise a more revelant error
# message: "No module n... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.2/Lib/test/test_concurrent_futures.py | Python | mit | 20,163 | 0.000893 |
from re import compile, match
REGEX = compile(r'((25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){3}'
r'(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)$')
def is_valid_IP(strng):
""" is_valid_ip == PEP8 (forced mixedCase by CodeWars) """
return bool(match(REGEX, strng))
| the-zebulan/CodeWars | katas/kyu_4/ip_validation.py | Python | mit | 276 | 0 |
# -*- coding: utf-8 -*-
r"""
Graph-directed iterated function system (GIFS)
See [JK14]_ or [BV20]_ or
- http://larryriddle.agnesscott.org/ifs/ifs.htm
- https://encyclopediaofmath.org/wiki/Iterated_function_system
We allow the functions to be contracting or not. When the functions are
inflations, it allows to represe... | seblabbe/slabbe | slabbe/graph_directed_IFS.py | Python | gpl-2.0 | 26,146 | 0.004171 |
import ddt
from analyticsclient.tests import (
APIListTestCase,
APIWithPostableIDsTestCase,
ClientTestCase
)
@ddt.ddt
class CourseSummariesTests(APIListTestCase, APIWithPostableIDsTestCase, ClientTestCase):
endpoint = 'course_summaries'
id_field = 'course_ids'
_LIST_PARAMS = frozenset([
... | Stanford-Online/edx-analytics-data-api-client | analyticsclient/tests/test_course_summaries.py | Python | apache-2.0 | 1,471 | 0.00136 |
from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
from django.conf import settings
from django.db import connection
from django.db.models import Q, F
from contactnetwork.distances import *
from protein.models import ProteinFamily
import time
import scipy
... | protwis/protwis | contactnetwork/management/commands/build_distance_representative.py | Python | apache-2.0 | 2,958 | 0.006423 |
# Stack implementation
class Stack (object):
def __init__ (self):
self.stack = []
def push (self, data):
self.stack.append(data)
def peek (self):
if self.isEmpty():
return None
return self.stack[-1]
def pop (self):
if self.isEmpty():
return None
return self.stack.pop()
def isEmpty (self):
... | mag6367/Cracking_the_Coding_Interview_Python_Solutions | chapter3/stack.py | Python | mit | 418 | 0.057416 |
from django.apps import AppConfig
class ActivityConfig(AppConfig):
name = 'cyactivities'
verbose_name = 'Cyborg Activities'
def ready(self):
import cyactivities.signals
| shawnhermans/cyborgcrm | cyactivities/apps.py | Python | bsd-2-clause | 192 | 0.010417 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-14 17:20
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateMode... | richardcornish/django-paywall | regwall/tests/articles/migrations/0001_initial.py | Python | bsd-3-clause | 1,053 | 0.003799 |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from ndreg import *
import ndio.remote.neurodata as neurodata
import nibabel as nb
refToken = "ara_ccf2"
refImg = imgDownload(refToken)
imgShow(refImg)
plt.savefig("refImg_initial.png", bbox_inches='tight')
imgShow(refImg, vmax=500)
plt.savefig("... | NeuroDataDesign/seelviz | seelviz/brainalign.py | Python | apache-2.0 | 3,476 | 0.006617 |
import importlib
import lektor.i18n
def test_loading_i18n_triggers_no_warnings(recwarn):
importlib.reload(lektor.i18n)
for warning in recwarn.list:
print(warning) # debugging: display warnings on stdout
assert len(recwarn) == 0
| lektor/lektor | tests/test_i18n.py | Python | bsd-3-clause | 252 | 0 |
from django import forms
from seednetwork.forms import SeedNetworkBaseForm
from seedlibrary.models import Event
GRAIN_CHOICES = (
('-','-'),
('amaranth','Amaranth'),
('barley', 'Barley'),
('buckwheat', 'Buckwheat'),
('corn', 'Corn'),
# ('kaniwa', 'Kaniwa'),
('mil... | RockinRobin/seednetwork | seedlibrary/forms.py | Python | mit | 6,875 | 0.0224 |
import os
import sqlite3
from time import time, strftime, gmtime
from waskr.config import options
import log
# Fixes Database Absolute Location
FILE_CWD = os.path.abspath(__file__)
FILE_DIR = os.path.dirname(FILE_CWD)
DB_FILE = FILE_DIR+'/waskr.db'
# Engines Supported
engines_supported = ['sqlite', 'mongodb']
cla... | AloneRoad/waskr | waskr/database.py | Python | mit | 2,723 | 0.011017 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.