code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# ===============================================================================
# Copyright 2016 Jake Ross
#
# 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... | USGSDenverPychron/pychron | pychron/hardware/furnace/nmgrl/funnel.py | Python | apache-2.0 | 2,158 |
# -*- test-case-name: twisted.web.test.test_web -*-
#
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""I hold the lowest-level Resource class."""
# System Imports
from twisted.internet import defer
from twisted.python import roots, reflect
from zope.interface import Attribute, im... | santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/twisted/web/resource.py | Python | bsd-3-clause | 6,969 |
import json
import yaml
from bson.objectid import ObjectId
from dateutil.parser import parse
from django.http import HttpResponse
from lxml.etree import tostring
from django.core.urlresolvers import resolve, get_script_prefix
from tastypie.exceptions import BadRequest, ImmediateHttpResponse
from tastypie.serializers... | lakiw/cripts | cripts/core/api.py | Python | mit | 27,581 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | MobinRanjbar/hue | apps/oozie/src/oozie/views/dashboard.py | Python | apache-2.0 | 44,447 |
"""
These functions can be called by DetectionModules to aid in calculations
"""
import copy
import numpy as np
def coord_transform(theta, x, y):
"""
Transforms coordinates so that x is measured in the direction of the wind.
NOTE: coord_transform updates the x and y values passed to the function... | EAOgroup/FEAST | DetectionModules/helper_functions.py | Python | mit | 1,455 |
import socket #for sockets
import sys #for exit
try:
#create an AF_INET, STREAM socket (TCP)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.error, msg:
print 'Failed to create socket. Error code: ' + str(msg[0]) + ' , Error message : ' + msg[1]
sys.exit();
print 'Socket Creat... | ozdemircili/pycheat | pycheat/socket.py | Python | gpl-3.0 | 614 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2018 CERN.
#
# INSPIRE 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 ... | inspirehep/inspire-next | tests/unit/records/serializers/literature/common/test_citation_item.py | Python | gpl-3.0 | 4,513 |
# This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | XeCycle/indico | indico/modules/attachments/blueprint.py | Python | gpl-3.0 | 9,383 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-12-21 10:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('organization_magazine', '0019_auto_20170105_1743'),
]
... | Ircam-Web/mezzanine-organization | organization/magazine/migrations/0020_auto_20171221_1143.py | Python | agpl-3.0 | 669 |
########################################################################
# Rancho - Open Source Group/Project Management Tool
# Copyright (C) 2008 The Rancho Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by t... | joaquimrocha/Rancho | rancho/lib/templatetags/monthcal.py | Python | agpl-3.0 | 3,664 |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | uber/ludwig | ludwig/features/date_feature.py | Python | apache-2.0 | 4,824 |
'''
Created on Mar 24, 2016
@author: consultit
'''
from panda3d.core import load_prc_file_data, LPoint3f
import ely.libtools
from ely.ai import GameAIManager
from direct.showbase.ShowBase import ShowBase
prefD = '../../../assets/'
dataDirs = [prefD + 'models/test', prefD + 'textures/test', prefD + 'sounds/test',
... | consultit/Ely | test/ai/python/rn_basic.py | Python | lgpl-3.0 | 2,904 |
# -*- coding: utf-8 -*-
#
# This file is part of Glances.
#
# Copyright (C) 2015 Nicolargo <nicolas@nicolargo.com>
#
# Glances is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | subodhchhabra/glances | glances/plugins/glances_network.py | Python | lgpl-3.0 | 13,890 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import TestCase
import datetime
from mock import MagicMock, call, patch
from audit_tools.audit.views import AccessViewSet
@patch.object(AccessViewSet, 'queryset')
class AccessViewSetTestCase(TestCase):
def setUp(self):
self.a... | PeRDy/django-audit-tools | audit_tools/tests/audit/views/api/test_access.py | Python | gpl-2.0 | 6,891 |
#-*- coding: utf-8 -*-
from django.http import *
from django import template
from django.shortcuts import render_to_response, render
from django.views.decorators.csrf import csrf_exempt
from django.contrib.gis.geos import fromstr
from world.models import Member
import forms
from forms import ContactForm
from d... | Alexander-M-Waldman/local_currency_site | geodjango/geodjango/web.py | Python | gpl-3.0 | 2,915 |
GITHUB = None
| cameronbwhite/GithubRemote | GithubRemote/Gui/__init__.py | Python | bsd-3-clause | 14 |
#!/usr/bin/env python
# Copyright 2020 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 ... | GoogleCloudPlatform/covid-19-open-data | src/update.py | Python | apache-2.0 | 6,509 |
#!/bin/env python2
from alife.worlds.world import World, Point
from alife.agents.UtilityAgent import SimpleAgent
from alife.utils.utils import dumpToArray, zeros
import math
import sys
import numpy
from nupic.encoders.extras.utility import SimpleUtilityEncoder
# common settings:
items=None
target=Point(4,9)
agent=Non... | breznak/ALife | alife/experiments/behavior/random_walk_map.py | Python | gpl-2.0 | 6,062 |
from sympy.core import (Basic, Expr, S, C, Symbol, Wild, Add, sympify, diff,
oo, Tuple, Dummy, Equality, Interval)
from sympy.core.symbol import Dummy
from sympy.core.compatibility import ordered_iter
from sympy.integrals.trigonometry import trigintegrate
from sympy.integrals.deltafunctions imp... | minrk/sympy | sympy/integrals/integrals.py | Python | bsd-3-clause | 31,617 |
#!/usr/bin/env python
from sys import argv
script, filename = argv
txt = open(filename)
print("Here's you file %r:" % filename)
print(txt.read())
print("Type the filename again:")
file_again = input("> ")
txt_again = open(file_again)
print(txt_again.read())
| davvi/Hardway3 | ex15.py | Python | mit | 267 |
import click
from complex.cli import pass_context
@click.command('status', short_help='Shows file changes.')
@pass_context
def cli(ctx):
"""Shows file changes in the current working directory."""
ctx.log('Changed files: none')
ctx.vlog('bla bla bla, debug info')
| staranjeet/fjord | vendor/packages/click/examples/complex/complex/commands/cmd_status.py | Python | bsd-3-clause | 277 |
from twisted.internet import reactor, defer
def defer_sleep(seconds):
d = defer.Deferred()
reactor.callLater(seconds, d.callback, seconds)
return d
@defer.inlineCallbacks
def blocking_f1():
print("blocking_f1 before sleep")
yield defer_sleep(1)
print("blocking_f1 after sleep")
@defer.inlineCa... | drednout/pvt_python_course | lesson4/non_blocking_sleep.py | Python | gpl-2.0 | 536 |
from django.contrib.auth.models import User, Group
from rest_framework import viewsets
from tutorial.quickstart.serializers import UserSerializer, GroupSerializer
class UserViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows users to be viewed or edited.
"""
queryset = User.objects.all()
... | decadecity/ct | caffeine_tracker/apps/quickstart/views.py | Python | unlicense | 549 |
import sys, batchOpenMPI, apport_python_hook
batchOpenMPI.begin_MPI_loop()
raise RuntimeError, "mpirun should hang not hang and exit"
batchOpenMPI.end_MPI_loop() #release workers
| hamish2014/batchOpenMPI | examples/unhandled_exception_ex.py | Python | mit | 182 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class AccountingPeriod(Document):
def validate(self):
self.validate_overlap... | ovresko/erpnext | erpnext/accounts/doctype/accounting_period/accounting_period.py | Python | gpl-3.0 | 2,066 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | pernici/sympy | sympy/thirdparty/pyglet/pyglet/window/carbon/quartzkey.py | Python | bsd-3-clause | 6,150 |
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# Author: Doug Hellmann <doug.hellmann@dreamhost.com>
#
# 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/li... | m1093782566/openstack_org_ceilometer | ceilometer/api/controllers/root.py | Python | apache-2.0 | 1,902 |
import discord
import aiohttp
import asyncio
import json
import bs4
from bs4 import BeautifulSoup
from __main__ import send_cmd_help
from .utils import chat_formatting as chat
from discord.ext import commands
IMAGE_SEARCH = 'http://www.dnd.beyond.com/{}?filter-search={}'
schema={
'spells':(
{'id':'string'... | JasonJW/dnd | dnd/dnd.py | Python | mit | 23,139 |
########################################
## Adventure Bot "Dennis" ##
## commands/me.py ##
## Copyright 2012-2013 PariahSoft LLC ##
########################################
## **********
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software... | pariahsoft/Dennis | commands/me.py | Python | mit | 1,660 |
# -*- coding: utf-8 -*-
from datetime import datetime as dt
import json
import os
import random
import subprocess
import traceback
import urllib2
import zipfile
import zlib
# turbogears imports
from tg import expose, redirect, validate, flash, request, response, override_template, config
from tg.decorators import pag... | LamCiuLoeng/gap | gapproject/controllers/order.py | Python | mit | 32,750 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2015, Trond Hindenes <trond@hindenes.com>, and others
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'statu... | drmrd/ansible | lib/ansible/modules/windows/win_dsc.py | Python | gpl-3.0 | 5,245 |
import logging
import urllib
from collections import OrderedDict
import sqlalchemy
from sqlalchemy import Column, Integer, BigInteger, String, DateTime, func, or_
from sqlalchemy import ForeignKey, UniqueConstraint, Boolean
from sqlalchemy.orm.exc import NoResultFound
import akiri.framework.sqlalchemy as meta
from a... | palette-software/palette | controller/controller/files.py | Python | gpl-3.0 | 11,735 |
# coding:utf8
import functools
from functools import partial
# cmp_to_key(mycmp)
# Convert a cmp= function into a key= function
# 将比较函数转换为 key 函数
# 所谓比较函数 就是接受两个参数,然后在函数内判断大小返回True或False
# 所谓 key 函 就是接收一个函数, 然后将其转换为一个可比较的东西
# 比如 原序列是 [1,2,3,4,5] 进行排序的序列就是 [key(1), key(2), key(3), ...]
# sorted(range(5), key=lambda x: ... | duanyifei/python_modules_test | test_functools.py | Python | gpl-3.0 | 2,462 |
#! /usr/bin/python
""" XKComplete: A date reversing completeness counter inspired by XKCD
http://xkcd.com/1017/
Copyright (C) 2012 Paul Pritchard
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; eith... | ExpatPaul/silliness | xkcomplete.py | Python | gpl-3.0 | 1,641 |
"""
..
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be ... | ddietze/DOSSS | objects/DOSSS_GlassSlab.py | Python | gpl-3.0 | 5,582 |
from girder.constants import SortDir
def default_pagination_params(limit=None, offset=None, sort=None):
"""Returns default params unless they are set"""
if limit is None:
limit = 25
if offset is None:
offset = 0
if sort is None:
sort = [('_id', SortDir.DESCENDING)]
return ... | OpenChemistry/mongochemserver | girder/images/images/utils/pagination.py | Python | bsd-3-clause | 1,079 |
import os
import shutil
def spawn_plotting_script(dest,name):
module_dir = os.path.dirname(os.path.abspath(__file__))
shutil.copyfile(module_dir+"\\plotting_scripts\\"+name+'.py', dest+"\\"+name+'.py')
shutil.copyfile(module_dir+"\\plotting_scripts\\plot.bat", dest+"\\plot.bat")
bat = open(dest+"\\plot.bat", 'a')
... | ooovector/qtlab_replacement | plotting_scripts_mgmt.py | Python | gpl-3.0 | 359 |
from django.views.generic.base import TemplateResponseMixin
from django.template.response import TemplateResponse
class ResponseGenerator(object):
serializer_class = None
serializer_kwargs = {}
def __init__(self, request):
self.request = request
def get_serialized_data(self, obj):
se... | changer/django-rts | rts/response_generators.py | Python | bsd-3-clause | 1,298 |
#!/usr/bin/python
######################################################################
# Cloud Routes Availability Manager: digitalocean-snapshot
# ------------------------------------------------------------------
# This module will query Digital Ocean's api and return all actions
# This will return true if there ha... | dethos/cloudroutes-service | src/monitors/checks/digitalocean-snapshot/__init__.py | Python | agpl-3.0 | 2,191 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | danielvdende/incubator-airflow | tests/contrib/sensors/test_aws_redshift_cluster_sensor.py | Python | apache-2.0 | 3,415 |
"""
Unittests for opal.core.scaffold
"""
import shutil
import subprocess
from mock import patch, MagicMock, Mock
import ffs
import opal
from django.conf import settings
from opal.core.test import OpalTestCase
from opal.tests.models import Colour
from opal.core import scaffold
from opal.core.scaffold import (
cre... | khchine5/opal | opal/tests/test_scaffold.py | Python | agpl-3.0 | 18,271 |
#!/usr/bin/env python
# coding=utf-8
import os
from PIL import Image
i=0
for file in os.listdir('./dealtrain/'):
im=Image.open('./dealtrain/'+file)
x=im.size[0]
y=im.size[1]
print '/home/dvaliu/case/dealtrain/'+file,1,'0','0',x,y
i+=1
| dvaliu/game_pic_identify | des.py | Python | gpl-3.0 | 256 |
#Python WeConnect API call
import argparse, requests, sys, traceback, json
from datetime import datetime
wcBaseURL = "https://palalinq.herokuapp.com/api"
BASE_URL = "https://palalinq.herokuapp.com/api/people"
user = 'YOUR_USERNAME_HERE'
pw = 'YOUR_PASSWD_HERE'
token = None
"""argument parsing for username and passw... | jazzij/powertoken | weconx_calls.py | Python | mit | 3,440 |
# -*- coding: utf-8 -*-
#
# Suricata-Update documentation build configuration file, created by
# sphinx-quickstart on Wed Jul 17 23:14:56 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.... | jasonish/suricata-update | doc/conf.py | Python | gpl-2.0 | 7,919 |
import pytest
from aioredis import exceptions
multiply_script = """
local value = redis.call('GET', KEYS[1])
value = tonumber(value)
return value * ARGV[1]"""
msgpack_hello_script = """
local message = cmsgpack.unpack(ARGV[1])
local name = message['name']
return "hello " .. name
"""
msgpack_hello_script_broken = """... | aio-libs/aioredis | tests/test_scripting.py | Python | mit | 4,885 |
import grpc
from concurrent import futures
from resultstoresearchapi import (resultstore_download_pb2_grpc as
resultstoresearch_download_pb2_grpc)
from mock.mock_proxy import MockProxyServer
PORT = '[::]:9090'
def serve():
mock_proxy_server = MockProxyServer()
server = grpc.... | google/resultstoreui | resultstoresearch/server/resultstoresearch/mock_server.py | Python | apache-2.0 | 618 |
import numpy as np
import sklearn
from sklearn.metrics import roc_curve, auc
import sklearn.metrics
import sklearn.cross_validation
import copy
import util
import time
import metrics as ranking_metrics
import azimuth.models.regression
import azimuth.models.ensembles
import azimuth.models.DNN
import azimuth.models.basel... | mayavanand/RMMAFinalProject | build/lib/azimuth/predict.py | Python | bsd-3-clause | 21,618 |
import os
import sys
from core.tests import test_utils
class FailingTests(test_utils.GenericTestBase):
def test_fail(self):
self.assertEqual(1, 2)
| prasanna08/oppia | core/tests/data/failing_tests.py | Python | apache-2.0 | 164 |
from django.test import TestCase, RequestFactory
from ddah_web.models import DdahFlatPage, DDAHInstanceWeb
from ddah_web.views import FlatPageView, MoustacheFlatPageTemplateResponse
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import Site
from django.core.urlresolvers import rev... | opencorato/deldichoalhecho | ddah_web/tests/flat_pages_tests.py | Python | gpl-3.0 | 4,343 |
from StringIO import StringIO
from couchpotato import addView
from couchpotato.core.event import fireEvent, addEvent
from couchpotato.core.helpers.encoding import tryUrlencode, ss, toSafeString
from couchpotato.core.helpers.variable import getExt, md5
from couchpotato.core.logger import CPLog
from couchpotato.environme... | mozvip/CouchPotatoServer | couchpotato/core/plugins/base.py | Python | gpl-3.0 | 9,569 |
import math
sumatotal=0
for x in range(1,10):
y=1
while len(str(int(math.pow(x,y))))<=y and y<50:
if len(str(int(math.pow(x,y))))==y:
sumatotal+=1
y+=1
print sumatotal
| luismack1997/PrograMate201603126 | Project Euler/Ejercicio63.py | Python | gpl-3.0 | 206 |
from django.conf.urls import url
from course.urls import INSTANCE_URL_PREFIX, EDIT_URL_PREFIX
from . import views
urlpatterns = [
url(INSTANCE_URL_PREFIX + r'external-link/(?P<menu_id>\d+)/$',
views.ExternalLinkView.as_view(),
name="external-service-link"),
url(INSTANCE_URL_PREFIX + r'lti-log... | teemulehtinen/a-plus | external_services/urls.py | Python | gpl-3.0 | 961 |
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
# Inspired by the example at https://pytest.org/latest/goodpractises.html
class NoseTestCommand(TestCommand):
user_options = [('nose-args=', 'a', "Arguments to pass to nose")]
def initialize_options(self):
... | kokosing/git-gifi | setup.py | Python | apache-2.0 | 1,510 |
# Copyright (C) 2010 Google Inc. All rights reserved.
# Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Szeged
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of so... | zero-rp/miniblink49 | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py | Python | apache-2.0 | 14,685 |
import pytest
np = pytest.importorskip("numpy")
npt = pytest.importorskip("numpy.testing")
sp = pytest.importorskip("scipy")
import networkx as nx
from networkx.generators.degree_seq import havel_hakimi_graph
class TestBetheHessian:
@classmethod
def setup_class(cls):
deg = [3, 2, 2, 1, 0]
cl... | SpaceGroupUCL/qgisSpaceSyntaxToolkit | esstoolkit/external/networkx/linalg/tests/test_bethehessian.py | Python | gpl-3.0 | 1,347 |
"""
This module defines various patches for peewee to easily interact with
graphene.
"""
# external imports
from functools import singledispatch
from graphene.core.types.scalars import (
Boolean,
Float,
ID,
Int,
String,
)
# local imports
import nautilus.models.fields as fields
@singledispa... | aaivazis/nautilus | nautilus/contrib/graphene_peewee/converter.py | Python | mit | 1,686 |
import openmc
import openmc.deplete
import numpy as np
import matplotlib.pyplot as plt
###############################################################################
# Simulation Input File Parameters
###############################################################################
# OpenMC simula... | johnnyliu27/openmc | examples/python/pincell_depletion/run_depletion.py | Python | mit | 6,312 |
import json
import math
import os
from statistics import mean
import numpy
from django.conf import settings
from django.contrib.gis.geos import Polygon
from django.core.management import BaseCommand, CommandError
from django.db.models import Avg
from ncdjango.models import Service, SERVICE_DATA_ROOT, Variable
from net... | consbio/seedsource-core | seedsource_core/django/seedsource/management/commands/calculate_zone_transfers.py | Python | bsd-3-clause | 14,279 |
#/ <reference path="./testBlocks/templateStrings.ts" />
template_test = template.create(img("""0123"""))
template_test2 = template.create(img("""
0
1
2
3"""))
bad_template = template.create(badt("""0123""")) | switch-education/pxt | tests/pydecompile-test/baselines/tagged_templates.py | Python | mit | 214 |
#-*- coding: utf-8 -*-
#
# This file is part of PassMAN.
#
# PassMAN 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.
#
# PassMAN is dis... | maelick/PassMAN | src/passgen_tests.py | Python | gpl-3.0 | 6,869 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('snotes20', '0006_podcast_feed'),
]
operations = [
migrations.AlterUniqueTogether(
name='episode',
un... | shownotes/snotes20-restapi | snotes20/migrations/0007_auto_20141125_1737.py | Python | agpl-3.0 | 381 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2020, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Input Generator and Parser
#############################
Every attempt is made to follow the Documentation on the
NWChem `website`_ with a general theme of the input Generator
ac... | exa-analytics/atomic | exatomic/nwchem/inputs.py | Python | apache-2.0 | 9,896 |
from urlparse import urlparse
from momoko.clients import AsyncClient
class Row:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
class Database():
def __init__(self, client):
self.client = client
def select_all(self, operation, parameters=(), record=Row, callback=None):
... | pitluga/elephunk | elephunk/database.py | Python | mit | 2,435 |
import copy
import pycountry
from sidr import validator, const
from sidr.orm import db, sa_utils
from sqlalchemy.orm import relationship, backref
from .model import ObjectTable, Query, QueryFilterEq, QueryFilterEqDate, QueryFilterLike
__all__ = ['action_types', 'Action', 'ActionQuery']
action_types = {
'ADD_ENTR... | oiime/sidr | sidr/models/action.py | Python | gpl-2.0 | 1,920 |
# 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
# distributed under the Li... | dstufft/warehouse | tests/unit/admin/test_routes.py | Python | apache-2.0 | 4,819 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import random
import string
import tornado.util
class SessionStorage(dict):
"""The class store sessions."""
pass
class Session(object):
"""The session. Store a value and a expire_time."""
def __init__(self, key, expire_time, value=None)... | RTNelo/Beryllium | session.py | Python | gpl-2.0 | 4,314 |
# Copyright 2016 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... | GoogleCloudPlatform/mimus-game-simulator | db_api/objects/player.py | Python | apache-2.0 | 3,330 |
# Samba-specific bits for optparse
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option... | anoopcs9/samba | python/samba/getopt.py | Python | gpl-3.0 | 11,137 |
# Copyright (c) 2014 Alcatel-Lucent Enterprise
# 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... | OpenTouch/python-facette | src/facette/v1/plot.py | Python | apache-2.0 | 2,559 |
# Generated by Django 3.0.3 on 2020-04-15 12:53
import django.contrib.gis.db.models.fields
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('locations', '0008_auto_20200416_0028'),
]
operations = [
mi... | greenstone/keadatabase-back | src/locations/migrations/0009_auto_20200416_0053.py | Python | agpl-3.0 | 719 |
#!/usr/bin/env python
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | googleads/google-ads-python | examples/campaign_management/get_campaigns_by_label.py | Python | apache-2.0 | 3,902 |
"""
Decision Tree Classification Example.
"""
import time
from math import sqrt
import sys
sys.path.append('/home/sasaki/devapp/spark-1.6.1-bin-hadoop2.6/python/lib')
from pyspark import SparkContext
from pyspark import SparkConf
from pyspark.mllib.clustering import KMeansModel, KMeans
from pyspark.mllib.regression i... | sasakigao/offline-example | src/main/python/cluster.py | Python | apache-2.0 | 1,783 |
# This file is part of Moksha.
# Copyright (C) 2008-2014 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 b... | mokshaproject/moksha | moksha.hub/moksha/hub/api/producer.py | Python | apache-2.0 | 5,310 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | alexandrucoman/vbox-neutron-agent | neutron/tests/unit/api/v2/test_attributes.py | Python | apache-2.0 | 35,656 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
''' Read settings.json '''
import os, json
import install
def bulk_download():
''' Read Bulk Download.txt '''
os.chdir(settings_json('preferences', 'location'))
bulk_download = open('Bulk Download.txt', 'r')
urls = bulk_download.readlines()
return ur... | ankitsejwal/Lyndor | module/read.py | Python | mit | 2,144 |
import copy
import pprint
import random
class TetrisBoard(object):
""" Represents a Tetris board.
The board is where the actual tetris game takes place.
It is a 2D array of cells, some of which are already
occupied. It also keeps track of the current figure,
allowing to move and r... | aroberge/qt_py | varia/lib/tetrismodel.py | Python | mit | 12,271 |
import unittest
from test import support
from test import test_urllib
import os
import io
import socket
import array
import sys
import tempfile
import subprocess
import urllib.request
# The proxy bypass method imported below has logic specific to the OSX
# proxy config data structure but is testable on all platforms.... | yotchang4s/cafebabepy | src/main/python/test/test_urllib2.py | Python | bsd-3-clause | 76,874 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask.ext.restful import Resource
from flask.ext.restful import reqparse
from flask import request
import datetime
import time
from ..models import *
from ..lib.util import *
from ..login.views import auth
class devResource(Resource):
# decorators = [auth.login_r... | zhounanshu/SEMD | app/semd/views.py | Python | mit | 14,848 |
import sciunit
class SpontaneousFiringTest(sciunit.Test, IntervalScore):
'''
ff
'''
def generate_prediction(self, model, verbose=False):
'''
fdf
'''
pass
def validate_observation(self, observation, first_try=True):
'''
fdfd
'''
pass... | lungsi/cerebellum-unit | cerebunit/validation_tests/cells/general/spontaneous_firing.py | Python | bsd-3-clause | 423 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Daniel and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class CotizacionItemRecursosHumanos(Document):
pass
| Init-7/demoest | demoest/demoest/doctype/cotizacion_item_recursos_humanos/cotizacion_item_recursos_humanos.py | Python | mit | 272 |
#!/usr/bin/env python2
import fontforge
import sys
if len(sys.argv) < 4:
print "Usage: %s <font file> <ascent> <descent>" % sys.argv[0]
sys.exit(1)
font_file = sys.argv[1]
ascent = int(sys.argv[2])
descent = int(sys.argv[3])
font = fontforge.open(font_file)
font.os2_winascent = ascent
font.os2_windescent ... | Khan/MathJax-dev | fonts/OTF/TeX/modify_ascent_descent.py | Python | apache-2.0 | 433 |
"""
Models to support Course Surveys feature
"""
import logging
from collections import OrderedDict
from django.core.exceptions import ValidationError
from django.db import models
from lxml import etree
from model_utils.models import TimeStampedModel
from openedx.core.djangoapps.xmodule_django.models import CourseKe... | lduarte1991/edx-platform | lms/djangoapps/survey/models.py | Python | agpl-3.0 | 8,819 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import feed... | ancafarcas/superdesk-core | superdesk/io/feeding_services/rss.py | Python | agpl-3.0 | 14,715 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | anilmuthineni/tensorflow | tensorflow/python/ops/control_flow_ops_test.py | Python | apache-2.0 | 12,436 |
#
# Copyright 2008 Google Inc. Released under the GPL v2
import os, pickle, random, re, resource, select, shutil, signal, StringIO
import socket, struct, subprocess, sys, time, textwrap, urlparse
import warnings, smtplib, logging, urllib2
from threading import Thread, Event
try:
import hashlib
except ImportError:
... | wuzhy/autotest | client/common_lib/base_utils.py | Python | gpl-2.0 | 57,760 |
import sqlalchemy as sa
from .exc import ClassNotVersioned, ImproperlyConfigured
from .manager import VersioningManager
from .operation import Operation
from .transaction import TransactionFactory
from .unit_of_work import UnitOfWork
from .utils import (
changeset,
count_versions,
get_versioning_manager,
... | fake-name/ReadableWebProxy | sqlalchemy_continuum_vendored/__init__.py | Python | bsd-3-clause | 3,467 |
#
# Copyright (c) 2004 Conectiva, Inc.
#
# Written by Gustavo Niemeyer <niemeyer@conectiva.com>
#
# This file is part of Smart Package Manager.
#
# Smart Package Manager 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 Fou... | PaulWay/spacewalk | client/solaris/smartpm/smart/commands/upgrade.py | Python | gpl-2.0 | 6,196 |
import re
import os.path
from setuptools import setup, find_packages
HERE = os.path.abspath(os.path.dirname(__file__))
README_PATH = os.path.join(HERE, 'README.md')
try:
with open(README_PATH) as fd:
README = fd.read()
except IOError:
README = ''
INIT_PATH = os.path.join(HERE, 'rollbar/__init__.py')
... | rollbar/pyrollbar | setup.py | Python | mit | 3,249 |
#! /usr/bin/env python
"""
poller-wrapper A small tool which wraps around the poller and tries to
guide the polling process with a more modern approach with a
Queue and workers
Author: Job Snijders <job.snijders@atrato.com>
Date: Jan 2013
Usage: This program... | neokjames/librenms | poller-wrapper.py | Python | gpl-3.0 | 12,589 |
"""Add rejected column
Revision ID: 3a704a54392
Revises: 1371a0c98ad
Create Date: 2015-06-09 12:30:56.039052
"""
# revision identifiers, used by Alembic.
revision = '3a704a54392'
down_revision = '1371a0c98ad'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic ... | Debetux/sr.ht | alembic/versions/3a704a54392_add_rejected_column.py | Python | mit | 607 |
import copy
import exceptions
import json
import math
import time
try:
import RPi.GPIO as gpio
except:
gpio = None
from twisted.application import service
from twisted.internet import task, reactor, defer
from twisted.python import log
from twisted.python.filepath import FilePath
from twisted.web import serve... | calston/pitool | pitool/service.py | Python | mit | 6,191 |
#! /usr/bin/env python
import rospy
import tf
from otl_diff_drive import twist_velocities
from otl_diff_drive import odometry
from nav_msgs.msg import Odometry
from tf.transformations import quaternion_from_euler
class Pose:
def __init__(self, x, y, theta):
self.x = x
self.y = y
self.th... | OTL/otl_diff_drive | nodes/base_odom.py | Python | bsd-3-clause | 3,074 |
# SecuML
# Copyright (C) 2016-2018 ANSSI
#
# SecuML 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.
#
# SecuML is distributed in the h... | ah-anssi/SecuML | SecuML/core/Classification/Monitoring/MulticlassPerfIndicators.py | Python | gpl-2.0 | 3,945 |
#!/usr/bin/env python3
# Copyright 2013 Donald Stufft
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | pypa/twine | twine/__main__.py | Python | apache-2.0 | 1,475 |
# BS mark.1-55
# /* coding: utf-8 */
# © WitcherGeralt, 2012.
def command_YandexMarket(mType, source, body):
if body:
ls = body.split()
c1st = (ls.pop(0)).lower()
if check_number(c1st):
if ls:
c2st = ls.pop(0)
if check_number(c2st):
try:
print c2st
data = read_url("http://m.market.y... | cobrab11/black1-bot | extensions/yandexmarket.py | Python | apache-2.0 | 2,365 |
import ast
import traceback
import os
import sys
userFunctions = {}
renames = ['vex.pragma','vex.motor','vex.slaveMotors','vex.motorReversed']
classNames = []
indent = ' '
sameLineBraces = True
compiled = {}
def module_rename(aNode):
if aNode.func.print_c() == 'vex.pragma':
asC = '#pragma '
useComma =... | NoMod-Programming/PyRobotC | pyRobotC.py | Python | mit | 19,127 |
# 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
# distributed under the... | klmitch/nova | nova/tests/functional/test_availability_zones.py | Python | apache-2.0 | 7,107 |
#!c:\webs\moviestalk\venv\Scripts\python2.7.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'gunicorn==18.0','console_scripts','gunicorn'
__requires__ = 'gunicorn==18.0'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('gunicorn==18.0', 'console_scripts', 'gunico... | bertucho/moviestalk | venv/Scripts/gunicorn-script.py | Python | mit | 333 |
import json
import os
import ssl
import requests
import re
from flask import Flask, redirect, session as sess, jsonify, url_for, make_response
from flask_bouncer import ensure
from jinja2 import Markup
from flask_login import current_user
from sqlalchemy.orm import joinedload
from werkzeug.routing import BaseConverter... | ubc/compair | compair/__init__.py | Python | gpl-3.0 | 10,568 |
from numpy import *
from time import *
from matplotlib.pyplot import *
from scipy.sparse import csr_matrix, coo_matrix
#Main goal for this implementation: avoid poor design choices
class electronbasis():
def __init__(self, N, rs, Nparticles):
self.rs = rs
self.states = []
self.nstates = 0
... | CompPhysics/ThesisProjects | doc/MSc/msc_students/former/AudunHansen/Audun/Pythonscripts/CCD_block_implementation.py | Python | cc0-1.0 | 25,666 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.