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 |
|---|---|---|---|---|---|
# Copyright (c) 2014 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 agreed to in writ... | satish-avninetworks/murano | murano/engine/system/net_explorer.py | Python | apache-2.0 | 7,642 |
from __future__ import print_function
class MetaOne(type):
def __new__(meta, classname, supers, classdict):
print('In MetaOne.new:', meta, classname, supers, classdict, sep='\n...')
return type.__new__(meta, classname, supers, classdict)
class Eggs(object):
pass
print('making class'... | simontakite/sysadmin | pythonscripts/learningPython/metaclass1-2x.py | Python | gpl-2.0 | 678 |
# pylint: disable=missing-docstring
import unittest
from django.conf import settings
from django.test import TestCase
from oauth2_provider.models import AccessToken, Application, RefreshToken
from openedx.core.djangoapps.oauth_dispatch.tests import factories
from common.djangoapps.student.tests.factories import Use... | stvstnfrd/edx-platform | openedx/core/djangoapps/oauth_dispatch/tests/test_factories.py | Python | agpl-3.0 | 2,331 |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, include, url
from .views import *
urlpatterns = patterns('',
url(r'^$', QuestionsListView.as_view(), name='questions'),
url(r'^create/$', QuestionsCreateView.as_view(), name='questions-create'),
url(r'^(?P<qslug>[\w\d\-]+)/view/$', Q... | niwinz/Green-Mine | src/greenmine/questions/urls.py | Python | bsd-3-clause | 564 |
from quantopian.research import run_pipeline
from quantopian.pipeline import Pipeline
from quantopian.pipeline.factors import Latest
from quantopian.pipeline.data.builtin import USEquityPricing
from quantopian.pipeline.data import morningstar
from quantopian.pipeline.factors import CustomFactor, SimpleMovingAverage, Av... | vsmolyakov/fin | alpha_selection.py | Python | mit | 12,422 |
# Copyright 2012 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | barnsnake351/neutron | neutron/api/v2/resource.py | Python | apache-2.0 | 7,285 |
# encoding: utf-8
class MyBaseException(Exception):
"""
Base class for Exceptions
Create subclasses with parameters in their msg e.g. {message} or {name}
and call as in: raise NewException(name="Foo");
msgargs Arguments that slot into msg
__str__ Returns msg expanded with msgparms
"""
... | ArchiveLabs/dweb_gateway | python/Errors.py | Python | agpl-3.0 | 3,507 |
#!/usr/bin/env python
# Copyright 2016 gRPC 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 applicable law o... | stanley-cheung/grpc | tools/run_tests/artifacts/artifact_targets.py | Python | apache-2.0 | 21,883 |
__author__ = 'venkat'
from tkinter import *
root = Tk()
def send_mail():
return
def send_trap():
return
def mradioselect():
return
check_gmail = IntVar()
check_snmp = IntVar()
var = IntVar()
#root.config(bg="grey")
LB=Label(root, text="All Node Link status", borderwidth=0)
LB.grid(row=0, columnspan=4)... | venkatant/msproject | sample.py | Python | gpl-2.0 | 2,075 |
# Copyright 2011 OpenStack LLC.
# 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 b... | eneabio/nova | nova/notifier/capacity_notifier.py | Python | apache-2.0 | 3,445 |
#!/usr/bin/env python
from __future__ import print_function
import sys
sq_to_str = [
'a1', 'b1', 'c1', 'd1', 'e1', 'f1', 'g1', 'h1',
'a2', 'b2', 'c2', 'd2', 'e2', 'f2', 'g2', 'h2',
'a3', 'b3', 'c3', 'd3', 'e3', 'f3', 'g3', 'h3',
'a4', 'b4', 'c4', 'd4', 'e4', 'f4', 'g4', 'h4',
'a5', 'b5', 'c5', 'd5... | selavy/chess | print_move.py | Python | mit | 1,472 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from import2 import *
import import2
print 'In import1'
import2.bar()
bar()
| licongyu95/learning_python | core_python_programming/cap14/import1.py | Python | unlicense | 123 |
# -*- Mode: Python; test-case-name: flumotion.test.test_registry -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified u... | timvideos/flumotion | flumotion/common/registry.py | Python | lgpl-2.1 | 64,775 |
"""
PostgreSQL Session API
======================
The Session classes wrap the Queries :py:class:`Session <queries.Session>` and
:py:class:`TornadoSession <queries.tornado_session.TornadoSession>` classes
providing environment variable based configuration.
Environment variables should be set using the ``PGSQL[_DBNAME]... | sprockets/sprockets.clients.postgresql | sprockets/clients/postgresql/__init__.py | Python | bsd-3-clause | 5,585 |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | wxiang7/airflow | airflow/settings.py | Python | apache-2.0 | 4,000 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('inboxen', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='liberation',
name='a... | Inboxen/Inboxen | inboxen/migrations/0002_remove_liberation_async_result.py | Python | agpl-3.0 | 351 |
import sys, os, inspect
import os, sys, inspect, inviwopy
path_to_current_folder = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
sys.path.append(path_to_current_folder + "/../")
import envisionpy
import envisionpy.hdf5parser
from envisionpy.network import VisualisationManager
VASP_DIR = pat... | rartino/ENVISIoN | demo/fermi_surface.py | Python | bsd-2-clause | 754 |
from __future__ import print_function
import socket, threading, sys, re, types
from . import axonmc
from six.moves import map
def main():
## Use 34567 as default port
if len(sys.argv) < 2:
port = 34567
else:
port = int(sys.argv[1])
## Mutex to serialize requests to multiclamp... | acq4/acq4 | acq4/drivers/MultiClamp/multiclamp_server/multiClampServer.py | Python | mit | 3,071 |
# 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/.
from optparse import OptionParser
import os
import re
import unittest
import sys
import dmunit
import genfiles
def ma... | wilebeast/FireFox-OS | B2G/gecko/testing/mozbase/mozdevice/sut_tests/runtests.py | Python | apache-2.0 | 2,917 |
#!/usr/bin/python
import os
import sys
import os.path as osp
import cv2
import numpy as np
import argparse as ap
conf_parser = ap.ArgumentParser(description='Traverse all .mp4 video files in the specified folder and pick out frames to export as images.')
conf_parser.add_argument("-f", "--folder", help="Folder to proce... | Algomorph/reco | scripts/extract_frames_multivideo.py | Python | apache-2.0 | 2,649 |
"""
Integrate functions by rewriting them as Meijer G-functions.
There are three user-visible functions that can be used by other parts of the
sympy library to solve various integration problems:
- meijerint_indefinite
- meijerint_definite
- meijerint_inversion
They can be used to compute, respectively, indefinite i... | ChristinaZografou/sympy | sympy/integrals/meijerint.py | Python | bsd-3-clause | 75,824 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
# What's the real floor?题目地址:https://www.codewars.com/kata/574b3b1599d8f897470018f6/train/python
'''
import unittest
class TestCases(unittest.TestCase):
def setUp(self):
pass
def test1(self):self.assertEqual(get_real_floor(1), 0)
def test2(self):self.... | karchi/codewars_kata | 已完成/What's the real floor.py | Python | mit | 794 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Episode.allow_multiple_niqati'
db.add_column(u'activities... | enjaz/enjaz | activities/south_migrations/0007_auto__add_field_episode_allow_multiple_niqati.py | Python | agpl-3.0 | 12,555 |
#! /usr/bin/env python3
"""
bitset.py
Written by Geremy Condra
Licensed under GPLv3
Released 3 May 2009
This module provides a simple bitset implementation
for Python.
"""
from collections import Sequence
import math
class Bitset(Sequence):
"""A very simple bitset implementation for Python.
Note that, like wi... | djdarcy/Prime-Square-Sum | test/recipe-576738-1.py | Python | gpl-2.0 | 3,415 |
from citrination_client.data import UploadResult
def test_indicates_failure():
"""
Tests that the presence of a single failure
will make the result report unsuccessful
"""
ur = UploadResult()
ur.add_failure("test.jpg", "bad filename")
assert ur.successful() is False
def test_default_is_suc... | CitrineInformatics/python-citrination-client | citrination_client/data/tests/test_upload_result.py | Python | apache-2.0 | 1,010 |
import sys
from time import sleep
sys.path.append('../lib')
import cflib.crtp
from cflib.crazyflie import Crazyflie
from cfclient.utils.logconfigreader import LogConfig
from threading import Thread, Timer
import logging
logging.basicConfig(level=logging.ERROR)
class MyCF:
def __init__(self, uri):
self.c... | Venris/crazyflie-multilink | KM/kilka.py | Python | gpl-2.0 | 2,202 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import MySQLdb
import sys
import numpy as np
from scipy.optimize import leastsq
def priceVolumeDown(data_date):
stockList = StockDataMart.getAllStocks()
for rows in stockList:
stockId = rows[0]
market = rows[1]
stockName = rows[2]
dataInfo = StockDataMart.... | sunpy1106/stocknotes | StockDataAnalyze.py | Python | gpl-2.0 | 3,667 |
from PIL import Image
import glob
import numpy as np
import os
def chkMkDir(dirName):
if not os.path.exists(dirName):
os.makedirs(dirName)
return
def imgSizeFinder(img, newSize=1280):
imgDims = img.size
dimMax = max(imgDims)
if (dimMax <= newSize):
width = imgDims[0]
height = imgDims[1]
else:
width = i... | mtwharmby/assorted-scripts | PythonPlayground/photo-bulk-resize.py | Python | gpl-2.0 | 1,054 |
"""
A tool for identifying griefers.
.. note::
"blockinfo" must be AFTER "votekick" in the config script list
Commands
^^^^^^^^
* ``/griefcheck or /gc <player> <minutes>`` gives you when, how many and whos blocks a player destroyed *admin only*
Options
^^^^^^^
.. code-block:: guess
[blockinfo]
griefcheck_... | feikname/spades-server | piqueserver/scripts/blockinfo.py | Python | gpl-3.0 | 6,523 |
#coding: utf-8
from django import forms
from django.forms import CharField, IntegerField, DecimalField
from assist.conf import MERCHANT_ID, TEST_MODE, MODE1_URL, MODE2_URL
class HiddenForm(forms.Form):
def __init__(self, *args, **kwargs):
super(HiddenForm, self).__init__(*args, **kwargs)
for fiel... | denisbalyko/django-assist-by | build/lib/assist/forms.py | Python | mit | 5,182 |
#!/usr/bin/env python
"""
Copyright 2015 Reverb Technologies, 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 require... | Alzon/SUR | magnum/common/pythonk8sclient/client/models/V1beta3_ReplicationControllerStatus.py | Python | apache-2.0 | 1,380 |
import os
print('hahaha')
| jonathanchu/gitpython-test | test.py | Python | mit | 27 |
# Sai Nudurupati and Erkan Istanbulluoglu - 14May2014 :
# Example to use radiation_field.py
"""
Article author: Sai S. Nudurupati (saisiddu@uw.edu) and Erkan Istanbulluoglu
Date: 22 May 2014
"""
"""
Radiation component calculates total incoming shortwave radiation and
relative radiation factor (ra... | decvalts/landlab | landlab/components/radiation/examples/radiation_field_example.py | Python | mit | 5,494 |
# Setup the notebook and download the data
from __future__ import print_function
from __future__ import division
import functools
import hashlib
import os
import warnings
from subprocess import check_output
import numpy
from ipywidgets import interact
import pandas
from root_pandas import read_root
from scipy import ... | lhcb/opendata-project | Data/setup_main_analysis.py | Python | gpl-2.0 | 2,100 |
# Generated by Django 2.0.4 on 2018-04-26 07:42
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... | rodgomes/django-waffle | test_app/migrations/0001_initial.py | Python | bsd-3-clause | 4,126 |
from Bio import SeqIO
import tempfile
import sys
import argparse
import operator
def parse_xmfa(xmfa):
"""Simple XMFA parser until https://github.com/biopython/biopython/pull/544
"""
current_lcb = []
current_seq = {}
for line in xmfa.readlines():
if line.startswith('#'):
contin... | TAMU-CPT/mauved3 | cluster_lcbs.py | Python | agpl-3.0 | 6,597 |
"""
``revscoring score -h``
::
Scores a set of revisions.
Usage:
score (-h | --help)
score <model-file> <rev_id>... --api=<uri> [--verbose]
Options:
-h --help Print this documentation
<model-file> Path to a model file
--api=<url> The url pointing to a Med... | aetilley/revscoring | revscoring/utilities/score.py | Python | mit | 1,550 |
import ctypes
from . import x64dbg
GUI_MAX_LINE_SIZE = 65536
def DbgIsDebugging():
return x64dbg.DbgIsDebugging()
def GuiGetLineWindow(title=''):
line = ctypes.create_string_buffer(GUI_MAX_LINE_SIZE)
return_value = x64dbg.GuiGetLineWindow("%s" % title, line)
if return_value:
return line.val... | x64dbg/x64dbgpy | swig/x64dbgpy/pluginsdk/bridgemain.py | Python | mit | 491 |
# -*- coding:utf-8 -*-
# Transform given Active Display Coordinate (ADC) to Media Coordinate (MC).
# raw/pororo*.tsv -> data/pororo*.tsv
#
# @date 2014-03-30
# @author Jin-Hwa Kim (jhkim@bi.snu.ac.kr)
import os, sys, getopt, glob, re
import numpy as np
from sets import Set
import common
# default options
verbose =... | jnhwkim/Eye-Tracking | Transform/preprocess.py | Python | mit | 8,025 |
# -*- coding: utf-8 -*-
import sys,getopt,got,datetime,codecs
def main(argv):
if len(argv) == 0:
print 'You must pass some parameters. Use \"-h\" to help.'
return
if len(argv) == 1 and argv[0] == '-h':
print """\nTo use this jar, you can pass the folowing attributes:
username: Username of a specific t... | pizzaro13/FakeNewsDetector | Exporter.py | Python | mit | 2,515 |
import os
from IPython.lib import passwd
c.NotebookApp.ip = '*'
c.NotebookApp.port = int(os.getenv('PORT', 8888))
c.NotebookApp.open_browser = False
c.NotebookApp.allow_root = True
c.MultiKernelManager.default_kernel_name = 'python3'
# sets a password if PASSWORD is set in the environment
if 'PASSWORD' in os.environ:... | lukealexmiller/docker_devenvs | tensorflow_source/jupyter_notebook_config_py3.py | Python | gpl-3.0 | 515 |
# This file is part of OpenHatch.
# Copyright (C) 2009 OpenHatch, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later v... | jledbetter/openhatch | mysite/profile/migrations/0052_add_old_summary_field_to_citation.py | Python | agpl-3.0 | 14,266 |
from django import template
register = template.Library()
@register.filter
def smart_pages(all_pages, current_page):
all_pages = list(all_pages)
smart_pages = set([
1,
all_pages[-1],
current_page,
max(min(current_page // 2, all_pages[-1]), 1),
max(min(current_page + ((... | drscream/teamvault | src/teamvault/apps/secrets/templatetags/smart_pagination.py | Python | gpl-3.0 | 631 |
import os
import sys
class Factory(object):
def __init__(self):
pass
def get(self):
return True
NAME = "atve.core"
FACTORY = Factory()
| TE-ToshiakiTanaka/atve | atve/library/core/service.py | Python | mit | 163 |
from django.contrib import admin
class ArchiveAdminMixin(admin.ModelAdmin):
exclude = ('b64id', 'deleted_at',) | octaflop/pastryio | apps/pastryio/admin/mixins.py | Python | mit | 116 |
#!/usr/bin/env python
"""
@file Constants.py
@author Remi Domingues
@date 18/06/2013
Constants used by ASTra Python scripts
"""
import os, sys
import re
from math import ceil
from datetime import datetime
import logging
"""
=====================================================================================... | remidomingues/ASTra | astra/constants.py | Python | gpl-3.0 | 11,987 |
import functools
import django
from django.conf import settings
from django.contrib.admin.options import ModelAdmin, csrf_protect_m, InlineModelAdmin
if django.VERSION >= (1, 7):
from django.contrib.admin.utils import (flatten_fieldsets, unquote,
get_deleted_objects)
else:
from django.contrib.admin.util... | philippeowagner/django-hvad | hvad/admin.py | Python | bsd-3-clause | 24,414 |
# py27 vs py34 compatibility
try:
from unittest.mock import MagicMock
except ImportError:
from mock import MagicMock
import unittest
from django.http import QueryDict
from django.conf import settings
# We need to configure Django settings before importing SecureView
# because we are running this test set out... | fmitra/django-rest-secureview | tests/test_view_rules.py | Python | mit | 3,284 |
import logging
import click
import click_log
from flask.cli import with_appcontext
from ..account import github
from . import tasks
from .models import Project
logger = logging.getLogger(__name__)
click_log.basic_config(logger)
@click.command("projects")
@click_log.simple_verbosity_option(logger)
@with_appcontext
... | jazzband/site | jazzband/projects/commands.py | Python | mit | 1,877 |
# 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/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py | Python | mit | 28,583 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
####################################################################################################
#
# Author: wishinlife
# QQ: 57956720
# E-Mail: wishinlife@gmail.com, wishinlife@qq.com
# Web Home: http://syncyhome.duapp.com, http://hi.baidu.com/wishinlife
# Update d... | wwbhl/openwrt | package/syncy/files/usr/bin/syncy.py | Python | mit | 98,343 |
# Copyright (C) 2010-2018 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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 v... | mkuron/espresso | src/python/espressomd/observables.py | Python | gpl-3.0 | 21,633 |
# Copyright 2012 OpenStack Foundation
# Copyright 2013 IBM Corp.
#
# 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... | jonnary/keystone | keystone/tests/unit/test_v3_protection.py | Python | apache-2.0 | 54,812 |
from Board import Board
from Board import Card
import numpy as np
from PIL import Image, ImageGrab
class ScreenParser:
"""
Screen Parser
"""
def __init__(self):
self.recognizer = CardRecognizer()
self.origin = None
def capture_screenshot(self, im_path='screenshot.png'):
im ... | davidxk/SolitaireBot | screenparser.py | Python | mit | 3,066 |
# Copyright 2011 OpenStack 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 ... | maoy/zknova | nova/tests/api/openstack/compute/contrib/test_admin_actions.py | Python | apache-2.0 | 13,648 |
#!/usr/bin/env python
"""
Framework to start a simulated vehicle and connect it to MAVProxy.
Peter Barker, April 2016
based on sim_vehicle.sh by Andrew Tridgell, October 2011
"""
import atexit
import getpass
import optparse
import os
import os.path
import signal
import subprocess
import sys
import tempfile
import ti... | shrkey/ardupilot | Tools/autotest/sim_vehicle.py | Python | gpl-3.0 | 29,504 |
"""Random variable generators.
integers
--------
uniform within range
sequences
---------
pick random element
pick random sample
generate random permutation
distributions on the real line:
------------------------------
uniform
... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.5/Lib/random.py | Python | mit | 30,483 |
# -*- coding: utf-8 -*-
#Copyright (C) David García Granda dgranda@users.sourceforge.net
#Copyright (C) Kevin Dwyer kevin@pheared.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 versio... | viiru-/pytrainer | pytrainer/test/lib/test_gpx.py | Python | gpl-2.0 | 6,062 |
# coding=utf-8
from __future__ import unicode_literals
from collections import defaultdict
from ..node import Node
from ..utils.thread import ThreadLocalObject
class BufferedNode(Node):
def __init__(self, node, callback):
self._node = node
self._callback = callback
self._flushed = False
... | 5monkeys/content-io | cio/pipeline/buffer.py | Python | bsd-3-clause | 1,923 |
# ----- Info ------------------------------------------------------------------
__author__ = 'Michael Montero <mcmontero@gmail.com>'
# ----- Imports ---------------------------------------------------------------
from tinyAPI.base.config import ConfigManager
import logging
import random
import tinyAPI
__all__ = [
... | mcmontero/tinyAPI | base/stats_logger.py | Python | mit | 1,579 |
# Copyright (c) 2021 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import numpy
import math
from typing import List, Optional, TYPE_CHECKING, Any, Set, cast, Iterable, Dict
from UM.Logger import Logger
from UM.Mesh.MeshData import MeshData
from UM.Mesh.MeshBuilder import MeshBuilder
fro... | Ultimaker/Cura | cura/BuildVolume.py | Python | lgpl-3.0 | 65,716 |
import os
import sys
import numpy as np
import glob
import gfs_sublink_utils as gsu
import shutil
import math
import astropy
import astropy.io.fits as fits
#import matplotlib
#import matplotlib.pyplot as plt
import scipy
import scipy.ndimage
#import make_color_image
import numpy.random as random
import congrid
import t... | gsnyder206/mock-surveys | original_illustris/luvoir_udf.py | Python | mit | 31,191 |
import datetime
import math
import os
import logging
from pyproj import transform, Proj
from urlparse import urljoin, urlsplit
from django.db import models
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError
from django.conf import ... | ismailsunni/geonode | geonode/base/models.py | Python | gpl-3.0 | 30,817 |
import inspect
import re
def _hook_add(func, add, name=''):
if not hasattr(func, '_hook'):
func._hook = []
func._hook.append(add)
if not hasattr(func, '_filename'):
func._filename = func.func_code.co_filename
if not hasattr(func, '_args'):
argspec = inspect.getargspec(func)
... | Jeebeevee/DouweBot_JJ15 | plugins_org/util/hook.py | Python | unlicense | 2,904 |
import sys
import os.path
ROOT_DIR = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), os.pardir))
sys.path.append(ROOT_DIR)
import pausable_unittest
import testpauser
import time
import logging
class SampleTest(pausable_unittest.TestCase):
def test_reboot(self):
... | masamitsu-murase/pausable_unittest | test/test.py | Python | mit | 2,724 |
import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="family",
parent_name="contourcarpet.contours.labelfont",
**kwargs
):
super(FamilyValidator, self).__init__(
plotly_name=... | plotly/python-api | packages/python/plotly/plotly/validators/contourcarpet/contours/labelfont/_family.py | Python | mit | 600 |
import codecs
import logging
import json
import os
import unicodedata
import duplicateHash
class classifications:
_FALSE = 0
_MATCH = 1
def __init__(self, gdbm_files, filter_file, category):
self.category = category
self.duplicate_hash = duplicateHash.duplicateHash()
self.filter_f... | electricity345/Full.Text.Classification.Thesis | src/classify.pos.tag/src/classifications.py | Python | mit | 7,221 |
# 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/.
from __future__ import print_function, unicode_literals
import hashlib
import os
import re
import subprocess
import sys... | Yukarumya/Yukarum-Redfoxes | python/mozboot/mozboot/base.py | Python | mpl-2.0 | 22,367 |
"""Problem 49
01 August 2003
The arithmetic sequence, 1487, 4817, 8147, in which each of the terms
increases by 3330, is unusual in two ways: (i) each of the three terms
are prime, and, (ii) each of the 4-digit numbers are permutations of
one another.
There are no arithmetic sequences made up of three 1-, 2-, or 3-di... | feliposz/project-euler-solutions | python/euler49.py | Python | mit | 1,801 |
# 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... | benoitsteiner/tensorflow-xsmm | tensorflow/python/kernel_tests/segment_reduction_ops_test.py | Python | apache-2.0 | 37,722 |
"""
Common utility methods for Mobile APIs.
"""
API_V05 = 'v0.5'
API_V1 = 'v1'
def parsed_version(version):
""" Converts string X.X.X.Y to int tuple (X, X, X) """
return tuple(map(int, (version.split(".")[:3])))
| eduNEXT/edx-platform | lms/djangoapps/mobile_api/utils.py | Python | agpl-3.0 | 223 |
# Localization classes and functions
#
# Copyright (C) 2012-2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program i... | projectatomic/anaconda | pyanaconda/localization.py | Python | gpl-2.0 | 15,233 |
# -*- coding: utf-8 -*-
from django.db.models import Q
from django.contrib.auth.models import User
from crispy_forms.bootstrap import FormActions, PrependedText
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Field, Fieldset, Layout, Reset, Submit
from django.forms import ModelForm
from djang... | MSA-Argentina/relojito_project | relojito/app/forms.py | Python | mit | 7,675 |
from django.shortcuts import render
from django.contrib.auth.models import User
def all_profiles_page(request):
users = User.objects.filter(is_active=True).all()
return render(request, 'profilelist.html', context={'users': users})
def profile_page(request, user_id=1):
try:
user = User.objects.ge... | HeyIamJames/django-imager | imagersite/imagerprofile/views.py | Python | mit | 543 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
# Copyright (c) 2012 dput authors
#
# 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... | Debian/dput-ng | dput/hooks/checksum.py | Python | gpl-2.0 | 1,756 |
#!/usr/bin/env python
#
# This example shows the different aspects of user/team management.
#
import sys
from sdcclient import SdcClient
#
# Parse arguments
#
if len(sys.argv) != 4:
print(('usage: %s <sysdig-token> team-name user-name' % sys.argv[0]))
print('You can find your token at https://app.sysdigcloud... | draios/python-sdc-client | examples/user_team_mgmt.py | Python | mit | 2,675 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.forms import widgets
from django.forms.utils import ErrorDict
from django.utils.translation import ugettext_lazy as _
from django.utils.functional import cached_property
from djng.forms import fi... | nimbis/django-shop | shop/forms/checkout.py | Python | bsd-3-clause | 15,273 |
import math
# Determines the day of the year
# INPUT
# yr: year of interest (ex. 1989)
# month: month of interest (Jan=1...Dec=12)
# day: day (of the month) of interest
# OUTPUT
# dayj: Julian day of the year
def DAYOYR(yr, month, day):
daysinmonth = [0,31,59,90,120,151,181,212,243,273,304,334]
... | allthroughthenight/aces | python/functions/DAYOYR.py | Python | gpl-3.0 | 547 |
# -*- coding: utf-8 -*-
import os
import base64
from StringIO import StringIO
from django.conf import settings
from django.utils import simplejson
from django.core.files.base import ContentFile
from django.db import models, DEFAULT_DB_ALIAS
from django.utils.encoding import smart_unicode
from django.db.models.fields.f... | juanpex/django-model-deploy | model_deploy/serializer.py | Python | bsd-3-clause | 8,172 |
from suds.client import Client
from suds.wsse import *
from suds.sax.element import Element
from suds.sax.attribute import Attribute
from suds.xsd.sxbasic import Import
client1 = Client(url='https://www.bsg.gob.ec/sw/STI/BSGSW08_Acceder_BSG?wsdl')
client = Client(url='https://www.bsg.gob.ec/sw/SENESCYT/BSGSW01_Consult... | mauriciofierrom/testing | service.py | Python | lgpl-3.0 | 2,482 |
import numpy as np
from numpy.random import uniform, randint
from dissimilarity import compute_dissimilarity
if __name__ == '__main__':
n_streamlines = 10000
len_min = 30
len_max = 150
print("Generating random tractography of %s streamlines." %
n_streamlines)
tracks = np.array([uniform(s... | emanuele/dissimilarity | test_dissimilarity.py | Python | mit | 601 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Knem(AutotoolsPackage):
"""KNEM is a Linux kernel module enabling high-performance intra-n... | LLNL/spack | var/spack/repos/builtin/packages/knem/package.py | Python | lgpl-2.1 | 2,617 |
def itemTemplate():
return ['object/tangible/wearables/armor/marauder/shared_armor_marauder_s01_bicep_r.iff','object/tangible/wearables/armor/marauder/shared_armor_marauder_s02_bicep_r.iff','object/tangible/wearables/armor/marauder/shared_armor_marauder_s03_bicep_r.iff']
def customItemName():
return 'Marauder Arm... | agry/NGECore2 | scripts/loot/lootItems/armor/marauder/marauder_armor_bicep_right.py | Python | lgpl-3.0 | 818 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | bolkedebruin/airflow | airflow/providers/google/cloud/hooks/datacatalog.py | Python | apache-2.0 | 54,178 |
from chemlab.core import Atom, Molecule, crystal
from chemlab.graphics.qt import display_system
# Molecule templates
na = Molecule([Atom('Na', [0.0, 0.0, 0.0])])
cl = Molecule([Atom('Cl', [0.0, 0.0, 0.0])])
s = crystal([[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]], # Fractional Positions
[na, cl], # Molecules
... | chemlab/chemlab | examples/nacl.py | Python | gpl-3.0 | 517 |
"""
WSGI config for xdata 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, sys
sys.path.append('/var/www/op_task/xdata')
sys.path.append('/var/www/op_task')
sys.p... | draperlaboratory/stout | xdata/wsgi.py | Python | apache-2.0 | 501 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/odoo_addons_l10n_br | l10n_br_clv_abcfarma/clv_medicament/clv_medicament.py | Python | agpl-3.0 | 1,866 |
# -*- encoding: utf-8 -*-
__author__ = 'ray'
__date__ = '4/21/15'
from stonemason.renderer.engine.grammar import RenderGrammar, DictTokenizer
from stonemason.renderer.engine.context import RenderContext
from stonemason.renderer.cartographer import ImageNodeFactory
class MasonRenderer(object):
def __init__(self... | Kotaimen/stonemason | stonemason/renderer/renderer.py | Python | mit | 662 |
def prime(i, primes):
for prime in primes:
if not (i == prime or i % prime):
return False
primes.append(i)
return i
def find_primes(n):
primes = list()
i, p = 2, 0
while True:
if prime(i, primes):
p += 1
if i == n:
return primes
i += 1
f = open('input.txt', 'r')
f2 = open('output.txt', 'w')
n ... | mihail-morosan/OCAPE | DemoFiles/Basic/Prime/Prime_Sieve.py | Python | apache-2.0 | 390 |
# Copyright 2013 University of Maryland. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE.TXT file.
import sys
import os
import time
import urllib2
import re
import subprocess
import selenium.common.exceptions
import framework
class Exploit (fra... | UMD-SEAM/bugbox | framework/Exploits/OSVDB_88751_MSF.py | Python | bsd-3-clause | 2,462 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-23 15:59
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Cre... | vallemrv/tpvB3 | cloud/ventas/migrations/0001_initial.py | Python | apache-2.0 | 8,139 |
from . import common
import hglib
class test_tags(common.basetest):
def test_basic(self):
self.append('a', 'a')
rev, node = self.client.commit('first', addremove=True)
self.client.tag('my tag')
self.client.tag('local tag', rev=rev, local=True)
# filecache that was introduce... | beckjake/python3-hglib | tests/test-tags.py | Python | mit | 730 |
from django.conf import settings
AUDIO_AUTOPLAY = getattr(settings, "VIDEO_AUTOPLAY", False)
AUDIO_LOOP = getattr(settings, "VIDEO_LOOP", False)
| isotoma/cmsplugin-filer | cmsplugin_filer_audio/settings.py | Python | bsd-3-clause | 148 |
from django.contrib import admin
from .models import Friend
class FriendAdmin(admin.ModelAdmin):
list_display = ('full_name', 'profile_image')
def profile_image(self, obj):
return '<img src="%s" width="50" heith="50">' % obj.photo
profile_image.allow_tags = True
admin.site.register(Friend, Frie... | damianpv/exercise | home/admin.py | Python | gpl-2.0 | 328 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import uuid
from cms.test_utils.project.sampleapp.cms_apps import SampleApp
from cms.test_utils.util.context_managers import apphooks
from django.conf import settings
from django.contrib.sites.models import Site
from django.core import management
from dja... | jsma/django-cms | cms/tests/test_management.py | Python | bsd-3-clause | 27,071 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import inspect
import logging
logging.basicConfig()
log = logging.getLogger("ModuleRegister")
log.setLevel(logging.DEBUG)
MODULE_MAPS = []
def registerModuleMap(module... | Yangqing/caffe2 | caffe2/contrib/playground/ModuleRegister.py | Python | apache-2.0 | 4,206 |
# This file is part of Headphones.
#
# Headphones 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.
#
# Headphones is distributed i... | lepricon49/headphones | headphones/postprocessor.py | Python | gpl-3.0 | 54,020 |
from .common import *
class TestErrorBasics(TestCase):
def test_error_attributes(self):
try:
av.open('does not exist')
except AVError as e:
self.assertEqual(e.errno, 2)
self.assertEqual(e.strerror, 'No such file or directory')
self.assertEqual(e.fil... | danielballan/PyAV | tests/test_errors.py | Python | bsd-3-clause | 499 |
# -*- coding: utf-8 -*-
#
# This file is part of Panucci.
# Copyright (c) 2008-2011 The Panucci Project
#
# Panucci 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 you... | xerxes2/panucci | src/panucci/gtk3ui/gtkplaylist.py | Python | gpl-3.0 | 15,748 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-03 10:42
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0066_school'),
('app', '0066_auto_20160203_1039'),
]
operations = [
]
| malaonline/Server | server/app/migrations/0067_merge.py | Python | mit | 317 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.