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 random
from django.template import Library
register = Library
@register.filter
def shuffle(arg):
tmp = list(arg)[:]
random.shuffle(tmp)
return tmp | otreblatercero/cinesnob | califas/templatetags/shuffle.py | Python | gpl-2.0 | 158 |
#!/usr/bin/env python
'''
Set of analytics based on ssdeep hash.
- compare
Simple implementation of ssdeep comparisions using a few optimizations
described at the links below
https://www.virusbulletin.com/virusbulletin/2015/11/optimizing-ssdeep-use-scale
http://www.intezer.com/intezer-community-tip-s... | jmlong1027/multiscanner | analytics/ssdeep_analytics.py | Python | mpl-2.0 | 10,551 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | anilmuthineni/tensorflow | tensorflow/python/kernel_tests/softplus_op_test.py | Python | apache-2.0 | 3,261 |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 31 09:47:43 2016
@author: johnsom
"""
import requests, warnings, datetime, re
from lxml import etree
from pandas import DataFrame, date_range
from dateutil import parser
def get_FDI(region):
url = 'http://www.cfa.vic.gov.au/restrictions/%s-fired... | mrjoh3/raspberrypi | CFA_FDI.py | Python | mit | 1,708 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsExpression.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__a... | myarjunar/QGIS | tests/src/python/test_qgsexpression.py | Python | gpl-2.0 | 6,832 |
import json
import os
import ibm_db
import re
from flask import Flask
from flask import redirect
from flask.helpers import url_for
app = Flask(__name__)
def get_sqldb_dsn(vcap_services):
"""Returns the data source name for IBM SQL DB."""
parsed = json.loads(vcap_services)
credentials = parsed["sqldb"][0]... | itucsdb1522/itucsdb1522 | db2/server_db2.py | Python | gpl-3.0 | 2,236 |
# coding: utf-8
# In[6]:
get_ipython().magic('pylab inline')
# In[7]:
from plasticnet import *
# ## 1D BCM
# In[8]:
from plasticnet import *
pre=neurons.pattern_neuron([10])
post=neurons.linear_neuron(1)
c=connections.BCM(pre,post,[0,.05])
c.eta=5e-7
c.tau=1000
sim=simulation(1000*1000)
sim.monitor(c,['weig... | bblais/Plasticnet | examples/Example Low D Rate Based.py | Python | mit | 2,017 |
"""Unit tests for the Peewee time mixins and fields."""
import datetime
import arrow
import peewee
import pendulum
import pytest
from fleaker.peewee.fields import ArrowDateTimeField, PendulumDateTimeField
from fleaker.peewee.mixins import (
ArchivedMixin, CreatedMixin, CreatedModifiedMixin, ArrowArchivedMixin,
... | croscon/fleaker | tests/peewee/test_time.py | Python | bsd-3-clause | 4,240 |
"""
Utility functions for CMS models
"""
from urllib.parse import urlparse, parse_qs
def get_coupon_code(request):
"""
Get coupon code from an HttpRequest
Args:
request (django.http.request.HttpRequest): An HttpRequest
Returns:
str: A coupon code or None if none found
"""
nex... | mitodl/micromasters | cms/util.py | Python | bsd-3-clause | 627 |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from appearanceConfig_ui import Ui_Form
class Appearance_Config(QWidget, Ui_Form):
def __init__(self, parent, defaultConfig = None):
QWidget.__init__(self)
self.parent = parent
self.setupUi(self)
self.width_slider.setValue(parent.... | alandmoore/panel-dictionary-plasmoid | contents/code/appearanceConfig.py | Python | gpl-2.0 | 825 |
#!/usr/bin/python
import os
import json
def main():
print("Sample Post Script")
files = json.loads(os.environ.get('MH_FILES'))
for filename in files:
print(filename)
if __name__ == "__main__":
main()
| Collisionc/sickbeard_mp4_automator | post_process/sample.py | Python | mit | 214 |
import os
#cmd = 'python sample.py --source=en-ch.short --beam-search --beam-size 12 --trans en-ch.trans.txt --state models/search_state_en-ch.pkl models/search_model_en-ch.npz 2>>log.txt'
#cmd = 'python sample.py --source=fr.short --beam-search --beam-size 12 --trans fr-en.trans.txt --state search_state.pkl search_m... | sjtufs/GroundHog | experiments/nmt/run_test.py | Python | bsd-3-clause | 1,008 |
#!/usr/bin/env python
# Foundations of Python Network Programming - Chapter 18 - rpyc_client.py
# RPyC client
import rpyc
def noisy(string):
print('Noisy:', repr(string))
proxy = rpyc.connect('localhost', 18861, config={'allow_public_attrs': True})
fileobj = open('testfile.txt')
linecount = proxy.root.line_count... | jac2130/BayesGame | foundations-of-python-network-programming/python3/18/rpyc_client.py | Python | mit | 395 |
# vim:ts=4:sw=4:noexpandtab
from __future__ import print_function, absolute_import
import itertools
import re
import random
import pmxbot
from . import storage
from .core import command
class SameName(ValueError): pass
class AlreadyLinked(ValueError): pass
class Karma(storage.SelectableStorage):
@classmethod
de... | jamwt/diesel-pmxbot | pmxbot/karma.py | Python | bsd-3-clause | 9,256 |
# Copyright 2016 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 filecmp
import os
import os.path
import shutil
import sys
# Applies the ports EDK overlay to a local chromium checkout.
# These are copied non-rec... | darinf/ports | apply_to_chromium.py | Python | bsd-3-clause | 1,599 |
try:
import maya.cmds as cmds
import interface.messages as msg
except ImportError:
pass
try:
from PySide import QtGui, QtCore
from PySide.QtGui import *
from PySide.QtCore import *
except ImportError:
from PySide2 import QtGui, QtCore, QtWidgets
from PySide2.QtGui import *
from PySid... | jamesbdunlop/defaultMayaLibrary | interface/fileHandler.py | Python | apache-2.0 | 1,651 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Graphics pack management."""
from __future__ import print_function, unicode_literals, absolute_import
import os, shutil, glob
from .launcher import open_folder
from .lnp import lnp
from . import colors, df, paths, baselines, mods, log, manifest
from .dfraw import DFRaw
... | PeridexisErrant/python-lnp | core/graphics.py | Python | isc | 13,736 |
# Copyright (c) 2012, Daniel Zerbino
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# (1) Redistributions of source code must retain the above copyright
# notice, this list of conditions an... | dzerbino/cn-avg | cnavg/basics/__init__.py | Python | bsd-3-clause | 1,485 |
# Romulus.py
#
SYSTEM_STATES = [
'BASE_APPS',
'BMC_STARTING',
'BMC_READY',
'HOST_POWERING_ON',
'HOST_POWERED_ON',
'HOST_BOOTING',
'HOST_BOOTED',
'HOST_POWERED_OFF',
]
EXIT_STATE_DEPEND = {
'BASE_APPS': {
'/org/openbmc/sensors': 0,
},
'BMC_STARTING': {
'/org/... | openbmc/openbmc-test-automation | data/Romulus.py | Python | apache-2.0 | 30,088 |
# -*- coding: utf8 -*-
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
"""
This module represent all of behaviors used in the
FPTP election process definition.
"""
from substanced.util import get_oid
from dace.objec... | ecreall/nova-ideo | novaideo/content/processes/ballot_processes/fptp/behaviors.py | Python | agpl-3.0 | 1,182 |
#!/usr/bin/python
import os
import sys
try:
from functools import wraps
except ImportError:
# only needed for Python 2.4
def wraps(_):
def _wraps(func):
return func
return _wraps
# Creates os.path.relpath for Python 2.4
__unittest = True
if not hasattr(os, 'relpath'):
if... | Pelagicore/tracker-ivi | tests/functional-tests/unittest2/compatibility.py | Python | gpl-2.0 | 2,528 |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Copyright (c) 2011 Sergey Gulyaev <astraway@gmail.com>
#
# This file is part of Vertaler.
#
# Vertaler is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... | ambyte/Vertaler | src/controllers/taskbarcontroller.py | Python | gpl-2.0 | 2,396 |
# Copyright (C) 2013-2018 Samuel Damashek, Peter Foley, James Forcier, Srijay Kasturi, Reed Koser, Christopher Reffett, and Tris Wilson
#
# 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 v... | tjcsl/cslbot | cslbot/commands/quote.py | Python | gpl-2.0 | 6,319 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | jamielennox/python-keystoneclient | keystoneclient/tests/v2_0/test_client.py | Python | apache-2.0 | 6,828 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
ponysay - Ponysay, cowsay reimplementation for ponies
Copyright (C) 2012, 2013, 2014 Erkin Batu Altunbaş et al.
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 Softw... | tdsmith/ponysay | src/kms.py | Python | gpl-3.0 | 8,032 |
# coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import si... | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | orcid_api_v3/models/invited_positions_v30.py | Python | mit | 5,255 |
#!/usr/bin/env python
# encoding: utf-8
import numpy
from Cython.Build import cythonize
from setuptools import setup, Extension
# Set up the extension.
ext = Extension("plm._kernel", sources=["plm/_kernel.pyx"],
include_dirs=[numpy.get_include()])
ext2 = Extension("plm._gp", sources=["plm/_gp.pyx", "p... | jvc2688/cpm | setup.py | Python | mit | 570 |
"""
Panel presenting the configuration state for tor or arm. Options can be edited
and the resulting configuration files saved.
"""
import curses
import threading
from util import conf, panel, torTools, torConfig, uiTools
DEFAULT_CONFIG = {"features.config.selectionDetails.height": 6,
"features.con... | katmagic/arm | src/interface/configPanel.py | Python | gpl-3.0 | 12,753 |
import collections
import claripy
class SimVariable(object):
def __init__(self):
pass
class SimRegisterVariable(SimVariable):
def __init__(self, reg_offset, size):
SimVariable.__init__(self)
self.reg = reg_offset
self.size = size
def __repr__(self):
s = "<%d %d>" ... | zhuyue1314/simuvex | simuvex/s_variable.py | Python | bsd-2-clause | 3,768 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | kvar/ansible | lib/ansible/modules/network/check_point/checkpoint_access_rule.py | Python | gpl-3.0 | 8,284 |
# Generated by Django 3.1.2 on 2020-10-09 05:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('explorer', '0008_auto_20190308_1642'),
]
operations = [
migrations.AlterModelOptions(
name='query',
options={'orderi... | groveco/django-sql-explorer | explorer/migrations/0009_auto_20201009_0547.py | Python | mit | 913 |
'''connor utils'''
from __future__ import print_function, absolute_import, division
from datetime import datetime
import getpass
try:
#pylint: disable=unused-import
from itertools import map as iter_map
except ImportError:
#pylint: disable=invalid-name
iter_map = map
import logging
import os
import pla... | umich-brcf-bioinf/Connor | connor/utils.py | Python | apache-2.0 | 6,344 |
#!/usr/bin/env python3
# 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.
from typing import Optional
from parlai.core.params import ParlaiParser
from parlai.core.opt import Opt
from parlai.core... | facebookresearch/ParlAI | parlai/tasks/light_dialog/worlds.py | Python | mit | 4,531 |
"""Test properties of rows."""
from pytest import fixture, raises
from test_examples import charlotte as _charlotte
@fixture
def charlotte():
return _charlotte()
@fixture
def a1(charlotte):
""":return: the pattern ``"A.1"`` in charlotte"""
return charlotte.patterns["A.1"]
@fixture
def a2(charlotte):
... | AllYarnsAreBeautiful/knittingpattern | knittingpattern/test/test_example_rows.py | Python | lgpl-3.0 | 1,072 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# microbio documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 25 12:09:17 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
# a... | grst/microbio | docs/conf.py | Python | mit | 9,939 |
"""
Admin site bindings for dark_lang
"""
from config_models.admin import ConfigurationModelAdmin
from django.contrib import admin
from openedx.core.djangoapps.dark_lang.models import DarkLangConfig
admin.site.register(DarkLangConfig, ConfigurationModelAdmin)
| edx/edx-platform | openedx/core/djangoapps/dark_lang/admin.py | Python | agpl-3.0 | 264 |
from __future__ import print_function
import pickle
import pygame
import evolve
from neat import nn, visualize
evolve.W = 1000
evolve.H = 1000
pb = evolve.PictureBreeder(128, 128, 1500, 1500, 1280, 1024, 'color', 4)
with open("genome-20219-701.bin", "rb") as f:
g = pickle.load(f)
print(g)
node_names =... | drallensmith/neat-python | examples/picture2d/render.py | Python | bsd-3-clause | 577 |
"""
A port of django-forms-builder for Mezzanine. Allows admin users to create
their own HTML5 forms and export form submissions as CSV.
"""
from mezzanine import __version__
| orlenko/bccf | src/mezzanine/forms/__init__.py | Python | unlicense | 176 |
"""
Set of classes for building a directed acyclic graph. Can be used to
determine the order of dependencies. Can be used to determine compiling
order, for example. Topological sort pseudocode based on:
http://en.wikipedia.org/wiki/Topological_sorting
"""
__author__ = "Christian D. Langevin"
__date__ = "March 20,... | mjasher/gac | pymake/dag.py | Python | gpl-2.0 | 6,838 |
#!/usr/bin/env python
"""This file defines the base classes for Flows.
A Flow is a state machine which executes actions on the
client. Messages are transmitted between the flow object and the
client with their responses introduced into a state handler within the
flow.
The flow can send messages to a client, or launch... | pidydx/grr | grr/lib/flow.py | Python | apache-2.0 | 47,997 |
from django.contrib import admin
from .models import Location
class LocationAdmin(admin.ModelAdmin):
list_display = ('abbrev','name')
admin.site.register(Location, LocationAdmin)
| ginabythebay/iddocs | locations/admin.py | Python | apache-2.0 | 186 |
from IPython.utils.traitlets import Bool
from nbgrader import utils
from nbgrader.preprocessors import NbGraderPreprocessor
class LockCells(NbGraderPreprocessor):
"""A preprocessor for making cells undeletable."""
lock_solution_cells = Bool(True, config=True, help="Whether solution cells are undeletable")
... | alope107/nbgrader | nbgrader/preprocessors/lockcells.py | Python | bsd-3-clause | 1,110 |
import os, threading, time, datetime, Utils, collections, Reflection;
from boto.sqs.connection import SQSConnection;
from boto.sqs.message import Message ;
import xml.etree.ElementTree as ET;
JOB_QUEUE = 'edu_mbevis_osu_jobs' ;
ERR_QUEUE = 'edu_mbevis_osu_err' ;
NODE_STATS_QUEUE = 'ed... | softwarespartan/AGT | src/Infrastructure.py | Python | mit | 18,906 |
import click
from subprocess import call
def load_rules():
with open("C:\Windows\System32\drivers\etc\hosts") as file:
contents = file.readlines();
rules = []
for line in contents:
if not line.startswith("#") and not line.strip() == "":
parts = line.split()
... | JordanKnott/host-cli | host.py | Python | mit | 2,797 |
def my_cleaner(dryrun):
if dryrun:
print('dryrun, dont really execute')
return
print('execute cleaner...')
def task_sample():
return {
"actions" : None,
"clean" : [my_cleaner],
}
| JohannesBuchner/doit | doc/samples/custom_clean.py | Python | mit | 231 |
#!/usr/local/bin/python
##################################################################
#Created using code from Hamady et al. (2008) supplemental.#
#################################################################
from numpy import *
# current encoding scheme
INT_TO_BS = {0:"00", 1:"01", 2:"10", 3:"11"}
CUR_ENC_... | benjsmith/mubiomics | MPSDemultiplexer/hamming.py | Python | gpl-3.0 | 2,174 |
# grovepi.py
# v1.2.2
# This file provides the basic functions for using the GrovePi
#
# Karan Nayan
# Initial Date: 13 Feb 2014
# Last Updated: 22 Jan 2015
# http://www.dexterindustries.com/
#
# These files have been made available online through
# a Creative Commons Attribution-ShareAlike 3.0 license.
# (... | martinschaef/grovepi | grovepi.py | Python | mit | 13,742 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Time : 2018/1/24 下午5:03
# @Author : Zoe
# @File : fin-sentiment.py
# @Description : 金融新闻 / 情感词典 / 文本分类
import jieba
import nltk
import random
import collections
from nltk.classify.scikitlearn import SklearnClassifier
from sklearn.svm import SVC, L... | zoeyangyy/event-extraction | fin-senti/fin-sentiment.py | Python | mit | 4,147 |
# Copyright 2013 Cloudbase Solutions SRL
# Copyright 2013 Pedro Navarro Perez
# 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... | cloudbase/neutron-virtualbox | neutron/tests/unit/hyperv/test_hyperv_rpcapi.py | Python | apache-2.0 | 5,136 |
# This file is part of formunculous.
#
# formunculous 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.
#
# formu... | frutik/formunculous | formunculous/fields.py | Python | gpl-3.0 | 4,680 |
from __future__ import unicode_literals
from datetime import timedelta
from time import timezone
try:
from urllib.request import urlopen
from urllib.parse import urljoin
except ImportError:
from urllib import urlopen
from urlparse import urljoin
from django.core.management.base import CommandError
fr... | molokov/mezzanine | mezzanine/blog/management/commands/import_rss.py | Python | bsd-2-clause | 2,914 |
# -*- coding: utf-8 -*-
"""
femagtools.isa7
~~~~~~~~~~~~~~~
Read FEMAG I7/ISA7 model files
"""
import logging
import struct
import sys
import pdb
import re
import numpy as np
from collections import Counter
logger = logging.getLogger('femagtools.isa7')
class Reader(object):
"""
Open and Read I7/... | SEMAFORInformatik/femagtools | femagtools/isa7.py | Python | bsd-2-clause | 38,932 |
__author__ = 'roman' | rosogon/crossrefs | crossrefs/test/__init__.py | Python | gpl-3.0 | 20 |
# Stephen Wood
# Written January 29, 2015
# This file is designed to plot chemical space partitioning maps
# given: X, Y, and a set of phi values. (usually a set of 3)
import numpy as np
from pylab import *
class SWChemicalSpaceMap(object):
"""docstring for SWChemicalSpaceMap"""
def __init__(self, x, y, phi, phase_... | StephenAWood/SWUtils | SWChemicalSpaceMap.py | Python | mit | 1,331 |
import asyncio
import calendar
import logging
from bson import objectid
from anubis import app
from anubis import constant
from anubis import job
from anubis.model import builtin
from anubis.model import domain
from anubis.model import opcount
from anubis.model import queue
from anubis.model import record
from anubis.... | KawashiroNitori/Anubis | anubis/handler/judge.py | Python | gpl-3.0 | 7,735 |
from .fields import *
from .widgets import *
| dschep/django-xor-formfields | xorformfields/forms/__init__.py | Python | mit | 45 |
import logging
import sys
import traceback
from collections import namedtuple
import numpy as np
import pandas as pd
from scipy.stats import chisquare
from . import categorizer as cat
from . import draw
from .ipf.ipf import calculate_constraints
from .ipu.ipu import household_weights
logger = logging.getLogger("synt... | sfcta/synthpop | synthpop/synthesizer.py | Python | bsd-3-clause | 6,015 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'CentralMessage'
db.create_table(u'central_message_central... | nimbis/django-central-message | central_message/south_migrations/0001_initial.py | Python | bsd-3-clause | 6,941 |
# -*- coding: utf-8 -*-
import os
import timeside
audio_dir = '/home/momo/music_local/test/aboul/wav/'
audio_file = 'aboul.wav'
audio_path = audio_dir + audio_file
img_dir = '../results/img'
if not os.path.exists(img_dir):
os.makedirs(img_dir)
decoder = timeside.decoder.FileDecoder(audio_path)
analyzers = time... | tectronics/timeside | tests/sandbox/test_spectrogram3.py | Python | gpl-2.0 | 857 |
#!/usr/bin/env python
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t -*-
#
# NetProfile: IP addresses module - Models
# © Copyright 2013-2015 Alex 'Unik' Unigovsky
#
# This file is part of NetProfile.
# NetProfile is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero Gen... | nikitos/npui | netprofile_ipaddresses/netprofile_ipaddresses/models.py | Python | agpl-3.0 | 16,293 |
import datetime
from django.conf import settings
from django.db.models import Max
from django.db.utils import IntegrityError
from core.clients import get_tvdb_client
from core.utils import str_to_date
from shows.models import Episode, Series
def find_imdb_candidates(series_name):
"""
Args:
series_na... | onepesu/django_transmission | shows/logic.py | Python | mit | 4,509 |
import sys
from PySide import QtCore, QtGui
from core import console, stream
from ui import editor_window, output_window
class Window(QtGui.QWidget):
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
self.__layout = QtGui.QVBoxLayout()
self.__layout.setSp... | listyque/TACTIC-Handler | thlib/side/console/main.py | Python | epl-1.0 | 1,979 |
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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/... | vmthunder/nova | nova/volume/encryptors/__init__.py | Python | apache-2.0 | 2,343 |
from pycp2k.inputsection import InputSection
from ._each108 import _each108
class _diis_info2(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Section_parameters = None
self.Add_last = None
self.Common_iteration_levels = None
self.Filename = None
... | SINGROUP/pycp2k | pycp2k/classes/_diis_info2.py | Python | lgpl-3.0 | 668 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
Provides UM/CF phenomenon translations.
"""
from collections import namedtuple
CFName = namedtuple('CFName', 'standard_n... | SciTools/iris | lib/iris/fileformats/um_cf_map.py | Python | lgpl-3.0 | 106,520 |
#!/usr/bin/env python3
import itertools, random
from pokerHands import *
# create deck
deck = getDeck()
fred = OrderedCards()
al = OrderedCards()
burn = OrderedCards()
community = OrderedCards()
deck.deal(2, al, fred)
print("Fred's hand: " + str(fred))
print("Al's hand: " + str(al))
deck.deal(1,burn)
deck.deal(3,c... | Altoidnerd/cards | game.py | Python | mit | 845 |
## begin license ##
#
# "Meresco Lucene" is a set of components and tools to integrate Lucene into Meresco
#
# Copyright (C) 2013-2014, 2020-2021 Seecr (Seek You Too B.V.) https://seecr.nl
# Copyright (C) 2013-2014 Stichting Bibliotheek.nl (BNL) http://www.bibliotheek.nl
# Copyright (C) 2020-2021 Stichting Kennisnet ht... | seecr/meresco-lucene | meresco/lucene/luceneresponse.py | Python | gpl-2.0 | 2,366 |
#
# 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 us... | robertwb/incubator-beam | sdks/python/apache_beam/io/source_test_utils_test.py | Python | apache-2.0 | 4,941 |
# -*- 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.
""" Course page """
import web
from inginious.frontend.pages.utils import INGIniousPage
class CoursePage(INGIniousPage):
""" Course page """
def get_... | JuezUN/INGInious | inginious/frontend/pages/course.py | Python | agpl-3.0 | 4,665 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... | UManPychron/pychron | pychron/extraction_line/tasks/client_extraction_line_preferences.py | Python | apache-2.0 | 3,172 |
import pytest
from pytest_bdd import scenarios
pytestmark = [
pytest.mark.bdd,
pytest.mark.usefixtures('workbook', 'admin_user'),
]
scenarios(
'forms.feature',
'page.feature',
)
| T2DREAM/t2dream-portal | src/encoded/tests/features/test_admin_user.py | Python | mit | 197 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 Clione Software
# Copyright (c) 2010-2013 Cidadania S. Coop. Galega
#
# 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.or... | cidadania/e-cidadania | src/apps/ecidadania/debate/url_names.py | Python | apache-2.0 | 991 |
# Copyright 2008-2012 Nokia Siemens Networks Oyj
#
# 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... | robotframework/mabot | lib/robot/libraries/String.py | Python | apache-2.0 | 21,111 |
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
from pyramid.view import view_config
from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.default_behavior import Cancel
from pontus.form impo... | ecreall/lagendacommun | lac/views/services_processes/extraction_service/edit_service.py | Python | agpl-3.0 | 1,233 |
"""The scaled dot-product attention mechanism defined in Vaswani et al. (2017).
The attention energies are computed as dot products between the query vector
and the key vector. The query vector is scaled down by the square root of its
dimensionality. This attention function has no trainable parameters.
See arxiv.org/... | ufal/neuralmonkey | neuralmonkey/attention/scaled_dot_product.py | Python | bsd-3-clause | 15,590 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Apps.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| koenalphen/Apps | manage.py | Python | gpl-2.0 | 247 |
class Solution:
def canMakeArithmeticProgression(self, arr: List[int]) -> bool:
arr.sort()
diff = arr[1] - arr[0]
for i in range(2, len(arr)):
if arr[i] - arr[i - 1] != diff:
return False
return True
| jiadaizhao/LeetCode | 1501-1600/1502-Can Make Arithmetic Progression From Sequence/1502-Can Make Arithmetic Progression From Sequence.py | Python | mit | 264 |
# -*- coding: utf-8 -*-
from toolz.curried import filter, get, map, reduce
from toolz.sandbox.core import unzip
import PyCmdMessenger as cmd
from time import sleep
import os
import threading
import configparser
import signal
from copy import copy, deepcopy
import sys
from typing import Any, Text, Dict, Sequence, List,... | HARDWAREdotASTRO/ROBh.aTnetwork | Robhat/Robhat/Dome/Control.py | Python | mit | 5,353 |
import unittest
from typing import List, Tuple
from pyannotate_tools.annotations.infer import (
flatten_types,
infer_annotation,
merge_items,
remove_redundant_items,
)
from pyannotate_tools.annotations.types import (
AbstractType,
AnyType,
ARG_POS,
ARG_STAR,
ClassType,
TupleTyp... | dropbox/pyannotate | pyannotate_tools/annotations/tests/infer_test.py | Python | apache-2.0 | 9,255 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
from hypothesis ... | ryfeus/lambda-packs | pytorch/source/caffe2/python/operator_test/onnx_while_test.py | Python | mit | 3,154 |
# 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 th... | yjxtogo/horizon | openstack_dashboard/dashboards/project/stacks/panel.py | Python | apache-2.0 | 845 |
#-*- coding: utf-8 -*-
'''
Created on 24 авг. 2010
@author: ivan
'''
from gi.repository import Gtk
from foobnix.preferences.config_plugin import ConfigPlugin
import logging
from foobnix.fc.fc import FC
from foobnix.preferences.configs import CONFIG_DOWNLOAD_MANAGER
class DMConfig(ConfigPlugin):
name = CONFIG_DOW... | kagel/foobnix | foobnix/preferences/configs/dm_config.py | Python | gpl-3.0 | 1,751 |
#!/bin/env python
# -*- coding: utf-8; -*-
#
# (c) 2017 FABtotum, http://www.fabtotum.com
#
# This file is part of FABUI.
#
# FABUI 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 Licen... | FABtotum/colibri-fabui | fabui/ext/py/fabtotum/bluetooth/common.py | Python | gpl-2.0 | 5,219 |
'''
Created on Aug 29, 2015
@author: kevinchien
'''
import datetime
# from bson import ObjectId
from tornado.gen import Task, Return
from tornado.gen import coroutine
from src.common.logutil import get_logger
# from src.core.mongoutil import get_instance
#
# @coroutine
# def update_auth(auth_info):
# new_auth_in... | cchienhao/data_collector | src/collectors/fitbit/dao.py | Python | apache-2.0 | 841 |
from __future__ import division
from sympy import (Add, Basic, S, Symbol, Wild, Float, Integer, Rational, I,
sin, cos, tan, exp, log, nan, oo, sqrt, symbols, Integral, sympify,
WildFunction, Poly, Function, Derivative, Number, pi, NumberSymbol, zoo,
Piecewise, Mul, Pow, nsimplify, ratsimp, trigsimp, radsim... | Cuuuurzel/KiPyCalc | sympy/core/tests/test_expr.py | Python | mit | 55,897 |
#!/usr/bin/env python
#encode=utf-8
#vim: tabstop=4 shiftwidth=4 softtabstop=4
#Created on 2013-8-17
#Copyright 2013 nuoqingyun xuqifeng
class RpcDispatcher(object):
def __init__(self, callbacks):
self.callbacks = callbacks
print "enter RpcDispatcher", self.callbacks
super(Rpc... | homhei/glance | glance/rpc/dispatcher.py | Python | apache-2.0 | 581 |
from os.path import *
from os import listdir
from numpy import genfromtxt, array
class MetricValues:
def __init__(self, transform_dir):
self._values = [genfromtxt(join(transform_dir, file)) for file in listdir(transform_dir)]
def values(self):
return self._values
def delta_values(... | mattgibb/registration | graphing/metric_values.py | Python | mit | 688 |
from sanskrit_parser.generator.pratyaya import * # noqa: F403, F401
from sanskrit_parser.generator.dhatu import * # noqa: F403, F401
from sanskrit_parser.generator.pratipadika import * # noqa: F403, F401
viBakti = {}
prAtipadika = {}
encoding = {}
linga = {}
prAtipadika["rAma"] = rAma # noqa: F405
viBakti["rAma... | kmadathil/sanskrit_parser | sanskrit_parser/generator/test/vibhaktis_list.py | Python | mit | 34,643 |
import h5py
import numpy as np
import sys
import traceback
import inspect
import nwb.value_summary as vs
# import nwb
def print_error(context, err_string):
# func = traceback.extract_stack()[-3][2]
print("----------------------------------------")
# print("**** Failed unit test %s" % inspect.stack()[0][1])... | NeurodataWithoutBorders/api-python | matlab_bridge/matlab_unittest/test_utils.py | Python | bsd-3-clause | 5,916 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | Cgruppo/oppia | extensions/objects/models/objects_test.py | Python | apache-2.0 | 14,229 |
class PlanningError(Exception):
KNOWN_KWARGS = set(['deterministic'])
def __init__(self, *args, **kwargs):
super(PlanningError, self).__init__(*args)
assert self.KNOWN_KWARGS.issuperset(kwargs.keys())
self.deterministic = kwargs.get('deterministic', None)
class UnsupportedPlanningEr... | personalrobotics/prpy | src/prpy/planning/exceptions.py | Python | bsd-3-clause | 4,577 |
from handlers import Handler
# Logout handler
class Logout(Handler):
def get(self):
self.logout()
self.redirect('/blog')
| YuhanLin1105/Multi-User-Blog | handlers/logout.py | Python | mit | 143 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import codecs
import re
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages # noqa
here = os.path.abspath(os.path.dirname(__file... | jhubert/pydocx-s3-images | setup.py | Python | apache-2.0 | 2,319 |
#!/usr/bin/python
from biokbase.fbaModelServices.Client import fbaModelServices
import optparse
import subprocess
import sys
usage = """%prog object_type input_id_type output_id_type <input_ids, ;-delimited>
E.g. %prog compound ModelSEED name "cpd00001;cpd00002"
"""
description = """ Convert one type of alias into an... | kbase/KBaseFBAModeling | scripts/kbfba-convertid.py | Python | mit | 951 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2004-2016 QUIVAL, S.A. All Rights Reserved
# $Pedro Gómez Campos$ <pegomez@elnogal.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of th... | Comunitea/CMNT_00040_2016_ELN_addons | stock_not_allow_negative/models/product.py | Python | agpl-3.0 | 1,397 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
通用的
定义的是基本的监控项目 service
'''
class BaseService(object):
def __init__(self):
self.name = 'BaseService'
self.interval = 300 #监控间隔
self.last_time = 0
self.plugin_name = 'your_plugin' #监控插件
self.triggers = {} #监控阈值 | zhangyage/Python-oldboy | day08/monitor/server/conf/services/generic.py | Python | apache-2.0 | 364 |
# -*- coding: utf-8 -*-
"""
This config file runs the simplest dev environment using sqlite, and db-based
sessions. Assumes structure:
/envroot/
/db # This is where it'll write the database file
/edx-platform # The location of this repo
/log # Where we're going to write log files
"""
# We ... | franosincic/edx-platform | lms/envs/test.py | Python | agpl-3.0 | 19,782 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation.
# 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.apac... | citrix-openstack-build/neutron | neutron/plugins/common/constants.py | Python | apache-2.0 | 1,771 |
#Copyright (c) 2014 Sony Computer Entertainment America LLC. See License.txt.
import sys
sys.path.append("./CommonTestScripts")
import Test
doc = atfDocService.OpenNewDocument(editor)
#===================== 0: root ==================================
Test.Equal(0, Test.GetEnumerableCount(treeLister.TreeView.GetChil... | mindbaffle/ATF | Test/FunctionalTests/DomTreeEditorTestScripts/AddAllItems.py | Python | apache-2.0 | 20,874 |
import sys
from Filist import Filist
def main(name, filename, *argv):
# print the contents of the given file
ft = Filist(filename)
ft.sub_lines(r'<programlisting>plasTeXpython', r'<programlisting language="python">')
ft.sub_lines(r'plasTeXangle', r'<>')
# label the last chapters as appendic... | AllenDowney/ThinkBayes2 | book/postprocess.py | Python | mit | 754 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.