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 |
|---|---|---|---|---|---|
import _plotly_utils.basevalidators
class TickmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="tickmode", parent_name="heatmap.colorbar", **kwargs
):
super(TickmodeValidator, self).__init__(
plotly_name=plotly_name,
paren... | plotly/python-api | packages/python/plotly/plotly/validators/heatmap/colorbar/_tickmode.py | Python | mit | 605 |
"""
Copyright 2016 Mellanox Technologies. All rights reserved.
Licensed under the GNU General Public License, version 2 as
published by the Free Software Foundation; see COPYING for details.
"""
__author__ = """
jiri@mellanox.com (Jiri Pirko)
idosch@mellanox.com (Ido Schimmel)
"""
from lnst.Controller.Task import ctl... | jiriprochazka/lnst | recipes/switchdev/l2-018-bridge_fdb_team.py | Python | gpl-2.0 | 4,141 |
#!/usr/bin/env python
# coding: utf-8
import os
import sys
from setuptools.command.test import test as TestCommand
from jsonmodels import __version__, __author__, __email__
from setuptools import setup
PROJECT_NAME = 'jsonmodels'
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.e... | beregond/jsonmodels | setup.py | Python | bsd-3-clause | 2,441 |
from .perceptron import MultilayerPerceptron
from .autoencoder import AutoEncoder
__all__ = ('MultilayerPerceptron', 'AutoEncoder',)
| rogerfan/simpleml | simpleml/neural/__init__.py | Python | mpl-2.0 | 134 |
import config
from wmlib.scripts.deploy import deploy
if __name__ == '__main__':
deploy(config)
| onoga/wm | sql/test/deploy.py | Python | gpl-2.0 | 99 |
# -*- coding: utf-8 -*-
##===-----------------------------------------------------------------------------*- Python -*-===##
# _
# | |
# __| | __ ___ ___ ___
# / _` |/ _` \ \ /\ / / '_ |
# | (_| | (_| |\ V V /| | | |
# \__,_|\__,_| \_/\_/ |_| |_| - Compiler Toolchain
##
##
# This file is distributed under the MI... | MeteoSwiss-APN/dawn | dawn/src/dawn4py/serialization/utils.py | Python | mit | 27,374 |
import maya.cmds as cm
import maya.mel as mm
import pymel.core as pm
try:
from PySide2 import QtWidgets, QtCore, QtGui
except ImportError:
from PySide import QtCore, QtGui
QtWidgets = QtGui
# Get Maya Main Window
mayaMainWindow = pm.ui.Window('MayaWindow').asQtObject()
# Wrapper
SIGNAL = QtCore.Signal
# UI... | josephkirk/PipelineTools | sample/qt_ui.py | Python | bsd-2-clause | 3,109 |
# -*- coding: utf-8 -*-
"""Commands for managing launch configurations."""
import click
from ...jobs import launchconfigurations as launchconfig_jobs
from ...jobs.exceptions import AwsError
from ...jobs.exceptions import MissingKey
from ...jobs.exceptions import Non200Response
from ...jobs.exceptions import Permiss... | jtpaasch/armyguys | armyguys/cli/commands/launchconfigs.py | Python | mit | 5,292 |
from bson import ObjectId
import simplejson as json
from eve.tests import TestBase
from eve.tests.test_settings import MONGO_DBNAME
from eve.tests.utils import DummyEvent
from eve import STATUS_OK, LAST_UPDATED, ID_FIELD, ISSUES, STATUS, ETAG
from eve.methods.patch import patch_internal
class TestPatch(TestBase):
... | jzorrof/eve | eve/tests/methods/patch.py | Python | bsd-3-clause | 25,507 |
""" A neural chatbot using sequence to sequence model with
attentional decoder.
This is based on Google Translate Tensorflow model
https://github.com/tensorflow/models/blob/master/tutorials/rnn/translate/
Sequence to sequence model by Cho et al.(2014)
Created by Chip Huyen as the starter code for assignment 3,
cla... | adukic/nd101 | tf-stanford-tutorials/assignments/chatbot/data.py | Python | mit | 9,394 |
"""
swat-s1 run.py
"""
from mininet.net import Mininet
from mininet.cli import CLI
from minicps.mcps import MiniCPS
from topo import SwatTopo
import sys
class SwatS1CPS(MiniCPS):
"""Main container used to run the simulation."""
def __init__(self, name, net):
self.name = name
self.net = n... | remmihsorp/minicps | examples/swat-s1/run.py | Python | mit | 948 |
from django import forms
from django.contrib import admin
from .models import Album, Photo, Video
from .utils import youtube_video_id
import re
class VideoAddForm(forms.ModelForm):
link = forms.URLField(label='Link', help_text='Youtube or Vimeo link', required=True)
class Meta:
model = Video
... | eeriks/velo.lv | velo/gallery/admin.py | Python | gpl-3.0 | 2,767 |
from test.integration.base import DBTIntegrationTest, use_profile
class TestSeverity(DBTIntegrationTest):
@property
def schema(self):
return "severity_045"
@property
def models(self):
return "models"
@property
def project_config(self):
return {
'config-ver... | analyst-collective/dbt | test/integration/045_test_severity_tests/test_severity.py | Python | apache-2.0 | 3,711 |
# -*- coding: utf-8 -*-
# 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... | googleapis/python-pubsublite | samples/generated_samples/pubsublite_generated_pubsublite_v1_admin_service_list_reservations_sync.py | Python | apache-2.0 | 1,539 |
from nose import with_setup
import numpy as np
import unittest
import PySeis
from PySeis import Stream
class ContainerTests(unittest.TestCase):
def setUp(self):
self.path = "/home/stewart/data/su/"
def test_initialise_SU_file(self):
PySeis.loadSU(self.path+"test.su", self.path+"raw.np... | stuliveshere/PySeis | tests/PySeis_tests.py | Python | mit | 735 |
import mock
import unittest
from makobot.plugins.extractor import EmailExtractor, HostExtractor, \
IPExtractor, MD5Extractor, URLExtractor
class EmailExtractorTestCase(unittest.TestCase):
def setUp(self):
self.extractor = EmailExtractor()
def test_extract(self):
mock_message = mock.Mock(... | Swimlane/makobot | tests/plugins/test_extractor.py | Python | mit | 2,331 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | caio2k/RIDE | src/robotide/lib/robot/running/signalhandler.py | Python | apache-2.0 | 3,284 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/... | rackerlabs/melange | melange/tests/unit/test_ipv6.py | Python | apache-2.0 | 2,466 |
# 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... | shakamunyi/tensorflow | tensorflow/python/eager/execute.py | Python | apache-2.0 | 8,290 |
# Generated by Django 2.2.12 on 2021-12-23 22:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('games', '0048_auto_20211223_0647'),
]
operations = [
migrations.AddField(
model_name='game',
name='coverart',
... | lutris/website | games/migrations/0049_game_coverart.py | Python | agpl-3.0 | 411 |
import os, time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
def sendQuery(query, browser):
queryElement = browser.find_element_by_id("reset-button").click()
queryElement = browser.find_element_by_id("query-text")
queryElement.send_keys(query)
queryEl... | anotherik/Prolog | mrBOT.py | Python | apache-2.0 | 2,033 |
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://etetoolkit.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the... | fmaguire/ete | ete3/evol/parser/codemlparser.py | Python | gpl-3.0 | 12,529 |
from edc.dashboard.section.classes import BaseSectionView, site_sections
from .search import MaternalSearchByWord
from .models import MaternalConsent
class SectionMaternalView(BaseSectionView):
section_name = 'maternal'
section_display_name = 'Maternal'
section_display_index = 20
section_template = '... | botswana-harvard/eit | eit/apps/eit_maternal/section.py | Python | gpl-3.0 | 541 |
# -*- coding: utf-8 -*-
{
'name': 'test-workflow',
'version': '0.1',
'category': 'Tests',
'description': """A module to play with workflows.""",
'author': 'OpenERP SA',
'maintainer': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['base'],
'data': ['data.xml', 'ir.mode... | diogocs1/comps | web/openerp/addons/test_workflow/__openerp__.py | Python | apache-2.0 | 456 |
# This is a Bokeh server app. To function, it must be run using the
# Bokeh server ath the command line:
#
# bokeh serve --show patch_app.py
#
# Running "python patch_app.py" will NOT work.
import numpy as np
from bokeh.io import curdoc
from bokeh.layouts import gridplot
from bokeh.plotting import figure
from boke... | percyfal/bokeh | examples/howto/patch_app.py | Python | bsd-3-clause | 2,271 |
from graphmap.map_generator import build_graph
if __name__ == '__main__':
# robot_pos = {'point': [ 87, 17.45 ], 'angle': 0}
# target_pos = {'point': (148, 16), 'angle': 0}
robot_pos = { 'point': [ 211.5, 25.75], 'angle': 180 }
target_pos = { 'point': (221.35, 103.9), 'angle': 135}
g = build_gra... | Ecam-Eurobot-2017/main | code/raspberrypi/display_graph.py | Python | mit | 416 |
from __future__ import absolute_import
import sys
import copy
import codecs
from . import TypeSlots
from .ExprNodes import not_a_constant
import cython
cython.declare(UtilityCode=object, EncodedString=object, bytes_literal=object,
Nodes=object, ExprNodes=object, PyrexTypes=object, Builtin=object,
... | hhsprings/cython | Cython/Compiler/Optimize.py | Python | apache-2.0 | 186,187 |
from __future__ import division, print_function, absolute_import
__all__ = ['imread']
from numpy import array
def imread(fname, flatten=False, mode=None):
"""
Load an image from file.
Parameters
----------
fname : str
Image file name, e.g. ``test.jpg``.
flatten : bool, optional
... | sargas/scipy | scipy/ndimage/io.py | Python | bsd-3-clause | 1,346 |
# 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... | strint/tensorflow | tensorflow/compiler/tests/nary_ops_test.py | Python | apache-2.0 | 10,569 |
import pytest
import itertools
import os
from ...preprocessors import LockCells
from .base import BaseTestPreprocessor
from .. import create_code_cell
@pytest.fixture
def preprocessor():
return LockCells()
class TestLockCells(BaseTestPreprocessor):
@staticmethod
def deletable(cell):
return cel... | jhamrick/nbgrader | nbgrader/tests/preprocessors/test_lockcells.py | Python | bsd-3-clause | 6,903 |
import hashlib
from functools import lru_cache
def triple(hex, c):
for x in range(32 - 2):
if hex[x] == hex[x+1] == hex[x+2]:
return hex[x] == c
return False
def fives(hex):
x = 0
while x <= 32 - 5:
if hex[x] == hex[x+1] == hex[x+2] == hex[x+3] == hex[x+4]:
yi... | mofr/advent-of-code | 2016/day14.py | Python | apache-2.0 | 962 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2012 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... | CERNDocumentServer/invenio | modules/miscutil/lib/filedownloadutils_unit_tests.py | Python | gpl-2.0 | 1,830 |
"""Fix missing logical file for composite resources. If there are resource files in django
for any composite resource that are not part of any logical file, each of those files are made
part of a generic logical file.
* By default, prints errors on stdout.
* Optional argument --log: logs output to system log.
"""
fro... | ResearchSoftwareInstitute/MyHPOM | hs_core/management/commands/fix_missing_logical_files.py | Python | bsd-3-clause | 2,354 |
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard 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 3 of th... | lynnlyc/for-honeynet-reviewers | dsfsSensorOpt/SensorOpt/androguard/core/bytecodes/dvm.py | Python | gpl-3.0 | 230,940 |
import unittest
import os
import tempfile
import shutil
import contextlib
from scrapy.utils.project import data_path
@contextlib.contextmanager
def inside_a_project():
prev_dir = os.getcwd()
project_dir = tempfile.mkdtemp()
try:
os.chdir(project_dir)
with open('scrapy.cfg', 'w') as f:
... | kmike/scrapy | tests/test_utils_project.py | Python | bsd-3-clause | 1,242 |
from gym.spaces import Box
from multiworld.core.serializable import Serializable
import numpy as np
class ProxyEnv(Serializable):
def __init__(self, wrapped_env):
self.quick_init(locals())
self._wrapped_env = wrapped_env
@property
def wrapped_env(self):
return self._wrapped_env
... | kschmeckpeper/multiworld | multiworld/core/wrapper_env.py | Python | mit | 3,874 |
# Copyright 2013-2021 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 *
class Xlsclients(AutotoolsPackage, XorgPackage):
"""xlsclients is a utility for listing informat... | LLNL/spack | var/spack/repos/builtin/packages/xlsclients/package.py | Python | lgpl-2.1 | 774 |
# 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... | Gilbert88/mesos | src/python/cli_new/lib/cli/util.py | Python | apache-2.0 | 13,337 |
import argparse
import logging
import sys
from mwm.decode_id import decode_id
from mwm.dump_mwm import dump_mwm
from mwm.find_feature import find_and_print_features
from mwm.ft2osm import ft2osm
from mwm.mwm_feature_compare import compare_mwm
logger = logging.getLogger("mwm")
logger.setLevel(logging.ERROR)
class Mw... | darina/omim | tools/python/mwm/__main__.py | Python | apache-2.0 | 4,581 |
# Copyright 2017 gRPC 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 writing... | ctiller/grpc | tools/run_tests/performance/massage_qps_stats.py | Python | apache-2.0 | 28,751 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.jvm.targets.jar_dependency import JarDependency
from pants.build_graph.target import Target
from pants.base.payload import Payload
from pants.base.payload... | ericzundel/mvn2pants | src/python/squarepants/plugins/copy_signed_jars/targets/signed_jars.py | Python | apache-2.0 | 640 |
# -*- coding: utf-8 -*-
# Aualé oware graphic user interface.
# Copyright (C) 2014-2020 Joan Sala Soler <contact@joansala.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 Free Software Foundation, either version 3... | joansalasoler/auale | src/auale/gui/widgets/board_animator.py | Python | gpl-3.0 | 7,553 |
"""
Cycler
======
Cycling through combinations of values, producing dictionaries.
You can add cyclers::
from cycler import cycler
cc = (cycler(color=list('rgb')) +
cycler(linestyle=['-', '--', '-.']))
for d in cc:
print(d)
Results in::
{'color': 'r', 'linestyle': '-'}
{'color'... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/cycler.py | Python | bsd-2-clause | 15,959 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-20 23:06
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | luisen14/treatment-tracking-project | treatment_tracker/researchers/migrations/0001_initial.py | Python | apache-2.0 | 2,881 |
# coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import glob
import os
import re
from zipfile import ZipFile
from pants.backend.native.co... | foursquare/pants | tests/python/pants_test/backend/python/tasks/test_ctypes_integration.py | Python | apache-2.0 | 4,716 |
import sys
import gzip
import os
import logging
import argparse
DEBUG = False
NTA_TAG = ":CLIP_"
if DEBUG:
inputFile="Z:/Shared/Labs/Vickers Lab/Tiger/projects/20150930_TGIRT_tRNA_human/identical/result/KCVH01_clipped_identical.fastq.gz"
outputFile="H:/temp/KCVH01_clipped_identical_NTA.fastq.gz"
cca... | shengqh/ngsperl | lib/SmallRNA/fastqSmallRnaNTA.py | Python | apache-2.0 | 3,491 |
#!/usr/bin/env python
#encoding:utf-8
import os
import sys
import requests
import MySQLdb
from bs4 import BeautifulSoup
from bs4 import SoupStrainer
if len(sys.argv) != 4:
print 'Invalid parameters!'
exit(1)
print '=' * 60
print 'start:', sys.argv
aim_category_id = int(sys.argv[1])
start_point = (int(sys.ar... | JayvicWen/Crawler | 3che/crawler.py | Python | mit | 4,816 |
"""
Usage: python scorer_mentions.py key_file.conll response_file.conll
"""
import re,sys,pdb,copy
from collections import defaultdict
# ======================================================================= #
""" SETTINGS """
#noun_pos_tags,pronoun_pos_tags=['NN','NE'],['PPER','PPOSAT','PRELS'] #German; TuebaD/... | a-rios/spanish_coref | corzu_es/arcs_inferred_antecedents.py | Python | gpl-3.0 | 18,686 |
# Generated by Django 1.10.5 on 2017-05-02 21:44
import django.core.validators
from django.db import migrations, models
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
class Migration(migrations.Migration):
dependencies = [
("zerver",... | andersk/zulip | zerver/migrations/0081_make_emoji_lowercase.py | Python | apache-2.0 | 1,463 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
from local_packages.binary_tree import TreeNode
class Solution:
def lowestCommonAncestor(
self, root: "TreeNode", p: "TreeNode", q: "TreeNode"
... | l33tdaima/l33tdaima | pr1644m/lowest_common_ancestor2.py | Python | mit | 800 |
from models import City, Country
import factory
class CityFactory(factory.DjangoModelFactory):
remote_id = factory.Sequence(lambda n: n + 1)
class Meta:
model = City
class CountryFactory(factory.DjangoModelFactory):
remote_id = factory.Sequence(lambda n: n + 1)
class Meta:
model = ... | ramusus/django-vkontakte-places | vkontakte_places/factories.py | Python | bsd-3-clause | 328 |
#!/usr/bin/env python
# Copyright (c) 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 pyauto_functional # Must be imported before pyauto
import pyauto
from webdriver_pages import settings
from webdriver_pages.... | aYukiSekiguchi/ACCESS-Chromium | chrome/test/functional/prefs_ui.py | Python | bsd-3-clause | 7,292 |
#!/usr/bin/env python3
from contextlib import contextmanager
import time
from main import has_subset_sum_zero
class Duration:
def __init__(self, elapsed=None):
self.elapsed = elapsed
@contextmanager
def timeit():
duration = Duration()
tic = time.time()
yield duration
elapsed = time.time... | vigojug/reto | 201705/migonzalvar/biggest_set.py | Python | bsd-3-clause | 1,359 |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/compiler/mlir/tfr/python/tfr_gen.py | Python | apache-2.0 | 57,147 |
# -*- coding: utf-8 -*-
from django.conf import settings
INFLUXDB_HOST = getattr(settings, 'METRICS_INFLUXDB_HOST', 'localhost')
INFLUXDB_PORT = getattr(settings, 'METRICS_INFLUXDB_PORT', 8086)
INFLUXDB_DBNAME = getattr(settings, 'METRICS_INFLUXDB_DBNAME', 'erudit-metrics')
INFLUXDB_USER = getattr(settings, 'METRICS... | erudit/zenon | eruditorg/core/metrics/conf/settings.py | Python | gpl-3.0 | 628 |
# name: Gas simulation
# You can to turn gravity :)
let("earth_gravity", False)
# Also: you can try to >play< a simulation for a few seconds and then >pause< it,
# change speed to -10 or change "forward" to "backward" in the line below:
let('direction', 'forward')
# and then >play< it again.
# Change you have made co... | krassowski/basic-particle-simulator | simulations/gas.py | Python | bsd-3-clause | 842 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | abhikeshav/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_man_xml_ttyagent_oper.py | Python | apache-2.0 | 21,347 |
#!/usr/bin/env python3
# written by sqall
# twitter: https://twitter.com/sqall01
# blog: https://h4des.org
# github: https://github.com/sqall01
#
# Licensed under the GNU Affero General Public License, version 3.
import os
from typing import Optional
# this class is a global configuration class that holds
# values... | sqall01/alertR | sensorClientFIFO/lib/globalData/globalData.py | Python | agpl-3.0 | 1,738 |
# -*- encoding:utf-8 -*-
execfile("../config.py")
execfile("../method.py")
@task
def create_emacs_file_dir():
"""[1]!emacsで使うフォルダと設定ファイルを作成"""
if not dir_exists(EMACS_DIR):
run('mkdir ' + EMACS_DIR)
if not dir_exists(EMACS_DIR + "backups"):
run('mkdir ' + EMACS_DIR + "backups")
run('touch ' + EMACS... | cndlhvn/pilotis | configuration/fabfile.py | Python | gpl-3.0 | 7,066 |
import base64
import io
import logging
import requests
from fints.utils import Password
from .exceptions import *
from .message import FinTSInstituteMessage, FinTSMessage
logger = logging.getLogger(__name__)
class FinTSHTTPSConnection:
def __init__(self, url):
self.url = url
def send(self, msg: Fi... | raphaelm/python-fints | fints/connection.py | Python | lgpl-3.0 | 1,345 |
# Uses python3
import sys
FIBONACCI_LAST_DIGIT_MAX_VALUE = 10 ** 7
def get_fibonacci_last_digit(n):
if n < 1:
return n
a, b = 1, 1
for i in range(2, n):
a, b = b, (a + b) % 10
return b
if __name__ == '__main__':
input = sys.stdin.read()
n = int(input)
print(get_fibonacci... | chaicko/AlgorithmicToolbox | introduction_problems/fibonacci_last_digit.py | Python | gpl-3.0 | 336 |
import pytest
from tests.test_utils import add_log_response
from treeherder.etl.jobs import store_job_data
from treeherder.etl.push import store_push_data
from treeherder.model.error_summary import get_error_summary
from treeherder.model.models import Job, TextLogError
from ..sampledata import SampleData
@pytest.fi... | jmaher/treeherder | tests/log_parser/test_tasks.py | Python | mpl-2.0 | 1,853 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2015 Digi International, Inc.
"""Server Command Interface functionality"""
from devicecloud.apibase im... | michaelcho/python-devicecloud | devicecloud/sci.py | Python | mpl-2.0 | 7,640 |
# Copyright (c) 2017 Dirk Hartmann
#
# 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, distr... | soulchainer/qtile | test/test_scratchpad.py | Python | mit | 9,296 |
"""
PureMVC Python Port by Toby de Havilland <toby.de.havilland@puremvc.org>
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
"""
import puremvc.core
import puremvc.interfaces
import puremvc.patterns.observer
class Fac... | PureMVC/puremvc-python-demo-gae-blog | src/puremvc/patterns/facade.py | Python | bsd-3-clause | 9,327 |
import json
def with_token_query_string(func):
def wrapper(self):
resp = self.simulate_post('/user')
token = resp.json.get('token')
return func(self, "token=%s" % token)
return wrapper
def create_waifu(tast_case, token_qs):
body = json.dumps({'name': 'foo', 'description': 'bar'... | sketchturnerr/WaifuSim-backend | utils/test_utils.py | Python | cc0-1.0 | 453 |
import mock
from django.test import TestCase
from mediaviewer.views.signout import signout
class TestSignout(TestCase):
def setUp(self):
self.logout_patcher = mock.patch('mediaviewer.views.signout.logout')
self.mock_logout = self.logout_patcher.start()
self.addCleanup(self.logout_patcher... | kyokley/MediaViewer | mediaviewer/tests/views/test_signout.py | Python | mit | 1,454 |
# Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk)
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
import sys
__doc__="""
Consumer class that builds a Structure object. This is used by ... | dbmi-pitt/DIKB-Micropublication | scripts/mp-scripts/Bio/PDB/StructureBuilder.py | Python | apache-2.0 | 9,884 |
with open('data/rosalind_hamm.txt', 'r') as sample:
data = [line[:-1] for line in sample]
count = 0
for n, base in enumerate(data[0]):
if base != data[1][n]:
count += 1
else:
print(count)
| polentozer/testing_0 | rosalind/count-point-mutations.py | Python | mit | 209 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import datetime
class Migration(migrations.Migration):
dependencies = [
('waifufmapp', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='artist',
... | Adria331/WaifuFM | waifufmapp/migrations/0002_auto_20170420_1500.py | Python | gpl-3.0 | 1,081 |
import unittest
from unittest import TestCase
from algorithms.dataStructures.BinaryTree import BinaryTreeNode
from algorithms.dataStructures.BinaryTree import BinaryTree
class binary_tree_creation_Test(TestCase):
def test_create_node(self):
n = BinaryTreeNode(1)
self.assertIsInstance(n, BinaryTr... | mohrtw/algorithms | algorithms/tests/test_binary_tree.py | Python | mit | 5,736 |
# -*- coding: utf-8 -*-
##
## This file is part of INSPIRE.
## Copyright (C) 2015 CERN.
##
## INSPIRE 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) a... | ioannistsanaktsidis/inspire-next | inspire/base/format_elements/bfe_inspire_ntis_link.py | Python | gpl-2.0 | 1,441 |
# (C) British Crown Copyright 2014 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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 3 of the License, or
# (at your option) any l... | Jozhogg/iris | lib/iris/tests/unit/analysis/regrid/test_RectilinearRegridder.py | Python | lgpl-3.0 | 49,758 |
# Copyright 2015 Agile Business Group <http://www.agilebg.com>
# Copyright 2021 Lorenzo Battistini @ TAKOBI
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import datetime
from dateutil.rrule import MONTHLY
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
... | OCA/l10n-italy | l10n_it_vat_statement_split_payment/tests/test_vat_statement_split.py | Python | agpl-3.0 | 10,516 |
# -*- coding: utf-8 -*-
'''
Mepinta
Copyright (c) 2011-2012, Joaquin G. Duo
This file is part of Mepinta.
Mepinta 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 opti... | joaduo/mepinta | core/python_core/common/type_checking/isiterable.py | Python | gpl-3.0 | 972 |
"""Copyright 2008 Orbitz WorldWide
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | Talkdesk/graphite-web | webapp/graphite/urls.py | Python | apache-2.0 | 1,581 |
import discord
from discord.ext import commands
import logging
import re
XPOST = re.compile('x-?post #(?P<channel>\w+)', re.IGNORECASE)
class Xposter:
"""Bot that detects x-posts and dispatches them to desired channels"""
log = logging.getLogger('red.Xposter')
def __init__(self, bot):
self.bot... | phagara/cogs | xposter/xposter.py | Python | bsd-2-clause | 1,022 |
__author__ = 'Jonathan Spitz'
import numpy as np
# ##################################### BUILDER CLASS ##################################### #
# A Builder object creates a new population using a given population by applying
# reproduction operators like crossover and mutation.
# To create an object you'll need to pr... | lothas/vrep-python-ai | Builder/Builder.py | Python | mit | 4,343 |
from ..base import WLElement
class Wyroznienie(WLElement):
TXT_PREFIX = "*"
TXT_SUFFIX = "*"
EPUB_TAG = HTML_TAG = "em"
EPUB_CLASS = HTML_CLASS = "author-emphasis"
| fnp/librarian | src/librarian/elements/styles/wyroznienie.py | Python | agpl-3.0 | 183 |
# -*- coding: utf-8 -*-
from pyknyx.common.singleton import *
import unittest
# Mute logger
from pyknyx.services.logger import logging; logger = logging.getLogger(__name__)
from pyknyx.services.logger import logging
logger = logging.getLogger(__name__)
logging.getLogger("pyknyx").setLevel(logging.ERROR)
@six.add_me... | knxd/pKNyX | tests/common/singleton.py | Python | gpl-3.0 | 617 |
#!/usr/bin/env python
#
# 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 program is distributed in the hope that... | abaruchi/DataTransfer | Test/Source/experiments.py | Python | mit | 4,266 |
# https://www.ietf.org/rfc/rfc3309.txt
import array
import os
try:
if os.environ.get('CRC32C_SW_MODE', None) is None:
os.environ['CRC32C_SW_MODE'] = 'auto'
from crc32c import crc32 as _crc32c_native
except ImportError:
_crc32c_native = None
CRC_TABLE = (
0x00000000, 0xf26b8303, 0xe13b70f7, 0x... | lanpa/tensorboardX | tensorboardX/crc32c.py | Python | mit | 4,744 |
# coding: utf-8
import project
import itertools
## Create Project Manager
projectManager = project.ProjectManager()
## Set up project variables
projectManager.load_yaml('ACOMPLETER/conf.yml')
## Initialize instance
projectManager.set_instance_name('ACOMPLETER')
projectManager.set_ssh_key_file('ACOMPLETER')
projectM... | wikistat/Ateliers-Big-Data | GoogleCloud/main_docker.py | Python | mit | 1,640 |
#
# Copyright 2013 eNovance
#
# 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, ... | ityaptin/ceilometer | ceilometer/middleware.py | Python | apache-2.0 | 2,346 |
### utilities have been normalized to fall in the interval [0,1]
### to obtain the expeted utility with unscaled utilities apply the transformation 20*MEU-2H, where MEU is the value obtained with this formulation
#
## HORIZON
import sys
if len(sys.argv) < 2:
print "Usage:", sys.argv[0], "H, where H is a positive i... | denismaua/kpu-pp | limids/generate_maze_limid.py | Python | gpl-2.0 | 7,978 |
# debugthg.py - debugging library for TortoiseHg shell extensions
#
# Copyright 2008 Steve Borho <steve@borho.org>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2, incorporated herein by reference.
debugging = ''
try:
import _winreg
try:
... | gilshwartz/tortoisehg-caja | tortoisehg/util/debugthg.py | Python | gpl-2.0 | 1,489 |
from pymongo import MongoClient
from src.conf.serverconf import MONGODB_DATABASE, MONGODB_HOST, MONGODB_PORT
class DBmanager:
def __init__(self):
self.connection = None
def openConnection(self):
self.connection = MongoClient(MONGODB_HOST, MONGODB_PORT)
def closeConnection(self):
... | fikipollo/paintomics3 | PaintomicsServer/src/common/DBmanager.py | Python | gpl-3.0 | 683 |
"""Utilities"""
from circuits.six import iterbytes
def is_ssl_handshake(buf):
"""Detect an SSLv2 or SSLv3 handshake"""
# SSLv3
v = buf[:3]
if v in ("\x16\x03\x00", "\x16\x03\x01", "\x16\x03\x02"):
return True
# SSLv2
v = list(iterbytes(buf[:2])) + [0x00, 0x00]
if (v[0] & 0x80 ==... | nizox/circuits | circuits/net/utils.py | Python | mit | 384 |
from collections import namedtuple
import sublime
from sublime_plugin import WindowCommand
from ..git_command import GitCommand
from ...common import util
MenuOption = namedtuple("MenuOption", ["requires_action", "menu_text", "filename", "is_untracked"])
CLEAN_WORKING_DIR = "Nothing to commit, working directory cl... | ddevlin/GitSavvy | core/commands/quick_stage.py | Python | mit | 4,843 |
# -*- coding: utf-8 -*-
#
# SPIDAL documentation build configuration file, created by
# sphinx-quickstart on Wed May 18 09:56:03 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 file.
#
# Al... | DSC-SPIDAL/www | docs/source/conf.py | Python | apache-2.0 | 13,791 |
"""tests basic polymorphic mapper loading/saving, minimal relationships"""
from sqlalchemy import exc as sa_exc
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import Table
from sqlalchemy import testing
from sqlalchemy.orm import polymorphic_union
from sq... | monetate/sqlalchemy | test/orm/inheritance/test_poly_persistence.py | Python | mit | 16,839 |
# Copyright 2013 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.
"""Base class for linker-specific test cases.
The custom dynamic linker can only be tested through a custom test case
for various technical reasons:
... | markYoungH/chromium.src | build/android/pylib/linker/test_case.py | Python | bsd-3-clause | 19,753 |
from cx_Oracle import CLOB
from django.contrib.gis.db.backends.base.adapter import WKTAdapter
from django.contrib.gis.geos import GeometryCollection, Polygon
class OracleSpatialAdapter(WKTAdapter):
input_size = CLOB
def __init__(self, geom):
"""
Oracle requires that polygon rings are in prop... | georgemarshall/django | django/contrib/gis/db/backends/oracle/adapter.py | Python | bsd-3-clause | 1,508 |
# -*- coding: utf-8 -*-
import os
import sys
from six.moves.configparser import ConfigParser
class Config(object):
def __init__(self):
config_file = os.environ.get('CONFIG')
if config_file is None:
print('Environment variable "CONFIG" not defined.')
sys... | estnltk/abbreviation-resolver | abresolver/config.py | Python | gpl-2.0 | 561 |
from django.dispatch import Signal
class_prepared = Signal(providing_args=["class"])
pre_init = Signal(providing_args=["instance", "args", "kwargs"])
post_init = Signal(providing_args=["instance"])
pre_save = Signal(providing_args=["instance", "raw", "using"])
post_save = Signal(providing_args=["instance", "raw", "c... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/db/models/signals.py | Python | bsd-3-clause | 658 |
from bs4 import BeautifulSoup
from progressbar import ProgressBar
import requests
import os
import urllib
import urllib2
def getChapterURLs():
url = 'http://www.deltau.org/ChapterExcellence'
page = urllib2.urlopen('http://www.deltau.org/ChapterExcellence').read()
soup = BeautifulSoup(page, 'html.parser')... | carsonmclean/deltau-cep-scraper | scraper.py | Python | mit | 2,947 |
#### PATTERN | NL | INFLECT ########################################################################
# -*- coding: utf-8 -*-
# Copyright (c) 2010 University of Antwerp, Belgium
# Author: Tom De Smedt <tom@organisms.be>
# License: BSD (see LICENSE.txt for details).
######################################################... | EricSchles/pattern | pattern/text/nl/inflect.py | Python | bsd-3-clause | 16,402 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Exercise the listtransactions API
from test_framework.test_framework import ElectrumTestFramework
from... | sinraf96/electrum | qa/rpc-tests/listtransactions.py | Python | mit | 10,091 |
l = []
for x in range(7):
l.append(set())
with open(r'car.data') as somefile:
for line in somefile:
L = line.split(',')
for i, item in enumerate(L):
l[i].add(item)
for x in range(7):
l[x] = list(l[x])
print l[x];
f = open('car_nor.csv','w')
with open(r'car.data') as somefile... | septicmk/IBM_ML_toolbox | data/car_nor.py | Python | bsd-3-clause | 634 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/... | usc-isi/essex-baremetal-support | nova/virt/libvirt/volume.py | Python | apache-2.0 | 9,213 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.