code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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,... | elit3ge/SickRage | sickbeard/metadata/kodi.py | Python | gpl-3.0 | 4,553 |
# Copyright (c) 2001-2007 Twisted Matrix Laboratories.
# See LICENSE for details.
import gc
import StringIO, sys, types
from twisted.trial import unittest, runner
from twisted.scripts import trial
from twisted.python import util
from twisted.python.compat import set
from twisted.trial.test.test_loader import testNam... | sorenh/cc | vendor/Twisted-10.0.0/twisted/trial/test/test_script.py | Python | apache-2.0 | 13,677 |
# Copyright (c) 2015, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_... | leitao/mcrouter | mcrouter/test/test_ascii_error.py | Python | bsd-3-clause | 2,993 |
from distutils.command.build_py import build_py as old_build_py
from numpy.distutils.misc_util import is_string
class build_py(old_build_py):
def find_package_modules(self, package, package_dir):
modules = old_build_py.find_package_modules(self, package, package_dir)
# Find build_src generated *... | Ademan/NumPy-GSoC | numpy/distutils/command/build_py.py | Python | bsd-3-clause | 887 |
from django.shortcuts import render_to_response
# Create your views here.
from blog1.models import posts
def home(request):
entries = posts.objects.all()[:10]
return render_to_response('index.html', {'posts' : entries})
| caioproiete/illacceptanything | web/blog/firstblog1/blog1/views.py | Python | mit | 234 |
import json
import time
from io import StringIO
from mozlog import handlers, structuredlog
from ..formatters.wptscreenshot import WptscreenshotFormatter
from ..formatters.wptreport import WptreportFormatter
def test_wptreport_runtime(capfd):
# setup the logger
output = StringIO()
logger = structuredlog.... | CYBAI/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_formatters.py | Python | mpl-2.0 | 5,059 |
import unittest
from test import support
from weakref import proxy, ref, WeakSet
import operator
import copy
import string
import os
from random import randrange, shuffle
import sys
import warnings
import collections
from collections import UserString as ustr
import gc
import contextlib
class Foo:
pass
class Ref... | LaoZhongGu/kbengine | kbe/src/lib/python/Lib/test/test_weakset.py | Python | lgpl-3.0 | 15,170 |
f'{{{{{{{42:d}}}}}' | smmribeiro/intellij-community | python/testData/intentions/PyConvertToFStringIntentionTest/percentOperatorAddingEscapingToCurlyBraces_after.py | Python | apache-2.0 | 19 |
#
# 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
# ... | dragorosson/heat | heat/db/sqlalchemy/migrate_repo/versions/046_properties_data.py | Python | apache-2.0 | 927 |
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | takeshineshiro/cinder | cinder/tests/unit/api/contrib/test_volume_image_metadata.py | Python | apache-2.0 | 10,438 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Romain Deheele
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publ... | idncom/partner-contact | base_continent/__openerp__.py | Python | agpl-3.0 | 1,492 |
#!/usr/bin/env python3
#pylint: disable=missing-docstring
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
... | nuclear-wizard/moose | python/chigger/tests/vector/vector_magnitude.py | Python | lgpl-2.1 | 659 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | atheendra/access_keys | keystone/contrib/federation/migrate_repo/versions/002_add_mapping_tables.py | Python | apache-2.0 | 1,161 |
from django.utils.translation import activate, trans_real
import pytest
pytestmark = pytest.mark.django_db
def test_amo_locale_not_in_django():
"""
We load gettext catalogs in this order:
django/locale/django.po
amo/locale/django.po
If Django doesn't have a locale, it returns the en-us... | aviarypl/mozilla-l10n-addons-server | src/olympia/amo/tests/test_locales.py | Python | bsd-3-clause | 712 |
#!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Copyright (c) 2014 Intel Corporation. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import optparse
import os
import sys
GYP_ANDROID_DIR = os.path.join(os.p... | zeropool/crosswalk | build/android/merge_jars.py | Python | bsd-3-clause | 1,090 |
#!/usr/bin/env python
import sys
import os.path
from optparse import OptionParser
from scipy.optimize import curve_fit
from numpy import (exp, cos, pi, tri, argsort, asarray, arange, mean, isnan,
zeros, square)
from qiime.parse import parse_distmat
__author__ = "Antonio Gonzalez Pena"
__copyright_... | antgonza/qiime | qiime/plot_semivariogram.py | Python | gpl-2.0 | 5,408 |
"""
Tests for in-course reverification user partition creation.
This should really belong to the verify_student app,
but we can't move it there because it's in the LMS and we're
currently applying these rules on publish from Studio.
In the future, this functionality should be a course transformation
defined in the ve... | louyihua/edx-platform | openedx/core/djangoapps/credit/tests/test_verification_access.py | Python | agpl-3.0 | 13,330 |
#!/usr/bin/env python
"""
Copyright 2015 Reverb Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless require... | annegentle/magnum | magnum/common/pythonk8sclient/client/models/V1beta3_ContainerStateWaiting.py | Python | apache-2.0 | 1,400 |
# -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... | cursesun/python-goose | goose/extractors/tags.py | Python | apache-2.0 | 1,631 |
"""Namespace for cython generated modules for python3"""
| likelyzhao/mxnet | python/mxnet/_cy3/__init__.py | Python | apache-2.0 | 57 |
# -*- coding: utf-8 -*-
from gluon import *
from gluon.storage import Storage
from s3 import *
from s3theme import NAV, SECTION
# =============================================================================
class S3MainMenuLayout(S3NavigationItem):
""" Custom Main Menu Layout """
@staticmethod
def layou... | flavour/eden | modules/templates/historic/STL/layouts.py | Python | mit | 10,018 |
import argparse
import os
import re
import sys
import mxnet as mx
if sys.version_info >= (3, 0):
import configparser
else:
import ConfigParser as configparser
def parse_args(file_path):
default_cfg = configparser.ConfigParser()
default_cfg.read(file_path)
parser = argparse.ArgumentParser()
... | likelyzhao/mxnet | example/speech_recognition/config_util.py | Python | apache-2.0 | 3,125 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2017 F5 Networks Inc.
#
# This file is part of Ansible
#
# Ansible 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
# ... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_virtual_address.py | Python | bsd-3-clause | 16,948 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Project.display_name'
db.add_column('search_project', 'display_name', self.gf('django.db.m... | waseem18/oh-mainline | mysite/search/migrations/0062_auto__add_field_project_display_name.py | Python | agpl-3.0 | 18,220 |
from ..libmp.backend import xrange
from .calculus import defun
try:
iteritems = dict.iteritems
except AttributeError:
iteritems = dict.items
#----------------------------------------------------------------------------#
# Differentiation #
#----------... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/mpmath/calculus/differentiation.py | Python | mit | 20,272 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
__author__ = 'ajain'
| sonium0/pymatgen | pymatgen/analysis/hhi/__init__.py | Python | mit | 131 |
# (c) 2018, Ansible Inc,
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is di... | skg-net/ansible | lib/ansible/plugins/action/net_put.py | Python | gpl-3.0 | 9,188 |
# -*- test-case-name: twisted.trial.test.test_runner -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
A miscellany of code used to run Trial tests.
Maintainer: Jonathan Lange
"""
__all__ = [
'suiteVisit', 'TestSuite',
'DestructiveTestSuite', 'DocTestCase', 'DocTestSuite',
... | waseem18/oh-mainline | vendor/packages/twisted/twisted/trial/runner.py | Python | agpl-3.0 | 28,970 |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
"""
The main modules in this package are:
* discovery client
"""
| tcpcloud/contrail-controller | src/discovery/client/__init__.py | Python | apache-2.0 | 139 |
# Copyright 2016 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... | nburn42/tensorflow | tensorflow/python/debug/lib/session_debug_testlib.py | Python | apache-2.0 | 64,455 |
#
# ElementTree
# $Id: ElementPath.py 3375 2008-02-13 08:05:08Z fredrik $
#
# limited xpath support for element trees
#
# history:
# 2003-05-23 fl created
# 2003-05-28 fl added support for // etc
# 2003-08-27 fl fixed parsing of periods in element names
# 2007-09-10 fl new selection engine
# 2007-09-12 fl fix... | xyuanmu/XX-Net | python3.8.2/Lib/xml/etree/ElementPath.py | Python | bsd-2-clause | 13,118 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.chapel
~~~~~~~~~~~~~~~~~~~~~~
Lexer for the Chapel language.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, bygroups, words
from pygments.token import... | brunobergher/dotfiles | sublime/pygments/all/pygments/lexers/chapel.py | Python | mit | 3,338 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible 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 o... | thaim/ansible | lib/ansible/modules/network/check_point/cp_mgmt_run_ips_update.py | Python | mit | 2,269 |
from sympy import I, symbols
from sympy.physics.paulialgebra import Pauli
from sympy.utilities.pytest import XFAIL
from sympy.physics.quantum import TensorProduct
sigma1 = Pauli(1)
sigma2 = Pauli(2)
sigma3 = Pauli(3)
tau1 = symbols("tau1", commutative = False)
def test_Pauli():
assert sigma1 == sigma1
asse... | wxgeo/geophar | wxgeometrie/sympy/physics/tests/test_paulialgebra.py | Python | gpl-2.0 | 1,437 |
#!/usr/bin/python
# (c) 2017, NetApp, Inc
#
# This file is part of Ansible
#
# Ansible 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.... | sonaht/ansible | lib/ansible/modules/storage/netapp/sf_volume_manager.py | Python | gpl-3.0 | 11,481 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.igor
~~~~~~~~~~~~~~~~~~~~
Lexers for Igor Pro.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, words
from pygments.token import Text, Commen... | wandb/client | wandb/vendor/pygments/lexers/igor.py | Python | mit | 19,994 |
#!/usr/bin/env python
import os
import platform
import sys
try:
import multiprocessing.synchronize
gyp_parallel_support = True
except ImportError:
gyp_parallel_support = False
CC = os.environ.get('CC', 'cc')
script_dir = os.path.dirname(__file__)
uv_root = os.path.normpath(script_dir)
output_dir = os.path.joi... | sourcey/libsourcey | vendor/libuv/gyp_uv.py | Python | lgpl-2.1 | 2,793 |
#!/opt/anaconda1anaconda2anaconda3/bin/python
#
# Wrapper script for DeepVariant call_variants
BINARY_DIR="/opt/anaconda1anaconda2anaconda3/BINARYSUB"
MODEL_DIRS= {"wgs": "/opt/anaconda1anaconda2anaconda3/WGSMODELSUB",
"wes": "/opt/anaconda1anaconda2anaconda3/WESMODELSUB"}
import argparse
import os
impor... | roryk/recipes | recipes/deepvariant/dv_call_variants.py | Python | mit | 1,904 |
#!/usr/bin/env python
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation,... | ybdesire/apk_sdk_analysis | common/Androguard-2.0/apkviewer.py | Python | gpl-3.0 | 3,136 |
import main as main
import transaction as tx
# Shared secrets and uncovering pay keys
def shared_secret_sender(scan_pubkey, ephem_privkey):
shared_point = main.multiply(scan_pubkey, ephem_privkey)
shared_secret = main.sha256(main.encode_pubkey(shared_point, 'bin_compressed'))
return shared_secret
def s... | shaunstanislaus/ZeroNet | src/lib/pybitcointools/bitcoin/stealth.py | Python | gpl-2.0 | 3,683 |
# -*- coding: utf-8 -*-
# Authors: Nemry Jonathan
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
# All Rights Reserved
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual... | BT-ojossen/partner-contact | partner_firstname/tests/test_name.py | Python | agpl-3.0 | 3,241 |
# Copyright 2016 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... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/python/ops/distributions/bernoulli.py | Python | bsd-2-clause | 7,987 |
# test ffi float support
try:
import ffi
except ImportError:
print("SKIP")
raise SystemExit
def ffi_open(names):
err = None
for n in names:
try:
mod = ffi.open(n)
return mod
except OSError as e:
err = e
raise err
libm = ffi_open(('libm.so', ... | AriZuu/micropython | tests/unix/ffi_float2.py | Python | mit | 682 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | Metaswitch/horizon | openstack_dashboard/contrib/sahara/content/data_processing/cluster_templates/forms.py | Python | apache-2.0 | 2,225 |
__author__ = 'eikonomega'
| bigfatpanda-training/pandas-practical-python-primer | training/level-5-creating-websites/bfp-reference/exercise_10/__init__.py | Python | artistic-2.0 | 26 |
#!/usr/bin/env python
#
# Copyright (C) 2009 The Android Open Source Project
#
# 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 req... | NXT-F1V3/android_build | tools/compare_fileslist.py | Python | gpl-2.0 | 2,527 |
# Copyright (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
invento... | aperigault/ansible | lib/ansible/plugins/inventory/script.py | Python | gpl-3.0 | 8,382 |
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doctype("Portal Settings")
frappe.db.sql("""
delete from
`tabPortal Menu Item`
where
(route = '/quotations' and title ... | ovresko/erpnext | erpnext/patches/v8_5/remove_quotations_route_in_sidebar.py | Python | gpl-3.0 | 402 |
""" Testing
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal, \
run_module_suite, assert_
from scipy.io.matlab.mio_utils import cproduct, squeeze_element, \
chars_to_strings
def test_cproduct()... | jlcarmic/producthunt_simulator | venv/lib/python2.7/site-packages/scipy/io/matlab/tests/test_mio_utils.py | Python | mit | 1,789 |
# -*- coding: utf-8 -*-
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | harshilasu/GraphicMelon | y/google-cloud-sdk/platform/gsutil/gslib/tests/test_web.py | Python | gpl-3.0 | 3,288 |
# The plot server must be running
# Go to http://localhost:5006/bokeh to view this plot
from __future__ import division
import numpy as np
from bokeh.plotting import figure, show, output_server, vplot
def streamlines(x, y, u, v, density=1):
'''Returns streamlines of a vector flow.
* x and y are 1d arrays d... | rothnic/bokeh | examples/plotting/server/vector.py | Python | bsd-3-clause | 6,564 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit script for Chromium JS resources.
See chrome/browser/PRESUBMIT.py
"""
import regex_check
class JSChecker(object):
def __init__(self, i... | s20121035/rk3288_android5.1_repo | external/chromium_org/chrome/browser/web_dev_style/js_checker.py | Python | gpl-3.0 | 9,115 |
#!/usr/bin/python
#
# Copyright (c) 2016 Thomas Stringer, <tomstr@microsoft.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_functionapp_facts.py | Python | bsd-3-clause | 6,139 |
import os
import os.path
class NamedObject:
def __init__(self, name, **kw):
self.name = name
self.__dict__.update(kw)
def __repr__(self):
return self.name
struct_type_lookup = {
"char": "b",
"unsigned char": "B",
"int8_t": "b",
"uint8_t"... | DoreeMoell3/Doreen | py/openage/convert/util.py | Python | gpl-3.0 | 6,850 |
from __future__ import unicode_literals
import keyword
import re
from optparse import make_option
from django.core.management.base import NoArgsCommand, CommandError
from django.db import connections, DEFAULT_DB_ALIAS
from django.utils.datastructures import SortedDict
class Command(NoArgsCommand):
help = "Intro... | otherness-space/myProject003 | my_project_003/lib/python2.7/site-packages/django/core/management/commands/inspectdb.py | Python | mit | 10,340 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
# test_records = frappe.get_test_records('Job Opening')
class TestJobOpening(unittest.TestCase):
pass
| hassanibi/erpnext | erpnext/hr/doctype/job_opening/test_job_opening.py | Python | gpl-3.0 | 287 |
# 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 ... | shinate/phantomjs | src/qt/qtwebkit/Tools/Scripts/webkitpy/port/server_process.py | Python | bsd-3-clause | 15,181 |
"""replace last_delete with next_delete
Revision ID: e769c033e5c9
Revises: 6d298e6406f2
Create Date: 2017-08-14 20:51:02.248343
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'e769c033e5c9'
down_revision = '6d298e6406f... | codl/forget | migrations/versions/e769c033e5c9_replace_last_delete_with_next_delete.py | Python | isc | 1,297 |
from __future__ import print_function
from panda3d.core import loadPrcFileData
loadPrcFileData('', 'textures-power-2 None')
loadPrcFileData('', 'win-size 1024 768')
loadPrcFileData('', 'show-frame-rate-meter 1')
loadPrcFileData('', 'sync-video 0')
from panda3d.core import *
from direct.showbase.DirectObject import Dire... | wezu/p3d_gpu_particle | editor.py | Python | isc | 41,988 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2020 The Project X-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
'''
Script for adding the IO Banks in... | SymbiFlow/prjxray | fuzzers/001-part-yaml/add_iobanks.py | Python | isc | 1,173 |
""""
README
======
This file contains Python codes.
======
"""
""" An example of implementing an IP model with binary conditions """
import pulp
dealers = ["X", "Y", "Z"]
variable_costs = {"X": 500,
"Y": 350,
"Z": 450}
fixed_costs = {"X": 4000,
"Y": 2000,
... | jamesmawm/Mastering-Python-for-Finance-source-codes | B03898_02_Codes/B03898_02_04.py | Python | mit | 1,403 |
import _plotly_utils.basevalidators
class FamilysrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="familysrc", parent_name="mesh3d.hoverlabel.font", **kwargs
):
super(FamilysrcValidator, self).__init__(
plotly_name=plotly_name,
par... | plotly/plotly.py | packages/python/plotly/plotly/validators/mesh3d/hoverlabel/font/_familysrc.py | Python | mit | 428 |
"""
This has a few simple scripts for backing up
or restoring tables to/from JSON files.
"""
import json
import rethinkdb as rdb
DB_NAME = "test"
TABLES = ["periscope", "notes", "chat", "periscope_admin"]
class RethinkDB_Admin:
def createTable(self, tname):
conn = rdb.connect(db=DB_NAME)
res = rdb... | WorldViews/Spirals | RDB_Admin.py | Python | mit | 2,819 |
l = ['h','e','l','l','o']
print l.index('l')
print l.index('l', 2)
print l.index('l', 3)
print l.index('l', 2, 3)
print l.index('l', 3, 4)
print l.index('l', 2, -1)
print l.index('l', 2, -2)
print l.index('l', 3, -1)
try:
print l.index('l', 4)
except ValueError as e:
print e
try:
print l.index('l', -1)
e... | ArcherSys/ArcherSys | skulpt/test/run/t519.py | Python | mit | 781 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import flask
from flask import Flask, render_template, request, send_from_directory, redirect
from flask.json import jsonify
from multiprocessing.pool import ThreadPool
from flask_googlemaps import GoogleMaps
from flask_googlemaps import Map
from flask_googlemaps import icons
... | ZebraCat/pokemon-radar | example.py | Python | mit | 24,002 |
# coding=utf-8
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [("legalaid", "0001_initial"), migrations.swappable_dependency(settings.AU... | ministryofjustice/cla_backend | cla_backend/apps/timer/migrations/0001_initial.py | Python | mit | 1,472 |
###############################################################################
#
# VFR importer based on GDAL library
#
# Author: Martin Landa <landa.martin gmail.com>
#
# Licence: MIT/X
#
###############################################################################
import os
import sys
import datetime
import mimet... | ctu-osgeorel/gdal-vfr | vfr4ogr/utils.py | Python | mit | 5,046 |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module implements Compatibility corrections for mixing runs of different
functionals.
"""
import abc
import os
import warnings
from collections import defaultdict
from typing import Optional, Sequence, Union, List, Ty... | vorwerkc/pymatgen | pymatgen/entries/compatibility.py | Python | mit | 60,427 |
"""extended_groups
Revision ID: 46e4971dc46f
Revises: a90076b18837
Create Date: 2017-05-19 17:08:34.780367
"""
# revision identifiers, used by Alembic.
revision = '46e4971dc46f'
down_revision = 'a90076b18837'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
... | ActiDoo/gamification-engine | gengine/app/alembic/versions/46e4971dc46f_extended_groups.py | Python | mit | 5,140 |
# -*- coding: utf-8 -*-
"""
All database abstractions for subreddits go in this file.
I had to add the Subreddit model in manually via SQL, here were
my commands:
CREATE TABLE `subreddits_subreddit` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`desc` varchar(3000) DEFAULT NULL,
`ad... | codelucas/flask_reddit | flask_reddit/subreddits/models.py | Python | mit | 3,752 |
from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import connection
from protector.query import Query
ADD_PERMISSION_PERMISSION = 'add_permission'
VIEW_RESTRICTED_OBJECTS = 'view_restric... | grey0ne/django-protector | protector/internals.py | Python | mit | 7,456 |
"""
Tests for `tinyobj` module.
"""
import pytest
from tinyobj import tinyobj, fields
class TestFieldParserMetaclass(object):
def test_moves(self):
attrs = {
'test': 1,
'name': fields.Field()
}
obj = tinyobj.FieldParserMetaclass('test', (object,), attrs)
as... | BrianHicks/tinyobj | test/test_tinyobj.py | Python | mit | 1,424 |
from flask import render_template, request, jsonify
from . import main
@main.app_errorhandler(403)
def forbidden(e):
if request.accept_mimetypes.accept_json and \
not request.accept_mimetypes.accept_html:
response = jsonify({'error': 'forbidden'})
response.status_code = 403
retu... | delitamakanda/socialite | app/main/errors.py | Python | mit | 785 |
from .ir import *
def op2str(op):
return op.__class__.__name__
def expr2ir(expr, name=None, scope=None):
import inspect
from .env import env
from .type import Type
if expr is None:
return CONST(None)
elif isinstance(expr, int):
return CONST(expr)
elif isinstance(expr, str... | ktok07b6/polyphony | polyphony/compiler/irhelper.py | Python | mit | 6,866 |
import crypt
def test_pass(_crypt_pass):
salt = _crypt_pass[0:2]
dict_file = open('dictionary.txt', 'r')
for word in dict_file.readlines():
word = word.strip('\n')
crypt_word = crypt.crypt(word, salt)
if crypt_word == _crypt_pass:
print "[+] Found Password: " + word + "... | Great-Li-Xin/PythonDev | ViolentPython/Chap1/Unix_Passwd_Cracker.py | Python | mit | 704 |
import sys
sys.path.append("../../")
import unittest
from dockerEE.remote import RemoteInterfaceImpl
## TestRemoteInterfaceInmpl
#
# The test case for RemoteInterfaceImpl
class TestRemoteInterfaceInmpl(unittest.TestCase):
## init test case
def setUp(self):
arg = {"host": "localhost", "user": "vagrant... | ynaka81/dockerEE | test/test_case/remote.py | Python | mit | 1,143 |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from rest_jwt_permission.scopes import get_all_permission_providers_scopes
class Command(BaseCommand):
def handle(self, *args, **options):
for x in get_all_permission_providers_scopes():
print(x)
| chessbr/rest-jwt-permission | rest_jwt_permission/management/commands/show_roles.py | Python | mit | 299 |
from django.contrib.gis.db import models
class Organization(models.Model):
name = models.CharField(max_length=50)
org_type = models.CharField(choices=(('CBO', 'CBO'), ('NGO', 'NGO'), ('school', 'School'), ('private', 'Private')), max_length=10)
class Meta:
app_label = 'watsan'
db_table = 'watsan_organization' ... | spatialcollective/watsan | watsan/models/organizations.py | Python | mit | 436 |
# http://code.activestate.com/recipes/119466-dijkstras-algorithm-for-shortest-paths/
"""
G = {'s':{'u':10, 'x':5},
'u':{'v':1, 'x':2},
'v':{'y':4},
'x':{'u':3, 'v':9, 'y':2},
'y':{'s':7, 'v':6}}
"""
def graph_to_dot(G):
s = """digraph G {\nnode [width=.3,height=.3,shape=octagon,style=filled,colo... | JoeJasinski/WindyTransit | mobiletrans/mtdistmap/dijkstra/graph_to_dot.py | Python | mit | 569 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
End-to-end testing for the Fast ACUTE crowdsourcing task.
"""
import json
import os
import shutil
import tempfile
im... | facebookresearch/ParlAI | tests/crowdsourcing/tasks/acute_eval/test_fast_acute_logs.py | Python | mit | 3,400 |
# jsb/wave/waves.py
#
#
""" class to repesent a wave. """
## jsb imports
from jsb.lib.channelbase import ChannelBase
from jsb.utils.exception import handle_exception
from jsb.utils.locking import lockdec
from jsb.utils.generic import strippedtxt, toenc, fromenc
## basic imports
import logging
import copy
import os... | melmothx/jsonbot | jsb/lib/gae/wave/waves.py | Python | mit | 6,799 |
""" Parts of this module are taken from ``pyramid.compat`` module
"""
import sys
import types
# True if we are running on Python 3.
PY3 = sys.version_info[0] == 3
if PY3: # pragma: no cover
string_types = str,
integer_types = int,
class_types = type,
text_type = str
binary_type = bytes
long = ... | avanov/Rhetoric | rhetoric/compat.py | Python | mit | 1,361 |
import math
from hypothesis import given, event
from hypothesis import strategies as st
from pygob.types import (GoBool, GoUint, GoInt, GoFloat, GoByteSlice, GoString,
GoComplex)
def test_bool_false():
assert GoBool.decode(GoBool.encode(False)) == (False, b'')
def test_bool_true():
... | mgeisler/pygob | tests/test_properties.py | Python | mit | 1,499 |
import sqlite3
from etu.payEasyClass import prodcut
def savePostToSqlite(plist, cid):
try:
conn = sqlite3.connect('../payeasy_'+ str(cid) +'.sqlite')
c = conn.cursor()
# Create table
table_name = "payeasy"
c.execute("SELECT count(name) FROM sqlite_master WHERE type=... | texib/payeasy_crawler | src/etu/payeasyDB.py | Python | mit | 1,416 |
"""
TODO
---
- Create a separation of matrices and the functions to join after the results
are done.
- Classes to externalize the process of parallel computing preparations.
"""
from matrix_splitting import distribute_tasks, reshape_limits
| tgquintela/pythonUtils | pythonUtils/parallel_tools/__init__.py | Python | mit | 242 |
"""Scheduler module.
This module defines the scheduler part of alarmRetarder.
"""
import sched
import time
import threading
import logging
class Scheduler(threading.Thread):
"""Scheduler class.
This is the class definition of the alarmRetarder Scheduler, which
is the main part of the software.
Attri... | michael-batz/alarmRetarder | mods/scheduler.py | Python | mit | 5,735 |
# src: https://code.djangoproject.com/ticket/15307
from django.utils.text import slugify
def slugify_max(text, max_length=50):
slug = slugify(text)
if len(slug) <= max_length:
return slug
trimmed_slug = slug[:max_length].rsplit('-', 1)[0]
if len(trimmed_slug) <= max_length:
return ... | arturtamborski/wypok | wypok/wypok/utils/slugify.py | Python | mit | 426 |
from django.test import Client, TestCase
from django.contrib.auth.models import User
from models import WishedForItem
# Create your tests here.
class IndexTestCase(TestCase):
def test_template(self):
client = Client()
response = client.get("/")
self.assertEqual(response.status_code, ... | mnestis/wishlist | desirables/tests.py | Python | mit | 9,421 |
import os
import shutil
import subprocess
import py.test
from .. import vcs
# create temporary folder that will get test data
def pytest_funcarg__testbin(request):
def create_empty_folder():
if os.path.exists('testbin'): shutil.rmtree('testbin')
os.mkdir('testbin')
return 'testbin'
r... | schettino72/serveronduty | sodd/tests/test_vcs.py | Python | mit | 4,536 |
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... | Harmon758/discord.py | discord/message.py | Python | mit | 66,988 |
from audit import *
| tomquirk/taxman | taxman/__init__.py | Python | mit | 20 |
# selene documentation build configuration file, created by
# sphinx-quickstart on Sat Mar 4 11:34:49 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values hav... | yashaka/selene | docs/conf.py | Python | mit | 5,261 |
#!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name='ppp_cas',
version='0.8',
description='CAS plugin for PPP',
url='https://github.com/ProjetPP',
author='Projet Pensées Profondes',
author_email='marc.chevalier@ens-lyon.org',
license='MIT',
classifiers=[
... | ProjetPP/PPP-CAS | setup.py | Python | mit | 1,056 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from flask import request, abort
from flask_restful import Resource
from flask_restful import Resource, reqparse
from flask_rest_service import app, api, mongo
from bson.objectid import ObjectId
class GameList(Resource):
def get(self):
return [x fo... | pghilardi/live-football-client | flask_rest_service/resources.py | Python | mit | 682 |
#!/usr/bin/python
# create-slice-request <username> <imageName> <portSpecs>
# put a new slice in the database, and a request to create it
# userName is a GEE user
# imageName is one of the vetted images
# portSpecs is a set of strings (potentially empty) of the form nn:mm,
# where nn is a host port number and mm is a c... | rickmcgeer/geni-expt-engine | slice-scripts/create-slice-request.py | Python | mit | 5,256 |
from django.shortcuts import render
from .models import TableOfMonth, Shift
# Create your views here.
def home(request):
tables = TableOfMonth.objects.all()
return render(request, 'tables_of_month/table_list.html', {'tables': tables})
#def table_list(request):
# tables = TableOfMonth.objects.all()
# ret... | noracami/haveaniceday | haveaniceday/tables_of_month/views.py | Python | mit | 610 |
from collections import OrderedDict
import csv
import json
import requests
import time
from collections import defaultdict
def load_matrices():
reader = csv.reader(open('global_migrant_origin_database_version_4.csv', 'rU'), delimiter=',')
row = reader.next()
state_codes = row[2:]
i=0
matrix = {}
... | madewulf/MigrationsMap.net | parser.py | Python | mit | 2,346 |
"""Test invariance to translation, scaling and rotation on the "Labeled Faces in the Wild" dataset (http://vis-www.cs.umass.edu/lfw/).
This requires test images to be cropped a bit wider than the normal to give some room for the transformations.
"""
# MIT License
#
# Copyright (c) 2016 David Sandberg
#
# Permission i... | davidsandberg/facenet | tmp/test_invariance_on_lfw.py | Python | mit | 11,123 |
#!/usr/bin/env python
import os
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "silverplate.settings.base")
django.setup()
from crawler.engine import DataMining
from crawler.models import DataIngredient
mining = DataMining()
ingredients = DataIngredient.objects.all()
count = 0
for ingredient in ingred... | lucasgr7/silverplate | mining.py | Python | mit | 406 |
import numpy as np
'''
Product of Gaussians 1D
gij(x) = exp( wi*(x-xi)^2 ) * exp( wj*(x-xj)^2 )
wi*( x^2 + 2*xi*x + xi^2 ) + wj*( x^2 + 2*xj*x + xj^2 )
(wi+wj)*x^2 + (wi*xi + wj*xj)*2*x + wi*x^2 + wj*x^2
wij*( x^2 + 2*x*xij + xij^2 ) + C
wij = (wi+wj)
wij*xij = (wi*xi + wj*xj)
xij = (wi*... | ProkopHapala/SimpleSimulationEngine | python/pyGaussAtom/GaussProduct.py | Python | mit | 2,662 |