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 |
|---|---|---|---|---|---|---|
import os
from decimal import Decimal
import pytest
from polyglotdb import CorpusContext
@pytest.mark.acoustic
def test_analyze_vot(acoustic_utt_config, vot_classifier_path):
pytest.skip()
with CorpusContext(acoustic_utt_config) as g:
g.reset_acoustics()
g.reset_vot()
stops = ['p', ... | PhonologicalCorpusTools/PolyglotDB | tests/test_acoustics_vot.py | Python | mit | 1,599 | 0.005003 |
#In this problem you will analyze a profile log taken from a mongoDB instance. To start, please download sysprofile.json
#from Download Handout link and import it with the following command:
#
#mongoimport -d m101 -c profile < sysprofile.json
#Now query the profile data, looking for all queries to the students collect... | baocongchen/M101P-MONGODB-FOR-PYTHON-DEVELOPERS | week4/hw4-4/hw4-4.py | Python | mit | 595 | 0.021849 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | jiahaoliang/group-based-policy | gbpservice/tests/contrib/gbpfunctests/testcases/tc_gbp_ri_func_4.py | Python | apache-2.0 | 3,891 | 0.000257 |
import numpy as np
import scimath as sm
import matplotlib.pyplot as plt
import json
import yaml
import sys
import os
# Make sure that caffe is on the python path:
configStream = open("FluffyHaiiro.yaml", "r")
config = yaml.load(configStream)
caffe_root = config.get(':caffe_root_path')
sys.path.insert(0, caffe_root +... | Pirolf/Cabot | categorize.py | Python | mit | 2,623 | 0.0122 |
"""Tests for Table Schema integration."""
from collections import OrderedDict
import json
import numpy as np
import pytest
from pandas.core.dtypes.dtypes import (
CategoricalDtype,
DatetimeTZDtype,
PeriodDtype,
)
import pandas as pd
from pandas import DataFrame
import pandas._testing as tm
from pandas.i... | jorisvandenbossche/pandas | pandas/tests/io/json/test_json_table_schema.py | Python | bsd-3-clause | 28,054 | 0.000857 |
from rambutan3 import RArgs
from rambutan3.check_args.base.RInstanceMatcher import RInstanceMatcher
from rambutan3.check_args.set.RSetEnum import RSetEnum
class RSetMatcher(RInstanceMatcher):
def __init__(self, set_enum: RSetEnum):
RArgs.check_is_instance(set_enum, RSetEnum, "set_enum")
super()._... | kevinarpe/kevinarpe-rambutan3 | rambutan3/check_args/set/RSetMatcher.py | Python | gpl-3.0 | 347 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Yann GUIBET <yannguibet@gmail.com>
# See LICENSE for details.
from .openssl import OpenSSL
# For python3
def _equals_bytes(a, b):
if len(a) != len(b):
return False
result = 0
for x, y in zip(a, b):
result |= x ^ y
r... | cpacia/Subspace | subspace/pyelliptic/hash.py | Python | mit | 1,739 | 0 |
"""Tests for the Fronius sensor platform."""
from homeassistant.components.fronius.const import DOMAIN
from homeassistant.components.fronius.coordinator import (
FroniusInverterUpdateCoordinator,
FroniusMeterUpdateCoordinator,
FroniusPowerFlowUpdateCoordinator,
)
from homeassistant.components.sensor import ... | jawilson/home-assistant | tests/components/fronius/test_sensor.py | Python | apache-2.0 | 29,800 | 0.004832 |
import time
import sys
import array
# show start
def py_add(A,B,size):
i = 0
while i < size:
A[i] = A[i] + B[i]
i += 1
# show stop
if __name__ == '__main__':
s = int(sys.argv[1])
j = int(sys.argv[2])
a = array.array('d', [0.0]*s)
b = array.array('d', [1.0]*s)
for i in rang... | planrich/pypy-simd-benchmark | user/add.py | Python | gpl-3.0 | 458 | 0.019651 |
#! /usr/bin/env python
class Duck:
"""
this class implies a new way to express polymorphism using duck typing.
This class has 2 functions: quack() and fly() consisting no parameter.
"""
def quack(self):
print("Quack, quack!");
def fly(self):
print("Flap, Flap!");
... | IPVL/Tanvin-PythonWorks | pythonOOP/codes/duck_test.py | Python | mit | 722 | 0.01662 |
import urllib.request
import json
import webbrowser
___author___ = 'D4rkC00d3r'
bssid = input('Enter a BSSID: ') # Mac address of AP you want to locate
api_uri = 'https://api.mylnikov.org/geolocation/wifi?v=1.1&data=open&bssid=' # Api endpoint for database.
map_url = 'http://find-wifi.mylnikov.org/#' # Map provide... | D4rkC00d3r/locatebssid | locatebssid.py | Python | gpl-3.0 | 1,239 | 0.002421 |
import shelve
import pytest
import schedule2 as schedule
@pytest.yield_fixture
def db():
with shelve.open(schedule.DB_NAME) as the_db:
if schedule.CONFERENCE not in the_db:
schedule.load_db(the_db)
yield the_db
def test_record_attr_access():
rec = schedule.Record(spam=99, eggs=1... | everaldo/example-code | 19-dyn-attr-prop/oscon/test_schedule2.py | Python | mit | 1,753 | 0 |
from ctypes import *
wemoDll = cdll.LoadLibrary("WeMo.dll")
def turn_on():
wemoDll.turnOn()
def turn_off():
wemoDll.turnOff()
def get_state():
return wemoDll.getState() > 0
if __name__ == '__main__':
import time
turn_on()
print get_state()
time.sleep(3.0)
turn_off()
print get_st... | henningpohl/WeMo | wemo.py | Python | mit | 327 | 0.015291 |
# -*- coding: utf-8 -*-
"""
This module contains backports to support older Python versions.
They contain the backported code originally developed for Python. It is
therefore distributed under the PSF license, as follows:
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
--------------------------------------------
1. Th... | valhallasw/pywikibot-core | pywikibot/backports.py | Python | mit | 6,204 | 0.000322 |
import sys
import sdl2.ext
def run():
resources = sdl2.ext.Resources(__file__, "platformer")
sdl2.ext.init()
window = sdl2.ext.Window("SRG", size=(200, 200))
window.show()
factory = sdl2.ext.SpriteFactory(sdl2.ext.SOFTWARE)
sprite = factory.from_image(resources.get_path("sky0.png"))
s2 = sp... | anokata/pythonPetProjects | var_scripts/sdl_test.py | Python | mit | 1,486 | 0.003365 |
{% if current_user %}<script>
// Add the snippet here with account id
// Assuming your page has loaded the current user as the object current_user
chmln.identify({
uid: '{{ current_user.id }}',
created: '{{ current_user.created_at }}',
email: '{{ current_user.email }}',
plan: '{{ current_user.acco... | trychameleon/snippet.js | examples/chameleon-python.py | Python | mit | 415 | 0.031325 |
# -*- coding: utf-8 -*-
#
# NFD - Named Data Networking Forwarding Daemon documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 6 19:58:22 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are prese... | chris-wood/onpath-NFD | docs/conf.py | Python | gpl-3.0 | 9,075 | 0.00595 |
prices = [2, 1, 2, 1, 2, 1]
total = 0
for i in xrange(1, len(prices), 2):
total += prices[i] - prices[i-1]
print total | quake0day/oj | ttt.py | Python | mit | 123 | 0.00813 |
# coding=utf-8
# Copyright 2018 The DisentanglementLib 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
#
# Un... | google-research/disentanglement_lib | disentanglement_lib/evaluation/abstract_reasoning/relational_layers_test.py | Python | apache-2.0 | 4,868 | 0.003698 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""--- Day 3: Perfectly Spherical Houses in a Vacuum ---
Santa is delivering presents to an infinite two-dimensional grid of houses.
He begins by delivering a present to the house at his starting location, and
then an elf at the North Pole calls him via radio and tells hi... | MattJDavidson/python-adventofcode | advent/problem_03.py | Python | bsd-2-clause | 3,424 | 0.000292 |
"""Copyright 2008 Orbitz WorldWide
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwa... | absalon-james/graphite-api | graphite_api/utils.py | Python | apache-2.0 | 2,513 | 0.000398 |
#
# This file is part of Gruvi. Gruvi is free software available under the
# terms of the MIT license. See the file "LICENSE" that was provided
# together with this source file for the licensing terms.
#
# Copyright (c) 2012-2014 the Gruvi authors. See the file "AUTHORS" for a
# complete list.
from __future__ import a... | swegener/gruvi | tests/test_poll.py | Python | mit | 8,350 | 0.004192 |
# BurnMan - a lower mantle toolkit
# Copyright (C) 2012, 2013, Heister, T., Unterborn, C., Rose, I. and Cottaar, S.
# Released under GPL v2 or later.
"""
example_composition
-------------------
This example shows how to create different minerals, how to compute seismic
velocities, and how to compare them to a se... | QuLogic/burnman | examples/example_composition.py | Python | gpl-2.0 | 6,658 | 0.016822 |
def print_rangoli(size):
# your code goes here
if __name__ == '__main__':
n = int(input())
print_rangoli(n)
| jerodg/hackerrank-python | python/02.Strings/10.AlphabetRangoli/template.py | Python | mit | 118 | 0.016949 |
# Copyright 2011-2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
'''
Blocks and utilities for digital modulation and demodulation.
'''
from __future__ import absolute_import
from __future__ import unicode_literals
# The presence of this file tu... | TheWylieStCoyote/gnuradio | gr-digital/python/digital/__init__.py | Python | gpl-3.0 | 1,013 | 0 |
import random
from datetime import datetime
from multiprocessing import Pool
import numpy as np
from scipy.optimize import minimize
def worker_func(args):
self = args[0]
m = args[1]
k = args[2]
r = args[3]
return (self.eval_func(m, k, r) -
self.eval_func(m, k, self.rt) -
... | ndt93/tetris | scripts/agent3.py | Python | mit | 5,234 | 0 |
from . import NamedEntity
class Application(NamedEntity):
def __init__(self, name, provider):
NamedEntity.__init__(self, name)
self.provider = provider
def get_descendants(self):
return []
| stlemme/python-dokuwiki-export | entities/application.py | Python | mit | 202 | 0.034653 |
# Copyright 2016 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... | jjas0nn/solvem | tensorflow/lib/python2.7/site-packages/tensorflow/contrib/slim/python/slim/learning_test.py | Python | mit | 34,627 | 0.008981 |
# follow/models.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from datetime import datetime, timedelta
from django.db import models
from election.models import ElectionManager
from exception.models import handle_exception, handle_record_found_more_than_one_exception,\
handle_record_not_found_exc... | wevote/WeVoteServer | follow/models.py | Python | mit | 78,451 | 0.004015 |
# Copyright 2015 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... | aselle/tensorflow | tensorflow/python/estimator/keras.py | Python | apache-2.0 | 21,876 | 0.006491 |
import sys
sys.path.insert(1, "../../")
import h2o
def pyunit_assign(ip,port):
pros = h2o.import_file(h2o.locate("smalldata/prostate/prostate.csv"))
pq = pros.quantile()
PSA_outliers = pros[pros["PSA"] <= pq[1,1] or pros["PSA"] >= pq[1,9]]
PSA_outliers = h2o.assign(PSA_outliers, "PSA.outliers")
p... | weaver-viii/h2o-3 | h2o-py/tests/testdir_misc/pyunit_assign.py | Python | apache-2.0 | 567 | 0.012346 |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/raw/GL/ATI/pixel_format_float.py | Python | lgpl-3.0 | 648 | 0.023148 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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.
#
... | DepthDeluxe/ansible | lib/ansible/modules/windows/win_scheduled_task.py | Python | gpl-3.0 | 3,418 | 0.000585 |
from freezegun import freeze_time
import sure # noqa
from moto.swf.models import Timeout
from ..utils import make_workflow_execution
def test_timeout_creation():
wfe = make_workflow_execution()
# epoch 1420113600 == "2015-01-01 13:00:00"
timeout = Timeout(wfe, 1420117200, "START_TO_CLOSE")... | william-richard/moto | tests/test_swf/models/test_timeout.py | Python | apache-2.0 | 501 | 0 |
from ..exception import FuzzExceptBadOptions
import re
import collections
from ..facade import BASELINE_CODE
class FuzzResSimpleFilter:
def __init__(self, ffilter=None):
self.hideparams = dict(
regex_show=None,
codes_show=None,
codes=[],
words=[],
... | xmendez/wfuzz | src/wfuzz/filters/simplefilter.py | Python | gpl-2.0 | 3,567 | 0.00028 |
from multiprocessing import Pool
from client import FlurryClient, get_id
import time
p = Pool(10)
p.map_async(get_id, [('localhost', 9090, 10000)])
# p.map_async(get_id, [('localhost', 9091, 10000)] * 2)
# p.join()
p.close()
p.join()
# time.sleep(2) | isterin/flurry | examples/python/load_tests.py | Python | apache-2.0 | 252 | 0.003968 |
# Copyright 2015 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... | neilhan/tensorflow | tensorflow/python/framework/ops.py | Python | apache-2.0 | 150,185 | 0.005413 |
from docutils.parsers.rst import Directive, directives
from docutils import nodes
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
from sphinx.util import compat
compat.make_admonition = BaseAdmonition
from sphinx import addnodes
from sphinx.locale import _
class bestpractice(nodes.Admonition, ... | takeit/web-publisher | docs/_extensions/sensio/sphinx/bestpractice.py | Python | agpl-3.0 | 1,458 | 0.006173 |
from pathlib import Path
import xarray
KEY = 'imgs' # handle to write inside the output file
CLVL = 1 # ZIP compression level
def writeframes(outfn: Path, img: xarray.DataArray):
"""writes image stack to disk"""
assert img.ndim == 3
if outfn is None:
return
outfn = Path(outfn).expanduser(... | scivision/raspberrypi_raw_camera | pibayer/io.py | Python | mit | 1,418 | 0 |
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2017 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it a... | sanguinariojoe/FreeCAD | src/Mod/Path/PathTests/TestPathTool.py | Python | lgpl-2.1 | 4,116 | 0.001944 |
#!./uwsgi --http-socket :9090 --async 100 ...
# same chat example but using uwsgi async api
# for pypy + continulets just run:
# uwsgi --http-socket :9090 --pypy-home /opt/pypy --pypy-wsgi-file tests/websockets_chat_async.py --pypy-eval "uwsgi_pypy_setup_continulets()" --async 100
import uwsgi
import time
import redis
... | goal/uwsgi | tests/websockets_chat_async.py | Python | gpl-2.0 | 3,284 | 0.000914 |
"""
Usage:
import_localities < Localities.csv
"""
from django.contrib.gis.geos import GEOSGeometry
from django.utils.text import slugify
from ..import_from_csv import ImportFromCSVCommand
from ...utils import parse_nptg_datetime
from ...models import Locality
class Command(ImportFromCSVCommand):
"""
Impo... | jclgoodwin/bustimes.org.uk | busstops/management/commands/import_localities.py | Python | mpl-2.0 | 2,629 | 0.001902 |
"""!
@brief CCORE Wrapper for MBSAS algorithm.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
from ctypes import c_double, c_size_t, POINTER;
from pyclustering.core.wrapper import ccore_library;
from pyclustering.core.pyclustering_package import pycluste... | annoviko/pyclustering | pyclustering/core/mbsas_wrapper.py | Python | gpl-3.0 | 842 | 0.015439 |
"""Make session:proposal 1:1.
Revision ID: 3a6b2ab00e3e
Revises: 4dbf686f4380
Create Date: 2013-11-09 13:51:58.343243
"""
# revision identifiers, used by Alembic.
revision = '3a6b2ab00e3e'
down_revision = '4dbf686f4380'
from alembic import op
def upgrade():
op.create_unique_constraint('session_proposal_id_key... | hasgeek/funnel | migrations/versions/3a6b2ab00e3e_session_proposal_one.py | Python | agpl-3.0 | 441 | 0.004535 |
#!/usr/bin/python2.5
# Copyright (C) 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | google/transitfeed | transitfeed/farerule.py | Python | apache-2.0 | 2,778 | 0.009359 |
################################################################
### functions specific to text line processing
### (text line segmentation is in lineseg)
################################################################
from scipy import stats
from scipy.ndimage import interpolation,morphology,filters
from pylab impor... | stweil/ocropy | OLD/lineproc.py | Python | apache-2.0 | 6,891 | 0.026411 |
from django.conf.urls import patterns, url
urlpatterns = patterns(
'us_ignite.blog.views',
url(r'^$', 'post_list', name='blog_post_list'),
url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<slug>[-\w]+)/$',
'post_detail', name='blog_post_detail'),
)
| us-ignite/us_ignite | us_ignite/blog/urls.py | Python | bsd-3-clause | 266 | 0 |
import xbmcgui
import urllib
def download(url, dest, dp = None):
if not dp:
dp = xbmcgui.DialogProgress()
dp.create("XBMCHUB...","Downloading & Copying File",' ', ' ')
dp.update(0)
urllib.urlretrieve(url,dest,lambda nb, bs, fs, url=url: _pbhook(nb,bs,fs,url,dp))
def _pbhook(numblocks, blo... | aplicatii-romanesti/allinclusive-kodi-pi | .kodi/addons/plugin.video.familyfunflix/downloader.py | Python | apache-2.0 | 588 | 0.027211 |
# $language = "python"
# $interface = "1.0"
# for GCCLABVM1,GCCLABVM2
import os
import csv
def main():
crt.Screen.Synchronous = True
# Create an Excel compatible spreadsheet
filename = crt.Dialog.Prompt("Enter file name to write to: ", "Show Interface Description", "intdesc.csv", False)
fileobj = open(filename... | kelvinongtoronto/SecureCRT | shintdesc_legacy.py | Python | artistic-2.0 | 1,392 | 0.03592 |
"""
Sending/Receiving Messages.
"""
from itertools import count
from carrot.utils import gen_unique_id
import warnings
from carrot import serialization
class Consumer(object):
"""Message consumer.
:param connection: see :attr:`connection`.
:param queue: see :attr:`queue`.
:param exchange: see :att... | ask/carrot | carrot/messaging.py | Python | bsd-3-clause | 37,722 | 0.000265 |
from ..base import HaravanResource
class ShippingLine(HaravanResource):
pass
| Haravan/haravan_python_api | haravan/resources/shipping_line.py | Python | mit | 83 | 0 |
"""
RendererResult
"""
class RendererResult(object):
def __init__(self):
self.string_stream = ''
def append(self, s):
self.string_stream += s
def pop_back(self, index=1):
self.string_stream = self.string_stream[:-index]
def get_string(self):
return self.string_stream
| svperbeast/plain_data_companion | src/templates/renderer_result.py | Python | mit | 320 | 0.003125 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'CourseProfessor.is_course_author'
db.add_column(u'core_co... | AllanNozomu/tecsaladeaula | core/migrations/0029_auto__add_field_courseprofessor_is_course_author.py | Python | agpl-3.0 | 13,255 | 0.007922 |
# scarf1{background-image: url('https://rollforfantasy.com/images/clothing/nmale/scarf1.png');}
scarf = ["scarf{}.png".format(i) for i in range(1, 31)]
| d2emon/generator-pack | src/fixtures/tools/outfit/scarf.py | Python | gpl-3.0 | 152 | 0.006579 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('visit', '0073_visit_student_absent_reason'),
]
operations = [
migrations.AlterField(
model_name='visit',
... | koebbe/homeworks | visit/migrations/0074_auto_20150826_2122.py | Python | mit | 670 | 0.002985 |
############################################################################
# Joshua Boverhof<JRBoverhof@lbl.gov>, LBNL
# Monte Goode <MMGoode@lbl.gov>, LBNL
# See Copyright for copyright notice!
############################################################################
import exceptions, sys, optparse, os, warning... | sassoftware/catalog-service | catalogService/libs/viclient_vendor/ZSI/generate/commands.py | Python | apache-2.0 | 19,840 | 0.009224 |
#!/usr/bin/python
# Python library for ADXL345 accelerometer.
# Copyright 2013 Adafruit Industries
# 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 the Software without restriction, including without li... | cmuphyscomp/physcomp-examples | support/rpi/Adafruit-Raspberry-Pi-Python-Code-master/Adafruit_ADXL345/Adafruit_ADXL345.py | Python | bsd-3-clause | 3,978 | 0.008296 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('QuickBooking', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='timing',
name='i... | noorelden/QuickBooking | QuickBooking/migrations/0002_auto_20150623_1913.py | Python | gpl-2.0 | 450 | 0.002222 |
# Orca
#
# Copyright 2012 Igalia, S.L.
#
# Author: Joanmarie Diggs <jdiggs@igalia.com>
#
# 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 Software Foundation; either
# version 2.1 of the License, or (at your o... | GNOME/orca | src/orca/orca_gui_navlist.py | Python | lgpl-2.1 | 6,822 | 0.001906 |
# We slice the array in two parts at index d, then print them
# in reverse order.
n, d = map(int, input().split())
A = list(map(int, input().split()))
print(*(A[d:] + A[:d]))
| yznpku/HackerRank | solution/practice/data-structures/arrays/array-left-rotation/solution.py | Python | mit | 177 | 0.00565 |
"""
REQUIREMENTS:
- install pip with distribute (http://packages.python.org/distribute/)
- sudo pip install Fabric
"""
from fabric.api import local
def lang(mode="extract"):
"""
REQUIREMENTS:
- Install before pip with distribute_setup.py (Read the environment setup document)
... | Tibo-R/jamplaygen | fabfile.py | Python | lgpl-3.0 | 2,830 | 0.006007 |
import sys; sys.dont_write_bytecode = True; from mcpower_utils import *
def do_case(inp: str, sample=False):
# READ THE PROBLEM FROM TOP TO BOTTOM OK
def sprint(*a, **k): sample and print(*a, **k)
lines: typing.List[str] = inp.splitlines()
paras: typing.List[typing.List[str]] = lmap(str.splitlines, inp... | saramic/learning | dojo/adventofcode.com/2021/catchup/mcpower-day19_2.py | Python | unlicense | 4,767 | 0.004615 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# written by Shotaro Fujimoto
# 2016-05-30
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from triangular import LatticeTriangular as LT
from base import Main as base
import numpy as np
import random
from tqdm import tq... | ssh0/growing-string | triangular_lattice/moving_string/moving_string_deadlock.py | Python | mit | 5,500 | 0.013057 |
import os
import pickle
from astropy.extern import six
import numpy as np
from numpy.testing import assert_allclose
from scipy.interpolate import RectBivariateSpline
import sncosmo
from sncosmo.salt2utils import BicubicInterpolator, SALT2ColorLaw
# On Python 2 highest protocol is 2.
# Protocols 0 and 1 don't work o... | dannygoldstein/sncosmo | sncosmo/tests/test_salt2utils.py | Python | bsd-3-clause | 3,927 | 0.000255 |
import tornado.gen
from .models import Feed
# Handlers in Tornado like Views in Django
class FeedHandler(tornado.web.RequestHandler):
@tornado.gen.coroutine
def get(self):
feed = yield Feed.fetch()
self.write(feed)
| rudyryk/python-samples | hello_tornado/hello_feed/core/handlers.py | Python | cc0-1.0 | 240 | 0.004167 |
from vpp_interface import VppInterface
import socket
class VppGreInterface(VppInterface):
"""
VPP GRE interface
"""
def __init__(self, test, src_ip, dst_ip, outer_fib_id=0, is_teb=0):
""" Create VPP loopback interface """
self._sw_if_index = 0
super(VppGreInterface, self).__i... | milanlenco/vpp | test/vpp_gre_interface.py | Python | apache-2.0 | 2,595 | 0 |
from Bio import SeqIO
def get_proteins_for_db(fastafn, fastadelim, genefield):
"""Runs through fasta file and returns proteins accession nrs, sequences
and evidence levels for storage in lookup DB. Duplicate accessions in
fasta are accepted and removed by keeping only the last one.
"""
records = {... | glormph/msstitch | src/app/readers/fasta.py | Python | mit | 4,853 | 0.002885 |
#!/usr/bin/env python3
###############################################################################
# Copyright 2017 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/ota/create_sec_package.py | Python | apache-2.0 | 1,573 | 0 |
# Copyright 2015 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... | nburn42/tensorflow | tensorflow/python/training/session_manager_test.py | Python | apache-2.0 | 32,764 | 0.009095 |
################################################################################
# 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... | StephanEwen/incubator-flink | flink-python/pyflink/fn_execution/coder_impl_slow.py | Python | apache-2.0 | 28,735 | 0.001183 |
#!/usr/bin/env python3
import logging
import signal
from typing import List
import elli
from LTL_to_atm import translator_via_spot
from config import Z3_PATH
from syntcomp.rally_template import main_template
from syntcomp.task import Task
from syntcomp.task_creator import TaskCreator
from synthesis.z3_via_pipe import ... | 5nizza/party-elli | rally_elli_bool.py | Python | mit | 3,337 | 0.002997 |
#!/usr/bin/env python
'''
Solves Rosenbrock's Unconstrained Problem.
min 100*(x2-x1^2)**2 + (1-x1)^2
s.t.: -10 <= xi <= 10, i = 1,2
f* = 0 , x* = [1, 1]
'''
# =============================================================================
# Standard Python modules
# =================================... | svn2github/pyopt | examples/rosenbrock.py | Python | gpl-3.0 | 2,679 | 0.011945 |
from django.test import TestCase
from .models import Clothes
class ClothesModelTests(TestCase):
def setUp(self):
Clothes.objects.create(clothes_type='ladies dress', price=28.50)
Clothes.objects.create(clothes_type='men tie', price=8.50)
def test_number_of_clothes_created(self):
se... | Meerkat007/Clothes-Shop-Website | server/clothes/tests.py | Python | mit | 369 | 0.00542 |
#!/usr/bin/env python3
import os
import crossval, features, estimators, estpicker, bootstrap
def Vecuum():
print('\nGROUP CHOICES (automated order: 2,1,0,4,3,5,11,10,12)')
print('\nSymptom Severity:\n')
print(' 0= control/mild\n 1= control/severe\n 2= control/very severe\n 3= mild/severe\n 4= mild/ve... | jrabenoit/shopvec | shopvec.py | Python | gpl-3.0 | 1,402 | 0.017832 |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: mcp/v1alpha1/resource.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from ... | istio/api | python/istio_api/mcp/v1alpha1/resource_pb2.py | Python | apache-2.0 | 3,416 | 0.005269 |
from django.db import models
class NonTradingDay(models.Model):
non_trading_date = models.DateField()
class Meta:
ordering = ('non_trading_date',)
verbose_name = 'Non Trading Day'
verbose_name_plural = 'Non Trading Days'
def __unicode__(self):
return self.non_t... | rodxavier/open-pse-initiative | django_project/market/models.py | Python | mit | 445 | 0.008989 |
#!/usr/bin/env python
# Meran - MERAN UNLP is a ILS (Integrated Library System) wich provides Catalog,
# Circulation and User's Management. It's written in Perl, and uses Apache2
# Web-Server, MySQL database and Sphinx 2 indexing.
# Copyright (C) 2009-2013 Grupo de desarrollo de Meran CeSPI-UNLP
#
# This file is part ... | Desarrollo-CeSPI/meran | dev-plugins/node64/lib/node/wafadmin/Utils.py | Python | gpl-3.0 | 20,212 | 0.030972 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_ve... | alxgu/ansible | lib/ansible/modules/network/aci/mso_schema_site_vrf_region.py | Python | gpl-3.0 | 6,343 | 0.002207 |
import abc
import inspect
import re
from mountapi.core import exceptions
class AbstractConverter(metaclass=abc.ABCMeta):
param_url: str = None
param_regex: str = None
@classmethod
def path_to_regex(cls, path):
return re.sub(cls.param_url, cls.param_regex, path) + '$'
class IntConverter(Abs... | pyQuest/mount-api | mountapi/schema.py | Python | apache-2.0 | 2,575 | 0 |
import requests
from requests.auth import HTTPBasicAuth
def get_data(config):
auth = HTTPBasicAuth(config['authentication']['username'], config['authentication']['password'])
resp = requests.get(config['host'] + '/api/queues', auth=auth)
queues = resp.json()
data = {}
for queue in queues:
... | kierenbeckett/sentinel | sentinel/alert_plugins/rabbit_queues.py | Python | apache-2.0 | 1,275 | 0.003922 |
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | LockScreen/Backend | venv/lib/python2.7/site-packages/awscli/customizations/cloudsearch.py | Python | mit | 4,291 | 0.000466 |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import textwrap
from textwrap import dedent
from pants.engine.internals.native_engine import FileDigest
from pants.jvm.resolve.common import ArtifactRequirement, Coordinate, Coordinates
fr... | pantsbuild/pants | src/python/pants/jvm/run_deploy_jar_intergration_test.py | Python | apache-2.0 | 4,405 | 0.001135 |
#!/usr/bin/env python
__author__ = 'heroico'
########################################################################################################################
# Gathers statistics on allele information.
# Produces a csv with the following columns:
# rsid,chromosome,wdb_ref_allele,wdb_eff_allele,legend_ref_allel... | hakyimlab/MetaXcan-Postprocess | source/deprecated/ProcessAlleleStatistics.py | Python | mit | 9,438 | 0.004238 |
import uuid
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import select, func
from sqlalchemy.ext.hybrid import hybrid_property
db = SQLAlchemy()
# Base model that for other models to inherit from
class Base(db.Model):
__abstract__ = True
id = db.Column(db.Integer, primary_key=True, autoincremen... | viniciusfk9/LearningFlask | votr/models.py | Python | gpl-3.0 | 3,878 | 0.001031 |
# Copyright (c) 2016, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions a... | ledatelescope/bifrost | test/test_gunpack.py | Python | bsd-3-clause | 4,872 | 0.007594 |
#!/usr/bin/env python3
"""
# USAGE
# make_generated_output.py <path to config file for gradeable> <assignment> <semester> <course>
"""
import argparse
import json
import os
from submitty_utils import dateutils
import sys
SUBMITTY_DATA_DIR = "/var/local/submitty"
def parse_args():
parser = argparse.Argume... | RCOS-Grading-Server/HWserver | bin/make_generated_output.py | Python | bsd-3-clause | 2,717 | 0.009201 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""CNF formulas type with support of linear forms
This CNF formula type supports
- linear equations mod 2
- integer linear inequalities on literals (no coefficients)
for example 'atmost k'
Copyright (C) 2021 Massimo Lauria <lauria.massimo@gmail.com>
https://github.com/... | MassimoLauria/cnfgen | cnfgen/formula/linear.py | Python | gpl-3.0 | 7,042 | 0.000142 |
class Paginator(object):
def __init__(self, collection, page_number=0, limit=20, total=-1):
self.collection = collection
self.page_number = int(page_number)
self.limit = int(limit)
self.total = int(total)
@property
def page(self):
start = self.page_number * ... | michaelcontento/whirlwind | whirlwind/view/paginator.py | Python | mit | 1,921 | 0.008329 |
"""sparql_select_result.py
Data structure for storing the results of SPARQL SELECT queries"""
__all__ = ["SPARQLSelectResult"]
from xml.etree import ElementTree as et
class SPARQLSelectResult(object):
def __init__(self):
self.variables = []
self.results = []
def parse(self, s):
tree = et.fromstring(s)
head = ... | iand/pynappl | old/sparql_select_result.py | Python | gpl-2.0 | 1,296 | 0.026235 |
import platform
import importlib
from utils.pyx_replace import read_file
name = 'cython._genpyx_' + '_'.join(platform.architecture()) + '_chess0x88'
try:
chess = importlib.import_module(name)
checksum = chess.CHECKSUM
expected_checksum = read_file("chess0x88.py", [], "cython")
if checksum != expected_... | GRUPO-ES2-GJLRT/XADREZ_ES2 | src/cython/importer.py | Python | mit | 665 | 0 |
import six
from django import template
from oscar.core.loading import get_model
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import resolve, Resolver404
from oscar.apps.customer import history
from oscar.core.compat import urlparse
Site = get_model('sites', 'Site')
register =... | MrReN/django-oscar | oscar/templatetags/history_tags.py | Python | bsd-3-clause | 1,884 | 0.000531 |
from __future__ import print_function
import os
import sys
import imp
import shutil
from glob import glob
from pprint import pprint
from cStringIO import StringIO
class Capturing(list):
def __enter__(self):
self._stdout = sys.stdout
sys.stdout = self._stringio = StringIO()
return self
... | plin1112/pysimm | tests/test.py | Python | mit | 1,809 | 0.012714 |
#!/usr/bin/python
#This is the old version of Tactix befor I decided to make the C version.
#I hope you all like it.
#I wanted to include it to make sure even if you only have a monochrome display you can still play!
# * HORRAY FOR GAMERS!
#I may very well have modded this a bit too, just so it feels more like the fu... | M3TIOR/Tactix | Tactix.py | Python | mit | 2,700 | 0.047778 |
from importlib import import_module
from django.apps import AppConfig as BaseAppConfig
class AppConfig(BaseAppConfig):
name = "moleculeci"
def ready(self):
import_module("moleculeci.receivers")
| iModels/ffci | moleculeci/apps.py | Python | mit | 215 | 0 |
# -*- coding: utf-8 -*-
# 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 the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub... | ngageoint/gamification-server | gamification/core/models.py | Python | mit | 7,022 | 0.003987 |
"""Copyright 2008 Orbitz WorldWide
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | Talkdesk/graphite-web | webapp/graphite/browser/views.py | Python | apache-2.0 | 7,137 | 0.026482 |
#!/usr/bin/env python
""" Patch utility to apply unified diffs
Brute-force line-by-line non-recursive parsing
Copyright (c) 2008-2012 anatoly techtonik
Available under the terms of MIT license
Project home: http://code.google.com/p/python-patch/
$Id: patch.py 181 2012-11-23 16:03:05Z techtonik... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/doc/patch.py | Python | gpl-3.0 | 34,815 | 0.014074 |
"""
APIs that deal with the edx cached data
"""
import datetime
import logging
from collections import namedtuple
from django.db import transaction
from requests.exceptions import HTTPError
from edx_api.client import EdxApi
from backends import utils
from backends.constants import COURSEWARE_BACKEND_URL, BACKEND_EDX_... | mitodl/micromasters | dashboard/api_edx_cache.py | Python | bsd-3-clause | 15,571 | 0.002954 |
# Test script. Tests GUI scroll movement commands.
# Created by Toni Sagrista
from gaia.cu9.ari.gaiaorbit.script import EventScriptingInterface
gs = EventScriptingInterface.instance()
gs.disableInput()
gs.cameraStop()
gs.setGuiScrollPosition(20.0)
gs.sleep(1)
gs.setGuiScrollPosition(40.0)
gs.sleep(1)
gs.setGuiScro... | vga101/gaiasky | assets/scripts/tests/scroll-test.py | Python | mpl-2.0 | 452 | 0 |
"""
This is a custom solr_backend for haystack. It fixes a few minor issues
with the out-of-the-box version.
1. Overrides the SolrSearchBackend._process_results() method. The
out-of-the-box haystack version uses pysolr._to_python() to parse any
results for indexes that aren't managed by haystack. This method for... | unt-libraries/catalog-api | django/sierra/sierra/solr_backend.py | Python | bsd-3-clause | 11,551 | 0.001472 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.