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 |
|---|---|---|---|---|---|
"""Constructors for the blaze array object.
Having them as external functions allows to more flexibility and helps keeping
the blaze array object compact, just showing the interface of the
array itself.
The blaze array __init__ method should be considered private and for
advanced users only. It will provide the tools... | mwiebe/blaze | blaze/objects/constructors.py | Python | bsd-3-clause | 8,945 |
from SubProviders.OpenSubtitles import IOpenSubtitlesProvider
from SubProviders.OpenSubtitles.IOpenSubtitlesProvider import OPENSUBTITLES_LANGUAGES, OPENSUBTITLES_PAGES
class OpenSubtitlesProvider(IOpenSubtitlesProvider.IOpenSubtitlesProvider):
PROVIDER_NAME = 'Russian - www.opensubtitles.org'
def __ini... | yosi-dediashvili/SubiT | src/SubProviders/OpenSubtitles/rus_OpenSubtitlesProvider/OpenSubtitlesProvider.py | Python | gpl-3.0 | 543 |
from slippinj.emr.job_flow.arguments.instances import InstancesArgument
class TestInstancesArgument(object):
def test_parse_successfully_run(self):
configuration = {
'availability_zone': 'eu-west-1',
'ec2_key_name': 'my_key',
'keep_alive': True,
'termination... | scm-spain/slippin-jimmy | tests/slippinj/emr/job_flow/arguments/test_instances.py | Python | apache-2.0 | 2,113 |
def break_string_into_parts(s, l=1):
buffer = ''
for char in reversed(s):
buffer += char
if len(buffer) >= l:
yield buffer[::-1]
buffer = ''
yield buffer[::-1]
class Solution:
def licenseKeyFormatting(self, S: str, K: int) -> str:
S = S.upper().replace('... | 1337/yesterday-i-learned | leetcode/482.py | Python | gpl-3.0 | 476 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | eliasdesousa/indico | indico/modules/events/notes/models/notes.py | Python | gpl-3.0 | 9,055 |
# proxy module
from __future__ import absolute_import
from envisage.plugins.remote_editor.editor_plugins.editra.editra_plugin import *
| enthought/etsproxy | enthought/plugins/remote_editor/editor_plugins/editra/editra_plugin.py | Python | bsd-3-clause | 135 |
from . import hr_analytic_timesheet
from . import global_timesheet_state
from . import crm_lead_suivi_gdoc | nuxly/nuxly-odoo-addons | nuxly/models/__init__.py | Python | agpl-3.0 | 106 |
class LEDSquare:
def __init__(self, x1, y1, x2, y2, rgb, matrix):
self.x1 = x1
self.x2 = x2
self.y1 = y1
self.y2 = y2
self.rgb = rgb
self.matrix = matrix
self.matrix.obj_list += [self]
def draw(self):
self.matrix.fillRect(self.x1, self.y1, self.x2, self.y2, self.rgb)
def setX(self, x):
width = se... | jboullianne/LEDMatrix | LEDMatrix/LEDSquare.py | Python | gpl-2.0 | 786 |
#!/usr/bin/env python
################################################################################
# The Sandbox Libraries (Python) Distutil Script #
# #
# Copyright (C) 2004-2009, 2011, 2012 LIU Yu, pineapple... | vineethguna/heroku-buildpack-libsandbox | vendor/pysandbox-0.3.5/setup.py | Python | mit | 4,886 |
#!/usr/bin/env python
#
# test_multibytecodec_support.py
# Common Unittest Routines for CJK codecs
#
import codecs
import os
import re
import sys
import unittest
from httplib import HTTPException
from test import test_support
from StringIO import StringIO
class TestBase:
encoding = '' # codec name
... | bussiere/pypyjs | website/demo/home/rfk/repos/pypy/lib-python/2.7/test/test_multibytecodec_support.py | Python | mit | 14,533 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | srager13/ns3_qoi_symptotics | src/fd-net-device/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 311,170 |
class AlterTable:
""" Generates an SQL command to alter a table """
def __init__(self, table_name: str):
self._table_name = table_name
self._operations = []
def add_operation(self, operation):
self._operations.append(operation)
@property
def table_name(self) -> str:
... | cmancone/mygrations | mygrations/core/operations/alter_table.py | Python | mit | 731 |
import os
from six import string_types
import maya.cmds as cmds
from cmt.io.obj import import_obj, export_obj
import cmt.shortcuts as shortcuts
import cmt.deform.np_mesh as np_mesh
import cmt.rig.common as common
def get_blendshape_node(geometry):
"""Get the first blendshape node upstream from the given geometry... | chadmv/cmt | scripts/cmt/deform/blendshape.py | Python | mit | 7,474 |
# Copyright 2013 Canonical Ltd.
#
# Authors:
# Charm Helpers Developers <juju@lists.ubuntu.com>
"""A helper to create a yaml cache of config with namespaced relation data."""
import os
import yaml
import charmhelpers.core.hookenv
charm_dir = os.environ.get('CHARM_DIR', '')
def dict_keys_without_hyphens(a_dict):
... | mbirru/midonet-charms | midonet-zookeeper/hooks/charmhelpers/contrib/templating/contexts.py | Python | apache-2.0 | 4,507 |
import urllib
import httplib
import struct
from Crypto.Cipher import AES
import hashlib
import binascii
import json
from Crypto import Random
from django.conf import settings
def check_password(username,password):
p = {
'username': username,
'password': password,
}
params = urllib.urlencode... | luzi82/owatube | member/owtforum.py | Python | gpl-3.0 | 2,194 |
# coding: utf-8
from __future__ import unicode_literals
import itertools
import json
import re
from .common import InfoExtractor, SearchInfoExtractor
from ..compat import (
compat_urllib_parse,
compat_urlparse,
)
from ..utils import (
clean_html,
unescapeHTML,
ExtractorError,
int_or_none,
... | Buggaarde/youtube-dl | youtube_dl/extractor/yahoo.py | Python | unlicense | 13,867 |
"""
3-leg table
"""
from bliss.controllers.motor import CalcController
from bliss.controllers.motors.threelegtable.InvKin import invKin
from bliss.controllers.motors.threelegtable.FwdKin import fwdKin
from bliss.controllers.motors.threelegtable.Leg import Leg
import math
import numpy
class Sample(object):
pass
c... | tiagocoutinho/bliss | bliss/controllers/motors/tab3new.py | Python | lgpl-3.0 | 1,674 |
# This file is Public Domain and may be used without restrictions.
import _jpype
import jpype
from jpype.types import *
from jpype import java
import jpype.dbapi2 as dbapi2
import common
import time
try:
import zlib
except ImportError:
zlib = None
class SQLModuleTestCase(common.JPypeTestCase):
def setUp(... | Thrameos/jpype | test/jpypetest/test_sql_generic.py | Python | apache-2.0 | 4,356 |
# ----------------------------------------------------------------------
# Copyright (C) 2016, 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 program is free software: you can redistribute it and/or mo... | subutai/NAB | nab/detectors/numenta/numentaTM_detector.py | Python | agpl-3.0 | 2,714 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Models for user, blog, comment.
'''
import time, uuid
from orm import Model, StringField, BooleanField, FloatField, TextField
def next_id():
return '%015d%s000' % (int(time.time() * 1000), uuid.uuid4().hex)
class User(Model):
__table__ = 'users'
id = ... | bluethon/awesome-python3-webapp | www/models.py | Python | gpl-3.0 | 1,440 |
import json
import matplotlib.pyplot as plt
from matplotlib import font_manager, rc
from matplotlib import style
import func
font_name = font_manager.FontProperties(fname="c:/Windows/Fonts/malgun.ttf").get_name()
rc('font', family=font_name)
style.use('ggplot')
data = ''
classList = ''
with open('data.json',encoding=... | YuHyun7/IndustrialGeneral | graphShow.py/graphShow.py | Python | mit | 1,576 |
from itertools import chain
import django
if django.VERSION[0:2] >= (1, 8):
from django.db.backends.base.introspection import BaseDatabaseIntrospection
else:
from django.db.backends import BaseDatabaseIntrospection
from django_cassandra_engine.utils import get_installed_apps, get_cql_models
class CassandraD... | TargetHolding/django-cassandra-engine | django_cassandra_engine/base/introspection.py | Python | bsd-2-clause | 2,546 |
from openpyxl.reader.excel import load_workbook
from re import sub
from NLP5 import getDirectResourceUrl, databaseWrapper, getRedirectedResourceURL, isLocation, checkDisambiguates
__author__ = 'Andrei Mihai'
def isLocationBool(keyword):
locationString = keyword
locationString = locationString.replace("_"," "... | andpol5/QueryParsingForInlp | test.py | Python | mit | 2,135 |
#!/usr/bin/python
import os
import sys
import time
import glob
import trace
import tempfile
if '--dir' in sys.argv:
i = sys.argv.index('--dir')
dir = sys.argv[i+1]
else:
dir = None
if '--email' in sys.argv:
i = sys.argv.index('--email')
email = sys.argv[i+1]
else:
email = None
if '--nodoc' in... | conwayje/ase-python | tools/sphinx.py | Python | gpl-2.0 | 3,888 |
# -*- coding: utf-8 -*-
import ev3
import time
brick = ev3.connect_to_brick(address='10.0.1.1')
compass_sensor = ev3.HiTechnicCompass(brick, 1)
heading = compass_sensor.get_compass_mode()
for _ in range(0, 4):
time.sleep(2)
print heading.fetch_sample() | alexander-svendsen/ev3-python | examples/sensor/hitech/compass.py | Python | mit | 264 |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Yujin Robot
# 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 r... | CARMinesDouai/MultiRobotExplorationPackages | inria_demo/scripts/autodock_client.py | Python | mit | 3,861 |
#!/usr/bin/env python
#
# test_codecencodings_hk.py
# Codec encoding tests for HongKong encodings.
#
from test import support
from test import test_multibytecodec_support
import unittest
class Test_Big5HKSCS(test_multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'big5hkscs'
tstring = test_mult... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.1/Lib/test/test_codecencodings_hk.py | Python | mit | 800 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2014 Kitware 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 cop... | jcfr/girder | plugins/oauth/plugin_tests/oauth_test.py | Python | apache-2.0 | 9,423 |
# Copyright 2019 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | adarob/magenta | magenta/models/melody_rnn/melody_rnn_pipeline.py | Python | apache-2.0 | 3,517 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Pexego Sistemas Informáticos (<http://www.pexego.es>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it a... | iw3hxn/LibrERP | sale_commission/models/sale_line_agent.py | Python | agpl-3.0 | 2,836 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013, 2014 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... | zenodo/invenio | invenio/modules/deposit/filter_utils.py | Python | gpl-2.0 | 3,264 |
import urwid
class MenuButton(urwid.Button):
def __init__(self, caption, callback):
super(MenuButton, self).__init__("")
urwid.connect_signal(self, 'click', callback)
self._w = urwid.AttrMap(urwid.SelectableIcon(
[u' \N{BULLET} ', caption], 2), None, 'selected')
class SubMenu(... | uccgit/the-game | test/hmenu.py | Python | gpl-2.0 | 2,735 |
# SPDX-License-Identifier: LGPL-3.0-only
"""Configuration file for sniffer."""
# pylint: disable=superfluous-parens,bad-continuation
import time
import subprocess
from sniffer.api import select_runnable, file_validator, runnable
try:
from pync import Notifier
except ImportError:
notify = None
else:
notif... | jacebrowning/doorstop | scent.py | Python | lgpl-3.0 | 2,412 |
"""
You are a professional robber planning to rob houses along a street. Each
house has a certain amount of money stashed, the only constraint stopping you
from robbing each of them is that adjacent houses have security system
connected and it will automatically contact the police if two adjacent houses
were broken int... | JiaminXuan/leetcode-python | house_robber/solution.py | Python | bsd-2-clause | 1,018 |
# This a large test that goes through the translation of the bvlc caffenet
# model, runs an example through the whole model, and verifies numerically
# that all the results look right. In default, it is disabled unless you
# explicitly want to run it.
from caffe2.proto import caffe2_pb2
from caffe.proto import caffe_p... | bwasti/caffe2 | caffe2/python/caffe_translator_test.py | Python | apache-2.0 | 2,791 |
# This file is part of PyImgur.
# PyImgur 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.
# PyImgur is distributed in the hope that i... | Damgaard/PyImgur | pyimgur/test/user_test.py | Python | gpl-3.0 | 2,652 |
def printArthmeticOperationalValues(a,b):
print(a+b)
print(a-b)
print(a*b)
if __name__ == '__main__':
a = int(input())
b = int(input())
printArthmeticOperationalValues(a,b)
| pk-hackerrank/python | introduction/arithmetic_operators.py | Python | mit | 197 |
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license
"""
Implementation for of the configuration object.
"""
import os,time,socket,sys
from data import *
import base_classes... | Neohapsis/mptcp-abuse | scapy/config.py | Python | gpl-2.0 | 13,056 |
#!/usr/bin/python
# Copyright (C) 2006-2007 The Open Planning Project
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
... | socialplanning/TaskTracker | tasktracker/tests/load/bench.py | Python | gpl-2.0 | 5,884 |
# Symbolic feature extraction from sequences of notes
# WARNING: sort your note sequences according to onset time before using these
# functions!
import numpy
def range(sequence):
"""Returns the note rance in a tuplet (min_note, max_note)"""
if len(sequence) == 0:
return (0, 0)
min_pitch = 999
... | pymir3/pymir3 | mir3/lib/mir/midifeatures.py | Python | mit | 7,982 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/mpls/lsps/static_lsps/__init__.py | Python | apache-2.0 | 13,426 |
import sqlite3, os, time
from datetime import datetime
from subprocess import check_output
def ftime2ts(ftime='now'): #'%Y-%m-%d %H:%M:%S' to timestamp
if ftime == 'now':
ftime = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime())
ptime = time.strptime(ftime, '%Y-%m-%d %H:%M:%S')
return int(time.mkt... | pwwang/pwPHP | drivers/cmdQueue/cqUtils.py | Python | mit | 926 |
# 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, software
# distributed under ... | jamielennox/requests-mock | requests_mock/compat.py | Python | apache-2.0 | 992 |
# -- coding: utf-8 --
# ===========================================================================
# eXe
# Copyright 2013, Pedro Peña Pérez, Open Phoenix IT
#
# 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 Softwar... | tquilian/exelearningTest | tools/tinymceI18nMerge.py | Python | gpl-2.0 | 3,107 |
#!/usr/bin/env python
import os
import simplejson as json
from argparse import ArgumentParser
from datetime import datetime
import time
from pprint import pprint
import numpy as np
from tools import diff_last, cost_val, load_kind, label_kind, MAX_WASTE, MAX_COST, \
outter_reproccessed
CAT_LABEL = "{0}\n{1}"
de... | cyclus/cyc3d | data_alltimes.py | Python | bsd-3-clause | 1,336 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
# PyQt4 includes for python bindings to QT
from PyQt4.QtGui import QGridLayout
from opus_gui.util.pythongui import OpusPythonShell
# Main console class for the python console
class ConsoleBase(obje... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/opus_gui/util/consolebase.py | Python | gpl-2.0 | 783 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-12-31 23:46
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('busshaming', '0015_feed_last_processed_dump'),
]
operations = [
migrations.... | katharosada/bus-shaming | busshaming/migrations/0016_tripdate_added_from_realtime.py | Python | mit | 476 |
# coding: utf-8
# Standard Libraries
import logging
import re
# Third Party Libraries
from cfgtree import LOGGER_NAME
log = logging.getLogger(LOGGER_NAME)
# tells flake8 to ignore complexity check for this file
# flake8: noqa
def get_node_by_xpath(mapping, xpath, default=None, ignore_errors=False,
... | Stibbons/dopplerr | cfgtree/dictxpath.py | Python | mit | 5,244 |
# MacroIP_ICMP is part of MacroIP Core. Provides Access to ICMP traffic through simple
# textual macros.
# Copyright (C) 2014 Nicola Cimmino
#
# 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 Foun... | nicolacimmino/LoP-RAN | LoPAccessPoint/MacroIP_ICMP.py | Python | gpl-3.0 | 3,055 |
# Copyright 2016, 2021 John Rofrano. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | nyu-devops/lab-flask-tdd | service/models.py | Python | apache-2.0 | 7,648 |
"""
Vimeo Tag
---------
This implements a Liquid-style vimeo tag for Pelican,
based on the youtube tag which is in turn based on
the jekyll / octopress youtube tag [1]_
Syntax
------
{% vimeo id [width height] %}
Example
-------
{% vimeo 10739054 640 480 %}
Output
------
<div style="width:640px; height:480px;"><ifra... | ioos/system-test | pelican-plugins/liquid_tags/vimeo.py | Python | unlicense | 1,771 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Medias locator
==============
Medias locator returns a path on the file system from the *src* of an img tag.
.. data:: PLACEHOLDER
A special object that indicates to the renderer to use a placeholder
instead of a media.
"""
from __future__ import absolute_i... | cecedille1/PDF_generator | pdf_generator/medias.py | Python | mit | 948 |
"""Creates and logs charts introspecting models built with scikit-learn to W&B."""
from .shared import (
summary_metrics as plot_summary_metrics,
learning_curve as plot_learning_curve,
)
from .classifier import (
classifier as plot_classifier,
feature_importances as plot_feature_importances,
class_... | wandb/client | wandb/sklearn/plot/__init__.py | Python | mit | 1,292 |
# -*- coding: utf-8 -*-
from copy import copy
from datetime import datetime
from itertools import chain
from django.utils.six import string_types
import re
from classytags.values import StringValue
from django.db.models import Model
from cms.utils.urlutils import admin_reverse
from django import template
from django.c... | DylannCordel/django-cms | cms/templatetags/cms_tags.py | Python | bsd-3-clause | 48,757 |
# Copyright 2015, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | JPO1/python-docs-samples | tests/__init__.py | Python | apache-2.0 | 789 |
# coding: utf-8
#
# Copyright 2018 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 requi... | oppia/oppia | core/domain/skill_fetchers.py | Python | apache-2.0 | 10,043 |
"""
Implementation of abstraction layer for other parts of the system to make queries related to ID Verification.
"""
import logging
from datetime import timedelta
from itertools import chain
from urllib.parse import quote
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from dja... | eduNEXT/edx-platform | lms/djangoapps/verify_student/services.py | Python | agpl-3.0 | 10,160 |
# -*- coding: utf-8 -*-
#
# repeated_stimulation.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 Li... | weidel-p/nest-simulator | pynest/examples/repeated_stimulation.py | Python | gpl-2.0 | 4,210 |
from django.db import models
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel
from wagtail.wagtailcore.fields import RichTextField
from wagtail.contrib.settings.models import BaseSetting
from wagtail.contrib.settings.registry import register_setting
from wagtail.wagtailsnipp... | bruecksen/impacts-world | impacts_world/core/models.py | Python | mit | 3,189 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | google/gnxi | oc_config_validate/oc_config_validate/models/types.py | Python | apache-2.0 | 3,293 |
#!/usr/bin/env python -t
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Jonathan Delvaux <pyshell@djoproject.net>
# 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... | djoproject/pyshell | pyshell/register/profile/command.py | Python | gpl-3.0 | 5,109 |
#!/usr/bin/env python
# Create a N node line connected by a series of CSMA networks. Enable
# IP forwarding, run OSPFv2 for routing, and launch xterms for shell
# access to all nodes.
from netns3 import *
import os
import subprocess
# these are the default ubuntu/debian paths
QUAGGA_CONF = "/etc/quagga"
QUAGGA_RUN ... | hbhzwj/imalse | tools/netns3/examples/csma-line-quagga.py | Python | gpl-3.0 | 3,106 |
#!/usr/bin/python
#
# time2.py
#
# Fig. 7.7:
# Class Time with accessor methods.
#
# Author: Billy Wilson Arante
# Created: 2016/09/09 EDT (America/New York)
#
# Attribution: Python How to Program, 1st Ed. by Deitel & Deitel
#
class Time:
"""Time
Class Time with accessor methods.
"""
def __init__(se... | arantebillywilson/python-snippets | py2/htp/ch07/time2.py | Python | mit | 2,194 |
import argparse
import csv
import json
import re
MANUFACTURER = {
"A": "American Home Food Products",
"G": "General Mills",
"K": "Kellogs",
"N": "Nabisco",
"P": "Post",
"Q": "Quaker Oats",
"R": "Ralston Purina",
}
NORMAL_FIELDS = [
"calories",
"protein",
"fat",
"sodium"... | kyleconroy/dataflakes | etl/etl.py | Python | mit | 2,694 |
from setuptools import setup, find_packages
setup(name='BIOMD0000000056',
version=20140916,
description='BIOMD0000000056 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/BIOMD0000000056',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/BIOMD0000000056 | setup.py | Python | cc0-1.0 | 377 |
import _plotly_utils.basevalidators
class HovertextsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="hovertextsrc", parent_name="heatmap", **kwargs):
super(HovertextsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name... | plotly/plotly.py | packages/python/plotly/plotly/validators/heatmap/_hovertextsrc.py | Python | mit | 408 |
# -*- coding: utf-8 -*-
# Copyright 2022 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-aiplatform | google/cloud/aiplatform_v1/services/index_endpoint_service/transports/base.py | Python | apache-2.0 | 9,451 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-10-02 09:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hkm', '0024_hkm_museum_user'),
]
operations = [
migrations.AddField(
... | andersinno/kuvaselaamo | hkm/migrations/0025_userprofile_printer_presets.py | Python | mit | 657 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-25 02:07
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('account', '0008_auto_20170923_1655'),
('vpc', '0010... | hyperwd/hwcram | vpc/migrations/0011_createip.py | Python | mit | 1,985 |
from emailhooks.settings import *
# Add a secret:
SECRET_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
| DeMille/emailhooks | settings.example.py | Python | mit | 103 |
"""!
@brief Examples of usage and demonstration of abilities of Elbow method.
@authors Andrey Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
import matplotlib.pyplot as plt
from pyclustering.cluster.center_initializer import kmeans_plusplus_initializer, random_center_ini... | annoviko/pyclustering | pyclustering/cluster/examples/elbow_examples.py | Python | gpl-3.0 | 3,405 |
import requests
import re
import traceback
import feedparser
import time
import urllib.request, urllib.error, urllib.parse
import http.client
import zlib
from django.contrib.sites.models import Site
from django.utils.encoding import smart_bytes
from mongoengine.queryset import NotUniqueError
from socket import error as... | samuelclay/NewsBlur | apps/rss_feeds/page_importer.py | Python | mit | 14,431 |
import unittest
from r2dto.fields import StringField
from r2dto import Serializer
class BaseSerializerTests(unittest.TestCase):
def test_metaclass_creation(self):
class ObjSerializer(Serializer):
string_field = StringField(name="stringField", required=True, allow_null=False)
for fiel... | nickswebsite/r2dto | tests/test_base_serializer.py | Python | unlicense | 2,617 |
# -*- coding: utf-8 -*-
#
# graph-tool documentation build configuration file, created by
# sphinx-quickstart on Sun Oct 26 18:29:16 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pick... | profgiuseppe/graph-tool-tests | doc/conf.py | Python | gpl-3.0 | 7,468 |
def fib(n): # return Fibonacci series up to n from: https://docs.python.org/2/tutorial/controlflow.html
"""Return a list containing the Fibonacci series up to n."""
result = []
a, b = 0, 1
while a < n:
result.append(a)
a, b = b, a+b
return result
def fibonacci(n):
fib = [0, 1]
... | Deepak345/al-go-rithms | math/fibonacci/python/fibonacci.py | Python | mit | 434 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/operationsmanagement/azure-mgmt-operationsmanagement/azure/mgmt/operationsmanagement/aio/_operations_management_client.py | Python | mit | 4,274 |
"""Test calculate module"""
from chanjo.store.models import Sample
def test_mean(populated_db):
"""Test for calculating mean coverage"""
# GIVEN a database loaded with 2 samples
assert Sample.query.count() == 2
# WHEN calculating mean values across metrics
query = populated_db.mean()
# THEN t... | robinandeer/chanjo | tests/test_calculate.py | Python | mit | 2,295 |
import os
from setuptools import setup, find_packages
__here__ = os.path.dirname(os.path.abspath(__file__))
package_info = {k: None for k in ["RELEASE", "COMMIT", "VERSION", "NAME"]}
for name in package_info:
with open(os.path.join(__here__, "insights", name)) as f:
package_info[name] = f.read().strip()
... | PaulWay/insights-core | setup.py | Python | apache-2.0 | 1,837 |
from __future__ import absolute_import
import responses
import six
from sentry.utils.compat.mock import patch
from exam import fixture
from django.test import RequestFactory
from sentry.integrations.github.integration import GitHubIntegration
from sentry.models import Integration, ExternalIssue
from sentry.testutils... | beeftornado/sentry | tests/sentry/integrations/github/test_issues.py | Python | bsd-3-clause | 13,578 |
"""
Django settings for app project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import... | openhistorymap/tiffany | app/settings.py | Python | mit | 2,033 |
# Copyright 2016 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | informatik-mannheim/Moduro-CC3D | Simulation/Core/ExecConfig.py | Python | apache-2.0 | 9,823 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from base64 import b32encode
import os
import subprocess
from Cryptodome.Random import random
import gnupg
from gnupg._util import _is_stream, _make_binary_stream
import scrypt
import config
import store
# to fix gpg error #78 on production
os.environ['USERNAME'] = 'www... | garrettr/securedrop | securedrop/crypto_util.py | Python | agpl-3.0 | 6,840 |
from django.db import connection
import logging
from django.utils.deprecation import MiddlewareMixin
logger = logging.getLogger(__name__)
class QueryCountDebugMiddleware(MiddlewareMixin):
def process_response(self, request, response):
if response.status_code == 200:
total_time = 0
... | Harvard-ATG/media_management_api | media_management_api/middleware.py | Python | bsd-3-clause | 1,232 |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... | liosha2007/temporary-groupdocs-python3-sdk | groupdocs/models/AddDocumentQuestionnaireResult.py | Python | apache-2.0 | 1,186 |
#-*- coding: utf-8 -*-
#
# Copyright (C) 2005-2010 TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# P... | solus-project/package-management | pisi/actionsapi/shelltools.py | Python | gpl-2.0 | 9,041 |
#! /usr/bin/env python
""" Utility program to try to gently line wrap preformatted text inside an XML tag
"""
import sys, string
import codecs
def wrapElementLines(wrap=72,src=sys.stdin, dst=sys.stdout, srcenc='iso8859', dstenc='utf-8', elem='screen'):
# Tell python how to encode the output (generally utf-8)
... | jamie-dryad/dryad-repo | dspace/docs/wrapscreen.py | Python | bsd-3-clause | 1,981 |
from rich.console import Console
from rich.markdown import Markdown
from rich.syntax import Syntax
def process_syntax(code, lang, theme, line_numbers, code_width, word_wrap):
syntax = Syntax(
code,
lang,
theme=theme,
line_numbers=line_numbers,
code_width=code_width,
... | seleniumbase/SeleniumBase | seleniumbase/console_scripts/rich_helper.py | Python | mit | 1,219 |
from dxr.testing import SingleFileTestCase, MINIMAL_MAIN
class TypedefTests(SingleFileTestCase):
source = r"""
typedef int MyTypedef;
void my_typedef_function(MyTypedef) {
}
""" + MINIMAL_MAIN
def test_typedefs(self):
self.found_line_eq('+type:MyTypedef',
... | srenatus/dxr | tests/test_typedefs.py | Python | mit | 493 |
from objp.util import pyref
from cocoa.inter import PyGUIObject, GUIObjectView
from core.gui.prioritize_dialog import PrioritizeDialog
class PrioritizeDialogView(GUIObjectView):
pass
class PyPrioritizeDialog(PyGUIObject):
def __init__(self, app: pyref):
model = PrioritizeDialog(app.model)
PyGU... | stuckj/dupeguru | cocoa/inter/prioritize_dialog.py | Python | gpl-3.0 | 836 |
from recoDataStructure import *
class DataReceiver:
"""This class helps us to read data into the program.
During the training stage, it can read data from file
and during recognition stage, it can get real time tracking data and
pass it to the Feature Extraction module."""
def __init__(... | Weiya-CF/reco_gesture | dataAcquisition.py | Python | mit | 4,190 |
"""Tools"""
| all-of-us/raw-data-repository | rdr_service/tools/__init__.py | Python | bsd-3-clause | 12 |
from odoo import models, fields
class ResPartner(models.Model):
_name = 'res.partner'
_inherit = ['res.partner', 'l10n.es.mod190.additional.data.mixin']
include_on_aeat_mod190 = fields.Boolean(
string='Included in mod190',
oldname='incluir_190',
default=False
)
| factorlibre/l10n-spain | l10n_es_aeat_mod190/models/res_partner.py | Python | agpl-3.0 | 306 |
import math
def clamp(v, minvalue=0, maxvalue=1):
return max(minvalue, min(v, maxvalue))
def clamp_array(v, minvalue=0, maxvalue=1):
return [clamp(v[i], minvalue, maxvalue) for i in range(len(v))]
def magnitude(v):
return math.sqrt(sum(v[i] * v[i] for i in range(len(v))))
def normalize(v):
vmag ... | rocktavious/pyul | pyul/mathUtils.py | Python | mit | 629 |
#!/usr/bin/env python
"""
@file getHourlyMatrix.py
@author Yun-Pang Wang
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2008-08-20
@version $Id: matrixDailyToHourly.py 13811 2013-05-01 20:31:43Z behrisch $
This script is to generate hourly matrices from a VISUM daily matrix.
The taffic demand of th... | rudhir-upretee/Sumo17_With_Netsim | tools/assign/matrixDailyToHourly.py | Python | gpl-3.0 | 11,132 |
import tempfile
from pygmin.landscape import DoubleEndedConnect, DoubleEndedConnectPar
from pygmin import basinhopping
from pygmin.storage import Database
from pygmin.takestep import RandomDisplacement, AdaptiveStepsizeTemperature
from pygmin.utils.xyz import write_xyz
from pygmin.optimize import mylbfgs
from pygmin.t... | js850/PyGMIN | pygmin/systems/basesystem.py | Python | gpl-3.0 | 16,801 |
##############################################################################
#
# Copyright (c) 2008-2010 SIA "KN dati". (http://kndati.lv) All Rights Reserved.
# General contacts <info@kndati.lv>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the who... | cherrygirl/micronaet7 | dentist/report/parser.py | Python | agpl-3.0 | 4,199 |
# -*- coding: utf-8 -*-
# Copyright 2006 - 2012 Philipp Wollermann
#
# 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 app... | philwo/pysk | pysk/vps/admin.py | Python | apache-2.0 | 5,594 |
import pygal
from die import Die
die_1 = Die()
die_2 = Die()
results = []
for roll_num in range(1000):
result = die_1.roll() + die_2.roll()
results.append(result)
frequencies = []
max_result = die_1.num_sides + die_2.num_sides
for value in range(2, max_result + 1):
frequency = results.count(value)
... | timtian090/Playground | Python/visualization/die_visual.py | Python | mit | 633 |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# 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... | UManPychron/pychron | pychron/canvas/canvas2D/extraction_line_canvas2D.py | Python | apache-2.0 | 10,949 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import threading
fro... | landism/pants | src/python/pants/pantsd/service/pants_service.py | Python | apache-2.0 | 1,471 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.