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 |
|---|---|---|---|---|---|
import json
import pickle
import time
dataset = open("yelp_academic_dataset_review.json",'r')
lines = dataset.readlines()
# stores the valuable data
review_dict = {}
# stores the dates
review_data_dict = {}
for line in lines:
# ignore these lines
if line[0] != '{':
continue
o = json.loads(str(lin... | pranav-gokhale/YelpGroupRecommendations | parse_for_validation.py | Python | apache-2.0 | 1,375 |
__author__ = 'Jiri'
##################################################
import requests
import pymysql
import pymysql.cursors
class SeriesCatalogUpdater(object):
def __init__(self):
self.HYDROSERVER_URL = 'http://worldwater.byu.edu/app/index.php/climate/services/api/'
self.HYDROSERVER_HOST = 'wor... | CMIP5/HUC8Climate | scripts/python/update_series_catalog/update_series_catalog.py | Python | mit | 8,059 |
import ckan.logic as logic
from ckan.logic.action.get import package_show as ckan_package_show
from ckan.plugins import toolkit
from ckanext.datasetversions.helpers import get_context
def dataset_version_create(context, data_dict):
id = data_dict.get('id')
parent_name = data_dict.get('base_name')
owner_... | aptivate/ckanext-datasetversions | ckanext/datasetversions/logic/action/create.py | Python | agpl-3.0 | 1,187 |
# This tests that recursion with iternext doesn't lead to segfault.
try:
enumerate
filter
map
max
zip
except:
print("SKIP")
raise SystemExit
# We need to pick an N that is large enough to hit the recursion
# limit, but not too large that we run out of heap memory.
try:
# large stack/hea... | selste/micropython | tests/stress/recursive_iternext.py | Python | mit | 1,015 |
from flask import (
abort
Flask,
flash,
g,
session,
redirect,
render_template,
request,
)
from flask.ext.mongoengine import MongoEngine
import datetime
import hashlib
import os
import random
app = Flask(__name__)
app.config["MONGODB_SETTINGS"] = {'DB': 'corgiwrites'}
app.config["SECR... | CorgiW/corgiwrites | corgiwrites.py | Python | mit | 10,537 |
import os
import os.path
import re
import sys
import subprocess
import shlex
# WAF modules
from waflib import Options, Utils, Logs, TaskGen, Build, Context
from waflib.Errors import WafError
# these are set from the main wscript file
APPNAME=None
VERSION=None
bld=None
def get_command_template(env, arguments=()):
... | bijaydev/Implementation-of-Explicit-congestion-notification-ECN-in-TCP-over-wireless-network-in-ns-3 | wutils.py | Python | gpl-2.0 | 8,869 |
#!/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 m... | cloudera/hue | tools/ops/script_runner/lib/custom_commands/management/commands/hue_desktop_document_cleanup.py | Python | apache-2.0 | 6,044 |
import librtmp
import logging
import threading
from http.server import BaseHTTPRequestHandler, HTTPServer
from PyQt5.QtCore import Qt, QThread, QObject, QTimer, QMetaObject, pyqtSignal, pyqtSlot
from protocols import Protocol
from util import get_open_port
log = logging.getLogger(__name__)
BUF_SIZE = 64 * 1024
class... | ov1d1u/tv-maxe-ng | tv-maxe/protocols/rtmp.py | Python | lgpl-3.0 | 4,122 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('filmfestival', '0019_screening'),
]
operations = [
migrations.AddField(
model_name='film',
name='ori... | thanos/mykonosbiennale.org | filmfestival/migrations/0020_auto_20150610_2315.py | Python | apache-2.0 | 781 |
from __future__ import unicode_literals, division, absolute_import
import re
import logging
from urlparse import urlparse, urlunparse
from requests import RequestException
from flexget import plugin
from flexget.event import event
from flexget.plugins.plugin_urlrewriting import UrlRewritingError
from flexget.utils imp... | patsissons/Flexget | flexget/plugins/urlrewrite_eztv.py | Python | mit | 1,950 |
# this is the magic interpreted by Sonata, referring to on_enable etc. below:
### BEGIN PLUGIN INFO
# [plugin]
# plugin_format: 0, 0
# name: Notify plugin
# version: 0, 0, 1
# description: A simple notify plugin using pynotify.
# author: Leo Iannacone
# author_email: leo.iannacone@gmail.com
# url: http://en.leoiannaco... | onto/sonata | sonata/plugins/notify.py | Python | gpl-3.0 | 3,581 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2020 Florian Bruhin (The-Compiler) <me@the-compiler.org>
# Copyright 2015-2018 Alexander Cogneau (acogneau) <alexander.cogneau@gmail.com>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# i... | t-wissmann/qutebrowser | tests/unit/misc/test_cmdhistory.py | Python | gpl-3.0 | 5,172 |
import logging
import sys
from os import path
import click
from clickclick import AliasedGroup, fatal_error
import connexion
from connexion.mock import MockResolver
logger = logging.getLogger('connexion.cli')
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
def validate_wsgi_server_requirements(ctx, par... | NeostreamTechnology/Microservices | venv/lib/python2.7/site-packages/connexion/cli.py | Python | mit | 5,463 |
# -*- coding: utf-8 -*-
"""
A demostration of a simple BearerToken class.
Active tokens are stored in redis via the Flask-Sentinel extension. When
a request hits a API endpoint all we need to do is verify that a token
is provided with the request and that said token is active.
See https://github.... | nicolaiarocci/eve-oauth2 | oauth2.py | Python | bsd-3-clause | 1,963 |
import pytest
import dns.resolver
from pyisemail import is_email
from pyisemail.diagnosis import (
BaseDiagnosis,
DNSDiagnosis,
GTLDDiagnosis,
ValidDiagnosis,
)
from tests.validators import create_diagnosis, get_scenarios
scenarios = get_scenarios("tests.xml")
threshold = BaseDiagnosis.CATEGORIES["TH... | michaelherold/pyIsEmail | tests/test_is_email.py | Python | mit | 1,876 |
"""
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
"License"); you may not use this ... | alexryndin/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/service_check.py | Python | apache-2.0 | 2,021 |
# Copyright (C) 2016 Allen Li
#
# This file is part of Animanager.
#
# Animanager 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.
#
# ... | darkfeline/animanager | animanager/anidb.py | Python | gpl-3.0 | 3,274 |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.schema import MetaData
# Useful naming conventions
metadata = MetaData(naming_convention={
"ix": 'ix_%(column_0_label)s',
"uq": "uq_%(table_name)s_%(column_0_name)s",
"ck": "ck_%(table_name)s_%(constraint_name)s",
"fk": "fk_%(tabl... | betsybookwyrm/python-cafe-sqlalchemy | cafe/database/sqlalchemy/declarative.py | Python | apache-2.0 | 793 |
"""
Menu template tags, the following menu tags are available:
* ``{% admin_tools_render_menu %}``
* ``{% admin_tools_render_menu_item %}``
* ``{% admin_tools_render_menu_css %}``
To load the menu tags in your templates: ``{% load admin_tools_menu_tags %}``.
"""
from django import template
from django.core.urlres... | WhySoGeeky/DroidPot | venv/lib/python2.7/site-packages/admin_tools/menu/templatetags/admin_tools_menu_tags.py | Python | mit | 2,823 |
# -*- coding: utf-8 -*-
from datetime import datetime
import pytz
import db_params
from utils import *
# Variable global de para act/desactivar el modo verbose para imprimir mensajes en terminal.
v = 1
def sql_executor(query, expected_kind=None, last_row_id=False): # References
"""
:param query:
:para... | ButterFlyDevs/StudentsManagementSystem | SMS-Back-End/tdbms/dbapi/entities_manager.py | Python | gpl-3.0 | 46,758 |
from __future__ import absolute_import
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.contrib.auth.models import Group
from osf.models.user import OSFUser
from admin.common_auth.models import AdminProfile
cl... | mluo613/osf.io | admin/common_auth/forms.py | Python | apache-2.0 | 1,294 |
# -*- coding: utf-8 -*-
#
# Copyright © 2014 René Samselnig
#
# This file is part of Database Navigator.
#
# Database Navigator 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, ... | resamsel/dbmanagr | src/tests/test_options.py | Python | gpl-3.0 | 4,176 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | datalogics/scons | test/SConscriptChdir.py | Python | mit | 2,586 |
"""
=========================================================================
GPML regression: predicting Carbon Dioxide Concentration
=========================================================================
This example is based on the example condacted by Carl Edward Rasmussen,
available at http://learning.eng.cam... | depet/scikit-learn | examples/gpml/co2.py | Python | bsd-3-clause | 2,535 |
# Copyright 2015 NEC 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 o... | nis-sdn/odenos | apps/cli/producer.py | Python | apache-2.0 | 16,458 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 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... | tylertian/Openstack | openstack F/nova/nova/api/openstack/compute/contrib/certificates.py | Python | apache-2.0 | 3,687 |
# Staxus
import re, os, platform, urllib, cgi
PLUGIN_LOG_TITLE='Staxus' # Log Title
VERSION_NO = '2017.07.26.0'
# Delay used when requesting HTML, may be good to have to prevent being
# banned from the site
REQUEST_DELAY = 0
# URLS
BASE_URL='http://staxus.com%s'
# Example Video Details URL
# http://st... | MrPlow254/plex-gay-metadata-agent | Staxus.bundle/Contents/Code/__init__.py | Python | mit | 9,602 |
from urllib.parse import urlencode, parse_qs
import flask
from flask import Blueprint, redirect
from flask import current_app
from flask import jsonify
from flask.helpers import make_response
from flask.templating import render_template
from oic.oic.message import TokenErrorResponse, UserInfoErrorResponse, EndSessionR... | its-dirg/pyop | example/views.py | Python | apache-2.0 | 5,268 |
# 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... | fengbeihong/tempest_automate_ironic | tempest/common/utils/linux/remote_client.py | Python | apache-2.0 | 6,256 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import pika
import time
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
channel.queue_declare(queue='task_queue', durable=True)
print(' [*] Waiting for messages. To exit press CTRL+C')
def callback(... | mahandra/recipes_video_conv | local_scripts/rabbitmq/worker.py | Python | gpl-2.0 | 634 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.variables.variable import Variable, ln_bounded
from variable_functions import my_attribute_label
class ln_basic_sector_employment_within_walking_distance(Variable):
"""Natur... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim/gridcell/ln_basic_sector_employment_within_walking_distance.py | Python | gpl-2.0 | 1,713 |
"""
Django JSON Field. This extends Django Model Fields to store JSON as a field-type.
"""
#TODO - Move this to utils or another application. This is tangential to reporting and useful for other things.
from django.db import models
from django.utils import simplejson
from django.core.serializers.json import DjangoJS... | dmpayton/django-reportengine | reportengine/jsonfield.py | Python | bsd-3-clause | 5,894 |
# -*- coding: utf-8 -*-
import bleach
from datetime import datetime
from markdown import markdown
from .. import db
class BlogCategory(db.Model):
""" 类型(目录) """
__tablename__ = u'blog_category'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(40), unique=True, nullable=False)
... | revoll/PySite | app/models/blog.py | Python | gpl-3.0 | 3,352 |
import random
import datetime
import sys
import crs
import encdec
import prover
import verifier
system_random = random.SystemRandom()
def secure_shuffle(lst):
random.shuffle(lst, random=system_random.random)
def random_permutation(n):
s = list(range(n))
secure_shuffle(s)
return s
def initialize... | grnet/ac16 | src/demo.py | Python | agpl-3.0 | 1,874 |
# -*- 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):
# Flag to indicate if this migration is too risky
# to run online and needs to be coordinated for offline
... | mvaled/sentry | src/sentry/south_migrations/0394_auto__chg_field_project_team.py | Python | bsd-3-clause | 99,984 |
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(
name='PyDL7',
version='0.0.3',
description='Python API for parsing DAN Dive Log files.',
long_description=readme(),
author='Simon Johnston',
author_email='johnstonskj@gmail.com',
do... | johnstonskj/PyDL7 | setup.py | Python | mit | 915 |
#runas solve(16384)
#pythran export solve(int)
def solve(max_route):
'''
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.
3
7 5
2 4 6
8 5 9 3
That is, 3 + 7 + 4 + 9 = 23.
Find the maximum total fr... | serge-sans-paille/pythran | pythran/tests/euler/euler18.py | Python | bsd-3-clause | 2,455 |
"""
*Author:*
* Nicholas Silveira, Nicholas.Silveira@gmail.com, Jul 21, 2013 4:57:26 PM
"""
pipeline_name = 'Studio' | nicholas-silveira/art_pipeline | core/config.py | Python | bsd-3-clause | 118 |
"""
Tests for wiki middleware.
"""
from django.test.client import Client
from nose.plugins.attrib import attr
from unittest import skip
from wiki.models import URLPath
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from openedx.core.... | Learningtribes/edx-platform | lms/djangoapps/course_wiki/tests/test_comprehensive_theming.py | Python | agpl-3.0 | 1,915 |
"""
WSGI config for OpenIdGenericProvider project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "OpenIdGenericProvider.se... | qmagico/openid_server | OpenIdGenericProvider/wsgi.py | Python | mit | 417 |
"""
mpi.py
"""
from log import LOG_NAME
import multiprocessing
from multiprocessing.pool import Pool
import traceback
def error(msg, *args):
""" Error function"""
return multiprocessing.get_logger(LOG_NAME).error(msg, *args)
# -------------------------------------------------------------------- #
class Log... | bartnijssen/RVIC | rvic/core/mpi.py | Python | gpl-3.0 | 1,303 |
import subprocess
from typing import Any
class CalledProcessError(RuntimeError):
pass
def cmd_output_b(*cmd: str, **kwargs: Any) -> bytes:
proc = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
**kwargs,
)
stdout, stderr = proc.communicate()
... | Yelp/git-code-debt | git_code_debt/util/subprocess.py | Python | mit | 532 |
from .qcookboob import QCookboob
__all__ = ['QCookboob']
| sputnick-dev/weboob | weboob/applications/qcookboob/__init__.py | Python | agpl-3.0 | 58 |
from chainer import backend
from chainer import function_node
from chainer.functions.array import stack
from chainer.utils import type_check
class Separate(function_node.FunctionNode):
"""Function that separates a given array."""
def __init__(self, axis):
self.axis = axis
def check_type_forward... | tkerola/chainer | chainer/functions/array/separate.py | Python | mit | 2,459 |
"""
@brief test log(time=28s)
"""
import unittest
import numpy
import pandas
from pyquickhelper.pycode import ExtTestCase
from cpyquickhelper.fastdata import df2array, df2arrays
class TestPandasNumpy(ExtTestCase):
def test_df2array(self):
df = pandas.DataFrame([dict(a=3.4, b=5.6), dict(a=3.5, b=5.7... | sdpython/cpyquickhelper | _unittests/ut_fastdata/test_pandas_numpy.py | Python | mit | 1,858 |
# -*- coding: utf-8 -*-
# This file is part of wger Workout Manager.
#
# wger Workout Manager 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 ... | DeveloperMal/wger | wger/exercises/views/categories.py | Python | agpl-3.0 | 4,168 |
# Copyright 2017-2021 TensorHub, 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 writ... | guildai/guild | guild/op_cmd.py | Python | apache-2.0 | 9,413 |
import parsley
grammar = r"""
namelist = ws '$' name:n pairlist:p ws '$END'? -> (n, dict(p))
pairlist = (pair:first (pair)*:rest -> [first] + rest) | -> []
pair = ws name:k ws '=' ws valuelist:v ws ','? -> (k.upper(), v)
valuelist = ws (stringlist | numberlist | truth | falsehood):v -> v
numberlist = (number:first ... | openmrslab/pylcmodel | pylcmodel/namelist.py | Python | mit | 2,238 |
# -*- coding: utf-8 -*-
# Copyright 2007-2016 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | francisco-dlp/hyperspy | hyperspy/tests/component/test_components.py | Python | gpl-3.0 | 15,650 |
#Copyright 2012 EasyDevStdio , wes342
#
#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, ... | wes342/EasyDevStudio | scripts/BrowserMods.py | Python | apache-2.0 | 4,477 |
from hashlib import md5
from app import db
ROLE_USER = 0
ROLE_ADMIN = 1
followers = db.Table('followers',
db.Column('follower_id', db.Integer, db.ForeignKey('user.id')),
db.Column('followed_id', db.Integer, db.ForeignKey('user.id'))
)
class User(db.Model):
id = db.Column(db.Integer, primary_key = True)
... | mrzacarias/zaca_shortener | app/models.py | Python | mit | 2,674 |
#!/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/beeswax/src/beeswax/forms.py | Python | apache-2.0 | 17,132 |
# Copyright 2015 The Switch Authors. All rights reserved.
# Licensed under the Apache License, Version 2, which is in the LICENSE file.
"""
Defines model components to describe unit commitment of projects for the
SWITCH-Pyomo model. This module is mutually exclusive with the
project.no_commit module which specifies s... | bmaluenda/SWITCH-Pyomo-Chile | switch_mod/project/unitcommit/commit.py | Python | apache-2.0 | 14,444 |
# -*- coding: utf-8 -*-
"""
@file costMemory.py
@author Jakob Erdmann
@author Michael Behrisch
@date 2012-03-14
@version $Id: costMemory.py 22608 2017-01-17 06:28:54Z behrisch $
Perform smoothing of edge costs across successive iterations of duaIterate
SUMO, Simulation of Urban MObility; see http://sumo.dlr.d... | 702nADOS/sumo | tools/assign/costMemory.py | Python | gpl-3.0 | 7,283 |
from __future__ import unicode_literals
from django.db import models
from django.db.migrations.operations.base import Operation
from django.db.migrations.state import ModelState
from django.db.models.fields.related import RECURSIVE_RELATIONSHIP_CONSTANT
from django.db.models.options import normalize_together
from djan... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/django/db/migrations/operations/models.py | Python | mit | 33,086 |
# This script is used to import geometry information, from a shapefile, KML
# or GeoJSON file, into MapIt.
#
# Copyright (c) 2011 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org; WWW: http://www.mysociety.org
import re
from optparse import make_option
from django.core.management.base... | opencorato/mapit | mapit/management/commands/mapit_import.py | Python | agpl-3.0 | 14,414 |
# Copyright 2022 The Flax Authors.
#
# 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 wri... | google/flax | flax/optim/adadelta.py | Python | apache-2.0 | 2,586 |
import os
APP_PATH = os.path.dirname(os.path.realpath(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Daniel Garcia', 'dani@danigm.net'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'database.sqlite' # Or... | danigm/password | password/settings.py | Python | gpl-3.0 | 2,718 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Audun Gravdal Johansen
"""Defines class to operate on SESAM hydrodynamic data.
"""
from __future__ import division
import numpy as np
from .sifdata import SifData
from .helpers import getrow
from ..exceptions import ResultError, NoSuchRecordError
class HydroData(SifData)... | agrav/freesif | freesif/data/hydrodata.py | Python | mit | 13,702 |
# Copyright (c) 2017 Pavel 'Blane' Tuchin
import ConfigParser
import os.path
from service import Config, Sender, Watcher, Processor, DICOMDevice, \
DICOMHandler, DICOMService
def read_config(filenames):
if not filenames:
raise ValueError('No config files present')
config = ConfigParser.RawConfigPa... | blanebf/dicom_service | config_reader/ini_reader.py | Python | mit | 5,618 |
from chainer.iterators import multiprocess_iterator
from chainer.iterators import serial_iterator
MultiprocessIterator = multiprocess_iterator.MultiprocessIterator
SerialIterator = serial_iterator.SerialIterator
| kikusu/chainer | chainer/iterators/__init__.py | Python | mit | 214 |
import datetime as dt
import time
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.axes import Axes
from matplotlib.colors import Normalize, ListedColormap, LinearSegmentedColormap, hsv_to_rgb
from matplotlib.cm import ScalarMappable
from ... | dcherian/tools | ROMS/pmacc/tools/post_tools/rompy/tags/rompy-0.1.5/rompy/plot_utils.py | Python | mit | 21,943 |
#! /usr/bin/python
#
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any ... | ronin13/Pacman | test/pacman/pmpkg.py | Python | gpl-2.0 | 5,319 |
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. 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 requir... | Hybrid-Cloud/cinder | cinder/volume/drivers/zfssa/zfssanfs.py | Python | apache-2.0 | 32,677 |
# -*- coding: utf-8 -*-
from collections import namedtuple
import operator
import warnings
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.models.query_utils import Q
from django.template import TemplateSyntaxError, NodeList, Variable, engines
from django.templat... | iddqd1/django-cms | cms/utils/placeholder.py | Python | bsd-3-clause | 11,909 |
#!/usr/bin/env python2
# author: greyshell
import argparse
from pwn import *
context(os='linux', arch='amd64')
context.terminal = ['tmux', 'splitw', '-h'] # run the local binary in tmux session
class UserInput:
def __init__(self):
# create the top-level parser
self.parser = argparse.ArgumentP... | greyshell/greyshell.github.io | artifacts/canary_bypass02.assets/exploit_v01.py | Python | mit | 3,608 |
# Copyright (C) 2001-2004 Python Software Foundation
# Author: Barry Warsaw, Thomas Wouters, Anthony Baxter
# Contact: email-sig@python.org
"""A parser of RFC 2822 and MIME email messages."""
import warnings
from cStringIO import StringIO
from email.FeedParser import FeedParser
from email.Message import Message
c... | xbmc/atv2 | xbmc/lib/libPython/Python/Lib/email/Parser.py | Python | gpl-2.0 | 3,261 |
#!/usr/bin/env python
#
# $File: backTrajectory.py $
#
# This file is part of simuPOP, a forward-time population genetics
# simulation environment. Please visit http://simupop.sourceforge.net
# for details.
#
# Copyright (C) 2004 - 2010 Bo Peng (bpeng@mdanderson.org)
#
# This program is free software: you can redistri... | BoPeng/simuPOP | docs/backTrajectory.py | Python | gpl-2.0 | 2,557 |
# -- Paths ------------------------------------------------
import sys
import os
sys.path.insert(0, os.path.abspath('../../qmeq/'))
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ------------------------------------------------
needs_sphinx = '1.3'
extensions = ['sphinx.ext.autodoc',
... | gedaskir/qmeq | docs/source/conf.py | Python | bsd-2-clause | 2,697 |
# Copyright 2013: Mirantis 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 b... | vponomaryov/rally | tests/functional/test_cli_task.py | Python | apache-2.0 | 25,638 |
from .development import *
ALLOWED_HOSTS = [
'147.91.177.194',
'localhost',
]
DEBUG = False
TEMPLATE_DEBUG = False
STATIC_ROOT = 'staticfiles'
| UKS-Tim3/Issuebox | issuebox/issuebox/settings/production.py | Python | mit | 156 |
import imp
import inspect
def load_module(module_name):
"""
Loads the provide module or throws an exception.
Args:
module_name: The name of the module where the code for the class is.
"""
find_return = imp.find_module(module_name)
if find_return is None:
raise Exception("No module " + module_name +... | billyziege/config2class | src/class_retrieval.py | Python | gpl-2.0 | 1,066 |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_equal, assert_allclose
import scipy.special as sc
def test_symmetries():
np.random.seed(1234)
a, h = np.random.rand(100), np.random.rand(100)
assert_equal(sc.owens_t(h, a), sc.owens_t(-h,... | lhilt/scipy | scipy/special/tests/test_owens_t.py | Python | bsd-3-clause | 1,389 |
n = int(input())
A = [list(map(int, input().split())) for i in range(n)]
B = list()
for i in range(n):
for j in range(n):
if A[i][j] != 0:
B.append([i, j, A[i][j]])
for x in B:
print(*x)
| Senbjorn/mipt_lab_2016 | lab_18/task_1.py | Python | gpl-3.0 | 194 |
from pupa.scrape import Jurisdiction, Organization
import scrapelib
import lxml.html
from .people import SDLegislatorScraper
from .bills import SDBillScraper
class SouthDakota(Jurisdiction):
division_id = "ocd-division/country:us/state:sd"
classification = "government"
name = "South Dakota"
url = "htt... | cliftonmcintosh/openstates | openstates/sd/__init__.py | Python | gpl-3.0 | 3,672 |
import os, stat
def verify_number_of_cmd_line_arguments(actual_nr_args):
if actual_nr_args != EXPECTED_NR_ARGS:
if DEBUG:
print 'ACTUAL NUMBER OF ARGUMENTS: %(actual_nr_args)s' % locals()
raise WrongNumberOfArgumentsError
return
def verify_game_state_consistency(
game_sta... | rosedu/I.GameBot | tictactoe/game_engine/src/validations.py | Python | agpl-3.0 | 2,176 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-06 02:47
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operation... | italopaiva/your.car | yourcar/car/migrations/0001_initial.py | Python | bsd-2-clause | 2,468 |
# (c) Nelen & Schuurmans. MIT licensed, see LICENSE.rst.
from django.conf.urls import include, patterns, url
from django.contrib import admin
from ddsc_core.views import DataSetRulesView
from ddsc_core.views import LogicalGroupGraph
from ddsc_core.views import LogicalGroupRulesView
admin.autodiscover()
urlpatterns ... | ddsc/ddsc-core | ddsc_core/urls.py | Python | mit | 1,055 |
from django.shortcuts import render
from django.shortcuts import redirect
from django.core.context_processors import csrf
from django.contrib.auth import authenticate, login
from .forms import RegistrationForm
def register_user(request):
if request.method == 'POST':
form = RegistrationForm(request.POST)
... | MasterGowen/moonrain | moonrain/accounts/views.py | Python | gpl-2.0 | 739 |
# -*- coding: utf-8 -*-
""" PDF parsing and information extraction. """
import logging
import traceback
from StringIO import StringIO
from multiprocessing import Process
from loggingutil import ProcessLogHandler
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.pdfpage import PDFPage
... | jasalt/prh-document-parser | src/parser/pdfparser.py | Python | gpl-3.0 | 2,597 |
import warnings
import nose
import numpy as np
from nose.tools import assert_equal, assert_true
from scipy import sparse as sp
from sklearn.linear_model.logistic import LogisticRegression
from sklearn.svm import LinearSVC
from sklearn.svm.bounds import l1_min_c
from sklearn.utils.testing import clean_warning_registry
... | DailyActie/Surrogate-Model | 01-codes/scikit-learn-master/sklearn/svm/tests/test_bounds.py | Python | mit | 2,539 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('djangolettings', '0003_add_room_rates'),
]
operations = [
migrations.CreateModel(
name='BookingEnquiry',
... | dominicrodger/django-lettings | djangolettings/migrations/0004_add_booking_enquiry.py | Python | mit | 2,487 |
default_app_config = 'ecommerce.extensions.dashboard.orders.apps.OrdersDashboardConfig'
| edx/ecommerce | ecommerce/extensions/dashboard/orders/__init__.py | Python | agpl-3.0 | 88 |
import numpy as np
import warnings
import GPy
def get_slices(input_list):
num_outputs = len(input_list)
_s = [0] + [ _x.shape[0] for _x in input_list ]
_s = np.cumsum(_s)
slices = [slice(a,b) for a,b in zip(_s[:-1],_s[1:])]
return slices
def build_XY(input_list,output_list=None,index=None):
n... | ptonner/GPy | GPy/util/multioutput.py | Python | bsd-3-clause | 3,588 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, json
from frappe.desk.form.load import run_onload
@frappe.whitelist()
def savedocs(doc, action):
"""save / submit / update doclist"""
try:
doc = frappe.get_doc... | saurabh6790/frappe | frappe/desk/form/save.py | Python | mit | 1,676 |
# PMR WebServices
# Copyright (C) 2016 Manhoi Hur, Belyaeva, Irina
# This file is part of PMR WebServices API.
#
# PMR API 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
... | Arabidopsis-Information-Portal/PMR_API | services/platform_api/service.py | Python | gpl-2.0 | 1,510 |
#
# pyfeyner - a simple Python interface for making Feynman diagrams.
# Copyright (C) 2005-2010 Andy Buckley, Georg von Hippel
# Copyright (C) 2013 Ismo Toijala
#
# pyfeyner 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... | itoijala/pyfeyner | tests/test-bend90a.py | Python | gpl-2.0 | 1,085 |
########################################################################
#
# File Name: HTMLSelectElement.py
#
#
"""
WWW: http://4suite.com/4DOM e-mail: support@4suite.com
Copyright (c) 2000 Fourthought Inc, USA. All Rights Reserved.
See http://4suite.com/COPYRIGHT for license and copyright info... | alanjw/GreenOpenERP-Win-X86 | python/Lib/site-packages/_xmlplus/dom/html/HTMLSelectElement.py | Python | agpl-3.0 | 4,750 |
#Copyright 2014, Antoine Drouin
import os, serial, logging
from gi.repository import GLib, Gio, GObject
import phoenix.pprz_transport as transp
LOG = logging.getLogger('serial_link')
LOG.setLevel(logging.ERROR)
#LOG.setLevel(logging.DEBUG)
import pdb
class PhoenixCommunication(GObject.GObject):
DEFAULT_PORT = "... | rmeertens/paparazzi | sw/tools/tcp_aircraft_server/phoenix/serial_link.py | Python | gpl-2.0 | 3,691 |
# -*- coding: utf-8 -*-
# Scrapy settings for cameo_scrapy project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/l... | muchu1983/104_cameo | cameo_scrapy/settings.py | Python | bsd-3-clause | 3,036 |
# ~*~ coding: utf-8 ~*~
#!/usr/bin/env python
"""
fedora-software
Functional tests - fedora-software-fixtures.py
This module is responsible for building the fixtures needed by the test
suite.
"""
import os
from unipath import Path
def _prepare_fixtures_dir(path):
"""
Creates the fixtures' directory if it... | misli/fedora-software | bin/fedora-software-fixtures.py | Python | bsd-3-clause | 2,516 |
import collections
def make_enum(name, fields):
return collections.namedtuple(name, fields)(*range(len(fields)))
| tingelst/pymanopt | pymanopt/tools/__init__.py | Python | bsd-3-clause | 119 |
# -*- coding: utf8 -*-
__author__ = 'Viktor Winkelmann'
import sys
sys.path.append('../..')
from core.Plugins.DataRecognizer import *
def getClassReference():
return BMPFile
class BMPFile(DataRecognizer):
signatures = [(b'\x42\x4D.{4}\x00\x00\x00\x00', None)]
fileEnding = "bmp"
dataType = "Bitmap ... | vikwin/pcapfex | plugins/data_recognizers/bmp.py | Python | apache-2.0 | 364 |
# Moogul.py: MOOSE Graphics Using Lines
# This is a fallback graphics interface for displaying neurons using
# regular matplotlib routines.
# Put in because the GL versions like moogli need all sorts of difficult
# libraries and dependencies.
# Copyright (C) Upinder S. Bhalla NCBS 2018
# This program is licensed under... | upibhalla/moose-core | python/rdesigneur/moogul.py | Python | gpl-3.0 | 12,679 |
from prettytoml import elements
from prettytoml.elements.table import TableElement
from prettytoml.elements.tableheader import TableHeaderElement
from prettytoml.errors import InvalidTOMLFileError
from prettytoml.util import PeekableIterator
def sanitize(_elements):
"""
Finds TableHeader elements that are not... | Jumpscale/python-pretty-toml | prettytoml/parser/elementsanitizer.py | Python | mit | 2,007 |
#!/usr/bin/env python
#coding: utf8
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.properties import NumericProperty
from kivy.lang import Builder
#Ventanas Principales
class Principal(Screen):
pass
class Licenciatura(Screen):
def mostrar(self):
print("Li... | AzaJimenez/proyecto_final | Prototipo-Dividido/AplicacionApp.py | Python | gpl-2.0 | 2,595 |
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from openerp.osv import fields, osv
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
from openerp.tools.translate import _
import openerp.addons.decimal... | minhphung171093/GreenERP | openerp/addons/purchase_requisition/purchase_requisition.py | Python | gpl-3.0 | 22,839 |
#!/usr/bin/env python
from tdclient import (
bulk_import_model,
database_model,
job_model,
result_model,
schedule_model,
table_model,
user_model,
)
BulkImport = bulk_import_model.BulkImport
Database = database_model.Database
Schema = job_model.Schema
Job = job_model.Job
Result = result_mod... | treasure-data/td-client-python | tdclient/models.py | Python | apache-2.0 | 457 |
# Copyright (c) 2014 Alexander Bredo
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions ... | alexbredo/site-packages3 | handler/manager.py | Python | bsd-2-clause | 2,493 |
import time
import timeit
import signal
from sys import exit, exc_info, argv
from math import sin, cos, sqrt, asin, isnan, isinf, pi
from collections import deque
from references import *
#http://www.forkosh.com/mimetex.cgi?P(s)=\frac{\alpha_2z^2+\alpha_1z+\alpha_0}{\beta_2z^2+\beta_1z+\beta_0}
#http://www.forkosh.com/... | slremy/testingpubsub | myBallPlate/openloopsweep.py | Python | mit | 6,598 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.