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 numpy as np
from astropy.coordinates import EarthLocation, SkyCoord
__all__ = ['MWA_LOC', 'MWA_FIELD_EOR0', 'MWA_FIELD_EOR1', 'MWA_FIELD_EOR2',
'MWA_FREQ_EOR_ALL_40KHZ', 'MWA_FREQ_EOR_ALL_80KHZ',
'MWA_FREQ_EOR_HI_40KHZ', 'MWA_FREQ_EOR_HI_80KHZ',
'MWA_FREQ_EOR_LOW_40KHZ', 'MWA_FR... | piyanatk/sim | opstats/utils/settings.py | Python | mit | 1,196 | 0.000838 |
# 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
# distributed under the Li... | alex/warehouse | tests/unit/i18n/test_init.py | Python | apache-2.0 | 1,717 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or impli... | splice/splice-server | src/splice/common/rhic_serve_client.py | Python | gpl-2.0 | 3,508 | 0.005703 |
from __future__ import unicode_literals
import copy
from dateutil.relativedelta import relativedelta
import six
from dash.utils import get_month_range
from django import forms
from django.forms.forms import DeclarativeFieldsMetaclass
from django.utils import timezone
from django.utils.translation import ugettext_l... | xkmato/tracpro | tracpro/charts/filters.py | Python | bsd-3-clause | 5,748 | 0.000696 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | ericmjl/bokeh | bokeh/io/output.py | Python | bsd-3-clause | 4,608 | 0.006293 |
"""The tests for the pilight component."""
from datetime import timedelta
import logging
import socket
from unittest.mock import patch
from voluptuous import MultipleInvalid
from homeassistant.components import pilight
from homeassistant.setup import async_setup_component
from homeassistant.util import dt as dt_util
... | partofthething/home-assistant | tests/components/pilight/test_init.py | Python | apache-2.0 | 14,678 | 0.000409 |
# Copyright (c) Mathias Kaerlev 2012.
# This file is part of OpenSND.
# OpenSND 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.
# Op... | matpow2/opensnd | frame2.py | Python | gpl-3.0 | 18,104 | 0.005689 |
'''
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2017 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
-----------------------------------... | fsxfreak/esys-pbi | src/pupil/pupil_src/player/player_methods.py | Python | mit | 13,738 | 0.012957 |
import errno
import os
from setuptools import Extension
from paver.easy import *
from paver.path import path
from paver.setuputils import setup
setup(
name="notifier",
description="A pre-connected mesh of servers for fast internal RPC",
version="1.0",
license="bsd",
author="Libor Michalek",
a... | slideinc/notifier | pavement.py | Python | bsd-3-clause | 1,537 | 0.003253 |
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# Copyright 2022 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# pylint: disable=locally-disabled, manifest-required-author
{
"name": "HR Timesheet - Workflow Policy",
"version": "8.0.1.0.0",
"cate... | open-synergy/opnsynid-hr | hr_timesheet_workflow_policy/__openerp__.py | Python | agpl-3.0 | 733 | 0 |
# -*- Python -*-
#
# Jiao Lin <jiao.lin@gmail.com>
#
plots_table = """
exp exp-sqe.h5
sim-singlephonon sp-sqe.h5
sim-multiphonon mp-sqe.h5
sim-multiple-scattering ms-sqe.h5
sim-correction sqe_correction.h5
exp-corrected-single-phonon corrected_sqe.h5
sim-total-inel total-inel-sqe.h5
exp-residual residual-sqe.h5
"""
p... | sns-chops/multiphonon | multiphonon/backward/_sqe2dos_script_templates.py | Python | mit | 1,493 | 0 |
class Solution:
"""
@param k: The number k.
@return: The kth prime number as description.
"""
def kthPrimeNumber(self, k):
# write your code here
q = [1]
i3 = i5 = i7 = 0
while len(q)-1 < k:
m3, m5, m7 = q[i3] * 3, q[i5] * 5, q[i7] * 7
m = min(m3, m5... | quake0day/oj | kthPrimeNumber.py | Python | mit | 527 | 0.043643 |
# Copyright 2017 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... | alexgorban/models | research/slim/nets/nasnet/nasnet_utils.py | Python | apache-2.0 | 20,826 | 0.007395 |
"""Auto-generated file, do not edit by hand. IE metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_IE = PhoneMetadata(id='IE', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='[159]\\d{2,5}', possible_number_pattern... | roubert/python-phonenumbers | python/phonenumbers/shortdata/region_IE.py | Python | apache-2.0 | 1,071 | 0.008403 |
#Embedded file name: ACEStream\Core\Statistics\VideoPlaybackCrawler.pyo
from time import strftime
import cPickle
import sys
import threading
import zlib
from ACEStream.Core.BitTornado.BT1.MessageID import CRAWLER_VIDEOPLAYBACK_INFO_QUERY, CRAWLER_VIDEOPLAYBACK_EVENT_QUERY
from ACEStream.Core.CacheDB.SqliteVideoPlayback... | aplicatii-romanesti/allinclusive-kodi-pi | .kodi/userdata/addon_data/plugin.video.p2p-streams/acestream/ace/ACEStream/Core/Statistics/VideoPlaybackCrawler.py | Python | apache-2.0 | 7,854 | 0.005857 |
import sys
import collections
class GeocoderResult(collections.Iterator):
"""
A geocoder resultset to iterate through address results.
Exemple:
results = Geocoder.geocode('paris, us')
for result in results:
print(result.formatted_address, result.location)
Provide shortcut to ease fiel... | zoeren/pygeocoder | pygeolib.py | Python | bsd-3-clause | 4,972 | 0.000603 |
from peewee import * # no other way to reach playhouse :(
from playhouse import flask_utils as peewee_flask_utils
from playhouse import signals as peewee_signals
database = peewee_flask_utils.FlaskDB()
| thedod/boilerplate-peewee-flask | application/sitepack/db.py | Python | gpl-3.0 | 204 | 0 |
from django.apps import AppConfig
class CirculoConfig(AppConfig):
name = 'circulo'
| jstitch/gift_circle | GiftCircle/circulo/apps.py | Python | gpl-3.0 | 89 | 0 |
# -*- coding: utf-8 -*-
"""
Contains classes to handle images related things
# Requires PIL
"""
from hyde.plugin import Plugin
import re
import Image
class ImageSizerPlugin(Plugin):
"""
Each HTML page is modified to add width and height for images if
they are not already specified.
"""
def __in... | Valloric/hyde | hyde/ext/plugins/images.py | Python | mit | 5,652 | 0.000885 |
from bases import *
from inanimate import Bullet
class Player(AnimateObject):
def __init__(self, x=0, y=0, hits=MAX_HEALTH, timer=TIMER, damage=1, score=0):
super(Player, self).__init__(x, y, hits, timer)
self.damage = damage
self.score = score
def shoot(self):
... | elenaod/PythonScrollingShooter | player.py | Python | gpl-3.0 | 743 | 0.004038 |
from midx.notify.common import iter_modified_files
| mikeboers/midx | midx/notify/__init__.py | Python | bsd-3-clause | 51 | 0 |
try:
from django.conf.urls import patterns, include, url
urlpatterns = patterns(
'',
# url(r'^admin/', include(admin.site.urls)),
)
except ImportError:
from django.conf.urls import include, url
urlpatterns = (
# url(r'^admin/', include(admin.site.urls)),
)
| Ubiwhere/django-dbbackup | dbbackup/tests/testapp/urls.py | Python | bsd-3-clause | 305 | 0 |
"""Configuration for pytest."""
import json
def pytest_generate_tests(metafunc):
"""Configure pytest to call each of the tests once for each test case."""
if "test_case" in metafunc.fixturenames:
tests = json.load(open("tests/test_data.json"))["tests"]
metafunc.parametrize("test_case", tests)
| rowanphipps/Cerberus | tests/conftest.py | Python | mit | 320 | 0 |
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from .. import views
class Common(object):
"""
Stuff shared by the two views.
"""
def get_return_url(self):
return reverse('openid_callback')
... | brutasse/django-le-social | le_social/openid/tests/views.py | Python | bsd-3-clause | 714 | 0.002801 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('emailer', '0004_auto_20150128_2202'),
]
operations = [
migrations.RemoveField(
model_name='email',
n... | JustinWingChungHui/okKindred | emailer/migrations/0005_remove_email_creation_date.py | Python | gpl-2.0 | 358 | 0 |
# -*- coding: utf-8 -*-
# Description: litespeed netdata python.d module
# Author: Ilya Mashchenko (ilyam8)
# SPDX-License-Identifier: GPL-3.0-or-later
import glob
import os
import re
from collections import namedtuple
from bases.FrameworkServices.SimpleService import SimpleService
update_every = 10
# charts order ... | 3cky/netdata | collectors/python.d.plugin/litespeed/litespeed.chart.py | Python | gpl-3.0 | 5,647 | 0.001948 |
input ('Анук Эме - это псевдоним актрисы Франсуазы Юдит Сорья Дрейфус')
| Mariaanisimova/pythonintask | ISTp/2014/VOLKO_S_D/task-1-46.py | Python | apache-2.0 | 123 | 0.013889 |
from __future__ import division
from _init_paths import *
import os
import os.path as osp
import sg_utils as utils
import numpy as np
import skimage.io
import skimage.transform
import h5py
import pickle
import json
import math
import argparse
import time
import cv2
from collections import Counter
from json import encod... | wenhuchen/ETHZ-Bootstrapped-Captioning | visual-concepts/eval.py | Python | bsd-3-clause | 11,962 | 0.006437 |
#!/usr/bin/env python3
#
# PLASMA : Generate an indented asm code (pseudo-C) with colored syntax.
# Copyright (C) 2015 Joel
#
# 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 ... | chubbymaggie/reverse | plasma/lib/arch/arm/utils.py | Python | gpl-3.0 | 4,197 | 0.004289 |
from share.normalize import ctx, tools
from share.normalize.parsers import Parser
from share.normalize.utils import format_address
class WorkIdentifier(Parser):
uri = tools.RunPython('get_ncar_identifier', ctx)
class Extra:
description = tools.Try(ctx.Related_URL.Description)
url_content_type... | zamattiac/SHARE | providers/org/ncar/normalizer.py | Python | apache-2.0 | 3,649 | 0.00137 |
#!/usr/bin/env python3
#
# Copyright (c) 2019, The OpenThread 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:
# 1. Redistributions of source code must retain the above copyright
# ... | librasungirl/openthread | tests/toranj/test-033-mesh-local-prefix-change.py | Python | bsd-3-clause | 3,956 | 0.000758 |
#!/usr/bin/python
import json
class Tests(object):
def __init__(self, tests, name):
self.tests = tests
self.name = name
self.export_tests()
def export_tests(self):
with open(self.name + ".ptdf", "w+") as ptdf_file:
ptdf_file.write("Application " + self.name + '\n')... | kfrye/SMM-MPI | utilities/results/ptdf_export.py | Python | gpl-3.0 | 2,213 | 0.004067 |
# Update or remove for 2.0.0
from ..v20.grammars.STIXPatternListener import * # noqa: F401 | chisholm/cti-pattern-validator | stix2patterns/grammars/STIXPatternListener.py | Python | bsd-3-clause | 91 | 0.010989 |
"""Update a task in maniphest.
you can use the 'task id' output from the 'arcyon task-create' command as input
to this command.
usage examples:
update task '99' with a new title, only show id:
$ arcyon task-update 99 -t 'title' --format-id
99
"""
# ========================================================... | kjedruczyk/phabricator-tools | py/aon/aoncmd_taskupdate.py | Python | apache-2.0 | 5,958 | 0 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Subscriber'
db.create_table(u'subscribers_subscriber', (
(u'id', self.gf('django... | jcalazan/glucose-tracker | glucosetracker/subscribers/migrations/0001_initial.py | Python | mit | 1,627 | 0.00799 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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... | cvegaj/ElectriCERT | venv3/lib/python3.6/site-packages/pbr/tests/test_commands.py | Python | gpl-3.0 | 3,688 | 0.000271 |
# -*- coding: utf-8 -*-
# Roastero, released under GPLv3
import os
import json
import time
import functools
from PyQt5 import QtGui
from PyQt5 import QtCore
from PyQt5 import QtWidgets
from openroast import tools
from openroast.views import customqtwidgets
from openroast import utils as utils
class RecipeEditor(QtW... | Roastero/Openroast | openroast/views/recipeeditorwindow.py | Python | gpl-3.0 | 19,366 | 0.001962 |
# This file is part of the pyqualtrics package.
# For copyright and licensing information about this package, see the
# NOTICE.txt and LICENSE.txt files in its top-level directory; they are
# available at https://github.com/Baguage/pyqualtrics
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... | Baguage/pyqualtrics | examples/import_panel_example.py | Python | apache-2.0 | 1,983 | 0.002017 |
# -*- coding: utf-8 -*-
"""
models
~~~~~~~~~~~~~~~~~~~~
Top-level models for the entire app.
:copyright: 2011 by Google, Inc.
:license: Apache 2.0, see LICENSE for more details.
"""
# standard Python library imports
import datetime
import logging
import urllib
# App Engine imports
from google.ap... | aleaxit/pysolper | latrop/models.py | Python | apache-2.0 | 10,073 | 0.014196 |
import threading
class CloseableThread(threading.Thread):
running = false
def __init__(self, group = None, target = None, name = None, args=(), kwargs={}):
threading.Thread.__init__(self, group = group, target = target, name = name, args=args, kwargs=kwargs)
def start():
Running = true... | zaquestion/vendttp | server/CloseableThread.py | Python | gpl-2.0 | 447 | 0.035794 |
# Copyright 2020 The Matrix.org Foundation C.I.C.
#
# 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 a... | matrix-org/synapse | synapse/config/redis.py | Python | apache-2.0 | 1,857 | 0.000539 |
import bench
class Stats(bench.Bench):
def __init__(self, league):
bench.Bench.__init__(self)
self.league = league
self.type = 'stats'
def list(self, team=False, player=False):
"""
Lists all stats for the current season to date. Can be filtered by team or by player. De... | sroche0/mfl-pyapi | modules/stats.py | Python | gpl-3.0 | 929 | 0.003229 |
from distutils.core import setup
setup(
name='amenu',
version='1.0.3',
author='ludbek',
author_email='sth.srn@gmail.com',
packages= ['amenu', 'amenu.migrations', 'amenu.templatetags'],
scripts=[],
url='https://github.com/ludbek/amenu',
license='LICENSE.txt',
description='A menu plug... | ludbek/amenu | setup.py | Python | mit | 546 | 0.001832 |
# imports - compatibility imports
from __future__ import absolute_import
# imports - standard imports
import os
# imports - module imports
from spockpy.app.config import BaseConfig
class ServerConfig(BaseConfig):
class Path(BaseConfig.Path):
ABSPATH_TEMPLATES = os.path.join(BaseConfig.Path.ABSPATH_VIEWS, 'templat... | achillesrasquinha/spockpy | spockpy/app/config/server.py | Python | apache-2.0 | 381 | 0.013123 |
"""Module grouping session scoped PyTest fixtures."""
import datetime
import glob
import os
import tempfile
import owslib
import pytest
from _pytest.monkeypatch import MonkeyPatch
from owslib.etree import etree
from owslib.feature.schema import _construct_schema, _get_elements
from owslib.iso import MD_Metadata
from ... | DOV-Vlaanderen/pydov | tests/conftest.py | Python | mit | 15,105 | 0 |
import libtcod.libtcodpy as libtcod
from random import randint
SCREEN_WIDTH = 40
SCREEN_HEIGHT = 20
LIMIT_FPS = 20
MAP_WIDTH = 80
MAP_HEIGHT = 45
ROOM_MAX_SIZE = 10
ROOM_MIN_SIZE = 10
MAX_ROOMS = 30
MAX_ROOM_MONSTERS = 3
FOV_ALGO = libtcod.FOV_SHADOW
FOV_LIGHT_WALLS = True
TORCH_RADIUS = 8
void_color = libtcod.Co... | gambl0r/roguebowl | rbowl.py | Python | unlicense | 14,250 | 0.007509 |
import cv, cv2
import rectangle
from numpy import concatenate
import logging
class Face(object):
def __init__(self, config = {}):
self.config = {
"top_offset" : 1.0,
"bottom_offset" : 1.0,
"left_offset" : 0.0,
"right_offset" : 0.0,
"haar_confidence" : 3,
"min_fac... | mre/tracker | face.py | Python | lgpl-3.0 | 3,699 | 0.012976 |
from .base import *
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '!i%7s@1+v&293zcy*kljuke=_l176nqpj2-3dtms()pw^et!we'
# SECURITY WARNING: don't run... | acdh-oeaw/dig_ed_cat | digital_editions/settings/dev.py | Python | mit | 533 | 0 |
class Strings:
ADD_SUPERVISOR = "You are now connected with "
START_MONITORING = " wants to monitor you, click to allow"
ACCEPTED_MONITORING= "You started monitoring "
STOP_MONITORING_SUPERVISE = " canceled monitoring"
STOP_MONITORING_SUPERVISOR = " is no longer monitoring you"
APPLICATION_ANOMA... | tweiss1234/Cras | strings.py | Python | apache-2.0 | 824 | 0.003641 |
#!/usr/bin/env python
import fluidity.diagnostics.annulus_mesh as mesh
import fluidity.diagnostics.triangletools as tt
div = mesh.SliceCoordsConstant(0.0, 1.0, 3)
m = mesh.GenerateRectangleMesh(div, div)
tt.WriteTriangle(m, "square-structured-linear")
| FluidityProject/multifluids | tests/square-convection-parallel-trivial/src/genmesh.py | Python | lgpl-2.1 | 254 | 0 |
# Copyright (c) 2014 OpenStack 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... | swiftstack/swift | swift/common/middleware/s3api/s3request.py | Python | apache-2.0 | 62,988 | 0 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP module
# Copyright (C) 2010 Micronaet srl (<http://www.micronaet.it>)
#
# Italian OpenERP Community (<http://www.openerp-italia.com>)
#
#####################################################... | Micronaet/micronaet-accounting | account_invoice_multipartner/multipartner.py | Python | agpl-3.0 | 2,506 | 0.004789 |
# Copyright 2012 James McCauley
#
# 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 writi... | avihad/ARP-Storm | src/arp_open_flow/pox/misc/of_tutorial.py | Python | apache-2.0 | 4,582 | 0.006547 |
import requests
def getHTMLText(url):
try:
r=requests.get(url,timeout=30)
r.raise_for_status()
r.encoding=r.apparent_encoding
return r.text
except:
return "产生异常"
if __name__=="__main__":
url="http://www.baidu.com"
print(getHTMLText(url)) | ccto/python-demos | 06-requests/framework.py | Python | apache-2.0 | 303 | 0.030508 |
import graphlab as gl
import time
def pagerank_update_fn(src, edge, dst):
if src['__id'] != dst['__id']: # ignore self-links
dst['pagerank'] += src['prev_pagerank'] * edge['weight']
return (src, edge, dst)
def sum_weight(src, edge, dst):
if src['__id'] != dst['__id']: # ignore self-links
s... | dato-code/how-to | triple_apply_weighted_pagerank.py | Python | cc0-1.0 | 2,161 | 0.006478 |
#!/usr/bin/env python
#
# Jetduino Example for using the Grove Electricity Sensor (http://www.seeedstudio.com/wiki/Grove_-_Electricity_Sensor)
#
# The Jetduino connects the Jetson and Grove sensors. You can learn more about the Jetduino here: http://www.NeuroRoboticTech.com/Projects/Jetduino
#
# Have a question about... | NeuroRoboticTech/Jetduino | Software/Python/grove_electricity_sensor.py | Python | mit | 2,751 | 0.003999 |
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
import colander
import venusian
from BTrees.OOBTree import OOBTree
from persistent.list import PersistentList
from persistent.dict import PersistentDict
from webob.multi... | ecreall/nova-ideo | novaideo/core.py | Python | agpl-3.0 | 25,754 | 0.000427 |
"""
Health check endpoint
"""
from flask import Blueprint
HEALTHCHECK = Blueprint('healthcheck', __name__)
@HEALTHCHECK.route('/comments/health_check')
def healthcheck():
"""
Returns 200
"""
return 'OK'
| miljkovicivan/MicroComments | app/healthcheck.py | Python | bsd-3-clause | 222 | 0 |
import hashlib
import json
import os
import unicodedata
import uuid
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.urlresolvers import reverse
from django.db import models
from django.dispatch import receiver
from django.template.defaultfilters import... | eviljeff/zamboni | mkt/files/models.py | Python | bsd-3-clause | 11,351 | 0 |
#!/usr/bin/env python
#
# Copyright 2013 CSIR Meraka HLT and Multilingual Speech Technologies (MuST) North-West University
#
# 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
#
# ht... | Mphaya/heasy | heasy/utility_scripts/display_top_prons.py | Python | apache-2.0 | 4,406 | 0.00749 |
import xml.etree.ElementTree as ET
from email.utils import parsedate as parsedate_
from time import mktime
import datetime
def parsedate(d):return datetime.datetime.fromtimestamp(mktime(parsedate_(d)))
def element_value(el,default):
return ((el.text + el.tail) if el is not None else "").strip()
def date_value(dv):
... | tyler-elric/misc | rss.py | Python | gpl-3.0 | 6,353 | 0.030222 |
'''Generate truth data from a truth_data_file.
A truth_data_file may be produced by a human being, so sometimes
it should be considered truth data. This file provides
utilities for turning a truth_data_file of a certain format into
truth data the harness understands.
'''
from __future__ import absolute_import
import ... | trec-dd/trec-dd-simulation-harness | trec_dd/harness/truth_data.py | Python | mit | 4,988 | 0.002005 |
"""
Copyright (c) 2016, John Deutscher
Description: Sample Python script for Azure Media Indexer V2
License: MIT (see LICENSE.txt file for details)
Documentation : https://azure.microsoft.com/en-us/documentation/articles/media-services-process-content-with-indexer2/
"""
import os
import json
import amspy
import time
im... | johndeu/amspy | amspy/examples/analytics/indexer_v2/indexer_v2.py | Python | mit | 14,879 | 0.01566 |
# 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... | openstack/smaug | karbor/services/protection/protection_plugins/server/nova_protection_plugin.py | Python | apache-2.0 | 20,349 | 0 |
#!/usr/bin/env python3
import sys
import requests
import json
import unittest
import datetime
from util import TestCase
import config
import common
class TestApiProblemGuest(TestCase):
url = '%s/api/groups/3/problems/'%(config.base_url)
token = common.get_user_info({'account': config.user_admin_account, 'passw... | Tocknicsu/nctuoj | backend/test/api/problem/guest.py | Python | mit | 1,488 | 0.005376 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import hashlib
from django.utils import six
URL_LIST_CACHE = 'powerpages:url_list'
SITEMAP_CONTENT = 'powerpages:sitemap'
def get_cache_name(prefix, name):
"""
Cache name constructor. Uses the same methods as django cache system
... | Open-E-WEB/django-powerpages | powerpages/cachekeys.py | Python | mit | 1,418 | 0 |
#!/usr/bin/env python
# =============================================================================================
# MODULE DOCSTRING
# =============================================================================================
"""
Tests for cheminformatics toolkit wrappers
"""
# ==============================... | open-forcefield-group/openforcefield | openff/toolkit/tests/test_toolkits.py | Python | mit | 163,747 | 0.002449 |
#! /usr/bin/python3
import sys, os, time, tempfile
import pytest
import util_test
from util_test import CURR_DIR
from fixtures.vectors import UNITTEST_VECTOR
from fixtures.params import DEFAULT_PARAMS as DP
from lib import (config, util, api)
import counterpartyd
def setup_module():
counterpartyd.set_options(data... | Ziftr/counterpartyd | test/unit_test.py | Python | mit | 1,568 | 0.007015 |
import uuid
import os
import shutil
import urlparse
import re
import hashlib
from lxml import html
from PIL import Image, ImageFile
from django.conf import settings
import views
ImageFile.MAXBLOCKS = 10000000
def match_or_none(string, rx):
"""
Tries to match a regular expression and returns an integer if it... | ZG-Tennis/django-ckeditor | ckeditor/utils.py | Python | bsd-3-clause | 8,404 | 0.004522 |
from distutils.core import setup
setup(name='pycycle',
version='3.9.9',
packages=[
'pycycle',
'pycycle/thermo',
'pycycle/thermo/cea',
'pycycle/thermo/cea/thermo_data',
'pycycle/elements',
'pycycle/maps',
'pycycle/thermo/tabular'
]... | JustinSGray/pyCycle | setup.py | Python | apache-2.0 | 386 | 0.005181 |
default_app_config = 'projectlight.apps.ProjectlightConfig'
| cuedpc/edpcmentoring | edpcmentoring/projectlight/__init__.py | Python | mit | 60 | 0 |
########################################################################
#
# File Name: TextElement.py
#
#
"""
Implementation of the XSLT Spec text stylesheet element.
WWW: http://4suite.com/4XSLT e-mail: support@4suite.com
Copyright (c) 1999-2000 Fourthought Inc, USA. All Rights Reserved.
See htt... | Pikecillo/genna | external/PyXML-0.8.4/xml/xslt/TextElement.py | Python | gpl-2.0 | 2,357 | 0.003818 |
# -*- coding: utf-8 -*-
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2010 Thomas Perl and the gPodder Team
#
# gPodder 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... | timabell/gpodder | src/gpodder/gtkui/frmntl/portrait.py | Python | gpl-3.0 | 8,012 | 0.002122 |
# Copyright 2012-2017 The Meson development team
# 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 agree... | QuLogic/meson | mesonbuild/compilers/mixins/clike.py | Python | apache-2.0 | 59,114 | 0.002436 |
## for learning purpose only
from collections import deque
##The making of a hash Table
def hash_string(keyword,buckets):
'''
# takes as inputs a keyword
# (string) and a number of buckets,
# and returns a number representing
# the bucket for that keyword.
'''
return sum(map(ord, keyword))... | codecakes/random_games | implement_hash_map.py | Python | mit | 5,289 | 0.016449 |
class amicable():
def d(self, n):
if n == 1:
return 0
else:
sum_of_factors = 0
for i in range(1, int(n**0.5)+1):
if n % i == 0:
sum_of_factors += i
if n/i != n:
sum_... | higee/project_euler | 21-30/21.py | Python | mit | 860 | 0.010465 |
# introduction
print("Bitte füllen Sie das folgende Formular aus")
# get name
name = input("Vorname: ")
lastname = input("Nachname: ")
fullname = name + ' ' + lastname
# get birth info
birth_year = int(input("Geburtsjahr: "))
birth_place = input("Geburtsort: ")
# calculate age
age = 2016 - birth_year
print("\n")
# pr... | Informatik-AG-KGN-2016/Dokumente | 2016-11-14/input.py | Python | gpl-3.0 | 503 | 0 |
import cherrypy
from cherrypy.lib import httpauth
def check_auth(users, encrypt=None, realm=None):
"""If an authorization header contains credentials, return True, else False."""
request = cherrypy.serving.request
if 'authorization' in request.headers:
# make sure the provided credentials ... | TRex22/Sick-Beard | cherrypy/lib/auth.py | Python | gpl-3.0 | 3,288 | 0.007603 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "concert.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| fotcorn/liveinconcert | manage.py | Python | mit | 250 | 0 |
import os
import json
import pyodbc
import psycopg2
import psycopg2.extras
from psycopg2.pool import ThreadedConnectionPool
import datetime
from concurrent.futures import ThreadPoolExecutor, wait
import multiprocessing
import sys
import hashlib
from utils import *
THREADNUM = 16
class IntWriter:
def __init__(self... | HeavenlySword/INTINT | intint/intwriter.py | Python | mit | 12,384 | 0.006137 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:9554")
else:
access = Ser... | yardsalecoin/yardsalecoin | contrib/bitrpc/bitrpc.py | Python | mit | 7,836 | 0.038157 |
from __future__ import unicode_literals
import logging
# Logging configuration
log = logging.getLogger(__name__) # noqa
log.addHandler(logging.NullHandler()) # noqa
from netmiko.ssh_dispatcher import ConnectHandler
from netmiko.ssh_dispatcher import ssh_dispatcher
from netmiko.ssh_dispatcher import redispatch
from ne... | fooelisa/netmiko | netmiko/__init__.py | Python | mit | 1,198 | 0.003339 |
from src.greedy_algorithms import find_ample_city
from src.greedy_algorithms import find_majority_element
from src.greedy_algorithms import GasCity
from src.greedy_algorithms import three_sum
from src.greedy_algorithms import trapped_water
from src.greedy_algorithms import two_sum
class TestTwoSum(object):
"""
... | jakubtuchol/epi | test/test_greedy_algorithms.py | Python | mit | 2,161 | 0 |
#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1+
# Generate autosuspend rules for devices that have been tested to work properly
# with autosuspend by the Chromium OS team. Based on
# https://chromium.googlesource.com/chromiumos/platform2/+/master/power_manager/udev/gen_autosuspend_rules.py
import chromium... | filbranden/systemd | tools/make-autosuspend-rules.py | Python | gpl-2.0 | 938 | 0 |
import rdflib
from rdflib import Namespace
from ontology import Ontology
class DOC(Ontology, ):
def __init__(self):
Ontology.__init__(self, rdflib.term.URIRef(u'http://www.w3.org/2000/10/swap/pim/doc#'))
prefix = 'doc'
doc = DOC()
ontology = doc
| h4ck3rm1k3/gcc-ontology | lib/ontologies/org/w3/_2000/_10/swap/pim/doc.py | Python | gpl-3.0 | 265 | 0.011321 |
# Copyright (C) 2013 - 2016 - Oscar Campos <oscar.campos@member.fsf.org>
# This program is Free Software see LICENSE file for details
from .local_process import LocalProcess
from .remote_process import StubProcess
from .vagrant_process import VagrantProcess
class WorkerProcess(object):
"""Return a right process... | danalec/dotfiles | sublime/.config/sublime-text-3/Packages/Anaconda/anaconda_lib/workers/process.py | Python | mit | 636 | 0 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
test_records = frappe.get_test_records('Operation')
class TestOperation(unittest.TestCase):
pass
| Zlash65/erpnext | erpnext/manufacturing/doctype/operation/test_operation.py | Python | gpl-3.0 | 258 | 0.007752 |
# -* encoding: utf-8 *-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from unittest.case import TestCase
from gopythongo.utils.debversion import debian_substr_compar... | gopythongo/gopythongo | src/py/gopythongo/tests/debversion.py | Python | mpl-2.0 | 3,559 | 0.006185 |
import random
import numpy
large_set_size = 1000
small_set_size = 20
print_diff = 100
stat_num = 1000
stats = [[], [], []]
for _ in range(stat_num):
lset = set()
sset = set()
stop = False
i = 0
large_set_count = None
small_set_count = None
large_set_size_when_small_set_complete = None
... | veltzer/riddling | instances/cover_subset/solution.py | Python | gpl-3.0 | 1,036 | 0 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
from scrapy.item import Item, Field
from scrapy.loader.processors import Join, MapCompose, TakeFirst
from scrapy.loader import ItemLoader
from w3lib.html i... | bernieyangmh/spider | spider_y/items.py | Python | gpl-3.0 | 1,245 | 0.00241 |
__author__ = 'kdsouza'
import traits.api as tr
import traitsui.api as trui
from traitsui.editors import *
class VEdit(tr.HasTraits):
"""
Container class for value, editor type, and editor specifications.
"""
value = tr.Any
editor = trui.EditorFactory
kwargs = tr.Dict(key_trait=tr.Str, value_... | kdz/test | VEdit.py | Python | mit | 735 | 0.005442 |
"""
(Future home of) Tests for program enrollment writing Python API.
Currently, we do not directly unit test the functions in api/writing.py.
This is okay for now because they are all used in
`rest_api.v1.views` and is thus tested through `rest_api.v1.tests.test_views`.
Eventually it would be good to directly test th... | ESOedX/edx-platform | lms/djangoapps/program_enrollments/api/tests/test_writing.py | Python | agpl-3.0 | 574 | 0.001742 |
# -*- 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... | rosenvladimirov/odoo | anglo_saxon_dropshipping/__init__.py | Python | agpl-3.0 | 1,071 | 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... | tensorflow/tensorflow | tensorflow/python/framework/traceable_stack_test.py | Python | apache-2.0 | 5,145 | 0.003693 |
import numpy
from GenOpt import GeneticOptimizer
##Booths Function but with an additional slack variable to show the constraint feature.
def BoothsFnc(x):
return (x[:, 0] + 2*x[:, 1] - 7)**2 + (2*x[:, 0] + x[:, 1] - 5)**2
InitialSolutions = [numpy.array([numpy.random.uniform(), numpy.random.uniform(), numpy.random.... | kevinlioi/GenOpt | examples/constrained_optimization.py | Python | mit | 762 | 0.045932 |
from django.shortcuts import render_to_response
from django.template import RequestContext
from home.models import HomeImage
def index(request):
info = {}
info['homeImages'] = HomeImage.objects.all().order_by('title').order_by('order')
return render_to_response('home/index.html', { 'info': info }, co... | UTAlan/PhotosByMallie | mallie/home/views.py | Python | gpl-2.0 | 361 | 0.019391 |
#-*- coding: utf-8 -*-
__all__ = ["XML_BibleParser", "reference"]
import re
import xml.etree.ElementTree as ET
from BibleParser.abstract import parser as abstract_parser, reference as abstract_reference
from BibleParser.error import *
from BibleParser.Numbers import Number
class parser(abstract_parser):
"""
... | oelson/concordance | lib/BibleParser/xml.py | Python | gpl-2.0 | 17,962 | 0.001689 |
__all__ = ['get_config_vars', 'get_path']
try:
# Python 2.7 or >=3.2
from sysconfig import get_config_vars, get_path
except ImportError:
from distutils.sysconfig import get_config_vars, get_python_lib
def get_path(name):
if name not in ('platlib', 'purelib'):
raise ValueError("Name ... | OpenWinCon/OpenWinNet | web-gui/myvenv/lib/python3.4/site-packages/setuptools/py31compat.py | Python | apache-2.0 | 1,184 | 0.005068 |
# -*- coding: utf-8 -*-
# 226. Invert Binary Tree
#
# Invert a binary tree.
#
# 4
# / \
# 2 7
# / \ / \
# 1 3 6 9
#
# to
#
# 4
# / \
# 7 2
# / \ / \
# 9 6 3 1
#
# Trivia:
# This problem was inspired by this original tweet by Max Howell:
#
# Google: 90% of our engineers u... | gengwg/leetcode | 226_invert_binary_tree.py | Python | apache-2.0 | 1,673 | 0.001267 |
import libtcodpy as libtcod
import consts
def find_closest_target(caster, entities, range):
closest_target = None
closest_dist = range + 1
for obj in entities:
if obj.fighter and obj != caster:
dist = caster.distance_to(obj)
if dist < closest_dist:
closest_... | MykeMcG/SummerRoguelike | src/utils.py | Python | gpl-3.0 | 2,363 | 0.003809 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.