text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# coding=utf-8
from safe.common.exceptions import NoAttributeInLayerError
from safe.impact_functions.bases.utilities import check_attribute_exist
__author__ = 'Rizky Maulana Nugraha "lucernae" <lana.pcfre@gmail.com>'
__date__ = '08/05/15'
class ClassifiedVectorExposureMixin(object):
def __init__(self):
... | cchristelis/inasafe | safe/impact_functions/bases/layer_types/classified_vector_exposure.py | Python | gpl-3.0 | 1,719 | 0 |
# Copyright (C) 2010 Trinity Western University
from cube.books.models import Book
from cube.twupass.settings import TWUPASS_LOGOUT_URL
from django.contrib.auth.models import User
from django.contrib import admin
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template, redi... | kd7iwp/cube-bookstore | cube/urls.py | Python | gpl-3.0 | 2,981 | 0.006038 |
'''
https://leetcode.com/problems/path-sum/#/description
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary tree and sum = 22,
5
/ \
4 8
... | jcchuks/MiscCodes | CheckPathSum.py | Python | mit | 2,184 | 0.012821 |
import csv
import math
import numpy as np
from PIL import Image
width = 854
height = 480
fov_multiplier = 1.73 # For 60 degrees, set to 1.73. For 90 degrees, set to 1.
minwh2 = 0.5 * min(width, height)
class Star:
def __init__(self, ra, dec, parallax, g_flux, bp_flux, rp_flux):
self.ra = ra
self... | j3camero/galaxyatlas | data-release-2/render-lmc-frames.py | Python | mit | 5,728 | 0.00419 |
# -*- coding: utf-8 -*-
# Some utils
import hashlib
import uuid
def get_hash(data):
"""Returns hashed string"""
return hashlib.sha256(data).hexdigest()
def get_token():
return str(uuid.uuid4())
| aluminiumgeek/organic | utils.py | Python | lgpl-3.0 | 212 | 0 |
import string
from django.utils.text import slugify
from django.utils.timezone import now
from lxml import html
from lxml.html import tostring
from lxml.html.clean import Cleaner
from cl.lib.string_utils import anonymize, trunc
from cl.search.models import OpinionCluster
from juriscraper.lib.string_utils import clean_... | voutilad/courtlistener | cl/corpus_importer/dup_helpers.py | Python | agpl-3.0 | 14,568 | 0.003089 |
from celery.exceptions import SoftTimeLimitExceeded, TimeLimitExceeded
from urllib.parse import urlparse
from httpobs.conf import (RETRIEVER_CONNECT_TIMEOUT,
RETRIEVER_CORS_ORIGIN,
RETRIEVER_READ_TIMEOUT,
RETRIEVER_USER_AGENT)
from httpobs.s... | april/http-observatory | httpobs/scanner/retriever/retriever.py | Python | mpl-2.0 | 7,939 | 0.004157 |
import unittest
import datetime
import httpretty as HP
import json
from urllib.parse import parse_qsl
from malaysiaflights.aa import AirAsia as AA
class AARequestTests(unittest.TestCase):
def url_helper(self, from_, to, date):
host = 'https://argon.airasia.com'
path = '/api/7.0/search'
... | azam-a/malaysiaflights | malaysiaflights/tests/test_aa.py | Python | mit | 3,889 | 0 |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/pay_period_details.py | Python | mit | 9,216 | 0.000434 |
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
sys.path.append(os.path.dirname(BASE_DIR))
from global_variables import *
from evaluation_helper import *
cls_names = g_shape_names
img_name_file_list = [os.path.join(g_real_images_voc12val_det_bbox_folder, name+'.tx... | ShapeNet/RenderForCNN | view_estimation/run_evaluation.py | Python | mit | 932 | 0.006438 |
# Portions Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# hgweb/__init__.py - web interface to a mercurial repository
#
# Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
# Copyright 2005 ... | facebookexperimental/eden | eden/hg-server/edenscm/mercurial/hgweb/__init__.py | Python | gpl-2.0 | 3,073 | 0 |
import py, sys, platform
import pytest
from testing import backend_tests, test_function, test_ownlib
from cffi import FFI
import _cffi_backend
class TestFFI(backend_tests.BackendTests,
test_function.TestFunction,
test_ownlib.TestOwnLib):
TypeRepr = "<ctype '%s'>"
@staticmethod
... | mhnatiuk/phd_sociology_of_religion | scrapper/build/cffi/testing/test_ffi_backend.py | Python | gpl-2.0 | 9,406 | 0.001701 |
#!/usr/bin/python
# coding: utf-8
class Solution(object):
def convertToTitle(self, n):
"""
:type n: int
:rtype: str
"""
return "" if n == 0 else self.convertToTitle((n - 1) / 26) + chr((n - 1) % 26 + ord('A'))
| Lanceolata/code-problems | python/leetcode/Question_168_Excel_Sheet_Column_Title.py | Python | mit | 255 | 0.003922 |
"""
Imitate the parser representation.
"""
import inspect
import re
import sys
import os
from functools import partial
from jedi._compatibility import builtins as _builtins, unicode
from jedi import debug
from jedi.cache import underscore_memoization, memoize_method
from jedi.parser.tree import Param, Base, Operator, ... | snakeleon/YouCompleteMe-x86 | third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/compiled/__init__.py | Python | gpl-3.0 | 17,309 | 0.000924 |
from __future__ import unicode_literals
import unittest
from ship.datastructures import rowdatacollection as rdc
from ship.datastructures import dataobject as do
from ship.fmp.datunits import ROW_DATA_TYPES as rdt
class RowDataCollectionTests(unittest.TestCase):
def setUp(self):
# Create some object t... | duncan-r/SHIP | tests/test_rowdatacollection.py | Python | mit | 10,219 | 0.002838 |
# coding: utf-8
import os
from setuptools import setup, find_packages
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-nomad-activity-feed',
v... | Nomadblue/django-nomad-activity-feed | setup.py | Python | bsd-3-clause | 1,187 | 0.000843 |
import pytest
from sqlobject import boundattributes
from sqlobject import declarative
pytestmark = pytest.mark.skipif(
True,
reason='The module "boundattributes" and its tests were not finished yet')
class SOTestMe(object):
pass
class AttrReplace(boundattributes.BoundAttribute):
__unpackargs__ = ... | drnlm/sqlobject | sqlobject/tests/test_boundattributes.py | Python | lgpl-2.1 | 1,672 | 0 |
# 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... | panmari/tensorflow | tensorflow/tensorboard/scripts/serialize_tensorboard.py | Python | apache-2.0 | 6,341 | 0.008831 |
# This file is a part of MediaDrop (http://www.mediadrop.net),
# Copyright 2009-2015 MediaDrop contributors
# For the exact contribution history, see the git revision log.
# The source code contained in this file is licensed under the GPLv3 or
# (at your option) any later version.
# See LICENSE.txt in the main project ... | rbu/mediadrop | mediadrop/migrations/versions/004-280565a54124-add_custom_head_tags.py | Python | gpl-3.0 | 1,908 | 0.007862 |
"""Main entry points for scripts."""
from __future__ import print_function, division
from argparse import ArgumentParser
from collections import OrderedDict
from copy import copy
from datetime import datetime
import glob
import json
import logging
import math
import os
import scipy.stats
import numpy as np
from .ve... | snfactory/cubefit | cubefit/main.py | Python | mit | 26,267 | 0.000533 |
#!/usr/bin/env python
# coding=utf-8
import struct
from twisted.internet import defer
from txportal.packet import cmcc, huawei
from txportal.simulator.handlers import base_handler
import functools
class AuthHandler(base_handler.BasicHandler):
def proc_cmccv1(self, req, rundata):
resp = cmcc.Portal.newMess... | talkincode/txportal | txportal/simulator/handlers/auth_handler.py | Python | mit | 1,737 | 0.003454 |
"""Support for Satel Integra zone states- represented as binary sensors."""
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from . import (
CONF_OUTPUTS, CONF_ZONE_NAM... | nugget/home-assistant | homeassistant/components/satel_integra/binary_sensor.py | Python | apache-2.0 | 3,430 | 0 |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework 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
... | jaloren/robotframework | src/robot/libraries/BuiltIn.py | Python | apache-2.0 | 146,969 | 0.001082 |
self.description = "Remove a package required by other packages"
lp1 = pmpkg("pkg1")
self.addpkg2db("local", lp1)
lp2 = pmpkg("pkg2")
lp2.depends = ["pkg1"]
self.addpkg2db("local", lp2)
lp3 = pmpkg("pkg3")
lp3.depends = ["pkg1"]
self.addpkg2db("local", lp3)
lp4 = pmpkg("pkg4")
lp4.depends = ["pkg1"]
self.addpkg2db(... | AWhetter/pacman | test/pacman/tests/remove047.py | Python | gpl-2.0 | 521 | 0 |
class A(Aa):
@property
def <warning descr="Getter signature should be (self)">x<caret></warning>(self, r):
return ""
@x.setter
def <warning descr="Setter should not return a value">x</warning>(self, r):
return r
| asedunov/intellij-community | python/testData/quickFixes/PyUpdatePropertySignatureQuickFixTest/getter.py | Python | apache-2.0 | 245 | 0.053061 |
# Copyright 2018 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... | annarev/tensorflow | tensorflow/python/ops/list_ops.py | Python | apache-2.0 | 14,846 | 0.00714 |
# -*- 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):
# Changing field 'SocialAccount.uid'
db.alter_column(u'socialaccount_soc... | Alexander-M-Waldman/local_currency_site | lib/python2.7/site-packages/allauth/socialaccount/south_migrations/0013_auto__chg_field_socialaccount_uid__chg_field_socialapp_secret__chg_fie.py | Python | gpl-3.0 | 7,605 | 0.00789 |
"""This demo demonstrates how to move the vertex coordinates of a
boundary mesh and then updating the interior vertex coordinates of the
original mesh by suitably interpolating the vertex coordinates (useful
for implementation of ALE methods)."""
# Copyright (C) 2008 Solveig Bruvoll and Anders Logg
#
# This file is pa... | alogg/dolfin | demo/undocumented/ale/python/demo_ale.py | Python | gpl-3.0 | 1,429 | 0.0007 |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~... | bmi-forum/bmi-pyre | pythia-0.8/packages/journal/journal/components/Device.py | Python | gpl-2.0 | 1,235 | 0.006478 |
import random
import datetime
import time
import hashlib
from django.db import models
from django.conf import settings
from django.urls import reverse
from django.contrib.auth.models import User, Group
from django.db.models.signals import post_save
from djangopress.core.models import Property
from django.utils import ... | codefisher/djangopress | djangopress/accounts/models.py | Python | mit | 5,282 | 0.006437 |
#!/usr/bin/env python
#-------------------------------------------------------------------------------
import os
import sys
bin_dir = os.path.dirname(os.path.abspath(__file__))
pkg_dir = os.path.abspath(os.path.join(bin_dir, ".."))
sys.path.append(pkg_dir)
#-----------------------------------------------------------... | r-rathi/ckt-apps | bin/report_net.py | Python | mit | 2,251 | 0.01466 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | DazWorrall/ansible | lib/ansible/modules/network/aci/aci_filter_entry.py | Python | gpl-3.0 | 10,104 | 0.003068 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0021_auto_20171023_1358'),
]
operations = [
migrations.AlterField(
model_name='inductioninterest',
name='age',
field=... | Spoken-tutorial/spoken-website | events/migrations/0022_auto_20171023_1505.py | Python | gpl-3.0 | 2,412 | 0.002488 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2015
#
# STIC - Universidad de La Laguna (ULL) <gesinv@ull.edu.es>
#
# This file is part of Modelado de Servicios TIC.
#
# Modelado de Servicios TIC is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affe... | RocioDSI/Carta-Servicios-STIC | servicios/GeneraNagios.py | Python | agpl-3.0 | 2,787 | 0.024408 |
#!/usr/bin/python
import sys, getopt, os, urllib2
import Overc
from flask import Flask
from flask import jsonify
from flask import request
from flask_httpauth import HTTPBasicAuth
from passlib.context import CryptContext
app = Flask(__name__)
# Password hash generation with:
#python<<EOF
#from passlib.context import... | jwessel/meta-overc | meta-cube/recipes-support/overc-system-agent/files/overc-system-agent-1.2/run_server.py | Python | mit | 11,160 | 0.007437 |
from django.contrib import admin
from . import models
from django_markdown.admin import MarkdownModelAdmin
from django_markdown.widgets import AdminMarkdownWidget
from django.db.models import TextField
# Register your models here.
class SnippetTagAdmin(admin.ModelAdmin):
list_display = ('slug',)
class SnippetAdm... | craigderington/django-code-library | snippets/admin.py | Python | gpl-3.0 | 978 | 0.005112 |
"""
The MIT License (MIT)
Copyright (c) 2015 Robert Hodgen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge... | roberthodgen/thought-jot | src/api_v2.py | Python | mit | 37,593 | 0.000718 |
from setuptools import setup
from ast import literal_eval
def get_version(source='xpclr/__init__.py'):
with open(source) as sf:
for line in sf:
if line.startswith('__version__'):
return literal_eval(line.split('=')[-1].lstrip())
raise ValueError("__version__ not found")
VE... | hardingnj/xpclr | setup.py | Python | mit | 1,538 | 0.0013 |
#!/usr/bin/python
import apt
import apt.progress
import apt_pkg
import logging
import re
import sys
logging.basicConfig(filename1='/var/log/supervisor/rps.log',
format='%(asctime)s %(levelname)s: deb_install: %(message)s',
level=logging.INFO)
logging.getLogger().setLevel(logging.INFO)
class control_p... | bioothod/zbuilder | conf.d/deb_install_build_deps.py | Python | apache-2.0 | 3,249 | 0.004925 |
from django.db import models
from django.utils import timezone
import datetime
class Question(models.Model):
""" Question object model
"""
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self): # __unicode__ on Pyt... | devtronics/heck_site | polls/models.py | Python | agpl-3.0 | 953 | 0.002099 |
#!/usr/bin/python
import simplejson as json
i = open('/proc/cpuinfo')
my_text = i.readlines()
i.close()
username = ""
for line in my_text:
line = line.strip()
ar = line.split(' ')
if ar[0].startswith('Serial'):
username = "a" + ar[1]
if not username:
exit(-1)
o = open('/home/pi/.cgminer/c... | glukolog/calc256 | cgserial.py | Python | gpl-3.0 | 673 | 0.007429 |
from django.conf.urls.defaults import *
from django.contrib import admin
from fumblerooski.feeds import CoachesFeed
feeds = {
'coaches': CoachesFeed,
}
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/coach_totals/', "fumblerooski.college.views.admin_coach_totals"),
url(r'^admin/doc/', incl... | dwillis/fumblerooski | urls.py | Python | bsd-3-clause | 1,591 | 0.005657 |
# -*- coding: utf-8 -*-
'''
(c) Copyright 2013 Telefonica, I+D. Printed in Spain (Europe). All Rights
Reserved.
The copyright to the software program(s) is property of Telefonica I+D.
The program(s) may be used and or copied only with the express written
consent of Telefonica I+D or in accordance with the terms... | hilgroth/fiware-IoTAgent-Cplusplus | tests/e2e_tests/common/gw_configuration.py | Python | agpl-3.0 | 1,230 | 0.017073 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from unittest.mock import Mock, call
from tinyrpc.server import RPCServer
from tinyrpc.transports import ServerTransport
from tinyrpc.protocols import RPCProtocol, RPCResponse
from tinyrpc.dispatch import RPCDispatcher
CONTEXT='sapperdeflap'
RECMSG='out of... | mbr/tinyrpc | tests/test_server.py | Python | mit | 1,748 | 0.006293 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Wout De Nolf (wout.de_nolf@esrf.eu)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software")... | woutdenolf/wdncrunch | wdncrunch/tests/__init__.py | Python | mit | 1,226 | 0.000816 |
#!/usr/bin/env python
"""Grover's quantum search algorithm example."""
from sympy import pprint
from sympy.physics.quantum import qapply
from sympy.physics.quantum.qubit import IntQubit
from sympy.physics.quantum.grover import (OracleGate, superposition_basis,
WGate, grover_iteration)
def demo_vgate_app(v):... | kaushik94/sympy | examples/advanced/grover_example.py | Python | bsd-3-clause | 2,081 | 0.001442 |
# coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import numba
from src_legacy.fourier_series.buffer.ringbuffer import Ringbuffer
@numba.vectorize(nopython=True)
def legendre_recursio... | jaantollander/Convergence-of-Fourier-Series | src_legacy/fourier_series/basis_functions/legendre/fast_evaluation.py | Python | mit | 1,726 | 0 |
# encoding: utf-8
"""
corduroy.config
Internal state
"""
from __future__ import with_statement
import os, sys
from .atoms import odict, adict, Document
# LATER: add some sort of rcfile support...
# from inspect import getouterframes, currentframe
# _,filename,_,_,_,_ = getouterframes(currentframe())[-1]
# print "fro... | samizdatco/corduroy | corduroy/config.py | Python | bsd-3-clause | 1,593 | 0.009416 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Rackspace Hosting
#
# 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... | Havate/havate-openstack | proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/dashboards/project/database_backups/tables.py | Python | apache-2.0 | 3,772 | 0 |
"""
Forum attachments models
========================
This module defines models provided by the ``forum_attachments`` application.
"""
from machina.apps.forum_conversation.forum_attachments.abstract_models import AbstractAttachment
from machina.core.db.models import model_factory
Attachment = model_fa... | ellmetha/django-machina | machina/apps/forum_conversation/forum_attachments/models.py | Python | bsd-3-clause | 346 | 0.00578 |
from nose.tools import eq_, ok_
from remo.base.tests import RemoTestCase
from remo.base.utils import get_date
from remo.profiles.forms import ChangeUserForm, UserStatusForm
from remo.profiles.models import UserStatus
from remo.profiles.tests import UserFactory, UserStatusFactory
class ChangeUserFormTest(RemoTestCase... | mozilla/remo | remo/profiles/tests/test_forms.py | Python | bsd-3-clause | 4,057 | 0.000739 |
"""Public API for Fortran parser.
Module content
--------------
"""
from __future__ import absolute_import
#Author: Pearu Peterson <pearu@cens.ioc.ee>
#Created: Oct 2006
__autodoc__ = ['get_reader', 'parse', 'walk']
from . import Fortran2003
# import all Statement classes:
from .base_classes import EndStatement, cla... | pearu/f2py | fparser/api.py | Python | bsd-3-clause | 7,543 | 0.006364 |
#!/usr/bin/env python3
'''
Make a stream emit at the pace of a slower stream
Pros:
Introduce a delay between events in an otherwise rapid stream (like range)
Cons:
When the stream being delayed runs out of events to push, the zipped stream
will keep pushing events, defined with the lambda fn ... | Pysellus/streaming-api-test | rx-tests/rx-stream-pacing.py | Python | mit | 1,709 | 0.004096 |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | ProfessionalIT/maxigenios-website | sdk/google_appengine/google/appengine/cron/GrocParser.py | Python | mit | 29,691 | 0.00906 |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
# pylint: disable=redefined-builtin,wrong-import-position,wildcard-import,useless-suppression,line-too-long
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('contentstore.management.commands.tests.test_sync_c... | eduNEXT/edunext-platform | import_shims/studio/contentstore/management/commands/tests/test_sync_courses.py | Python | agpl-3.0 | 491 | 0.010183 |
from __future__ import division, print_function
from abc import ABCMeta, abstractmethod
import matplotlib as mpl
mpl.use('TkAgg')
from matplotlib.ticker import MaxNLocator, Formatter, Locator
from matplotlib.widgets import Slider, Button
import matplotlib.patches as patches
import matplotlib.pyplot as plt
from matplotl... | vaquerizaslab/tadtool | tadtool/plot.py | Python | mit | 28,848 | 0.002634 |
from django.db import models
from django.contrib.auth.models import User
class OrganisationType(models.Model):
type_desc = models.CharField(max_length=200)
def __unicode__(self):
return self.type_desc
class Address(models.Model):
street_address = models.CharField(max_length=100)
city = model... | saloni10/librehatti_new | src/authentication/models.py | Python | gpl-2.0 | 1,479 | 0.00879 |
#! /usr/bin/env python
#
# example2_gtk.py -- Simple, configurable FITS viewer.
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
from __future__ import print_function
import sys, os
import logging, logging.handlers
from ginga import AstroImage
from ginga.g... | stscieisenhamer/ginga | ginga/examples/gtk/example2_gtk.py | Python | bsd-3-clause | 8,631 | 0.00139 |
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is dis... | le9i0nx/ansible | test/units/modules/network/mlnxos/mlnxos_module.py | Python | gpl-3.0 | 2,693 | 0.001485 |
"""Various useful tools."""
import copy
import datetime
import logging
# FIXME: temporary backward compatibility
from eaf.core import Vec3 as Point
LOG_FORMAT = (
"[%(asctime)s] %(levelname)-8s %(name)s[%(funcName)s]:%(lineno)s: "
"%(message)s"
)
"""Log message format string."""
TIME_FORMAT = "%H:%M:%S,%03... | pankshok/xoinvader | xoinvader/utils.py | Python | mit | 3,433 | 0 |
# -*- coding: utf-8 -*-
import json
from flask import jsonify
from flask import render_template, request, url_for, redirect
import time, random
#------------------------------------------------------------------------------
def get_desktop_items_data():
"""
Returns items for Desktop in JSON array:
title
... | vsergeyev/os2online | desktop/desktop_items.py | Python | mit | 3,022 | 0.009927 |
#!/usr/bin/env python3
from http.server import HTTPServer, CGIHTTPRequestHandler
port = 8000
httpd = HTTPServer(('', port), CGIHTTPRequestHandler)
print("Starting simple_httpd on port: " + str(httpd.server_port))
httpd.serve_forever()
| fthuin/artificial-intelligence | assignment3/Code/zipremise/SimpleHTTPServer.py | Python | mit | 238 | 0 |
"""
Unittest for time.strftime
"""
import calendar
import sys
import os
import re
from test import test_support
import time
import unittest
# helper functions
def fixasctime(s):
if s[8] == ' ':
s = s[:8] + '0' + s[9:]
return s
def escapestr(text, ampm):
"""
Escape text to deal with possible ... | mancoast/CPythonPyc_test | cpython/266_test_strftime.py | Python | gpl-3.0 | 6,966 | 0.004594 |
# pylint: disable=I0011,C0301
from __future__ import absolute_import, unicode_literals
import os
from setuptools import find_packages, setup
from namespaced_session import __version__
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
# allow setup.py to be run fr... | ckot/django-namespaced-session | setup.py | Python | mit | 1,469 | 0.000681 |
test = {
'name': '',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> type(imdb_by_year) == tables.Table
True
>>> imdb_by_year.column('Title').take(range(3))
array(['The Kid (1921)', 'The Gold Rush (1925)', 'The General (1926)'],
... | jamesfolberth/NGC_STEM_camp_AWS | notebooks/data8_notebooks/lab03/tests/q3_2.py | Python | bsd-3-clause | 530 | 0.003774 |
"""
distutils commands for riak-python-client
"""
from distutils import log
from distutils.core import Command
from distutils.errors import DistutilsOptionError
from subprocess import Popen, PIPE
from string import Template
import shutil
import re
import os.path
__all__ = ['create_bucket_types', 'setup_security', 'en... | GabrielNicolasAvellaneda/riak-python-client | commands.py | Python | apache-2.0 | 15,906 | 0.000063 |
# -*- coding: utf-8 -*-
# Copyright 2015-2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.addons.connector_carepoint.unit import mapper
from .common import SetUpCarepointBase
class TestCarepointImporterMapper(SetUpCarepointBase):
def setUp(self):
super(Te... | laslabs/odoo-connector-carepoint | connector_carepoint/tests/test_carepoint_import_mapper.py | Python | agpl-3.0 | 1,081 | 0 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from PyQt4.QtCore import Qt, QVariant, SIGNAL, QModelIndex, QAbstractItemModel
from PyQt4.QtCore import QString
from PyQt4.QtGui import QColor, QIcon, QStyle, QMessageBox
from PyQt4.Qt import qApp # Fo... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/opus_gui/abstract_manager/models/xml_model.py | Python | gpl-2.0 | 21,520 | 0.002556 |
from setuptools import setup
setup(
name='quotequail',
version='0.2.3',
url='http://github.com/closeio/quotequail',
license='MIT',
author='Thomas Steinacher',
author_email='engineering@close.io',
maintainer='Thomas Steinacher',
maintainer_email='engineering@close.io',
description='A... | elasticsales/quotequail | setup.py | Python | mit | 1,101 | 0.000908 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
class CameraClass(object):
'''
docstring for CameraClass
'''
def __init__(self):
super(CameraClass, self).__init__()
def visible_target(self):
'''
Returns true if target is visible
'''
retur... | twistedretard/LaserSimulatedSecurityTurret | src/turret/camera.py | Python | mit | 620 | 0.001613 |
import sys
import socket
from PyQt5.QtWidgets import QApplication
from qt_DisplayWindow import DisplayWindow
from Server import Server
def main(camID):
hostname = socket.gethostname()
ip_address = socket.gethostbyname_ex(hostname)[2][-1]
print(hostname, ip_address)
port = 12349
app = QApplicat... | natedileas/ImageRIT | Server/qt_main.py | Python | gpl-3.0 | 762 | 0.002625 |
import os
from pathlib import Path
from PIL import Image
import pyconfig
import pydice
class ImageNotSupported(Exception):
pass
class BeardedDie:
def __init__(self, die):
self.die = die
# Time to strap our to_image to pydice's Die
if pyconfig.get('dicebeard.images_path'):
... | nasfarley88/dicebeard | python/dicebeard/skb_roll/beardeddie.py | Python | unlicense | 1,060 | 0 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Group.auth'
db.add_column('people_group', 'auth', self.gf('django.db.models.fields.Boolean... | pizzapanther/Church-Source | churchsource/people/migrations/0013_auto__add_field_group_auth.py | Python | gpl-3.0 | 6,849 | 0.008906 |
from pprint import pprint
from base.models import Colaborador
def get_create_colaborador_by_user(user):
try:
colab = Colaborador.objects.get(user__username=user.username)
except Colaborador.DoesNotExist:
colab = Colaborador(
user=user,
matricula=72000+user.id,
... | anselmobd/fo2 | src/base/queries/models.py | Python | mit | 391 | 0 |
import json
import copy
from util.json_request import JsonResponse
from django.http import HttpResponseBadRequest
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_http_methods
from django_future.csrf import ensure_csrf_cookie
from edxmako.shortcuts import rende... | LICEF/edx-platform | cms/djangoapps/contentstore/views/checklist.py | Python | agpl-3.0 | 6,004 | 0.002665 |
import numpy as np
import sys
R = np.eye(int(sys.argv[2]))
np.savetxt(sys.argv[1]+'/R.txt', R)
| chocjy/randomized-quantile-regression-solvers | hadoop/src/gen_id.py | Python | apache-2.0 | 97 | 0.010309 |
from symbol.builder import FasterRcnn as Detector
from models.dcn.builder import DCNResNetC4 as Backbone
from symbol.builder import Neck
from symbol.builder import RpnHead
from symbol.builder import RoiAlign as RoiExtractor
from symbol.builder import BboxC5V1Head as BboxHead
from mxnext.complicate import normalizer_fac... | TuSimple/simpledet | config/dcn/faster_dcnv2_r50v1bc4_c5_512roi_1x.py | Python | apache-2.0 | 7,639 | 0.004451 |
# -*- coding: utf-8 -*-
"""
:copyright: 2005-2008 by The PIDA Project
:license: GPL 2 or later (see README/COPYING/LICENSE)
"""
import gtk
from pygtkhelpers.delegates import SlaveView
# locale
from pida.core.locale import Locale
locale = Locale('pida')
_ = locale.gettext
class PidaView(SlaveView):
# ... | fermat618/pida | pida/ui/views.py | Python | gpl-2.0 | 1,810 | 0.001105 |
# 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... | DailyActie/Surrogate-Model | 01-codes/tensorflow-master/tensorflow/python/client/notebook.py | Python | mit | 4,766 | 0.002098 |
# Copyright 2013-2019 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 REvd(RPackage):
"""evd: Functions for Extreme Value Distributions"""
homepage = "http... | iulian787/spack | var/spack/repos/builtin/packages/r-evd/package.py | Python | lgpl-2.1 | 597 | 0.00335 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | demis001/scikit-bio | skbio/util/tests/test_decorator.py | Python | bsd-3-clause | 9,694 | 0.000103 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import django_castle
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
version = django_castle.__version__
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
os.system('pytho... | ProReNata/django-castle | setup.py | Python | bsd-3-clause | 1,596 | 0 |
# The MIT License
#
# Copyright (c) 2008 James Piechota
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... | redpawfx/massiveImporter | python/ns/bridge/io/WReader.py | Python | mit | 2,920 | 0.037329 |
# Generated by Django 2.2.11 on 2020-11-09 17:00
import daphne_context.utils
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | seakers/daphne_brain | daphne_context/migrations/0011_auto_20201109_1100.py | Python | mit | 1,011 | 0.002967 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Archive',
fields=[
('id', models.AutoField(verb... | emory-libraries/findingaids | findingaids/fa/migrations/0001_initial.py | Python | apache-2.0 | 1,937 | 0.004646 |
import logging
import inspect
import numpy as np
from pybar.analysis.analyze_raw_data import AnalyzeRawData
from pybar.fei4.register_utils import invert_pixel_mask, make_xtalk_mask, make_pixel_mask
from pybar.fei4_run_base import Fei4RunBase
from pybar.fei4.register_utils import scan_loop
from pybar.run_manager impor... | SiLab-Bonn/pyBAR | pybar/scans/scan_crosstalk.py | Python | bsd-3-clause | 6,325 | 0.004111 |
#!/usr/bin/env python
"""
Parse a file and write output to another.
"""
from optparse import OptionParser
import re
from collections import OrderedDict
parser = OptionParser()
parser.add_option("-i", "--input", dest="input_filepath", help="input filepath")
parser.add_option("-o", "--output", dest="output_filepat... | alexisbellido/programming-in-python | parse_file.py | Python | bsd-3-clause | 1,192 | 0.00755 |
def f(m,n):
ans = 1
while (m - n >= 0):
(ans,m) = (ans*2,m-n)
return(ans)
| selvagit/experiments | nptel/nptel_programming_data_structure/week_1/q3.py | Python | gpl-3.0 | 97 | 0.082474 |
"""Test that resize event works correctly.
Expected behaviour:
One window will be opened. Resize the window and ensure that the
dimensions printed to the terminal are correct. You should see
a green border inside the window but no red.
Close the window or press ESC to end the test.
"""
import unit... | bitcraft/pyglet | tests/interactive/window/event_resize.py | Python | bsd-3-clause | 801 | 0 |
from zope.interface import Interface
class IUWOshThemeLayer(Interface):
"""
Marker interface that defines a browser layer
""" | uwosh/uwosh.themebase | uwosh/themebase/browser/interfaces.py | Python | gpl-2.0 | 138 | 0.014493 |
# Copyright 2006 James Tauber and contributors
# Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
#
# 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/... | anandology/pyjamas | library/gwt/ui/UIObject.py | Python | apache-2.0 | 10,085 | 0.002776 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, print_function, unicode_literals, \
absolute_import
import os
import unittest
from pymatgen.io.lammps.sets import LammpsInputSet
__author__ = 'Kiran Mathew'
__email__ = '... | johnson1228/pymatgen | pymatgen/io/lammps/tests/test_sets.py | Python | mit | 2,130 | 0.000469 |
from csv import DictReader
import os
from rest_framework import status
from rest_framework.viewsets import ViewSet
from rest_framework.exceptions import NotFound
from rest_framework.response import Response
import odatagym_app.settings as ods
import logging
logger = logging.getLogger('odata_gym')
class DatasetsHan... | lucalianas/opendata_gym | odatagym_app/datasets_handler/views.py | Python | mit | 1,158 | 0.002591 |
#!/usr/bin/env python
import re
import os
import time
import sys
import unittest
import ConfigParser
from setuptools import setup, Command
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
class SQLiteTest(Command):
"""
Run the tests on SQLite
"""
description = ... | fulfilio/trytond-waiting-customer-shipment-report | setup.py | Python | bsd-3-clause | 4,152 | 0 |
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings.prod')
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| monovertex/ygorganizer | manage.py | Python | mit | 247 | 0 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2012 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) a... | Panos512/invenio | modules/webaccess/lib/external_authentication_oauth1.py | Python | gpl-2.0 | 8,849 | 0.007232 |
# All nodes are of the form [path1, child1, path2, child2]
# or <value>
from ethereum import utils
from ethereum.db import EphemDB, ListeningDB
import rlp, sys
import copy
hashfunc = utils.sha3
HASHLEN = 32
# 0100000101010111010000110100100101001001 -> ASCII
def decode_bin(x):
return ''.join([chr(int(x[i:i+8],... | EthereumWebhooks/blockhooks | lib/ethereum/tests/bintrie.py | Python | apache-2.0 | 8,042 | 0.000373 |
# Copyright 2010 Ramon Xuriguera
#
# This file is part of BibtexIndexMaker.
#
# BibtexIndexMaker 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 late... | rxuriguera/bibtexIndexMaker | src/bibim/gui/custom_widgets.py | Python | gpl-3.0 | 3,769 | 0.006898 |
#!/usr/bin/python
import urllib2
import json, csv
import subprocess
import sys
import platform
import getopt
all_flag = False
download_flag = False
filename=None
offcore_events=[]
try:
opts, args = getopt.getopt(sys.argv[1:],'a,f:,d',['all','file=','download'])
for o, a in opts:
if o i... | jcmcclurg/serverpower | utilities/intel_pcm/pmu-query.py | Python | gpl-2.0 | 3,641 | 0.014556 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from django.template.response import TemplateResponse
from django.test import TestCase
from django.test.utils import override_settings
from .models import Action
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1... | lzw120/django | tests/regressiontests/admin_custom_urls/tests.py | Python | bsd-3-clause | 3,056 | 0.002291 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.