code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
"""Compile, build and download the ATLYS demo to the ATLYS development kit"""
import sys
import os
import shutil
from chips.components.components import discard, constant
from chips.compiler.exceptions import C2CHIPError
import user_settings
def compile_user_design(application, working_directo... | dawsonjon/Chips-Demo | demo/run_demo.py | Python | mit | 5,045 |
"""Cihai core functionality."""
import logging
import os
import kaptan
from appdirs import AppDirs
from . import exc, extend
from ._compat import string_types
from .config import expand_config
from .constants import DEFAULT_CONFIG, UNIHAN_CONFIG
from .db import Database
from .utils import import_string, merge_dict
l... | cihai/cihai | cihai/core.py | Python | mit | 4,415 |
#!/usr/bin/env python
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import specs.fbthrift as fbthrift
import specs.folly as folly
import specs.gmock as gmock
from shell_quoti... | facebook/watchman | watchman/build/fbcode_builder_config.py | Python | mit | 1,801 |
#!/usr/bin/python
#======================================================================
#
# Project : hpp_IOStressTest
# File : Libs/IOST_Basi.py
# Date : Nov 28, 2016
# Author : HuuHoang Nguyen
# Contact : hhnguyen@apm.com
# : hoangnh.hpp@gmail.com
# License : MIT License
# Copyright : 2016
# ... | HPPTECH/hpp_IOSTressTest | Refer/IOST_OLD_SRC/IOST_0.21/Libs/IOST_Basic.py | Python | mit | 12,444 |
"""
Copyright (C) 2014, Jaguar Land Rover
This program is licensed under the terms and conditions of the
Mozilla Public License, version 2.0. The full text of the
Mozilla Public License is at https://www.mozilla.org/MPL/2.0/
Maintainer: Rudolf Streif (rstreif@jaguarlandrover.com)
"""
from django.db import models
... | rstreif/rvi_backend | web/dblog/models.py | Python | mpl-2.0 | 1,400 |
"""Support for Tasmota switches."""
from homeassistant.components import switch
from homeassistant.components.switch import SwitchEntity
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import DOMAIN as TASMOTA_DOMAIN
from .discovery import TASM... | GenericStudent/home-assistant | homeassistant/components/tasmota/switch.py | Python | apache-2.0 | 1,727 |
# -*- 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 'Brand'
db.create_table('products_brand', (
('id', self.gf('django.db.models.fiel... | blorenz/indie-film-rentals | indiefilmrentals/products/migrations/0005_auto__add_brand.py | Python | bsd-3-clause | 6,244 |
# coding=utf-8
# Copyright 2016 Google Inc. 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 appl... | beomyeol/models | syntaxnet/syntaxnet/text_formats_test.py | Python | apache-2.0 | 7,252 |
import unittest
from clib.tmp import sumfunc
from .context import clib
class SumFuncTest(unittest.TestCase):
def test_sumfunc(self):
self.assertEqual(sumfunc(2), 3)
if __name__ == '__main__':
unittest.main()
| Swall0w/clib | tests/test_sumfunc.py | Python | mit | 229 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from openpyxl import load_workbook
try:
file_name = str(sys.argv[1])
except IndexError:
exit("Usage: " + sys.argv[0] + " filename.xlsx")
workbook = load_workbook(file_name)
sheet_names = workbook.get_sheet_names()
for sheet in sheet_names:
current_sh... | pyskell/excel-comment-grabber | grab_excel_comments.py | Python | mit | 1,051 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | KMK-ONLINE/ansible-modules-core | network/nxos/nxos_template.py | Python | gpl-3.0 | 5,518 |
#!/usr/local/bin/python
"""
A very simple 3D vector, matrix, and linear algebra library.
"""
import math
import types
class Vector:
"""A 3 element vector."""
ZERO = None
I = None
J = None
K = None
def __init__(self, x, y, z):
self.x, self.y, self.z = float(x), float(y), float(... | sheldonrobinson/shaderman | modes/Particles/la.py | Python | bsd-3-clause | 10,411 |
import uuid
import psycopg2
from django.conf import settings
from django.db.backends.postgresql.base import \
DatabaseWrapper as PostgresqlDatabaseWrapper
from django.db.backends.postgresql.base import utc_tzinfo_factory
class server_side_cursors(object):
"""
With block helper that enables and disables s... | monikagrabowska/osf.io | osf/db/backends/postgresql/base.py | Python | apache-2.0 | 2,162 |
import datetime
startDate = datetime.date(1901,1,1)
endDate = datetime.date(2000,12,31)
day = datetime.timedelta(days=1)
sundays = 0
while startDate <= endDate:
if startDate.weekday() == 6 and startDate.day == 1:
sundays += 1
startDate+=day
print sundays
| nighthawk702/Project-Euler-Solutions | Python/problem19.py | Python | lgpl-3.0 | 264 |
from pycp2k.inputsection import InputSection
class _velocity3(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Default_keyword = []
self._name = "VELOCITY"
self._repeated_default_keywords = {'Default_keyword': 'DEFAULT_KEYWORD'}
self._attributes = ['Defau... | SINGROUP/pycp2k | pycp2k/classes/_velocity3.py | Python | lgpl-3.0 | 334 |
from django.db import models
from djangae.test import TestCase
from djangae.contrib import sleuth
from djangae.contrib.pagination import (
paginated_model,
Paginator,
PaginationOrderingRequired
)
from .paginator import queryset_identifier, _get_marker
@paginated_model(orderings=[
("first_name",),
... | b-cannon/my_djae | djangae/contrib/pagination/tests.py | Python | bsd-3-clause | 6,842 |
import bench
def test(num):
for i in iter(range(num // 10000)):
l = [0] * 1000
l2 = bytearray(l)
bench.run(test)
| kerneltask/micropython | tests/internal_bench/from_iter-7-bytearray_bound.py | Python | mit | 137 |
"""
.. _askbot.deps
:mod:askbot.deps - dependency packages for Askbot
===================================================
Most askbot dependencies are satisfied with setuptools, but some modules
were either too seriously modified - like `django_authopenid` specifically for
askbot, while others are not available via P... | divio/askbot-devel | askbot/deps/__init__.py | Python | gpl-3.0 | 665 |
# -*- coding: utf-8 -*-
from django import dispatch
# ☠ do not import models here. they import us. ☠
cart_quantity_change_check = dispatch.Signal(providing_args=['variant', 'old_qty', 'new_qty', 'result'])
cart_quantity_change_check.__doc___ = """
Sent to check if it is possible to change item's quantity to new value.... | fusionbox/satchless | satchless/cart/signals.py | Python | bsd-3-clause | 851 |
import os
import unittest
from mediadownloader import shutdown
from mediadownloader.subtitles.sub_db import SubDb
TEST_URL = 'http://sandbox.thesubdb.com/'
USER_AGENT = 'SubDB/1.0 (mediadownloader-test/0.1; http://github.com/md384/mediadownloader)'
class OpenSubtitlesTest(unittest.TestCase):
def setUp(self):
... | md384/media-reminder | tests/test_sub_db.py | Python | mit | 1,554 |
# 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... | alshedivat/tensorflow | tensorflow/python/data/experimental/kernel_tests/optimization/optimize_dataset_test.py | Python | apache-2.0 | 3,491 |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
import heapq
class Solution(object):
def mergeKLists(self, lists):
"""
:type lists: List[ListNode]
:rtype: ListNode
"""
if not lis... | TanakritBenz/leetcode-adventure | merge_k_sorted_lists.py | Python | gpl-2.0 | 979 |
## roster_nb.py
## based on roster.py
##
## Copyright (C) 2003-2005 Alexey "Snake" Nezhdanov
## modified by Dimitur Kirov <dkirov@gmail.com>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the... | 9thSenseRobotics/bosh_server | nbxmpp-0.1/nbxmpp/roster_nb.py | Python | gpl-3.0 | 13,001 |
from django.conf.global_settings import PASSWORD_HASHERS as default_hashers
from django.contrib.auth.hashers import (is_password_usable,
check_password, make_password, PBKDF2PasswordHasher, load_hashers,
PBKDF2SHA1PasswordHasher, get_hasher, UNUSABLE_PASSWORD,
MAXIMUM_PASSWORD_LENGTH, password_max_length)
f... | mozilla/verbatim | vendor/lib/python/django/contrib/auth/tests/hashers.py | Python | gpl-2.0 | 8,176 |
"""
Fallback syllable counter
This is based on the algorithm in Greg Fast's perl module
Lingua::EN::Syllable.
"""
import string, re, os
specialSyllables_en = """tottered 2
chummed 1
peeped 1
moustaches 2
shamefully 3
messieurs 2
satiated 4
sailmaker 4
sheered 1
disinterred 3
propitiatory 6
bepatched 2
particularized... | stringertheory/names | syllables_en.py | Python | mit | 2,682 |
import json
def load_json_from_file(file_path):
"""Load schema from a JSON file"""
try:
with open(file_path) as f:
json_data = json.load(f)
except ValueError as e:
raise ValueError('Given file {} is not a valid JSON file: {}'.format(file_path, e))
else:
return json_... | ueg1990/faker-schema | faker_schema/schema_loader.py | Python | mit | 585 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2020 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
"""This provides a basic ButtonBox class, and imports the
`ioLab python library <http:/... | psychopy/versions | psychopy/hardware/labjacks.py | Python | gpl-3.0 | 1,270 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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,
... | azverkan/scons | test/VariantDir/VariantDir.py | Python | mit | 11,730 |
from hyperadmin.resources.models.resources import ModelResource, InlineModelResource
| zbyte64/django-hyperadmin | hyperadmin/resources/models/__init__.py | Python | bsd-3-clause | 86 |
# coding: utf-8
from __future__ import division
import random
from random import randint
import pygame
from pygame.locals import *
SIZE = 800, 600
FLAGS = 0
# actually, delay in ms:
FRAMERATE = 30
WAVE_ENEMIES = [1, 5, 1]
Group = pygame.sprite.OrderedUpdates
class GameOver(Exception):
pass
class NoEnemyI... | jsbueno/towertower | towertower/__init__.py | Python | gpl-3.0 | 14,154 |
default_app_config = 'cmj.agenda.apps.AppConfig'
| cmjatai/cmj | cmj/agenda/__init__.py | Python | gpl-3.0 | 49 |
# Copyright 2020 The HuggingFace Team. 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 applicabl... | huggingface/transformers | examples/legacy/seq2seq/sentence_splitter.py | Python | apache-2.0 | 1,239 |
from actions.deploy import deploy_template_method
from actions.build import build_template_method
###############################################################################
#
class generic_linux_deploy(deploy_template_method):
def unlock_node(
self,
):
from steps.deploy.unlock_node.gener... | uvsmtid/common-salt-states | states/bootstrap/bootstrap.dir/modules/platforms/generic_linux.py | Python | apache-2.0 | 3,945 |
#!/usr/bin/python
# ex:set fileencoding=utf-8:
from __future__ import unicode_literals
from djangobmf.tasks.document import generate_sha1
from djangobmf.tasks.notification import djangobmf_user_watch
__all__ = [
'djangobmf_user_watch',
'generate_sha1',
]
| django-bmf/django-bmf | djangobmf/tasks/__init__.py | Python | bsd-3-clause | 267 |
""" Regular expression routines.
Implement regular expressions using derivatives.
"""
from .regex import Symbol, SymbolSet, Kleene
from .parser import parse
__all__ = ("parse", "Symbol", "SymbolSet", "Kleene")
| windelbouwman/ppci-mirror | ppci/lang/tools/regex/__init__.py | Python | bsd-2-clause | 216 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'http://npettiaux.github.io/openForumBe/'
RELA... | pdebuyl/openForumBe | publishconf.py | Python | agpl-3.0 | 547 |
"""
Handlers for different signals in the student_certificates application.
"""
import logging
from django.db.models.signals import post_save
from django.dispatch import receiver
from common.lib.mandrill_client.client import MandrillClient
from lms.djangoapps.certificates.models import GeneratedCertificate
from opene... | philanthropy-u/edx-platform | openedx/features/student_certificates/handlers.py | Python | agpl-3.0 | 2,294 |
# Copyright 2017 Velodyne Acoustics, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | Kitware/VeloView | Application/Ui/python/lidarview/aboutDialog.py | Python | apache-2.0 | 4,231 |
"""Provide access to Python's configuration information.
"""
import sys
import os
from os.path import pardir, realpath
_INSTALL_SCHEMES = {
'posix_prefix': {
'stdlib': '{base}/lib/{implementation_lower}{py_version_short}',
'platstdlib': '{platbase}/lib/{implementation_lower}{py_version_short}',
... | ZachRiegel/scriptbin | pypyjs/modules/sysconfig.py | Python | gpl-3.0 | 23,928 |
"""
.. _ex-morph-surface:
=============================
Morph surface source estimate
=============================
This example demonstrates how to morph an individual subject's
:class:`mne.SourceEstimate` to a common reference space. We achieve this using
:class:`mne.SourceMorph`. Pre-computed data will be morphed ... | mne-tools/mne-tools.github.io | 0.20/_downloads/e414d894f3f4079b3e5897dd9c691af7/plot_morph_surface_stc.py | Python | bsd-3-clause | 5,938 |
"""
This tutorial introduces denoising auto-encoders (dA) using Theano.
Denoising autoencoders are the building blocks for SdA.
They are based on auto-encoders as the ones used in Bengio et al. 2007.
An autoencoder takes an input x and first maps it to a hidden representation
y = f_{\theta}(x) = s(Wx+b), paramete... | mriosb08/palodiem-QE | src/dA.py | Python | apache-2.0 | 10,611 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Pexego S.I. (<http://www.pexego.es>).
#
# All other contributions are (C) by their respective contributors
#
# All Rights Reserved
#
# This program is free software: you can redistri... | Pexego/PXGO_00053_2013_VT | project-addons/account_banking_sepadd_groupby_partner/wizard/export_sdd.py | Python | agpl-3.0 | 21,985 |
"""
GitHub extensions to the new-commit view.
"""
import re
import sublime
from sublime_plugin import TextCommand
from ...core.git_command import GitCommand
from ...core.ui_mixins.quick_panel import show_paginated_panel
from .. import github
from .. import git_mixins
from ...common import util
class GsGithubShowIs... | divmain/GitSavvy | github/commands/commit.py | Python | mit | 3,939 |
import pickle
from nose.tools import eq_
from .. import dicts
from ....dependencies import solve
from ...datasource import Datasource
my_dict = Datasource("my_dict")
my_keys = dicts.keys(my_dict)
my_values = dicts.values(my_dict)
def test_dict_keys():
cache = {my_dict: {"foo": 1, "bar": 2}}
eq_(set(solve(... | yafeunteun/wikipedia-spam-classifier | revscoring/revscoring/datasources/meta/tests/test_dicts.py | Python | mit | 752 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/libdivsufsort/package.py | Python | lgpl-2.1 | 1,602 |
from supriya.system.SupriyaValueObject import SupriyaValueObject
class BufferProxy(SupriyaValueObject):
"""
A buffer proxy.
Acts as a singleton reference to a buffer on the server, tracking the state
of a single buffer id and responding to `/b_info` messages. Multiple Buffer
instances reference a... | Pulgama/supriya | supriya/realtime/BufferProxy.py | Python | mit | 8,402 |
# -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoSansMongolian-Regular'
native_name = ''
def glyphs(self):
chars = []
chars.append(0x0000) #uniFEFF ????
chars.append(0x1801) #uni1801 MONGOLIAN ELLIPSIS
chars.append(0x1802) #uni1802 MONGOLIAN COMMA
... | davelab6/pyfontaine | fontaine/charsets/noto_chars/notosansmongolian_regular.py | Python | gpl-3.0 | 13,119 |
import unittest
from pystan import stanc, StanModel
from pystan._compat import PY2
class TestUTF8(unittest.TestCase):
desired = sorted({"status", "model_cppname", "cppcode", "model_name", "model_code", "include_paths"})
def test_utf8(self):
model_code = 'parameters {real y;} model {y ~ normal(0,1);}... | ariddell/pystan | pystan/tests/test_utf8.py | Python | gpl-3.0 | 1,618 |
# coding: utf-8
from __future__ import absolute_import, unicode_literals
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework_sso import claims
from rest_framework_sso.models i... | namespace-ee/django-rest-framework-sso | rest_framework_sso/views.py | Python | mit | 4,556 |
# coding: utf-8
"""
Salt Edge Account Information API
API Reference for services # noqa: E501
OpenAPI spec version: 5.0.0
Contact: support@saltedge.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class Country(object):
... | ltowarek/budget-supervisor | third_party/saltedge/swagger_client/models/country.py | Python | mit | 5,389 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ---------------------------------------------------
# Copyright (c) 2013 Pablo Caro. All Rights Reserved.
# Pablo Caro <me@pcaro.es> - http://pcaro.es/
# ProgressBar.py
# ---------------------------------------------------
import sys
class ProgressBar:
... | pcaro90/Python-AES | ProgressBar.py | Python | bsd-3-clause | 1,773 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2022 Daniele Simonetti
#
# 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.
#
... | OpenNingia/l5r-character-manager-3 | l5r/api/character/merits.py | Python | gpl-3.0 | 2,828 |
# -*- python -*-
# pylogsparser - Logs parsers python library
#
# Copyright (C) 2011 Wallix Inc.
#
# 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 (... | wallix/pylogsparser | tests/test_suite.py | Python | lgpl-2.1 | 1,489 |
from django.conf import settings
from django.http import Http404
import os
import shutil
import time
import re
import urlparse
import urllib
from subprocess import call
from exceptions import ImageMagickException, ImageMagickConversionError, ImageMagickOSFileError
from cache_util import file_hash
from django.db.mode... | gregplaysguitar/glamkit | glamkit/incubated/imageutil/imagemagick_util.py | Python | bsd-3-clause | 6,569 |
###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... | ilastikdev/ilastik | ilastik/applets/dataExport/opDataExport.py | Python | gpl-3.0 | 20,984 |
#!/usr/bin/env python
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
import argparse
import datetime
import socket
import traceback
import time
import logging
import json
from multiprocessing import Proce... | cmu-db/db-webcrawler | core/scripts/vagrant_benchmark.py | Python | apache-2.0 | 4,885 |
from time import sleep
from IoTPy.ioboard.boards.uper import UPER1
from IoTPy.things.led_strip import LedStrip
def shift(seq, n):
n %= len(seq)
return seq[n:] + seq[:n]
with UPER1() as board, board.spi("SPI0", clock=2.9e6) as spi, LedStrip(spi) as leds:
colors = [0xFF0000, 0xFFFF00, 0x00FF00, 0x0000FF, ... | 8devices/IoTPy | examples/sensors/08_LedStrip.py | Python | mit | 434 |
#!/usr/bin/python
import vlc
import time
import os
import pyttsx
import pyaudio
import speech_recognition as sr
import random
import datetime
import threading
from threading import Timer
import thread, sys
from mutagen.mp3 import MP3
from mutagen.asf import ASF
import RPi.GPIO as GPIO
import os
import Adafruit_CharLCD ... | ajprameswari/ElevatorAnnotator | elevatorannotator_audio.py | Python | gpl-3.0 | 13,436 |
import numpy as np
from numpy import infty
from numpy.linalg import norm
def norm1(x):
if len(x) > 0:
return norm(x,ord=1)
return 0.0
def norm2(x):
if len(x) > 0:
return norm(x)
return 0.0
def normp(x,p):
if len(x) > 0:
return norm(x,ord=p)
return 0.0
def norm_infty(x... | optimizers/nlpy | nlpy/tools/norms.py | Python | gpl-3.0 | 2,495 |
# Copyright 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.
import os
import unittest
from telemetry import story
from telemetry.page import page
class TestPage(unittest.TestCase):
def assertPathEqual(self, path1... | TheTypoMaster/chromium-crosswalk | tools/telemetry/telemetry/page/page_unittest.py | Python | bsd-3-clause | 6,894 |
from typing import List
def simple_preprocess(*args, **kwarg) -> List[str]: ...
| n-kats/arxiv2vec | stabs/gensim/utils/__init__.py | Python | mit | 82 |
import json
from math import ceil
from asyncpg import Connection
from qllr.common import MATCH_LIST_ITEM_COUNT
from qllr.db import cache
from qllr.settings import PLAYER_COUNT_PER_PAGE
KEEPING_TIME = 60 * 60 * 24 * 30
SQL_TOP_PLAYERS_BY_GAMETYPE = """
SELECT
p.steam_id,
p.name,
p.model,
... | em92/pickup-rating | qllr/blueprints/ratings/methods.py | Python | mit | 3,787 |
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, json
import frappe.defaults
from frappe.desk.notifications import (delete_notification_count_for,
clear_notifications)
common_default_keys = ["__default", "__glo... | vjFaLk/frappe | frappe/cache_manager.py | Python | mit | 5,282 |
"""Test for `maas.client.viscera.bcache_cache_sets`."""
import random
from testtools.matchers import Equals
from ..bcache_cache_sets import BcacheCacheSet, BcacheCacheSets
from ..block_devices import BlockDevice, BlockDevices
from ..nodes import Node, Nodes
from ..partitions import Partition, Partitions
from ..test... | maas/python-libmaas | maas/client/viscera/tests/test_bcache_cache_sets.py | Python | agpl-3.0 | 6,995 |
# -*- 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):
# Changing field 'ScriptVariable.script'
db.alter_column('sms_messages_scriptvariable', 'script_id', self.g... | audaciouscode/SMSBot | smsbot_django/sms_messages/migrations/0006_auto__chg_field_scriptvariable_script.py | Python | gpl-3.0 | 9,479 |
##########################################################################
#
# Copyright (c) 2012, John Haddon. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided t... | davidsminor/gaffer | python/GafferSceneTest/PathMatcherTest.py | Python | bsd-3-clause | 17,956 |
from geopy.geocoders import OpenMapQuest
from test.geocoders.util import GeocoderTestBase
class OpenMapQuestTestCase(GeocoderTestBase): # pylint: disable=R0904,C0111
@classmethod
def setUpClass(cls):
cls.geocoder = OpenMapQuest(scheme='http', timeout=3)
cls.delta = 0.04
def test_geocode... | MultiRRomero/manhattan-map | lib/geopy-1.4.0-py2.6.egg/test/geocoders/openmapquest.py | Python | mit | 772 |
# -*- coding: utf-8 -*-
# Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U
#
# This file is part of FI-WARE project.
#
# 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://w... | Fiware/cloud.SDC | test/acceptance/commons/fabric_utils.py | Python | apache-2.0 | 8,560 |
#!/usr/bin/python
# Updated for python 3.6+
# This is an additional line that can be removed.
import os, sys, string, xmlrpc.client, re, pprint
debug=1
def attachmentsSize(server,token,pageid,depth):
asize = 0
depth += 1
try:
attachments = server.confluence2.getAttachments(token, pageid) # Creates another list... | lordtherick/python-misc | get-tree-bak.py | Python | gpl-3.0 | 6,215 |
from __future__ import absolute_import
import functools
import posixpath
import six
from threading import Lock
import rb
from pkg_resources import resource_string
from redis.client import Script
from redis.connection import ConnectionPool
from sentry import options
from sentry.exceptions import InvalidConfiguration... | alexm92/sentry | src/sentry/utils/redis.py | Python | bsd-3-clause | 5,427 |
from setuptools import setup, find_packages
setup(
name="classifier",
version="0.1",
description="Text classification library.",
url="https://github.com/VaclavDedik/classifier",
keywords="classifier machine_learning text",
license="MIT",
author="Vaclav Dedik",
author_email="vaclav.ded... | VaclavDedik/classifier | setup.py | Python | mit | 564 |
# -*- coding: utf-8 -*-
"""
These the test the public routines exposed in types/common.py
related to inference and not otherwise tested in types/test_common.py
"""
from warnings import catch_warnings, simplefilter
import collections
import re
from datetime import datetime, date, timedelta, time
from decimal import De... | amolkahat/pandas | pandas/tests/dtypes/test_inference.py | Python | bsd-3-clause | 46,231 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
################################################################################
# DChars Copyright (C) 2012 Suizokukan
# Contact: suizokukan _A.T._ orange dot fr
#
# This file is part of DChars.
# DChars is free software: you can redistribute it and/or modify
# ... | suizokukan/anceps | dchars/languages/ang/transliterations/__init__.py | Python | gpl-3.0 | 1,053 |
from flask import Flask
from redis import Redis
import os
app = Flask(__name__)
redis = Redis(host=os.environ.get('REDIS_HOST', 'redis'), port=6379)
@app.route('/')
def hello():
visits = redis.incr('hits')
html = "<h3>Hello Kubernauts</h3> <br/>" \
"<h2>Number of Hits:</2> {hits}<br/>"
return... | kedgeproject/kedge | docs/examples/s2i/app.py | Python | apache-2.0 | 425 |
#! /usr/bin/env python
""" Take a template file (sftlf_fx_EC-Earth3-Veg_TEMPLATE_r1i1p1f1_gr.nc),
which has correct data values for fx/sftlf (land fraction) and create
publishable files for all experiments given
"""
import os
import shutil
import uuid
from netCDF4 import Dataset
# experiment_id heap... | goord/ece2cmor3 | ece2cmor3/scripts/data-qa/recipes/sftlf.py | Python | apache-2.0 | 4,131 |
#!/usr/bin/python
import os
import shutil
import subprocess
import sys
import tempfile
def rel_to_abs(rel_path):
return os.path.join(script_path, rel_path)
java_bin_path = os.getenv('JAVA_HOME', '')
if java_bin_path:
java_bin_path = os.path.join(java_bin_path, 'bin')
main_class = 'org.chromium.devtools.co... | geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/third_party/WebKit/Source/devtools/scripts/closure/closure_runner/build_compiler_runner_jar.py | Python | gpl-3.0 | 2,187 |
# 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... | xzturn/tensorflow | tensorflow/python/data/experimental/kernel_tests/make_csv_dataset_test.py | Python | apache-2.0 | 25,612 |
from django.conf.urls import patterns, url
urlpatterns = patterns(
'geonode.contrib.favorite.views',
url(r'^document/(?P<id>\d+)$', 'favorite', {'subject': 'document'}, name='add_favorite_document'),
url(r'^map/(?P<id>\d+)$', 'favorite', {'subject': 'map'}, name='add_favorite_map'),
url(r'^layer/(?P<id... | darisandi/geonode | geonode/contrib/favorite/urls.py | Python | gpl-3.0 | 625 |
# Copyright 2015 Google Inc. 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 applicable law or a... | awni/tensorflow | tensorflow/python/kernel_tests/clip_ops_test.py | Python | apache-2.0 | 8,011 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | qiime2/q2-types | q2_types/sample_data/__init__.py | Python | bsd-3-clause | 661 |
# coding: utf-8
"""
Qc API
Qc API # noqa: E501
The version of the OpenAPI document: 3.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import telestream_cloud_qc
from telestream_cl... | Telestream/telestream-cloud-python-sdk | telestream_cloud_qc_sdk/test/test_extra_audio_layout_modes.py | Python | mit | 1,418 |
"""
CustomQtDialog.py - Example of how to create a custom Qt dialog in Deadline monitor
Copyright Thinkbox Software 2016
"""
import sys
from System.IO import *
from Deadline.Scripting import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
import PyQt5.QtCore
import ... | ThinkboxSoftware/Deadline | Custom/scripts/General/CustomQtDialog.py | Python | apache-2.0 | 2,889 |
from django.contrib import admin
import models
# Register your models here.
admin.site.register(models.ImageWithLabels)
| yuyu2172/image-labelling-tool | tests/example_labeller/admin.py | Python | mit | 121 |
import numpy as np
import tensorflow as tf
from ops import fc
class Generator(object):
def __init__(self, name, h, w, c, norm_type, deconv_type, is_train):
self.name = name
self._h = h
self._w = w
self._c = c
self._norm_type = norm_type
self._deconv_type = deconv_ty... | gitlimlab/SSGAN-Tensorflow | generator.py | Python | mit | 1,775 |
"""
MicroNFCBoard Python API
Copyright (c) 2014-2015 AppNearMe Ltd
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 ... | jautero/micronfcboard-python | micronfcboard/nfc/ndef.py | Python | apache-2.0 | 2,680 |
#
# Copyright 2009-2011 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | txomon/vdsm | vdsm/storage/sp.py | Python | gpl-2.0 | 77,789 |
# -*- coding: utf-8 -*-
import sys
from django import http
class HandleExceptionsMiddleware(object):
def process_exception(self, request, exception):
print >> sys.stderr, "exception has been raised"
# Get the exception info now, in case another exception is thrown later.
if isinstance(exc... | arcturusannamalai/Ezhil-Lang | web/ulle_veliye/api/exception.py | Python | gpl-3.0 | 496 |
# 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... | Juniper/tempest | tempest/lib/services/image/v2/image_members_client.py | Python | apache-2.0 | 3,281 |
#Miscellaneous tools for HunTag
from collections import defaultdict
import sys
def sentenceIterator(input):
currSen = []
currComment = None
while True:
line = input.readline()
if not line:
break
if line.startswith('"""'):
assert currSen == [], 'ERROR: \
... | recski/HunTag | tools.py | Python | lgpl-3.0 | 2,709 |
import pygame
pygame.init()
screen = pygame.display.set_mode((400, 300))
done = False
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
pygame.display.flip()
| stivosaurus/rpi-snippets | reference_scripts/basic_pygame.py | Python | unlicense | 266 |
#
# (c) 2017 Red Hat Inc.
#
# (c) 2017 Dell EMC.
#
# 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 ve... | trishnaguha/ansible | lib/ansible/plugins/cliconf/dellos6.py | Python | gpl-3.0 | 2,847 |
#!/usr/bin/env python
"""Execute the tests for the seqcons2 program.
The golden test outputs are generated by the script generate_outputs.sh.
You have to give the root paths to the source and the binaries as arguments to
the program. These are the paths to the directory that contains the 'projects'
directory.
Usage... | rrahn/jst_bench | include/seqan/apps/seqcons2/tests/run_tests.py | Python | gpl-3.0 | 7,418 |
# -*- coding: utf-8 -*-
# kate: indent-width 4;
###########################################################################
# Copyright (C) 2008 Håvard Gulldahl
# <havard@gulldahl.no>
#
# Lisens: GPL2
#
# $Id: faktura.py 260 2008-05-11 08:59:23Z havard.gulldahl $
#
#############################################... | kkoksvik/finfaktura | finfaktura/gui_finfaktura_oppsett.py | Python | gpl-2.0 | 3,949 |
import keystoneclient.v2_0.client as ksclient
import novaclient.v1_1.client as nvclient
from novaclient import client as novaclient
import glanceclient
import os
def get_keystone_creds():
d = {}
d['username'] = 'admin'
d['password'] = 'password'
d['auth_url'] = 'http://10.0.2.15:5000/v2.0/'
d['tena... | OpenAcademy-OpenStack/DorisXue | keystone_test.py | Python | apache-2.0 | 1,624 |
#! /usr/bin/python
# -*- encoding: utf-8 -*-
"""
Name lookup in OpenERP for incoming and outgoing calls with an
Asterisk IPBX
This script is designed to be used as an AGI on an Asterisk IPBX...
BUT I advise you to use a wrapper around this script to control the
execution time. Why ? Because if the script takes to... | cgstudiomap/cgstudiomap | main/parts/connector-telephony/asterisk_click2dial/scripts/set_name_agi.py | Python | agpl-3.0 | 15,779 |
# 29/05/2017
def collatz(value):
while value != 'a':
print(value)
value = value[2:] + {'a': "bc", 'b': "a", 'c':"aaa"}[value[0]]
print(value)
#one-liner
collatz1 = lambda y: print("{}".format('\n'.join((lambda a:lambda v:a(a,v))(lambda s, x: [x] + s(s, x[2:] + {'a': "bc", 'b': "a", 'c':"aaa"}[... | tlseabra/dailyprogrammer | Python/easy/e317.py | Python | mit | 356 |
# -*- coding: utf-8 -*-
from mock import Mock, PropertyMock, patch
from flask import url_for, session
from flask_oauthlib.client import OAuthException
from app.models import User
from base import ClientTestCase
from app.auth.views import facebook
from app import helpers
from datetime import datetime, timedelta
class ... | rosariomgomez/tradyfit | vagrant/tradyfit/tests/unit/auth/test_auth_views.py | Python | mit | 6,154 |
# -*- coding: utf-8 -*-
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
class NewsletterApp(CMSApp):
name = _("Newsletter App") # give your app a name, this is required
urls = ["cmskit.newsletter.urls"] # link your app to url co... | ozgurgunes/django-cmskit | cmskit/newsletter/cms_app.py | Python | mit | 397 |
# Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/jws | jws/jws.py | Python | apache-2.0 | 12,195 |
# /usr/bin/env python
'''
Written by Kong Xiaolu and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
'''
import os
import numpy as np
import torch
import CBIG_pMFM_basic_functions as fc
import warnings
def CBIG_mfm_test_desikan_main_highres(gpu_index=0):
'''
This function ... | ThomasYeoLab/CBIG | stable_projects/fMRI_dynamics/Kong2021_pMFM/part2_pMFM_control_analysis/High_resolution/scripts/CBIG_pMFM_test_high_resolution.py | Python | mit | 2,204 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.