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 |
|---|---|---|---|---|---|
"""Converts between units of distance measuring"""
import sys
import readchar
def read_char():
"""Detects key strokes"""
key_stroke = str(repr(readchar.readkey()))
key_stroke = key_stroke.replace("'", "")
if key_stroke == "1":
return "meters_to_feet"
elif key_stroke == "2":
return "... | CruyeEblon/Programming_Classes | distance_converter.py | Python | mit | 801 |
#!/usr/bin/env python
# Copyright 2014, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | jpmontez/rpc-openstack | maas/glance_registry_local_check.py | Python | apache-2.0 | 2,294 |
from .permission import *
from .serializers import ArticleSerializer
from .models import Article
from rest_framework.filters import SearchFilter
from rest_framework.viewsets import ModelViewSet
from rest_framework.response import Response
from django.db.models import Q
# Create your views here.
class dataWrapper(objec... | shady831213/myBlog | myBlog/articles/views.py | Python | mit | 1,502 |
# MySQL Connector/Python - MySQL driver written in Python.
import django
if django.VERSION < (1, 8):
from django.db.backends import BaseDatabaseValidation
else:
from django.db.backends.base.validation import BaseDatabaseValidation
if django.VERSION < (1, 7):
from django.db import models
else:
from dja... | rupace10/mysql-connector-python | lib/mysql/connector/django/validation.py | Python | gpl-2.0 | 2,529 |
'''
IDE: Eclipse (PyDev)
Python version: 2.7
Operating system: Windows 8.1
@author: Emil Carlsson
@copyright: 2015 Emil Carlsson
@license: This program is distributed under the terms of the GNU General Public License
'''
import unittest
from Model import Card
class TestCard(unittest.TestCase):
def testCardSetA... | gingerswede/ITSecCardGame | src/UnitTests/TestCard.py | Python | gpl-3.0 | 5,344 |
from builtins import str
import uuid
from ckan import model
from ckan.lib import dictization
from ckan.plugins import toolkit
from sqlalchemy import Column, types
from sqlalchemy.ext.declarative import declarative_base
import logging
log = logging.getLogger(__name__)
Base = declarative_base()
def make_uuid():
... | vrk-kpa/api-catalog | ckanext/ckanext-apply_permissions_for_service/ckanext/apply_permissions_for_service/model.py | Python | mit | 3,739 |
from .grammar_checker import *
| jmchrl/opb | grammalecte/__init__.py | Python | gpl-3.0 | 32 |
import org_demo_file_2
org_demo_file_2.external_function("call2")
foobar = 10
def foo():
org_demo_file_2.external_function("call2")
| vibhavp/emacs-lsp | test/fixtures/org-mode/org_demo_file.py | Python | gpl-3.0 | 140 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import getpass
import os
import time
import invoke
import requests
JE... | bwhmather/cryptography | tasks.py | Python | bsd-3-clause | 3,366 |
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
rect = plt.Rectangle((np.pi, -0.5), 1, 1, fc=np.random.random(3), picker=True)
ax.add_patch(rect)
x = np.linspace(0, np.pi*2, 100)
y = np.sin(x)
line, = plt.plot(x, y, picker=8.0)
def on_pick(event):
artist = event.artist
if isinstanc... | UpSea/midProjects | BasicOperations/04_Matplotlib/07_mouseEvent_selection.py | Python | mit | 554 |
from __future__ import absolute_import
import logging
from kudzu.context import CONTEXT_VARS, RequestContext
class RequestContextFilter(object):
"""Logging filter which injects information about a current request.
`RequestContextFilter` accepts all log records and extends them by
contextual informatio... | mila/kudzu | kudzu/logging.py | Python | bsd-3-clause | 2,324 |
#!/usr/bin/env python
###################################################################################
#
# Copyright (c) 2010-2016 Motsai
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softwa... | Motsai/neblina-python | neblinaUART.py | Python | mit | 2,947 |
# -*- coding: utf-8 -*-
#
# 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
... | KL-WLCR/incubator-airflow | airflow/contrib/operators/druid_operator.py | Python | apache-2.0 | 1,947 |
# 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... | denny820909/builder | lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/unit/test_revlinks.py | Python | mit | 3,783 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.compiled
~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for compiled languages.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from string import Template
from pygments.lexer import Lexer, Rege... | djanowski/pygmentize | vendor/pygments/pygments/lexers/compiled.py | Python | mit | 155,163 |
# Copyright 2014 The Oppia 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 applicable ... | DewarM/oppia | core/controllers/pages_test.py | Python | apache-2.0 | 1,048 |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from os import path
here = path.abspath(path.dirname(__file__))
setup(
name='dicom2fem',
description='Generation of finite element meshes from DICOM images',
long_desctioption="Generation of finite element meshes using c... | mjirik/dicom2fem | setup.py | Python | bsd-3-clause | 3,561 |
"""
Copyright 2012 Jan Demter <jan@demter.de>
This file is part of LODStats.
LODStats 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.
LODS... | ahmadassaf/LODStats | lodstats/stats/Links.py | Python | gpl-3.0 | 1,766 |
# urllib3/_collections.py
# Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from collections import deque
from threading import RLock
__all__ = ['RecentlyUsedContai... | samabhi/pstHealth | venv/lib/python2.7/site-packages/requests/packages/urllib3/_collections.py | Python | mit | 4,119 |
__author__ = 'Kristy'
import bpy
from . import bpy_workspace as ws
import os
import json
from ematoblender.scripts.ema_shared import properties as pps
from .. import blender_shared_objects as bsh
import scripts.ema_shared.general_maths as bm
import scripts.ema_blender.coil_info as ci
def link_lips_to_coils():
""... | m2ci-msp/ematoblender | ematoblender/scripts/ema_blender/ema_bpy/bpy_link_assets_coils.py | Python | gpl-3.0 | 1,907 |
# coding=utf-8
"""
Collect IO Stats
Note: You may need to artifically generate some IO load on a disk/partition
before graphite will generate the metrics.
* http://www.kernel.org/doc/Documentation/iostats.txt
#### Dependencies
* /proc/diskstats
"""
import diamond.collector
import diamond.convertor
import time
... | sebbrandt87/Diamond | src/collectors/diskusage/diskusage.py | Python | mit | 10,773 |
# -*- coding: utf-8 -*-
import sys
#sys.path.append("/usr/lib/python2.6/")
#sys.path.append("/usr/lib/python2.6/lib-dynload")
import sublime, sublime_plugin
import subprocess, time
import tempfile
import os, signal
import stat
#import xml.parsers.expat
import re
import codecs
import glob
import hashlib
import shutil... | clemos/haxe-sublime-bundle | HaxeComplete.py | Python | apache-2.0 | 82,830 |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~... | bmi-forum/bmi-pyre | pythia-0.8/packages/journal/journal/diagnostics/State.py | Python | gpl-2.0 | 929 |
import socket
import sys
from thread import *
ServerIp = ''
ServerPort = 54321 #Socket Server Port Num
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print 'Socket created'
try:
s.bind((ServerIp, ServerPort))
except socket.error , msg:
print 'Bind failed. Error Code : ' + str(msg[0]) + ' Msg ' +... | rurume/Arduino_example | examples/week2/Robot_Hand/Python_Rpi_Socket_Server/Rpi_Socket_Server.py | Python | gpl-2.0 | 865 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | djkonro/client-python | kubernetes/test/test_v1beta1_user_info.py | Python | apache-2.0 | 859 |
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet import ssl
from twisted.python.util import sibpath
from OpenSSL import SSL
class ClientTLSContext(ssl.ClientContextFactory):
isClient = 1
def getContext(self):
return SSL.Context(SSL.TLSv1_METHOD... | sorenh/cc | vendor/Twisted-10.0.0/twisted/test/ssl_helpers.py | Python | apache-2.0 | 655 |
# coding=utf-8
"""
In this module resides the core data structures and logic of the plugin system. It is implemented in an OctoPrint-agnostic
way and could be extracted into a separate Python module in the future.
.. autoclass:: PluginManager
:members:
.. autoclass:: PluginInfo
:members:
.. autoclass:: Plugin
... | DueLaser/OctoPrint | src/octoprint/plugin/core.py | Python | gpl-3.0 | 42,591 |
import os
import json
import string
import random
import nova_api
def cinder_request(self,
url_detail,
request_type='get',
request_name=None,
data=None,
locust_name=None):
url = self.get_endpoint('volumev2')
if url_detail:
... | pcrews/rannsaka | test_files/lib/openstack/cinder_api.py | Python | apache-2.0 | 13,466 |
# __init__.py: Python image functions
# Copyright (C) 2008
# Associated Universities, Inc. Washington DC, USA.
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published by
# the Free Software Foundation; either version 2 of the L... | casacore/python-casacore | casacore/images/__init__.py | Python | gpl-2.0 | 2,303 |
# sql/util.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""High level utilities which build upon other modules here.
"""
from .. import exc, uti... | jessekl/flixr | venv/lib/python2.7/site-packages/sqlalchemy/sql/util.py | Python | mit | 19,769 |
import jwt
import re
from tornado.gen import coroutine
from tornado.httpclient import AsyncHTTPClient
from os import path, getcwd
from api.model.models import User, UserActivation
from api.Crypto import hash_password
import functools
def authenticated(method):
@functools.wraps(method)
def wrapper(self, *arg... | fdemian/Morpheus | api/Utils.py | Python | bsd-2-clause | 2,877 |
import sys
import optparse
import subprocess
import random
import pdb
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams.update({'font.size': 40})
import math
import numpy as np
import scipy.io
a2_10 = np.loadtxt('2min3RCT_taus_a1.0',dtype=int)
t2_10 = np.loadtxt('2min3RCT_taus_time_a1.0',dtype=int... | ucbtrans/sumo-project | examples/timingPlan_simulation/Throughput/plots4pravin/Deceleration_3/5050_with_platooning/RCT3/tau_plots.py | Python | bsd-2-clause | 3,321 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-datacatalog | samples/generated_samples/datacatalog_generated_datacatalog_v1beta1_data_catalog_list_tags_async.py | Python | apache-2.0 | 1,540 |
from collections import deque
from lcdui import common
from lcdui.ui import widget
import array
import time
class Frame(object):
def __init__(self, ui):
self._ui = ui
self._widgets = {}
self._position = {}
self._span = {}
self._screen_buffer = ScreenBuffer(self.rows(), self.cols())
self.onI... | RockingRolli/pylcdui | lcdui/ui/frame.py | Python | gpl-2.0 | 7,655 |
# -*- coding: utf-8 -*-
"""Calculates the current version number.
If possible, uses output of “git describe” modified to conform to the
versioning scheme that setuptools uses (see PEP 386). Releases must be
labelled with annotated tags (signed tags are annotated) of the following
format:
v<num>(.<num>)+ [ {a|b|c... | jcollie/otx | version.py | Python | gpl-3.0 | 3,527 |
# © 2008-2020 Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details
{
"name": "Romania - Invoice Report ",
"summary": "Localizare Terrabit",
"version": "14.0.3.0.3",
"author": "Dorin Hongu," "Odoo Community Association (OCA)",
"website": "https://github.... | dhongu/l10n-romania | l10n_ro_invoice_report/__manifest__.py | Python | agpl-3.0 | 887 |
# -*- coding: utf-8 -*-
from setuptools import setup
VERSION = '0.1.3'
setup(
name='django-compoundqueryset',
packages=[
'djcompoundqueryset',
],
version=VERSION,
description='Allows for creation of compound querysets in Django.',
url='https://github.com/brianwawok/django-compoundquer... | brianwawok/django-compoundqueryset | setup.py | Python | mit | 1,249 |
import codecs
import os
from setuptools import setup
def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
setup(
name="django-queued-storage",
use_scm_version=True,
setup_requires=['setuptools_sc... | jezdez/django-queued-storage | setup.py | Python | bsd-3-clause | 1,190 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('assessment', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='StaffW... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/openassessment/assessment/migrations/0002_staffworkflow.py | Python | agpl-3.0 | 1,376 |
from phystricks import *
def UneCellule():
def Sigma(dep,leng):
sigma=[dep]
d=dep
for l in leng :
d=d+l
sigma.append(d)
return sigma
pspict,fig = SinglePicture("UneCellule")
a1=1
l1=[1.2,1.5,0.5,1,1]
sigma1=Sigma(a1,l1)
b1=a1+sum(l1)
a2=2
l2=[0.5,1.5,1]
sigma2=Sigma(a2,l2)
b2=a2+sum(l2)
for ... | Naereen/mazhe | phystricksUneCellule.py | Python | gpl-3.0 | 1,522 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | tensorflow/neural-structured-learning | research/kg_hyp_emb/models/euclidean.py | Python | apache-2.0 | 6,107 |
# Copyright 2016 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 required by applicable law or a... | Cyber-Neuron/inception_v3 | inception/inception/inception_train.py | Python | apache-2.0 | 15,221 |
# 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... | sileht/pifpaf | pifpaf/drivers/etcd.py | Python | apache-2.0 | 3,783 |
#!/usr/bin/env python
# Copyright 2013 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.
"""This script is a wrapper around the GN binary that is pulled from Google
Cloud Storage when you sync Chrome. The binaries go into pl... | michalliu/chromium-depot_tools | gn.py | Python | bsd-3-clause | 1,319 |
## {{{ http://code.activestate.com/recipes/492223/ (r1)
def protect_utf8(wrapped_function, encoding='UTF-8'):
"""Temporarily convert a UTF-8 string to Unicode to prevent breakage.
protect_utf8 is a function decorator that can prevent naive
functions from breaking UTF-8.
If the wrapped function takes ... | ParsonsAMT/Myne | datamining/libs/truncate.py | Python | agpl-3.0 | 1,967 |
# Copyright 2020, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | google-research/federated | reconstruction/movielens/movielens_dataset_test.py | Python | apache-2.0 | 17,985 |
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="energenie",
version="1.0.1",
author="Ben Nuttall",
author_email="ben@raspberrypi.org",
description="Remotely control power sockets from the Raspberry Pi",
... | rjw57/energenie | setup.py | Python | bsd-3-clause | 756 |
from typing import Optional, Union
import osgeo
import numpy as np
import pandas as pd
try:
import xarray as xr
except ImportError:
pass
from .landslide.common import (
static_factor_of_safety,
rock_slope_static_factor_of_safety,
)
from .landslide.newmark import (
newmark_critical_accel,
new... | gem/oq-engine | openquake/sep/calculators.py | Python | agpl-3.0 | 2,395 |
"""Test for Roles CLI
:Requirement: Role
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: UsersRoles
:Assignee: dsynk
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import re
from math import ceil
from random import choice
import pytest
from fauxfactory import gen_string
from r... | JacobCallahan/robottelo | tests/foreman/cli/test_role.py | Python | gpl-3.0 | 12,631 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | dset0x/invenio-checker-old | invenio_checker/conftest2.py | Python | gpl-2.0 | 24,901 |
# -*- coding: utf-8 -*-
from local_settings import *
# Application definition
INSTALLED_APPS = (
'wpadmin',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib... | CARocha/mapafinca | mapafinca/settings.py | Python | mit | 3,040 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 you... | SNoiraud/gramps | gramps/gen/filters/rules/media/_mediaprivate.py | Python | gpl-2.0 | 1,633 |
#!/usr/bin/env python3
#******************************************************************************
# (C) 2018, Stefan Korner, Austria *
# *
# The Space Python Library is free software; you can redi... | Stefan-Korner/SpacePyLibrary | AppTest/testEDENclient.py | Python | mit | 5,625 |
from django.contrib import admin
from layerdefinitions.models import LayerDefinition, Review
class LayerDefinitionInline(admin.TabularInline):
model = Review
list_display = ('review_date', 'comment', 'reviewer')
@admin.register(LayerDefinition)
class LayerDefinitionAdmin(admin.ModelAdmin):
inlines = [La... | qgis/QGIS-Django | qgis-app/layerdefinitions/admin.py | Python | gpl-2.0 | 618 |
#!/usr/bin/python
#
# Copyright (c) 2011-2013 Jason Dobies
#
# This file is part of Okaara.
#
# Okaara 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 l... | jdob/okaara | samples/sample_table.py | Python | gpl-2.0 | 4,650 |
# This file is a part of MediaDrop (http://www.mediadrop.net),
# Copyright 2009-2014 MediaDrop contributors
# For the exact contribution history, see the git revision log.
# The source code contained in this file is licensed under the GPLv3 or
# (at your option) any later version.
# See LICENSE.txt in the main project ... | timohtey/mediadrop_copy | mediadrop/lib/helpers.py | Python | gpl-3.0 | 15,572 |
import pprint
import re
import sys
import unittest
sys.path.insert(0, '..')
import pycparser.c_ast as c_ast
class Test_c_ast(unittest.TestCase):
def test_BinaryOp(self):
b1 = c_ast.BinaryOp(
op='+',
left=c_ast.Constant(type='int', value='6'),
right=c_ast.... | songjiguo/interface-code-generator | tests/test_c_ast.py | Python | bsd-3-clause | 2,224 |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from ..view.Ui_DamageForm import *
from ..model.DatabaseHelper import *
from ..model.core_classes import CoDamage
from ..utils.PluginUtils import *
from ..utils.LayerUtils import *
from DamageDialog import *
class DamageForm(QWidget, Ui_DamageForm, DatabaseHelper):... | gc-i/wntOS | controller/DamageForm.py | Python | gpl-3.0 | 5,612 |
#!/usr/bin/env python
# Copyright 2013 Abram Hindle
#
# 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... | tbrockman/CMPUT404-assignment-webserver | freetests.py | Python | apache-2.0 | 1,988 |
import tempfile
import sys
import os
import warnings
import numpy as np
from nose import SkipTest
from numpy.core import *
from numpy.compat import asbytes
from numpy.testing.utils import WarningManager
from numpy.compat import asbytes, getexception, strchar
from test_print import in_foreign_locale
from nump... | beiko-lab/gengis | bin/Lib/site-packages/numpy/core/tests/test_multiarray.py | Python | gpl-3.0 | 119,031 |
#!/usr/bin/env python
# Author: Angela Chapman
# Date: 8/6/2014
#
# This file contains code to accompany the Kaggle tutorial
# "Deep learning goes to the movies". The code in this file
# is for Part 2 of the tutorial and covers Bag of Centroids
# for a Word2Vec model. This code assumes that you have already
# ... | CharLLCH/Word2Vec | pycode/Word2Vec_BagOfCentroids.py | Python | gpl-2.0 | 5,355 |
from threading import Lock
from pprint import pformat
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django import http
from django.core import signals
from django.core.handlers import base
from django.core.urlresolvers import set_script_prefix
from django.utils impo... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.2/django/core/handlers/wsgi.py | Python | bsd-3-clause | 9,928 |
#!/usr/bin/env python
import sys
import os
import platform
import cexbot
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if getattr(sys, 'version_info', (0, 0, 0)) < (2, 5, 0, 'final'):
raise SystemExit("cexbot requires Python 2.5 or later.")
if sys.argv[-1] == 'publis... | nikcub/cexbot | setup.py | Python | mit | 1,604 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# InkCut, Plot HPGL directly from Inkscape.
# device.py
# device settings
#
# Copyright 2010 Jairus Martin <frmdstryr@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms... | shackspace/inkcut_dmpl | app/bin/device.py | Python | gpl-3.0 | 3,688 |
import tensorflow as tf
from keras import backend as K
from keras import regularizers, constraints, initializers, activations
from keras.layers.recurrent import Recurrent
from keras.engine import InputSpec
tfPrint = lambda d, T: tf.Print(input_=T, data=[T, tf.shape(T)], message=d)
"""
Original code from the keras bac... | lukas/ml-class | examples/lstm/attention/attention_decoder.py | Python | gpl-2.0 | 15,894 |
# tr_mongo_rest_ext.py william k. johnson 2017
import logging
import re
import requests
from datetime import datetime
import json
from bson import json_util , ObjectId
import flask
from flask import Flask , request , send_file , render_template , url_for
from flask import redirect , Response , current_app , jsoni... | chromatic-universe/cci-stream-mta | src/cci_stream_tornado/cci_mta_trinity/streams/tr_mongo_rest_ext.py | Python | mit | 7,750 |
import unittest
from binary_conversion import convert_to_binary
class TestCorrectness(unittest.TestCase):
def test_converts_to_binary(self):
for i in range(1, 1000):
self.assertEqual(convert_to_binary(i), '{0:b}'.format(i))
if __name__ == '__main__':
unittest.main()
| Bradfield/algos | book/stacks/binary_conversion_test.py | Python | cc0-1.0 | 300 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import logging
from pymatgen.core import Molecule
from pymatgen.io.qchem_io.inputs import QCInput
from pymatgen.io.qchem_io.utils import lower_and_check_unique
# Classes for reading/manipulating/writing QChem ... | nisse3000/pymatgen | pymatgen/io/qchem_io/sets.py | Python | mit | 7,003 |
from __future__ import unicode_literals
import io
import os
import datetime
import tempfile
import unittest
import profig
# use str for unicode data and bytes for binary data
if not profig.PY3:
str = unicode
if profig.WIN:
try:
import winreg
except ImportError:
import _winreg as winreg
... | firstworldproblems/journaltools | tests.py | Python | mit | 20,137 |
#!/usr/bin/env python
from setuptools import setup
setup(
name="vagrant-metadata",
version="1.1.2",
description="Vagrant metadata.json generator",
long_description=open("README.md", "r").read(),
long_description_content_type="text/markdown",
url="https://github.com/lvillani/vagrant-metadata/",... | lvillani/vagrant-metadata | setup.py | Python | mit | 640 |
import pytest
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametrize(
"to_concat_dtypes, result_dtype",
[
(["Int64", "Int64"], "Int64"),
(["UInt64", "UInt64"], "UInt64"),
(["Int8", "Int8"], "Int8"),
(["Int8", "Int16"], "Int16"),
(["UInt8", "Int8"], "... | TomAugspurger/pandas | pandas/tests/arrays/integer/test_concat.py | Python | bsd-3-clause | 780 |
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "codearena.settings")
application = get_wsgi_application()
application = DjangoWhiteNoise(application)
| rachitnaruzu/codearena | codearena/wsgi.py | Python | mit | 261 |
from __future__ import absolute_import
import inspect
import six
import sys
from sentry.utils.imports import import_string
PACKAGES = {
"django.db.backends.postgresql_psycopg2": "psycopg2.extensions",
"sentry.db.postgres": "psycopg2.extensions",
"django.core.cache.backends.memcached.MemcachedCache": "mem... | mvaled/sentry | src/sentry/utils/settings.py | Python | bsd-3-clause | 2,420 |
import sys
import re
import os
import pybars
import path
SEGMENTS = {
'FLASH': {
'size': 1 * 1024 * 1024,
'sections': ['.text', '.data']
},
'RAM': {
'size': 128 * 1024,
'sections': ['.bss', '.heap']
}
}
SECTION_HEADER = r"^(?P<name>\S+)\s+(?P<base>0x[0-... | PW-Sat2/PWSat2OBC | utils/memory_report.py | Python | agpl-3.0 | 4,512 |
#!/usr/bin/env python
#pyNFC_preprocess.py
"""
pre-processing steps for pyNFC code. Basic geometry definition
and partitioning information created and input file created prior to
parallel simulation run
"""
import scipy.io
import math
import argparse
parser = argparse.ArgumentParser(prog='pyNFC_preproces... | stu314159/pyNFC | pyNFC_preprocess.py | Python | mit | 5,297 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# Thinkopen Brasil
# Copyright (C) Thinkopen Solutions Brasil (<http://www.tkobr.com>).
#
# This ... | bmya/tkobr-addons | tko_point_of_sale_discount_cards/__openerp__.py | Python | agpl-3.0 | 2,070 |
data = (
'Yu ', # 0x00
'Shui -|-Shei ', # 0x01
'Shen ', # 0x02
'Diao ', # 0x03
'Chan ', # 0x04
'Liang ', # 0x05
'Zhun ', # 0x06
'Sui ', # 0x07
'Tan ', # 0x08
'Shen ', # 0x09
'Yi ', # 0x0a
'Mou ', # 0x0b
'Chen ', # 0x0c
'Die ', # 0x0d
'Huang ', # 0x0e
'Jian ', # 0x0f
'Xie ... | Memrise/unidecode | unidecode/x08c.py | Python | gpl-2.0 | 4,638 |
import time
import sys
import _mysql
import random
import string
import re
from selenium import webdriver
from selenium.webdriver.support.ui import Select
import selenium.webdriver.chrome.service as service
try:
# Check to see if it was added
db=_mysql.connect('localhost','root','root','paws_db')
rand_fname=''.jo... | TheParrotsAreComing/PAWS | TestingAssets/Fosters/foster_edit.py | Python | mit | 2,306 |
from codeschool.tests import *
from cs_auth.factories import *
# Fixtures
register(FriendshipStatusFactory)
class TestURLs(URLBaseTester):
public_urls = [
'/',
'/accounts/login',
'/accounts/signout',
]
login_urls = [
'/accounts/{user.username}/edit',
'/accounts/{us... | jonnatas/codeschool | old/cs_auth/test_app.py | Python | gpl-3.0 | 740 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
# (c) 2013, Yeukhon Wong <yeukhon@acm.org>
# (c) 2014, Nate Coraor <nate@bx.psu.edu>
#
# 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_M... | jmighion/ansible | lib/ansible/modules/source_control/hg.py | Python | gpl-3.0 | 9,896 |
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | fabian4/trove | trove/tests/fakes/swift.py | Python | apache-2.0 | 21,028 |
#!/usr/bin/env python
import os
import sys
import argparse
import json
# tempate2json.py -k SYSTEM=lonestar.tacc.utexas.edu
# PATH=/home/vaughn/apps -i template.jsonx -o file.json
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("-k", dest='keys', help='Spac... | iPlantCollaborativeOpenSource/cyverse-sdk | src/scripts/template2json.py | Python | bsd-3-clause | 1,718 |
from typing import TypeVar, Any, Union, Callable, List, Tuple, Optional
import ray
from ray.util.annotations import PublicAPI, DeveloperAPI
from ray.data.block import (
Block,
BlockAccessor,
BlockMetadata,
BlockPartition,
BlockExecStats,
)
from ray.data.context import DatasetContext
from ray.data.i... | ray-project/ray | python/ray/data/impl/compute.py | Python | apache-2.0 | 10,223 |
from django.conf.urls.defaults import patterns, url, include
from django.contrib import admin
from django.conf import settings
from django.views.generic.simple import direct_to_template
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^', include('reciblog.blog.urls')),
url(r'^about$', direct_to_tem... | wraithan/reciblog | urls.py | Python | bsd-2-clause | 617 |
'''
Splits dataset into samples of specified duration (we used 4 seconds) and
puts all samples not of this duration into seperate directory
@date 2017-05-19
'''
import os
import wave
import sys
from os import listdir
from os.path import isfile, isdir, join
# Hyperparameter
wantedduration = sys.argv[1]
# if sys inpu... | verrannt/deepdreaming-sounds-tensorflow | datatools/deleteDurations.py | Python | mit | 970 |
# Copyright 2004-2017 Tom Rothamel <pytom@bishoujo.us>
#
# 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, m... | kfcpaladin/sze-the-game | renpy/gl/glblacklist.py | Python | mit | 1,846 |
def remove_duplicates(sentence: str) -> str:
"""
Remove duplicates from sentence
>>> remove_duplicates("Python is great and Java is also great")
'Java Python also and great is'
>>> remove_duplicates("Python is great and Java is also great")
'Java Python also and great is'
"""
retu... | TheAlgorithms/Python | strings/remove_duplicate.py | Python | mit | 434 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
from decimal import Decimal
import doctest
import unittest
from couchdb import design, mapping
from... | ryanolson/couchdb-python | couchdb/tests/mapping.py | Python | bsd-3-clause | 5,861 |
from pcs_test.tools.command_env.mock_get_local_corosync_conf import Call
from pcs_test.tools.misc import get_test_resource as rc
from pcs.lib.corosync.config_facade import ConfigFacade
from pcs.lib.corosync.config_parser import Parser, Section
class CorosyncConf:
def __init__(self, call_collection):
self... | feist/pcs | pcs_test/tools/command_env/config_corosync_conf.py | Python | gpl-2.0 | 2,245 |
import argparse
from random import shuffle
import json
import cPickle as pickle
import os
import numpy as np
import dataset as data
DFLT_ANGLES = '[0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180]'
DFLT_AUGMENT_PRM = '{"angles":' + DFLT_ANGLES + ', "max_pixel": 58}'
HELP_AUGMENT_PRM = 'Parameters used to aug... | escorciav/ndsb | src/s_augment_dataset.py | Python | mit | 2,397 |
# One of your friends has an awful writing style: he almost never starts a message with a capital letter, but adds
# uppercase letters in random places throughout the message. It makes chatting with him very difficult for you, so
# you decided to write a plugin that will change each message received from your friend ... | ntthuy11/CodeFights | Arcade/04_Python/02_SlitheringInStrings/fixMessage.py | Python | mit | 791 |
from branca.element import MacroElement
from folium.elements import JSCSSMixin
from folium.utilities import parse_options
from jinja2 import Template
class MousePosition(JSCSSMixin, MacroElement):
"""Add a field that shows the coordinates of the mouse position.
Uses the Leaflet plugin by Ardhi Lukianto und... | python-visualization/folium | folium/plugins/mouse_position.py | Python | mit | 3,066 |
#Get dota text from soundboard.com
from bs4 import BeautifulSoup
import json
import re
import requests
#Website to scrape dota text from
website = "http://www.soundboard.com/sb/howboutthis"
#Get website data
data = requests.get(website).text
#Parse data using bs4
soup = BeautifulSoup(data, "html.parser")
#List of ... | KingsleyBell/dotacelebbot | textList.py | Python | mit | 590 |
import esp
class DS:
@staticmethod
def calc_crc(indata):
crc = 0
for data in indata:
crc = crc ^ data
for ii in range(8):
if crc & 0x01:
crc = (crc >> 1) ^ 0x8C
else:
crc >>= 1
return crc
... | mianos/micropython | esp8266/examples/onewire.py | Python | mit | 1,458 |
#! /usr/bin/env python
# coding=utf-8
""" Grep-like tool for FITS headers
Call commandline: ``grepfitshdr --help`` for parameters info.
"""
from __future__ import print_function, division
import astropy.io.fits as pyfits
import re
from os.path import isfile
from sys import exit
from sys import stdout
from glob im... | majkelx/astwro | astwro/tools/grepfitshdr.py | Python | mit | 5,442 |
#!/usr/bin/env python3
import os
import sys
assert sys.version_info >= (3, 5)
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "courses.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sfu-fas/coursys | manage.py | Python | gpl-3.0 | 285 |
from django.db import connection, transaction
from django.db.models import signals, get_model
from django.db.models.fields import AutoField, Field, IntegerField, PositiveIntegerField, PositiveSmallIntegerField, get_ul_class
from django.db.models.related import RelatedObject
from django.db.models.query_utils import Quer... | pelle/talk.org | django/db/models/fields/related.py | Python | gpl-3.0 | 37,425 |
from pledger.account import Account, AccountFactory
from pledger.parser import Parser
from pledger.directive import *
from pledger.ledger_processor import LedgerProcessor
import pytest
class ProcessorStub(object):
def __init__(self):
self.repo = AccountFactory()
self.account = self.repo.root()
... | pcapriotti/pledger | tests/test_directive.py | Python | mit | 1,746 |
# coding: utf-8
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class FeatureValue(object):
"""
NOTE: This class is auto... | kinow-io/kinow-python-sdk | kinow_client/models/feature_value.py | Python | apache-2.0 | 4,404 |
"""
Tests for OEShape color utilities.
"""
import numpy as np
import unittest
from openeye.oechem import *
from openeye.oeshape import *
from ..color import ColorForceField
class TestColorForceField(unittest.TestCase):
"""
Tests for ColorForceField.
"""
def setUp(self):
"""
Set up te... | skearnes/color-features | oe_utils/shape/tests/test_color.py | Python | bsd-3-clause | 1,693 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.