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 -*-
#!/usr/bin/env python
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import FeedMe
version = FeedMe.__version__
setup(
name='FeedMe',
version=version,
author='',
author_email='andrew@nimblemachine.com',
... | nimblemachine/feedme | setup.py | Python | apache-2.0 | 498 |
# -*- coding: utf-8 -*-
from collections import defaultdict
import dateutil.parser
import re
from typing import Any, DefaultDict, Dict, FrozenSet, List, Optional, Set, Tuple, Union
from django.http import HttpRequest, HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404
from django.db import con... | catmaid/CATMAID | django/applications/catmaid/control/annotation.py | Python | gpl-3.0 | 76,984 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('zerver', '0111_botuserstatedata'),
]
operations = [
migrations.RunSQL(
'''
CREATE INDEX zerver_mutedtopic_stream_topic
ON zerver_mutedtopic
(stream_i... | brainwane/zulip | zerver/migrations/0112_index_muted_topics.py | Python | apache-2.0 | 446 |
from tests.support.asserts import assert_success
from . import opener, window_name
def new_window(session, type_hint=None):
return session.transport.send(
"POST", "session/{session_id}/window/new".format(**vars(session)),
{"type": type_hint})
def test_payload(session):
original_handles = se... | scheib/chromium | third_party/blink/web_tests/external/wpt/webdriver/tests/new_window/new_window.py | Python | bsd-3-clause | 1,766 |
# tests.test_text.test_freqdist
# Tests for the frequency distribution visualization
#
# Author: Rebecca Bilbro
# Created: 2017-03-22 15:27
#
# Copyright (C) 2018 The scikit-yb developers
# For license information, see LICENSE.txt
#
# ID: test_freqdist.py [bd9cbb9] $
"""
Tests for the frequency distribution text vi... | pdamodaran/yellowbrick | tests/test_text/test_freqdist.py | Python | apache-2.0 | 1,675 |
# -*- 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... | AntaresConsulting/odoo-marble | product_marble/__openerp__.py | Python | gpl-2.0 | 2,342 |
# Copyright (c) 2018, Intel Corporation.
# SPDX-License-Identifier: BSD-3-Clause
# Create the ixp_default.conf file used by installer based on the ixp_default.h
import argparse
delete_list = ["\"", "\\n"]
parser = argparse.ArgumentParser(description='The default ini conf file generator.')
parser.add_argument('src_f... | intel/ipmctl | src/os/ini/ini_auto_gen_default_config.py | Python | bsd-3-clause | 682 |
"""
check issue #8
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
__all__ = ['main']
import sys
import traceback
import signal
import time
import platform
import random
import pyownet
from pyownet import protocol
from . import (HOST, PORT)
A = 1e-3 ... | miccoli/pyownet | tests/eintr.py | Python | lgpl-3.0 | 1,660 |
import os
from urllib.parse import urlparse
default_db = 'postgres://user:pass@127.0.0.1:5432/dbname'
DATABASE_URL = os.environ.get('DATABASE_URL', default_db)
url = urlparse(DATABASE_URL)
DATABASE_HOST = '{}:{}'.format(url.hostname, url.port)
DATABASE_NAME = url.path[1:]
DATABASE_USERNAME = url.username
DATABASE_PA... | itkpi/events-storage | events_service/settings.py | Python | apache-2.0 | 342 |
#!/usr/bin/env python
from unittest import TestCase
from fix_task.humans import Human, Boy, Girl
from fix_task.dances import HipHop, Pop, Electrodance
from fix_task.songs import Song
__author__ = 'litleleprikon'
class TestHuman(TestCase):
def setUp(self):
self.human = Human(name="Emil", dances=(HipHop(),... | litleleprikon/FIXTestTask | tests/test_human.py | Python | apache-2.0 | 1,688 |
from datetime import datetime
class GKReview:
# TODO add platform(s)
def __init__(self, reviewer="default", title="default", review_link="default", rating=-1, date="17/07/1994"):
self.reviewer = reviewer
self.title = title
self.link = review_link
self.rating = int(rating)
... | arthurdk/gk-analysis | GKReview.py | Python | mit | 981 |
#!/usr/bin/python
from distutils.core import setup
setup(name='kodicmd',
description='Kodi command-line interface',
author='Tobias D. Oestreicher',
author_email='lists@oestreicher.com.de',
url='https://github.com/tobias-d-oe/kodicmd',
version='0.0.1',
packages=['kodicmd'],
sc... | tobias-d-oe/kodicmd | setup.py | Python | gpl-3.0 | 349 |
from flask import Blueprint
from flask import make_response, Markup, send_from_directory, current_app
from flask import request, redirect, url_for, render_template, g, abort
from werkzeug.http import http_date, generate_etag
from redwind import imageproxy
from redwind import util
from redwind.extensions import db
from ... | Lancey6/redwind | redwind/views.py | Python | bsd-2-clause | 21,930 |
layer = iface.activeLayer()
renderer = layer.rendererV2()
#props = layer.rendererV2().symbols()[0].symbolLayer(0).properties()
props = {
"outline_width": "0.3",
"outline_color": "0,0,0,255",
"angle": "0",
"width": "8",
"color": "0,0,0,255",
"svgFile_dd_useexpr": "1",
"svgFile": "/home/jelen/jelen_d... | jeleniste/islh_parser | svg/por_mapa/symbology.py | Python | gpl-3.0 | 845 |
"""
k-epsilon fitted turbulence model using truncation of the velocity and water level
Implements TurbulenceKepFitted_core. See parent class for explanation
Runs its parent's methods.
Date: 02-11-2016 (original date: 20-11-2015)
Authors: Y.M. Dijkstra
"""
from TurbulenceKepFitted_core import TurbulenceKepFitted_core
... | YoeriDijkstra/iFlow | packages/numerical2DV/turbulence/KEFittedTruncated.py | Python | lgpl-3.0 | 1,404 |
#####################################################################
# program name: guess.py
# auther: max baseman
# email: dos.fool@gmail.com
# date: 5/01/07
# short description:
# this is a program that has two features
# one that randomly picks numbers till it gets yours
# and one that picks the most effective wa... | ActiveState/code | recipes/Python/511440_guesspy/recipe-511440.py | Python | mit | 1,690 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-14 19:45
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('pootle_store', '0045_remov... | claudep/pootle | pootle/apps/pootle_score/migrations/0003_add_pootle_user_store_score.py | Python | gpl-3.0 | 1,645 |
# 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... | cg31/tensorflow | tensorflow/python/platform/googletest.py | Python | apache-2.0 | 8,887 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu>
#
# 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/license... | Acimaz/Google_Apple_Financial_Reporter | lib/third_party/rsa/pkcs1.py | Python | mit | 8,244 |
# This file is part of Buildbot. Buildbot 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.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | zozo123/buildbot | master/buildbot/test/unit/test_changes_bitbucket.py | Python | gpl-3.0 | 18,476 |
# This program will calculate the weight of thre different atoms Hydrogen, Carbon, and Oxygen
# You will input the number of atoms per molecule
def main():
h = 1.0079 #hydrogen weight
c = 12.011 # carbon weight
o = 15.9994 #Oxygen weight
# Prompts for the number of molecules per element
noH = eval(input("Enter t... | src053/PythonComputerScience | chap3/molWeight.py | Python | cc0-1.0 | 923 |
class PingSampler(object):
def __init__(self, *args, numSamples=5):
if numSamples <= 0:
raise ValueError('numSamples must be a positive integer')
self.numSamples = int(numSamples)
self.samples = list(args)
def __len__(self):
return len(self.samples)
def ... | HendrikF/transmitter | transmitter/PingSampler.py | Python | bsd-3-clause | 691 |
# coding: utf-8
# Copyright: (c) 2019, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import os.path
import pathlib
import yam... | cchurch/ansible | hacking/build_library/build_ansible/command_plugins/collection_meta.py | Python | gpl-3.0 | 2,953 |
# -*- coding: utf-8 -*-
from textwrap import dedent
from django import VERSION
import pytest
from djmoney.models.fields import CurrencyField, MoneyField
from .helpers import get_models, get_operations
if VERSION >= (1, 7):
from django.db import migrations
else:
migrations = None
@pytest.mark.usefixtures... | rescale/django-money | tests/migrations/test_migrations.py | Python | bsd-3-clause | 9,480 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM14/CDPSM/GIS_Connectivity/IEC61968/AssetModels/CableInfo.py | Python | mit | 5,250 |
"""The table of contents needed isn't quite the same as the toc provided by
the api. We need to modify it a bit to group subparts, subterps, etc. These
modifications, then, are used for navigation, citations, and the TOC
layer"""
from regulations.generator import title_parsing
from regulations.generator.api_reader impo... | adderall/regulations-site | regulations/generator/toc.py | Python | cc0-1.0 | 4,642 |
# Copyright (c) 2009, 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... | klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/common/system/outputcapture.py | Python | bsd-3-clause | 5,478 |
#!/usr/bin/env python
# This Python file uses the following encoding: utf-8
# Find details about this project at https://github.com/e1ven/robohash
from __future__ import unicode_literals
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import socket
import os
import hashlib
im... | datfinesoul/Robohash | robohash/webfront.py | Python | mit | 19,155 |
# -*- coding: utf-8 -*-
import sys
import os
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.mathjax',
]
# Add any paths that contain templates here, relative t... | archonwang/redmine_tweaks | docs/conf.py | Python | gpl-2.0 | 3,020 |
"""Module Description
Copyright (c) 2014, Ying Jin <yjin@cshl.edu >
This code is free software; you can redistribute it and/or modify it
under the terms of the Artistic License (see the file COPYING included
with the distribution).
@author: Ying Jin
@contact: yjin@cshl.edu
"""
import sy... | mhammell-laboratory/tetoolkit | TEToolkit/GeneFeatures.py | Python | gpl-3.0 | 7,064 |
from PyQt4 import QtCore, QtGui, QtXml
class XmlHandler(QtXml.QXmlDefaultHandler):
def __init__(self, root):
QtXml.QXmlDefaultHandler.__init__(self)
self._root = root
self._item = None
self._text = ''
self._error = ''
def startElement(self, namespace, name, qname, attri... | heltonbiker/MapComplete | PyQt/FeatureDemos/XmlToTreeView.py | Python | mit | 3,160 |
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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 a... | nash-x/hws | neutron/db/migration/__init__.py | Python | apache-2.0 | 5,404 |
from django.conf.urls import include, url
from .views import BandCreateView, BandDeleteView, BandListView, BandUpdateView
dashboard_urlpatterns = [
url(r'^band/create/$', BandCreateView.as_view(), name='oscar-band-create'),
url(r'^band/$', BandListView.as_view(), name='oscar-band-list'),
# The RelatedFiel... | sonofatailor/django-oscar | src/oscar/test/factories/urls.py | Python | bsd-3-clause | 861 |
import ply.lex as lex
tokens = (
'ID',
'QUOTED_STRING',
'NUMBER',
'RATIONAL',
'DECIMAL',
'IF',
'DOT',
'POPEN',
'PCLOSE',
'COMMA',
'PLUS',
'PIPE',
'TIMES',
'NAF',
'ARITH',
)
precedence = (
('right', 'PIPE', 'PLUS'),
('right', 'COMMA', 'TIMES'),
)
t_I... | alviano/python | fasp/parser.py | Python | gpl-3.0 | 4,568 |
#!/usr/bin/env python3
from subprocess import run
run(['cargo', 'bench', '--', 'rc_linked_queue_baseline', '--test', '--nocapture'])
run(['cargo', 'bench', '--', 'padded_048_rc_linked_queue', '--test', '--nocapture'])
run(['cargo', 'bench', '--', 'padded_064_rc_linked_queue', '--test', '--nocapture'])
run(['cargo', '... | Alex-Diez/data-structure-experiments | rust-impl/linked-queues.py | Python | mit | 744 |
import numpy as np
import trep
import scipy.optimize as so
# set mass, length, and gravity:
m = 1.0; l = 1.0; g = 9.8;
# set state and step conditions:
pk = 0.5 # discrete generalized momentum
qk = 0.2 # theta config
uk = 0.8 # input torque
dt = 0.1 # timestep
# create system
system = trep.System()
# define frames
f... | hilario/trep | examples/papers/tase2012/pend-single-step.py | Python | gpl-3.0 | 1,483 |
#!/usr/bin/env python
#
# Copyright (C) 2007-2008 Camptocamp
#
# This file is part of MapFish Client
#
# MapFish Client 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, o... | flavour/ssf | static/scripts/tools/mergejsmf.py | Python | mit | 8,962 |
import os
import re
source_dir = "src/main/res/"
target_dir = "../fastlane/metadata/android/"
def copy_key_from_strings_xml_to_file(xml, key, filename):
match = re.search("<string name=\"" + key + "\">\"?(.*?)\"?</string>", xml, re.DOTALL)
if match:
with open(filename, "w", encoding='utf8') as file:
file.wri... | Binnette/StreetComplete | app/copyShopDescriptions.py | Python | gpl-3.0 | 1,324 |
"""
.. currentmodule:: nidaqmx
The :mod:`nidaqmx` package provides the following classes:
.. autosummary::
AnalogInputTask
AnalogOutputTask
DigitalInputTask
DigitalOutputTask
CounterInputTask
CounterOutputTask
that expose NI-DAQmx tasks to Python environment. The instances of
these task classes provide ... | burnpanck/pylibnidaqmx | nidaqmx/__init__.py | Python | bsd-3-clause | 2,530 |
'''
chg1: first change to multi-person pose estimation
'''
from __future__ import print_function, absolute_import
import argparse
import time
import matplotlib.pyplot as plt
import os
import torch
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torchvision.datasets as datase... | weigq/pytorch-pose | example/main.py | Python | gpl-3.0 | 12,764 |
import bpy
import struct
import sqlite3
import os
import shutil
import tarfile
import random
import string
import hashlib
from mathutils import Vector
dbScriptPath = '/home/pacmancoder/core/projects/dcdr/dcdr-scene/scenedb.sql'
tmpDirectory = '/home/pacmancoder/core/projects/dcdr/dcdr-scene/scenes_tmp/'
outputDirect... | pacmancoder/dcdr | dcdr-scene/blender_export_scene.py | Python | mit | 9,613 |
# Copyright (C) 2008 Andi Albrecht, albrecht.andi@gmail.com
#
# This module is part of python-sqlparse and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php.
"""Parse SQL statements."""
__version__ = '0.1.14'
# Setup namespace
from sqlparse import engine
from sqlparse import f... | Yelp/sqlparse | sqlparse/__init__.py | Python | bsd-3-clause | 4,111 |
import click
from groundcontrol.scheduler import Scheduler
from groundcontrol.server import app
from groundcontrol.deployment import Deployment
from groundcontrol.models import set_aws_host
from groundcontrol.models import set_aws_region
from groundcontrol.instrument.reporter import MetricReporter
from waitress import ... | Skyscanner/ground-control | groundcontrol/cli.py | Python | apache-2.0 | 2,839 |
# This file is part of Lod4Stat.
#
# Copyright (C) 2014 Provincia autonoma di Trento
#
# 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 optio... | trentino-sistemi/l4s | web/models.py | Python | agpl-3.0 | 14,065 |
__author__ = 'ariel'
"""
Python Population Simulator
Copyright (C) 2015 Ariel Young
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 yo... | DarthGeek01/PopulationSimulator | Genetics/Allele.py | Python | gpl-2.0 | 6,542 |
from marshmallow import ValidationError
class InputValidationError(ValidationError):
"""Raised when loading fails on an input-specialized schema"""
class InputLoaderSchemaMixin(object):
def load_strict(self, data):
loaded = self.load(data)
if loaded.errors:
raise InputValidationE... | ccortezia/featuring | featuring-flask-api/featuring/utilities/ext_schema.py | Python | mit | 362 |
from setuptools import setup, find_packages
setup(
name = "pycloser",
version = "0.2",
packages = find_packages(),
author = "Arvin Kulagin",
author_email = "arvinkulagin@yandex.ru",
description = "Сlean exit for Python scripts after Ctrl-C.",
long_description = open("README.rst").read(),
license = "MIT",
keyw... | arvinkulagin/pycloser | setup.py | Python | mit | 395 |
# 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)
class PySpacyModelsEnCoreWebSm(PythonPackage):
"""English multi-task CNN trained on OntoNotes. Assigns context-specif... | LLNL/spack | var/spack/repos/builtin/packages/py-spacy-models-en-core-web-sm/package.py | Python | lgpl-2.1 | 967 |
"""NDG XACML parsers package
NERC DataGrid
"""
__author__ = "P J Kershaw"
__date__ = "15/03/10"
__copyright__ = "(C) 2010 Science and Technology Facilities Council"
__contact__ = "Philip.Kershaw@stfc.ac.uk"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "Philip.Kershaw@stfc.ac.uk"
__revis... | cedadev/ndg_xacml | ndg/xacml/parsers/__init__.py | Python | bsd-3-clause | 2,221 |
##########################################################################
#
# Copyright (c) 2008-2014, Image Engine Design 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:
#
# * Redis... | hradec/cortex | test/IECoreMaya/FromMayaMeshConverterTest.py | Python | bsd-3-clause | 18,381 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('naf_autoticket', '0023_hostdevice_hostlocation'),
]
operations = [
migrations.CreateModel(
name='AlertCorrelatio... | kevinnguyeneng/django-uwsgi-nginx | app/naf_autoticket/migrations/0024_alertcorrelationweight.py | Python | gpl-3.0 | 1,043 |
import datetime
import os
import xml.etree.cElementTree as ET
import sys
from zipfile import ZipFile
# see if this filename is in the array of filenames
def checkPresent(arr, fileName, curResult):
# don't bother testing if we've already failed
if curResult is False:
return False
if fileName not in ... | debrief/debrief | org.mwc.cmap.combined.feature/root_installs/sample_data/other_formats/repository/update_Python.py | Python | epl-1.0 | 3,203 |
from keystone.manage2 import base
from keystone.manage2 import mixins
class Command(base.BaseBackendCommand, mixins.ListMixin):
"""Lists all users in the system."""
# pylint: disable=E1101
def get_users(self):
return self.user_manager.get_all()
def run(self, args):
"""Process argpars... | HugoKuo/keystone-essex3 | keystone/manage2/commands/list_users.py | Python | apache-2.0 | 736 |
#------------------------------------------------------------------------------
# Copyright 2013 Esri
# 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/LICENS... | JudTown17/solutions-geoprocessing-toolbox | data_management/test/test_publishable_tasks/TestFastVisibilityByCircle_SingleInput.py | Python | apache-2.0 | 3,255 |
"""
Unit tests of Raster elements
"""
import numpy as np
from holoviews.element import Raster, Image
from holoviews.element.comparison import ComparisonTestCase
class TestRaster(ComparisonTestCase):
def setUp(self):
self.array1 = np.array([(0, 1, 2), (3, 4, 5)])
def test_raster_init(self):
R... | mjabri/holoviews | tests/testraster.py | Python | bsd-3-clause | 1,103 |
# -*- coding: utf-8 -*-
# This file is part of tornado-stale-client.
# https://github.com/globocom/tornado-stale-client
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT-license
# Copyright (c) 2016, Globo.com <backstage@corp.globo.com>
from tornado_stale_client.client import StaleHTTPClient... | globocom/tornado-stale-client | tornado_stale_client/__init__.py | Python | mit | 352 |
from headers import *
class PathFinder:
def __init__(self, image_path):
self.image = cv2.imread(image_path)
def find_and_draw(self):
binary_image = self.filtered_binary_image(self.image)
contours, hierarchy = self.find_contours(binary_image)
graph = self.build_connection_graph... | sld/computer_vision_workshop | Seminars/PathFinder/path_finder.py | Python | mit | 7,036 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('barsystem', '0015_auto_20150505_2046'),
]
operations = [
migrations.AddField(
model_name='person',
n... | TkkrLab/barsystem | barsystem/src/barsystem/migrations/0016_auto_20150505_2342.py | Python | mit | 1,047 |
"""Add minimal paper reviewing data to DB
Revision ID: 33eb26faf225
Revises: 1af04f7ede7a
Create Date: 2016-04-03 11:58:16.756125
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.sql.ddl import CreateSchema, DropSchema
from indico.core.db.sqlalchemy import PyIntEnum, UTCDateTime
from indico.modules... | belokop/indico_bare | migrations/versions/201604081138_33eb26faf225_add_minimal_paper_reviewing_data_to_db.py | Python | gpl-3.0 | 2,140 |
# -*- coding: utf-8 -*-
"""
threatmetrix.tests.__init__
~~~~~~~~~~~~~~~~~~~~~~~~~~~
init file for threatmetrix
"""
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'threatmetrix.tests.settings'
from .threatmetrix import *
| CashStar/django-threatmetrix | threatmetrix/tests/__init__.py | Python | bsd-3-clause | 240 |
import csv
# file_xy是景点经纬度的csv文件,file_value是景点热度的csv文件
file_xy = open(r'J:\四会多规合一\四会景点坐标.csv')
file_value = open(r'J:\四会多规合一\四会景点热度.csv')
def nodes_reader(file):
'''
A function to drag out x and y coordinates from a csv file
(n row 2 col) and convert them into complex numbers and store
into a frozen... | spencerpomme/coconuts-on-fire | csv model test.py | Python | apache-2.0 | 1,468 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django.utils.translation import ugettext_lazy as _
from shuu... | suutari-ai/shoop | shuup/campaigns/admin_module/sections.py | Python | agpl-3.0 | 1,238 |
#!/usr/bin/env python
# -- coding: utf-8 --
# 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 (th... | kawamon/hue | desktop/libs/kafka/src/kafka/kafka_api.py | Python | apache-2.0 | 3,371 |
def exists():
return True
def make_incflags(paths, RDirs):
result = []
for path in paths:
if not str(path).startswith("#"):
for rdir in RDirs((path,)):
result.append("-isystem")
result.append(str(rdir))
else:
for rdir in RDirs((path,)):
... | alalazo/wesnoth | scons/system_include.py | Python | gpl-2.0 | 647 |
# -*- coding: utf-8 -*-
"""
morphsnakes
===========
This is a Python implementation of the algorithms introduced in the paper
Márquez-Neila, P., Baumela, L., Álvarez, L., "A morphological approach
to curvature-based evolution of curves and surfaces". IEEE Transactions
on Pattern Analysis and Machine Intelligence... | braysia/CellTK | celltk/utils/morphsnakes.py | Python | mit | 11,905 |
#!/usr/bin/python
# 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
# "Licen... | aspoman/flink-china-doc | quickstart/plotPoints.py | Python | apache-2.0 | 2,413 |
import math
li=[]
for i in range(3,200,2):
ro=int(math.sqrt(i))
f=1
for j in range(3,ro+1,2):
if(i%j==0):
f=0
break
if(f==1):
li.append(i)
print(li)
print(len(li))
#li=[123]
for i in li:
n=i
for j in range(len(str(i))):
r=n%10
n=(n//10)+r*(10**(len(str(i))-1))
#print(n,r)
if(j not in li):
li... | akash-akya/Project-Euler | Euler_P35.py | Python | gpl-2.0 | 366 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class LocalTestCase(Integration... | tysonholub/twilio-python | tests/integration/api/v2010/account/available_phone_number/test_local.py | Python | mit | 4,003 |
# 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... | tmenjo/cinder-2015.1.1 | cinder/tests/test_cmd.py | Python | apache-2.0 | 63,587 |
from codecs import open
from os import path
from setuptools import setup, Extension
from Cython.Distutils import build_ext
import numpy
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.... | MicheleDamian/ConnectopicMapping | setup.py | Python | apache-2.0 | 1,540 |
from django.conf.urls import patterns, url
urlpatterns = patterns(
'',
url(r'^$',
'flooding_lib.tools.gdmapstool.views.index',
name='flooding_gdmaapstool_index'),
url(r'^gdmapdetail/(?P<gdmap_id>\d+)$',
'flooding_lib.tools.gdmapstool.views.gdmap_details',
name='flooding_gd... | lizardsystem/flooding-lib | flooding_lib/tools/gdmapstool/urls.py | Python | gpl-3.0 | 797 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | superstack/nova | nova/db/sqlalchemy/migration.py | Python | apache-2.0 | 3,168 |
# Turtle Loop - Python Code - Elizabeth Tweedale
import turtle # imports the turtle module
loopy = turtle.Turtle() # name your turtle 'loopy'
# use a for loop to repeat the forward/right code 4 times
for i in range(4):
loopy.forward(50)
loopy.right(90)
turtle.done() # tur... | elizabethtweedale/HowToCode2 | SuperSkill-03-Artist/turtle-square-loopy.py | Python | gpl-3.0 | 332 |
# -*- coding: utf-8 -*-
import re
import time
from ..internal.Account import Account
from ..internal.misc import json
class EuroshareEu(Account):
__name__ = "EuroshareEu"
__type__ = "account"
__version__ = "0.12"
__status__ = "testing"
__description__ = """Euroshare.eu account plugin"""
__l... | Arno-Nymous/pyload | module/plugins/accounts/EuroshareEu.py | Python | gpl-3.0 | 1,755 |
import modules.pumpingsystem as ps
import pandas as pd
import numpy as np
# Pump schedule as per SCADA. rows = pumps, columns 1:=Peak, 2:=Standard, 3:Off-peak
pump_schedule_41 = np.array([[72, 42, 50],
[95, 78, 86],
[110, 110, 110],
... | Mierzen/Dam-Simulation | simulations/Case_study_3/simulation_CS3.py | Python | gpl-3.0 | 4,643 |
#!/usr/bin/env python
# coding=utf-8
import random
import os
import sys
import unittest
import run_test
import codecs
reload(sys)
sys.setdefaultencoding("utf-8")
class TestCaseUnit(unittest.TestCase):
def test_case_1(self):
self.assertEqual(
"Pass",
run_test.run_test_result(
... | qiuzhong/crosswalk-test-suite | wrt/wrt-manifest-tizen-tests/test.py | Python | bsd-3-clause | 53,807 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __open... | MickSandoz/compassion-modules | child_compassion/models/compassion_hold.py | Python | agpl-3.0 | 4,052 |
# Sprites for the platform game
import pygame as pg
from settings import *
import random
from random import choice, randrange
vec = pg.math.Vector2
class Spritesheet:
# Class for loading and handling of sprites
def __init__(self, filename):
self.spritesheet = pg.image.load(filename).convert_a... | coderfourfun/Sonic-Classic-Jump | sprites.py | Python | mit | 18,893 |
# encoding: utf-8
# 2011 © Bruno Chareyre <bruno.chareyre@hmg.inpg.fr>
import yade,math,os,sys
scriptsToRun=os.listdir(checksPath)
resultStatus = 0
nFailed=0
skipScripts = ['checkList.py']
for script in scriptsToRun:
if (script[len(script)-3:]==".py" and script not in skipScripts):
try:
print "###############... | anna-effeindzourou/trunk | scripts/checks-and-tests/checks/checkList.py | Python | gpl-2.0 | 859 |
# -*- coding: utf-8 -*-
"""Tests for xmlreader module."""
#
# (C) Pywikibot team, 2009-2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
from pywikibot import xmlreader
from tests import join_xml_data_path
from tests.aspects impo... | darthbhyrava/pywikibot-local | tests/xmlreader_tests.py | Python | mit | 5,108 |
import ArtusConfigBase as base
import mc
def config():
conf = mc.config()
l = []
for pipeline in conf['Pipelines']:
if not pipeline.startswith('all'):
l.append(pipeline)
elif 'CHS' not in pipeline:
l.append(pipeline)
for pipeline in l:
del conf['Pipe... | dhaitz/CalibFW | cfg/artus/mc_noc.py | Python | gpl-2.0 | 508 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-19 13:06
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('pictures', '0009_auto_20161219_1306'),
('education'... | photoboard/photoboard-django | education/migrations/0003_auto_20161219_1306.py | Python | mit | 2,856 |
# Copyright (c) Byron Galbraith and Unlock contributors.
# 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... | NeuralProsthesisLab/unlock | unlock/state/trainer_state.py | Python | bsd-3-clause | 5,106 |
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _
from django.conf import settings
from django.utils.crypto import get_random_string
from optparse import make_option
import shutil
import os.path
class Command(BaseCommand):
help = _('Copies settings... | CodigoSur/cyclope | cyclope/management/commands/local_settings.py | Python | gpl-3.0 | 2,248 |
"""
general set discretization
--------------------------
Discretization set. Explicit relations between elements and their groups.
"""
import numpy as np
from scipy.sparse import issparse, coo_matrix
from ..spatialdiscretizer import BaseSpatialDiscretizor
class SetDiscretization(BaseSpatialDiscretizor):
"""Se... | tgquintela/pySpatialTools | pySpatialTools/Discretization/Discretization_set/general_set_discretization.py | Python | mit | 10,575 |
#
# Copyright 2016 Quantopian, 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 wr... | florentchandelier/zipline | zipline/finance/trading.py | Python | apache-2.0 | 9,694 |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# 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 me... | bitcraft/pyglet | examples/image_display.py | Python | bsd-3-clause | 2,766 |
""" xgettext tool
Tool specific initialization of `xgettext` tool.
"""
# Copyright (c) 2001 - 2017 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 Software without restriction... | mapycz/mapnik | scons/scons-local-3.0.1/SCons/Tool/xgettext.py | Python | lgpl-2.1 | 13,879 |
from django.db import models
from gitireadme.utils import getUploadToPath
import datetime
class Article(models.Model):
name = models.CharField(max_length=255,blank=True,null=True)
path = models.CharField(max_length=255,blank=True,null=True)
class ArticleAlias(models.Model):
repo = models.CharField(max_le... | gitireadme/gitireadme.server | gitireadme/article/models.py | Python | apache-2.0 | 391 |
from __future__ import absolute_import
import json
import subprocess
import conveyor
def run_command(command):
return subprocess.Popen(command, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].strip()
def get_json_from_command(command):
return json.loads(run_command(command))... | mconigliaro/conveyor | conveyor/tests/hoist_tests.py | Python | gpl-3.0 | 772 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import re
from flexget import plugin
from flexget.event import event
log = logging.getLogger('manipulate')
class Manipulate(object):
"""
Usage:
... | gazpachoking/Flexget | flexget/plugins/modify/manipulate.py | Python | mit | 5,810 |
# -*- coding: utf-8 -*-
#
# satcfe/__init__.py
#
# Copyright 2015 Base4 Sistemas Ltda 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
#
#... | kmee/satcfe | satcfe/__init__.py | Python | apache-2.0 | 897 |
#!/usr/bin/env python2
# -*- coding: utf8 -*-
"""
get_dir_size.py: Various ways to calculate the size of a directory tree.
"""
#==============================================================================
# Various ways to calculate the size of a directory tree or a single file.
# Include methods to convert a s... | joedicastro/python-recipes | get_size.py | Python | gpl-3.0 | 10,830 |
import glob, sys
from xml.sax import make_parser
from db_classes import *
from db_output import *
from MaKaC.common.Configuration import Config
from MaKaC.common import Configuration
import MaKaC.debug as debug
debug.debugW = False
bk = BKrepository("/data/in... | belokop-an/agenda-tools | tools/backup/db_import.py | Python | gpl-2.0 | 1,101 |
import json
import logging
import gzip
import socket
import ssl
import sys
import traceback
from datetime import datetime
from threading import Lock, Thread
from time import sleep
from typing import Optional
import websocket
from vnpy.trader.utility import get_file_logger
class WebsocketClient:
"""
Websocke... | msincenselee/vnpy | vnpy/api/websocket/websocket_client.py | Python | mit | 9,241 |
#!/usr/bin/env python2.7
import numpy as np
import random
import time
import itertools
# Implementation of Linear UCB
class LinUCB:
# all_articles = []
all_M = None
all_M_inv = None
all_b = None
all_w = None
mapping = {}
keyList=None
firstTS = None
articleSize = 1
totalLine = 0
... | lukaselmer/ethz-data-mining | 4-bandit/code/policyLinUCBVectorizedTimestamp.py | Python | mit | 4,092 |
# This module contains HipChat related functions
def get_message_color(return_code):
if(return_code != 0):
return "red"
else:
return "green"
def pack_json_response(message, color="green"):
message = message.replace('"', '"') # some basic escaping
response = '{ "color": "'+color+'",... | Wide-Net/widebot | hiputils.py | Python | mit | 609 |
from __future__ import unicode_literals
from django.apps.registry import Apps
from django.db import models
from django.db.models import signals
from django.dispatch import receiver
from django.test import TestCase, mock
from django.test.utils import isolate_apps
from django.utils import six
from .models import Author... | loic/django | tests/signals/tests.py | Python | bsd-3-clause | 11,802 |
# -*- coding: UTF-8 -*-
# Copyright (C) 2011 Juan David Ibáñez Palomar <jdavid@itaapy.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 3 of the License, or
# (at your option... | hforge/ikaaro | ikaaro/config_captcha.py | Python | gpl-3.0 | 8,495 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | ntt-sic/nova | nova/api/openstack/compute/plugins/v3/flavor_manage.py | Python | apache-2.0 | 3,903 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.