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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# $File: edge.py
# $Date: Apr 1, 10:40, 2015.
__author__ = 'tobin'
import cv2
def get_canny_edge(image):
""" canny edge detection
:param image:
:return:
edge: edge graph
"""
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
edge = cv2.Canny(gray, 500, 1000, aper... | skyczhao/silver | AOTee/api/edge.py | Python | gpl-2.0 | 348 |
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import boto3
import unittest
from urlparse import urlparse
from moto import mock_s3
from app import create_app
from app.bitstore import BitStore
... | frictionlessdata/dpr-api | tests/bitstore/test_bitstore.py | Python | mit | 12,449 |
"""colcat_crowdsourcing tasks URL Configuration
"""
from django.conf.urls import patterns, url
from tasks import views
from tasks.imports import *
urlpatterns = [
url(r'^mturk-template/', views.mturk_template, name='mturk template'),
url(r'^disclaimer/', views.disclaimer, name='disclaimer'),
url(r'^prescr... | csdevsc/colcat_crowdsourcing_application | tasks/urls.py | Python | mit | 534 |
# Copyright (c) "Neo4j"
# Neo4j Sweden AB [http://neo4j.com]
#
# This file is part of Neo4j.
#
# 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... | neo4j/neo4j-python-driver | neo4j/exceptions.py | Python | apache-2.0 | 10,124 |
#!/usr/bin/env ./batchprofiler.sh
"""sql_jobs.py - launch and monitor remote jobs that submit SQL
This file is a command-line script for running jobs and a set of functions
for running the script on the cluster. To get help on running from the
command-line:
sql_jobs.py --help
CellProfiler is distributed under the GN... | LeeKamentsky/CellProfiler | BatchProfiler/sql_jobs.py | Python | gpl-2.0 | 3,871 |
# Copyright (C) 2009, 2010, 2011 Rickard Lindberg, Roger Lindberg
#
# This file is part of Timeline.
#
# Timeline 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... | linostar/timeline-clone | source/timelinelib/db/utils.py | Python | gpl-3.0 | 3,411 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any later
# version.
#
# This program is distributed in the... | GabrielReusRodriguez/DummySoapServer | pysimplesoap/simplexml.py | Python | gpl-2.0 | 21,628 |
"""
WSGI config for ctfapp project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "conf.localsettings")
from django.core.... | blstream/CaptureTheFlag | ctf-web-app/wsgi.py | Python | apache-2.0 | 390 |
DEBUG = 0
# cardinal diretions
directions = ("left","up","right","down")
# logic
maxExamined = 75000 # maximum number of tries when solving
maxMoves = 19 # maximum number of moves
cullFrequency = 75000 # number of tries per cull update
cullCutoff = 1.2 # fraction of average to cull
# grid size
gridRows = 5
gridColum... | discomethod/pad-helper | constants.py | Python | gpl-2.0 | 1,240 |
import urllib.parse
from unittest.mock import PropertyMock
import responses
from .c14 import C14
class TestC14:
def setup_method(self, method):
url = urllib.parse.urljoin(C14.C14_API_URL, "safe/abcdefg/archive")
responses.add(responses.GET, url, json=[{
"uuid_ref": "833a45fd-e87f-415... | jsurloppe/N14 | N14/test_c14.py | Python | gpl-3.0 | 627 |
from datetime import datetime, timedelta
import unittest
import gnip_client
class BasicTests(unittest.TestCase):
def setUp(self):
self.client = gnip_client.AllAPIs(config='DEFAULT')
now = datetime.now()
self.to_date = now.strftime("%Y%m%d0000")
self.from_date = (now - timedelta(da... | bee-keeper/pygnip-allapis | pygnip_allapis/tests.py | Python | gpl-3.0 | 2,625 |
#!/usr/bin/env python
"""
Common util classes / functions for the NGS project
"""
import collections
import gzip
import os
import re
import sys
def format_number(n):
'''
>>> format_number(1000)
'1,000'
>>> format_number(1234567)
'1,234,567'
'''
ar = list(str(n))
for i in range(len(ar))... | nitesh1989/tools-iuc | tools/ngsutils/ngsutils/support/ngs_utils.py | Python | mit | 5,476 |
#!/usr/bin/env python
#
# Copyright 2010 Andrei <vish@gravitysoft.org>
#
# 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... | barmalei/scalpel | lib/gravity/common/db.py | Python | lgpl-3.0 | 10,270 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
from essh.ec2 import EC2Controller
from essh.ssh import SSHController
from essh.exceptions import ESSHException
@click.command(context_settings=dict(ignore_unknown_options=True,))
@click.option('--profile', '-p', help='AWS credentials profile (i.e. ~/.aws/cre... | patrickbcullen/essh | essh/cli.py | Python | mit | 1,163 |
# encoding: utf-8
import curses
from . import wgmultilinetree
class TreeLineSelectable(wgmultilinetree.TreeLine):
# NB - as print is currently defined, it is assumed that these will
# NOT contain multi-width characters, and that len() will correctly
# give an indication of the correct offset
CAN_SELEC... | tescalada/npyscreen-restructure | npyscreen/widget/multilinetreeselectable.py | Python | bsd-2-clause | 4,001 |
"""ZFS based backup workflows."""
import datetime
import shlex
import gflags
import lvm
import workflow
FLAGS = gflags.FLAGS
gflags.DEFINE_string('rsync_options',
'--archive --acls --numeric-ids --delete --inplace',
'rsync command options')
gflags.DEFINE_string('rsync_path'... | rbarlow/ari-backup | ari_backup/zfs.py | Python | bsd-3-clause | 9,110 |
from datetime import timedelta
from urllib.parse import urlencode
from django.shortcuts import render, get_object_or_404, redirect
from django.urls import reverse
from django.http import Http404
from django.contrib import auth
from django.db import models
from django.views.generic import DetailView, FormView
from djan... | fin/froide | froide/account/views.py | Python | mit | 22,708 |
import Fast5File
def run(parser, args):
if args.read:
for i, fast5 in enumerate(Fast5File.Fast5FileSet(args.files)):
for metadata_dict in fast5.read_metadata:
if i == 0:
header = metadata_dict.keys()
print "\t".join(["filename"] + header)
print "\t".join([fast5.filename] + [str( metadata_dict[... | arq5x/poretools | poretools/metadata.py | Python | mit | 641 |
#!/usr/bin/env python3.8
'Calculations.'
import numpy as np
import cv2 as cv
from process_image import shape, odd, rotate
from images import Images
from angle import Angle
class Calculate():
'Calculate results.'
def __init__(self, core, input_images):
self.settings = core.settings.settings
... | FarmBot/farmbot_os | priv/farmware/measure-soil-height/calculate.py | Python | mit | 12,513 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2005-2007 Carabos Coop. V. All rights reserved
# Copyright (C) 2008-2017 Vicent Mas. All rights reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License... | ankostis/ViTables | vitables/preferences/vtconfig.py | Python | gpl-3.0 | 21,206 |
import logging
from docker.utils import kwargs_from_env
from cattle import default_value, Config
log = logging.getLogger('docker')
_ENABLED = True
class DockerConfig:
def __init__(self):
pass
@staticmethod
def docker_enabled():
return default_value('DOCKER_ENABLED', 'true') == 'true'
... | sonchang/python-agent | cattle/plugins/docker/__init__.py | Python | apache-2.0 | 3,232 |
import os
import logging
from yaml import safe_load
from collections import namedtuple
log = logging.getLogger('kkross;conf_parser')
# -------------------------------------------------------------------------------------------------
def conf_parser(conf_file):
log.debug('Reading data from configuration file "%s"'... | Doctor-love/kkross | playground/kkross/conf_parser.py | Python | gpl-2.0 | 460 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | addition-it-solutions/project-all | openerp/report/render/rml2pdf/__init__.py | Python | agpl-3.0 | 1,032 |
#!/usr/bin/env python
# coding: utf-8
import re
def rm(target, pattern):
pattern = re.compile(pattern, re.UNICODE)
return re.sub(pattern, '', target)
def number_translator(target):
def num_han(base):
def get_num(s):
num = 0
if len(s) == 2:
num += __word2num... | hsinhuang/pytimeextract | time_expr/prehandler.py | Python | gpl-2.0 | 3,333 |
#
# 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 n... | lhfei/spark-in-action | spark-2.x/src/main/python/mllib/correlations_example.py | Python | apache-2.0 | 2,008 |
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.config import config, ConfigSubsection, ConfigInteger, ConfigSlider, getConfigListEntry
config.plugins.OSDPositionSetup = ConfigSubsection()
config.plugins.OSDPositionSetup.dst_left = ConfigInteger(default = 0)
config.... | factorybuild/stbgui | lib/python/Plugins/SystemPlugins/OSDPositionSetup/plugin.py | Python | gpl-2.0 | 1,888 |
#!/usr/bin/env python3
###############################################################################
# Copyright 2019 The Apollo 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... | ApolloAuto/apollo | modules/tools/sensor_calibration/extract_data.py | Python | apache-2.0 | 29,171 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Puttichai Lertkultanon <L.Puttichai@gmail.com>
#
# This file is part of pymanip.
#
# pymanip 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,... | Puttichai/pymanip | pymanip/utils/ObjectPreprocessing.py | Python | gpl-3.0 | 21,276 |
"""
Module for the `assistant` service.
This is a standard Django-Celery integration setup.
See `make run-assistant` for running during development with the
necessary environment variables.
See `assistant.Dockerfile` for running in production.
See
- https://docs.celeryproject.org/en/latest/django/first-steps-with-dj... | stencila/hub | manager/manager/assistant.py | Python | apache-2.0 | 1,186 |
from flask import render_template
from flask import url_for
from flask import redirect
from flask import request
from datetime import datetime
from flask_login import current_user, login_required
from classes.operations.person_operations import person_operations
from classes.operations.project_operations import project... | itucsdb1611/itucsdb1611 | templates_operations/personal/default.py | Python | gpl-3.0 | 8,587 |
"""Handles simulator watch device pairs."""
from typing import Any, Dict, List
from isim.base_types import SimulatorControlBase, SimulatorControlType
class DevicePair(SimulatorControlBase):
"""Represents a device pair for the iOS simulator."""
raw_info: Dict[str, Any]
identifier: str
watch_udid: st... | dalemyers/xcrun | isim/device_pair.py | Python | mit | 2,574 |
"""
Pandoc filter using panflute
"""
import panflute as pf
def prepare(doc):
pass
def action(elem, doc):
if isinstance(elem, pf.Element) and doc.format == 'latex':
pass
# return None -> element unchanged
# return [] -> delete element
def strong2underline(elem, doc):
if isinstance... | sergiocorreia/panflute | tests/filters/underline.py | Python | bsd-3-clause | 643 |
import pytest
from unittest import mock
import os
from django.utils.timezone import now, timedelta
from awx.main.tasks import (
RunProjectUpdate, RunInventoryUpdate,
awx_isolated_heartbeat,
isolated_manager
)
from awx.main.models import (
ProjectUpdate, InventoryUpdate, InventorySource,
Instance, ... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx/main/tests/functional/test_tasks.py | Python | apache-2.0 | 6,092 |
my_expr = True
# language=regexp
pattern = r'{my_e<caret>'
| siosio/intellij-community | python/testData/completion/fStringLikeCompletionDoesNotWorkInStringWithInjections.py | Python | apache-2.0 | 59 |
"""
Django settings for projetoCP project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
... | luispaulo8402/projetoCP | projetoCP/settings.py | Python | mit | 2,167 |
import codecs
from functools import wraps
import json
from urlparse import urljoin, urlunsplit
from bitcoin import decode_privkey, encode_privkey
import click
import requests
from requests.exceptions import ConnectionError, HTTPError
from blocks import TransientBlock, block_structure
import rlp
from transactions impo... | jnnk/pyethereum | pyethereum/ethclient.py | Python | mit | 21,070 |
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup (
... | g8os/core0 | client/py-client/setup.py | Python | apache-2.0 | 696 |
#######################################################################
## gengcell.py
##
## Copyright 2011 Elizabeth Yip
##
## This file is part of AnStreetBump.
##
## AnStreetBump is free software: you can redistribute it and/or modify
## it under the terms of the Lesser GNU General Public License as published by
##... | elyip/AnStreetBump | SRC/gengcell.py | Python | gpl-3.0 | 8,444 |
#!/usr/bin/env python
import sys
import yaml
import datetime
def main(dbfile, action, stamp):
"""Update a YAML file of build timestamps
Args:
dbfile: YAML file name
action: 'add', 'test', or 'rm'
stamp: name of stamp
"""
with open(dbfile, 'r') as f:
data = yaml.load(f... | cornell-cs5220-f15/totient-pkg | configs/check_stamp.py | Python | mit | 890 |
from __future__ import print_function, division
from itertools import product
from sympy.core.sympify import (_sympify, sympify, converter,
SympifyError)
from sympy.core.basic import Basic
from sympy.core.expr import Expr
from sympy.core.singleton import Singleton, S
from sympy.core.evalf import EvalfMixin
from s... | antepsis/anteplahmacun | sympy/sets/sets.py | Python | bsd-3-clause | 61,756 |
if __name__ == "__main__":
with open("input.txt") as f:
res = 0
data = f.read()
flag_basement_first = False
for i, d in enumerate(data):
if d == '(':
res += 1
if d == ')':
res -= 1
if res == -1 and flag_basemen... | svagionitis/puzzles | adventofcode.com/2015/1/sol1.py | Python | mit | 581 |
# -*- coding: utf-8 -*-
from threading import Thread
from django.http import Http404, HttpResponseServerError, HttpResponse
from django.shortcuts import render_to_response
from django.utils import simplejson
def render_page(template):
'''
Render data to template with given file name.
'''
... | JokerQyou/Quantic | nook/decorators.py | Python | mit | 1,795 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 8 11:47:19 2016
@author: ericgrimson
"""
ans = 0
neg_flag = False
x = int(input("Enter an integer: "))
if x < 0:
neg_flag = True
while ans**2 < x:
ans = ans + 1
if ans**2 == x:
print("Square root of", x, "is", ans)
else:
print(x, "is not a perfect square... | mkhuthir/learnPython | edX_mitX_6_00_1x/L3/sqrtExample.py | Python | mit | 396 |
"""Test event player."""
from collections import namedtuple
from mpf.tests.MpfTestCase import MpfTestCase
class TestEventPlayer(MpfTestCase):
def get_config_file(self):
return 'test_event_player.yaml'
def get_machine_path(self):
return 'tests/machine_files/event_players/'
def test_load... | missionpinball/mpf | mpf/tests/test_EventPlayer.py | Python | mit | 9,499 |
# Copyright 2015 PerfKitBenchmarker 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 appli... | meteorfox/PerfKitBenchmarker | perfkitbenchmarker/linux_benchmarks/oldisim_benchmark.py | Python | apache-2.0 | 8,628 |
# Copyright 2019 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... | jhseu/tensorflow | tensorflow/python/data/experimental/kernel_tests/optimization/inject_prefetch_test.py | Python | apache-2.0 | 4,584 |
from __future__ import unicode_literals
import base64
import datetime
import hashlib
import json
import netrc
import os
import re
import socket
import sys
import time
import math
from ..compat import (
compat_cookiejar,
compat_cookies,
compat_etree_fromstring,
compat_getpass,
compat_http_client,
... | mcepl/youtube-dl | youtube_dl/extractor/common.py | Python | unlicense | 89,946 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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) an... | wulczer/ansible | v2/ansible/executor/playbook_iterator.py | Python | gpl-3.0 | 4,905 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
import unittest
from meridian.acupoints import dabao41
class TestDabao41Functions(unittest.TestCase):
def setUp(self):
pass
def test_xxx(self):
pass
if __name__ == '__main__':
unittest.main()
| sinotradition/meridian | meridian/tst/acupoints/test_dabao41.py | Python | apache-2.0 | 295 |
#!/usr/bin/env python
## Google APIs
# apiclient
from apiclient.discovery import build
# Oauth2
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import run
# Python Built-in Libraries
import httplib2
import trackback
__author__ = "Colin Su <littl... | Tagtoo/cookie_atm | gce_operation.py | Python | mit | 2,794 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('inicio', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='perfiles',
name='rol'... | acs-um/gestion-turnos | apps/inicio/migrations/0002_remove_perfiles_rol.py | Python | mit | 339 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from marshmallow_mongoengine.schema import (
SchemaOpts,
ModelSchema,
)
from marshmallow_mongoengine.conversion.fields import (
register_field,
register_field_builder
)
from marshmallow_mongoengine.convert import (
ModelConverter,
... | touilleMan/marshmallow-mongoengine | marshmallow_mongoengine/__init__.py | Python | mit | 758 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-15 18:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('places', '0007_auto_20161114_2203'),
]
operations = [
migrations.AddField(
... | RESTfactory/presence | places/migrations/0008_place_code.py | Python | gpl-3.0 | 481 |
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.postgres.search import SearchVector, SearchQuery, SearchRank
from django.core.urlresolvers import reverse
from django.db import models
from github import UnknownObjectException
from social.apps.django_app.default.models imp... | ZeroCater/Eyrie | interface/models.py | Python | mit | 4,056 |
'''
Animations tests
================
'''
import unittest
from time import time, sleep
from kivy.animation import Animation, AnimationTransition
from kivy.uix.widget import Widget
from functools import partial
from kivy.clock import Clock
class AnimationTestCase(unittest.TestCase):
def sleep(self, t):
st... | nuigroup/kivy | kivy/tests/test_animations.py | Python | lgpl-3.0 | 1,392 |
#<pycode(py_diskio)>
def enumerate_system_files(subdir, fname, callback):
"""Similar to enumerate_files() however it searches inside IDA directory or its subdirectories"""
return enumerate_files(idadir(subdir), fname, callback)
#</pycode(py_diskio)>
| nihilus/src | pywraps/py_diskio.py | Python | bsd-3-clause | 258 |
# -*- coding: utf-8 -*-
import time, random, string, os
import urllib, urllib2
from PIL import Image
def urlformat(unformaturl):
host = 'http://w.duoting.fm'
url = '%s%s' % (host, unformaturl)
return url
def urllocalformat(unformaturl):
host = 'http://api.duoting.fm'
url = '%s%s' % (host, unform... | rsj217/dtapi | dtapi/api/libs/utils.py | Python | gpl-2.0 | 4,366 |
# Configuration file for jupyter-notebook.
#------------------------------------------------------------------------------
# Application(SingletonConfigurable) configuration
#------------------------------------------------------------------------------
## This is an application.
## The date format used by logging f... | noahbenson/neuropythy | docker/jupyter_notebook_config.py | Python | agpl-3.0 | 28,716 |
"""Memebot views"""
import os
from django.views.generic.simple import direct_to_template
from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.shortcuts import get_object_or_404
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.core.urlres... | ToxicFrog/lancow | contrib/django-memebot/gruntle/memebot/views/memebot.py | Python | gpl-3.0 | 3,251 |
grid = [
[ 8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8],
[49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0],
[81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65],
[52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, ... | smileytechguy/sample_projects | product_in_a_grid/python/product_in_a_grid.py | Python | mit | 2,677 |
# This file is part of FNPDjango, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See README.md for more information.
#
from django.conf import settings
from django.test import TestCase
class UtilsSettingsTestCase(TestCase):
def test_lazy_ugettext_lazy(self):
self.asser... | fnp/fnpdjango | tests/tests/test_utils_settings.py | Python | agpl-3.0 | 398 |
#!/usr/bin/env python
import numpy as np
import rospy as rp
import cv2
import time
from sensor_msgs.msg import CompressedImage
from cv_bridge import CvBridge, CvBridgeError
from _init_paths import cfg
import caffe
__author__ = 'kazuto1011'
TOPIC_NAME = "/camera/image/compressed"
class CNNClassifier:
def __init... | kazuto1011/rcnn-server | tms_ss_cnn/nodes/caffe/server_caffe.py | Python | mit | 1,790 |
"""
When you need a wall.
"""
VERSION = (1, 2, 0)
def get_version():
"""Returns the version as a string."""
return '.'.join(map(str, VERSION))
| GermanoGuerrini/django-bricks | djangobricks/__init__.py | Python | mit | 154 |
# -*- coding: utf-8 -*-
#
# 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
#... | r39132/airflow | airflow/contrib/operators/s3_to_gcs_operator.py | Python | apache-2.0 | 8,370 |
# -*- coding: utf-8 -*-
# Home made test
KX= 1000 # Spring constant
KY= 2000 # Spring constant
KZ= 3000 # Spring constant
FX= 1 # Force magnitude
FY= 2
FZ= 3
import xc_base
import geom
import xc
from solution import predefined_solutions
from model import predefined_spaces
from materials import typical_materials
# M... | lcpt/xc | verif/tests/constraints/test_elastic_bearing_01.py | Python | gpl-3.0 | 2,538 |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas.topology import connected_components
__all__ = [
'network_disconnected_nodes',
'network_disconnected_edges',
'network_explode'
]
def network_disconnected_nodes(network):
"""Get th... | compas-dev/compas | src/compas/datastructures/network/explode.py | Python | mit | 1,947 |
import math
import re
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.urls import reverse_lazy
from django.contrib.contenttypes.fields import GenericRelation
from planotrabalho.models import ... | culturagovbr/sistema-nacional-cultura | adesao/models.py | Python | agpl-3.0 | 26,998 |
import json
import os
from datetime import datetime
from django.core.files.base import ContentFile
from django.core.files.storage import get_storage_class
from django.forms.models import model_to_dict
storage = get_storage_class()()
IP_DENY_LIST = """
-- Mozilla Network
ip_address NOT LIKE '63.245.208.%' A... | harikishen/addons-server | src/olympia/stats/management/commands/__init__.py | Python | bsd-3-clause | 2,174 |
# -*- coding: utf-8 -*-
# Licensed to Anthony Shaw (anthonyshaw@apache.org) 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 "Li... | tonybaloney/pluralsight | pluralsight/licensing/client.py | Python | apache-2.0 | 2,994 |
from django.contrib import admin
from djforms.giving.models import PaverContact, DonationContact
from djforms.processors.models import Order
class OrderInline(admin.TabularInline):
model = DonationContact.order.through
extra = 3
class DonationContactAdmin(admin.ModelAdmin):
model = DonationCont... | carthagecollege/django-djforms | djforms/giving/admin.py | Python | unlicense | 3,871 |
#!/usr/bin/python3
def min_max_avg(list):
min = list[0]
max = list[0]
sum = list[0]
for x in list[1:]:
if x < min:
min = x
if x > max:
max = x
sum += x
return min, max, sum / len(list)
print(min_max_avg(xrange(0, 100000)))
| nonZero/demos-python | src/exercises/basic/min_max_average/solution3.py | Python | gpl-3.0 | 294 |
"""Support for sensors through the SmartThings cloud API."""
from collections import namedtuple
from typing import Optional, Sequence
from pysmartthings import Attribute, Capability
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_ILLUMINANCE,
DEVICE_CLASS_TE... | leppa/home-assistant | homeassistant/components/smartthings/sensor.py | Python | apache-2.0 | 11,668 |
from . import config_params
from . import thermometer
from . import util
import subprocess
import shlex
import os
import collections
import logging
logger = logging.getLogger(__name__)
def _iterate_command_output(self, command):
process = subprocess.Popen(command,
stdout=subprocess... | bluecube/pysystemfan | pysystemfan/harddrive.py | Python | mit | 5,952 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'c+#8x$+zfq00i(z@6_81ht9i-0dcp53iyl_bp$mr^f22k600i*'
DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.site... | kkoci/orthosie | orthosie/settings.py | Python | gpl-3.0 | 2,988 |
#!/usr/bin/env python
# Copyright 2016 The Kubernetes 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 appli... | jlowdermilk/test-infra | gubernator/filters_test.py | Python | apache-2.0 | 6,840 |
import numpy as np
import pandas as pd
from darkcore import *
df = pd.DataFrame(np.random.randn(3, 3))
class MyApp(Darkcore):
def get_data(self, params):
return df
def get_chart(self, params):
ax = self.get_data(params).plot(figsize=(4, 3))
return ax
if __name__ == "__main__":
... | sinhrks/darkcore | examples/simpleapp.py | Python | bsd-3-clause | 603 |
'''Test cases for qInstallMsgHandler'''
import unittest
import sys
from PySide2.QtCore import *
param = []
def handler(msgt, msg):
global param
param = [msgt, msg.strip()]
def handleruseless(msgt, msg):
pass
class QInstallMsgHandlerTest(unittest.TestCase):
def tearDown(self):
# Ensure th... | BadSingleton/pyside2 | tests/QtCore/qinstallmsghandler_test.py | Python | lgpl-2.1 | 1,482 |
from .crp import CRP
from .bah import BAH
from .anticor import Anticor
from .corn import CORN
from .bcrp import BCRP
from .cwmr import CWMR
from .olmar import OLMAR
from .pamr import PAMR
from .rmr import RMR
from .up import UP
from .wmamr import WMAMR
from .ons import ONS
from .kelly import Kelly
from .up import UP
fr... | greenlin/universal-portfolios | universal/algos/__init__.py | Python | mit | 492 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
from cryptography import utils
from cryptography.exceptions import... | hipnusleo/laserjet | resource/pypi/cryptography-1.7.1/src/cryptography/hazmat/backends/commoncrypto/ciphers.py | Python | apache-2.0 | 8,139 |
# 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 u... | Laurawly/tvm-1 | tests/python/unittest/test_tir_analysis_calculate_workspace.py | Python | apache-2.0 | 8,017 |
import logging
import os
from django.conf import settings
from django.core.management.base import BaseCommand
from django.template.loader import get_template
logger = logging.getLogger("zentral.server.base.management.commands.build_custom_error_pages")
class Command(BaseCommand):
help = 'Build custom error page... | zentralopensource/zentral | server/base/management/commands/build_custom_error_pages.py | Python | apache-2.0 | 1,054 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 later version.
#
# This program is distrib... | srgblnch/LinacGUI | ctli/widgets/componentswindow.py | Python | gpl-3.0 | 6,014 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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 later version.
#
# This progra... | 0vercl0k/rp | src/third_party/beaengine/tests/0f3870.py | Python | mit | 2,248 |
import json
"""
Transforms csv abolone data into json abolone data
"""
# Sex { M, F, I}
# Length real
# Diameter real
# Height real
# Whole weight real
# Shucked weight real
# Viscera weight real
# Shell weight real
# Class_Rings integer
def toAboloneDictionary(
sex, length, diameter, height,
wholeWei... | AKST/Data-mining | scripts/jsonify.py | Python | mit | 900 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mergedialog.ui'
#
# Created: Fri May 30 09:15:18 2014
# by: PyQt4 UI code generator 4.9.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Att... | boundlessgeo/qgis-geogig-plugin | geogig/ui/mergedialog.py | Python | gpl-2.0 | 14,704 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Boa:Frame:schoolnet_main
# JNMaster / schoolnet / shrimp entry point, main UI
#
# Copyright (C) 2011 Wang Xuerui <idontknw.wang@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 pub... | xen0n/gingerprawn | gingerprawn/shrimp/schoolnet/schoolnet_main.py | Python | gpl-3.0 | 4,365 |
from __future__ import absolute_import
from collections import OrderedDict
from pybloom import BloomFilter
from os import path, makedirs
from celery import Task
from gevent.queue import Queue
from arachne.celery import celery
import errno, sys
## these directories are used to output results from scripts and e... | gzzo/arachne | arachne/utils.py | Python | gpl-2.0 | 4,274 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('trans', '0045_auto_20150916_1007'),
]... | miumok98/weblate | weblate/billing/migrations/0001_initial.py | Python | gpl-3.0 | 1,726 |
from distutils.core import setup
setup(name='distributed_exploration',
version='1.0',
packages = ['distributed_exploration']
)
| pabloriera/distributed_exploration | setup.py | Python | gpl-2.0 | 145 |
"""
Pure Python discrete time PID controllers
"""
from __future__ import division
import time
from builtins import object
from past.utils import old_div
import zmq
# todo: add ZMQ connections to PIDs without one
class PID_V(object):
"""
Discrete PID control: the so-called `velocity` pid_controller
""... | friend0/tower | tower/controllers/pid.py | Python | isc | 8,867 |
from tests.fail_random import fail_random | griddynamics/bunch | tests/functional/bunches/light_failed/__init__.py | Python | gpl-3.0 | 41 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import glob
class Aspa(MakefilePackage):
"""A fundamental premise in ExMatEx is that scale-bridg... | rspavel/spack | var/spack/repos/builtin/packages/aspa/package.py | Python | lgpl-2.1 | 1,827 |
# Natural Language Toolkit: Rude Chatbot
#
# Copyright (C) 2001-2013 NLTK Project
# Author: Peter Spiller <pspiller@csse.unimelb.edu.au>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
from __future__ import print_function
from .util import Chat, reflections
pairs = (
(r'We (.*)',
... | bbengfort/TextBlob | textblob/nltk/chat/rude.py | Python | mit | 2,703 |
# 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 u... | mlperf/training_results_v0.7 | Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/3rdparty/tvm/tests/python/unittest/test_lang_schedule.py | Python | apache-2.0 | 9,054 |
#!/usr/bin/env python3.5
from libs.git_wrapper import GitManager
from libs.utils import generic_setup, parse_args, explode
def clone_repos(logger, settings, dry_run=False):
for repo in settings["repositories"]:
protocol = repo[0]
host = repo[1]
user = repo[2]
repository = repo[3]
... | xyder/dotfiles | utils/installer/tools/install_repos.py | Python | mit | 1,106 |
import numpy
from palm.util import n_choose_k
from palm.route_collection import RouteCollectionFactory
class Route(object):
'''
A generic route class for AggregatedKineticModels. Routes represent
transitions between states in such models.
Parameters
----------
id_str : string
Identifie... | milapour/palm | palm/blink_route_mapper.py | Python | bsd-2-clause | 22,106 |
#Copyright ReportLab Europe Ltd. 2000-2016
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/platypus/xpreformatted.py
__version__='3.3.0'
__doc__='''A 'rich preformatted text' widget allowing internal markup'''
from reportlab.lib import P... | EduPepperPDTesting/pepper2013-testing | lms/djangoapps/reportlab/platypus/xpreformatted.py | Python | agpl-3.0 | 13,022 |
from django import shortcuts
def render( request, template, ** kwargs ):
kwargs[ 'request' ] = request
return shortcuts.render( request, template, kwargs )
| shlomimatichin/workflow | workflow/render.py | Python | gpl-3.0 | 159 |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | gkc1000/pyscf | pyscf/prop/rotational_gtensor/test/test_rhf.py | Python | apache-2.0 | 1,370 |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 12 07:50:10 2017
@author: Mok Jun Neng
"""
#
# Hello World client in Python
# Connects REQ socket to tcp://localhost:5555
# Sends "Hello" to server, expects "World" back
#
import zmq
context = zmq.Context()
a = 1.23
# Socket to talk to server
print("Connecting to ... | tgymartin/green-fingers-2d | client.py | Python | gpl-3.0 | 706 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.