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 |
|---|---|---|---|---|---|---|
from dependencywatcher.crawler.detectors import Detector
import urllib2, json, logging, os
logger = logging.getLogger(__name__)
class RubyGemsDetector(Detector):
""" rubygems.org API based information detector """
url = "https://rubygems.org/api/v1/gems/%s.json"
auth = "af93e383246a774566bcf661f9c9f591"
... | DependencyWatcher/crawler | dependencywatcher/crawler/rubygems.py | Python | apache-2.0 | 1,359 | 0.003679 |
'''
Python bindings for bgfx.
'''
__author__ = "Jason Nadro"
__copyright__ = "Copyright 2016, Jason Nadro"
__credits__ = ["Jason Nadro"]
__license__ = "BSD 2-clause"
__version__ = "0.0.1"
__maintainer__ = "Jason Nadro"
__email__ = ""
__status__ = "Development"
import ctypes
from ctypes import Structure, POINTER, cas... | jnadro/pybgfx | pybgfx/bgfx.py | Python | bsd-2-clause | 45,223 | 0.010548 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from flask import Blueprint, render_template, Markup, url_for
from flask_toolbox.models import Package
package_page = Blueprint('package_page', __name__,
template_folder='templates')
@package_page.route(... | lord63/flask_toolbox | flask_toolbox/views/package.py | Python | mit | 2,151 | 0.002789 |
import copy
import json
import os
import asyncio
import pytest
import webdriver
from urllib.parse import urlunsplit
from tests.support import defaults
from tests.support.helpers import cleanup_session, deep_update
from tests.support.inline import build_inline
from tests.support.http_request import HTTPRequest
# Th... | nwjs/chromium.src | third_party/blink/web_tests/external/wpt/webdriver/tests/support/fixtures.py | Python | bsd-3-clause | 7,196 | 0.001112 |
from __future__ import absolute_import, print_function, division
from copy import copy
from itertools import product as itertools_product
from unittest import TestCase
import numpy
from numpy import (arange, array, common_type, complex64, complex128, float32,
float64, newaxis, shape, transpose, zeros... | Weihonghao/ECM | Vpy34/lib/python3.5/site-packages/theano/tensor/tests/test_blas.py | Python | agpl-3.0 | 87,605 | 0.00145 |
from __future__ import print_function
import logging
import mock
import pytest
from faker import Factory
from website import settings as website_settings
from framework.celery_tasks import app as celery_app
logger = logging.getLogger(__name__)
# Silence some 3rd-party logging and some "loud" internal loggers
SILEN... | mattclark/osf.io | conftest.py | Python | apache-2.0 | 3,405 | 0.000881 |
import urllib.request
import re
def getHtml(url):
page = urllib.request.urlopen(url)
html = page.read().decode('utf-8')
return html
def getImg(html):
reg = r'src="(.+?\.jpg)" pic_ext'
imgre = re.compile(reg)
imglist = re.findall(imgre,html)
x = 0
for imgurl in imglist:
urllib.r... | Octoberr/swmcdh | cong/zijixieyige.py | Python | apache-2.0 | 496 | 0.014113 |
import time
from robograph.datamodel.nodes.lib import buffers
def test_buffer():
instance = buffers.Buffer()
assert instance.requirements == []
expected = dict(a=1, b=2, c=3)
instance.input(expected)
instance.set_output_label('any')
assert instance.output() == expected
def test_detlayed_buf... | csparpa/robograph | robograph/datamodel/tests/test_buffers.py | Python | apache-2.0 | 703 | 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 ... | Azure/azure-sdk-for-python | sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_person_group_operations.py | Python | mit | 21,247 | 0.001459 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com>
# (c) 2014, Ahti Kitsik <ak@ahtik.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 S... | chrismeyersfsu/ansible-modules-core | files/lineinfile.py | Python | gpl-3.0 | 15,603 | 0.001795 |
# -*- coding: UTF-8 -*-
from django.template.context import RequestContext
from project.tramitacao.models import Tbpecastecnicas, \
Tbprocessorural,Tbchecklistprocessobase, Tbprocessosanexos, Tbprocessobase,Tbprocessourbano, Tbcaixa, AuthUser, Tbmunicipio, Tbprocessoclausula, Tbpendencia, Tbetapa, Tbtransicao
f... | waldenilson/TerraLegal | project/tramitacao/restrito/relatorio.py | Python | gpl-2.0 | 111,754 | 0.016833 |
# coding=utf-8
# Copyright 2018 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)
class PantsDaemonSt... | baroquebobcat/pants | src/python/pants/goal/pantsd_stats.py | Python | apache-2.0 | 1,009 | 0.006938 |
# 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... | tensorflow/benchmarks | scripts/tf_cnn_benchmarks/mlperf_test.py | Python | apache-2.0 | 7,794 | 0.003977 |
# vim: set fileencoding=utf-8 ts=4 sw=4 expandtab fdm=marker:
"""
Small wrapper around the python ConfigParser module.
"""
import ConfigParser
CONFIG = ConfigParser.ConfigParser()
DEFAULTS = {
'patterns': {
'path' : '(?P<artist>\w+) - (?P<year>\d+) - (?P<album>\w+)'
}
}
def get_param(sec... | turbofish/mcverify | config.py | Python | bsd-2-clause | 772 | 0.009067 |
"""
Validate the dependencies are installed.
"""
from __future__ import print_function
__all__ = [
'installRequiredToolbox',
'downloadDependency',
'addExtensionPath',
'loadExtensions',
'installPackage',
'tokenRefresher',
'validateToken',
'checkInstall',
'updateToken',
'TokenErro... | aldmbmtl/FloatingTools | tools/utilities.py | Python | mit | 10,347 | 0.002996 |
import numpy as np
from scipy.sparse import csr_matrix
class AliasArray(np.ndarray):
"""An ndarray with a mapping of values to user-friendly names -- see example
This ndarray subclass enables comparing sub_id and hop_id arrays directly with
their friendly string identifiers. The mapping parameter transla... | MAndelkovic/pybinding | pybinding/support/alias.py | Python | bsd-2-clause | 5,869 | 0.001704 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import tensorflow as tf
class BaseConverter(object):
@staticmethod
def to_int64_feature(values):
"""Returns a TF-Feature of int64s.
Args:
values: A scalar or list of values.
Returns:... | polyaxon/polyaxon-api | polyaxon_lib/datasets/converters/base.py | Python | mit | 2,397 | 0.001252 |
# Copyright (c) 2012 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.
''' Base class for postprocessing of RC files.
'''
from __future__ import print_function
class PostProcessor(object):
''' Base class for postprocessi... | scheib/chromium | tools/grit/grit/tool/postprocess_interface.py | Python | bsd-3-clause | 1,031 | 0.00388 |
from math import pi
import pandas as pd
from bokeh.io import output_file, show
from bokeh.palettes import Category20c
from bokeh.plotting import figure
from bokeh.transform import cumsum
output_file("pie.html")
x = {
'United States': 157,
'United Kingdom': 93,
'Japan': 89,
'China': 63,
'Germany'... | mindriot101/bokeh | examples/plotting/file/pie.py | Python | bsd-3-clause | 1,053 | 0.004748 |
import decimal
import json
import unittest
import uuid
from django import forms
from django.core import checks, exceptions, serializers, validators
from django.core.exceptions import FieldError
from django.core.management import call_command
from django.db import IntegrityError, connection, models
from django.test imp... | piquadrat/django | tests/postgres_tests/test_array.py | Python | bsd-3-clause | 34,363 | 0.001659 |
# -*- coding: utf-8 -*-
import unittest
import datetime
from cwr.parser.encoder.dictionary import ComponentDictionaryEncoder
from cwr.work import ComponentRecord
"""
ComponentRecord to dictionary encoding tests.
The following cases are tested:
"""
__author__ = 'Bernardo Martínez Garrido'
__license__ = 'MIT'
__stat... | weso/CWR-DataApi | tests/parser/dictionary/encoder/record/test_component.py | Python | mit | 2,680 | 0.000373 |
# pylint: disable-msg=too-many-lines
"""OPP Hardware interface.
Contains the hardware interface and drivers for the Open Pinball Project
platform hardware, including the solenoid, input, incandescent, and neopixel
boards.
"""
import asyncio
from collections import defaultdict
from typing import Dict, List, Set, Union,... | missionpinball/mpf | mpf/platforms/opp/opp.py | Python | mit | 53,276 | 0.003942 |
#!/usr/bin/env python
import sys
sys.path.append("../build/")
import phisSchema
import pyxb
import warnings
# Strategy:
# Perhaps cleanest would be to build a separate interface for data that may vary from VFB.
# This also allows separation of Jython code
# OTOH - this gives another layer of mappings to maintain.
... | PhenoImageShare/PhenoImageShare | VFB_import/src/VFB2PhisXML.py | Python | apache-2.0 | 15,991 | 0.00863 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common
import datetime
class TestAutoBlacklist(common.TransactionCase):
def test_mail_bounced_auto_blacklist(self):
mass_mailing_contacts = self.env['mail.mass_mailing.contact']
... | t3dev/odoo | addons/test_mass_mailing/tests/test_mail_auto_blacklist.py | Python | gpl-3.0 | 4,008 | 0.002994 |
# -*- coding: utf-8 -*-
"""
Exceptions
"""
#
# (C) Pywikibot team, 2008-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
import re
import json
try:
long
except NameError:
long = int
class WbTime(object):
"""A Wikibase time representation."""
PREC... | wikimedia/pywikibot-wikibase | pywikibase/wbtime.py | Python | mit | 4,755 | 0 |
class Solution:
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
num1, cnt1 = 0, 0
num2, cnt2 = 1, 0
for num in nums:
if num == num1:
cnt1 += 1
elif num == num2:
c... | YiqunPeng/Leetcode-pyq | solutions/229MajorityElementII.py | Python | gpl-3.0 | 671 | 0.007452 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | OpusVL/odoo | addons/share/wizard/share_wizard.py | Python | agpl-3.0 | 50,754 | 0.006147 |
#!/usr/bin/env vpython3
# Copyright 2021 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.
import unittest
from flake_suppressor import data_types
class ExpectationUnittest(unittest.TestCase):
def testAppliesToResultNon... | nwjs/chromium.src | content/test/gpu/flake_suppressor/data_types_unittest.py | Python | bsd-3-clause | 2,947 | 0.004411 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Window selection algorithm.
This module aims to provide a window selection algorithm suitable for
calculating phase misfits between two seismic waveforms.
The main function is the select_windows() function. The selection process is a
multi-stage process. Initially all... | krischer/LASIF | lasif/window_selection.py | Python | gpl-3.0 | 36,635 | 0 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 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... | belokop/indico_bare | indico/modules/rb/forms/reservations.py | Python | gpl-3.0 | 8,391 | 0.003814 |
class RecordingException(Exception):
pass
class Recording(object):
def __init__(self, stream, lenght):
import command
self.name = None
self.time = None
self.lenght = lenght
self.path = None
self._temp_path = None
self._processing_list = []
if i... | rizen1892/SmartHomeSolutions-Web | app/recording.py | Python | gpl-2.0 | 3,094 | 0.001616 |
'''
Created by auto_sdk on 2015.11.10
'''
from top.api.base import RestApi
class TradePostageUpdateRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.post_fee = None
self.tid = None
def getapiname(self):
return 'taobao.trade.postage.up... | colaftc/webtool | top/api/rest/TradePostageUpdateRequest.py | Python | mit | 327 | 0.030581 |
"""
A helper class for working with 2D bins of goodness-of-fit as a function of log(SNR).
"""
import numpy as np
class DeltaFSNRBins(object):
NUM_SNR_BINS = 50
NUM_DELTA_F_BINS = 50
LOG_SNR_RANGE = 6.
LOG_SNR_OFFSET = 2.
DELTA_F_RANGE = 1.
DELTA_F_OFFSET = 0.
def __init__(self):
... | yishayv/lyacorr | physics_functions/delta_f_snr_bins.py | Python | mit | 1,610 | 0.003106 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import os
im... | mdhaman/superdesk-core | tests/vocabularies_tests.py | Python | agpl-3.0 | 4,647 | 0.000215 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2009 Douglas S. Blank
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... | arunkgupta/gramps | gramps/plugins/quickview/ageondate.py | Python | gpl-2.0 | 2,780 | 0.002518 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-25 00:04
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | ortutay/23andme-phenotypes-hackathon | my_app/my_app/migrations/0001_initial.py | Python | mit | 829 | 0.003619 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
**get_package_path.py**
**Platform:**
Windows, Linux, Mac Os X.
**Description:**
Write given package path to stdout.
**Others:**
"""
from __future__ import unicode_literals
import argparse
import sys
import foundations.decorators
import foundations.verbo... | KelSolaar/sIBL_GUI | utilities/get_package_path.py | Python | gpl-3.0 | 2,062 | 0 |
import _plotly_utils.basevalidators
class FillValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="fill", parent_name="volume.slices.z", **kwargs):
super(FillValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/volume/slices/z/_fill.py | Python | mit | 517 | 0.001934 |
"""
Demonstrates how the bz2 module may be used to create a compressed object
which represents a bitarray.
"""
import bz2
from bitarray import bitarray
def compress(ba):
"""
Given a bitarray, return an object which represents all information
within the bitarray in a compresed form.
The function `deco... | brianhelba/pylibtiff | libtiff/bitarray-a1646c0/examples/compress.py | Python | bsd-3-clause | 953 | 0 |
import pingo
from time import sleep
rpi = pingo.rpi.RaspberryPi()
# A B C D E F G dp
led_locations = [11, 7, 21, 24, 26, 13, 15, 19]
pins = [rpi.pins[loc] for loc in led_locations[:6]]
for pin in pins:
pin.mode = pingo.OUT
pin.low()
while True:
for pin in pins:
pin.h... | garoa/pingo | pingo/examples/rpi_examples/display7_anim.py | Python | mit | 363 | 0 |
"""
This convenience module is to hard-code some example FASTA files for testing
and development.
"""
| scholer/cadnano2.5 | cadnano/extras/fasta/__init__.py | Python | mit | 102 | 0 |
#!/usr/bin/env python
import re,os,glob,sys,gc,ctypes,time
import numpy as np
try:import ROOT
except:print "Error!! pyroot didn't compile! please recompile your root!"
from array import array
#from pylab import plot,show,subplot
from bcmconst import *
from runinfo import getpklpath,runinfo,zload,zdump
try:from scipy.si... | zhupengjia/beampackage | beampackage/signalfilter.py | Python | gpl-3.0 | 32,657 | 0.043268 |
from django.core.management.base import BaseCommand
from lizard_blockbox import import_helpers
class Command(BaseCommand):
help = "Parse the shapes for the blockbox data."
def handle(self, *args, **kwargs):
import_helpers.parse_shapes_blockbox(self.stdout)
| lizardsystem/lizard-blockbox | lizard_blockbox/management/commands/parse_shapes_blockbox.py | Python | gpl-3.0 | 276 | 0 |
#!/usr/bin/env python
# Copyright 2016 gRPC 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 o... | firebase/grpc-SwiftPM | tools/run_tests/artifacts/artifact_targets.py | Python | apache-2.0 | 16,432 | 0.000609 |
"""pidaemon.py
Usage:
pidaemon.py [--brightness=<b>] [--sleep=<s>] [--interval=<s>] [--wait=<s>]
pidaemon.py (-h | --help)
pidaemon.py --version
Options:
-h --help Show this screen.
--version Show version
--brightness=<b> Default brightness level 1-255 [default: 2]
--interval=<s> Def... | ollej/piapi | pidaemon.py | Python | mit | 2,568 | 0.002336 |
"""
Utilities for instructor unit tests
"""
import datetime
import json
import random
import six
from pytz import UTC
from util.date_utils import get_default_time_display
class FakeInfo(object):
"""Parent class for faking objects used in tests"""
FEATURES = []
def __init__(self):
for feature ... | cpennington/edx-platform | lms/djangoapps/instructor/tests/utils.py | Python | agpl-3.0 | 3,206 | 0.000624 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (C) 2016 Didotech srl (<http://www.didotech.com>).
#
# All Rights Reserved
#
# This program is free software: you can redistr... | iw3hxn/LibrERP | product_extended/models/__init__.py | Python | agpl-3.0 | 1,187 | 0 |
# -*- coding: utf-8 -*-
#Copyright (C) 2015 David Delgado Hernandez
# 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.
... | lokiteitor/ikol | ikol/config.py | Python | gpl-2.0 | 7,992 | 0.010636 |
from __future__ import annotations
from decimal import Decimal
from typing import (
Any,
Mapping,
Sequence,
)
import uuid
from pprint import pprint
import pytest
from ai.backend.common.docker import ImageRef
from ai.backend.common.types import (
AccessKey, AgentId, KernelId,
ResourceSlot, Session... | lablup/sorna-manager | tests/manager/test_scheduler.py | Python | lgpl-3.0 | 16,173 | 0.000618 |
from __future__ import absolute_import
from __future__ import print_function
import re
import itertools
from ..utils.py3compat import range
from .. import csstokens as tokens
class ScannerBase(object):
def __init__(self, data):
self._tokeniter = tokens.re_tokens.finditer(data)
self._lineno = 1
... | colossalbit/cssypy | cssypy/scanners/scanners.py | Python | bsd-3-clause | 4,679 | 0.005984 |
def sqr(x):
return x*x
def cube(x):
return x*x*x
def quad(x):
return cube(x)*x
a = 10
print sqr(a)
print cube(a)
print quad(a)
| jishnuv/Toy-Python-Virtual-Machine | Testcases/Functions/f2.py | Python | gpl-2.0 | 131 | 0.045802 |
"""
Application urlconfig
"""
from __future__ import absolute_import
from django.conf.urls import url
from . import views
urlpatterns = [
url(
r"^(?P<uuid>[0-9a-f-]{36})/$",
views.RateView.as_view(),
name="rate"
),
url(
r"^2/(?P<uuid>[0-9a-f-]{36})/$",
views.Rate2... | RightToResearch/OpenCon-Rating-App | project/rating/urls.py | Python | mit | 365 | 0 |
from ..models import Post, Category, Tag
from django.db.models.aggregates import Count
from django import template
register = template.Library()
# 最近文章
@register.simple_tag
def get_recent_posts(num=9):
return Post.objects.all().order_by('-modified_time')[:num]
# 按月归档
@register.simple_tag
def archi... | RewrZ/RewrZ | rewrz/blog/templatetags/blog_tags.py | Python | agpl-3.0 | 698 | 0.010479 |
# -*- coding: utf-8 -*-
import httplib as http
import mock
from nose.tools import * # noqa
from boto.exception import S3ResponseError
from framework.auth import Auth
from tests.base import get_default_metaschema
from tests.factories import ProjectFactory, AuthUserFactory
from website.addons.base import testing
from... | monikagrabowska/osf.io | website/addons/s3/tests/test_view.py | Python | apache-2.0 | 12,215 | 0.001474 |
import numpy as np
import matplotlib.pyplot as plt
from shapely.geometry.polygon import Polygon
from shapely.geometry import MultiPolygon
import cell_tree2d
# create a rotated Cartesian grid
xc, yc = np.mgrid[1:10:15j, 1:20:18j]
yc = yc**1.2 + xc**1.5
def rot2d(x, y, ang):
'''rotate vectors by geometric angle''... | pyoceans/gridded | examples/make_test_grid.py | Python | mit | 1,437 | 0.004871 |
from django.conf import settings
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import gettext_lazy as _
from churchill.apps.core.models import BaseModel
from churchill.apps.currencies.services import get_default_currency_id
class StatsCalculationStrategy(model... | manti-by/Churchill | churchill/apps/profiles/models.py | Python | bsd-3-clause | 2,037 | 0 |
# coding=utf-8
# Copyright 2014 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 os
from pant... | pgroudas/pants | src/python/pants/backend/android/targets/android_resources.py | Python | apache-2.0 | 1,346 | 0.008172 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in ... | technologiescollege/Blockly-rduino-communication | scripts_XP/Lib/site-packages/autobahn/wamp/test/test_uri_pattern.py | Python | gpl-3.0 | 24,741 | 0.001495 |
#!/usr/bin/env python
# crc16.py by Bryan G. Olson, 2005
# This module is free software and may be used and
# distributed under the same terms as Python itself.
"""
CRC-16 in Python, as standard as possible. This is
the 'reflected' version, which is usually what people
want. See Ross N. Williams' /A Pain... | bapril/cfa_635 | cfa635/crc16.py | Python | apache-2.0 | 4,254 | 0.019041 |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
from datetime import date
from ggrc import db
from ggrc import builder
from ggrc... | hyperNURb/ggrc-core | src/tests/ggrc_workflows/generator.py | Python | apache-2.0 | 5,290 | 0.00397 |
import paho.mqtt.client as mqtt
import time
import json
import sys
import usbtmc
#should be unique for each Ioc
clientId = "itsPowerMeter01Ioc"
subscribeTopic = "itsPowerMeter01/set/#"
publishtopic = "itsPowerMeter01/get"
periodicPollPeriodSecs = 1
# Power meter initialization
usbInst = usbtmc.Instrument(2733, 27)
u... | se-esss-litterbox/ess-its | IceCubeIocPython/OldItsPowerMeterIoc.py | Python | gpl-3.0 | 3,050 | 0.003279 |
import datetime
import astropy
'''Boxing day is celebrated on the 26th of December, each year.
If Boxing day falls on the weekend it is moved to the following Monday or Tuesday
Boxing Day is observed on the 28th if the 26th falls on a Saturday or Sunday
'''
def get_holiday(year):
'''
Calculate the observed da... | shaneHowearth/Statutory_Holidays | Christmas_and_New_Year/Boxing_day.py | Python | gpl-2.0 | 1,049 | 0.003813 |
from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, antecedents, out_attributes, user_options, num_cores,
outfile):
from genomicode import filelib
import os
from genomicode imp... | jefftc/changlab | Betsy/Betsy/modules/plot_geneset_score_bar.py | Python | mit | 1,784 | 0.006726 |
test = {
'name': 'Question 4',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> rows7 = {('Joey', 7), ('Henry', 7)}
>>> rows6 = {('Ian', 6), ('Joyce', 6)}
>>> q4_answer[0] == ("John", 8)
True
>>> all([tuple(row) in rows7 fo... | DS-100/sp17-materials | sp17/labs/lab06/ok_tests/q4.py | Python | gpl-3.0 | 642 | 0.003115 |
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q
from zerver.models import Message, Realm, Recipient, Stream, Subscription, get_realm
class Command(BaseCommand):
help = "Generate statistics on the streams ... | showell/zulip | analytics/management/commands/stream_stats.py | Python | apache-2.0 | 2,358 | 0.003393 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, cint
from frappe import throw, _
from frappe.model.document import Document
class RootNotEditable(frappe.V... | hatwar/buyback-erpnext | erpnext/accounts/doctype/account/account.py | Python | agpl-3.0 | 8,576 | 0.024254 |
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesse... | FedoraScientific/salome-smesh | src/SMESH_SWIG/PAL_MESH_041_mesh.py | Python | lgpl-2.1 | 2,975 | 0.009748 |
//codecademy course answer
parrot = "Norwegian Blue"
print len(parrot)
| nurhandipa/python | codecademy/string_methods.py | Python | gpl-3.0 | 72 | 0 |
#!/usr/bin/python2
# Client code for Update Agent
# Copyright (c) 1999--2018 Red Hat, Inc. Distributed under GPLv2.
#
# Author: Adrian Likins <alikins@redhat.com
#
import os
__rhnexport__ = [
'reboot']
from up2date_client import up2dateLog
from up2date_client import config
cfg = config.initUp2dateConfig()
log... | mcalmer/spacewalk | client/rhel/rhn-client-tools/src/actions/reboot.py | Python | gpl-2.0 | 1,358 | 0.005891 |
# Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de
# Aplicacion de las TIC basadas en Fuentes Abiertas, Spain.
#
# 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 reta... | helix84/activae | deployment/__init__.py | Python | bsd-3-clause | 3,590 | 0 |
import logging
import sys
from argparse2tool import load_argparse
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class Arg2GxmlParser:
def __init__(self):
ap = load_argparse() # avoid circular imports
help_text = (
"argparse2tool forms Galaxy XML and CWL... | erasche/argparse2tool | argparse2tool/cmdline2gxml/__init__.py | Python | apache-2.0 | 1,040 | 0.002885 |
from test import support
syslog = support.import_module("syslog") #skip if not supported
import unittest
# XXX(nnorwitz): This test sucks. I don't know of a platform independent way
# to verify that the messages were really logged.
# The only purpose of this test is to verify the code doesn't crash or leak.
class T... | firmlyjin/brython | www/tests/unittests/test/test_syslog.py | Python | bsd-3-clause | 1,104 | 0.005435 |
# coding: utf-8
from __future__ import unicode_literals
import base64
import functools
import json
import re
import itertools
from .common import InfoExtractor
from ..compat import (
compat_kwargs,
compat_HTTPError,
compat_str,
compat_urlparse,
)
from ..utils import (
clean_html,
determine_ext... | remitamine/youtube-dl | youtube_dl/extractor/vimeo.py | Python | unlicense | 46,520 | 0.001721 |
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Documentation on PRESUBMIT.py can be found at:
# http://www.chromium.org/developers/how-tos/depottools/presubmit-scripts
import os
import sys
# ... | mxOBS/deb-pkg_trusty_chromium-browser | native_client/PRESUBMIT.py | Python | bsd-3-clause | 7,031 | 0.008107 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Xibo - Digitial Signage - http://www.xibo.org.uk
# Copyright (C) 2010-11 Alex Harrington
#
# This file is part of Xibo.
#
# Xibo is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free... | xibosignage/xibo-pyclient | plugins/media/MicroblogMedia.py | Python | agpl-3.0 | 27,626 | 0.010715 |
import json
from django.http import HttpResponse
from django.shortcuts import render
from torrents.logic import active_torrents_info
def active(request):
if request.is_ajax():
content = {"torrents": active_torrents_info()}
return HttpResponse(json.dumps(content), content_type="application/json")
... | onepesu/django_transmission | torrents/views.py | Python | mit | 371 | 0.002695 |
# 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/logs/controllers.py | Python | gpl-3.0 | 1,324 | 0.001511 |
from rhizome.tests.base_test_case import RhizomeApiTestCase
from rhizome.models.indicator_models import Indicator
from rhizome.models.document_models import SourceObjectMap, \
DocumentSourceObjectMap
from pandas import read_csv
from rhizome.tests.setup_helpers import TestSetupHelpers
class SourceObjectMapResour... | unicef/rhizome | rhizome/tests/test_api_source_object_map.py | Python | agpl-3.0 | 5,601 | 0.005892 |
#
# Copyright 2011-2013 Blender Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | pawkoz/dyplom | blender/intern/cycles/blender/addon/osl.py | Python | gpl-2.0 | 4,371 | 0.002974 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def isBalanced(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
return self... | liupangzi/codekata | leetcode/Algorithms/110.BalancedBinaryTree/Solution.py | Python | mit | 712 | 0.001404 |
#! /usr/bin/env python
import sys, glob
from astropy.io import fits
try: ext = int(sys.argv[2])
except: ext = 0
print sys.argv[1]
ims = glob.glob(sys.argv[1])
for im in ims:
print repr(fits.getheader(im, ext))
| Vb2341/image-junk | fhead.py | Python | mit | 217 | 0.018433 |
from __future__ import absolute_import
from .telegram import TelegramService
| brantje/telegram-github-bot | captain_hook/services/telegram/__init__.py | Python | apache-2.0 | 77 | 0 |
import sys
import subprocess
result = subprocess.Popen('sh test.sh', shell=True)
text = result.communicate()[0]
sys.exit(result.returncode)
| marcindulak/accts | accts/asegpaw/3.6.0-0.9.0.8965/ase/test.py | Python | gpl-3.0 | 142 | 0.007042 |
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICUL... | pmisik/buildbot | master/buildbot/test/unit/www/test_roles.py | Python | gpl-2.0 | 3,892 | 0.000514 |
import kivy
from kivy.app import App
from kivy.clock import Clock
from kivy.uix.popup import Popup
from kivy.uix.progressbar import ProgressBar
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty
kivy.require("1.9.1")
class MyPopupProgressBar(Widget):
progress_bar = ObjectProperty() # Ki... | bradfortner/Convergence-Jukebox-Experimental | working_popup_progress_bar rewrite.py | Python | gpl-3.0 | 1,763 | 0.016449 |
#!/usr/bin/env python
import string, copy
import sys
def read_fasta(afile, query_id=''):
"""Parses any fasta, a2m, a3m file, sequence or alignment file.
@param afile input file
@param query_id ID of query sequence (default='')
Ensures: key of a given query ID only contains its ID... | ElofssonLab/pcons-fold | pconsc/plotting/parse_fasta.py | Python | mit | 3,026 | 0.004296 |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
def plot_risk_grid(risk_grid, filename):
fig = plt.figure("Risk Map")
ax = fig.add_subplot(111)
ax.set_xlabel("X Location")
ax.set_ylabel("Y Location")
x_step = 1
y_step = 1
x_min = 0
y_min = 0
x_max = r... | wallarelvo/rover | rover/plot.py | Python | apache-2.0 | 3,026 | 0.00033 |
from .Peaks import Peaks
from .Amplitude import Amplitude
from .Combination import Combination
from .OutputFrame import OutputFrame
from .Track import Track
from .panels import Panel
import bpy
class SingleTrack(
bpy.types.PropertyGroup,
Panel,
Track,
Amplitude,
Combination,
OutputFrame,
Peaks
):
''' ... | CaptainDesAstres/Frames-Animated-By-Curve | single_track/SingleTrack.py | Python | gpl-3.0 | 1,451 | 0.052378 |
import json
import requests
from django.views.decorators.csrf import csrf_exempt
FB_MESSENGER_ACCESS_TOKEN = "[TOKEN]"
def respond_FB(sender_id, text):
json_data = {
"recipient": {"id": sender_id},
"message": {"text": text + " to you!"}
}
params = {
"access_token": FB_MESSENGER_A... | voidabhi/python-scripts | webhook-fb-messenger.py | Python | mit | 1,193 | 0.003353 |
#! /usr/bin/python
#--------------------------------------------------------------------
# PROGRAM : granule2map.py
# CREATED BY : hjkim @IIS.2015-07-13 11:56:07.989735
# MODIFED BY :
#
# USAGE : $ ./granule2map.py
#
# DESCRIPTION:
#------------------------------------------------------cf0.2@20120401
import ... | kimlab/GPyM | granule2map.py | Python | mit | 1,360 | 0.025735 |
'''A collection of tasks to perform related to Piwik custom variables.'''
import logging
import re
import dbsources
import dbengine
class Populate(object):
'''Take existing data and populate custom variables.'''
def __init__(self):
self.CONFIG = None # tables and fields to use
self.CONNECTION ... | bodleian/stats-time-cache | collate/custom_variables.py | Python | gpl-3.0 | 8,288 | 0.009411 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | skuda/client-python | kubernetes/client/models/v1_label_selector.py | Python | apache-2.0 | 4,559 | 0.001535 |
import pytest
from mock import Mock
from workbench.runtime import WorkbenchRuntime
from xblock.fields import ScopeIds
from xblock.runtime import DictKeyValueStore, KvsFieldData
from done.done import DoneXBlock
def generate_scope_ids(runtime, block_type):
""" helper to generate scope IDs for an XBlock """
de... | pmitros/DoneXBlock | tests/conftest.py | Python | agpl-3.0 | 842 | 0 |
from evosnap import constants
class POSDevice:
def __init__(self,**kwargs):
self.__order = [
'posDeviceType', 'posDeviceConnection', 'posDeviceColour', 'posDeviceQuantity',
]
self.__lower_camelcase = constants.ALL_FIELDS
self.pos_device_type = kwargs.get('pos_device_ty... | Zertifica/evosnap | evosnap/merchant_applications/pos_device.py | Python | mit | 806 | 0.007444 |
# Generated by Django 2.2.1 on 2019-05-08 23:41
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("private_sharing", "0022_auto_20190507_1843"),
("public_data", "0002_auto_20171213_1947"),
]
operations = [
... | OpenHumans/open-humans | public_data/migrations/0003_auto_20190508_2341.py | Python | mit | 834 | 0 |
# -*- coding: utf-8 -*-
"""
ctf.py -- contrast transfer function in electron tomography
Copyright 2014 Holger Kohr
This file is part of tomok.
tomok 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 versio... | kohr-h/tomok | ctf.py | Python | gpl-3.0 | 3,242 | 0.000925 |
# coding: utf-8
# Copyright (c) 2001-2018, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public transport:
# a non ending quest to... | xlqian/navitia | source/tyr/tests/integration/autocomplete_test.py | Python | agpl-3.0 | 9,528 | 0.001364 |
import collections
import warnings
from operator import add
import pytest
import numpy as np
import dask
import dask.array as da
from dask.highlevelgraph import HighLevelGraph
from dask.blockwise import Blockwise, rewrite_blockwise, optimize_blockwise, index_subs
from dask.array.utils import assert_eq
from dask.array... | ContinuumIO/dask | dask/array/tests/test_atop.py | Python | bsd-3-clause | 17,215 | 0.00151 |
"""Univariate features selection."""
# Authors: V. Michel, B. Thirion, G. Varoquaux, A. Gramfort, E. Duchesnay.
# L. Buitinck, A. Joly
# License: BSD 3 clause
import numpy as np
import warnings
from scipy import special, stats
from scipy.sparse import issparse
from ..base import BaseEstimator
from ..prepr... | chrsrds/scikit-learn | sklearn/feature_selection/univariate_selection.py | Python | bsd-3-clause | 28,149 | 0.000355 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 7, transform = "Difference", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Difference/trend_Lag1Trend/cycle_7/ar_12/test_artificial_128_Difference_Lag1Trend_7_12_20.py | Python | bsd-3-clause | 266 | 0.086466 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.