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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
'''
Support for Postfix
This module is currently little more than a config file viewer and editor. It
is able to read the master.cf file (which is one style) and files in the style
of main.cf (which is a different style, that is used in multiple postfix
configuration files).
The design of this... | smallyear/linuxLearn | salt/salt/modules/postfix.py | Python | apache-2.0 | 15,966 |
# -*- 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... | pablocm-aserti/l10n_es_gestion_comercial_v8_WIP | l10n_es_gestion_comercial/wizard/check_paid.py | Python | agpl-3.0 | 2,454 |
#!/usr/bin/env python
from app import app
from flask_script import Manager
manager = Manager(app)
if __name__ == "__main__":
manager.run()
| aitoehigie/gidimagic | manage.py | Python | mit | 143 |
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | haniehrajabi/ryu | ryu/tests/unit/ofproto/test_ofproto_parser.py | Python | apache-2.0 | 7,100 |
"""Module grouping tests for the bodemclassificatie search module."""
from owslib.fes import PropertyIsEqualTo
from pydov.search.bodemclassificatie import BodemclassificatieSearch
from pydov.types.bodemclassificatie import Bodemclassificatie
from pydov.util.dovutil import build_dov_url
from tests.abstract import Abstr... | DOV-Vlaanderen/pydov | tests/test_search_bodemclassificatie.py | Python | mit | 1,677 |
# pyca.simple
# One dimensional Cellular Automata
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Fri Jan 31 10:49:41 2014 -0500
#
# Copyright (C) 2014 Bengfort.com
# For license information, see LICENSE.txt
#
# ID: simple.py [] benjamin@bengfort.com $
"""
Space-Time animation for one dimensional c... | bbengfort/cellular-automata | pyca/simple.py | Python | mit | 2,656 |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# Standard imports
from future import standard_library
standard_library.install_aliases()
from builtins import *
import unittest
import datetime as pydt
import logging
imp... | sunil07t/e-mission-server | emission/tests/analysisTests/intakeTests/TestFilterAccuracy.py | Python | bsd-3-clause | 5,514 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""Command for adding tags to instances."""
import copy
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.compute.lib import base_classes
class InstancesAddTags(base_classes.InstanceTagsMutatorMixin,
base_classes.ReadWriteComm... | wemanuel/smry | smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/compute/subcommands/instances/add_tags.py | Python | apache-2.0 | 2,058 |
# Copyright 2013-2015 Rackspace US, 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 i... | ryandub/simpl | simpl/server.py | Python | apache-2.0 | 6,254 |
# Lint as: python3
# 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 ... | tensorflow/lingvo | lingvo/tasks/image/params/mnist.py | Python | apache-2.0 | 1,996 |
from waitress import serve
from pyramid.config import Configurator
from pyramid.view import view_config
from pyramid.response import Response
from pyramid_socketio.io import SocketIOContext, socketio_manage
@view_config(route_name="root", renderer="root/index.mak")
def index(request):
return dict(title="insights v... | thujikun/insights-visualizer | hello.py | Python | mit | 1,223 |
# encoding: utf-8
import sys
sys.path.append('/home/zjd/jmm/JPPCF/')
import os
import numpy as np
import util
from JPPCF import *
import logging
argvs = sys.argv
# We fix the num of latent feature
k = 100
lambd = 0.5
if len(argvs) == 3:
k = int(float(argvs[1]))
lambd = float(argvs[2])
... | bit-jmm/ttarm | demo/trm.py | Python | gpl-2.0 | 10,034 |
import functools
import ipaddress
import itertools
from django import http
from django.contrib import admin, messages
from django.contrib.admin.utils import unquote
from django.db.models import Count, F, Q
from django.db.utils import IntegrityError
from django.http import (
Http404,
HttpResponseForbidden,
... | wagnerand/addons-server | src/olympia/users/admin.py | Python | bsd-3-clause | 22,013 |
# -*- coding: 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 'Dog.in_adoption_process'
db.add_column(u'dogs_dog', 'in_adoption_process',
... | brenolf/myfriend | dogs/migrations/0010_auto__add_field_dog_in_adoption_process.py | Python | apache-2.0 | 8,592 |
#!/usr/bin/python3
import numpy as np
from scipy.sparse.linalg import svds
from scipy import sparse
from math import sqrt
def vector_to_diagonal(vector):
"""
将向量放在对角矩阵的对角线上
:param vector:
:return:
"""
if (isinstance(vector, np.ndarray) and vector.ndim == 1) or \
isinstance(vector,... | ryanorz/code-camp | data_mining/collaborative_filtering/nmf_co_filter.py | Python | apache-2.0 | 4,137 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/xnl_2_0/GeneralSuffixElement.py | Python | gpl-3.0 | 962 |
import math
def sieve(limit):
primes_set = set()
primes = [True] * limit
primes[0] = primes[1] = False
for (i, is_prime) in enumerate(primes):
if is_prime:
primes_set.add(i)
for n in xrange(i*i, limit, i):
primes[n] = False
return primes_set
def P035():
limit = 1000000
prime_se... | brendanzhao/ProjectEuler | src/P035.py | Python | mit | 719 |
import RPi.GPIO as GPIO
from lib_nrf24 import NRF24
import time
import spidev
import sys
GPIO.setmode(GPIO.BCM)
# Build up the radio transmitter
pipe = [0xE8, 0xE8, 0xF0, 0xF0, 0xE1]
radio = NRF24(GPIO, spidev.SpiDev())
radio.begin(0, 17)
radio.setPayloadSize(32)
radio.setChannel(0x76)
radio.setDataRate(NRF24.BR_1MBP... | d3221/urban | urbanBeacon/sendArduinoOnce.py | Python | gpl-3.0 | 1,005 |
# -*- coding: utf-8 -*-
import argparse
import yaml
from os import getcwd
from os.path import (
abspath,
dirname,
exists,
join,
realpath,
isabs
)
from s3deploy.s3 import init as init_s3
from s3deploy.core import (
sync_static_site,
overwrite_static_site
)
parser = argparse.Argument... | petermelias/s3deploy | s3deploy/__init__.py | Python | mit | 1,825 |
#-*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring communication protocols... | dasbruns/netzob | src/netzob/Common/Models/Grammar/States/PrismaState.py | Python | gpl-3.0 | 5,647 |
###############################
# This file is part of PyLaDa.
#
# Copyright (C) 2013 National Renewable Energy Lab
#
# PyLaDa is a high throughput computational platform for Physics. It aims to make it easier to submit
# large numbers of jobs on supercomputers. It provides a python interface to physical input, suc... | pylada/pylada-light | src/pylada/misc/lockfile.py | Python | gpl-3.0 | 6,381 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from hurry.filesize import size
import numpy
from PIL import Image
def read_pixels(filename):
"""Read the image `filename` and return the pixels.
Parameters
----------
filename : string
A path to an image which will be read.
Returns
----... | MartinThoma/datatools | datatools/images.py | Python | mit | 2,198 |
## {{{ http://code.activestate.com/recipes/577715/ (r3)
# Random 2D Slice Of 4D Mandelbrot Fractal
# FB - 201105231
"""Random 2D Slice Of 4D Mandelbrot Fractal.
Modified by Symion 2011
Now works with Visual Python v5.40.
Produce 2D slice of 4D Mandelbrot Fractal and Map it in 3D!
Visu... | ActiveState/code | recipes/Python/577723_2D_slice_4D_Mandelbrot_Fractal_Map_it/recipe-577723.py | Python | mit | 5,397 |
import tensorflow as tf
import numpy as np
x_data = np.random.rand(100)
y_data = x_data * 0.1 + 0.2
b = tf.Variable(0.)
k = tf.Variable(0.)
y = k * x_data + b
loss = tf.reduce_mean(tf.square(y_data - y))
optimizer = tf.train.GradientDescentOptimizer(0.2)
train = optimizer.minimize(loss)
init = tf.global_variables_i... | hwangcc23/programming | tensorflow-hellowork.py | Python | gpl-2.0 | 473 |
"""Tkinter-based GUI for FileSorter."""
import os
import platform
import sorter
import sys
from Tkinter import *
import tkFileDialog
import util
__author__ = "Alex Cappiello"
__license__ = "See LICENSE.txt"
import sys
import util
# Workaround for wonky Python handling of lambdas in the widget commands.
# Workarou... | acappiello/file-sorter | tkgui.py | Python | mit | 7,071 |
from fiona import crs
def test_proj_keys():
assert len(crs.all_proj_keys) == 86
assert 'init' in crs.all_proj_keys
assert 'proj' in crs.all_proj_keys
assert 'no_mayo' in crs.all_proj_keys
def test_from_string():
# A PROJ.4 string with extra whitespace.
val = crs.from_string(
" +proj=l... | johanvdw/Fiona | tests/test_crs.py | Python | bsd-3-clause | 2,552 |
# Copyright 2014 Open Connectome Project (http://openconnecto.me)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | openconnectome/ocptilecache | tilecache/removeDataset.py | Python | apache-2.0 | 1,223 |
# Copyright 2017 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 or agreed to in writing, s... | cschnei3/forseti-security | tests/common/util/log_util_test.py | Python | apache-2.0 | 2,137 |
from Tkinter import *
import mimetypes
class AreaVi(Text):
ACTIVE = None
def __init__(self, default_filename, *args, **kwargs):
"""
This class receives all Text widget arguments
and one named default_filename which means
the filename that is saved when no filename
is sp... | kk9599/vy | vyapp/areavi.py | Python | mit | 42,534 |
from __future__ import print_function, absolute_import
from collections import OrderedDict
import json
from functools import partial
import operator
import os
import traceback
import logging
from ...vendor import Qt
from pymel.core import Callback, cmds, hide, scriptJob, select, selected, setParent, PyNode, \
... | patcorwin/fossil | pdil/tool/fossil/main.py | Python | bsd-3-clause | 32,622 |
#!/usr/bin/env python
import subprocess
import praw
from hashlib import sha1
from flask import Flask
from flask import Response
from flask import request
from cStringIO import StringIO
from base64 import b64encode
from base64 import b64decode
from ConfigParser import ConfigParser
import OAuth2Util
import os
import mar... | foobarbazblarg/stayclean | stayclean-2018-march/serve-signups-with-flask.py | Python | mit | 8,581 |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from electrum_dgc.i18n import _
class ReceivingWidget(QTreeWidget):
def toggle_used(self):
if self.hide_used:
self.hide_used = False
self.setColumnHidden(2, False)
else:
self.hide_used = True
self.... | testalt/electrum-dgc | gui/qt/receiving_widget.py | Python | gpl-3.0 | 2,848 |
"""Contains the BulletinBoard class."""
__all__ = ['BulletinBoard']
from direct.directnotify import DirectNotifyGlobal
class BulletinBoard:
"""This class implements a global location for key/value pairs to be
stored. Intended to prevent coders from putting global variables directly
on showbase, so that p... | chandler14362/panda3d | direct/src/showbase/BulletinBoard.py | Python | bsd-3-clause | 2,027 |
import os
import sys
import time
import smtplib
import traceback
import shutil
from xcsoar.mapgen.server.job import Job
from xcsoar.mapgen.generator import Generator
from xcsoar.mapgen.util import check_commands
class Worker:
def __init__(self, dir_jobs, dir_data, mail_server):
check_commands()
sel... | fberst/mapgen | lib/xcsoar/mapgen/server/worker.py | Python | gpl-2.0 | 4,027 |
from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint
from CTFd.utils import admins_only, is_admin, unix_time, get_config, \
set_config, sendmail, rmdir, create_image, delete_image, run_image, container_status, container_ports, \
container_stop, container_start, g... | gibsonnathan/CTFd | CTFd/admin/scoreboard.py | Python | apache-2.0 | 1,388 |
"""
Tests for Discussion API serializers
"""
import itertools
from urlparse import urlparse
import ddt
import httpretty
import mock
from django.test.client import RequestFactory
from discussion_api.serializers import CommentSerializer, ThreadSerializer, get_context
from discussion_api.tests.utils import (
Commen... | rhndg/openedx | lms/djangoapps/discussion_api/tests/test_serializers.py | Python | agpl-3.0 | 27,357 |
from django.contrib.sites.models import Site
from django.db import models
class Article(models.Model):
sites = models.ManyToManyField(Site)
headline = models.CharField(max_length=100)
publications = models.ManyToManyField("model_package.Publication", null=True, blank=True,)
| denisenkom/django | tests/model_package/models/article.py | Python | bsd-3-clause | 289 |
###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary for... | Nikea/VisTrails | scripts/update_copyright_year.py | Python | bsd-3-clause | 3,291 |
#
# Copyright (c) 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | NervanaSystems/coach | rl_coach/agents/dqn_agent.py | Python | apache-2.0 | 4,788 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsProject.
.. note:: 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.
"""
__auth... | myarjunar/QGIS | tests/src/python/test_qgsmaplayerregistry.py | Python | gpl-2.0 | 20,785 |
# $Id: buddy.py 4704 2014-01-16 05:30:46Z ming $
#
# pjsua Python GUI Demo
#
# Copyright (C)2013 Teluu Inc. (http://www.teluu.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 versio... | yuezhou/telephony2 | telephony/Classes/pjproject-2.2.1/pjsip-apps/src/pygui/buddy.py | Python | mit | 4,267 |
from uw_hfs.dao import Hfs_DAO
| uw-it-aca/uw-restclients | restclients/dao_implementation/hfs.py | Python | apache-2.0 | 31 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
urlpatterns = patterns('aldryn_mailchimp.views',
url(r'^(?P<pk>[0-9]+)/(?P<slug>[\w.@+-]+)/$', 'campaign_detail', name='mailchimp_campaign_detail'),
)
| CT-Data-Collaborative/ctdata-mailchimp | ctdata_mailchimp/urls.py | Python | bsd-3-clause | 224 |
import pinky
class TheBrain:
def __init__(self, email, password):
self.pinky = pinky.Pinky(email, password)
def take_over_the_world(self):
# unconditional help
energy = self.pinky.energy_levels()
if (not self.pinky.is_alive()) or energy['max'] - energy['value'] < 8:
... | frcr/thetalesimplebot | thebrain.py | Python | mit | 696 |
import pyglet
from pyglet.gl import*
from unit import Unit
from gun import Gun
from math import pi, sin, cos
from utils import load_image
from random import randint
from utils import*
from resources import*
from shared import*
glEnable(GL_BLEND)
class PlayerUnitHandlers(object):
def __init__(self, player):
... | Eaglemania/ASS | player.py | Python | gpl-2.0 | 9,494 |
# Copyright 2011 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.
r"""Instrumentation-based profiling for Python.
trace_event allows you to hand-instrument your code with areas of interest.
When enabled, trace_event logs th... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/third_party/py_trace_event/src/trace_event.py | Python | mit | 6,729 |
"""Tests for forbes implementation."""
import pytest
from forbes import *
@pytest.fixture
def data():
"""Fixture to get jason data."""
return get_json()
def test_billionaire_age_valid(data):
"""Test that find billionaire finds youngest billionaire with valid age."""
result = find_billionaire(data)
... | serashioda/code-katas | src/tests/test_forbes.py | Python | mit | 1,438 |
import psycopg2
from .db_controller import DbController
class Hashtag:
def __init__(self, name):
self.name = name
self.__db = DbController(table='Event')
@staticmethod
def create_hashtag(name):
try:
db = DbController(table='Event')
db.create(name... | lubchenko05/belka.system | belkaBot/logic/hashtag.py | Python | mit | 1,274 |
try:
from unittest import mock
except ImportError:
import mock
from docker_custodian.docker_autostop import (
build_container_matcher,
get_opts,
has_been_running_since,
main,
stop_container,
stop_containers,
)
def test_stop_containers(mock_client, container, now):
matcher = mock.M... | Yelp/docker-custodian | tests/docker_autostop_test.py | Python | apache-2.0 | 2,726 |
# -*- coding: utf-8 -*-
# Copyright 2013 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 requi... | koder-ua/nailgun-fcert | nailgun/nailgun/api/v1/handlers/node.py | Python | apache-2.0 | 8,916 |
import ConfigParser
import os.path as op
from .data_collection import ta_mod_input as ta_input
from .ta_cloud_connect_client import TACloudConnectClient as CollectorCls
from ..common.lib_util import (
get_main_file, get_app_root_dir, get_mod_input_script_name
)
def _load_options_from_inputs_spec(app_root, stanza... | georgestarcher/TA-SyncKVStore | bin/ta_synckvstore/cloudconnectlib/splunktacollectorlib/cloud_connect_mod_input.py | Python | mit | 2,338 |
from dartcms import get_model
from dartcms.utils.config import DartCMSConfig
from django.utils.translation import ugettext_lazy as _
from .forms import ProductCatalogForm
app_name = 'catalog'
ProductCatalog = get_model('shop', 'ProductCatalog')
config = DartCMSConfig({
'model': ProductCatalog,
'grid': {
... | astrikov-d/dartcms | dartcms/apps/shop/catalog/urls.py | Python | mit | 796 |
from rest_framework import generics
from rest_framework.exceptions import PermissionDenied
from django.utils.timezone import datetime
from .models import PrivateMessage, GroupMessage
from .serializers import PrivateMessageListCreateSerializer, PrivateMessageRetrieveUpdateDestroySerializer
from .serializers import Gro... | olegpshenichniy/truechat | server/api/message/views.py | Python | mit | 2,941 |
# coding: utf-8
from ..views import employee
from ..tests.base import BaseTest
from ..tests.helpers import *
from .. import factories
class BaseEmployeeTest(BaseTest):
view_path = None
def get_update_params(self):
division = models.Division.objects.all()[0]
p = {
'username': 'iv... | telminov/sw-django-division-perm | division_perm/tests/test_employee.py | Python | mit | 4,896 |
# -*- coding: utf-8 -*-
##
# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
# This file is part of openmano
# 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 ... | nfvlabs/openmano | openvim/httpserver.py | Python | apache-2.0 | 95,390 |
# lint-amnesty, pylint: disable=missing-module-docstring
class Creator(object):
"""
A placeholder class that provides a way to set the attribute on the model.
"""
def __init__(self, field):
self.field = field
def __get__(self, obj, type=None): # lint-amnesty, pylint: disable=redefined-buil... | stvstnfrd/edx-platform | openedx/core/djangoapps/util/model_utils.py | Python | agpl-3.0 | 1,102 |
# coding=utf-8
from app import mongo_utils
from bson import json_util
from flask import Blueprint, render_template, request, Response,session
import json
import time
from datetime import datetime
from operator import itemgetter
mod_main = Blueprint('main', __name__)
@mod_main.route('/', methods=['GET'])
def index():
... | crtarsorg/glasomer.rs-v2 | app/mod_main/views.py | Python | cc0-1.0 | 17,233 |
# Copyright (c) 2007-2009 Citrix Systems Inc.
#
# 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 2 only.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ... | jamesbulpin/xsconsole | XSConsoleHotData.py | Python | gpl-2.0 | 19,975 |
# import std libs
import os
from pkg_resources import resource_filename
import json
# import third party libs
import jinja2
# import local libs
from cycle.meta import __title__ as pkgname
def format_json(data):
return json.dumps(data, indent=2, sort_keys=True)
def load_resource_json(resource_path, pkgname=pkgnam... | refnode/python-cycle | src/cycle/utils.py | Python | apache-2.0 | 841 |
from __future__ import unicode_literals
from unittest import TestCase
import requests
import requests_mock
import time
try:
from urlparse import urlparse, parse_qs
except ImportError:
from urllib.parse import urlparse, parse_qs
from oauthlib.oauth2.rfc6749.errors import InvalidGrantError
from requests_oauthl... | requests/requests-oauthlib | tests/test_compliance_fixes.py | Python | isc | 14,397 |
# coding: utf-8
#
# SearchEntry - An enhanced search entry with timeout
#
# Copyright (C) 2007 Sebastian Heinlein
# 2007-2009 Canonical Ltd.
#
# Authors:
# Sebastian Heinlein <glatzor@ubuntu.com>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Gene... | sti-lyneos/shop | softwarecenter/ui/gtk3/widgets/searchentry.py | Python | lgpl-3.0 | 5,342 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | datacommonsorg/data | scripts/us_epa/ghgrp/download.py | Python | apache-2.0 | 6,169 |
# Lazygal, a lazy static web gallery generator.
# Copyright (C) 2007-2012 Alexandre Rossi <alexandre.rossi@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 Li... | Konubinix/lazygal | lazygal/__init__.py | Python | gpl-2.0 | 2,278 |
from nltk.corpus import treebank
from nltk.tag import tnt, CRFTagger
# split training data from test data
train_data = treebank.tagged_sents()[:3000]
test_data = treebank.tagged_sents()[3000:]
# train a trigram N tagger (TnT)
tnt_pos_tagger = tnt.TnT()
tnt_pos_tagger.train(train_data)
print tnt_pos_tagger.evaluate(t... | Elixeus/NLP | own_model.py | Python | mit | 497 |
"""SCons.Debug
Code for debugging SCons internal things. Shouldn't be
needed by most users.
"""
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# 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... | IljaGrebel/OpenWrt-SDK-imx6_HummingBoard | staging_dir/host/lib/scons-2.3.5/SCons/Debug.py | Python | gpl-2.0 | 6,970 |
from src.types.game import Game
from src.types.player import Player
class GamesAndPlayers(object):
def __init__(self, player_db):
self.player_db = player_db
def parse(self, data):
pdb = self.player_db
# Single values
self.points = data.get('CurrentTotalPoints')
# Arr... | gak/giant-multiplayer-robot-helper | src/types/games_and_players.py | Python | mit | 846 |
from PIL import Image
import os.path,os
#import pickle
#import sqlite3
import hashlib
import time
import random
import logging
import copy
import threading
import itertools
from math import ceil
from enum import Enum
from copy import deepcopy
import itertools
from lipyc.utility import recursion_protect
from lipyc.Ver... | severus21/LiPyc | src/Album.py | Python | apache-2.0 | 4,909 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from pyparsecom.query import Query
from pyparsecom.objects import ParseObject
from tests import init_parse
class QueryTest(unittest.TestCase):
def setUp(self):
init_parse()
def tearDown(self):
pass
def create_cities(self):
... | justinwp/pyparsecom | tests/test_Query.py | Python | mit | 3,440 |
"""
tests for quantecon.compute_fp module
@author : Spencer Lyon
@date : 2014-07-31
References
----------
https://www.math.ucdavis.edu/~hunter/book/ch3.pdf
TODO: add multivariate case
"""
from __future__ import division
import unittest
from quantecon import compute_fixed_point
class TestFPLogisticEquation(unitte... | dingliumath/quant-econ | quantecon/tests/test_compute_fp.py | Python | bsd-3-clause | 2,288 |
# -*- coding: utf-8 -*-
"""
Copyright © 2017 - Alexandre Machado <axmachado@gmail.com>
This file is part of Simple POS Compiler.
Simnple POS Compiler 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 Found... | axmachado/simplepos | simplepos/codegen/boolean.py | Python | gpl-3.0 | 15,374 |
from datetime import datetime, timedelta
from dateutil import tz
import numpy as np
import pandas as pd
from pandas import DataFrame, Index, Series, Timestamp, date_range
from pandas.util import testing as tm
class TestDatetimeIndex(object):
def test_setitem_with_datetime_tz(self):
# 16889
# su... | GuessWhoSamFoo/pandas | pandas/tests/indexing/test_datetime.py | Python | bsd-3-clause | 11,482 |
# -*- coding: utf-8 -*-
# pyLottoSimu,
# Copyright (C) <2012-2018> Markus Hackspacher
# This file is part of pyLottoSimu.
# pyLottoSimu 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 t... | MarkusHackspacher/pyLottoSimu | tests/__init__.py | Python | gpl-3.0 | 780 |
"""MolLib command line interface
"""
# Author: Justin L Lorieau
# Copyright 2016
import argparse
import logging
import sys
import os
import mollib
from mollib.utils import FormattedStr
from mollib.plugins import PluginManager
from mollib.core import list_global_settings, load_settings
import mollib.utils.settings
t... | jlorieau/mollib | mollib/__main__.py | Python | gpl-3.0 | 4,658 |
import sys
import operator
import pytest
import ctypes
import gc
import types
from typing import Any
import numpy as np
from numpy.core._rational_tests import rational
from numpy.core._multiarray_tests import create_custom_field_dtype
from numpy.testing import (
assert_, assert_equal, assert_array_equal, assert_ra... | numpy/numpy | numpy/core/tests/test_dtype.py | Python | bsd-3-clause | 68,138 |
# $Id$ *** pyformex ***
##
## This file is part of pyFormex 0.8.9 (Fri Nov 9 10:49:51 CET 2012)
## pyFormex is a tool for generating, manipulating and transforming 3D
## geometrical models by sequences of mathematical operations.
## Home page: http://pyformex.org
## Project page: http://savannah.nongnu.org/proj... | dladd/pyFormex | pyformex/examples/Demos/BarrelVault2.py | Python | gpl-3.0 | 3,104 |
# (c) Copyright 2013-2015 Hewlett Packard Enterprise Development LP
# All Rights Reserved.
#
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the Licen... | phenoxim/cinder | cinder/volume/drivers/hpe/hpe_3par_base.py | Python | apache-2.0 | 22,301 |
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="arpa_linker",
version="0.6.0",
author="Erkki Heino",
description="Tool for linking rdf datasets to other datasets using ARPA",
license="MIT",
keywords="... | SemanticComputing/python-arpa-linker | setup.py | Python | mit | 549 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# tvalacarta - XBMC Plugin
# Canal para Ecuador TV
# http://blog.tvalacarta.info/plugin-xbmc/tvalacarta/
#------------------------------------------------------------
import urlparse,re
import urllib
import os
from core import logger... | uannight/reposan | plugin.video.tvalacarta/channels/ecuadortv.py | Python | gpl-2.0 | 5,395 |
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from .views import LatestView, ByView
urlpatterns = [
url(r'^latest$', LatestView.as_view(), name='history-latest'),
url(r'^by/user/(?P<user_id>\d+)$', ByView.as_view(), name='history-by-user'... | futurice/django-history | djangohistory/urls.py | Python | bsd-3-clause | 492 |
# Copyright 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 ... | dukhlov/oslo.messaging | oslo_messaging/_drivers/zmq_driver/broker/zmq_base_proxy.py | Python | apache-2.0 | 1,462 |
from flask import Flask
from flask import render_template
from flask import request
import json
import dbconfig
if dbconfig.test:
from mockdbhelper import MockDBHelper as DBHelper
else:
from dbhelper import DBHelper
app = Flask(__name__)
DB = DBHelper()
@app.route("/")
def home():
crimes = DB.get_all_cri... | nikitabrazhnik/flask2 | Module 1/Chapter07/crimemap.py | Python | mit | 851 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | tylertian/Openstack | openstack F/keystone/keystone/clean.py | Python | apache-2.0 | 1,803 |
# Definition of the version number
import os
from io import open as io_open
__all__ = ["__version__"]
# major, minor, patch, -extra
version_info = 4, 15, 0
# Nice string for the version
__version__ = '.'.join(map(str, version_info))
# auto -extra based on commit hash (if not tagged as release)
scriptdir = os.path.... | HesselTjeerdsma/Cyber-Physical-Pacman-Game | Algor/flask/lib/python2.7/site-packages/tqdm/_version.py | Python | apache-2.0 | 2,318 |
# -*- encoding: utf-8 -*-
from .base import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'temp.db', # Or path to database file if using sqlite3.
'USER': ... | pkimber/search | example_search/dev_test.py | Python | apache-2.0 | 1,119 |
from numpy import arange, power, genfromtxt
from define_my_consts import sigma, L_CO2, L_CO2_175, s_CO2, mu_CO2, R, beta, ro_CO2, epsilon, Cp_Co2ice
def CO2_phase_diagram(Trange):
Temp = Trange[0] + arange(Trange[-1]-Trange[0]+1)
# --- CO2 phase diagram for T<-56.4C ---
Pres = 0.01316*power(10.0, -135... | portyankina/little_helpers | CO2_phase_diagram.py | Python | bsd-3-clause | 2,025 |
from frowns import Smiles
mol = Smiles.smilin("c1ccccc1CCC1CC1")
index = 0
for cycle in mol.cycles:
print "cycle", index
print "\t", cycle.atoms
print "\t", cycle.bonds
index = index + 1
| tuffery/Frog2 | frowns/docs/examples/example8.py | Python | gpl-3.0 | 205 |
__author__ = 'odrulea'
from lib.devices import get_supported_metrics, get_supported_devices, RABBITMQ_ADDRESS, MOCK_DEVICE_ID
import argparse
import imp
import os
import yaml
import time
import threading
from lib.constants import colors
_SUPPORTED_DEVICES = get_supported_devices()
_SUPPORTED_METRICS = get_supported_m... | octopicorn/bcikit | Analysis/AnalysisService.py | Python | agpl-3.0 | 5,988 |
"""
URLs for LMS
"""
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.views.generic.base import RedirectView
from ratelimitbackend import admin
from django.conf.urls.static import static
import auth_exchange.views
from courseware.views.views import EnrollStaffView
from ... | Livit/Livit.Learn.EdX | lms/urls.py | Python | agpl-3.0 | 35,570 |
#!/usr/bin/env python3
#
# grmpy documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 18 13:05:32 2017.
#
# 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.
#
# All ... | grmToolbox/grmpy | docs/conf.py | Python | mit | 5,902 |
"""
https://github.com/renskiy/fabricio/blob/master/examples/service/kubernetes
"""
import fabricio
from fabric import api as fab
from fabricio import tasks, kubernetes
from fabricio.misc import AvailableVagrantHosts
from six.moves import filter
hosts = AvailableVagrantHosts(guest_network_interface='eth1')
service ... | renskiy/fabricio | examples/service/kubernetes/fabfile.py | Python | mit | 2,512 |
import sys
def error(m):
sys.stderr.write(str(m) + '\n')
| vim-scripts/Threesome | autoload/threesomelib/util/io.py | Python | mit | 63 |
from math import factorial
def fsum(n): return sum(factorial(int(d)) for d in str(n))
print(sum(n for n in range(3, 45000) if n == fsum(n)))
| jokkebk/euler | p34.py | Python | mit | 143 |
import os
from subprocess import Popen, PIPE
from selenium import webdriver
import time
abspath = lambda *p: os.path.abspath(os.path.join(*p))
ROOT = abspath(os.path.dirname(__file__))
def execute_command(command):
result = Popen(command, shell=True, stdout=PIPE).stdout.read()
if len(result) > 0 and not res... | mhfowler/brocascoconut | bots/screenshot.py | Python | mit | 4,885 |
# -*- coding: utf-8 -*-
#
# boing/net/tcp.py -
#
# Authors: Nicolas Roussel (nicolas.roussel@inria.fr)
# Paolo Olivo (paolo.olivo@inria.fr)
#
# Copyright © INRIA
#
# See the file LICENSE for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
import logging
import s... | olivopaolo/boing | boing/net/tcp.py | Python | gpl-2.0 | 6,209 |
"""
Programmer : EOF
E-mail : jasonleaster@163.com
File : svm.py
Date : 2015.12.13
You know ... It's hard time but it's not too bad to say give up.
"""
import numpy
class SVM:
def __init__(self, Mat, Tag, C = 2, MAXITER = 200):
self._Mat = numpy.array(Mat)
self._Tag =... | jasonleaster/Machine_Learning | SVM/svm.py | Python | gpl-2.0 | 9,610 |
# Copyright (C) 2010-2017 GRNET S.A.
#
# 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 i... | grnet/synnefo | snf-cyclades-app/synnefo/logic/management/commands/port-remove.py | Python | gpl-3.0 | 2,495 |
# -*- coding: utf-8 -*-
from sqlalchemy.ext.declarative import declarative_base
from tgext.pluggable import PluggableSession
DBSession = PluggableSession()
DeclarativeBase = declarative_base()
def init_model(app_session):
DBSession.configure(app_session)
from models import *
| nomed/cashup | cashup/model/__init__.py | Python | mit | 284 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import with_statement
from collections import OrderedDict
import numpy as np
import pyqtgraph as pg
import scipy
import six
from six.moves import range
from six.moves import zip
import acq4.util.functions as fn
import acq4.util.ptime as pt... | acq4/acq4 | acq4/devices/MockCamera/mock_camera.py | Python | mit | 14,519 |
# Copyright 2013-2020 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 *
import spack.paths
class UrlListTest(Package):
"""Mock package with url_list."""
homepage =... | iulian787/spack | var/spack/repos/builtin.mock/packages/url-list-test/package.py | Python | lgpl-2.1 | 793 |
# encoding: utf-8
if __name__ == '__main__':
from PyQt5 import Qt, QtWidgets, QtCore
enter_event = Qt.QKeyEvent(Qt.QEvent.KeyPress, Qt.Qt.Key_Enter, Qt.Qt.NoModifier)
import MainPane
MainPane.start_app() | yauchien/Bot-Visitor | main.py | Python | gpl-2.0 | 220 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.