code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright 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 compliance with the License. You may obtain
# a ... | hahaps/openstack-project-generator | template/<project_name>/__init__.py | Python | apache-2.0 | 981 |
"""
Various utilities for scrambling.
"""
import os, sys, errno, re, distutils.util, glob, shutil, subprocess, tarfile, zipfile
from distutils.sysconfig import get_config_var, get_config_vars
try:
import zlib
except:
raise Exception( 'Cannot import zlib, which must exist to build eggs. If your python interpre... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/scripts/scramble/lib/scramble_lib.py | Python | gpl-3.0 | 4,890 |
# Copyright 2012-2013 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 la... | metacloud/python-openstackclient | openstackclient/identity/v3/consumer.py | Python | apache-2.0 | 4,875 |
try:
a = 1
except:
a = 2
else:<caret> | asedunov/intellij-community | python/testData/keywordCompletion/elseInTryNotIndented.after.py | Python | apache-2.0 | 45 |
#!/usr/bin/python
#
# Copyright 2011-2013 Software freedom conservancy
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | adamwwt/chvac | venv/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py | Python | mit | 3,243 |
# da vs turns module
import numpy as np
from scipy import optimize
import matplotlib.pyplot as pl
import glob, sys, os, time
from deskdb import SixDeskDB,tune_dir,mk_dir
import matplotlib
# ------------- basic functions -----------
def get_divisors(n):
"""finds the divisors of an integer number"""
large_divisors = ... | mfittere/SixDeskDB | sixdeskdb/davsturns.py | Python | lgpl-2.1 | 28,687 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import tempfile
import os
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation
)
from django.contrib.contenttypes.models import ContentType
from django.core.fi... | beckastar/django | tests/admin_views/models.py | Python | bsd-3-clause | 20,993 |
#!/usr/bin/env python
import errno
import os
import re
import tempfile
from hashlib import md5
class _FileCacheError(Exception):
"""Base exception class for FileCache related errors"""
class _FileCache(object):
DEPTH = 3
def __init__(self, root_directory=None):
self._InitializeRootDirectory(ro... | milmd90/TwitterBot | twitter/_file_cache.py | Python | apache-2.0 | 5,588 |
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(
paramiko.AutoAddPolicy())
ssh.connect('127.0.0.1', username='xxxxxxx',
password='xxxxxxxxxxx')
stdin, stdout, stderr = ssh.exec_command("uptime")
type(stdin)
stdout.readlines()
| eldie1984/Scripts | pg/para.py | Python | gpl-2.0 | 262 |
#
# Package analogous to 'threading.py' but using processes
#
# multiprocessing/__init__.py
#
# This package is intended to duplicate the functionality (and much of
# the API) of threading.py but uses processes instead of threads. A
# subpackage 'multiprocessing.dummy' has the same API but is a simple
# wrapper for 't... | microdee/IronHydra | src/IronHydra/Lib/multiprocessing/__init__.py | Python | mit | 7,897 |
__package__ = 'emotion.axis'
from .. import log as elog
from ..task_utils import *
from ..settings import AxisSettings
from .. import event
import time
import gevent
import re
import types
class Null(object):
__slots__ = []
class Motion(object):
def __init__(self, axis, target_pos, delta):
self.__... | ESRF-BCU/emotion | emotion/axis.py | Python | gpl-2.0 | 26,587 |
"""\
Examples
For the development.ini you must supply the paster app name:
%(prog)s development.ini --app-name app --init --clear
"""
from pkg_resources import resource_filename
from pyramid.paster import get_app, get_appsettings
from multiprocessing import Process, set_start_method
import atexit
import logging
... | ENCODE-DCC/snovault | src/snovault/dev_servers.py | Python | mit | 4,779 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
for each in orm.Contact.objects.all():
... | prontointern/django-contact-form | django_contact_form_project/contacts/migrations/0004_migrate_data_from_location_to_lat_and_lng.py | Python | mit | 1,512 |
"""Adhocracy frontend customization package."""
import os
import version
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
requires = ['adhocracy_frontend',
... | fhartwig/adhocracy3.mercator | src/meinberlin/setup.py | Python | agpl-3.0 | 1,478 |
import numpy as np
import sys
N = int(sys.argv[1])
eyes = np.random.randint(1, 7, N)
success = eyes == 6 # True/False array
M = np.sum(success) # treats True as 1, False as 0
print 'Got six %d times out of %d' % (M, N)
| qilicun/python | python3/src/random/roll_die_vec.py | Python | gpl-3.0 | 227 |
from tqdm import tqdm
class LogMode(object):
PBAR = 0
PARALLEL = 1
class Logger(object):
MODE = LogMode.PBAR
def __init__(self, *args, **kwargs):
if Logger.MODE == LogMode.PBAR:
self.logger = PbarLogger(*args, **kwargs)
elif Logger.MODE == LogMode.PARALLEL:
s... | BartKeulen/drl | drl/utilities/logger.py | Python | mit | 2,207 |
# -*- coding: utf-8 -*-
from website.addons.dataverse.client import get_dataset, get_files, \
get_dataverse, connect_from_settings
from website.project.decorators import must_be_contributor_or_public
from website.project.decorators import must_have_addon
from website.util import rubeus
def dataverse_hgrid_root(... | revanthkolli/osf.io | website/addons/dataverse/views/hgrid.py | Python | apache-2.0 | 2,011 |
# Copyright 2014 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 ... | wavemind/mlgcb | modules/manual_progress/manual_progress.py | Python | apache-2.0 | 6,900 |
#!/usr/bin/env python
from __future__ import division
import numpy as np
import scipy.special as scsp
import argparse
import asetk.format.cp2k as cp2k
import asetk.format.cube as cube
import asetk.atomistic.constants as constants
import asetk.util.progressbar as progressbar
import os.path
# Define command line parser
... | cpignedoli/asetk | scripts/cp2k-extrapolate.py | Python | mit | 7,239 |
from django.db import models
from librehatti.suspense.models import Staff
from librehatti.suspense.models import Vehicle
class TeamName(models.Model):
"""Model for team"""
team_name = models.CharField(max_length=500)
def __unicode__(self):
return self.team_name
class StaffInTeam(models.Model):
... | jasvir99/LibreHatti | src/librehatti/programmeletter/models.py | Python | gpl-2.0 | 1,397 |
"""Hook specifications for pytest plugins which are invoked by pytest itself
and by builtin plugins."""
from pathlib import Path
from typing import Any
from typing import Dict
from typing import List
from typing import Mapping
from typing import Optional
from typing import Sequence
from typing import Tuple
from typing ... | nicoddemus/pytest | src/_pytest/hookspec.py | Python | mit | 32,626 |
def is_number(number):
try:
float(number)
return True
except ValueError:
return False
def add(number1, number2):
if not is_number(number1) or not is_number(number2):
return 'error'
return number1 + number2
def subtract(number1, number2):
if not is_number(number1)... | vivanov1410/pickled-brain | 001/vivanov/pickle001.py | Python | mit | 703 |
#!/usr/bin/env python3
#
# cppcheck addon for Y2038 safeness detection
#
# Detects:
#
# 1. _TIME_BITS being defined to something else than 64 bits
# 2. _USE_TIME_BITS64 being defined when _TIME_BITS is not
# 3. Any Y2038-unsafe symbol when _USE_TIME_BITS64 is not defined.
#
# Example usage:
# $ cppcheck --dump path-to-... | bartlomiejgrzeskowiak/cppcheck | addons/y2038.py | Python | gpl-3.0 | 7,434 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20150914_2147'),
]
operations = [
migrations.AlterField(
model_name='movie',
name=... | rtancman/filmes | movies/core/migrations/0003_auto_20150914_2157.py | Python | mit | 408 |
from enum import Enum
class EntityType(Enum):
Person = 0
Location = 1
Organisation = 2
Address = 3
class Entity:
def __init__(self, type: EntityType, title: str, content: object):
self.type = type
self.title = title
self.content = content
@property
def serializ... | bureaucratic-labs/pinkerton | pinkerton/base.py | Python | mit | 427 |
import unittest
import logging
from locator.dailydigest import DailyDigestInputParser
from locator.parser import LocatorParser, OutputParser
from locator import process_escapes_in_line
logger = logging.getLogger(__name__)
class AccentsTest(unittest.TestCase):
def _load_and_convert(self, filename):
'''Che... | LibraryOfCongress/locator | locator/tests/test_accents.py | Python | cc0-1.0 | 1,635 |
from . import SPyTSError
class TSFileWriterError(SPyTSError.SPyTSError):
def __init__(self, msg="TSFileWriterError occured."):
self.msg = msg
| dondamage/SPyTS | exceptions/TSFileWriterError.py | Python | gpl-2.0 | 151 |
class IView(object):
def __init__(self):
super(IView, self).__init__()
self.viewmodel = None
def update(self):
"""
Main function of the view component in MVVM pattern, draws the contents of the model to the output device.
"""
raise NotImplementedError()
class... | pdyban/dicombrowser | dicomviewer/iview.py | Python | apache-2.0 | 918 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pyspin
~~~~~~~
Little terminal spinner lib.
:copyright: (c) 2015 by lord63.
:license: MIT, see LICENSE for more details.
"""
__title__ = "pyspin"
__version__ = '1.1.1'
__author__ = "lord63"
__license__ = "MIT"
__copyright__ = "Copyright 2015 lord... | lord63/py-spin | pyspin/__init__.py | Python | mit | 324 |
# -*- coding: utf-8 -*-
from openerp.exceptions import Warning
from openerp import models, fields
class Certificate(models.Model):
""""""
_name = 'infrastructure.certificate'
_description = 'SSL Certificate'
name = fields.Char(
string='Name',
required=True
)
... | steingabelgaard/odoo-infrastructure | infrastructure/certificate.py | Python | agpl-3.0 | 1,034 |
import _plotly_utils.basevalidators
class FillcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(self, plotly_name="fillcolor", parent_name="scatterpolargl", **kwargs):
super(FillcolorValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatterpolargl/_fillcolor.py | Python | mit | 408 |
# -*- coding: utf-8 -*-
from django.db import models
from tweets.models import Tweet
class Tag(models.Model):
name = models.CharField(max_length=255, unique=True, db_index=True)
is_hashtag = models.BooleanField(default=False)
tweets = models.ManyToManyField(Tweet, related_name='tags')
class Meta:
... | kk6/onedraw | onedraw/tags/models.py | Python | mit | 345 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Buron. Copyright Yannick Buron
#
# 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 t... | codoo/vertical-exchange | __TODO__/exchange_rating/vote.py | Python | agpl-3.0 | 16,162 |
first_name = 'Brando'
last_name = 'Ickett'
print('Hi there, %s %s' % (first_name, last_name)) | amosnier/python_for_kids | book_code/appendixb/ch3-greetings.py | Python | gpl-3.0 | 93 |
# Copyright 2015 Cloudbase Solutions Srl
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | cmin764/cloudbase-init | cloudbaseinit/tests/plugins/common/userdataplugins/cloudconfigplugins/test_write_files.py | Python | apache-2.0 | 8,368 |
from __future__ import generators
from cStringIO import StringIO
import email.Message
import email.Parser
import email.Utils
import hmac
import inspect
import re
import sha
import sys
import time
import types
class fbp822:
"""Flow-based messages via simple RFC-822-like format.
Provides a faster and more bi... | stevegt/isconf4 | lib/python/isconf/fbp822.py | Python | gpl-2.0 | 12,737 |
from django.conf.urls import patterns, url
from rango import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^about', views.about, name='about'),
url(r'^add_tapa/(?P<bar_name_slug>[\w\-]+)/$', views.add_tapa, name='add_tapa'),
url(r'^reclama_datos/', views.reclam... | mpvillafranca/barestapas | tango_with_django_project/rango/urls.py | Python | gpl-3.0 | 501 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/appflow/appflowpolicylabel_appflowpolicy_binding.py | Python | apache-2.0 | 9,927 |
# -*- coding: utf-8 -*-
import filename
def main():
rootpath = '~/Documents' # change this to a proper directory path
ext = 'pdf' # change it to whatever file extension you need
oldPrefix = '' # left empty when adding new prefix
newPrefix = 'prefix-' # left empty when removing old prefix
oldSuffi... | iROCKBUNNY/myfile | filename_sample_code.py | Python | mit | 631 |
import logging
from datetime import datetime
from ....entities.run import Run
from cassandra_runs_query_builder import CassandraRunsQueryBuilder
from cassandra_runs_insert_commands_builder import CassandraRunsInsertCommandsBuilder
from cassandra_runs_query_result_parser import CassandraRunsQueryResultParser
logger = l... | jacekdalkowski/bike-timer | web-api/biketimerwebapi/db/repositories/cassandra/runs/cassandra_runs_repository.py | Python | apache-2.0 | 3,681 |
def send_simple_message():
return requests.post(
"https://api.mailgun.net/v3/sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org/messages",
auth=("api", "key-679dc79b890e700f11f001a6bf86f4a1"),
data={"from": "Mailgun Sandbox <postmaster@sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org>",
... | nicorellius/pdxpixel | pdxpixel/core/mailgun.py | Python | mit | 1,073 |
# -*- coding: utf-8 -*-
#
# This tool helps you rebase your package to the latest version
# Copyright (C) 2013-2019 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version... | rebase-helper/rebase-helper | rebasehelper/plugins/build_tools/srpm/mock.py | Python | gpl-2.0 | 5,197 |
""" Module containing the storage services.
Contains the standard :class:`~pypet.storageservice.HDF5StorageSerivce`.
"""
__author__ = 'Robert Meyer'
import os
import warnings
import time
import hashlib
import itertools as itools
import tables as pt
import tables.parameters as ptpa
import numpy as np
from pandas i... | nigroup/pypet | pypet/storageservice.py | Python | bsd-3-clause | 209,955 |
#! /usr/bin/env python
'''Make sure the Cassandra client is sane'''
import unittest
from test import BaseTest
from simhash_db import Client
class CassandraTest(BaseTest, unittest.TestCase):
'''Test the Cassandra client'''
def make_client(self, name, num_blocks, num_bits):
return Client('cassandra', ... | seomoz/simhash-db-py | test/test_cassandra.py | Python | mit | 397 |
from __future__ import unicode_literals
import base64
import binascii
import hashlib
import importlib
from collections import OrderedDict
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.signals import setting_changed
from django.dispatch import rece... | diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/contrib/auth/hashers.py | Python | mit | 17,840 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# 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',
... | konstruktoid/ansible-upstream | lib/ansible/modules/network/nxos/nxos_linkagg.py | Python | gpl-3.0 | 12,489 |
"""
Given a square matrix, rotate it in-place 90 degrees anti-clockwise.
"""
def matrix_rotate(mat):
N = len(mat[0])
sz = N
for layer in range(1, N/2 + 1):
fR = fC = layer - 1
lR = lC = N - layer
for i in range(sz - 1):
temp = mat[fR][lC - i]
mat[fR][lC - i... | prathamtandon/g4gproblems | Misc/square_matrix_rotation.py | Python | mit | 868 |
from sqlalchemy import Column, Integer, String, Float, ForeignKey, Index
from sqlalchemy.orm import relationship
from api import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(120), unique=True)
password = db.Column(db.String(64))
def is_active(self)... | Code4SA/elections-api | api/models.py | Python | apache-2.0 | 4,191 |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import ctypes
import errno
import os
import pyglet
from pyglet.app.xlib import XlibSelectDevice
from base import Device, Control, RelativeAxis, AbsoluteAxis, Button, Joystick
from base import DeviceOpenException
from evdev_constan... | NiclasEriksen/py-towerwars | src/pyglet/input/evdev.py | Python | cc0-1.0 | 9,184 |
# Copyright 2018 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... | ghchinoy/tensorflow | tensorflow/python/distribute/multi_worker_util_test.py | Python | apache-2.0 | 8,226 |
import matplotlib.pyplot as plt
import mpl_toolkits.axisartist as AA
fig = plt.figure(1)
fig.subplots_adjust(right=0.85)
ax = AA.Subplot(fig, 1, 1, 1)
fig.add_subplot(ax)
# make some axis invisible
ax.axis["bottom", "top", "right"].set_visible(False)
# make an new axis along the first axis axis (x-axis) which pass
#... | lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/doc/mpl_toolkits/axes_grid/figures/simple_axisartist1.py | Python | mit | 562 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/vpn_client_parameters_py3.py | Python | mit | 1,322 |
###############################################################################
# This file is part of openWNS (open Wireless Network Simulator)
# _____________________________________________________________________________
#
# Copyright (C) 2004-2009
# Chair of Communication Networks (ComNets)
# Kopernikusstr. 5, D-5... | creasyw/IMTAphy | modules/dll/glue/PyConfig/glue/support/CSMACA.py | Python | gpl-2.0 | 4,953 |
#!/usr/bin/python
# Appengine test runner
# Got it from: https://developers.google.com/appengine/docs/python/tools/localunittesting#Setting_Up_a_Testing_Framework
# with some modification
import os
import optparse
import sys
import unittest2
import webtest
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
USAGE = ... | ekaputra07/bokerface | runtest.py | Python | mit | 1,037 |
#!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
"""Test the hunt_view interface."""
import traceback
from grr.gui import runtests_test
from grr.lib import access_control
from grr.lib import aff4
from grr.lib import flags
from grr.lib import flow
from grr.lib import flow_runner
from grr.lib import hu... | darrenbilby/grr | gui/plugins/hunt_view_test.py | Python | apache-2.0 | 26,383 |
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import numpy as np
scaling_factor = 50
r0 = 1/np.sqrt(np.pi)
def plotTube(ax, crossSection, velocity, pressure, dx, t):
radius0 = np.sqrt(crossSection/np.pi)
N = velocity.shape[0]
u0 = 10
ampl = 3
ax.plot(np.arange(N) * d... | precice/elastictube1d | fluid-python/tubePlotting.py | Python | gpl-3.0 | 1,595 |
# -*- coding: utf-8 -*-
import xbmc
import xbmcgui
import xbmcaddon
from utilities import xbmcJsonRequest, Debug, notification, chunks, get_bool_setting
__setting__ = xbmcaddon.Addon('script.myshows').getSetting
__getstring__ = xbmcaddon.Addon('script.myshows').getLocalizedString
add_episodes_to_myshows = get_bool... | DiMartinoX/plugin.video.kinopoisk.ru | script.myshows/episode_sync.py | Python | gpl-3.0 | 16,581 |
"""Unit tests for html_filter."""
import unittest
from symplate import html_filter
class TestHtmlFilter(unittest.TestCase):
def test_str(self):
self.assertEqual(html_filter('foo'), u'foo')
self.assertEqual(html_filter('foo &<>\'" bar'), u'foo &<>'" bar')
self.assertEqual... | benhoyt/symplate | tests/test_html_filter.py | Python | bsd-3-clause | 947 |
# encoding: utf-8
from yast import import_module
import_module('UI')
from yast import *
class Label1DeClient:
def main(self):
UI.OpenDialog(
VBox(
Label(
"\u00DF\u00F6\u00F6\u00F6\u00F6\u00F6\u00F6\u00DC\u00DC\u00DC\u00DC\u00DC\u00F6\u00DF\u00DF\u00DF\u00DF\u00E4\u00C4\u00C4\u00... | yast/yast-python-bindings | examples/Label1_de.py | Python | gpl-2.0 | 476 |
from django.contrib.auth import logout, login, authenticate
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.http import HttpResponse
from django.shortcuts import render
from django.... | shwayytha/art-c | web/scalica/micro/views.py | Python | mit | 4,598 |
print("Status: 301")
print("Location: /static/demos/index.html")
print("")
| NTUTVisualScript/Visual_Script | static/javascript/blockly/appengine/index_redirect.py | Python | mit | 75 |
#! /usr/bin/env python
from x256 import x256
from optparse import OptionParser
import Image
import sys
if sys.version > '3':
from io import BytesIO as StringIO
import urllib.request as urllib
else:
import urllib
try:
from cStringIO import StringIO
except ImportError:
from StringIO ... | magarcia/pycture-tube | pycture-tube/pycturetube.py | Python | mit | 1,553 |
import os
from django.conf import settings
class BorgConfiguration():
@staticmethod
def initialize():
setattr(BorgConfiguration,"DEBUG",getattr(settings,"DEBUG",False))
config = getattr(settings,"HARVEST_CONFIG")
if not config:
config = {}
for name, value in config.... | rockychen-dpaw/borgcollector | borg_utils/borg_config.py | Python | bsd-3-clause | 890 |
'''
Template untuk solusi Lab 11 kelas C.
'''
import tkinter as tk
class Kalkulator():
'''
Sebuah kalkulator.
'''
def __init__(self, master):
self.master = master
# TODO: Set title window menjadi "Kalkulator Sederhana" di bawah ini.
# TODO: Buatlah Label, Entry, Button,
... | giovanism/TarungLab | lab/11/template_11_c.py | Python | mit | 887 |
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from adhocracy4.comments import models as comment_models
from adhocracy4.projects.models import \
ProjectContactDetailMixin as contact_m... | liqd/a4-meinberlin | meinberlin/apps/budgeting/models.py | Python | agpl-3.0 | 1,785 |
import sys
from collections import OrderedDict
from typing import Any, Dict, Iterable, Iterator, Optional, Type, TypeVar
if sys.version_info >= (3, 7):
from typing import Mapping
else: # pragma: no cover
from collections.abc import Mapping as _BaseMapping
class _MappingMeta(type):
def __getitem__... | corenting/immutabledict | immutabledict/__init__.py | Python | mit | 2,701 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
TEMPLATE_DIRS = [
os.path.join(BASE_DIR, 'tests'),
os.path.join(BASE_DIR, 'tri_form/templates'),
]
TEMPLATE_DEBUG = True
# Django >=1.9
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': TEM... | TriOptima/tri.form | tests/settings.py | Python | bsd-3-clause | 710 |
"""
Routines to summarize and report tabular data.
"""
def comment_banner(s, width=50):
line = "#" * width
return "\n".join((line, "#", "# " + s.strip(), "#", line))
def banner(header, rows, major="=", minor="-"):
formatted = [header] + rows
rulersize = max(max(len(z) for z in x.splitlines()) for x ... | tanghaibao/jcvi | jcvi/utils/table.py | Python | bsd-2-clause | 3,946 |
#!/usr/bin/env 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 ... | apache/steve | pysteve/www/wsgi/rest_voter.py | Python | apache-2.0 | 10,933 |
# =============================================================================
# Federal University of Rio Grande do Sul (UFRGS)
# Connectionist Artificial Intelligence Laboratory (LIAC)
# Renato de Pontes Pereira - renato.ppontes@gmail.com
# ============================================================================... | renatopp/psi-robotics | psi/engine/graphics.py | Python | mit | 10,236 |
from functools import wraps
from typing import Any, Callable, Dict, TypeVar, cast
# FIXME: Using ParamSpec when supported in mypy *and* Visual Studio code
# from typing_extensions import ParamSpec
# T = TypeVar("T")
# P = ParamSpec("P")
F = TypeVar("F", bound=Callable[..., Any])
def memoize(function: F) -> F:
#... | FrodeSolheim/fs-uae-launcher | fscore/memoize.py | Python | gpl-2.0 | 1,435 |
#! /usr/bin/env python
from __future__ import print_function
from openturns import *
from math import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
# Instanciate one distribution object
dim = 3
R = CorrelationMatrix(dim)
for i in range(dim - 1):
R[i, i + 1] = 0.25
copula = NormalCopul... | dubourg/openturns | python/test/t_NormalCopula_std.py | Python | gpl-3.0 | 3,230 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2019, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | chetan51/nupic.research | nupic/research/frameworks/dynamic_sparse/models/comparative.py | Python | gpl-3.0 | 11,710 |
import geojson
class Feature(object):
'''Class for defining objects ready to push to Datafangst'''
def __init__(self, objekt_type, coordinates, tag):
self._objekt_type = objekt_type
self._coordinates = None
self.properties = {}
self.coordinates(coordinates)
self.proper... | Acurus/PVDB | pnvdb/models/feature.py | Python | mit | 2,382 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
from the month of edge deletion, find the SR before, at the time and after
"""
from collections import defaultdict
import codecs
import os
import json
import numpy as np
from igraph import *
IN_DIR = "../../../DATA/General/"
os.chdir(IN_DIR)
F_IN = "mention/edge_form... | sanja7s/SR_Twitter | src_graph/edge_deletion_REL_ST.py | Python | mit | 14,039 |
#!/usr/bin/env python
'''
Main SpiderWho entrypoint
See ./SpiderWho.py -h for how to use
'''
import time
from helperThreads import ManagerThread
import datetime
import argparse
import config
import sys
import whoisThread
last_lookups = 0
def set_proc_name(newname):
try:
import setproctitle
setproc... | lanrat/SpiderWho | SpiderWho.py | Python | gpl-2.0 | 7,404 |
"""This module is for parsing and conversion functions that needs
objects from both music library and music service data structures
"""
from functools import lru_cache
import logging
from .data_structures import didl_class_to_soco_class
from .exceptions import DIDLMetadataError
from .xml import XML, ns_tag
_LOG = l... | SoCo/SoCo | soco/data_structures_entry.py | Python | mit | 1,686 |
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by ap... | kuke/models | fluid/PaddleCV/yolov3/models/yolov3.py | Python | apache-2.0 | 7,585 |
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# ------------------------------------------------------... | marmyshev/transitions | openlp/core/lib/htmlbuilder.py | Python | gpl-2.0 | 22,541 |
import pytest
from pyecore.ecore import *
from pyecore.utils import dispatch
def test_dispatch_dynamic_mm():
A = EClass('A')
B = EClass('B')
class SequenceSwitch(object):
def __init__(self):
self.sequence = []
@dispatch
def do_switch(self, o):
self.sequenc... | pyecore/pyecore | tests/test_dispatch.py | Python | bsd-3-clause | 4,826 |
# coding=utf-8
from plone.app.layout.globals.interfaces import IViewView
from Products.Archetypes.config import REFERENCE_CATALOG
from Products.Archetypes.public import DisplayList
from Products.CMFPlone.i18nl10n import ulocalized_time
from Products.CMFPlone.utils import _createObjectByType
from Products.CMFPlone.utils... | veroc/Bika-LIMS | bika/lims/browser/worksheet/views/results.py | Python | agpl-3.0 | 9,328 |
import os
from django.core.management import BaseCommand
from subprocess import call
__author__ = 'vikashdat'
"""
This command converts amr files to mp3 audio files.
"""
class Command(BaseCommand):
args = ''
help = ''
def convertAMRToMp3(self,(dirpath,filename)):
pathToAMR = os.path.join(dir... | NiJeLorg/follow-the-money | CashCity/management/commands/convert_uploaded_audio.py | Python | mit | 1,523 |
# Copyright (c) 2013, Frappe and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.website.website_generator import WebsiteGenerator
from frappe.utils import is_markdown, markdown, cint
from frappe.website.utils import get_comment_list
from... | adityahase/frappe | frappe/website/doctype/help_article/help_article.py | Python | mit | 3,288 |
# Copyright (c) 2011 OpenStack Foundation
# 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 ... | ntt-sic/nova | nova/scheduler/filters/compute_capabilities_filter.py | Python | apache-2.0 | 3,081 |
#-*- coding: utf-8 -*-
#
# Krzysztof „krzykwas” Kwaśniewski
# Gdańsk, 15-07-2012
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | krzykwas/rhqagent | pyagent/test/data/model/PastMeasurementsManagerTest.py | Python | gpl-3.0 | 3,503 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
from flexget.utils.log import log_once
log = logging.getLogger('urlfix')
class UrlFix(object):... | gazpachoking/Flexget | flexget/plugins/generic/urlfix.py | Python | mit | 895 |
diccionario={"agua":0, "fuego":0}
lista=[]
cd="true"
X=0
while cd=="true":
lista.append(input("introduce una oracion: "))
if "fuego" in diccionario:
X=X+1
elif "agua" in diccionario:
X=X+1
a=input("deseas salir del programa: ")
if a=="si" or a=="Si":
print("sa... | espinosa34/uip-iiig2016-prog3 | laboratorio/laboratorio 1/quiz 2.py | Python | mit | 451 |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
__version__ = "1.2.0.11"
| STIXProject/python-stix | stix/version.py | Python | bsd-3-clause | 130 |
from django.utils.translation import ugettext as _
from django.core.mail import send_mail
from django import forms
from django.conf import settings
import logging
log = logging.getLogger(__name__)
class ContactForm(forms.Form):
contact_name = forms.CharField(
label=_('Name'), max_length=100,
wid... | okfn/rtei | rtei/forms.py | Python | agpl-3.0 | 1,103 |
# coding=utf-8
""""
User Based Collaborative Filtering Recommender with Attributes (User Attribute KNN)
[Rating Prediction]
User-Attribute-kNN predicts a user’s rating according to how similar users rated the same item. The algorithm
matches similar users based on the similarity of their attributes sco... | ArthurFortes/CaseRecommender | caserec/recommenders/rating_prediction/user_attribute_knn.py | Python | mit | 6,702 |
#!/usr/bin/env python
# encoding: utf-8
"""Code to provide access to UltiSnips files from disk."""
from collections import defaultdict
import hashlib
import os
from UltiSnips import _vim
from UltiSnips import compatibility
from UltiSnips.snippet.source._base import SnippetSource
def _hash_file(path):
"""Returns... | rbastic/glowing-tyrion | dotvim/.vim/bundle/ultisnips/pythonx/UltiSnips/snippet/source/file/_base.py | Python | mit | 3,635 |
# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class VATReportWizard(models.TransientModel):
_inherit = "vat.report.wizard"
operating_unit_ids = fields.Many2many(
comodel_name="operating.unit",... | OCA/operating-unit | account_financial_report_operating_unit/wizards/vat_report_wizard.py | Python | agpl-3.0 | 504 |
# -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
#
# Copyright (C) 2012 He Jian <hejian.he@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2,... | ruud-v-a/rhythmbox | plugins/lyrics/JlyricParser.py | Python | gpl-2.0 | 2,517 |
from django.conf.urls import url
from .views import Index
urlpatterns = [
url(r'^$', Index.as_view(), name='index'),
]
| DBarthe/chatbox | mainapp/urls.py | Python | mit | 124 |
import base64
from unittest import TestCase
from unittest.mock import MagicMock, call, patch
from maxcube.commander import Commander
from maxcube.connection import Connection
from maxcube.deadline import Deadline, Timeout
from maxcube.message import Message
L_CMD = Message("l")
L_CMD_SUCCESS = Message("L")
S_CMD_HEX ... | goodfield/python-maxcube-api | tests/test_commander.py | Python | mit | 7,245 |
#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pixelated is distrib... | SamuelToh/pixelated-user-agent | service/pixelated/adapter/services/mail_service.py | Python | agpl-3.0 | 4,990 |
# cslist.py - embeddable changeset/patch list component
#
# Copyright 2009 Yuki KODAMA <endflow.net@gmail.com>
# Copyright 2010 David Wilhelm <dave@jumbledpile.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2, incorporated herein by reference.
impo... | gilshwartz/tortoisehg-caja | tortoisehg/hgqt/cslist.py | Python | gpl-2.0 | 6,670 |
#/usr/bin/python
# Author - Anu Mercian
# Problem Statement: You are provided with two files: One, which has a number of processes and the amount of memory required to run them. Two, which has a number of nodes and the amount of freely available memory. Design an algorithm to assign the different processes almost even... | anumercian/SampleCoding | ProcessDistributionAlgorithm.py | Python | gpl-2.0 | 4,373 |
# Resource object code (Python 3)
# Created by: object code
# Created by: The Resource Compiler for Qt version 5.15.2
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore
qt_resource_data = b"\
\x00\x00\x00h\
\x89\
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
\x00\x00 \x00\x00\x00 \x08\x0... | bdcht/amoco | amoco/ui/graphics/qt_/rc_icons.py | Python | gpl-2.0 | 478,751 |
#!/usr/local/bin/Python3
# Based on code created for Udacity Linear Algebra Refresher course
from copy import deepcopy
from vector import Vector
from hyperplane import Hyperplane
class LinearSystemHyper(object):
ALL_PLANES_MUST_BE_IN_SAME_DIM_MSG = ('All planes in the system should live in the same dimension')... | HKuz/Test_Code | LinearAlgebra/linsysHyper.py | Python | mit | 9,911 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.