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 |
|---|---|---|---|---|---|
from __future__ import unicode_literals
from django.apps import AppConfig
class ProfileConfig(AppConfig):
name = "profiles"
verbose_name = 'User Profiles'
def ready(self):
from . import signals # noqa
| ramaseshan/symptomchecker | symptomcheck/src/profiles/apps.py | Python | gpl-2.0 | 226 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import functools
import sys
import unittest
import torch
from fairseq.distributed import utils as dist_utils
from .utils import objects_are... | pytorch/fairseq | tests/distributed/test_utils.py | Python | mit | 3,656 |
# coding: utf-8
"""
Wavefront REST API Documentation
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the W... | wavefrontHQ/python-client | wavefront_api_client/models/new_relic_metric_filters.py | Python | apache-2.0 | 4,730 |
from biicode.common.utils.serializer import Serializer, SetDeserializer
from biicode.common.model.brl.block_name import BlockName
from biicode.common.find.policy import Policy
from biicode.common.model.symbolic.reference import ReferencedDependencies
from collections import defaultdict
from biicode.common.utils.bii_log... | zhangf911/common | find/finder_request.py | Python | mit | 4,606 |
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
#
# License: BSD Style.
from numpy.testing import assert_array_almost_equal
import numpy as np
from scipy import sparse
from ..base import LinearRegression
from ...utils import check_random_state
def te... | cdegroc/scikit-learn | sklearn/linear_model/tests/test_base.py | Python | bsd-3-clause | 1,363 |
# 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 applicable ... | naturali/tensorflow | tensorflow/contrib/slim/python/slim/nets/inception_v3_test.py | Python | apache-2.0 | 12,169 |
from datetime import timedelta
import numpy as np
import pytest
from pandas import (
DataFrame,
DatetimeIndex,
Timedelta,
date_range,
period_range,
to_datetime,
)
import pandas._testing as tm
class TestToTimestamp:
def test_frame_to_time_stamp(self):
K = 5
index = period_... | TomAugspurger/pandas | pandas/tests/frame/methods/test_to_timestamp.py | Python | bsd-3-clause | 4,020 |
"""
RequestOperation to create a tarball from a list of LFNs.
Download a list of files to local storage, then tars it and uploads it to a StorageElement
This operation requires the following arguments:
* ArchiveLFN: The LFN of the tarball
* SourceSE: Where the files to be archived are downloaded from
* TarballSE:... | fstagni/DIRAC | DataManagementSystem/Agent/RequestOperations/ArchiveFiles.py | Python | gpl-3.0 | 9,341 |
import pytest
@pytest.mark.page('forms_with_input_elements.html')
class TestInputType(object):
def test_returns_an_email_type(self, browser):
assert browser.input(name='html5_email').type == 'email'
| lmtierney/watir-snake | tests/browser/input_tests.py | Python | mit | 213 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | wileeam/airflow | airflow/contrib/operators/bigquery_to_gcs.py | Python | apache-2.0 | 1,678 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from unittest.mock import patch
from unittest.mock import DEFAULT
from werkzeug.urls import url_parse, url_decode
from odoo import exceptions
from odoo.addons.test_mail.models.test_mail_models import MailTestSimple
from... | jeremiahyan/odoo | addons/test_mail/tests/test_mail_thread_internals.py | Python | gpl-3.0 | 16,837 |
"""
This file includes the monkey-patch for requests' PATCH method, as we are using
older version of django that does not contains the PATCH method in its test client.
"""
# pylint: disable=protected-access
from __future__ import unicode_literals
from urlparse import urlparse
from django.test.client import RequestF... | beni55/edx-platform | openedx/core/lib/django_test_client_utils.py | Python | agpl-3.0 | 1,555 |
#!/usr/bin/env python
"""import_dictionary.py: Imports key-size n-gram words from a collection of English n-gram words"""
import sys
import os
if not os.path.exists('.\dictionary'):
os.makedirs('.\dictionary')
for i in range(2,6):
infile = 'w' + str(i) + '_.txt'
outfile = '.\dictionary\w' + str(i) + '.t... | anish-shekhawat/double-transposition | import_dictionary.py | Python | mit | 1,452 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# 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
#... | Rajeshkumar90/ansible-modules-extras | cloud/ovirt/ovirt_groups.py | Python | gpl-3.0 | 5,266 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from future.utils import PY2
import logging
import re
import sys
from datetime import datetime
from path import Path
from flexget import plugin
from flexget.config_schema... | sean797/Flexget | flexget/plugins/input/filesystem.py | Python | mit | 7,624 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | danielvdende/incubator-airflow | tests/contrib/sensors/test_file_sensor.py | Python | apache-2.0 | 3,968 |
from django.db import models
class InfantCnsManager(models.Manager):
def get_by_natural_key(self, cns, report_datetime, visit_instance, code, subject_identifier_as_pk):
InfantCongenitalAnomalies = models.get_model('mb_infant', 'InfantCongenitalAnomalies')
infant_congenital_anomalities = InfantCon... | TshepangRas/tshilo-dikotla | td_infant/managers/congenital_anomalities_manager.py | Python | gpl-2.0 | 7,487 |
"""
"""
import pygame
from pygame.locals import *
import pguglobals
import container
from const import *
class App(container.Container):
"""The top-level widget for an application.
<pre>App(theme=None)</pre>
<dl>
<dt>theme<dd>an instance of a Theme, optional as it will use the default Theme ... | JordanMagnuson/Country-Connect | pgu/gui/app.py | Python | lgpl-2.1 | 7,728 |
#!/usr/bin/python
# Copyright 2016 Red Hat | Ansible
# 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_version': '1.1',
'status': ['previe... | s-hertel/ansible | test/support/integration/plugins/modules/docker_swarm.py | Python | gpl-3.0 | 24,565 |
class Solution(object):
def findDuplicate(self, paths):
"""
:type paths: List[str]
:rtype: List[List[str]]
"""
M = collections.defaultdict(list)
for i in paths:
data = i.split()
base = data[0]
for file in data[1:]:
n... | danisfermi/CodingPractice | LeetCode/Find Duplicate File in System/FindDuplicateFileinSystem.py | Python | gpl-3.0 | 469 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2019 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Version information for Invenio-OpenAIRE.
This file is imported by ``invenio_open... | inveniosoftware/invenio-openaire | invenio_openaire/version.py | Python | mit | 451 |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
Services Cron jobs
"""
from treeio.services.models import TicketQueue, TicketRecord
from django.core.urlresolvers import reverse
import datetime
def tickets_escalate():
"Automatically move tickets ... | rogeriofalcone/treeio | services/cron.py | Python | mit | 2,070 |
import numpy as np
def normalized(a, axis=-1, order=2):
l2 = np.atleast_1d(np.linalg.norm(a, order, axis))
l2[l2==0] = 1
return a / np.expand_dims(l2, axis)
A = np.random.randn(3,3,3)
print normalized(A,0)
print normalized(A,1)
print normalized(A,2)
print normalized(np.arange(3)[:,None])
print normalized... | sergeimoiseev/othodi_code | old2/test_normalized.py | Python | mit | 538 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Radim Rehurek <me@radimrehurek.com>
#
# This code is distributed under the terms and conditions
# from the MIT License (MIT).
#
import gzip
import os
import os.path as P
import subprocess
from unittest import mock
import sys
import pytest
import smart_open.hdfs
CURR_DIR... | RaRe-Technologies/smart_open | smart_open/tests/test_hdfs.py | Python | mit | 4,884 |
x = int(raw_input())
d = input()
i = int(input())
print i[d:]+i[:d]
print i[-d:]+i[:-d]
| ganesh-95/python-programs | pypro/1hr.py | Python | mit | 94 |
# Copyright 2014 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | mateusz-blaszkowski/PerfKitBenchmarker | perfkitbenchmarker/linux_benchmarks/mysql_service_benchmark.py | Python | apache-2.0 | 33,031 |
from types import TupleType
from fontTools.misc.textTools import safeEval
def buildConverters(tableSpec, tableNamespace):
"""Given a table spec from otData.py, build a converter object for each
field of the table. This is called for each table in otData.py, and
the results are assigned to the corresponding ... | olivierdalang/stdm | third_party/FontTools/fontTools/ttLib/tables/otConverters.py | Python | gpl-2.0 | 10,542 |
import numpy as np
from bokeh.sampledata.stocks import AAPL, FB, GOOG, IBM, MSFT
from bokeh.plotting import *
output_server('stocks')
hold()
figure(x_axis_type = "datetime", tools="pan,wheel_zoom,box_zoom,reset,previewsave")
line(np.array(AAPL['date'], 'M64'), AAPL['adj_close'], color='#A6CEE3', legend='AAPL')
lin... | sahat/bokeh | examples/plotting/server/stocks.py | Python | bsd-3-clause | 1,233 |
import os
from fabric.decorators import task
from fabric.api import local, run, cd, env, prefix, hide
from fabric.colors import cyan, red, green, yellow
import app
import git
import virtualenv
@task
def init():
"""Execute init tasks for all components (virtualenv, pip)."""
print(yellow("# Setting up developme... | ronhanson/python-tbx | fabfile/__init__.py | Python | mit | 1,018 |
# -*- coding: utf-8 -*-
# © 2014 Elico Corp (https://www.elico-corp.com)
# Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)
import sale_quotation
import crm
import wizard
| Elico-Corp/openerp-7.0 | sale_quotation/__init__.py | Python | agpl-3.0 | 190 |
from fabric.api import env, local, require
project_name = 'eraldoenergy'
def backup():
"""fab [environment] backup"""
require('environment')
if env.environment == "development":
local('pg_dump -Fc {project} > backups/{project}-{environment}_`date +%Y-%m-%d_%H%M%S`.dump'.format(
projec... | Eraldo/eraldoenergy | fabfile.py | Python | bsd-3-clause | 2,395 |
##############################################################################
# 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... | TheTimmy/spack | var/spack/repos/builtin/packages/molcas/package.py | Python | lgpl-2.1 | 1,895 |
# Copyright 2014 Cloudbase Solutions Srl
#
# 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 ... | phenoxim/cinder | cinder/tests/unit/windows/test_smbfs.py | Python | apache-2.0 | 37,650 |
from pyramid.config import Configurator
from karmaid.redisio import init_redis
from karmaid.resources import StuffResource
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
init_redis(settings, 'redis.')
config = Configurator(settings=settings)
config... | hirokiky/karmaid | karmaid/__init__.py | Python | agpl-3.0 | 732 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django import forms
from django.contrib import admin
from modeltranslation.admin import TranslationAdmin
from .models import Service, Category
@admin.register(Service)
class ServiceAdmin(admin.ModelAdmin):
pass
@admin.register... | Semillas/semillas_backend | services/admin.py | Python | mit | 379 |
# Copyright 2015 - Rackspace US, 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 in... | devdattakulkarni/test-solum | solum/api/controllers/v1/datamodel/app.py | Python | apache-2.0 | 3,434 |
"""
Format and compress XML documents
"""
import getopt
import re
import sys
import xml.parsers.expat
__version__ = "0.2.4"
DEFAULT_BLANKS = False
DEFAULT_COMPRESS = False
DEFAULT_SELFCLOSE = False
DEFAULT_CORRECT = True
DEFAULT_INDENT = 2
DEFAULT_INDENT_CHAR = " "
DEFAULT_INLINE = True
DEFAULT_ENCODING_INPUT = None... | pamoller/xmlformatter | xmlformatter.py | Python | mit | 30,777 |
# setup.py - distutils configuration for esm and esmre modules
# Copyright (C) 2007 Tideway Systems Limited.
#
# 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... | lewcpe/esmre | setup.py | Python | lgpl-2.1 | 2,269 |
# This file is part of Moksha.
# Copyright (C) 2008-2014 Red Hat, 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 b... | mokshaproject/moksha | moksha.hub/moksha/hub/api/consumer.py | Python | apache-2.0 | 8,457 |
'''
All of these views are predicated on the user already being logged in to
valid session.
djago_ug/views.py
John Whelchel
Summer 2013
These are the views for the User Gateway section of the administration
site. They are all decorated with @authenticate to make sure that a user is
logged in; if not, they are redir... | jcnelson/syndicate | old/ms/django_ug/views.py | Python | apache-2.0 | 20,371 |
# Copyright 2017 The Bazel 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 applicable la... | bazelbuild/skydoc | skydoc/load_extractor_test.py | Python | apache-2.0 | 2,898 |
#---------------------------------------------------------------------------
#
# Cell.py: hierarchical compartments containing molecules that react,
# and possibly other compartments too, like in P Systems
#
# by Lidia Yamamoto, July 2013
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#... | danielrcardenas/ac-course-2017 | frameworks/pycellchem-2.0/src/artchem/Cell.py | Python | apache-2.0 | 5,204 |
##############################################################################
# Copyright (c) 2013-2018, 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... | EmreAtes/spack | var/spack/repos/builtin/packages/r-rmysql/package.py | Python | lgpl-2.1 | 1,690 |
# Copyright (C) 2013-2015 Free Software Foundation, 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 3 of the License, or
# (at your option) any later version.
#
# This progr... | cupertinomiranda/binutils | gdb/testsuite/gdb.perf/lib/perftest/testresult.py | Python | gpl-2.0 | 2,216 |
# -*-coding:Utf-8 -*
import xml.etree.cElementTree as ET
__classRegister={}
def RegisterType(cls):
clsName=cls.__name__
__classRegister[clsName]=cls
def GetType(name):
return __classRegister[name]
def GetSubTypes(cls):
res=[]
for T in __classRegister.values():
if issubclas... | astyl/wxPlotLab | mplotlab/utils/abctypes.py | Python | mit | 6,855 |
# 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... | ctrlaltdel/neutrinator | vendor/pbr/util.py | Python | gpl-3.0 | 23,333 |
r"""
**openpnm.materials**
----
This module provides a library of preconfigured Network-Geometry combinations.
In most case the topology and geometry cannot be considered in isolation.
This module provides recipes that create both the Network and Geometry objects
simultaneously to ensure sensible correspondance bet... | TomTranter/OpenPNM | openpnm/materials/__init__.py | Python | mit | 1,200 |
"""Find modules used by a script, using introspection."""
import dis
import imp
import importlib.machinery
import marshal
import os
import sys
import types
import struct
# XXX Clean up once str8's cstor matches bytes.
LOAD_CONST = bytes([dis.opname.index('LOAD_CONST')])
IMPORT_NAME = bytes([dis.opname.index('IMPORT_N... | timm/timmnix | pypy3-v5.5.0-linux64/lib-python/3/modulefinder.py | Python | mit | 23,198 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import contextlib
import warnings
from ...tests.helper import catch_warnings
@contextlib.contextmanager
def ignore_non_integer_warning():
# We need to ignore this warning on Scipy < 0.14.
# When our minimum version of Sc... | DougBurke/astropy | astropy/modeling/tests/utils.py | Python | bsd-3-clause | 586 |
#!/usr/bin/env python
import unittest
from ct.crypto import error
from ct.crypto.asn1 import x509_time
class TimeTest(unittest.TestCase):
def verify_time(self, time_struct, year, month, day, hour, minute, sec):
self.assertEqual(year, time_struct.tm_year)
self.assertEqual(month, time_struct.tm_mo... | php-coder/origin | vendor/github.com/google/certificate-transparency/python/ct/crypto/asn1/x509_time_test.py | Python | apache-2.0 | 2,308 |
"""
Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...
Note:
n is positive and will fit within the range of a 32-bit signed integer (n < 231).
Example 1:
Input:
3
Output:
3
Example 2:
Input:
11
Output:
0
Explanation:
The 11th digit of the sequence 1, 2, 3, 4, 5, 6, 7, 8, 9... | algorhythms/LeetCode | 400 Nth Digit.py | Python | mit | 919 |
blastn=open('LTRs_5copies.txt', 'r')
blastx=open('LTR.blastx.copies.txt', 'r')
biglist=[]
for line in blastn:
line=line.strip()
biglist.append(line)
for elto in blastx:
elto=elto.strip()
biglist.append(elto)
unicos=set(biglist)
for item in unicos:
print item
| stajichlab/localizaTE | scripts/joinlists.py | Python | mit | 270 |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from openerp import api, fields, models, _
import openerp.addons.decimal_precision as dp
from openerp.exceptions import UserError
class SaleAdvancePaymentInv(models.TransientModel):
_name = "sale.advance.payment.inv"
_desc... | QinerTech/QinerApps | openerp/addons/sale/wizard/sale_make_invoice_advance.py | Python | gpl-3.0 | 7,101 |
# Make Makefile
#
# Jul 28, 2005
# Markus Chimani, markus.chimani@cs.uni-dortmund.de
#########################################################
import os, sys, fnmatch, ConfigParser
class versionclass:
def call(self):
return '$(' + self.var + ')'
def library(self):
return self.call() + '/' + libName
def object... | kdbanman/browseRDF | tulip-3.8.0-src/thirdparty/OGDF/makeMakefile.py | Python | gpl-3.0 | 5,988 |
from math import factorial
from itertools import permutations
import multiprocessing
class Puzzle:
def __init__(self, raw_puzzle):
self.raw_puzzle = raw_puzzle
self.rows = []
self.columns = []
self.boxes = []
self.valid = True
if self.check_raw_puzzle() != True:
self.valid = False
print "[-] Fail... | thaReal/sodoku | src/multisolver.py | Python | mit | 1,965 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | gqwest-erp/server | openerp/addons/base/ir/ir_model.py | Python | agpl-3.0 | 55,319 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a dialog for editing the IRC server configuration.
"""
from __future__ import unicode_literals
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QDialog, QDialogButtonBox
from .Ui_I... | testmana2/test | Network/IRC/IrcServerEditDialog.py | Python | gpl-3.0 | 2,240 |
__author__ = 'labx'
| lucarebuffi/OASYS1 | oasys/menus/__init__.py | Python | gpl-3.0 | 20 |
# -*- coding: utf-8 -*-
#
# This file is part of INGInious. See the LICENSE and the COPYRIGHTS files for
# more information about the licensing of this file.
""" Task """
import gettext
from inginious.common.base import id_checker
class Task(object):
""" Contains the data for a task """
def __init__(self, ... | JuezUN/INGInious | inginious/common/tasks.py | Python | agpl-3.0 | 7,488 |
from setuptools import setup, find_packages
setup(
name = 'athletic_pandas',
packages = find_packages(),
version = '0.8.0',
description = 'Workout analysis',
author='Aart Goossens',
author_email='aart@goossens.me',
url='https://github.com/AartGoossens/athletic_pandas',
classifiers=[
... | AartGoossens/athletic_pandas | setup.py | Python | mit | 690 |
import os
from setuptools import setup, find_packages
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='poloniex',
version=... | absortium/poloniex-api | setup.py | Python | mit | 909 |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001-2007 Donald N. Allingham, Martin Hawlisch
# Copyright (C) 2009 Douglas S. Blank
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foun... | pmghalvorsen/gramps_branch | gramps/plugins/gramplet/fanchartdescgramplet.py | Python | gpl-2.0 | 3,450 |
class Solution:
def numTrees(self, n: int) -> int:
dp = [0] * (n + 1)
dp[0] = 1
for j in range(1, n + 1):
for i in range(j):
dp[j] += dp[i] * dp[j - i - 1]
return dp[n]
# Catalan Number
class Solution2:
def numTrees(self, n: int) -> int:
resu... | jiadaizhao/LeetCode | 0001-0100/0096-Unique Binary Search Trees/0096-Unique Binary Search Trees.py | Python | mit | 447 |
import unittest
from mox import MoxTestBase, IsA
from gevent.socket import socket
from slimta.smtp.datareader import DataReader
from slimta.smtp.io import IO
from slimta.smtp import ConnectionLost, MessageTooBig
class TestSmtpDataReader(MoxTestBase, unittest.TestCase):
def setUp(self):
super(TestSmtpDat... | slimta/python-slimta | test/test_slimta_smtp_datareader.py | Python | mit | 3,309 |
from flask import Flask, url_for, render_template
app = Flask(__name__)
@app.route('/')
def hello_world(name=None):
hello = 'hello'
#return render_template('static/index.html', name=name)
#return url_for('static', filename='index.html')
return render_template('index.html', name=name)
if __name__ == ... | jpdoyle/OmegaGo | server/hello.py | Python | mit | 394 |
# Created by Albert Aparicio on 21/10/16
# coding: utf-8
# This import makes Python use 'print' as in Python 3.x
from __future__ import print_function
import h5py
import numpy as np
from tfglib.utils import kronecker_delta
def parse_file(param_len, file_path, offset=0):
# TODO Document the offset parameter
... | albertaparicio/tfglib | tfglib/construct_table.py | Python | lgpl-3.0 | 6,807 |
while True:
print('Enter your age:')
age = input()
if age.isdecimal():
break
print('Please enter a number for your age.')
while True:
print('Select a new password (letters and numbers only):')
password = input()
if password.isalnum():
break
print('Passwords can only have... | ir0nb8t/tutorials | automateTheBoringStuff/vailidateInput.py | Python | gpl-3.0 | 344 |
import locale
import logging
from hashlib import sha1
from django import http
from django.conf.urls import url
from django.contrib import messages
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.core.mail import mail_managers
from django.shortcuts import redirect
from django.templa... | matthiask/django-mooch | mooch/postfinance.py | Python | mit | 6,553 |
from src.feat_extractor import *
from glob import *
import sys
from config import *
def get_features_dict(pkts, fileName=None):
feat_list_key = parse_cfg(fileName)
feature_set = get_conv_feature(pkts)
vec = dict()
for entry in feat_list_key:
try:
vec[entry] = feature_set[entry]
... | xh2310/traffic_feature_extractor | __init__.py | Python | gpl-2.0 | 1,097 |
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from rest_framework import routers
from django.contrib import admin
from orea.settings import base
from defcdb import views
from defcdb import api_views
import autocomplete_light.shortcuts as al
al.autodiscover()
router = routers.DefaultRouter()
router.... | acdh-oeaw/defc-app | orea/urls.py | Python | mit | 6,607 |
from django.contrib import admin
from commoner.server.models import TrustedRelyingParty, TrustedMetadata
class TrustedMetadataAdmin(admin.TabularInline):
model = TrustedMetadata
class TrustedRelyingPartyAdmin(admin.ModelAdmin):
list_display = ('user', 'root')
inlines = [TrustedMetadataAdmin]
admin.site.r... | cc-archive/commoner | src/commoner/server/admin.py | Python | agpl-3.0 | 395 |
from setuptools import setup
from setuptools import find_packages
setup(name='keras_extensions',
version='1.1',
description='Extension library for Keras',
author='Yoshiaki Takahashi',
author_email='',
url='https://github.com/bnsnapper/keras_bn_library',
download_url='',
... | bnsnapper/keras_bn_library | setup.py | Python | mit | 403 |
# META: timeout=long
import json
_window_id = "window-fcc6-11e5-b4f8-330a88ab9d7f"
_frame_id = "frame-075b-4da1-b6ba-e579c2d3230a"
def test_initial_window(session):
# non-auxiliary top-level browsing context
raw_json = session.execute_script("return window;")
obj = json.loads(raw_json)
assert len(ob... | anthgur/servo | tests/wpt/web-platform-tests/webdriver/tests/contexts/json_serialize_windowproxy.py | Python | mpl-2.0 | 1,216 |
x01 = 1 in [1, 2, 3]
x02 = 'a' in [1, 2, 3]
x03 = 'a' in {'a': 1, 'b': 2}
x04 = 1 in (1, 2, 3)
x05 = 1 in 2 in 3
x06 = 1 in 2
| clark800/pystarch | test/testcases/in.py | Python | mit | 126 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-23 11:21
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('service', '0011_auto_20170723_1657'),
]
operations = ... | arifspica/oldTraffordTreasureHunt | webservice/service/migrations/0012_auto_20170723_1821.py | Python | gpl-3.0 | 533 |
from __future__ import absolute_import, unicode_literals
from stravalib import model, attributes, exc, unithelper as uh
from stravalib.client import Client
from stravalib.tests.functional import FunctionalTestBase
import datetime
import requests
class ClientTest(FunctionalTestBase):
def test_get_starred_segment(... | matt-leach/stravalib | stravalib/tests/functional/test_client.py | Python | apache-2.0 | 14,147 |
# Copyright 2022 The T5 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | google-research/text-to-text-transfer-transformer | t5/evaluation/qa_utils_test.py | Python | apache-2.0 | 2,172 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2012 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundati... | andrebellafronte/stoq | stoq/gui/test/test_production.py | Python | gpl-2.0 | 3,913 |
from direct.distributed.MsgTypes import *
OTP_DO_ID_SERVER_ROOT = 4007
OTP_DO_ID_FRIEND_MANAGER = 4501
OTP_DO_ID_LEADERBOARD_MANAGER = 4502
OTP_DO_ID_SERVER = 4600
OTP_DO_ID_UBER_DOG = 4601
OTP_CHANNEL_AI_AND_UD_BROADCAST = 4602
OTP_CHANNEL_UD_BROADCAST = 4603
OTP_CHANNEL_AI_BROADCAST = 4604
OTP_NET_MSGR_CHANNEL_ID_ALL... | ksmit799/Toontown-Source | otp/distributed/OtpDoGlobals.py | Python | mit | 3,284 |
#!/usr/bin/env python
#
# Copyright (C) 2013 Google Inc.
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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 you... | wow2006/ycmd | ycmd/server_utils.py | Python | gpl-3.0 | 1,528 |
# -*- coding: utf-8 -*-
#
# This file is part of the OpenHandWrite project software.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any ... | isolver/OpenHandWrite | distribution/getwrite/experiments/ExperimentTemplate/util.py | Python | gpl-3.0 | 7,017 |
def add_native_methods(clazz):
def getOGLIdString____():
raise NotImplementedError()
clazz.getOGLIdString____ = staticmethod(getOGLIdString____)
| laffra/pava | pava/implementation/natives/sun/java2d/opengl/OGLContext.py | Python | mit | 163 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('io', parent_package, top_path)
config.add_subpackage('tests')
... | bthirion/nipy | nipy/io/setup.py | Python | bsd-3-clause | 499 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "helgapp.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| burk/helgapp | manage.py | Python | mit | 250 |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
# Load extensions
(
sh % "cat"
<< r"""... | facebookexperimental/eden | eden/scm/tests/test-fb-hgext-diff-since-last-submit-t.py | Python | gpl-2.0 | 6,148 |
#!/usr/bin/python
try:
import autotest.common as common
except ImportError:
import common
import unittest
# This has to be done very early.
from autotest.client.shared.settings import settings
settings.override_value('HOSTS', 'default_protection', 'NO_PROTECTION')
from autotest.frontend import setup_django_e... | joyxu/autotest | frontend/afe/resources_unittest.py | Python | gpl-2.0 | 14,636 |
from .voxel_dir import task_dir, storage_dir, image_dir | andyneff/voxel-globe | voxel_globe/tools/__init__.py | Python | mit | 55 |
from defaults import *
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test_db',
}
}
| AlexandreProenca/backend-morandofloripa | morandofloripa/settings/tests.py | Python | mit | 157 |
#!/usr/bin/env python2
# Copyright (c) 2014 The FacileCoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test REST interface
#
from test_framework import FacileCoinTestFramework
from util import *
import jso... | facilecoin/facilecoin-core | qa/rpc-tests/rest.py | Python | mit | 3,267 |
# XXX: This file is copied directly from https://github.com/fuhrysteve/marshmallow-jsonschema
# If changes are made here please make sure that they are also available upstream.
import datetime
import uuid
import decimal
from marshmallow import fields, missing
from marshmallow.compat import text_type, binary_type
__a... | deliveryhero/lymph-schema | lymph/schema/_jsonschema.py | Python | apache-2.0 | 3,409 |
import logging
from time import sleep
from celery.result import AsyncResult
from django.core.management import BaseCommand
from delft3dcontainermanager.tasks import do_docker_remove, get_docker_ps
from delft3dworker.models import Container, Scene
"""
Synchronization command that's called periodically.
- Run docker p... | openearth/delft3d-gt-server | delft3dworker/management/commands/containersync_sceneupdate.py | Python | gpl-3.0 | 4,813 |
from lnst.Common.Utils import bool_it
from lnst.Controller.Task import ctl
from lnst.Controller.PerfRepoUtils import perfrepo_baseline_to_dict
from lnst.Controller.PerfRepoUtils import netperf_result_template
from lnst.RecipeCommon.ModuleWrap import ping, ping6, netperf
from lnst.RecipeCommon.IRQ import pin_dev_irqs
f... | jiriprochazka/lnst | recipes/regression_tests/phase3/vxlan_remote.py | Python | gpl-2.0 | 8,824 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | Azure/azure-sdk-for-python | sdk/cognitiveservices/azure-cognitiveservices-anomalydetector/azure/cognitiveservices/anomalydetector/models/_models_py3.py | Python | mit | 16,053 |
# -*- 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 field 'Audio.filetype'
db.add_column('filer_audio', 'filetype',
self.gf('djan... | hzlf/openbroadcast | website/__filer/migrations/0014_auto__add_field_audio_filetype.py | Python | gpl-3.0 | 11,114 |
import sys, os, glob, zipfile
ROOT = 'apps/Tasks/Release/'
FILES = [
'tasks.exe',
'locale/Tasks.*'
]
def paths():
for FILE in FILES:
for name in glob.iglob(os.path.join(ROOT, FILE)):
yield (name, os.path.join('bin', os.path.relpath(name, ROOT)))
with zipfile.ZipFile(sys.argv[1], 'w') as zip:
... | mbits-os/JiraDesktop | scripts/jenkins_win32.py | Python | mit | 394 |
#!/usr/bin/env python
"""AFF4 RDFValue implementations.
This module contains the various RDFValue implementations.
"""
| darrenbilby/grr | lib/rdfvalues/__init__.py | Python | apache-2.0 | 121 |
from django.contrib import admin
from manoseimas.scrapy import services
from manoseimas.scrapy.models import Question
from manoseimas.scrapy.models import Person
from manoseimas.scrapy.models import Voting
from manoseimas.scrapy.models import PersonVote
class VotingAdmin(admin.ModelAdmin):
list_display = ('title... | ManoSeimas/manoseimas.lt | manoseimas/scrapy/admin.py | Python | agpl-3.0 | 1,687 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import int_or_none
class DigitekaIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://(?:www\.)?(?:digiteka\.net|ultimedia\.com)/
(?:
deliver/
(?P<embed_type>
... | mxamin/youtube-dl | youtube_dl/extractor/digiteka.py | Python | unlicense | 3,507 |
class Command(object):
def __init__(self, args=None):
self.args = args
def __str__(self):
return '{0}'.format(self.__class__.__name__)
class GetState(Command):
pass
class Stop(Command):
pass
class GetProperty(Command):
def __init__(self, prop=None):
self.prop = prop
... | unix-beard/gloria | service/command.py | Python | mit | 874 |
from __future__ import unicode_literals
from prompt_toolkit.completion import Completer, Completion
import os
__all__ = (
'PathCompleter',
'ExecutableCompleter',
)
class PathCompleter(Completer):
"""
Complete for Path variables.
:param get_paths: Callable which returns a list of directories to ... | niklasf/python-prompt-toolkit | prompt_toolkit/contrib/completers/filesystem.py | Python | bsd-3-clause | 3,740 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.