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 |
|---|---|---|---|---|---|
"""`Singleton` provider resetting context manager example."""
from dependency_injector import containers, providers
class UserService:
...
class Container(containers.DeclarativeContainer):
user_service = providers.Singleton(UserService)
if __name__ == '__main__':
container = Container()
user_se... | rmk135/objects | examples/providers/singleton_resetting_with.py | Python | bsd-3-clause | 630 |
"""
Test utilities for waffle utilities.
"""
# Can be used with FilteredQueryCountMixin.assertNumQueries() to blacklist
# waffle tables. For example:
# QUERY_COUNT_TABLE_BLACKLIST = WAFFLE_TABLES
# with self.assertNumQueries(6, table_blacklist=QUERY_COUNT_TABLE_BLACKLIST):
WAFFLE_TABLES = [
"waffle_utils_waffl... | eduNEXT/edx-platform | openedx/core/djangoapps/waffle_utils/testutils.py | Python | agpl-3.0 | 457 |
#Processes the little-endian wave data as follows:
#1)shift right four bits
#2)prepend with 0011 (D/A header)
import struct
import sys
DAHeader=0x3000 #0011 0000 0000 0000
while True:
twobytes=sys.stdin.read(2)
if len(twobytes)==0:
break
elif len(twobytes)!=2:
assert False
sample=stru... | fginter/music-player | prep_files/packbits.py | Python | gpl-2.0 | 607 |
"""
file: repository.py
author: Ben Grawi <bjg1568@rit.edu>
date: October 2013
description: Holds the repository abstraction class and ORM
"""
import uuid
from db import *
from datetime import datetime
class Repository(Base):
"""
Commit():
description: The SQLAlchemy ORM for the repository table
"""
... | CommitAnalyzingService/CAS_Analyzer | repository.py | Python | gpl-2.0 | 932 |
#!/usr/bin/env python
from cass import add_friends, get_friend_usernames, remove_friend, save_user, save_tweet
from random import randint, choice
USERS = ("stewie", "brian", "meg", "lois", "peter", "chris")
WORDS = [
["implement", "utilize", "integrate", "streamline", "optimize", "evolve", "transform", "embrace",... | adhish20/TwitterWithCassandra | generate_test_data.py | Python | mit | 3,057 |
class Constraint(object):
def __init__(self,checkFunction):
self._check = checkFunction
def __instancecheck__(self,other):
return self._check(other)
def __str__(self):
return "Simple function-constraint"
def errorString(self):
return "Value did not match " + str(self.... | odd100/Checky | checky/Constraint.py | Python | gpl-2.0 | 1,620 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import sys
class Emacs(AutotoolsPackage, GNUMirrorPackage):
"""The Emacs programmable text edit... | iulian787/spack | var/spack/repos/builtin/packages/emacs/package.py | Python | lgpl-2.1 | 3,601 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
"""
Unit test for the CLI interface
"""
import os
import unittest
import subprocess
import sys
import tarfile
sys.path.append('..')
from libmat import mat
import test
class TestRemovecli(test.MATTest):
"""
test if cli correctly remove metadatas
"""
... | jubalh/MAT | test/clitest.py | Python | gpl-2.0 | 4,824 |
import clips6
env = clips6.ENV()
env.DLmodule("require.so")
s = env.SHELL()
print s.EVAL('(require-python "a" "b")') | vulogov/clips6 | modules/require/example/example0.py | Python | gpl-3.0 | 117 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | cvandeplas/plaso | plaso/frontend/pinfo.py | Python | apache-2.0 | 8,965 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# «recovery_gtk» - Dell Recovery GTK Frontend
#
# Copyright (C) 2010, Dell Inc.
#
# Author:
# - Mario Limonciello <Mario_Limonciello@Dell.com>
#
# This is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as publishe... | fourdollars/dell-recovery | Dell/recovery_gtk.py | Python | gpl-2.0 | 10,786 |
import os
from msl.loadlib import Server32, Client64
from msl.examples.loadlib import EXAMPLES_DIR
if Server32.is_interpreter():
def skipif_no_server32(*args):
pass
else:
from conftest import skipif_no_server32
class Ex32(Server32):
def __init__(self, host, port, **kwargs):
# this class... | MSLNZ/msl-loadlib | tests/test_server32_examples_dir.py | Python | mit | 1,096 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2016-12-21 13:35
from __future__ import unicode_literals
from django.db import migrations
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import wagtail.wagtailimages.blocks
class Migration(migrations.Migration):
dependencies = [
... | terotic/digihel | digi/migrations/0011_fix_guidepages_fields.py | Python | mit | 1,242 |
#!/usr/bin/env python
from sys import stdout, stderr, exit
from os.path import join, dirname, isfile
from itertools import izip, chain
from optparse import OptionParser
import json
import re
from psycho import dict2hierarchy
from pairwise_similarities import PAT_POS, PAT_CHR
MIN_SIZE = 10
def compute_coverage(roo... | danydoerr/PSyCHO | scripts/tree_info.py | Python | mit | 2,790 |
# -*- coding: utf-8 -*-
""" Sahana Eden Fire Models
@copyright: 2009-2014 (c) Sahana Software Foundation
@license: MIT
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... | gnarula/eden_deployment | modules/s3db/fire.py | Python | mit | 20,324 |
import unittest
import pytk.geo as geo
class GeoRQuatTest(unittest.TestCase):
def test_pow(self):
w = geo.rquat([1, 0, 0, 0])
x = geo.rquat([0, 1, 0, 0])
y = geo.rquat([0, 0, 1, 0])
z = geo.rquat([0, 0, 0, 1])
self.assertAlmostEqual((w ) ** 2, 1)
self.a... | bigblindbais/pytk | tests/geo/test_rquat.py | Python | mit | 1,090 |
"""initial migration
Revision ID: ece17263bec4
Revises: 2daaf886cde0
Create Date: 2017-03-06 15:45:10.499087
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ece17263bec4'
down_revision = '2daaf886cde0'
branch_labels = None
depends_on = None
def upgrade():
... | TomSGao/blogTom | migrations/versions/ece17263bec4_initial_migration.py | Python | mit | 1,151 |
import math
import random
import re
placeholderList = [3, 41, 12, 9, 74, 15]
placeholderText = 'The quick brown fox jumped over the lazy dog'
placeholderFile = 'mbox.txt'
def calculateCount(countList):
count = 0
for itervar in countList:
count = count + 1
print('Count = ', count)
def calculateDegrees():
inp = ... | henrydambanemuya/pyutils | pyutils.py | Python | mit | 2,221 |
#
# @file TestL3SpeciesReference.py
# @brief L3 SpeciesReference unit tests
#
# @author Akiya Jouraku (Python conversion)
# @author Sarah Keating
#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
#
# This file was generated automatically by converting ... | TheCoSMoCompany/biopredyn | Prototype/src/libsbml-5.10.0/src/bindings/python/test/sbml/TestL3SpeciesReference.py | Python | bsd-3-clause | 6,771 |
# -*- coding: utf-8 -*-
from ccxt.async.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import OrderNotFound
class acx (Exchange):
def describe(self):
return self.deep_extend(super(acx, self).describe(), {
'id': 'acx',
'name': 'ACX',... | tritoanst/ccxt | python/ccxt/async/acx.py | Python | mit | 14,134 |
# 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 t... | ctrlaltdel/neutrinator | vendor/keystoneauth1/tests/unit/test_fixtures.py | Python | gpl-3.0 | 13,460 |
import json
from django.contrib.auth import get_user_model
from requests.models import Response
from authlib.jose import JsonWebToken, KeySet, RSAKey
try:
from unittest.mock import patch, Mock
except ImportError:
from mock import patch, Mock
key = RSAKey.generate_key(is_private=True)
def make_id_token(sub,
... | ByteInternet/drf-oidc-auth | oidc_auth/test.py | Python | mit | 2,575 |
#!/usr/bin/env python3
# -!- encoding:utf8 -!-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# file: user_location.py
# date: 2017-09-26
# author: paul.dautry
# purpose:
#
# license:
# MapIF - Where are INSA de Lyon IF students right now ?
# Copyright (C) 2017 Loic To... | LoicTouzard/MapIf | core/classes/model/user_location.py | Python | gpl-3.0 | 7,289 |
"""
Unit tests for optimization routines from optimize.py
Authors:
Ed Schofield, Nov 2005
Andrew Straw, April 2008
To run it in its simplest form::
nosetests test_optimize.py
"""
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from numpy.testing import (a... | ales-erjavec/scipy | scipy/optimize/tests/test_optimize.py | Python | bsd-3-clause | 39,326 |
'''
Created on 13 abr. 2017
@author: javit
'''
| cruceno/JMC-AGILENT-DAQ | pyagilentdaq/workers/daq.py | Python | gpl-3.0 | 48 |
x = ["hello"]
y = None
def whatever(arg):
global y
y = arg
whatever(x.remove_at(0)) | Microsoft/pxt | tests/pyconverter-test/cases/array_generics4.py | Python | mit | 93 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
from six import iteritems, string_types
import frappe
import datetime
from frappe import _
from frappe.model import default_fields
from frappe.model.naming import set_new_name
fr... | RicardoJohann/frappe | frappe/model/base_document.py | Python | mit | 25,413 |
# coding: utf-8
from .transition import Transition as Tr
from .state import BaseState
| BernardFW/bernard | src/bernard/engine/__init__.py | Python | agpl-3.0 | 87 |
# Copyright 2015 RethinkDB, all rights reserved.
import errno
import socket
import struct
from tornado import gen, iostream
from tornado.ioloop import IOLoop
from tornado.concurrent import Future
from . import ql2_pb2 as p
from .net import decodeUTF, Query, Response, Cursor, maybe_profile
from .net import Connection ... | Qinusty/rethinkdb | drivers/python/rethinkdb/tornado_net/net_tornado.py | Python | agpl-3.0 | 10,717 |
from django.apps import apps
from django.contrib.sites.models import Site
def split_events_from_other_related_content(context, related_content):
context["related"] = {}
context["related"]["other"] = []
context["related"]["event"] = []
for rc in related_content:
if rc.__class__.__name__ == "Eve... | Ircam-Web/mezzanine-organization | organization/core/utils.py | Python | agpl-3.0 | 1,911 |
#!/usr/bin/env python
#
# Copyright 2016 Medoly
#
# 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 agr... | whiteclover/Medoly | medoly/config/hocon.py | Python | apache-2.0 | 38,051 |
import itertools
import json
import random
import time
from ast import literal_eval as make_tuple
from multiprocessing import Process, Queue
import numpy as np
import psutil
from sklearn import preprocessing
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.gaussian_process i... | zalandoresearch/fashion-mnist | benchmark/runner.py | Python | mit | 8,622 |
# -*- coding: utf-8 -*-
#
# python-slackclient documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 27 17:36:09 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated ... | slackhq/python-slackclient | docs-src-v2/conf.py | Python | mit | 9,887 |
# -*- coding: utf8 -*-
"""
Copyright 2014-2016 Andreas Würl
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 ap... | wuan/bo-python | blitzortung/dataimport/raw_signal.py | Python | apache-2.0 | 1,941 |
__author__ = "Andre Merzky, Ole Weidner"
__copyright__ = "Copyright 2012-2013, The SAGA Project"
__license__ = "MIT"
import re
import os
import sys
import errno
import tempfile
import saga.utils.misc as sumisc
import radical.utils as ru
import saga.utils.pty_shell_factory as supsf
... | telamonian/saga-python | src/saga/utils/pty_shell.py | Python | mit | 42,614 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-30 16:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crm', '0026_auto_20170530_1153'),
]
operations = [
migrations.AddField(
... | asterix135/infonex_crm | crm/migrations/0027_auto_20170530_1202.py | Python | mit | 662 |
def forenkling(a,b):
while b!=0:
gammel_b=b
b=a%b
a=gammel_b
#print(a,b)
return a
print(forenkling(30,20))
print(forenkling(10,2))
def gcd(a,b):
a=forenkling(a,b)
return a
def reduce_fraction(a,b):
divisor=forenkling(a,b)
a=int(a/diviso... | TorleifHensvold/ITGK3 | Oving5/torleif/07_Forenkling_av_brøker.py | Python | mit | 706 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2021-2022 Daniel Estevez <daniel@destevez.net>
#
# This file is part of gr-satellites
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
from gnuradio import gr, digital
import pmt
from ...hier.sync_to_pdu_packed import sync_to_pdu_packed
from ...hdlc_deframer ... | daniestevez/gr-satellites | python/components/deframers/yusat_deframer.py | Python | gpl-3.0 | 2,570 |
# 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 u... | apache/incubator-superset | tests/integration_tests/thumbnails_tests.py | Python | apache-2.0 | 11,708 |
# -*- coding: utf-8 -*-
# Copyright (c)2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a dialog to enter the data to relocate the workspace.
"""
from __future__ import unicode_literals
from PyQt5.QtWidgets import QDialog
from .Ui_SvnRelocateDialog import Ui_SvnRelocateDialog
class SvnR... | davy39/eric | Plugins/VcsPlugins/vcsSubversion/SvnRelocateDialog.py | Python | gpl-3.0 | 1,284 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'A minesweeper clone for the terminal',
'author': '4Evergreen4',
'url': 'https://github.com/4Evergreen4/nsweeper',
'download_url': 'https://github.com/4Evergreen4/nsweeper/archive/ma... | 4Evergreen4/nsweeper | setup.py | Python | lgpl-3.0 | 496 |
"""
DockerInspect - Command ``docker inspect --type={TYPE}``
========================================================
This module parses the output of the ``docker inspect`` command. This uses
the ``core.marshalling.unmarshal`` function to parse the JSON output from the
commands. The parsed data can be accessed a di... | RedHatInsights/insights-core | insights/parsers/docker_inspect.py | Python | apache-2.0 | 2,828 |
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
# clamav-unofficial-updates: ClamAV third party signature updates library
# Copyright (C) 2015 Andrew Colin Kissa <andrew@topdog.za.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Li... | akissa/clamav-unofficial-updates | clamav_unofficial_updates/utils.py | Python | agpl-3.0 | 2,383 |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Pub... | flumotion-mirror/flumotion | flumotion/worker/checks/gst010.py | Python | lgpl-2.1 | 8,378 |
"""
Tests for exporting OLX content.
"""
from __future__ import absolute_import
import shutil
import tarfile
import unittest
from six import StringIO
from tempfile import mkdtemp
import ddt
import six
from django.core.management import CommandError, call_command
from path import Path as path
from xmodule.modulestor... | ESOedX/edx-platform | cms/djangoapps/contentstore/management/commands/tests/test_export_olx.py | Python | agpl-3.0 | 3,608 |
# -*- coding: utf-8 -*-
from .base import *
# memcache
CACHES = {
'default' : {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
}
}
| davegri/Sikumia | sikumim/settings/development.py | Python | gpl-2.0 | 162 |
"""
pymc models for the analysis of fluorescence assay data.
"""
#=============================================================================================
# IMPORTS
#=============================================================================================
import numpy as np
import pymc
#===================... | MehtapIsik/assaytools | AssayTools/pymcmodels.py | Python | lgpl-2.1 | 28,046 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
import re
import string
import urllib.parse
from typing import List, Optional as TOptional, Set
from pyparsing import ( # noqa
Combin... | 4shadoww/usploit | lib/packaging/requirements.py | Python | mit | 4,664 |
# -*- 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 'GeoWidget.url'
db.alter_column(u'operations_geowidget', 'url', self.gf('django.db.models.... | ngageoint/geoevents | geoevents/operations/migrations/0020_auto__chg_field_geowidget_url.py | Python | mit | 19,138 |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import \
assert_array_almost_equal, assert_raises, TestCase, dec
from scipy.sparse.csgraph import \
shortest_path, dijkstra, floyd_warshall, johnson,\
bellman_ford, construct_dist_matrix, NegativeCycleErr... | sargas/scipy | scipy/sparse/csgraph/tests/test_shortest_path.py | Python | bsd-3-clause | 6,099 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def read_vocabulary(vocabulary_file):
"""Read ``vocabulary_file`` and return them in a structured way."""
vocabulary = []
with open(vocabulary_file) as f:
vocabulary = f.readlines()
return set(vocabulary)
def read_text(text, markup=None):
"""... | MartinThoma/pyspell | pyspell/utils.py | Python | mit | 405 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
merge.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*********************************... | luofei98/qgis | python/plugins/processing/algs/gdal/merge.py | Python | gpl-2.0 | 2,918 |
import collections
import sys
import six
IS_PYPY = '__pypy__' in sys.builtin_module_names
def _get_object_init():
if six.PY3 or IS_PYPY:
return six.get_unbound_function(object.__init__)
OBJECT_INIT = _get_object_init()
class classproperty(object):
def __init__(self, f):
self.f = f
d... | vertical-knowledge/mainline | mainline/utils.py | Python | gpl-3.0 | 1,108 |
import sys, os
if os.path.isfile("/usr/lib/enigma2/python/enigma.zip"):
sys.path.append("/usr/lib/enigma2/python/enigma.zip")
from Tools.Profile import profile, profile_final
profile("PYTHON_START")
import Tools.RedirectOutput
import enigma
import eConsoleImpl
import eBaseImpl
enigma.eTimer = eBaseImpl.eTimer
enigma... | BlackPole/bp-enigma2 | mytest.py | Python | gpl-2.0 | 17,159 |
""" Python Common Deployment Utils Package """
import os, site
def sitepath(package = 'analyticobjects', stdout = True):
pth = os.path.join(site.getsitepackages()[0], package)
if stdout:
print(pth)
return pth
| JoelBondurant/RandomCodeSamples | python/deployment.py | Python | apache-2.0 | 216 |
from setuptools import setup, find_packages
setup(
name="chronicler",
version="2.3.0",
description="Game tracker for Warmachine",
url="http://github.com/elwinar/chronicler",
author="Romain Baugue",
author_email="romain.baugue@elwinar.com",
license="The Unlicense",
zip_safe=False,
in... | elwinar/chronicler | setup.py | Python | unlicense | 585 |
""" Encoding Aliases Support
This module is used by the encodings package search function to
map encodings names to module names.
Note that the search function normalizes the encoding names before
doing the lookup, so the mapping will have to map normalized
encoding names to module names.
Con... | tempbottle/ironpython3 | Src/StdLib/Lib/encodings/aliases.py | Python | apache-2.0 | 15,287 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import re
import collections
import itertools
import math
import logging
from monty.json import MSONable, MontyDecoder
from functools import lru_cache
import numpy as np
from scipy.spatial import ConvexHull
... | montoyjh/pymatgen | pymatgen/analysis/phase_diagram.py | Python | mit | 83,286 |
# This file is part of the Indico plugins.
# Copyright (C) 2020 - 2022 CERN and ENEA
#
# The Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License;
# see the LICENSE file for more details.
from flask import session
from flask_pluginengine import current_plu... | indico/indico-plugins | vc_zoom/indico_vc_zoom/forms.py | Python | mit | 6,046 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 2 23:56:26 2017
@author: p
"""
""" Recurrent Neural Network.
A Recurrent Neural Network (LSTM) implementation example using TensorFlow library.
This example is using the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/)
Lin... | iABC2XYZ/abc | RNN/testRNN6.py | Python | gpl-3.0 | 4,358 |
from .utils import format_dict
import requests
def get_bitcoin_data(url, json_output=False):
try:
response = requests.get(url)
except requests.exceptions.ConnectionError:
print("Unable to fetch data! Check your internet connection.")
except Exception as e:
print(e)
else:
... | SharadKumar97/OSINT-SPY | modules/bitcoin.py | Python | gpl-3.0 | 1,076 |
#!/usr/bin/env python3
"""
https://adventofcode.com/2016
--- Day 5: How About a Nice Game of Chess? ---
You are faced with a security door designed by Easter Bunny engineers that seem
to have acquired most of their security knowledge by watching hacking movies.
The eight-character password for the door is generated... | rocian/AdventOfCode2016 | 05/solutions.py | Python | gpl-3.0 | 4,016 |
# -*- coding: utf-8 -*-
"""
@brief test log(time=73s)
"""
import os
import unittest
import shutil
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, skipif_appveyor, skipif_travis, add_missing_development_version
import ensae_teaching_cs
class TestNotebookRunner2aAlgo(unit... | sdpython/ensae_teaching_cs | _unittests/ut_dnotebooks/test_2A_notebook_algo.py | Python | mit | 2,087 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016 CERN.
#
# Invenio 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... | krzysztof/zenodo-migrator | zenodo_migrator/legacy/accessrequests.py | Python | gpl-2.0 | 1,973 |
#!/usr/bin/env python3
from cmd import Cmd
import argparse, socket, struct, time, pdb, os, sys
from binascii import hexlify, unhexlify
host = '192.168.0.203'
port = 2540
service = 'adc'
def call_de0(srv, cmd):
try:
host, port = srv.split(':')
port = int(port)
s = socket.so... | ivanovev/alt | gui/SDRAM.py | Python | gpl-3.0 | 4,912 |
from __future__ import (
absolute_import,
division,
print_function
)
import logging
import boto.swf.layer2 as swf
from boto.swf.exceptions import (
SWFTypeAlreadyExistsError,
SWFDomainAlreadyExistsError,
)
_LOGGER = logging.getLogger(__name__)
def register(domain='test', workflows=(), activitie... | sportarchive/CloudProcessingEngine-Decider | pydecider/register.py | Python | gpl-3.0 | 1,688 |
import sys, re
from subprocess import Popen, PIPE
import framework.mynumpy as np
info = {}
QUIET=True
ONLY_TIME=True
USE_CODE_COUNTERS=True
import framework.beamformer.capon.getCaponCUDA as getCaponCUDA
#sys.path.append('/home/me/Work/UiO/Phd/Code/Profile')
def getTimings(app_name='testEfficiency_default',
... | jpaasen/cos | framework/beamformer/capon/RealTimeCapon/profile/prof.py | Python | mit | 13,692 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
(r'^ckeditor/', include('ckeditor.urls')),
# The welcome to logged in view
url(
... | jonejone/tourney | tourney/frontend/urls.py | Python | bsd-2-clause | 725 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_04_01/operations/_vpn_server_configurations_associated_with_virtual_wan_operations.py | Python | mit | 8,289 |
#
# Evy - a concurrent networking library for Python
#
# Unless otherwise noted, the files in Evy are under the following MIT license:
#
# Copyright (c) 2012, Alvaro Saurin
# Copyright (c) 2008-2010, Eventlet Contributors (see AUTHORS)
# Copyright (c) 2007-2010, Linden Research, Inc.
# Copyright (c) 2005-2006, Bob Ippo... | inercia/evy | evy/patched/time.py | Python | mit | 1,624 |
import os
from setuptools import setup, find_packages
install_requires = []
tests_require = [
'nose2==0.5'
]
setup(
name='python-active-com-api',
version='0.1.4',
description='Python client for Active.com API',
classifiers=[
"Programming Language :: Python :: 3",
"Intended Audien... | v0y/python-active-com-api | setup.py | Python | mit | 729 |
#!/usr/bin/env python
#===============================================================================
# Copyright (c) 2014 Geoscience Australia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#... | GeoscienceAustralia/gdf | gdf/_gdfutils.py | Python | apache-2.0 | 5,320 |
# -*- coding: utf-8 -*-
from . import test_sale_triple_discount
| acsone/sale-workflow | sale_triple_discount/tests/__init__.py | Python | agpl-3.0 | 65 |
##########################################################################
#
# Copyright (c) 2011, John Haddon. All rights reserved.
# Copyright (c) 2011-2014, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... | lucienfostier/gaffer | python/GafferUI/ScrolledContainer.py | Python | bsd-3-clause | 5,893 |
# LOFAR IMAGING PIPELINE
# Prepare phase node
# Wouter Klijn
# 2012
# klijn@astron.nl
# -----------------------------------------------------------------------------
import sys
import shutil
import os
import subprocess
import copy
import pyrap.tables as pt # order of pyrap import influences the type
... | kernsuite-debian/lofar | CEP/Pipeline/recipes/sip/nodes/imager_prepare.py | Python | gpl-3.0 | 16,283 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
import zerver.lib.str_utils
class Migration(migrations.Migration):
dependencies = [
('analytics', '0002_remove_huddlecount'),
]
operations = [
migrations.CreateModel(
name='FillState',
fields=[
... | Galexrt/zulip | analytics/migrations/0003_fillstate.py | Python | apache-2.0 | 798 |
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'object/usable')
object.setStfFilename('static_item_n')
object.setStfName('item_officer_clicky_01_02')
object.setDetailFilename('static_item_d')
object.setDetailName('item_officer_clicky_01_02')
object.setIntAttribute('no_trade', 1)
obj... | agry/NGECore2 | scripts/object/tangible/loot/generic_usable/item_officer_clicky_01_02.py | Python | lgpl-3.0 | 493 |
# Copyright 2019 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/kfac | kfac/examples/autoencoder_mnist_tpu_strategy.py | Python | apache-2.0 | 8,402 |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module defines an excitation spectrum class.
"""
from pymatgen.core.spectrum import Spectrum
class ExcitationSpectrum(Spectrum):
"""
Basic excitation spectrum object.
.. attribute: x
The sequen... | vorwerkc/pymatgen | pymatgen/analysis/excitation.py | Python | mit | 644 |
from django.shortcuts import render
# Create your views here.
def panel_test(request):
return render(request, 'panel/index.html', {}) | VidasContadas/nomesevoces_viz | vidas_app/views.py | Python | gpl-2.0 | 136 |
# GUI object/properties browser.
# Copyright (C) 2011 Matiychuk D.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later ve... | moden-py/SWAPY-deleting | proxy.py | Python | lgpl-2.1 | 26,563 |
# Copyright 2015 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | googleapis/python-bigquery | google/cloud/bigquery/table.py | Python | apache-2.0 | 99,225 |
# encoding=utf8
import os
from distutils.core import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
README = read('README.rst')
setup(
name = "django-form-designer",
version = "0.8.0",
url = 'http://github.com/philomat/django-form-designer',
license = 'B... | decodetechnology/django-form-designer | setup.py | Python | bsd-3-clause | 1,648 |
# encoding: utf-8
"""
nexthop.py
Created by Thomas Mangin on 2009-11-05.
Copyright (c) 2009-2013 Exa Networks. All rights reserved.
"""
from exabgp.protocol.ip.inet import Inet,rawinet
from exabgp.bgp.message.update.attribute.id import AttributeID
from exabgp.bgp.message.update.attribute import Flag,Attribute
# ====... | mshahbaz/exabgp | lib/exabgp/bgp/message/update/attribute/nexthop.py | Python | bsd-3-clause | 1,188 |
# -*- coding: utf-8 -*-
import httplib as http
import pytest
from pytz import utc
from datetime import datetime
import urllib
from nose.tools import * # flake8: noqa
import re
from tests.base import ApiTestCase, DbTestCase
from osf_tests import factories
from tests.utils import make_drf_request_with_version
from a... | hmoco/osf.io | api_tests/base/test_serializers.py | Python | apache-2.0 | 19,864 |
#!/bin/env/python3
# file : bm_u.py
# divers utilitaires
import datetime
def title(msg):
print("*" * 30)
print(msg)
print("*" * 30)
def date_is_fr(date):
"""Verifie qu'une date est au format français.
>>> date_is_fr('31/12/1964')
True
>>> date_is_fr('31/13/1964')
False
"""
... | bermau/jemorganise | bm_u.py | Python | gpl-3.0 | 1,921 |
############################ Copyrights and license ############################
# #
# Copyright 2018 Justin Kufro <jkufro@andrew.cmu.edu> #
# Copyright 2018 Ivan Minno <iminno@andrew.cmu.edu> ... | ahmad88me/PyGithub | github/Clones.py | Python | lgpl-3.0 | 3,515 |
"""
Tests of modulestore semantics: How do the interfaces methods of ModuleStore relate to each other?
"""
from __future__ import absolute_import
import itertools
from collections import namedtuple
import ddt
from mock import patch
from xblock.core import XBlock, XBlockAside
from xblock.fields import Scope, String
f... | jolyonb/edx-platform | common/lib/xmodule/xmodule/modulestore/tests/test_semantics.py | Python | agpl-3.0 | 19,838 |
# never name this package "types", or mypy will crash in ugly ways
# necessary for annotating constructors
from __future__ import annotations
from dataclasses import dataclass
from datetime import timedelta
from pathlib import Path
from typing import Tuple, AbstractSet, Union
from dbt.dataclass_schema import (
d... | analyst-collective/dbt | core/dbt/helper_types.py | Python | apache-2.0 | 3,400 |
# 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 https://mozilla.org/MPL/2.0/.
from selenium.webdriver.common.by import By
from pages.base import BasePage
class FirefoxWhatsNewNightly70Page(BaseP... | mozilla/bedrock | tests/pages/firefox/whatsnew/whatsnew_nightly_70.py | Python | mpl-2.0 | 608 |
# http://stackoverflow.com/questions/11637467/modify-ini-file-with-python/11637494#11637494
# https://bigfix.me/relevance/details/3019050#comments
# http://stackoverflow.com/questions/2081640/what-exactly-do-u-and-r-string-flags-do-in-python-and-what-are-raw-string-l
import ConfigParser
config=ConfigParser.RawConfigP... | jgstew/tools | Python/edit_ini.py | Python | mit | 496 |
"""empty message
Revision ID: 094ef5ae04e9
Revises: 358d9bf8f69a
Create Date: 2016-05-04 21:31:06.305069
"""
# revision identifiers, used by Alembic.
revision = '094ef5ae04e9'
down_revision = '358d9bf8f69a'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
... | perna/podigger | migrations/versions/094ef5ae04e9_.py | Python | mit | 656 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-15 19:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hamask', '0010_auto_20170608_1737'),
]
operations = [
migrations.AlterField... | rawenihcam/BER-SERKR | hamask/migrations/0011_auto_20170615_1520.py | Python | mit | 879 |
"""This package is for integration tests.
Unit tests live side-by-side with tested modules.
"""
| sio2project/filetracker | filetracker/tests/__init__.py | Python | gpl-3.0 | 97 |
# server.py -- Implementation of the server side git protocols
# Copryight (C) 2008 Jelmer Vernooij <jelmer@samba.org>
#
# 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
# or (at... | harsh-a1/repeater-testing | dulwich/dulwich/client.py | Python | gpl-2.0 | 5,919 |
"""Fake HUG API module usable for testing importation of modules"""
import hug
@hug.get()
def made_up_hello():
"""GETting for science!"""
return "hello from GET"
@hug.post()
def made_up_hello():
"""POSTing for science!"""
return "hello from POST"
| timothycrosley/hug | tests/module_fake_many_methods.py | Python | mit | 267 |
# -*- coding: utf-8 -*-
from PyQt5.QtWidgets import QTableWidget, QComboBox
from hamcrest import contains, has_items, equal_to, has_item
from cute.matchers import named, showing_on_screen
from cute.widgets import TableViewDriver, ComboBoxDriver
from tgit.ui.pages.chain_of_title_tab import ChainOfTitleTab
from... | Iconoclasteinc/tgit | testing/drivers/chain_of_title_tab_driver.py | Python | gpl-3.0 | 5,149 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-29 05:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('magic', '0002_auto_20170929_0159'),
]
operations = [
migrations.AlterField(... | Angoreher/xcero | magic/migrations/0003_auto_20170929_0229.py | Python | mit | 696 |
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/fuzzbench | experiment/test_dispatcher.py | Python | apache-2.0 | 8,788 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_iot_hub_client_enums.py | Python | mit | 6,174 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.