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 |
|---|---|---|---|---|---|
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: tasking_dsz.py
import mcl.framework
import mcl.tasking
class dsz:
INTERFACE = 16842801
PFAM = 4129
PROVIDER_ANY = 4129
PROVIDER = 16... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/network/cmd/ping/tasking_dsz.py | Python | unlicense | 444 |
import sys
import struct
from optparse import OptionParser
# Starbound Spawn Coordinate Changer
# Based on http://seancode.com/galileo/format/wrldb.html
# usage: `python main.py -x coordinate -y coordinate worldfile'
KEY = bytearray([76, 76, 0, 0, 0, 1, 0, 0, 0, 0, 0])
WORLD_WIDTH_OFFSET = 0
WORLD_HEIGHT_OFF... | Omnipotence/Starbound-Spawn-Changer | main.py | Python | mit | 4,458 |
#!/usr/bin/env python
#
#
#
# Copyright (c) 2009 University of Dundee.
#
# 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 la... | sbesson/registry | omero_qa/validator/urls.py | Python | agpl-3.0 | 1,407 |
# source: http://stackoverflow.com/questions/2758159/how-to-embed-a-python-interpreter-in-a-pyqt-widget
import sys
import os
import re
import traceback
import platform
from PyQt5 import QtCore
from PyQt5 import QtGui
from PyQt5 import QtWidgets
from electrum import util
from electrum.i18n import _
if platform.sys... | cryptapus/electrum | electrum/gui/qt/console.py | Python | mit | 11,672 |
# Copyright (C) 2016-2018, Raffaele Salmaso <raffaele@salmaso.org>
# Copyright (C) 2013, byteweaver
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must re... | rsalmaso/django-fluo-coupons | coupons/admin.py | Python | bsd-3-clause | 4,090 |
import os
import mock
from django.conf import settings
from zerver.lib.test_classes import ZulipTestCase
from zproject.email_backends import get_forward_address
class EmailLogTest(ZulipTestCase):
def test_generate_and_clear_email_log(self) -> None:
with self.settings(EMAIL_BACKEND='zproject.email_backends... | jackrzhang/zulip | zerver/tests/test_email_log.py | Python | apache-2.0 | 2,036 |
from sympy import residue, Symbol, Function, sin, S, I, pi, exp, log, pi, factorial
from sympy.utilities.pytest import XFAIL, raises
from sympy.abc import x, y, z, a, s
def test_basic1():
assert residue(1/x, x, 0) == 1
assert residue(-2/x, x, 0) == -2
assert residue(81/x, x, 0) == 81
assert residue(1/... | kmacinnis/sympy | sympy/series/tests/test_residues.py | Python | bsd-3-clause | 1,943 |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import logging
import functools as ft
#import Pickle as cP
import numpy as np
import tqdm
from blessings import Terminal
import err
import utils as U
#import fileops as fops
from utils import print
from s... | zutshi/S3CAMR | src/core/random_testing.py | Python | bsd-2-clause | 16,059 |
import pytest
class TestTee:
@pytest.mark.complete("tee ")
def test_1(self, completion):
assert completion
@pytest.mark.complete("tee -", require_longopt=True)
def test_options(self, completion):
assert completion
| algorythmic/bash-completion | test/t/test_tee.py | Python | gpl-2.0 | 249 |
from . import foo | asedunov/intellij-community | python/testData/completion/relativeFromImportInNamespacePackage2/nspkg1/a.after.py | Python | apache-2.0 | 17 |
from django.conf.urls import url, include
from rest_framework import routers
from . import views
# TODO: create /api/v1/ url space for default API urls
router = routers.DefaultRouter()
router.register(r'bids', views.BidViewSet)
router.register(r'claims', views.ClaimViewSet)
router.register(r'votes', views.VoteViewS... | codesy/codesy | api/urls.py | Python | agpl-3.0 | 578 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01_preview/aio/operations/_admin_rule_collections_operations.py | Python | mit | 17,796 |
"""Monkeypatching and mocking functionality."""
import os
import re
import sys
import warnings
from contextlib import contextmanager
from pathlib import Path
from typing import Any
from typing import Generator
from typing import List
from typing import MutableMapping
from typing import Optional
from typing import overl... | pexip/os-pytest | src/_pytest/monkeypatch.py | Python | mit | 12,979 |
#import win32traceutil
import traceback
import sys
import os
import time
import new
# these three are required pre-imported, for pyjamas to work
# with the pyjd imputil etc. awful, i know...
import threading
import encodings
import encodings.cp437
from windows import *
from ctypes import *
from ctypes.wintypes imp... | andreyvit/pyjamas | pyjd/mshtml.py | Python | apache-2.0 | 13,133 |
import prairielearn as pl
import lxml.html
import chevron
import json
import pygraphviz
import numpy as np
ENGINE_DEFAULT = 'dot'
PARAMS_NAME_MATRIX_DEFAULT = None
PARAMS_NAME_LABELS_DEFAULT = None
WEIGHTS_DEFAULT = None
WEIGHTS_DIGITS_DEFAULT = 2
WEIGHTS_PRESENTATION_TYPE_DEFAULT = 'f'
def prepare(element_html, da... | mwest1066/PrairieLearn | elements/pl-graph/pl-graph.py | Python | agpl-3.0 | 3,763 |
# Copyright 2014 Open Connectome Project (http://openconnecto.me)
#
# 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 app... | neurodata/ndgrutedb | MR-OCP/MROCPdjango/pipeline/procs/process_ip_data.py | Python | apache-2.0 | 2,932 |
def solve(opr):
return eval(opr)
if __name__ == "__main__":
opr = input().strip()
result = solve(opr)
print(result)
| avenet/hackerrank | contests/university_codesprint_3/a_small_step_toward_calculators.py | Python | mit | 134 |
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | Donkyhotay/MoonPy | zope/app/folder/interfaces.py | Python | gpl-3.0 | 1,201 |
# This file is part of the Indico plugins.
# Copyright (C) 2002 - 2022 CERN
#
# The Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License;
# see the LICENSE file for more details.
from unittest.mock import MagicMock
import pytest
from wtforms import Valida... | indico/indico-plugins | payment_paypal/tests/util_test.py | Python | mit | 913 |
# Copyright 2021, 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-research/public-data-in-dpfl | mimelite.py | Python | apache-2.0 | 26,760 |
from __future__ import print_function
import argparse
import os
import stat
import sys
# find the import for catkin's python package - either from source space or from an installed underlay
if os.path.exists(os.path.join('/opt/ros/hydro/share/catkin/cmake', 'catkinConfig.cmake.in')):
sys.path.insert(0, os.path.joi... | HailStorm32/Q.bo_stacks | qbo_webi/build/catkin_generated/generate_cached_setup.py | Python | lgpl-2.1 | 1,266 |
#!/usr/bin/env python
"""This module compiles the lecture notes."""
import glob
import os
import subprocess
import argparse
import shutil
def compile_single(is_update):
"""Compile a single lecture."""
for task in ["pdflatex", "bibtex", "pdflatex", "pdflatex"]:
cmd = [task, "main"]
subprocess.... | grmToolbox/grmpy | promotion/grmpy_tutorial/create_slides.py | Python | mit | 1,444 |
from datetime import datetime
import os
import re
import unittest
from landscape.lib import testing
from landscape.lib.sysstats import (
MemoryStats, CommandError, get_logged_in_users, get_uptime,
get_thermal_zones, LoginInfoReader, BootTimes)
from landscape.lib.testing import append_login_data
SAMPLE_MEMORY... | CanonicalLtd/landscape-client | landscape/lib/tests/test_sysstats.py | Python | gpl-2.0 | 15,312 |
from __future__ import unicode_literals
import django
from future.builtins import int, zip
from functools import reduce
from operator import ior, iand
from string import punctuation
from django.apps import apps
from django.core.exceptions import ImproperlyConfigured
from django.db.models import Manager, Q, CharField... | sjdines/mezzanine | mezzanine/core/managers.py | Python | bsd-2-clause | 17,312 |
import os.path
from unittest2 import TestCase
from dingus import Dingus
from mule.base import Mule
from mule import conf
from mule.tasks import run_test, mule_setup, mule_teardown
def dingus_calls_to_dict(obj):
# remap dingus calls into a useable dict
calls = {}
for name, args, kwargs, obj in obj:
... | disqus/mule | mule/tests.py | Python | apache-2.0 | 5,367 |
import importlib
import glob
import os
import logging
def load_all_codecs():
# Loading all codecs in this folder
for module in glob.glob(os.path.join(os.path.dirname(__file__), "*.py")):
module = os.path.basename(module)
if not module.startswith("_") and module != "utils.py" \
and m... | ElegantMonkey/Bat-man | batman/codec_interface/utils.py | Python | gpl-3.0 | 511 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Moodle Development Kit
Copyright (c) 2012 Frédéric Massart - FMCorz.net
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 Lic... | FMCorz/mdk | mdk/moodle.py | Python | gpl-3.0 | 32,035 |
import os
import unittest
from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms import ImageField, ValidationError
from django.test import SimpleTestCase
try:
from PIL import Image
except ImportError:
Image = None
def get_img_path(path):
return os.path.join(os.path.abspath(os.p... | edmorley/django | tests/forms_tests/field_tests/test_imagefield.py | Python | bsd-3-clause | 2,282 |
#
# key.py - OpenSSL wrapper
# Source: git://github.com/joric/brutus.git
# which was forked from git://github.com/samrushing/caesure.git
#
import ctypes
import ctypes.util
ssl = ctypes.cdll.LoadLibrary (ctypes.util.find_library ('ssl') or 'libeay32')
# this specifies the curve used with ECDSA.
NID_secp256k1 = 714 #... | 0dayZh/python-bitcoinlib | bitcoin/key.py | Python | mit | 4,073 |
#!/usr/bin/env python
#
# Electrum - Lightweight Bitcoin Client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... | GroestlCoin/electrum-grs | electrum_grs/plugins/trustedcoin/qt.py | Python | gpl-3.0 | 13,381 |
#pylint: disable=invalid-name
"""
Classes for each reduction step. Those are kept separately
from the the interface class so that the DgsReduction class could
be used independently of the interface implementation
"""
from __future__ import (absolute_import, division, print_function)
import os
import xml.dom... | ScreamingUdder/mantid | scripts/Interface/reduction_gui/reduction/inelastic/dgs_sample_data_setup_script.py | Python | gpl-3.0 | 12,549 |
# -*- coding: utf-8 -*-
"""
Example that fails to execute
=============================
This example demonstrates a code block that raises an error and how any code
blocks that follow are not executed.
When scripts fail, their gallery thumbnail is replaced with the broken
image stamp. This allows easy identification ... | Eric89GXL/sphinx-gallery | examples/no_output/plot_raise.py | Python | bsd-3-clause | 1,038 |
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | termie/jaikuengine | common/protocol/pshb.py | Python | apache-2.0 | 1,524 |
import time
import collections
from django.core.exceptions import ImproperlyConfigured
from rest_framework.parsers import JSONParser
from rest_framework.exceptions import ParseError, NotAuthenticated
from framework.auth import signing
from api.base.utils import is_bulk_request
from api.base.renderers import JSONAPIRen... | mattclark/osf.io | api/base/parsers.py | Python | apache-2.0 | 12,275 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from boxbranding import getImageVersion, getMachineBrand, getMachineName
from os import system, access, R_OK
from os.path import ismount
import re
import six
from enigma import eConsoleAppContainer, eTimer
from twisted.web import client
from Plugins.System... | openatv/enigma2 | lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py | Python | gpl-2.0 | 30,623 |
from django.contrib import admin
from mailer.models import Message, DontSendEntry, MessageLog
class MessageAdmin(admin.ModelAdmin):
list_display = ["id", "to_addresses", "subject", "when_added", "priority"]
class DontSendEntryAdmin(admin.ModelAdmin):
list_display = ["to_address", "when_added"]
class Mess... | maweis1981/hey001 | mayversion/mayversion/mailer/admin.py | Python | lgpl-3.0 | 580 |
import re
from parsimonious.grammar import Grammar
import parsimonious.exceptions
class ParseError(Exception):
pass
def is_bdl_scenario(contents):
return contents.startswith("#!benchDL\n")
def convert(contents, env):
ast = transform(lex(contents))
return substitute(ast, env)
def get_includes(ir):
... | timofey-barmin/mzbench | lib/bdl_utils.py | Python | bsd-3-clause | 5,783 |
import numpy as np
import pytest
@pytest.fixture(autouse=True)
def add_np(doctest_namespace):
doctest_namespace["np"] = np
| jpn--/larch | larch/conftest.py | Python | gpl-3.0 | 129 |
"""
Server Technology Power Strips
"""
from basicpowerstrip import BasicPowerStrip
from clusto.drivers.devices.common import IPMixin, SNMPMixin
from clusto.drivers.resourcemanagers import IPManager
from clusto.exceptions import DriverException
import re
class PowerTowerXM(BasicPowerStrip, IPMixin, SNMPMixin):
... | rongoro/clusto | src/clusto/drivers/devices/powerstrips/servertech.py | Python | bsd-3-clause | 4,454 |
# Copyright 2017 Ben Walsh
#
# 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, so... | walshb/camog | camog/_csv.py | Python | apache-2.0 | 1,839 |
"""
Redis Backends
------------------
Provides backends for talking to `Redis <http://redis.io>`_.
"""
from __future__ import absolute_import
from dogpile.cache.api import CacheBackend, NO_VALUE
from dogpile.cache.compat import pickle, u
redis = None
__all__ = 'RedisBackend',
class RedisBackend(CacheBackend):
... | dantebarba/docker-media-server | plex/Subliminal.bundle/Contents/Libraries/Shared/dogpile/cache/backends/redis.py | Python | gpl-3.0 | 5,743 |
import os
import platform
import subprocess
import datetime as dt
import time
import calendar
import sys
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# General Parameters - Tools - Proxy Network - Output Directory
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Path declarati... | HoboSci/OBIS-Capelin | Loop_on_date_python_script.py | Python | mit | 16,260 |
from __future__ import absolute_import
from Components.VariableValue import VariableValue
from Components.Renderer.Renderer import Renderer
from enigma import eSlider
class Progress(VariableValue, Renderer):
def __init__(self):
Renderer.__init__(self)
VariableValue.__init__(self)
self.__start = 0
self.__end ... | atvcaptain/enigma2 | lib/python/Components/Renderer/Progress.py | Python | gpl-2.0 | 1,048 |
# 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... | mixturemodel-flow/tensorflow | tensorflow/contrib/bayesflow/python/kernel_tests/monte_carlo_test.py | Python | apache-2.0 | 8,131 |
import numpy as np
from HPOlibConfigSpace.configuration_space import ConfigurationSpace
from HPOlibConfigSpace.hyperparameters import CategoricalHyperparameter
from ParamSklearn.components.base import \
ParamSklearnPreprocessingAlgorithm
from ParamSklearn.constants import *
class Balancing(ParamSklearnPreproces... | automl/paramsklearn | ParamSklearn/components/data_preprocessing/balancing.py | Python | bsd-3-clause | 4,086 |
"""
Support for the worldtides.info API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.worldtidesinfo/
"""
from datetime import timedelta
import logging
import time
import requests
import voluptuous as vol
from homeassistant.components.sensor i... | tinloaf/home-assistant | homeassistant/components/sensor/worldtidesinfo.py | Python | apache-2.0 | 4,233 |
# -*- coding: utf-8 -*-
#############################################################################
#
# Copyright (c) 2007 Martin Reisenhofer <martin.reisenhofer@funkring.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | funkring/fdoo | addons-funkring/commission/account_analytic.py | Python | agpl-3.0 | 1,146 |
#!/usr/bin/env python
"""
fs.tests: testcases for the fs module
"""
from __future__ import with_statement
# Send any output from the logging module to stdout, so it will
# be captured by nose and reported appropriately
import sys
import logging
logging.basicConfig(level=logging.ERROR, stream=sys.stdout)
from ... | duedil-ltd/pyfilesystem | fs/tests/__init__.py | Python | bsd-3-clause | 46,382 |
import json
from django.test import TestCase
from django.utils.http import urlquote
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django.core.files.uploadedfile import SimpleUploadedFile
from wagtail.tests.utils import WagtailTestUtils
from wagtail.wagtailimages.u... | jorge-marques/wagtail | wagtail/wagtailimages/tests/test_admin_views.py | Python | bsd-3-clause | 22,610 |
from __future__ import absolute_import
import unittest
class TestRange1d(unittest.TestCase):
def setUp(self):
from bokeh.models.ranges import Range1d
self.range1d = Range1d
def test_init(self):
self.assertRaises(ValueError, self.range1d, 1, 2, start=1, end=2)
self.assertRaise... | htygithub/bokeh | bokeh/tests/test_models_ranges.py | Python | bsd-3-clause | 1,038 |
from djangoappengine.main.application import main, application, make_profileable
if __name__ == '__main__':
main()
| purpleidea/macaronic-net | djangoappengine/main/main.py | Python | agpl-3.0 | 120 |
from ._base import FunctionBase
class Function(FunctionBase):
name = 'clear'
doc = 'Clears TerminalWidgetSystem data'
methods_subclass = {}
def handle_input(self, term_system, term_globals, exec_locals, text):
term_system.data = []
| Bakterija/mmplayer | mmplayer/kivy_soil/terminal_widget/functions/clear.py | Python | mit | 258 |
#!/usr/bin/python
import mraa
import time
import sys
sys.path.append(r'~/programy/python/')
from robot import *
forward(1)
lrotate(1)
forward(1)
lrotate(1)
back(1)
rrotate(1)
back(1)
rrotate(1)
quit()
| jipech/SparkFun_H-Bridge_Block_for_Edison_Python_Library | example.py | Python | gpl-2.0 | 205 |
from copy import copy
import numpy as np
from nipy.core.image.image import Image
class ImageList(object):
''' Class to contain ND image as list of (N-1)D images '''
def __init__(self, images=None):
"""
A lightweight implementation of a list of images.
Parameters
-------... | yarikoptic/NiPy-OLD | nipy/core/image/image_list.py | Python | bsd-3-clause | 3,183 |
from .. import gen_or_fn
import unittest
from unittest.mock import Mock, patch
class RunGenOrFn(unittest.TestCase):
""" Test cases of RunGenOrFn """
def test_fn(self):
""" Test that a normal function is run properly """
fn = Mock()
args = range(3)
kwargs = {'one': 1, 't... | cloew/KaoGenerator | kao_generator/Test/test_gen_or_fn.py | Python | mit | 2,262 |
# 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... | gunan/tensorflow | tensorflow/python/kernel_tests/depthwise_conv_op_test.py | Python | apache-2.0 | 40,520 |
## PETRglobals.py [module]
##
# Global variable initializations for the PETRARCH event coder
#
# SYSTEM REQUIREMENTS
# This program has been successfully run under Mac OS 10.10; it is standard Python 2.7
# so it should also run in Unix or Windows.
#
# INITIAL PROVENANCE:
# Programmer: Philip A. Schrodt
# Parus Anal... | openeventdata/UniversalPetrarch | UniversalPetrarch/PETRglobals.py | Python | mit | 4,242 |
# Copyright 2009-2014 Justin Riley
#
# This file is part of StarCluster.
#
# StarCluster 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
# later ... | cancan101/StarCluster | starcluster/templates/config.py | Python | lgpl-3.0 | 14,546 |
import os
from datetime import timedelta
from environs import Env
from marshmallow.validate import OneOf, Email
# Read .env if any
env = Env(expand_vars=True)
env.read_env(env.path("DOTENV", ".env"), override=False)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def make_path(rel: str) ->... | simde-utc/woolly-api | woolly_api/settings.py | Python | gpl-3.0 | 8,899 |
import struct
import GLWindow
import ModernGL
# Window & Context
wnd = GLWindow.create_window()
ctx = ModernGL.create_context()
# Shaders & Program
prog = ctx.program(
ctx.vertex_shader('''
#version 330
in vec2 vert;
in vec3 vert_color;
out vec3 frag_color;
uniform ve... | cprogrammer1994/ModernGL | examples/old-examples/GLWindow/02_uniforms_and_attributes.py | Python | mit | 1,381 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tasks', '0002_task_jplag_up_to_date'),
('checker', '0003_isabellechecker_trusted_theories'),
]
operations = [
migrat... | lohner/Praktomat | src/checker/migrations/0004_textchecker_and_scalabuilder.py | Python | gpl-2.0 | 2,540 |
# from fractions import gcd
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a / gcd(a, b) * b
| warmsea/tc-srm | snippets/fractions.py | Python | mit | 139 |
"""Cache lines from files.
This is intended to read lines from modules imported -- hence if a filename
is not found, it will look down the module search path for a file by
that name.
"""
import sys
import os
__all__ = ["getline", "clearcache", "checkcache"]
def getline(filename, lineno, module_globals=None):
li... | MicroTrustRepos/microkernel | src/l4/pkg/python/contrib/Lib/linecache.py | Python | gpl-2.0 | 4,055 |
# Components.py - Abstract class for any Lustre filesystem components.
# Copyright (C) 2010-2015 CEA
#
# This file is part of shine
#
# 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 versi... | stanford-rc/shine | lib/Shine/Lustre/Component.py | Python | gpl-2.0 | 12,978 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | SKIRT/PTS | do/core/plotseds.py | Python | agpl-3.0 | 2,288 |
"""
Studio Index, home and dashboard pages. These are the starting pages for users.
"""
from bok_choy.page_object import PageObject
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
from common.test.acceptance.pages.studio import BASE_URL
from common.test.acceptance.pages.st... | cpennington/edx-platform | common/test/acceptance/pages/studio/index.py | Python | agpl-3.0 | 13,539 |
from PyQt4 import QtCore, QtGui
import shared
import re
import sys
import inspect
from helper_sql import *
from addresses import decodeAddress
from foldertree import AccountMixin
from pyelliptic.openssl import OpenSSL
from utils import str_broadcast_subscribers
import time
def getSortedAccounts():
configSections ... | Atheros1/PyBitmessage | src/bitmessageqt/account.py | Python | mit | 7,343 |
import csv
from django.conf import settings
from ._utils import AstaporCommand, validate_number_cols
from specimens.models import TaxonRank, Taxon, TaxonStatus, SPECIES_RANK_NAME, SUBGENUS_RANK_NAME
MODELS_TO_TRUNCATE = [Taxon, TaxonRank, TaxonStatus]
def create_initial_ranks():
TaxonRank.objects.bulk_create(... | BelgianBiodiversityPlatform/Astapor | website/specimens/management/commands/import_taxonomy.py | Python | bsd-2-clause | 4,434 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
import adhocracy4.images.fields
class Migration(migrations.Migration):
dependencies = [
('meinberlin_organisations', '0003_logo-for-newsletter'),
]
operations = [
... | liqd/a4-meinberlin | meinberlin/apps/organisations/migrations/0004_changed_upload_path.py | Python | agpl-3.0 | 637 |
# -*- coding: utf-8 -*-
#
# 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
#... | danielvdende/incubator-airflow | tests/contrib/hooks/test_spark_sql_hook.py | Python | apache-2.0 | 4,171 |
# coding=utf-8
from __future__ import absolute_import, division, print_function
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms of the AGPLv3 License"
import requests
import logging
from ..excepti... | beeverycreative/BEEweb | src/octoprint/plugins/softwareupdate/version_checks/bitbucket_commit.py | Python | agpl-3.0 | 1,717 |
# Copyright (C) 2015-2019 Magenta ApS, https://magenta.dk.
# Contact: info@magenta.dk.
#
# 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
import shutil
import... | magenta-aps/mox | oio_rest/oio_rest/utils/encode_token.py | Python | mpl-2.0 | 893 |
#! /usr/bin/python
# -*- coding: utf-8
STYLE = {
'fore': {
'black': 30, 'red': 31, 'green': 32, 'yellow': 33,
'blue': 34, 'purple': 35, 'cyan': 36, 'white': 37,
},
'back': {
'black': 40, 'red': 41, 'green': 42, 'yellow': 43,
'blue'... | doudounannan/python-crawl | style.py | Python | mit | 1,372 |
# -*- Mode:Python -*-
##########################################################################
# #
# This file is part of AVANGO. #
# ... | jakobharlan/avango | avango-volume/python/volume/__init__.py | Python | lgpl-3.0 | 1,634 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | ekivemark/my_device | bbp/bbp/member/migrations/0001_initial.py | Python | apache-2.0 | 862 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
BatchPanel.py
---------------------
Date : November 2014
Copyright : (C) 2014 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*************... | AsgerPetersen/QGIS | python/plugins/processing/gui/BatchPanel.py | Python | gpl-2.0 | 17,132 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2019 Satpy developers
#
# This file is part of satpy.
#
# satpy 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 Licens... | pytroll/satpy | satpy/writers/__init__.py | Python | gpl-3.0 | 47,315 |
name = input("Insert your name: ")
print("Ciao , name")
| lstorchi/teaching | helloworld/name.py | Python | gpl-3.0 | 57 |
import os
os.chdir("../resources") # Change the current directory
cwd = os.getcwd() # Get the current working directory (cwd)
files = os.listdir(cwd) # Get all the files in that directory
file_day1 = open("day1", "r")
where_is_santa = 0
class walker:
direction = 90;
pos_list = []
x = 0;
y = 0;
... | Mymoza/advent-of-code-2016 | days/day1.py | Python | mit | 1,811 |
import inspect
import example
print(inspect.getsource(example.A))
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_language_tools/inspect_getsource_class.py | Python | apache-2.0 | 67 |
"""Tests of openedx.features.discounts.applicability"""
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import ddt
import pytest
import pytz
from django.contrib.sites.models import Site
from django.utils.timezone import now
from edx_toggles.toggles.testutils import override_waffle_flag
from enterpri... | stvstnfrd/edx-platform | openedx/features/discounts/tests/test_applicability.py | Python | agpl-3.0 | 7,633 |
from flask_appbuilder.security.sqla.models import User
from sqlalchemy import Column, String
class MyUser(User):
extra = Column(String(256))
| rpiotti/Flask-AppBuilder | examples/quickhowto2/app/sec_models.py | Python | bsd-3-clause | 147 |
"""SCons.Tool.packaging.msi
The msi packager.
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# 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
# with... | dezelin/scons | scons-local/SCons/Tool/packaging/msi.py | Python | mit | 20,208 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | gfsa/datasets/graph_bundle.py | Python | apache-2.0 | 10,309 |
#!/usr/bin/env python
'''
Copyright (c) 2013-2014, Magnus Skjegstad (magnus@skjegstad.com) / FFI
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the abov... | MagnusS/pyradac | src/pyradac/openwrttoolbox.py | Python | bsd-2-clause | 4,561 |
import fileinput
def str_to_int(s):
return([ int(x) for x in s.split() ])
# args = [ 'line 1', 'line 2', ... ]
def proc_input(args):
f = str_to_int(args[1])
s = str_to_int(args[3])
return (f, s)
def solve(args, verbose=False):
(f, s) = proc_input(args)
post = [ ('f', x) for x in f ] + [ ('s', x) for x in s ]
... | cripplet/practice | codeforces/493/attempt/c_basketball.py | Python | mit | 1,215 |
# -*- coding: utf-8 -*-
__version__ = '0.1.0'
__version_info__ = tuple([int(num) if num.isdigit() else num for num in __version__.replace('-', '.', 1).split('.')])
default_app_config = 'core.apps.CoreConfig'
| jordij/menorkayak | core/__init__.py | Python | mit | 209 |
#!/usr/bin/env python3
'''
This script is used if you want to filter a GFF3 file by IDs but also maintain any relationships
defined within the file. That is, if you have a list of mRNA identifiers and want to keep them,
but also wanted to keep any associated exons, CDS, etc.
Because common GFF3 usage doesn't guara... | jonathancrabtree/biocode | gff/filter_gff3_by_id_list.py | Python | gpl-3.0 | 2,752 |
#!/usr/bin/env python
import re
data = re.compile(r'^([a-z]+_[a-z]+_[0-9]{3}): (.*) *$')
comment = re.compile(r'^#')
variable = re.compile(r'\$([a-z_]+)\$')
voted = re.compile(r'.*\$vote_tally\$.*')
passed = re.compile(r'.*(?!not )(passed|adopted).*\$vote_tally\$.*', re.IGNORECASE)
failed = re.compile(r'.*(failed|no... | votervoice/openstates | openstates/ks/action_codes_scrape.py | Python | gpl-3.0 | 1,139 |
"""
Convenience script triggering the P2.5 -> P3.0 migrations
XXX - NOTE - XXX
This is meant to migrate a P2.5 based Opencore site database to one
that will work on a P3.0 or better Opencore instance. THE 'unmake-sites'
SCRIPT MUST BE RUN BEFORE THIS SCRIPT, OR THIS SCRIPT WILL FAIL.
Sometimes even the 'unmake-sites'... | socialplanning/opencore | migrations/migrate-p3.py | Python | gpl-3.0 | 2,761 |
# pylint: disable=protected-access
"""
Unit tests for SafeCookieData
"""
import itertools
from time import time
import ddt
import six
from django.test import TestCase
from mock import patch
from six.moves import range # pylint: disable=ungrouped-imports
from ..middleware import SafeCookieData, SafeCookieError
from... | cpennington/edx-platform | openedx/core/djangoapps/safe_sessions/tests/test_safe_cookie_data.py | Python | agpl-3.0 | 7,693 |
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import platform
import traceback
import faulthandler
import tempfile
import os
import os.path
import uuid
import json
import locale
from typing import cast, Any
try:
from sentry_sdk.hub import Hub
from sentry_sdk.u... | Ultimaker/Cura | cura/CrashHandler.py | Python | lgpl-3.0 | 19,761 |
import numpy as np
from .base import classifier
from .base import regressor
from .utils import toIndex, fromIndex, to1ofK, from1ofK
from numpy import asarray as arr
from numpy import atleast_2d as twod
from numpy import asmatrix as mat
################################################################################... | sameersingh/ml-discussions | week9/mltools/nnet.py | Python | apache-2.0 | 22,387 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import oscar.models.fields
class Migration(migrations.Migration):
dependencies = [
('catalogue', '0001_initial'),
('contenttypes', '0001_initial'),
]
operations = [
migration... | vicky2135/lucious | src/oscar/apps/promotions/migrations/0001_initial.py | Python | bsd-3-clause | 11,439 |
# Returns a list of file paths contained within given parent folder
| anarkhede/Nark | File_org_preproc/filelist.py | Python | gpl-3.0 | 68 |
from __future__ import print_function
import warnings
from setuptools import setup, find_packages, Extension
from setuptools.command.install import install
import numpy
# Because many people neglected to run the pylearn2/utils/setup.py script
# separately, we compile the necessary Cython extensions here but because
#... | Refefer/pylearn2 | setup.py | Python | bsd-3-clause | 1,946 |
'''
Load options from the command line
Sam Geen, July 2013
'''
import sys
def Arg1(default=None):
'''
Read the first argument
default: Default value to return if no argument is found
Return: First argument in sys.argv (minus program name) or default if none
'''
if len(sys.argv) < 2:
re... | samgeen/Hamu | Utils/CommandLine.py | Python | mit | 464 |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import commah
# Here's an example run script, modify as preferred
commah.run('WMAP5',
zi=0,
Mi=[1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14],
z=[0, 0.5, 1, 1.5, 2],
filename='WMAP5_Test.txt')
| astroduff/commah | run.py | Python | bsd-3-clause | 320 |
from progressivis import Scheduler, Every
from progressivis.vis import ScatterPlot
from progressivis.io import CSVLoader
from progressivis.datasets import get_dataset
def filter_(df):
l = df['pickup_longitude']
return df[(l < -70) & (l > -80) ]
def print_len(x):
if x is not None:
print(len(x))
#l... | jdfekete/progressivis | examples/test_scatterplot.py | Python | bsd-2-clause | 739 |
"""A generic client for creating and managing transformations.
See the information about transformation parameters below.
"""
import six
import json
from DIRAC import gLogger, gConfig, S_OK, S_ERROR
from DIRAC.Core.Utilities.JEncode import encode
from DIRAC.Core.Utilities.PromptUser import promptUser
from DIRAC.Core.... | DIRACGrid/DIRAC | src/DIRAC/TransformationSystem/Client/Transformation.py | Python | gpl-3.0 | 28,989 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.