text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: ISO-8859-15 -*-
#
# Copyright (C) 2005-2007 David Guerizec <david@guerizec.net>
#
# Last modified: 2006 Sep 02, 01:40:01 by david
#
# 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... | OutOfOrder/sshproxy | lib/console_extra/__init__.py | Python | gpl-2.0 | 1,214 | 0.001647 |
import sys
import pytest
py3 = sys.version_info[0] >= 3
class DummyCollector(pytest.collect.File):
def collect(self):
return []
def pytest_pycollect_makemodule(path, parent):
bn = path.basename
if "py3" in bn and not py3 or ("py2" in bn and py3):
return DummyCollector(path, parent=pare... | paulrouget/servo | tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/conftest.py | Python | mpl-2.0 | 324 | 0 |
"""
Tests that skipped rows are properly handled during
parsing for all of the parsers defined in parsers.py
"""
from datetime import datetime
from io import StringIO
import numpy as np
import pytest
from pandas.errors import EmptyDataError
from pandas import (
DataFrame,
Index,
)
import pandas._testing as ... | pandas-dev/pandas | pandas/tests/io/parser/test_skiprows.py | Python | bsd-3-clause | 7,845 | 0.001147 |
#
# Copyright (c) 2012 Citrix Systems, 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 2 of the License, or
# (at your option) any later version.
#
# This program is dist... | OpenXT/sync-database | sync_db/run_script.py | Python | gpl-2.0 | 2,130 | 0.002347 |
#!/usr/bin/env python
#
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr
import pmt
def make_lengthtags(lengths, offsets, tagname='length', vlen=1):
tags = []
assert(len(offsets) == len(lengths))
f... | dl1ksv/gnuradio | gnuradio-runtime/python/gnuradio/gr/packet_utils.py | Python | gpl-3.0 | 4,116 | 0.000243 |
'''
Project: Farnsworth
Author: Karandeep Singh Nagra
'''
from django.contrib.auth.models import User, Group, Permission
from django.core.urlresolvers import reverse
from django.db import models
from base.models import UserProfile
class Thread(models.Model):
'''
The Thread model. Used to group messages.
... | knagra/farnsworth | threads/models.py | Python | bsd-2-clause | 3,639 | 0.002473 |
# coding: utf-8
# # L1 - Градиентый спуск и линейные модели
# In[1]:
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy.optimize import minimize
import math
get_ipython().magic('matplotlib notebook')
matplotlib.rcParams['figure.figsize'] = '12,8'
... | mryab/askme | labs/L1 - Gradient descent and linear models.py | Python | mit | 32,558 | 0.00386 |
class TriangleMaking:
def maxPerimeter(self, a, b, c):
first = a
second = b
third = c
sides = [first, second, third]
for idx, side in enumerate(sides):
one = (idx + 1) % 3
two = (idx + 2) % 3
total = sides[one] + sides[two]
... | mikefeneley/topcoder | src/SRM-697/triangle_making.py | Python | mit | 423 | 0.002364 |
# -*- coding: utf-8 -*-
"""Factories to help in tests."""
from factory import PostGenerationMethodCall, Sequence
from factory.alchemy import SQLAlchemyModelFactory
from chamberlain.database import db
from chamberlain.user.models import User
class BaseFactory(SQLAlchemyModelFactory):
"""Base factory."""
clas... | sean-abbott/chamberlain | tests/factories.py | Python | bsd-3-clause | 769 | 0 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "juisapp.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| snirp/juis | manage.py | Python | mit | 250 | 0 |
# Copyright 2019 Objectif Libre
#
# 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 agr... | stackforge/cloudkitty | cloudkitty/api/v2/scope/state.py | Python | apache-2.0 | 4,899 | 0 |
import frrtest
import pytest
if 'S["SCRIPTING_TRUE"]=""\n' not in open("../config.status").readlines():
class TestFrrlua:
@pytest.mark.skipif(True, reason="Test unsupported")
def test_exit_cleanly(self):
pass
else:
class TestFrrlua(frrtest.TestMultiOut):
program = "./test_f... | freerangerouting/frr | tests/lib/test_frrlua.py | Python | gpl-2.0 | 358 | 0 |
# pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
# Smartsheet Python SDK.
#
# Copyright 2018 Smartsheet.com, 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.... | smartsheet-platform/smartsheet-python-sdk | smartsheet/models/alternate_email.py | Python | apache-2.0 | 2,281 | 0 |
# Example for script that connects to PV,
# writes a value, then disconnects from the PV.
#
# This is usually a bad idea.
# It's better to have widgets connect to PVs,
# 1) More efficient. Widget connects once on start, then remains connected.
# Widget subscribes to PV updates instead of polling its value.
# 2) Widg... | ESSICS/org.csstudio.display.builder | org.csstudio.display.builder.model/examples/script_util/write_any_pv.py | Python | epl-1.0 | 855 | 0.003509 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from os.path import exists as path_exists
from pyscaffold.api import create_project
from pyscaffold.cli import run
from pyscaffold.extensions import travis
def test_create_project_with_travis(tmpfolder):
# Given options with the travis extension,
opts ... | cpaulik/pyscaffold | tests/extensions/test_travis.py | Python | mit | 1,578 | 0 |
#!/usr/bin/env python
from __future__ import unicode_literals
import io
import optparse
import os
import sys
# Import youtube_dl
ROOT_DIR = os.path.join(os.path.dirname(__file__), '..')
sys.path.insert(0, ROOT_DIR)
import youtube_dl
def main():
parser = optparse.OptionParser(usage='%prog OUTFILE.md')
optio... | MarkTheF4rth/youtube-dl | devscripts/make_supportedsites.py | Python | unlicense | 1,152 | 0.001736 |
"""Write initial TrueGrid files for one biplane blade station.
Usage
-----
start an IPython (qt)console with the pylab flag:
$ ipython qtconsole --pylab
or
$ ipython --pylab
Then, from the prompt, run this script:
|> %run biplane_blade_lib/prep_stnXX_mesh.py
or
|> import biplane_blade_lib/prep_stnXX_mesh
... | perryjohnson/biplaneblade | biplane_blade_lib/prep_stn18_mesh.py | Python | gpl-3.0 | 30,755 | 0.006763 |
#!/usr/bin/env python
import sys
import math
def main():
if len(sys.argv) != 3:
print('USAGE: ' + sys.argv[0] + ' <filename> ' + ' <boundary id of interest>')
return
targetString = 'Moment coefficient for body[' + sys.argv[2]
targetTimestep = ': \n'
filename = sys.argv[1]
t... | ngcurrier/ProteusCFD | tools/extractCM.py | Python | gpl-3.0 | 990 | 0.009091 |
from django.contrib.localflavor.it.forms import (ITZipCodeField, ITRegionSelect,
ITSocialSecurityNumberField, ITVatNumberField)
from django.test import SimpleTestCase
class ITLocalFlavorTests(SimpleTestCase):
def test_ITRegionSelect(self):
f = ITRegionSelect()
out = u'''<select name="regions"... | mixman/djangodev | tests/regressiontests/localflavor/it/tests.py | Python | bsd-3-clause | 2,453 | 0.000815 |
#!/usr/bin/env python
#
# MCP320x
#
# Author: Maurik Holtrop
#
# This module interfaces with the MCP300x or MCP320x family of chips. These
# are 10-bit and 12-bit ADCs respectively. The x number indicates the number
# of multiplexed analog inputs: 2 (MCP3202), 4 (MCP3204) or 8 (MCP3208)
# Communications with this chi... | mholtrop/Phys605 | Python/DevLib/MCP320x.py | Python | gpl-3.0 | 11,971 | 0.002423 |
# This file is only necessary for the tests to work | nathangeffen/tbonline-old | tbonlineproject/external/filebrowser/models.py | Python | mit | 51 | 0.019608 |
# -*- coding: utf-8 -*-
# Taboot - Client utility for performing deployments with Func.
# Copyright © 2009, 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 3 of th... | abutcher/Taboot | taboot-func/__init__.py | Python | gpl-3.0 | 851 | 0 |
# -*- coding: utf-8 -*-
from pytdx.hq import TdxHq_API
from fooltrader.api import technical
from fooltrader.contract.data_contract import KDATA_COLUMN_SINA
from fooltrader.utils.utils import get_exchange
def get_tdx_kdata(security_item, start, end):
api = TdxHq_API()
with api.connect():
# open close... | foolcage/fooltrader | fooltrader/datasource/tdx.py | Python | mit | 854 | 0.004684 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-24 20:36
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... | moniquehw/quoterizer | quotes/migrations/0001_initial.py | Python | gpl-3.0 | 1,134 | 0.002646 |
def extractMkkbunkotoikemenWordpressCom(item):
'''
Parser for 'mkkbunkotoikemen.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translate... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractMkkbunkotoikemenWordpressCom.py | Python | bsd-3-clause | 565 | 0.033628 |
import os
from concourse_common import jsonutil
def post_successful_tests(filepath, payload, sc, total_string):
sc.api_call("chat.postMessage", as_user=True,
channel=jsonutil.get_params_value(payload, "channel"),
attachments=[{"fallback": "Test Results",
... | cosee-concourse/slack-upload-resource | opt/resource/slack_post.py | Python | mit | 3,302 | 0.004543 |
#
# This file is part of HEPData.
# Copyright (C) 2016 CERN.
#
# HEPData 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.
#
# HEPData is... | HEPData/hepdata | hepdata/modules/search/webpack.py | Python | gpl-2.0 | 1,105 | 0 |
# The following parse_* methods are from bitcoin-abe
import base58
def parse_TxIn(vds):
d = {}
d['prevout_hash'] = vds.read_bytes(32)
d['prevout_n'] = vds.read_uint32()
d['scriptSig'] = vds.read_bytes(vds.read_compact_size())
d['sequence'] = vds.read_uint32()
return d
def parse_TxOut(vds):
d = {}
d['... | thandal/passe-partout | pp/pp_parse.py | Python | mit | 1,809 | 0.028192 |
import pytest
import unittest.mock as mock
import open_cp.network as network
import open_cp.data
import numpy as np
import datetime
def test_PlanarGraphBuilder():
b = network.PlanarGraphBuilder()
assert b.add_vertex(0.2, 0.5) == 0
b.set_vertex(5, 1, 2)
b.add_edge(0, 5)
g = b.build()
assert g.... | QuantCrimAtLeeds/PredictCode | tests/network_test.py | Python | artistic-2.0 | 25,390 | 0.037968 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
version = (0, "5d")
__title__ = "Elevator"
__author__ = "Oleiade"
__license__ = "MIT"
__version__ = '.'.join(map(str, version))
| oleiade/Elevator | elevator/__init__.py | Python | mit | 177 | 0 |
import inspect
import itertools
import types
import unittest
from tempfile import NamedTemporaryFile
from tests.test_bears.AllKindsOfSettingsDependentBear import (
AllKindsOfSettingsDependentBear)
from coala_quickstart.generation.Utilities import (
contained_in,
get_hashbang,
get_default_args, get_all... | coala-analyzer/coala-quickstart | tests/generation/UtilitiesTest.py | Python | agpl-3.0 | 11,382 | 0.000088 |
"""
timer.py: Request timer statistical tool
Code adapted from Bottle documentation
Copyright 2014-2015, Outernet Inc.
Some rights reserved.
This software is free software licensed under the terms of GPLv3. See COPYING
file that comes with the source code, or http://www.gnu.org/licenses/gpl.txt.
"""
from __future__... | karanisverma/feature_langpop | librarian/utils/timer.py | Python | gpl-3.0 | 1,356 | 0 |
from django.shortcuts import render, resolve_url
from django.contrib.auth.decorators import login_required
from gui.decorators import profile_required
from gui.utils import collect_view_data
from gui.signals import view_faq
from api.decorators import setting_required
@login_required
@profile_required
def api(request... | erigones/esdc-ce | gui/docs/views.py | Python | apache-2.0 | 1,344 | 0.000744 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-30 00:07
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import wagtail.wagtailcore.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0010_change... | Ecotrust/F2S-MOI | moi/recommendations/migrations/0002_auto_20151230_0007.py | Python | apache-2.0 | 1,297 | 0.002313 |
"""
To use this, create a settings.py file and make these variables:
TOKEN=<oath token for github>
ORG=<your org in github>
DEST=<Path to download to>
"""
from github import Github
from subprocess import call
import os
from settings import TOKEN, ORG, DEST
def download():
"""Quick and Dirty Download all repos funct... | sqor/3rdeye | fetch_repos.py | Python | mit | 789 | 0.032953 |
def count_factor(n, factor=0):
for i in range(1, int(n**0.5)+1):
if n % i == 0:
factor += 2
return factor
def nth_triangular_number(n):
return int(n+(n*(n-1))/2)
def find_triangular_number_over(k, n=0):
while count_factor(nth_triangular_number(n)) <= k:
n += 1
return nt... | higee/project_euler | 11-20/12.py | Python | mit | 439 | 0.009112 |
# Globals for the directions
# Change the values as you see fit
EAST = None
NORTH = None
WEST = None
SOUTH = None
class Robot:
def __init__(self, direction=NORTH, x_pos=0, y_pos=0):
pass
| jmluy/xpython | exercises/practice/robot-simulator/robot_simulator.py | Python | mit | 201 | 0 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="color", parent_name="scatter.unselected.textfont", **kwargs
):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | plotly/python-api | packages/python/plotly/plotly/validators/scatter/unselected/textfont/_color.py | Python | mit | 470 | 0.002128 |
"""
Document class definition
"""
class Document(object):
"""Represents a document"""
def __init__(self, id, name, type, path):
if '\n' in name:
raise ValueError('The document name cannot contain newline character!')
if '\n' in type:
raise ValueError('The document type... | piller-imre/grimoire-tk | grimoire/document.py | Python | gpl-3.0 | 806 | 0.003722 |
#!/usr/bin/env python
"""
For a given vdi and import file this script will import a VDI on to a XS host.
This script needs to be run whenever you want to restore a VDI to a previous
version.
example: python cbt_import_whole_vdi.py -ip <host address> -u <host username>
-p <host password> -v <vdi uuid> -f <impo... | xenserver/xs-cbt-samples | cbt_import_whole_vdi.py | Python | bsd-3-clause | 2,718 | 0.000368 |
# Copyright 2017 Mycroft AI 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 writin... | forslund/mycroft-core | mycroft/util/log.py | Python | apache-2.0 | 4,287 | 0 |
# 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/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/_configuration.py | Python | mit | 3,315 | 0.004223 |
from docar import Document, Collection
from docar import fields
from docar.backends.http import HttpBackendManager
from libthirty.state import uri, app_uri, service_uri, resource_collection_uri
from libthirty.validators import naming, max_25_chars, naming_with_dashes
import os
HttpBackendManager.SSL_CERT = os.path.... | 30loops/libthirty | libthirty/documents.py | Python | bsd-3-clause | 6,039 | 0.001325 |
import ast
import label
import repository
import os
class IncludeDef:
"""
Represents build file include definition like
include_defs("//include/path").
"""
def __init__(self, ast_call: ast.Call) -> None:
self.ast_call = ast_call
def get_location(self) -> str:
"""
... | LegNeato/buck | scripts/migrations/include_def.py | Python | apache-2.0 | 1,059 | 0.000944 |
import relayManager
import dronekit
class ShotManager():
def __init__(self):
# see the shotlist in app/shots/shots.p
print "init"
def Start(self, vehicle):
self.vehicle = vehicle
# Initialize relayManager
self.relayManager = relayManager.RelayManager(self)
target = '... | mapossum/SeymourSolo | tester.py | Python | gpl-3.0 | 495 | 0.006061 |
# coding=utf-8
import datetime
import logging
import time
import uuid
from dateutil.relativedelta import relativedelta
from redis.connection import Connection
import listenbrainz.db.user as db_user
from listenbrainz.db.testing import DatabaseTestCase
from listenbrainz import config
from listenbrainz.listen import Li... | Freso/listenbrainz-server | listenbrainz/listenstore/tests/test_redislistenstore.py | Python | gpl-2.0 | 4,058 | 0.002957 |
import subprocess
import tempfile
import random
import os
import shutil
import re
import chirc.replies as replies
from chirc.client import ChircClient
from chirc.types import ReplyTimeoutException
import pytest
import time
class IRCSession():
def __init__(self, chirc_exe = None, msg_timeout = 0.1, randomize... | loosecannon93/chittyrc | tests/chirc/tests/common.py | Python | apache-2.0 | 28,644 | 0.031804 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
FileSelectionPanel.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
********************... | alexbruy/QGIS | python/plugins/processing/gui/FileSelectionPanel.py | Python | gpl-2.0 | 3,127 | 0.00064 |
import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="family",
parent_name="scatter3d.marker.colorbar.title.font",
**kwargs
):
super(FamilyValidator, self).__init__(
plotly_n... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter3d/marker/colorbar/title/font/_family.py | Python | mit | 558 | 0 |
import re
from gourmet.plugin import ExporterPlugin
from gourmet.convert import seconds_to_timestring, float_to_frac
from . import gxml2_exporter
from gettext import gettext as _
GXML = _('Gourmet XML File')
class GourmetExportChecker:
def check_rec (self, rec, file):
self.txt = file.read()
self... | thinkle/gourmet | gourmet/plugins/import_export/gxml_plugin/gxml_exporter_plugin.py | Python | gpl-2.0 | 2,889 | 0.014192 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | fajoy/horizon-example | openstack_dashboard/dashboards/project/instances/urls.py | Python | apache-2.0 | 1,941 | 0.000515 |
#!/usr/bin/env python
# $Id$
"""
Print detailed information about a process.
"""
import os
import datetime
import socket
import sys
import psutil
from psutil._compat import namedtuple
def convert_bytes(n):
if n == 0:
return '0B'
symbols = ('k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
prefix = {}
... | jazinga/psutil | examples/process_detail.py | Python | bsd-3-clause | 3,753 | 0.00373 |
#MenuTitle: Guides through All Selected Nodes
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Creates guides through all selected nodes.
"""
from Foundation import NSPoint
import math
thisFont = Glyphs.font # frontmost font
selectedLayers = thisFont.selectedLayers... | mekkablue/Glyphs-Scripts | Guides/Guides through All Selected Nodes.py | Python | apache-2.0 | 2,786 | 0.037688 |
"""
Provide basic components for groupby. These definitions
hold the allowlist of methods that are exposed on the
SeriesGroupBy and the DataFrameGroupBy objects.
"""
from __future__ import annotations
import dataclasses
from typing import Hashable
@dataclasses.dataclass(order=True, frozen=True)
class OutputKey:
... | rs2/pandas | pandas/core/groupby/base.py | Python | bsd-3-clause | 3,488 | 0.000573 |
import collections
from django import forms
from django.forms.fields import MultiValueField, CharField
from django.forms.utils import flatatt
from django.forms.widgets import (
CheckboxInput,
Input,
RadioChoiceInput,
RadioSelect,
RadioFieldRenderer,
TextInput,
MultiWidget,
Widget,
)
from... | qedsoftware/commcare-hq | corehq/apps/style/forms/widgets.py | Python | bsd-3-clause | 10,116 | 0.00257 |
import lassie
from .base import LassieBaseTestCase
class LassieOpenGraphTestCase(LassieBaseTestCase):
def test_open_graph_all_properties(self):
url = 'http://lassie.it/open_graph/all_properties.html'
data = lassie.fetch(url)
self.assertEqual(data['url'], url)
self.assertEqual(dat... | michaelhelmick/lassie | tests/test_open_graph.py | Python | mit | 2,426 | 0.001237 |
#!/usr/bin/python3
import sys
import os
# this script allows the loading of palettes from files
# when invoked you must specify a palette
# google-blue.hex
# google-light-blue.hex
# old-blue.rgb
#
# each palette must contain 10 colours for the graduations between 0 and 100 %
# and an 11th colour for ... | mkfifo/open-source-stats | scripts/gen_colour_palette.py | Python | gpl-3.0 | 6,213 | 0.002253 |
from PyOMAPIc import PyOMAPIc
| stanvit/pyomapic | __init__.py | Python | mit | 31 | 0.032258 |
from settings_base import *
PORT = 80
SERVER_NAME = 'http://libra.pitomba.org:%s' % PORT
MONGODB_DATABASE_URL = "localhost"
MONGODB_DATABASE_PORT = 27017
MONGODB_DATABASE_USER = "usr_libra"
MONGODB_DATABASE_PWD = "usr_libra"
MONGODB_DATABASE_POOL_SIZE = 50
| pitomba/libra | libra/settings.py | Python | mit | 259 | 0 |
def italianhello():
i01.setHandSpeed("left", 0.60, 0.60, 1.0, 1.0, 1.0, 1.0)
i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
i01.setHeadSpeed(0.65, 0.75)
i01.moveHead(105,78)
i01.moveArm("left",78,48,37,11)
... | MyRobotLab/pyrobotlab | home/kwatters/harry/gestures/italianhello.py | Python | apache-2.0 | 2,293 | 0.066289 |
#
# (c) 2017 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | jimi-c/ansible | lib/ansible/plugins/cliconf/junos.py | Python | gpl-3.0 | 7,917 | 0.001768 |
from django.apps import AppConfig
from django.core import checks
from django.utils.translation import ugettext_lazy as _
import xadmin
class XAdminConfig(AppConfig):
"""Simple AppConfig which does not do automatic discovery."""
name = 'xadmin'
verbose_name = _("Administration")
def ready(self):
... | why168/PythonProjects | MxOnlie/extra_apps/xadmin/apps.py | Python | artistic-2.0 | 396 | 0 |
#!/usr/bin/env python
from distutils.core import setup
execfile('modlunky/version.py')
with open('requirements.txt') as requirements:
required = requirements.read().splitlines()
kwargs = {
"name": "modlunky",
"version": str(__version__),
"packages": ["modlunky"],
"scripts": ["bin/modlunky"],
... | gmjosack/modlunky | setup.py | Python | mit | 1,002 | 0.001996 |
#!/usr/bin/python
############################################################################
# tcp2tcp.py #
# v0.1 #
# ... | bladealslayer/nettraf-scripts | tcp2tcp.py | Python | gpl-2.0 | 2,816 | 0.003196 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Ship()
result.template = "object/ship/player/shared_player_z95.iff"
result.attribute_template_id = -1
result.stf... | obi-two/Rebelion | data/scripts/templates/object/ship/player/shared_player_z95.py | Python | mit | 434 | 0.048387 |
import csv
from django.db.models import Max
from django.utils.translation import ugettext_lazy as _
from urllib2 import URLError
from googlemaps import GoogleMaps, GoogleMapsError
from locations.models import Location
from locations.exceptions import LocationEncodingError
class CsvParseError(csv.Error):
pass
d... | bennylope/django-lokoj | locations/utils.py | Python | mit | 5,917 | 0.00169 |
'''
/*******************************************************************************
*
* Copyright (c) 2015 Fraunhofer FOKUS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Sof... | fraunhoferfokus/fixmycity | dummy/templatetags/value_from_settings.py | Python | lgpl-3.0 | 2,196 | 0.013206 |
# 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... | mlperf/training_results_v0.5 | v0.5.0/google/cloud_v3.8/ssd-tpuv3-8/code/ssd/model/tpu/models/official/retinanet/retinanet_architecture.py | Python | apache-2.0 | 25,570 | 0.004263 |
#! /usr/bin/env python
# -*- coding: latin-1 -*-
# Copyright (C) 2006 Universitat Pompeu Fabra
#
# Permission is hereby granted to distribute this software for
# non-commercial research purposes, provided that this copyright
# notice is included with any such distribution.
#
# THIS SOFTWARE IS PROVIDED "AS IS" WI... | PlanTool/plantool | code/Uncertainty/T0/translator/generators/sortnum.py | Python | gpl-2.0 | 3,602 | 0.009162 |
import sys
import numpy as np
from flopy.mbase import Package
from flopy.utils import util_2d,util_3d
from flopy.modflow.mfpar import ModflowPar as mfpar
class ModflowUpw(Package):
'Upstream weighting package class\n'
def __init__(self, model, laytyp=0, layavg=0, chani=1.0, layvka=0, laywet=0, iupwcb... | mjasher/gac | original_libraries/flopy-master/flopy/modflow/mfupw.py | Python | gpl-2.0 | 13,021 | 0.010598 |
from flask import Blueprint
log_analyzer = Blueprint('log_analyzer', __name__)
from . import views
| DonYum/LogAna | app/log_analyzer/__init__.py | Python | mit | 101 | 0.009901 |
# 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 "License"); you may not use ... | curoverse/libcloud | libcloud/test/compute/test_gce.py | Python | apache-2.0 | 123,700 | 0.001156 |
import os
import sys
import unittest
from logilab.common import testlib
from pylint.testutils import make_tests, LintTestUsingFile, cb_test_gen, linter
import ConfigParser
HERE = os.path.dirname(os.path.abspath(__file__))
PLUGINPATH = os.path.join(HERE, "..")
linter.prepare_import_path(PLUGINPATH)
linter.load_plugin_... | ancho85/pylint-playero-plugin | tests/fulltest.py | Python | gpl-2.0 | 2,139 | 0.004675 |
# code source: https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iv-database
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
api.downgrade(SQLALCHEMY_DATABASE_UR... | EddyCodeIt/SPA_Project_2016_Data_Rep-Quering | db_downgrade.py | Python | apache-2.0 | 600 | 0.006667 |
example_template = Template({
'A': RsrcDef({}, []),
'B': RsrcDef({}, []),
'C': RsrcDef({'a': '4alpha'}, ['A', 'B']),
'D': RsrcDef({'c': GetRes('C')}, []),
'E': RsrcDef({'ca': GetAtt('C', 'a')}, []),
})
engine.create_stack('foo', example_template)
engine.noop(3)
engine.rollback_stack('foo')
engine.no... | zaneb/heat-convergence-prototype | scenarios/basic_create_rollback.py | Python | apache-2.0 | 358 | 0 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import os
from mozboot.base import BaseBootstrapper
class OpenBSDBootstrapper(BaseBootstrapper):
def __init__(self... | SlateScience/MozillaJS | js/src/python/mozboot/mozboot/openbsd.py | Python | mpl-2.0 | 954 | 0.013627 |
#!/usr/bin/env python3
"""
The goal of this example is to show you the syntax for IR seeking readings. When using
IR-SEEK with a remote control you get both heading and distance data. The code below
shows the syntax for beacon seeking. Additionally it's good to play with a demo so that
you can see how well or not we... | Rosebotics/cwc-projects | lego-ev3/examples/analog_sensors/ir_sensor/print_beacon_seeking.py | Python | gpl-3.0 | 1,582 | 0.003793 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | artur-shaik/qutebrowser | tests/unit/misc/test_split.py | Python | gpl-3.0 | 6,878 | 0.000583 |
import re
import sys
class URI():
def __init__( self, root_path ):
super().__init__()
if root_path[-1] != '/' or root_path[0] != '/':
raise ValueError( 'root_path must start and end with "/"' )
self.root_path = root_path
self.uri_regex = re.compile( r'^({0}|/)(([a-zA-Z0-9\-_.!~*<>]+/)*)([a-zA... | cinp/python | cinp/common.py | Python | apache-2.0 | 4,279 | 0.038093 |
# Copyright (C) 2017 Lenovo, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansi... | sgerhart/ansible | test/units/modules/network/cnos/cnos_module.py | Python | mit | 3,502 | 0.000571 |
# Copyright 2014 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.
from master import gitiles_poller
def Update(config, active_master, c):
master_poller = gitiles_poller.GitilesPoller(
'https://chromium.googlesourc... | eunchong/build | masters/master.client.mojo/master_source_cfg.py | Python | bsd-3-clause | 386 | 0.005181 |
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('data', one_hot=True)
mnist_train = mnist.train
mnist_val = mnist.validation
p = 28 * 28
n = 10
h1 = 300
func_act = tf.nn.sigmoid
x_pl = tf.placeholder(dtype=tf.float32, shape=[None, p])
y_pl = tf.pl... | bm2-lab/MLClass | cgh_deep_learning/mnist_mlp.py | Python | apache-2.0 | 1,723 | 0.001741 |
import _plotly_utils.basevalidators
class TickvalsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="tickvals", parent_name="carpet.baxis", **kwargs):
super(TickvalsValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,... | plotly/plotly.py | packages/python/plotly/plotly/validators/carpet/baxis/_tickvals.py | Python | mit | 407 | 0.002457 |
from django.contrib import admin
from .models import Grant, AccessToken, RefreshToken, get_application_model
class ApplicationAdmin(admin.ModelAdmin):
list_display = ("name", "user", "client_type", "authorization_grant_type")
list_filter = ("client_type", "authorization_grant_type", "skip_authorization")
... | StepicOrg/django-oauth-toolkit | oauth2_provider/admin.py | Python | bsd-2-clause | 1,114 | 0.000898 |
import os
import sys
# Add parent directory to path to make test aware of other modules
srcfolder = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', "src"))
if srcfolder not in sys.path:
sys.path.append(srcfolder)
| lmotta/Roam | tests/__init__.py | Python | gpl-2.0 | 234 | 0.008547 |
import logging
import os
import re
import select
import subprocess
import threading
import time
__all__ = [
'ExternalService',
'SpawnedService',
]
log = logging.getLogger(__name__)
class ExternalService(object):
def __init__(self, host, port):
log.info("Using already running service at %s:%d",... | gamechanger/kafka-python | test/service.py | Python | apache-2.0 | 3,648 | 0.003289 |
from django.conf.urls import patterns, include, url
from service_order import views, data_views
urlpatterns = patterns('',
url(r'^$', views.index),
url(r'^order_state_machine/$', views.order_state_machine),
url(r'^make_order/$', views.make_order),
url(r'^make_order2/$', views.make_order2),
u... | yejia/order_system | service_order/urls.py | Python | mit | 542 | 0.00369 |
"""The tests for the google calendar component."""
# pylint: disable=protected-access
import logging
import unittest
from unittest.mock import patch, Mock
import pytest
import homeassistant.components.calendar as calendar_base
from homeassistant.components.google import calendar
import homeassistant.util.dt as dt_uti... | PetePriority/home-assistant | tests/components/google/test_calendar.py | Python | apache-2.0 | 16,362 | 0 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from socorro.unittest.cron.setup_configman import (
get_config_manager_for_crontabber,
)
from crontabber.tests impo... | AdrianGaudebert/socorro | socorro/unittest/cron/jobs/base.py | Python | mpl-2.0 | 1,178 | 0 |
raise Exception("tests where moved to emzed to avoid circular dependencies")
| uweschmitt/emzed_optimizations | tests/test_sample.py | Python | bsd-3-clause | 77 | 0 |
import sys
from craystack import cf
if len(sys.argv) < 4:
print "Usage: %s <key> <subkey> <path>" % sys.argv[0]
sys.exit(2)
_, key, subkey, filename = sys.argv
with open(filename) as f:
content = f.read()
cf.insert(key, {subkey: content})
print "Uploaded %s to %s/%s (%s bytes)" % (filename, key,... | rbranson/craystack | upload.py | Python | bsd-3-clause | 343 | 0.002915 |
import re
import svgwrite
import math
class LantexBase(object):
def __init__(self):
self.identifier = None
self.description = None
self.properties = [ 'description' ]
def __repr__(self):
out = "{0} {1}:\n".format(type(self).__name__, self.identifier)
for p in self.prop... | liamfraser/lantex | lantex/types.py | Python | bsd-3-clause | 19,172 | 0.002921 |
import csv
from datetime import datetime
from django.conf import settings
from django.core.management import BaseCommand
from bustimes.utils import download_if_changed
from ...models import Licence, Registration, Variation
def parse_date(date_string):
if date_string:
return datetime.strptime(date_string, ... | jclgoodwin/bustimes.org.uk | vosa/management/commands/import_vosa.py | Python | mpl-2.0 | 11,021 | 0.002087 |
from couchpotato import get_session
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.helpers.variable import mergeDicts, randomString
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotato.core.settings.model import Library
import copy
imp... | tmxdyf/CouchPotatoServer | couchpotato/core/providers/info/_modifier/main.py | Python | gpl-3.0 | 3,402 | 0.004409 |
"""Test cltk.prosody."""
__license__ = 'MIT License. See LICENSE.'
from cltk.prosody.latin.scanner import Scansion as ScansionLatin
from cltk.prosody.latin.clausulae_analysis import Clausulae
from cltk.prosody.greek.scanner import Scansion as ScansionGreek
from cltk.prosody.latin.macronizer import Macronizer
import u... | TylerKirby/cltk | cltk/tests/test_nlp/test_prosody.py | Python | mit | 3,978 | 0.001078 |
from datetime import datetime, time, timedelta
from pandas.compat import range
import sys
import os
import nose
import numpy as np
from pandas import Index, DatetimeIndex, Timestamp, Series, date_range, period_range
import pandas.tseries.frequencies as frequencies
from pandas.tseries.tools import to_datetime
impor... | bdh1011/wau | venv/lib/python2.7/site-packages/pandas/tseries/tests/test_frequencies.py | Python | mit | 16,705 | 0.004071 |
from OpenGLCffi.GL import params
@params(api='gl', prms=['len', 'string'])
def glStringMarkerGREMEDY(len, string):
pass
| cydenix/OpenGLCffi | OpenGLCffi/GL/EXT/GREMEDY/string_marker.py | Python | mit | 123 | 0.02439 |
import unittest
from github_person import GithubPerson
class Test_GithubPerson(unittest.TestCase):
def setUp(self):
pass
if __name__ == '__main__':
unittest.main()
| pepincho/Python101-and-Algo1-Courses | Programming-101-v3/week6/1-Who-Follows-You-Back/github_person_test.py | Python | mit | 185 | 0 |
import shutil
import os
import hashlib
import dockbot
def gen_hash(data):
return hashlib.sha256(data).hexdigest()
class Image(object):
def __init__(self, root, name, path, platform = None, projects = [],
modes = None, slave = False, remote = False):
self.root = root
self.con... | CauldronDevelopmentLLC/dockbot | dockbot/Image.py | Python | gpl-3.0 | 6,147 | 0.00667 |
#!/bin/env python
# mainly for sys.argv[], sys.argv[0] is the name of the program
import sys
# mainly for arrays
import numpy as np
def newtraph(fx, fxprime):
if __name__ == '__main__':
print 'hello'
| ketancmaheshwari/hello-goog | src/python/newtonraphson.py | Python | apache-2.0 | 209 | 0.004785 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.