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 |
|---|---|---|---|---|---|---|
version = (2, 0, 0)
VERSION = "%d.%d.%d" % version
| KlausPopp/Moddy | src/moddy/version.py | Python | lgpl-3.0 | 51 | 0 |
#
# Copyright 2015 Fasih
#
# 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... | faskiri/barry2gugl | dn.py | Python | apache-2.0 | 3,915 | 0.02069 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('carts', '0006_auto_20150930_1739'),
('carts', '0005_auto_20151022_2158'),
]
operations = [
]
| abhijitbangera/ecommerce | src/carts/migrations/0007_merge.py | Python | mit | 293 | 0 |
"""
A small Sphinx extension that adds Domain objects (eg. Python Classes & Methods) to the TOC Tree.
It dynamically adds them to the already rendered ``app.env.tocs`` dict on the Sphinx environment.
Traditionally this only contains Section's,
we then nest our Domain references inside the already existing Sections.
""... | rtfd/sphinx-autoapi | autoapi/toctree.py | Python | mit | 5,871 | 0.001533 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Grid Dynamics
# 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/l... | TieWei/nova | nova/virt/libvirt/imagebackend.py | Python | apache-2.0 | 23,315 | 0.000815 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_huff_darklighter.iff"
result.attribute_template_id = 9
result... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_huff_darklighter.py | Python | mit | 452 | 0.04646 |
floor = 0
with open('../input.txt', 'r') as fp:
while True:
buffer = fp.read(1024)
if buffer is None or len(buffer) <= 0:
break
for c in buffer:
if c == '(':
floor += 1
elif c == ')':
floor -= 1
print floor
| tosmun/AdventOfCode | solutions/day1/p1/main.py | Python | apache-2.0 | 233 | 0.042918 |
# repo.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from git.exc import InvalidGitRepositoryError, NoSuchPathError
from git.cmd import Git
from git.util im... | dbaxa/GitPython | git/repo/base.py | Python | bsd-3-clause | 30,180 | 0.00666 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/applications_health_evaluation.py | Python | mit | 2,699 | 0.002223 |
#!/usr/bin/env python
## \file adjoint.py
# \brief python package for running adjoint problems
# \author T. Lukaczyk, F. Palacios
# \version 5.0.0 "Raven"
#
# SU2 Original Developers: Dr. Francisco D. Palacios.
# Dr. Thomas D. Economon.
#
# SU2 Developers: Prof. Juan J. Alonso's group at St... | pawhewitt/Dev | SU2_PY/SU2/run/adaptation.py | Python | lgpl-2.1 | 2,501 | 0.015194 |
#! /usr/bin/env python
import sys
from ete2 import Tree
import random
def get_json(node):
# Read ETE tag for duplication or speciation events
if not hasattr(node, 'evoltype'):
dup = random.sample(['N', 'Y'], 1)[0]
elif node.evoltype == "S":
dup = "N"
elif node.evoltype == "D":
... | Phelimb/atlas | scripts/newick2json.py | Python | mit | 1,160 | 0 |
""" Python Character Mapping Codec iso8859_13 generated from 'MAPPINGS/ISO8859/8859-13.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self... | Hasimir/brython | www/src/Lib/encodings/iso8859_13.py | Python | bsd-3-clause | 13,578 | 0.020916 |
from dependencies.dependency import ModuleSecurityInfo#, #allow_module
from dependencies.dependency import DateTime
from dependencies.dependency import DisplayList
from dependencies.dependency import getToolByName
from dependencies.dependency import TranslationServiceTool
from lims.browser import BrowserView
from lims ... | yasir1brahim/OLiMS | lims/idserver.py | Python | agpl-3.0 | 8,055 | 0.003228 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11b1 on 2017-06-23 09:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gwasdb', '0006_auto_20170623_0933'),
]
operations = [
migrations.AddField(
... | 1001genomes/AraGWAS | aragwas_server/gwasdb/migrations/0007_study_n_hits_thr.py | Python | mit | 462 | 0 |
import codecs
import os
from setuptools import setup, find_packages
def read(filename):
filepath = os.path.join(os.path.dirname(__file__), filename)
return codecs.open(filepath, encoding='utf-8').read()
setup(
name='lemon-filebrowser',
version='0.1.2',
license='ISC',
description="Fork of Pat... | trilan/lemon-filebrowser | setup.py | Python | bsd-3-clause | 998 | 0 |
from astrodata.ReductionObjects import PrimitiveSet
class OBSERVEDPrimitives(PrimitiveSet):
astrotype = "OBSERVED"
def init(self, rc):
print "OBSERVEDPrimitives.init(rc)"
return
def typeSpecificPrimitive(self, rc):
print "OBSERVEDPrimitives::typeSpecificPrimitive()"
... | pyrrho314/recipesystem | trunk/astrodata/samples/astrodata_Sample/RECIPES_Sample/primitives/primitives_OBSERVED.py | Python | mpl-2.0 | 968 | 0.007231 |
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
def t... | dimven/SpringNodes | py/Element.IsCut.py | Python | mit | 932 | 0.032189 |
#!/usr/bin/python
# Copyright (c) 2016 Red Hat
#
# 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 agree... | openstack/renderspec | renderspec/distloader.py | Python | apache-2.0 | 2,522 | 0 |
# The following YAML grammar is LL(1) and is parsed by a recursive descent
# parser.
#
# stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
# implicit_document ::= block_node DOCUMENT-END*
# explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
# block_node_o... | croxis/SpaceDrive | spacedrive/renderpipeline/rplibs/yaml/yaml_py2/parser.py | Python | mit | 26,131 | 0.002334 |
"""Scans and sanitzes HAR files containing sensitive information."""
# Copyright 2017, Google Inc.
# Authors: Garrett Anderson
#
# 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://w... | google/har-sanitizer | harsanitizer/harsan_api.py | Python | apache-2.0 | 7,146 | 0.012175 |
import unittest
import re
import requests
from .timeschedules_parser import FSM
class TestTimeschedulesParser(unittest.TestCase):
def _construct_fsm(self, string):
fsm = FSM([])
def stub(*args, **kwargs):
return string
fsm.next_string = stub
return fsm
def test_... | kelly-shen/canigraduate.uchicago.edu | backend/uchicago/src/timeschedules_parser_test.py | Python | mit | 1,945 | 0 |
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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, ... | pombredanne/invenio | modules/webaccess/lib/access_control_firerole.py | Python | gpl-2.0 | 15,550 | 0.007203 |
from sense_hat import SenseHat
sense = SenseHat()
X = [255, 0, 0] # Red
O = [255, 255, 255] # White
up_arrow = [
O, O, O, X, X, O, O, O,
O, O, X, X, X, X, O, O,
O, X, X, X, X, X, X, O,
O, O, O, X, X, O, O, O,
O, O, O, X, X, O, O, O,
O, O, O, X, X, O, O, O,
O, O, O, X, X, O, O, O,
O, O, O, X, X, O, O, O
]
sense.set_... | seattleacademy/fall27 | arrowup.py | Python | mit | 336 | 0.029762 |
"""
Copyright (C) 2014 Maruf Maniruzzaman
Website: http://cosmosframework.com
Author: Maruf Maniruzzaman
License :: OSI Approved :: MIT License
"""
| kuasha/cosmos | cosmos/schema/object.py | Python | mit | 154 | 0.006494 |
import gizeh
surface = gizeh.Surface(width=320, height=260)
circle = gizeh.circle (r=40, # radius, in pixels
xy= [156, 200], # coordinates of the center
fill= (1,0,0)) # 'red' in RGB coordinates
circle.draw( surface ) # draw the circle on the surface
surface.get_npimage() #... | mmenz/michaelmenz | spare-parts/animatedgifs.py | Python | apache-2.0 | 420 | 0.033333 |
# -*- coding=utf-8 -*-
import sys
import time
import logging
import os
sys.path.append(os.getcwd())
logging.basicConfig()
from hammer.sqlhelper import SqlHelper
db_config = {
'host': 'localhost',
'port': 3306,
'user': 'root',
'password': '123456',
'db': 'test',
}
def test_create_table():
c... | awolfly9/hammer | test/test.py | Python | mit | 2,505 | 0.004391 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
f... | twilio/twilio-python | twilio/rest/insights/v1/setting.py | Python | mit | 7,805 | 0.000769 |
#!Measurement
# all of this is configuration info that can be used in the script.
# you refer to these values using mx.<group>.<attribute>
# e.g
# mx.baseline.counts is 180
# mx.multicollect.detector is H1
'''
baseline:
after: true
before: false
counts: 180
detector: H1
mass: 34.2
settling_time: 15
d... | USGSDenverPychron/pychron | docs/user_guide/operation/scripts/examples/basic.py | Python | apache-2.0 | 2,487 | 0.002413 |
"""Support for VOC."""
from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity
from . import DATA_KEY, VolvoEntity
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Volvo sensors."""
if discovery_info is None:
return
... | tboyce021/home-assistant | homeassistant/components/volvooncall/binary_sensor.py | Python | apache-2.0 | 856 | 0.002336 |
from crystal_filter_middleware.handlers import CrystalBaseHandler
from swift.common.swob import HTTPMethodNotAllowed
from swift.common.wsgi import make_subrequest
from swift.common.utils import public
import operator
import json
import copy
import urllib
import os
import re
mappings = {'>': operator.gt, '>=': operator... | Crystal-SDS/filter-middleware | crystal_filter_middleware/handlers/proxy.py | Python | gpl-3.0 | 13,744 | 0.001237 |
# Copyright (c) 2015 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 w... | sc68cal/neutron-classifier | neutron_classifier/db/models.py | Python | apache-2.0 | 5,550 | 0 |
# coding=utf-8
"""
Collector that reports amavis metrics as reported by amavisd-agent
#### Dependencies
* amavisd-agent must be present in PATH
"""
import os
import subprocess
import re
import diamond.collector
import diamond.convertor
from diamond.collector import str_to_bool
class AmavisCollector(diamond.coll... | MichaelDoyle/Diamond | src/collectors/amavis/amavis.py | Python | mit | 3,732 | 0 |
# AtHomePowerlineServer - networked server for CM11/CM11A/XTB-232 X10 controllers
# Copyright (C) 2014, 2015 Dave Hocker
#
# 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, version 3 of the Licen... | dhocker/athomepowerlineserver | helpers/sun_data.py | Python | gpl-3.0 | 3,610 | 0.000831 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | andrius-preimantas/odoo | addons/base_action_rule/base_action_rule.py | Python | agpl-3.0 | 15,745 | 0.005017 |
# -*- 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 model 'Message'
db.create_table('firstclass_message', (
... | bennylope/django-firstclass | firstclass/south_migrations/0001_initial.py | Python | mit | 1,013 | 0.00691 |
from flask import Flask
from flaskext.cache import Cache
from flaskext.mongokit import BSONObjectIdConverter
from werkzeug.routing import BaseConverter
import settings
app = Flask(__name__)
app.config.from_object('woerterbuch.settings')
app.secret_key = settings.SECRET_KEY
## Hook up custom URL converters.
class Re... | fwenzel/strassendeutsch | woerterbuch/__init__.py | Python | gpl-3.0 | 739 | 0.005413 |
#
# Copyright (c) 2012 Will Page <compenguy@gmail.com>
# Derivative of ftpupload.py, credit to Tom Keffer <tkeffer@gmail.com>
#
# See the file LICENSE.txt for your full rights.
#
# $Id: rsyncupload.py 2766 2014-12-02 02:45:36Z tkeffer $
#
"""For uploading files to a remove server via Rsync"""
import os
imp... | tony-rasskazov/meteo | weewx/bin/weeutil/rsyncupload.py | Python | mit | 6,592 | 0.005765 |
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import configparser
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, RegexHandler, ConversationHandler
from telegram import (ReplyKeyboardMarkup, ReplyKeyboardRemove)
from copy import deepcopy
import logging
import logging.handlers
from decisionT... | giuva90/TreeBot | bot.py | Python | gpl-3.0 | 11,462 | 0.022596 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
COHORTE configuration file parser: converts a parsed configuration file to
beans
:author: Thomas Calmant
:license: Apache Software License 2.0
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you may n... | ahmadshahwan/cohorte-runtime | python/cohorte/config/parser.py | Python | apache-2.0 | 14,427 | 0 |
# -*- coding: utf-8 -*-
# usage:
# > python seoreporter/__init__.py [type] [format] [run_id]
# example:
# > python seoreporter/__init__.py build junit d09b8571-5c8a-42ff-8ab7-c38f4f8871c4
# todo
# output valid jUnit XML output
# output html files in a folder
# output html pages that show the data
# output json
impo... | saymedia/seosuite | seoreporter/__init__.py | Python | mit | 13,442 | 0.002232 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# Thinkopen Brasil
# Copyright (C) Thinkopen Solutions Brasil (<http://www.tkobr.com>).
#
# This ... | bmya/tkobr-addons | tko_point_of_sale_discount_cards/__openerp__.py | Python | agpl-3.0 | 2,070 | 0.004348 |
#!/usr/bin/python
#
# Copyright (c) SAS Institute 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... | sassoftware/robj | robj_test/robjtest/httptest.py | Python | apache-2.0 | 3,456 | 0.000579 |
# Copyright 2017 DataCentred 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 ag... | spjmurray/openstack-sentinel | sentinel/tests/functional/metering/v2/test_meters.py | Python | apache-2.0 | 1,567 | 0.005105 |
"""Auto-generated file, do not edit by hand. 878 metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_878 = PhoneMetadata(id='001', country_code=878, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='1\\d{11}', possible_number_pattern='\... | ayushgoel/FixGoogleContacts | phonenumbers/data/region_878.py | Python | mit | 1,847 | 0.009746 |
from fprops import *
from pylab import *
import sys
#P = fluid('water','helmholtz');
#P = fluid('ammonia','pengrob');
P = fluid('carbondioxide','pengrob');
print "SOLVING TRIPLE POINT..."
print "Fluid: %s\nData source: %s" %(P.name, P.source)
try:
p_t, rhof_t, rhog_t = P.triple_point()
except RuntimeError,e:
prin... | georgyberdyshev/ascend | models/johnpye/fprops/python/solve_ph_array.py | Python | gpl-2.0 | 2,054 | 0.041383 |
# vim: ts=4:sw=4:expandtab
# -*- coding: UTF-8 -*-
# BleachBit
# Copyright (C) 2008-2017 Andrew Ziem
# https://www.bleachbit.org
#
# 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... | brahmastra2016/bleachbit | tests/TestWindows.py | Python | gpl-3.0 | 13,915 | 0.000216 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'MODEL1006230072.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/MODEL1006230072 | MODEL1006230072/model.py | Python | cc0-1.0 | 427 | 0.009368 |
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of hr_timesheet_no_closed_project_task,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# hr_timesheet_invoice_hide_to_invoice is free software:
# ... | acsone/acsone-addons | hr_timesheet_no_closed_project_task/models/project_task.py | Python | agpl-3.0 | 1,843 | 0 |
#!/usr/bin/env python
# encoding: utf-8
from django.contrib.auth.decorators import (
permission_required as original_permission_required,
login_required as original_login_required,)
from keyauth.decorators import key_required as original_key_required
from functools import wraps
class DjangoToYardDecorator(obj... | laginha/yard | src/yard/resources/decorators/adapted.py | Python | mit | 1,471 | 0.004759 |
import os
import errno
class LockError (Exception):
pass
class LockIsLocked (LockError):
pass
class LockIsUnlocked (LockError):
pass
class Lock (object):
def __init__ (self, path):
self.path = path
self.locked = False
def acquire (self):
if self.locked:
rais... | larsks/gitblogger | gitblogger/lock.py | Python | gpl-3.0 | 966 | 0.009317 |
# Copyright (c) 2013-2014 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
#
# Un... | Juniper/contrail-dev-neutron | neutron/plugins/ml2/drivers/mechanism_odl.py | Python | apache-2.0 | 15,181 | 0 |
# -*- coding: utf-8 -*-
#
# Cheroke-admin
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2001-2014 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free So... | lmcro/webserver | admin/plugins/error_redir.py | Python | gpl-2.0 | 4,572 | 0.012905 |
"""
Bootstrapping script that create a basic Pimlico setup, either for an existing config file, or for a new project.
Distribute this with your Pimlico project code. You don't need to distribute Pimlico itself
with your project, since it can be downloaded later. Just distribute a directory tree containing your config ... | markgw/pimlico | admin/bootstrap.py | Python | gpl-3.0 | 8,150 | 0.003067 |
"""setuptools.command.bdist_egg
Build .egg distributions"""
# This module should be kept compatible with Python 2.3
import sys, os, marshal
from setuptools import Command
from distutils.dir_util import remove_tree, mkpath
try:
from distutils.sysconfig import get_python_version, get_python_lib
except ImportError:
... | mayankcu/Django-social | venv/Lib/site-packages/distribute-0.6.28-py2.7.egg/setuptools/command/bdist_egg.py | Python | bsd-3-clause | 18,594 | 0.006023 |
import sys
from tempfile import NamedTemporaryFile, TemporaryFile, mktemp
import os
from numpy import memmap
from numpy import arange, allclose, asarray
from numpy.testing import *
class TestMemmap(TestCase):
def setUp(self):
self.tmpfp = NamedTemporaryFile(prefix='mmap')
self.shape = (3,4)
... | mbalasso/mynumpy | numpy/core/tests/test_memmap.py | Python | bsd-3-clause | 4,069 | 0.002949 |
from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseShpStationsShpDistrictsImporter
class Command(BaseShpStationsShpDistrictsImporter):
srid = 27700
council_id = 'W06000021'
districts_name = 'polling_district'
stations_name = 'polling_station.shp'
elections... | chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_monmouthshire.py | Python | bsd-3-clause | 1,244 | 0.004019 |
import numpy as np, time, itertools
from collections import OrderedDict
from .misc_utils import *
from . import distributions
concat = np.concatenate
import theano.tensor as T, theano
from importlib import import_module
import scipy.optimize
from .keras_theano_setup import floatX, FNOPTS
from keras.layers.core import L... | abhinavagarwalla/modular_rl | modular_rl/core.py | Python | mit | 24,088 | 0.008261 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import unittest
from telemetry import story
from telemetry import page as page_module
from telemetry import value
from telemetry.value import impro... | catapult-project/catapult-csm | telemetry/telemetry/value/scalar_unittest.py | Python | bsd-3-clause | 7,682 | 0.002343 |
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification
import numpy as np
def predictClothesGeneral(temp):
dataFile = open("data.txt")
data = dataFile.read()
data = data.split("\n")
X = []
Y = []
Y2 = []
for i in ra... | epaglier/Project-JARVIS | jarvis-features/Weather AI/weatherai.py | Python | gpl-3.0 | 2,382 | 0.011755 |
# -*- coding: utf-8 -*-
# (c) 2017-2019, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""
Defines a crystal lattice class.
"""
import numpy as np
import scipy.linalg as la
from fsc.export import export
# TODO: move to a separate module # pylint: disable=fixme,useless-suppr... | Z2PackDev/bands_inspect | bands_inspect/lattice.py | Python | apache-2.0 | 1,413 | 0 |
"""
Base/mixin classes for the spatial backend database operations and the
`SpatialRefSys` model the backend.
"""
import re
from django.contrib.gis import gdal
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
class BaseSpatialOperations(object):
"""
This module holds... | ericholscher/django | django/contrib/gis/db/backends/base.py | Python | bsd-3-clause | 11,584 | 0.001468 |
# Given a linked list, remove the nth node from the end of list and return its head.
# For example,
# Given linked list: 1->2->3->4->5, and n = 2.
# After removing the second node from the end, the linked list becomes 1->2->3->5.
# Note:
# Given n will always be valid.
# Try to do this in one pass.
# Defin... | abawchen/leetcode | solutions/019_remove_nth_node_from_end_of_list.py | Python | mit | 1,751 | 0.003427 |
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... | detiber/lib_openshift | lib_openshift/models/v1_image_source.py | Python | apache-2.0 | 5,181 | 0.001544 |
"""Auto-generated file, do not edit by hand. NZ metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_NZ = PhoneMetadata(id='NZ', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='[14]\\d{2,3}', possible_length=(3, 4)),... | gencer/python-phonenumbers | python/phonenumbers/shortdata/region_NZ.py | Python | apache-2.0 | 673 | 0.008915 |
from django.conf.urls import url
from .views import ZadanieCreateView, ZadanieDetailView, ZadanieUpdateView
urlpatterns = [
url(r'^dodaj/(?P<dopuszczenie_id>[0-9]+)/$', ZadanieCreateView.as_view(), name='create'),
url(r'(?P<pk>[0-9]+)/detail/$', ZadanieDetailView.as_view(), name='detail'),
url(r'(?P<pk>[... | szymanskirafal/ab | zadania/urls.py | Python | mit | 388 | 0.010309 |
import multiprocessing
import os
from datetime import timedelta
import easy_env
from dotenv import find_dotenv, load_dotenv
load_dotenv(find_dotenv())
PORT = os.environ.get('PORT', '8000')
WEB_WORKERS = easy_env.get_int('WEB_WORKERS', multiprocessing.cpu_count())
bind = ":" + PORT
workers = WEB_WORKERS
timeout = t... | vaniakosmos/memes-reposter | server.py | Python | mit | 432 | 0 |
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import time
from openerp import pooler
from openerp.osv import fields, osv
from openerp.tools.translate import _
class is_api(osv.osv):
_name = 'is_api'
_description = u'Fonctions générales'
def get_usagers_structure(self, cr... | tonygalmiche/ove_structure | is_api.py | Python | mit | 13,118 | 0.008564 |
#!/usr/bin/python
# 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 w... | bbradbury/yum-utils | debuginfo-install.py | Python | gpl-2.0 | 7,411 | 0.004723 |
import datetime as dt
import numpy as np
import pandas as pd
# QSTK Imports
import QSTK.qstkutil.DataAccess as da
import QSTK.qstkutil.qsdateutil as du
def get_orders_list(s_file_path):
l_columns = ["year", "month", "day", "sym", "type", "num"]
df_orders_list = pd.read_csv(s_file_path, sep=',', header=None)
... | gdikos/qstk-on-ec2 | market_sim.py | Python | mit | 5,585 | 0.005909 |
from django.contrib import admin
from django.contrib.admin.widgets import AdminFileWidget, AdminURLFieldWidget
from django.contrib.contenttypes.models import ContentType
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from models import (Image, Video, Audio, Flash, Col... | callowayproject/django-massmedia | massmedia/admin.py | Python | apache-2.0 | 10,650 | 0.001784 |
from django.conf import settings
from django.contrib.auth.models import UserManager
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.utils.importlib import import_module
from django.utils.translation import ugettext_lazy as _
__all__ = (
'get_user_document',
)
MON... | LethusTI/supportcenter | vendor/mongoengine/mongoengine/django/mongo_auth/models.py | Python | gpl-3.0 | 3,378 | 0.000592 |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from .finders import get_finders
class WagtailEmbedsAppConfig(AppConfig):
name = 'wagtail.embeds'
label = 'wagtailembeds'
verbose_name = _("Wagtail embeds")
def ready(self):
# Check configuration on sta... | mikedingjan/wagtail | wagtail/embeds/apps.py | Python | bsd-3-clause | 347 | 0 |
import _plotly_utils.basevalidators
class MetaValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="meta", parent_name="pointcloud", **kwargs):
super(MetaValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
array_o... | plotly/plotly.py | packages/python/plotly/plotly/validators/pointcloud/_meta.py | Python | mit | 438 | 0 |
"""
WSGI config for dqc_django 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... | arturcalves/dqc | dqc_django/wsgi.py | Python | mit | 397 | 0 |
# coding: utf-8
"""
This file contains methods for translation norsource rules into rules we can
convert easily to a Typeraft compatible format.
"""
import re
from norsourceparser.core.config import config
from norsourceparser.core.constants import REDUCED_RULE_POS, REDUCED_RULE_GLOSSES, REDUCED_RULE_MORPHOLOGICAL_BRE... | Typecraft/norsourceparser | norsourceparser/core/rules.py | Python | mit | 11,982 | 0.002921 |
"""
The huginn_record script is used to record flight data from the simulator
"""
from argparse import ArgumentParser
import json
from twisted.internet import reactor
from twisted.web.client import Agent, readBody
from twisted.web.http_headers import Headers
from twisted.internet.task import LoopingCall
from huginn... | pmatigakis/Huginn | huginn/cli/huginn_record.py | Python | bsd-3-clause | 2,622 | 0.000381 |
from __future__ import unicode_literals
from frappe import _
from frappe.desk.moduleview import add_setup_section
def get_data():
data = [
{
"label": _("Users"),
"icon": "icon-group",
"items": [
{
"type": "doctype",
"name": "User",
"description": _("System and Website Users")
},
... | sbktechnology/trufil-frappe | frappe/config/setup.py | Python | mit | 5,480 | 0.042336 |
import logging
from django.conf import settings
from django.db import models
from mkt.site.mail import send_mail
from mkt.site.models import ModelBase
from mkt.users.models import UserProfile
from mkt.webapps.models import Webapp
from mkt.websites.models import Website
log = logging.getLogger('z.abuse')
class Abu... | eviljeff/zamboni | mkt/abuse/models.py | Python | bsd-3-clause | 3,467 | 0 |
# coding: utf-8
#
# Copyright 2020 The Oppia 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 requi... | kevinlee12/oppia | scripts/linters/css_linter_test.py | Python | apache-2.0 | 4,592 | 0.000653 |
"""Compute the archive start time of a HADS/DCP/COOP network"""
import sys
import datetime
from pyiem.network import Table as NetworkTable
from pyiem.util import get_dbconn, logger
LOG = logger()
THISYEAR = datetime.datetime.now().year
HADSDB = get_dbconn("hads")
MESOSITEDB = get_dbconn("mesosite")
def get_minvalid... | akrherz/iem | scripts/dbutil/compute_hads_sts.py | Python | mit | 2,162 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-11-08 12:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cashier', '0014_fix_transaction'),
]
operations = [
migrations.AlterField(
... | Rotendahl/DormitoryLife | cashier/migrations/0015_auto_20171108_1351.py | Python | gpl-3.0 | 552 | 0.001818 |
from __future__ import absolute_import, unicode_literals
from mopidy import listener
class CoreListener(listener.Listener):
"""
Marker interface for recipients of events sent by the core actor.
Any Pykka actor that mixes in this class will receive calls to the methods
defined here when the correspo... | mokieyue/mopidy | mopidy/core/listener.py | Python | apache-2.0 | 5,283 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('askapp', '0012_auto_20170203_1436'),
]
operations = [
migrations.RenameField(
model_name='post',
old... | BanzaiTokyo/akihabara-tokyo | askapp/migrations/0013_auto_20170206_0748.py | Python | apache-2.0 | 542 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | joshuamckenty/yolo-octo-wookie | nova/endpoint/images.py | Python | apache-2.0 | 2,782 | 0.002516 |
from sqlalchemy.schema import (
Table,
Column,
MetaData,
ForeignKey)
from sqlalchemy.types import (
Text,
JSON,
DateTime,
Integer,
String)
from collections import defaultdict
from uuid import uuid4
import datetime
class SchemaStore:
def __init__(self):
self.metadata = d... | grahame/ealgis | django/ealgis/dataschema/schema_v1.py | Python | gpl-3.0 | 3,861 | 0.001554 |
"""
* The SDK website: https://slack.dev/python-slack-sdk/
* PyPI package: https://pypi.org/project/slack-sdk/
Here is the list of key modules in this SDK:
#### Web API Client
* Web API client: `slack_sdk.web.client`
* asyncio-based Web API client: `slack_sdk.web.async_client`
#### Webhook / response_url Client
* ... | slackapi/python-slackclient | slack_sdk/__init__.py | Python | mit | 1,429 | 0.002099 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-09-05 09:13
from __future__ import unicode_literals
import uuid
from django.core.exceptions import FieldDoesNotExist
from django.db import migrations
def set_uuid_field(apps, schema_editor):
"""
Set a random uuid value to all existing rows in all mod... | uclouvain/osis | base/migrations/0063_populate_uuid_values.py | Python | agpl-3.0 | 969 | 0.002064 |
# -*- coding: utf-8 -*-
import os, sys, time, multiprocessing, re
from .processes import ForkedProcess
from .remoteproxy import ClosedError
from ..python2_3 import basestring, xrange
class CanceledError(Exception):
"""Raised when the progress dialog is canceled during a processing operation."""
pass
class Pa... | SpaceGroupUCL/qgisSpaceSyntaxToolkit | esstoolkit/external/pyqtgraph/multiprocess/parallelizer.py | Python | gpl-3.0 | 12,494 | 0.014647 |
# coding: utf-8
# pylint: disable=missing-docstring, invalid-name
import flask
import auth
import config
import model
from main import app
yahoo_config = dict(
access_token_url='https://api.login.yahoo.com/oauth/v2/get_token',
authorize_url='https://api.login.yahoo.com/oauth/v2/request_auth',
base_url=... | sidharta/hansel-app | main/auth/yahoo.py | Python | mit | 2,275 | 0 |
import os
import time
import pandas as pd
import pytest
import requests
from botocore.session import Session
from great_expectations.datasource.batch_kwargs_generator import (
S3SubdirReaderBatchKwargsGenerator,
)
port = 5555
url_host = os.getenv("GE_TEST_LOCALHOST_URL", "127.0.0.1")
endpoint_uri = f"http://{url... | great-expectations/great_expectations | tests/datasource/batch_kwarg_generator/test_s3_subdir_reader_generator.py | Python | apache-2.0 | 3,834 | 0.001826 |
import os
import logging
import re
from typing import Final
logger: Final = logging.getLogger("Npo.Utils")
pattern: Final = re.compile('[a-z0-9]{2,}', re.IGNORECASE)
def looks_like_form(form: str):
"""
Checks if the given string looks like a form. E.g. it represents json, xml, a file, or 'stdin'.
Otherw... | npo-poms/pyapi | npoapi/utils.py | Python | gpl-3.0 | 1,076 | 0.003717 |
# -*- coding: utf-8 -*-
import pairing_heap as pheap
from copy import deepcopy,copy
import threading
import Queue
import requests
from requests.auth import HTTPDigestAuth
import json
import sys
import communication
import config
import time
import L_sprit
# グローバル変数の宣言
LIMIT_SELECTION = 0
SELECTON_RATE = 0
EXCHANGE_RAT... | SP2LC/procon25-main | A-star/L-dynamic.py | Python | apache-2.0 | 17,085 | 0.024341 |
#!/usr/bin/env python
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from pdfminer.pdfpage import PDFPage
from cStringIO import StringIO
from collections import defaultdict
import sys
import yaml
raw_classification... | daniellawrence/pdfclassification | main.py | Python | mit | 2,887 | 0.002425 |
"""
Tests for courseware middleware
"""
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from django.http import Http404
from mock import patch
import courseware.courses as courses
from courseware.middleware import RedirectUnenrolledMiddleware
from xmodule.modulestore.tests.d... | eestay/edx-platform | lms/djangoapps/courseware/tests/test_middleware.py | Python | agpl-3.0 | 1,873 | 0 |
"""
Cryo-EM density map I/O
@warning: dragons ahead, this module is experimental
"""
import numpy
import struct
class DensityMapFormatError(ValueError):
pass
class ByteOrder(object):
NATIVE = '='
LITTLE = '<'
BIG = '>'
class DensityInfo(object):
def __init__(self, data, spacing, origin... | csb-toolbox/CSB | csb/bio/io/mrc.py | Python | mit | 9,732 | 0.009453 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
PACKAGEDIR = os.path.abspath(os.path.dirname(__file__))
import matplotlib
matplotlib.use('TkAgg')
from .version import __version__
from .keparray import *
from .kepbls import *
from .kepclean import *
from .kepclip import *
... | gully/PyKE | pyke/__init__.py | Python | mit | 1,296 | 0.036265 |
from .base import *
from .local import *
FB_APP_ID = "557603244304943" | amol-mandhane/konnactivity | settings/__init__.py | Python | mit | 71 | 0.014085 |
from django import forms
from django.conf import settings
from guardian.compat import url, patterns
from django.contrib import admin
from django.contrib import messages
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_res... | restless/django-guardian | guardian/admin.py | Python | bsd-2-clause | 14,636 | 0.001366 |
"""
Configuration class.
Copyright 2010 Kelsey Hightower
Kelsey Hightower <kelsey.hightower@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your op... | cobbler/koan | koan/configurator.py | Python | gpl-2.0 | 10,535 | 0.00019 |
import pytz
from collections import defaultdict
import logging
from datetime import datetime
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import connection
from django.http import HttpResponse
from django.utils import simplejson
from django_comment_common.mode... | LearnEra/LearnEraPlaftform | lms/djangoapps/django_comment_client/utils.py | Python | agpl-3.0 | 18,621 | 0.003007 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.