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 (C) 2014 Andrey Antukh <niwi@niwi.be>
# 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 the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This progra... | Zaneh-/bearded-tribble-back | taiga/events/events.py | Python | agpl-3.0 | 3,133 |
"""ModelLoader reads python modules as specified at runtime, loading and instantiating
objects.
"""
import importlib
import logging
import os
class ModelLoader(object):
"""Load Model from config
Examples
--------
Call :py:meth:`ModelLoader.load` to create, load and return a
:class:`Model` object.... | nismod/smif | src/smif/data_layer/model_loader.py | Python | mit | 2,774 |
from .theExceptions import ConnectionError, CreationError, DeletionError, UpdateError
class User(object):
"""This class represents a user"""
def __init__(self, users, jsonData = None):
if jsonData is None:
jsonData = {}
self._store = {}
self.users = users
self.connec... | tariqdaouda/pyArango | pyArango/users.py | Python | apache-2.0 | 5,657 |
# allefriezen naar sqlite.py - Convert A2A dump to relational sqlite3 database
#
# Copyright (C) 2016 T.Hofkamp
#
# 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 ... | tofkamp/akteconnect | allefriezen naar sqlite.py | Python | gpl-3.0 | 12,006 |
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
st_line_id = vals... | mozaik-association/mozaik | mozaik_account/models/account_move_line.py | Python | agpl-3.0 | 1,390 |
#!/usr/bin/python
import time
import datetime
try:
f = open('ActivatedAlarmTimes.log', 'r')
lines = f.readlines()
f.close()
start = True
while(start == True):
method = raw_input("Enter what method you want to use to clean the log file. Delete line per line: 'line', or delete per date rang... | skidekeersmaecker/raspi-cursus | labo5/tool.py | Python | mit | 2,255 |
# -*- coding: utf-8 -*-
from flask import Flask, url_for, render_template, request
from format_name import *
import requests
app = Flask(__name__)
@app.route('/', methods=['GET','POST'])
def api_root():
if request.method == 'POST':
movie_name= format_name(request.form[u'movie_name'])
url = "http:/... | benoittgt/flask_omdb_api | flask_demo.py | Python | mit | 690 |
import os
import re
from nose.tools import raises
import seqpoet
class TestSequence:
def setup(self):
self.seq1 = 'ACATacacagaATAgagaCacata'
self.illegal = 'agagcatgcacthisisnotcorrect'
def test_sequence_length(self):
s = seqpoet.Sequence(self.seq1)
assert len(s) == len(self... | maehler/seqpoet | seqpoet/tests/test_sequence.py | Python | mit | 1,544 |
"""
This module complements the math and cmath builtin modules by providing
fast machine precision versions of some additional functions (gamma, ...)
and wrapping math/cmath functions so that they can be called with either
real or complex arguments.
"""
import operator
import math
import cmath
# Irrational (?) consta... | nsalomonis/AltAnalyze | stats_scripts/mpmath/math2.py | Python | apache-2.0 | 18,562 |
import unittest, string
from test import test_support, string_tests
from UserList import UserList
class StringTest(
string_tests.CommonTest,
string_tests.MixinStrStringUserStringTest
):
type2test = str
def checkequal(self, result, object, methodname, *args):
realresult = getattr(string, m... | antb/TPT----My-old-mod | src/python/stdlib/test/test_string.py | Python | gpl-2.0 | 9,160 |
import sys
import unittest
from sympy import symbols, sin, cos, Rational, expand, collect, simplify, Symbol
from galgebra.printer import Format, Eprint, Get_Program, latex, GaPrinter, ZERO_STR
from galgebra.ga import Ga, one, zero
from galgebra.mv import Mv, Nga
# for backward compatibility
from galgebra.mv import ONE,... | arsenovic/galgebra | test/test_test.py | Python | bsd-3-clause | 16,441 |
# -*- coding: utf-8 -*-
"""
This module contains ExtensionLoader class that works with "model"
folder and is used to initialize the pipeline with all available image
processing categories and their respective algorithms. It uses config.json
settings to initialize image processing categories accordingly.
Extension... | LumPenPacK/NetworkExtractionFromImages | osx_build/nefi2_osx_amd64_xcode_2015/bin/nefi2/model/ext_loader.py | Python | bsd-2-clause | 4,135 |
#!/usr/bin/env python
import subprocess
import re
import os
import collections
class Platform(object):
pass
sdk_re = re.compile(r'.*-sdk ([a-zA-Z0-9.]*)')
def sdkinfo(sdkname):
ret = {}
for line in subprocess.Popen(['xcodebuild', '-sdk', sdkname, '-version'], stdout=subprocess.PIPE).stdout:
kv ... | zwaldowski/libffi-iOS | generate-osx-source-and-headers.py | Python | mit | 5,134 |
"""
Copyright (c) 2015 Michael Bright and Bamboo HR LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | BambooHR/rapid | rapid/master/controllers/api/upgrade_controller.py | Python | apache-2.0 | 1,295 |
# coding: utf-8
import time
import sublime
from sublime_plugin import WindowCommand
from .util import noop
from .cmd import GitCmd
from .helpers import GitStashHelper, GitStatusHelper, GitErrorHelper
class GitStashWindowCmd(GitCmd, GitStashHelper, GitErrorHelper):
def pop_or_apply_from_panel(self, action):
... | SublimeGit/SublimeGit | sgit/stash.py | Python | mit | 3,127 |
import os.path
import re
from anki.template import Template
class View(object):
# Path where this view's template(s) live
template_path = '.'
# Extension for templates
template_extension = 'mustache'
# The name of this template. If none is given the View will try
# to infer it based on the ... | victos/busuu_anki | anki/template/view.py | Python | agpl-3.0 | 3,397 |
"""
BrowserPlus
-----------
Advanced Mechanize browser.
"""
from setuptools import setup, find_packages
from browserplus import __version__
setup(
name='browserplus',
version=__version__,
url='https://github.com/vinceau/browserplus',
license='MIT',
author='Vince Au',
author_email='vinceau09@g... | xujun10110/browserplus | setup.py | Python | mit | 1,053 |
# -*- coding: utf-8 -*-
# © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
{
'name': 'URL attachment',
'version': '9.0.2.0.1',
'category': 'Tools',
'author': "Tecnativa,"
... | ClearCorp/knowledge | document_url/__openerp__.py | Python | agpl-3.0 | 622 |
#! /usr/bin/python
# Joe Deller 2014
# A simple colour version of the jsw.py code
# Level : Advanced
# Uses : Libraries, variables, operators, loops, lists
import mcpi.minecraft as minecraft
import mcpi.block as block
import time
# In this version there are only three frames of animation
def drawFrame(x, y, z, fr... | joedeller/pymine | jswcolour.py | Python | mit | 7,176 |
# comments.views
# PYTHON
import json
# DJANGO
from django.contrib import messages
from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.urlresolvers import reverse
from django.db.models import Max
from django.db.models import Q
from django.http import HttpResponse, HttpResponse... | valuesandvalue/valuesandvalue | vavs_project/comments/views.py | Python | mit | 3,904 |
class PlanningFailedError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
| jonbinney/python-planning | python_task_planning/src/python_task_planning/exceptions.py | Python | mit | 138 |
# Copyright (C) 2006, Giovanni Bajo
# Based on previous work under copyright (c) 2001, 2002 McMillan Enterprises, 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; either version 2
# of the... | pdubroy/kurt | build/MacOS/PyInstaller/pyinstaller-svn-r812/hooks/shared_PIL_SpiderImagePlugin.py | Python | gpl-2.0 | 1,278 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# stats.py - part of the FDroid server tools
# Copyright (C) 2010-13, Ciaran Gultnieks, ciaran@ciarang.com
#
# 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
# the Free So... | fantastico/fdroidserver | fdroidserver/stats.py | Python | agpl-3.0 | 10,581 |
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | danakj/chromium | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py | Python | bsd-3-clause | 4,329 |
import signal
import time
import os
import copy
import json
import tempfile
import pickle
import itertools
import sys
import multiprocessing
import pyfastaq
import minimap_ariba
from ariba import cluster, common, histogram, mlst_reporter, read_store, report, report_filter, reference_data, tb
class Error (Exception): p... | martinghunt/ariba | ariba/clusters.py | Python | gpl-3.0 | 28,393 |
#!/usr/bin/env python
import os,os.path,shutil
bin_path = os.path.abspath(__file__)
d_path = os.path.abspath(os.path.join(bin_path, os.pardir))
m_path = os.path.abspath(os.path.join(d_path, os.pardir))
y_path = os.path.abspath(os.path.join(m_path, os.pardir))
category_path = os.path.abspath(os.path.join(y_path, os.pard... | expertmm/integratoredu | etc/moveit.py | Python | gpl-3.0 | 4,480 |
# Copyright 2013-2021 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)
"""Tests for the `spack.verify` module"""
import os
import shutil
import llnl.util.filesystem as fs
import spack.spec
im... | LLNL/spack | lib/spack/spack/test/verification.py | Python | lgpl-2.1 | 7,097 |
# Volatility
# Copyright (C) 2007-2013 Volatility Foundation
#
# This file is part of Volatility.
#
# Volatility is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your o... | wroersma/volatility | volatility/plugins/mac/pstasks.py | Python | gpl-2.0 | 1,687 |
import sys
import rlp
from utils import int_to_big_endian, big_endian_to_int, safe_ord
import db
def _encode_optimized(item):
"""RLP encode (a nested sequence of) bytes"""
if isinstance(item, bytes):
if len(item) == 1 and ord(item) < 128:
return item
prefix = length_prefix(len(item... | pipermerriam/pyethereum | ethereum/fast_rlp.py | Python | mit | 3,196 |
# Copyright 2019 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... | jhseu/tensorflow | tensorflow/python/keras/distribute/keras_image_model_correctness_test.py | Python | apache-2.0 | 6,440 |
"""Support to keep track of user controlled booleans for within automation."""
from __future__ import annotations
import logging
import voluptuous as vol
from homeassistant.const import (
ATTR_EDITABLE,
CONF_ICON,
CONF_ID,
CONF_NAME,
SERVICE_RELOAD,
SERVICE_TOGGLE,
SERVICE_TURN_OFF,
S... | w1ll1am23/home-assistant | homeassistant/components/input_boolean/__init__.py | Python | apache-2.0 | 6,512 |
# -*- coding: UTF-8 -*-
"""
Lastship Add-on (C) 2019
Credits to Placenta and Covenant; our thanks go to their creators
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 vers... | lastship/plugin.video.lastship | resources/lib/modules/directstream.py | Python | gpl-3.0 | 11,429 |
# -*- 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 'PurpleRobotDeviceNote'
db.create_table(u'purple_robot_app... | cbitstech/Purple-Robot-Django | migrations/0034_auto__add_purplerobotdevicenote.py | Python | gpl-3.0 | 10,647 |
# -*- coding: utf-8 -*-
"""
This module provides all functionality for the tracking events during an VSG process.
The module defines the class VSGLogger. The VSGLogger class provides the main functionality of using Python's native logging process. Since Python allows period-separated hierarchical value (e.g. "VSG.Mo... | dbarsam/python-vsgen | vsgen/util/logger.py | Python | mit | 8,737 |
"""A library of helper functions for the CherryPy test suite."""
import datetime
import io
import logging
import os
import re
import subprocess
import sys
import time
import unittest
import warnings
import contextlib
import portend
import pytest
from cheroot.test import webtest
import cherrypy
from cherrypy._cpcomp... | JonnyWong16/plexpy | lib/cherrypy/test/helper.py | Python | gpl-3.0 | 16,369 |
# vim:fileencoding=utf-8
from calibre.constants import plugins
monotonicp, err = plugins['monotonic']
if err:
raise RuntimeError('Failed to load the monotonic module with error: ' + err)
monotonic = monotonicp.monotonic
del monotonicp, err
| jelly/calibre | src/calibre/utils/monotonic.py | Python | gpl-3.0 | 246 |
import numpy as np
from .core import LayerBase, FFBase, NoParamMixin
from ..ops import Sigmoid
from ..util import white, rtm
sigmoid = Sigmoid()
class HighwayLayer(FFBase):
"""
Neural Highway Layer
Based on Srivastava et al., 2015
A carry gate is applied to the raw input.
A transform gate is a... | csxeba/ReSkiv | brainforge/layers/fancy.py | Python | gpl-3.0 | 4,450 |
# 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 may not use this file ex... | MobinRanjbar/hue | desktop/core/src/desktop/lib/rest/http_client.py | Python | apache-2.0 | 5,229 |
"""Optimization index for accelerated response of api status.
Revision ID: 27a3d7e96d1f
Revises: 1f13d13948dd
Create Date: 2021-08-13 09:40:24.612261
"""
# revision identifiers, used by Alembic.
revision = "27a3d7e96d1f"
down_revision = "1f13d13948dd"
from alembic import op
import sqlalchemy as sa
def upgrade():
... | CanalTP/kirin | migrations/versions/27a3d7e96d1f_del_index_useless_optimize_index_real_time_update.py | Python | agpl-3.0 | 3,250 |
import serial
import numpy as np
import json
from datetime import datetime
class ElectronicNose:
def __init__(self, devAdd='/dev/ttyUSB0', baudrate=115200/3, \
tmax = 1000, outputFile = '', numSensors = 8):
## Creating the serial object
self.Sensor = serial.Serial(devAdd, baud... | VandroiyLabs/FaroresWind | faroreswind/collector/ElectronicNose.py | Python | gpl-3.0 | 2,352 |
from pygame.mixer import music as _music
from .loaders import ResourceLoader
from . import constants
__all__ = [
'rewind', 'stop', 'fadeout', 'set_volume', 'get_volume', 'get_pos',
'set_pos', 'play', 'queue', 'pause', 'unpause',
]
_music.set_endevent(constants.MUSIC_END)
class _MusicLoader(ResourceLoader):... | yrobla/pyjuegos | pgzero/music.py | Python | lgpl-3.0 | 2,526 |
# -*- test-case-name: twisted.web2.test.test_server -*-
# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This is a web-server which integrates with the twisted.internet
infrastructure.
"""
# System Imports
import cgi, time, urlparse
from urllib import quote, unquote
from urlparse ... | Donkyhotay/MoonPy | twisted/web2/server.py | Python | gpl-3.0 | 21,209 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2019 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.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, eith... | dontnod/weblate | weblate/machinery/tests.py | Python | gpl-3.0 | 27,388 |
# 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
# d... | Juniper/tempest | tempest/api/volume/admin/test_volume_retype_with_migration.py | Python | apache-2.0 | 4,277 |
score = [list(map(lambda x: int(x) - 1 , input().split())) for _ in range(int(n*(n-1)/2))]
points = [0 for _ in range(n)]
for a,b,c,d in score:
if c > d:
points[a] += 3
elif c < d:
points[b] += 3
else:
points[a] += 1
points[b] += 1
rank = sorted(points)
rank.revers... | knuu/competitive-programming | aoj/2/AOJ0566.py | Python | mit | 373 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2013-2017 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... | python-ivi/python-ivi | ivi/agilent/agilent8593A.py | Python | mit | 1,518 |
# Generated by Django 2.0.6 on 2018-06-29 11:04
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('library', '0009_product_summary'),
]
operations = [
migrations.AddField(
model_name='achievement',
... | xavierdutreilh/robots.midgar.fr | services/backbone/backbone/library/migrations/0010_auto_20180629_1304.py | Python | mit | 1,165 |
#!/usr/bin/env pmpython
#
# Copyright (C) 2020 Red Hat.
# Copyright (C) 2017 Alperen Karaoglu.
# Copyright (C) 2016 Sitaram Shelke.
#
# 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 versi... | adfernandes/pcp | src/pcp/pidstat/pcp-pidstat.py | Python | lgpl-2.1 | 50,840 |
#!/usr/bin/python
#
# This program converts a series of raw files into Blender Voxel format
#
#
import math;
import sys;
import array;
import glob
from optparse import OptionParser;
usage = "Append files to a single voxel file.\n syntax: voxel_join.py inputfile outputfile [options]";
parser = OptionParser(usage=usa... | fercook/SciViz | Voxels/Blender_voxels/voxel_join.py | Python | gpl-2.0 | 3,262 |
from client import exceptions as ex
from client.sources.common import core
import mock
import unittest
###############
# Field Tests #
###############
class MockField(core.Field):
VALID_INT = 42
OK_INT = 3
INVALID_INT = 2
def is_valid(self, value):
return value == self.VALID_INT
def to_j... | jackzhao-mj/ok-client | tests/sources/common/core_test.py | Python | apache-2.0 | 11,269 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import tokenize
from pants.contrib.python.checks.checker.common import CheckstylePlugin
... | twitter/pants | contrib/python/src/python/pants/contrib/python/checks/checker/indentation.py | Python | apache-2.0 | 1,262 |
import logging
import re
from collections import defaultdict
from datetime import datetime
from urllib.parse import urlparse
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.pagin... | mozilla/pontoon | pontoon/base/views.py | Python | bsd-3-clause | 29,190 |
#!/usr/bin/env python
import os
import json
from jinja2 import Environment, FileSystemLoader
PATH = os.path.dirname(os.path.abspath(__file__))
TEMPLATE_ENVIRONMENT = Environment(
autoescape=False,
loader=FileSystemLoader(os.path.join(PATH, 'templates')),
trim_blocks=False)
def path_to_dict(path):
d = {'... | jurvis/mugger | generate.py | Python | mit | 1,268 |
"""Support for Fritzbox binary sensors."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from typing import Final
from pyfritzhome.fritzhomedevice import FritzhomeDevice
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
B... | mezz64/home-assistant | homeassistant/components/fritzbox/binary_sensor.py | Python | apache-2.0 | 2,795 |
import logging
import threading
import time
import datetime
#import gdrivefs.report
import gdrivefs.state
from gdrivefs.conf import Conf
from gdrivefs.cache.cache_registry import CacheRegistry, CacheFault
_logger = logging.getLogger(__name__)
_logger.setLevel(logging.INFO)
class CacheAgent(object):
"""A parti... | tvierling/GDriveFS | gdrivefs/cache/cache_agent.py | Python | gpl-2.0 | 6,509 |
# Copyright 2017 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... | tensorflow/autograph | reference_tests/assertion_test.py | Python | apache-2.0 | 1,233 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Prabhat Kumar'
| 4979/machines | code/github/recipes/setup.py | Python | apache-2.0 | 76 |
# -*- coding: utf-8 -*-
from app import app
from cache.public import cache_url
from models import WechatMenu
__author__ = 'fengguanhua'
import time
import json
from flask import request, jsonify
from flask_weixin import FlaskWeixin
from wexin.util import *
from app import logger
from flask import Blueprint
weixin_mo... | davidvon/pipa-pay-server | admin/wexin/views.py | Python | apache-2.0 | 2,750 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, api, _
import odoo.addons.decimal_precision as dp
from odoo.exceptions import UserError
class AccountVoucher(models.Model):
_name = 'account.voucher'
_description = 'Accounting... | ayepezv/GAD_ERP | addons/account_voucher/models/account_voucher.py | Python | gpl-3.0 | 19,955 |
from django.contrib import admin
from .models import ConfigurationVariable
class ConfigurationVariableAdmin(admin.ModelAdmin):
list_display = ('name', 'value', 'description', 'editable')
fields = ('name', 'value', 'description', 'editable')
def get_readonly_fields(self, request, obj=None):
if obj... | maoaiz/django-admin-conf-vars | django_admin_conf_vars/admin.py | Python | bsd-3-clause | 796 |
##
# Copyright (c) 2006-2014 Apple 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 l... | trevor/calendarserver | twistedcaldav/accounting.py | Python | apache-2.0 | 4,247 |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 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; eith... | pferreir/indico-backup | indico/MaKaC/plugins/Collaboration/RecordingRequest/fossils.py | Python | gpl-3.0 | 1,938 |
#!/usr/bin/env python3
import argparse
import sys
import random
from contextlib import contextmanager
@contextmanager
def redirect_stdout(new_target):
old_target, sys.stdout = sys.stdout, new_target
try:
yield new_target
finally:
sys.stdout = old_target
def random_expression(depth = 3, ma... | azonenberg/yosys | tests/realmath/generate.py | Python | isc | 4,702 |
import urllib2
from lxml import html
# To address paging in Google
PAGE = 0
# url and query string from PART I
# this is a custom range from Jan 1, 2000 to Jan 1, 2001
URL = 'https://www.google.com/search?q=new+york+times&tbs=cdr%3A1%2Ccd_min%3A1%2F1%2F2000%2Ccd_max%3A1%2F1%2F2001&start=' + str(PAGE*10)
# here we s... | rodricios/crawl-to-the-future | crawlers/Crawling-Google/simpleselect.py | Python | gpl-2.0 | 1,471 |
# coding: utf-8
from __future__ import division, unicode_literals
"""
This module contains an algorithm to solve the Linear Assignment Problem
"""
__author__ = "Will Richards"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Will Richards"
__email__ = "wrichards@mit.edu"... | rousseab/pymatgen | pymatgen/optimization/linear_assignment.py | Python | mit | 8,010 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class PinboardLinkItem(scrapy.Item):
# fields that we get from pinboard
id = scrapy.Field()
link_url = scrapy.Field(... | spare-time/pinboogle | crawlers/items.py | Python | apache-2.0 | 1,937 |
import _plotly_utils.basevalidators
class ComputedValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="computed", parent_name="layout", **kwargs):
super(ComputedValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/_computed.py | Python | mit | 395 |
from comics.aggregator.crawler import ComicsKingdomCrawlerBase
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "Hägar the Horrible"
language = "en"
url = "https://www.comicskingdom.com/hagar-the-horrible"
rights = "Chris Browne"
class Crawler(ComicsKingdomCraw... | jodal/comics | comics/comics/hagarthehorrible.py | Python | agpl-3.0 | 524 |
#
# @file TestSpeciesConcentrationRule.py
# @brief SpeciesConcentrationRule unit tests
#
# @author Akiya Jouraku (Python conversion)
# @author Ben Bornstein
#
# $Id$
# $HeadURL$
#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
#
# This file was generat... | alexholehouse/SBMLIntegrator | libsbml-5.0.0/src/bindings/python/test/sbml/TestSpeciesConcentrationRule.py | Python | gpl-3.0 | 3,332 |
__author__ = 'Brandon C. Kelly'
import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import solve
from scipy.optimize import minimize
import samplers
import multiprocessing
import _carmcmc as carmcmcLib
class CarmaModel(object):
"""
Class for performing statistical inference assuming a CARMA(... | guillaumelenoir/WAVEPAL | carmcmc/carma_pack.py | Python | mit | 72,802 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.tests import opus_unittest
from numpy import array, arange
from opus_core.tests.utils.variable_tester import VariableTester
class Tests(opus_unittest.OpusTestCase):
def test_... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim_parcel/parcel/tests/travel_time_to_cbd.py | Python | gpl-2.0 | 1,051 |
from test_helper import ApiTestCase, is_auth, is_recursor
class Servers(ApiTestCase):
def test_flush(self):
r = self.session.put(self.url("/api/v1/servers/localhost/cache/flush?domain=example.org."))
self.assert_success_json(r)
data = r.json()
self.assertIn('count', data)
def... | DrRemorse/pdns | regression-tests.api/test_Cache.py | Python | gpl-2.0 | 954 |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, 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... | akash1808/nova_test_latest | nova/tests/unit/api/openstack/compute/test_consoles.py | Python | apache-2.0 | 11,651 |
#!/usr/bin/env python3
"""
This script has two arguments. A sitemap url and a api profile.
It will download the entire profile from the NPO Front end api, and it will also download the entire sitemap.
Then, it compares the found URL's in both. They should represent the same set.
If there are URL in the API which are... | npo-poms/scripts | python/check_with_sitemap.py | Python | gpl-2.0 | 15,955 |
# 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
# d... | kogotko/carburetor | openstack_dashboard/utils/settings.py | Python | apache-2.0 | 14,387 |
# Natural Language Toolkit: RTE Classifier
#
# Copyright (C) 2001-2011 NLTK Project
# Author: Ewan Klein <ewan@inf.ed.ac.uk>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Simple classifier for RTE corpus.
It calculates the overlap in words and named entities between text and
hypothesis,... | tadgh/ArgoRevisit | third_party/nltk/classify/rte_classify.py | Python | apache-2.0 | 6,409 |
# -*- coding: utf-8 -*-
"""attenuation.py - A collection of simple functions implementing various
proposed attenuation curves.
"""
import numpy as np
import warnings, sys
# --------------------
# ATTENUATION CURVES
# --------------------
__all__ = ["calzetti", "chevallard", "conroy", "noll",
"powerlaw",... | bd-j/sedpy | sedpy/attenuation.py | Python | mit | 12,814 |
from __future__ import print_function
import os
from setuptools import setup
# Utility function to read the README file.
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
# Setup
# 1. zip_safe needs to be False since we need access to templates
setup(
name="TimeVis",
v... | gaoce/TimeVis | setup.py | Python | mit | 1,191 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2016-2018 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | gnocchixyz/gnocchi | gnocchi/storage/s3.py | Python | apache-2.0 | 9,452 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'TabGeneral.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_TabGeneral(object):
def setupUi(self, TabGeneral):
TabGe... | cbclab/MDT | mdt/gui/maps_visualizer/design/ui_TabGeneral.py | Python | lgpl-3.0 | 33,361 |
from django.apps import AppConfig
class MovieBookingConfig(AppConfig):
name = 'movie_booking'
| Mtudy/movie-booking-demo | app/movie_booking/apps.py | Python | mit | 100 |
'''
Produce minimum, maximum and the difference of number list
Status: Accepted
'''
###############################################################################
def read_line_of_integers():
"""Read one line of numbers or detect EOF"""
try:
text = input()
return [int(i) for i in text.split... | ivanlyon/exercises | kattis/k_statistics.py | Python | mit | 970 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2011, Nicolas Clairon
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the abov... | wshcdr/mongokit | mongokit/migration.py | Python | bsd-3-clause | 4,737 |
# ----------------------------------------------------------------------------
# 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... | NiclasEriksen/py-towerwars | src/pyglet/window/win32/__init__.py | Python | cc0-1.0 | 35,484 |
#!/usr/bin/env python
"""
Script to fully automate the release process. Requires Python 2.6+
with sphinx installed and the 'hg' command on the path.
"""
from __future__ import print_function
import subprocess
import shutil
import os
import sys
import urllib2
import getpass
import collections
try:
import keyring
ex... | jsaveta/Lance | src/rescal/release.py | Python | apache-2.0 | 4,493 |
# 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... | sarvex/tensorflow | tensorflow/python/client/events_writer_test.py | Python | apache-2.0 | 2,890 |
"""Tests for the preset and the history of queries."""
import json
import os
from qgis.core import QgsCoordinateReferenceSystem, QgsRectangle
from qgis.testing import unittest
from QuickOSM.core.utilities.json_encoder import as_enum
from QuickOSM.core.utilities.query_saved import QueryManagement
from QuickOSM.core.ut... | Gustry/QuickOSM | QuickOSM/test/test_saved_query.py | Python | gpl-2.0 | 17,258 |
# Copyright (C) 2007, One Laptop Per Child
#
# 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 distrib... | AbrahmAB/sugar | src/jarabe/journal/objectchooser.py | Python | gpl-3.0 | 8,575 |
"""
Crawl job for Wikinews English
https://en.wikinews.org
"""
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
from psicrawler.spiders.default_spider import DefaultSpider
class WikinewsEnSpider(DefaultSpider):
name = "wikinews_en"
source = "wikinews-en"
allowed_domains = ["... | psiopic2/psicrawler | psicrawler/spiders/wikinews_en_spider.py | Python | mit | 2,522 |
from django.apps import AppConfig
class EstudiosSocioeconomicosConfig(AppConfig):
name = 'estudios_socioeconomicos'
| erikiado/jp2_online | estudios_socioeconomicos/apps.py | Python | mit | 122 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import pytest
import json
import itertools
from unittest import SkipTest
from numpy.testing import assert_equal, assert_almost_equal
f... | kcompher/FreeDiscovUI | freediscovery/server/tests/test_email_threading.py | Python | bsd-3-clause | 4,268 |
import os
import sys
import json
if __name__ == '__main__':
cfg_file_name = 'config_def.json'
if len(sys.argv) > 1: # cmd line input config file
pass
if not os.path.isfile(cfg_file_name):
print('Config file not found ({})'.format(cfg_file_name))
data_url = None
with open(cfg_file_... | mvwicky/acled | src/python/get_data.py | Python | mit | 395 |
# -*- coding: utf-8 -*-
"""API test module."""
#
# (C) Pywikibot team, 2007-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
import datetime
import types
import pywikibot.data.api as api
import pywikibot.family
import pywikibot.... | darthbhyrava/pywikibot-local | tests/api_tests.py | Python | mit | 38,915 |
#
# Ladybug: A Plugin for Environmental Analysis (GPL) started by Mostapha Sadeghipour Roudsari
#
# This file is part of Ladybug.
#
# Copyright (c) 2013-2015, Mostapha Sadeghipour Roudsari <Sadeghipour@gmail.com>
# Ladybug is free software; you can redistribute it and/or modify
# it under the terms of the GN... | boris-p/ladybug | src/Ladybug_Day_Month_Hour.py | Python | gpl-3.0 | 3,385 |
#!/usr/bin/env python
import numpy as np
SEED_ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
SEED_ALPHABET_DICT = dict((c, i) for i, c in enumerate(SEED_ALPHABET))
SEED_MAX = 'ZZZZZ'
SEED_MAX_CHAR_LEN = 5 # ZZZZZ is under max uint32, ZZZZZZ is above max uint32
## Dice roll + modifer
#
# ... | jimmayjr/swn-gen | swn/random.py | Python | isc | 2,665 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('web', '0010_auto_20150303_0046'),
]
operations = [
migrations.RenameField(
model_name='foro',
old_na... | palichis/elmolino | web/migrations/0011_auto_20150303_0050.py | Python | gpl-2.0 | 603 |
import datetime
import time
from urllib.request import urlopen
isGame = True
#get all games for the day
url = 'http://live.nhle.com/GameData/GCScoreboard/'+str(datetime.date.today())+'.jsonp'
#url = 'http://live.nhle.com/GameData/GCScoreboard/2015-10-08.jsonp'
socket = urlopen(url)
html = socket.read().decode()
socke... | nsquared25/nhl-score-stream-python | main.py | Python | mit | 1,575 |
# Copyright 2012 - 2013 Zarafa B.V.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3,
# as published by the Free Software Foundation with the following additional
# term according to sec. 7:
#
# According to sec. 7 of the ... | zarafagroupware/zarafa-zsm | tests/tests_authorization.py | Python | agpl-3.0 | 11,327 |
#Given two arrays, write a function to compute their intersection.
class Solution(object):
def intersect(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
dict = collections.defaultdict(int)
for i in nums1:
dict[i]+=1
ans=[]
for i in nums2:
if dict... | 95subodh/Leetcode | 350. Intersection of Two Arrays II.py | Python | mit | 372 |
# -*- 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... | crmccreary/openerp_server | openerp/addons/import_google/wizard/import_google_data.py | Python | agpl-3.0 | 8,149 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.