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 |
|---|---|---|---|---|---|
jvar = 0
def return_something():
return "Hi world"
def change_jvar():
jvar = 18
print(jvar)
def print_jvar():
print(jvar)
print("Called on import! Oops!")
| joelliusp/SpaceHabit | Experiments/ExperimentModule.py | Python | mit | 176 |
#!/usr/bin/python
import sys
import os
import time
s=['100', '500', '1000', '5000', '10000','20000']
jobs=10
job=0
while job < jobs:
for si in s:
command="qsub interact_serial_cuda.sge "+si+" interact_serial_cuda_"+si+".out"
os.system(command)
time.sleep(1)
job+=1
| adpozuelo/Master | HPC/PRA/interact_serial_cuda.py | Python | gpl-3.0 | 298 |
# -*- coding: utf-8 -*-
from stash.tests.stashtest import StashTestCase
class CowsayTests(StashTestCase):
"""tests for cowsay"""
def test_help(self):
"""test help output"""
output = self.run_command("cowsay --help", exitcode=0)
self.assertIn("cowsay", output)
self.assertIn("--... | ywangd/stash | tests/misc/test_cowsay.py | Python | mit | 2,613 |
# -*- coding: utf-8 -*-
"""
info.py --- Collection of functions to get metadata for items
Copyright (C) 2017, Midraal
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... | TheWardoctor/Wardoctors-repo | plugin.video.oculus/resources/lib/util/info.py | Python | apache-2.0 | 29,712 |
'''
Although there is a remote server context already in the main library,
it works under the assumption that users would have a server context
of the following form::
server_context = {
0x00: client('host1.something.com'),
0x01: client('host2.something.com'),
0x02: client('host3.something.... | mjfarmer/scada_py | pymodbus/examples/contrib/remote_server_context.py | Python | gpl-3.0 | 7,458 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Common functions
import os, sys
lib_path = os.path.abspath( os.path.join( '..', '..', 'lib' ) )
sys.path.append(lib_path)
from commons import *
from overpasser import *
from routing import *
from feriados import *
from make_json import *
def lower_capitalized(input):
o... | Skippern/PDF-scraper-Lorenzutti | creators/seletivo/common.py | Python | gpl-3.0 | 1,983 |
# -*- coding: utf-8 -*-
from . import good_turing
class BaseProb(object):
def __init__(self):
self.d = {}
self.total = 0.0
self.none = 0
def exists(self, key):
return key in self.d
def getsum(self):
return self.total
def get(self, key):
if not self.e... | ycchuang/snownlp | snownlp/utils/frequency.py | Python | mit | 1,553 |
"""This module contains classes for ensuring compatibility across multiple
minor versions of Python 3."""
from configparser import ConfigParser as ConfigParser_pre32, ParsingError
from optparse import OptionParser
### ConfigParser
class _Section:
def __init__(self, parent, name):
self.parent = parent
... | bunburya/bunbot | compat.py | Python | mit | 1,991 |
#!/usr/bin/env python
"""
IGWeight.py -
Compute IG Weights given a set of tokenized buckets and a feature set
Marco Lui, January 2013
Based on research by Marco Lui and Tim Baldwin.
Copyright 2013 Marco Lui <saffsd@gmail.com>. All rights reserved.
Redistribution and use in source and binary forms, with or without ... | plamenbbn/XDATA | wordcloud/langid/train/IGweight.py | Python | apache-2.0 | 8,703 |
#!/usr/bin/env python
def format_as_percent(value, total, tpl, *a, **k):
try:
percent = (1.0 * value/total) * 100
a = map(lambda x: str(x), a)
a.append(str("%.2f" % percent))
tpl = tpl + " ({}%)"
return tpl.format(*tuple(a))
except ZeroDivisionError:
return "0 ... | niedbalski/glucose | glucose/helpers.py | Python | gpl-2.0 | 783 |
import math
import data
import squirtle
from vector import *
from vector import Vector as v
from constants import *
class Actor(object):
collides = True
mass = 0
extra_keys = []
def __init__(self, world, pos=(0,0), radius=50, bearing=0, image_file=None, name=None, **kwargs):
self.world = wo... | italomaia/turtle-linux | games/DigbyMarshmallow/lib/actor.py | Python | gpl-3.0 | 9,210 |
'''
Copyright 2016, EMC, Inc.
Author(s):
George Paulos
'''
import fit_path # NOQA: unused import
import os
import sys
import subprocess
import fit_common
# Select test group here using @attr
from nose.plugins.attrib import attr
@attr(all=True, regression=True, smoke=True)
class rackhd11_api_profiles(fit_common.uni... | tannoa2/RackHD | test/tests/rackhd11/test_rackhd11_api_profiles.py | Python | apache-2.0 | 981 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Gaussian Processes regression: basic introductory example
=========================================================
A simple one-dimensional regression exercise with a cubic correlation
model whose parameters are e... | joshbohde/scikit-learn | examples/gaussian_process/plot_gp_regression.py | Python | bsd-3-clause | 2,000 |
# Copyright (C) 2000-2014 Bastian Kleineidam
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distr... | linkcheck/linkchecker | linkcheck/plugins/viruscheck.py | Python | gpl-2.0 | 7,884 |
#!/usr/bin/env python
"""Helper functionality for gui testing."""
import functools
import os
import time
import urlparse
# We have to import test_lib first to properly initialize aff4 and rdfvalues.
# pylint: disable=g-bad-import-order
from grr.lib import test_lib
# pylint: enable=g-bad-import-order
from selenium.co... | pidydx/grr | grr/gui/gui_test_lib.py | Python | apache-2.0 | 23,270 |
# -*- coding: utf-8 -*-
"""
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use Redis on Heroku
"""
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from django.util... | mjj55409/cpq-exporter | config/settings/production.py | Python | mit | 7,354 |
import ast
import time
import matplotlib.pyplot as plt
from plugins.quad_tree import QuadTreeIndex
from plugins.spatial_index_rtree import SpatialIndexRtree
from tools.generate import generate_data
def load_points(dat_file):
with open(dat_file, "r") as points_dat:
return ast.literal_eval(points_dat.read... | gph03n1x/Rend | tools/alg-compare.py | Python | mit | 2,461 |
# Copyright 2018 - Nokia
#
# 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, sof... | openstack/vitrage | vitrage/tests/unit/datasources/kubernetes/test_kubernetes_transformer.py | Python | apache-2.0 | 6,600 |
DEBUG = True
USE_TZ = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'custom_user',
'test_custom_user_subclass',
]
SECRET_KEY = 'not_random'
AUTH_USER_MODEL = 'test_custom_user_subclass.... | dragonfly-science/django-custom-user | test_settings/settings_subclass.py | Python | bsd-3-clause | 339 |
__author__ = 'mpetyx'
from django.contrib import admin
from .models import OpeniSleep
class SleepAdmin(admin.ModelAdmin):
pass
admin.site.register(OpeniSleep, SleepAdmin)
| OPENi-ict/ntua_demo | openiPrototype/openiPrototype/APIS/Activity/Sleep/admin.py | Python | apache-2.0 | 180 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""
"""
__version__ = "$Id$"
#end_pymotw_header
import readline
readline.parse_and_bind('tab: complete')
readline.parse_and_bind('set editing-mode vi')
while True:
line = raw_input('Prompt ("stop" to quit): ')
... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/readline/readline_parse_and_bind.py | Python | gpl-3.0 | 388 |
from __future__ import (absolute_import, division, print_function)
import matplotlib.pyplot as plt
import iris
import iris.quickplot as qplt
import iris.plot as iplt
fname = iris.sample_data_path('air_temp.pp')
temperature_cube = iris.load_cube(fname)
# Get the Purples "Brewer" palette.
brewer_cmap = plt.get_cmap... | Jozhogg/iris | docs/iris/src/userguide/plotting_examples/cube_brewer_cite_contourf.py | Python | lgpl-3.0 | 739 |
#!/usr/bin/python
GAIN_LINEAR = [
0.0, # 0
4.1, # 1
3.1, # 2
2.6, # 3
2.0, # 4
1.5, # 5
1.3, # 6
1.0, # 7
0.770, # 8
0.640, # 9
0.510, # A
0.380, # B
0.320, # C
0.260, # D
0.190, # E
0.160, # F
0.130, # 10
0.096, # 11
0.080, # 12
0.064, # 13
0.048, # 14
0.040, # 15
0.032, # 16
0.024, # 17
0.... | bcharron/spcplayer | gain-rates.py | Python | gpl-3.0 | 1,570 |
import json
import logging
import numpy as np
from kmodes import kprototypes
log = logging.getLogger(__name__)
def analyze(data):
# Convert this to python data for us to be able to run ML algorithms
json_to_python = json.loads(data)
log.debug("****** Analysis #6: IP-URL Input ******")
per_url ... | dscrobonia/sawyer | analyzers/url_requested.py | Python | mit | 4,080 |
# -*- coding:utf-8 -*-
"""my_blog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home,... | daimon99/pyer | my_blog/my_blog/urls.py | Python | gpl-3.0 | 928 |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM Limited
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 ... | geky/pyOCD | pyOCD/target/target_k64f.py | Python | apache-2.0 | 1,186 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | dandv/selenium | py/selenium/webdriver/remote/webelement.py | Python | apache-2.0 | 16,349 |
#!/usr/bin/env python
#
# Copyright (c) 2016-2019 Intel Corporation
#
# 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 a... | Formlabs/tbb | python/tbb/__init__.py | Python | apache-2.0 | 12,553 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | lujinda/iotop | iotop/ui.py | Python | gpl-2.0 | 24,215 |
# Copyright 2012, 2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test maasserver models."""
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
str = None
__metaclass__ = type
__all__ = []
f... | cloudbase/maas | src/maasserver/models/tests/test_node.py | Python | agpl-3.0 | 48,081 |
from zerver.lib.test_classes import WebhookTestCase
class PagerDutyHookTests(WebhookTestCase):
STREAM_NAME = 'pagerduty'
URL_TEMPLATE = "/api/v1/external/pagerduty?api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = 'pagerduty'
def test_trigger(self) -> None:
expected_message = 'Incident [3... | timabbott/zulip | zerver/webhooks/pagerduty/tests.py | Python | apache-2.0 | 4,489 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | abhikeshav/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_atm_vcm_oper.py | Python | apache-2.0 | 72,353 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | Petr-Kovalev/nupic-win32 | tests/integration/py2/nupic/swarming/experiments/spatial_classification/permutations.py | Python | gpl-3.0 | 5,740 |
# This file is part of the ISIS IBEX application.
# Copyright (C) 2012-2016 Science & Technology Facilities Council.
# All rights reserved.
#
# This program is distributed in the hope that it will be useful.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License... | ISISComputingGroup/EPICS-inst_servers | ArchiverAccess/test_modules/__init__.py | Python | bsd-3-clause | 1,336 |
"""Test help output of various IPython entry points"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import IPython.testing.tools as tt
from IPython.testing.decorators import skip_without
def test_ipython_help():
tt.help_all_output_test()
def test_profile... | mattvonrocketstein/smash | smashlib/ipy3x/terminal/tests/test_help.py | Python | mit | 803 |
# 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, ... | datacommonsorg/data | util/statvar_dcid_generator.py | Python | apache-2.0 | 24,622 |
import _plotly_utils.basevalidators
class TicksValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="ticks", parent_name="layout.scene.xaxis", **kwargs):
super(TicksValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/scene/xaxis/_ticks.py | Python | mit | 473 |
import numpy as np
import feed_forward_neural_network as DNN
# todo: this -> Add autodoc
def gradient_cheking(y, theta, forward_prop, back_prop, epsilon=1e-7):
"""
:param y:
:param theta:
:param forward_prop:
:param back_prop:
:param epsilon:
:return:
"""
J_plus, J_minus = forward_... | Infatum/neural-networks | src/test_cases.py | Python | mit | 683 |
#################################################################################$$
# Copyright (c) 2011,2012, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are... | PacificBiosciences/rDnaTools | src/pbrdna/rDnaResequencer.py | Python | bsd-3-clause | 16,747 |
'''
Reads the raw or feature files and performs xgb regression
INPUT FILES:
Train_tfidf_org.csv
Test_tfidf_org.csv
newFeatTrain.csv
newFeatTest.csv
+ (first time only):
train.csv
test.csv
product_descriptions.csv
attributes.csv
train_SynonymDropBox.csv
test_SynonymDropBox.csv
(It proved to be more convinient to com... | hamid-omid/search_relevance | xgb.py | Python | mit | 10,385 |
## Description: class MorphML for loading MorphML from file or xml element into MOOSE
## Version 1.0 by Aditya Gilra, NCBS, Bangalore, India, 2011 for serial MOOSE
## Version 1.5 by Niraj Dudani, NCBS, Bangalore, India, 2012, ported to parallel MOOSE
## Version 1.6 by Aditya Gilra, NCBS, Bangalore, India, 2012, further... | rahulgayatri23/moose-core | python/moose/neuroml/MorphML.py | Python | gpl-3.0 | 40,598 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | hlt-mt/tensorflow | tensorflow/models/rnn/fbk_nmt/seq2seq_model.py | Python | apache-2.0 | 13,619 |
#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under the
# terms of the GNU General Public License as published by ... | RedhawkSDR/integration-gnuhawk | components/probe_avg_mag_sqrd_c/tests/test_probe_avg_mag_sqrd_c.py | Python | gpl-3.0 | 4,083 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | forkbong/qutebrowser | tests/unit/misc/test_sessions.py | Python | gpl-3.0 | 12,363 |
"""
A simple sample of using a wx.Overlay to draw a rubberband effect
"""
import wx
print(wx.version())
class TestPanel(wx.Panel):
def __init__(self, *args, **kw):
wx.Panel.__init__(self, *args, **kw)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
... | dnxbjyj/python-basic | gui/wxpython/wxPython-demo-4.0.1/samples/overlay/overlay.py | Python | mit | 2,662 |
#!/usr/bin/env python
import argparse
import os.path
parser = argparse.ArgumentParser()
parser.add_argument('-d', dest='dir')
parser.add_argument('input')
args = parser.parse_args()
out = os.path.join(args.dir, args.input)
f = open(out, 'w')
f.write('!Generated Fortran file') # python will convert \n to os.linesep
f... | adamryczkowski/puppet-bootstrap | studia/pp_ser.py | Python | gpl-2.0 | 328 |
from django.utils.safestring import mark_safe
from django.conf import settings
from django.core.cache import cache
from django.db.models.loading import get_model
from cms.models import Page
from menus.base import NavigationNode
from menus.menu_pool import menu_pool
from menus.base import Modifier
from arkestra_utili... | evildmp/Arkestra | arkestra_utilities/menu.py | Python | bsd-2-clause | 8,488 |
# This is a helper for the win32trace module
# If imported from a normal Python program, it sets up sys.stdout and sys.stderr
# so output goes to the collector.
# If run from the command line, it creates a collector loop.
# Eg:
# C:>start win32traceutil.py (or python.exe win32traceutil.py)
# will start a pr... | zhanqxun/cv_fish | win32/lib/win32traceutil.py | Python | apache-2.0 | 1,528 |
"""Project metadata
Information describing the project.
"""
# The package name, which is also the "UNIX name" for the project.
package = 'pykey'
project = "Chorded Keyboard for AlphaGrip"
project_no_spaces = project.replace(' ', '')
version = '0.1'
description = 'It does cool things'
authors = ['Guillaume Lederrey']
... | gehel/pykey | pykey/metadata.py | Python | mit | 493 |
# -*- coding: utf-8 -*-
# pylint: disable=wildcard-import,redefined-builtin,unused-wildcard-import
from __future__ import absolute_import, division, print_function
from builtins import *
# pylint: enable=wildcard-import,redefined-builtin,unused-wildcard-import
import numpy as np
import pandas as pd
import pytest
fro... | jrderuiter/genemap | tests/test_genemap.py | Python | mit | 4,212 |
#!/usr/bin/env python
import pyzfm20x
VERSION = '0.1'
| garyservin/python-zfm20x | pyzfm20x/__init__.py | Python | mit | 56 |
from __future__ import absolute_import
from django.template.loader import get_template
from django.template import Context
from celery.schedules import crontab
import celery
import collections
from arxiv import feed, models, time
CELERYBEAT_SCHEDULE = {
# Executes on weekdays every 15 minutes (timezones are space... | hbristow/django-arxiv | arxiv/tasks.py | Python | bsd-3-clause | 1,705 |
"""
Get/Insert library metrics
"""
import logging
import os
import re
from .. import parsing
from .. import database
from .. import postprocessing
from .. import model as docs
logger = logging.getLogger(__name__)
class LibraryMetricsAnnotator(object):
"""
Identifies, stores, and updates information about li... | BenaroyaResearch/bripipetools | bripipetools/annotation/librarymetrics.py | Python | mit | 3,172 |
# -*- coding: utf-8 -*-
import sys, os
import codecs
import json
sys.path.insert(1, os.path.join(sys.path[0], os.path.pardir))
from json_utils import load_json_file, load_json_stream
def main(orig, src, fpath, dst):
fid2struct = load_json_file(fpath)
with open(src) as fin:
fin.readline() # ignore the... | murawaki/comp-typology | scripts/mv/tsv2json.py | Python | bsd-3-clause | 1,007 |
# package.py
# Module defining the dnf.Package class.
#
# 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... | rholy/dnf | dnf/package.py | Python | gpl-2.0 | 6,052 |
from Ensemble.Ensemble import Ensemble
from log import logger
class EarthVelocity:
"""
Earth Velocity DataSet.
[Bin x Beam] data.
"""
def __init__(self, num_elements, element_multiplier):
self.ds_type = 10
self.num_elements = num_elements
self.element_multiplier = element_... | ricorx7/rti_python | Ensemble/EarthVelocity.py | Python | bsd-3-clause | 1,316 |
import os
import dj_database_url
INSTALLED_APPS = ('inventory',)
MIDDLEWARE_CLASSES = ()
SECRET_KEY = os.environ.get('SECRET_KEY', '*q5ne7-4=vlewvfv8von1peb!+(dsk2&n364f()54i^mv2lz4y')
DATABASES = {
'default': dj_database_url.parse(os.environ.get('DATABASE_URL', 'postgres://localhost/inventory')),
}
| opennorth/inventory | inventory/settings.py | Python | mit | 307 |
# -*- coding: utf-8 -*-
from sdl2 import SDL_Rect,\
SDL_RenderCopy
from sdl2.ext import Resources
from const import WindowSize
from utils import dice
RESOURCES = Resources(__file__, 'resources')
class MotionType:
STANDING = 0
WALKING = 1
COUNT = 1
class Facing:
LEFT_DOWN = 0
DOWN = 1
... | ep0s/soulmaster | enemy.py | Python | gpl-3.0 | 4,469 |
""" module for performing various sorts of geocoding related tasks """
import urllib
import json
from settings import LOCATION_BOUNDS, LOCATION_COMPONENTS
def geocode_address(address):
"""
takes an address as a string and returns a tuple of latitude,
longitude and neighborhood in float format.
if g... | steventlamb/vegphilly.com | vegancity/geocode.py | Python | gpl-3.0 | 1,606 |
from django.urls import url, include, path
from rest_framework import routers
from users import views
# router = routers.DefaultRouter()
# router.register(r'users', views.UserViewSet)
# router.register(r'groups', views.GroupViewSet)
#
# # Wire up our API using automatic URL routing.
# # Additionally, we include login ... | indrz/indrz | indrz/users/urls.py | Python | gpl-3.0 | 1,054 |
import sys
from interface.Movie import Movies
from interface.Projections import Projection
from interface.User import Users
from interface.Reservation import Reservation
import interface.interface as interface
from database.connection.database_connection import Database
from settings.SharedVariables import SharedVa... | BrickText/JHROM | interface/main_menu.py | Python | mit | 7,871 |
# -*- coding:utf-8 -*-
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 ... | tipabu/swift | test/unit/common/test_memcached.py | Python | apache-2.0 | 37,888 |
"""
Utility functions for retrieving and generating forms for the
site-specific user profile model specified in the
``AUTH_PROFILE_MODULE`` setting.
"""
from django import forms
from django.conf import settings
from django.contrib.auth.models import SiteProfileNotAvailable
from django.db.models import get_model
def... | ttreeagency/PootleTypo3Org | pootle/apps/profiles/utils.py | Python | gpl-2.0 | 1,468 |
#!/usr/bin/env python
# Copyright 2018 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Generate library file with compressed symbols per Android build
# process.
# https://www.ece.villanova.edu/VECR/doc/gdb/MiniD... | youtube/cobalt | third_party/angle/android/compress_symbols.py | Python | bsd-3-clause | 3,635 |
from django.conf.urls import patterns, url
urlpatterns = patterns(
'',
url(r'^race_summary/', 'censusdata.views.race_summary_http', name='race_summary'),
url(r'^race_summary_csv/', 'censusdata.views.race_summary_csv', name='race_summary_csv'),
)
| mehtadev17/mapusaurus | mapusaurus/censusdata/urls.py | Python | cc0-1.0 | 259 |
from django.test import TestCase
from django.core.exceptions import FieldError
from regressiontests.null_queries.models import *
class NullQueriesTests(TestCase):
def test_none_as_null(self):
"""
Regression test for the use of None as a query value.
None is interpreted as an SQL NULL, b... | mzdaniel/oh-mainline | vendor/packages/Django/tests/regressiontests/null_queries/tests.py | Python | agpl-3.0 | 2,893 |
# -*- coding: utf-8 -*
from __future__ import unicode_literals
from django.test import TestCase
from django.utils.text import slugify
from wagtail.wagtailcore.utils import cautious_slugify
class TestCautiousSlugify(TestCase):
def test_behaves_same_as_slugify_for_latin_chars(self):
test_cases = [
... | mayapurmedia/wagtail | wagtail/wagtailcore/tests/test_utils.py | Python | bsd-3-clause | 1,287 |
import logging
from django.shortcuts import get_object_or_404
from docutils.utils.math.math2html import Link
from rest_framework import decorators, permissions, viewsets, status
from rest_framework.decorators import detail_route
from rest_framework.renderers import JSONPRenderer, JSONRenderer, BrowsableAPIRenderer
fro... | sils1297/readthedocs.org | readthedocs/restapi/views/model_views.py | Python | mit | 7,662 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2013, Matt Hite <mhite@hotmail.com>
#
# 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 Licens... | bearstech/ansible | lib/ansible/modules/network/f5/bigip_pool_member.py | Python | gpl-3.0 | 17,994 |
from collections import OrderedDict
class DefaultOrderedDict(OrderedDict):
def __missing__(self, key):
self[key] = type(self)()
return self[key]
d=DefaultOrderedDict()
d['a']['c']['d']=1234
d['as'][4][2]='sdf'
d[3][4][2]=322
print [(i, j, k, d[i][j][k]) for i in d for j in d[i] for k in d[i][j]]
it... | praveendareddy21/my-repo | ordict.py | Python | mit | 1,021 |
import discord
from discord.ext import commands
import asyncio
import datetime
import __main__
import math
# pip install PyNaCl
# pip install youtube-dl
# requires the appropriate opus library in the same dir
# requires opus to be installed, apt-get install libopus0, or pacman -S opus
# this script was originally wri... | matthew-morrison/discord-bot | tunes.py | Python | mit | 16,556 |
#Exercício 7
#Faça um algoritmo que leia 3 números inteiros e imprima o menor deles.
num1 = int(input('Informe o primeiro número: '))
num2 = int(input('Informe o segundo número: '))
num3 = int(input('Informe o terceiro número: '))
menor = num1;
if(num2 < menor):
menor = num2
if(num3 < menor):
menor = num3
... | elmoneto/eng-civil-2017-2 | lista2/ex7.py | Python | gpl-3.0 | 368 |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
def home(request):
"""The home page"""
return render(request, 'home.html')
def link1(request):
"""A New Page #1"""
return render(request, 'link1.html')
def link2(request):
"""A New Page #2"""
ret... | katyauchter/nyc-el | el/el/views.py | Python | agpl-3.0 | 438 |
import os
import sys
import time
import unittest
sys.path.append('../..')
import spade
host = "127.0.0.1"
class MyAgent(spade.Agent.Agent):
def _setup(self):
self.pi = None
self.msg = None
class GetPIBehav(spade.Behaviour.OneShotBehaviour):
def _process(self):
self.myAgent.pi = self.myAgent.getPlatfor... | exic/spade2 | examples/unittests/basicTestCase.py | Python | lgpl-2.1 | 4,485 |
import six
import sqlalchemy as sa
from sqlalchemy_utils import TSVectorType
from tests import TestCase
class TestTSVector(TestCase):
dns = 'postgres://postgres@localhost/sqlalchemy_utils_test'
def create_models(self):
class User(self.Base):
__tablename__ = 'user'
id = sa.Colu... | joshfriend/sqlalchemy-utils | tests/types/test_tsvector.py | Python | bsd-3-clause | 1,693 |
#!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation ... | arseneyr/essentia | test/src/unittest/standard/test_scale.py | Python | agpl-3.0 | 2,054 |
# -*- coding: utf-8 -*-
"""
Utilities for truncating assertion output.
Current default behaviour is to truncate assertion explanations at
~8 terminal lines, unless running in "-vv" mode or running on CI.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
i... | kawamon/hue | desktop/core/ext-py/pytest-4.6.11/src/_pytest/assertion/truncate.py | Python | apache-2.0 | 3,399 |
"""
Deuce Global
"""
context = None
import os
import sys
from configobj import ConfigObj
from validate import Validator
CONFIG_FILENAME = 'config.ini'
CONFIGSPEC_FILENAME = 'configspec.ini'
# This path is the path that is created when we
# have a virtual environment, or typically '/var' if
# we are installed in the ... | rackerlabs/deuce | deuce/__init__.py | Python | apache-2.0 | 2,540 |
# Copyright 2015 Reliance Jio Infocomm Ltd
#
# 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 ... | openstack/ceilometer | ceilometer/tests/unit/objectstore/test_rgw.py | Python | apache-2.0 | 7,723 |
#
# Copyright 2015-2019, Institute for Systems Biology
#
# 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 ... | isb-cgc/ISB-CGC-Webapp | scripts/bigquery/bq_load_filtered_list.py | Python | apache-2.0 | 11,025 |
# -*- coding: utf-8 -*-
from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class FshareVnFolder(SimpleCrypter):
__name__ = "FshareVnFolder"
__type__ = "crypter"
__version__ = "0.01"
__pattern__ = r'http://(?:www\.)?fshare\.vn/folder/.+'
__config__ = [("use_pre... | Zerknechterer/pyload | module/plugins/crypter/FshareVnFolder.py | Python | gpl-3.0 | 852 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import errno
import os
import re
import shutil
import subprocess
qtPath = None
verbose = False
def splitPath(path):
folders = []
while True:
path, folder = os.path.split(path)
if folder != '':
folders.append(folder)
else:
if pat... | Anty-Lemon/mgba | tools/deploy-mac.py | Python | mpl-2.0 | 5,460 |
# -*- coding: utf-8 -*-
from myutil import consolePrintWithLineNumber as c
'''
Created on 2015. 8. 12.
@author: Administrator
'''
'''
ch02 필드
'''
# 46p
from math import e
from math import pi
from GF2 import one
from image import color2gray
from image import file2image
from plotting import plot
c(1 + 3j)... | imsukmin/codingTheMatrix | chap2_the_field/chap2cheat.py | Python | mit | 7,388 |
import os
import yaml
import logging
import strategyCollector
import parameterCollector
import copy
from include_generator.IncludeGenerator import IncludeGenerator
from autosim.SimulationAutomator import SimulationAutomator
import pprint
from missile.classes.event import Event
from missile.classes.strategy import Stra... | ClockworkOrigins/m2etis | configurator/configurator/Configurator.py | Python | apache-2.0 | 8,047 |
class InvalidKeywordNames(object):
def __init__(self, hybrid=False):
if not hybrid:
self.run_keyword = lambda *args: None
def get_keyword_names(self):
return 1
| alexandrul-ci/robotframework | atest/testdata/test_libraries/dynamic_libraries/InvalidKeywordNames.py | Python | apache-2.0 | 198 |
from __future__ import division
from collections import defaultdict, deque
from heapq import heappush, heappop
from sys import stdin
from math import sqrt
def sqrtInt(n):
l, r = 1, n + 1
while r - l > 1:
mid = (l + r) // 2
if mid * mid > n:
r = mid
else:
l = mid
... | m00nlight/hackerrank | algorithm/Number-Theory/Dancing-in-Pairs/main.py | Python | gpl-2.0 | 518 |
from pymongo import MongoClient
import pymongo
from apps.messages.backends.redis import RedisMessagesInterface
from apps.messages.interface import MessagesInterfaceAbstract
__author__ = 'kollad'
HOST = 'localhost'
PORT = 27017
DB = 'turbo_ninja'
COLLECTION = 'messages'
class MongoMessagesInterface(MessagesInterface... | kollad/turbo-ninja | apps/messages/backends/mongo.py | Python | mit | 2,210 |
from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import NoArgsCommand
from docutil.commands_util import recocommand
from docutil.str_util import smart_decode
from recommender.actions import compute_remove_reco
class Command(NoArgsCommand):
option_list = No... | bartdag/recodoc2 | recodoc2/apps/recommender/management/commands/computeremoverecs.py | Python | bsd-3-clause | 1,782 |
# -*- coding: utf-8 -*-
import pytest
import validators
@pytest.mark.parametrize(('value', 'min', 'max'), [
(12, 11, 13),
(12, None, 14),
(12, 11, None),
(12, 12, 12)
])
def test_returns_true_on_valid_range(value, min, max):
assert validators.between(value, min=min, max=max)
@pytest.mark.parame... | kvesteri/validators | tests/test_between.py | Python | mit | 863 |
from tkinter import *
from tkinter import messagebox
class BottomController():
def __init__(self, canvas, unit):
self.canvas = canvas
self.unit = unit
###--- drawButtonsBottom ---###
lightLimit = unit.getLightLimit()
tempLimit = self.unit.getTempLimit()
rollDownLimit = round((self.unit.getCommand(25) / ... | femkeh/project2-1 | python/BottomController.py | Python | gpl-3.0 | 5,295 |
#############################################################################
##
## Copyright (C) 2015 The Qt Company Ltd.
## Contact: http://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 wit... | kuba1/qtcreator | tests/system/suite_general/tst_build_speedcrunch/test.py | Python | lgpl-2.1 | 3,768 |
#!/usr/bin/env python
"""
@package coverage_model.coverage_search
@file coverage_model/coverage_search.py
@author Casey Bryant
@brief Interfaces and implementations for finding coverages that match criteria
"""
__author__ = 'casey'
from ooi.logging import log
import numpy as np
from search_parameter import SearchCri... | ooici/coverage-model | coverage_model/search/coverage_search.py | Python | bsd-2-clause | 10,043 |
import sys,string
import os
def makeTestFile():
all_data = [['name','harold','bob','frank','sally','kim','jim'],
['a','0','0','1','2','0','5'],['b','0','0','1','2','0','5'],
['c','0','0','1','2','0','5'],['d','0','0','1','2','0','5']]
input_file = 'test.txt'
export_object = open(input_... | wuxue/altanalyze | sampleIndexSelection.py | Python | apache-2.0 | 8,608 |
#!/usr/bin/python
# Module: scipy_fft_peak.py
# Purpose: compute FFT and plot results
# Date: N/A
# Notes:
# 1) Test python code
# 2) This uses scipy and matplotlib, pkgs must be loaded
# as they are not default....
# 3) This uses peak estimation:
# https://ccrma.stanford.edu/~jos/sasp/Quadratic_... | wadester/wh_test_py | scipy_fft_peak.py | Python | gpl-2.0 | 1,848 |
from django.contrib import admin
from .models import Prospect, Account
# Register your models here.
class ProspectInline(admin.TabularInline):
model = Prospect
extra = 3
class AccountAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['account_name']}),
('Date information', {'fields... | helanan/Panda_Prospecting | panda_prospecting/prospecting/admin.py | Python | mit | 1,287 |
# nxt.__init__ module -- LEGO Mindstorms NXT python package
# Copyright (C) 2006 Douglas P Lau
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your o... | xarg/nxtpython | nxt/__init__.py | Python | gpl-2.0 | 590 |
# -*- coding: utf-8 -*-
"""The tgapp-flatpages package"""
import tg
def plugme(app_config, options):
config = {'templates': options.get('templates', [('kajiki:flatpages.templates.page', 'default')]),
'format': options.get('format', 'html')}
try:
app_config['_flatpages'] = config
exce... | amol-/tgapp-flatpages | flatpages/__init__.py | Python | mit | 589 |
#!BPY
"""
Name: 'MD2 -new- (.md2)...'
Blender: 245
Group: 'Export'
Tooltip: 'Export to Quake2 file format (.md2) -new-'
"""
__version__ = '0.1'
__author__ = [ 'Damien Thébault', 'Erwan Mathieu' ]
__url__ = [ 'https://metabolsim.no-ip.org/trac/metabolsim' ]
__email__ = [ 'Damien Thébault <damien!thebault#lapost... | Qazzian/ufoai_suspend | src/tools/blender/export_md2_new.py | Python | gpl-2.0 | 21,886 |
from __future__ import division
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ---------------... | squirrelo/qiita | qiita_ware/test/test_ebi.py | Python | bsd-3-clause | 66,383 |
# Copyright 2012, Red Hat, 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 agr... | alexandrucoman/vbox-nova-driver | nova/tests/unit/compute/test_rpcapi.py | Python | apache-2.0 | 49,349 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.