text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
import json
import numpy as np
from glob import glob
inputs = {
'xml_file_path' : "./data/single_wavelength_copy",
'file_set' : {'p38' : glob( "./data/single_wavelength_copy/*.xml")},
'section' : '280_480_TOP_120',
'ligand_order' : ['Bosutinib','Bosutinib Isomer','Erlotinib','Gefitinib'... | choderalab/assaytools | examples/direct-fluorescence-assay/inputs_p38_singlet.py | Python | lgpl-2.1 | 1,067 | 0.045923 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('browser', '0009_splitevent'),
]
operations = [
migrations.AddField(
model_name='affiliation',
name='... | erickpeirson/mbl-browser | browser/migrations/0010_auto_20160804_1644.py | Python | gpl-3.0 | 13,851 | 0.001877 |
# sqlalchemy/events.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Core event interfaces."""
from . import event, exc
from .pool import Pool
fro... | michaelgugino/web_keyer | sqlalchemy/events.py | Python | gpl-3.0 | 31,080 | 0.000611 |
# Copyright 2013: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | ytsarev/rally | rally/osclients.py | Python | apache-2.0 | 7,886 | 0.000127 |
from s3v1 import *
def filter_col_by_string(data_sample, field, filter_condition):
filtered_rows = [] # create a new list
col = int(data_sample[0].index(field)) # create a variable (col) and asign it to an integer which is pulled from the header row of the data_sample and which is the index (probably also an integer... | alexmilesyounger/ds_basics | s3v2.py | Python | mit | 2,936 | 0.016349 |
import pytz
from pyrfc3339.utils import timezone, timedelta_seconds
def generate(dt, utc=True, accept_naive=False, microseconds=False):
'''
Generate an :RFC:`3339`-formatted timestamp from a
:class:`datetime.datetime`.
>>> from datetime import datetime
>>> generate(datetime(2009,1,1,12,59,59,0,p... | kurtraschke/pyRFC3339 | pyrfc3339/generator.py | Python | mit | 2,170 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Corwin Brown <corwin@corwinbrown.com>
#
# 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... | gundalow/ansible-modules-extras | windows/win_uri.py | Python | gpl-3.0 | 4,484 | 0.000669 |
"""private_base will be populated from puppet and placed in this directory"""
import logging
import os
import dj_database_url
from lib.settings_base import CACHE_PREFIX, ES_INDEXES, KNOWN_PROXIES, LOGGING
from .. import splitstrip
import private_base as private
ENGAGE_ROBOTS = False
EMAIL_BACKEND = 'django.core.m... | anaran/olympia | sites/landfill/settings_base.py | Python | bsd-3-clause | 5,402 | 0.002962 |
#
# Copyright (C) 2000 Stefan Seefeld
# Copyright (C) 2000 Stephen Davies
# All rights reserved.
# Licensed to the public under the terms of the GNU LGPL (>= 2),
# see the file COPYING for details.
#
"""Abstract Syntax Tree classes.
This file contains classes which encapsulate nodes in the ASG. The base class
is the ... | stefanseefeld/synopsis | Synopsis/ASG.py | Python | lgpl-2.1 | 19,516 | 0.015936 |
"""calculate bootstrap bounds on a sample game"""
import argparse
import json
import sys
import numpy as np
from gameanalysis import bootstrap
from gameanalysis import gameio
from gameanalysis import regret
from gameanalysis import scriptutils
CHOICES = {
'regret': (bootstrap.mixture_regret, regret.mixture_regr... | yackj/GameAnalysis | gameanalysis/script/sgboot.py | Python | apache-2.0 | 3,682 | 0 |
import shutil
import os
import base64
from PySide.QtCore import *
from PySide.QtGui import *
from maya.app.general.mayaMixin import MayaQWidgetBaseMixin, MayaQWidgetDockableMixin
from maya import cmds
from luka import Luka
from luka.gui.qt import TakeSnapshotWidget, SnapshotListWidget
__all__ = ['LukaTakeSnapshotUI... | zakuro9715/luka | luka_maya.py | Python | gpl-3.0 | 2,318 | 0.006471 |
import unittest
import tests
import tests.test_logic
import tests.test_graph
import tests.test_output
| sambayless/monosat | src/monosat/api/python/tests/__init__.py | Python | mit | 102 | 0 |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko.modules.strreplace
~~~~~~~~~~~~~~~~~~~~~~~
Provides functions for string search-and-replace.
You provide the module with the text string to search for, and what to replace
it with. Multiple search-and-replace pairs can be added. You can specify to
replace all... | nerevu/riko | riko/modules/strreplace.py | Python | mit | 6,865 | 0.000146 |
# -*- coding: utf-8 -*-
import sys
import os
import shutil
import psutil
import subprocess
import time
import numpy as np
import itertools
# from matplotlib import pyplot
from routeGen import routeGen
from sumoConfigGen import sumoConfigGen
from stripXML import stripXML
import multiprocessing as mp
from glob import glo... | cbrafter/TRB18_GPSVA | codes/mainCode/ParallelSpecialMac.py | Python | mit | 5,186 | 0.005401 |
import pygame
music_on = 0
# Set up a button class for later usage
class Button:
def __init__(self, x, y, w, h, img):
self.x = x
self.y = y
self.w = w
self.h = h
self.img = img
self.surface = w * h
def buttonHover(self):
mouse = pygame.mo... | QuinDiesel/CommitSudoku-Project-Game | Euromast/menu.py | Python | mit | 6,569 | 0.003349 |
from fabric.api import hosts, run, sudo, local
from fabric.contrib.console import confirm
from fabric.utils import puts,warn
DEV_PROVISIONING_UUID = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
DEV_SIGN = "Mobi Ten"
DEV_APP_NAME = "Gym Mama"
DEV_APP_ID = 'com.mobiten.gym_mama'
TITANIUM_SDK_VERSION = '1.5.1'
IPHONE_SDK_VERS... | leonyeh/CoffeeScript-Hello-World | fabfile.py | Python | apache-2.0 | 1,250 | 0.0256 |
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# OpenModes - An eigenmode solver for open electromagnetic resonantors
# Copyright (C) 2013 David Powell
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gen... | DavidPowell/OpenModes | openmodes/constants.py | Python | gpl-3.0 | 1,192 | 0.001678 |
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2011,2017 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permis... | waynechu/PythonProject | dns/wiredata.py | Python | mit | 3,751 | 0.000267 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Diceware documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 26 22:19:13 2015.
#
# 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... | Treggats/DicewarePassphrase | docs/conf.py | Python | gpl-2.0 | 11,767 | 0.006289 |
# Copyright (c) 2011, Apple Inc. All rights reserved.
# Copyright (c) 2009, 2011, 2012 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must ret... | klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/common/config/committers.py | Python | bsd-3-clause | 11,526 | 0.001822 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
callback: default
type:... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/plugins/callback/default.py | Python | bsd-3-clause | 13,463 | 0.002823 |
"""Simple HTTP Server.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
__version__ = "0.6"
__all__ = ["SimpleHTTPRequestHandler"]
import os
import posixpath
import BaseHTTPServer
import urllib
import cgi
import sys
i... | jt6562/XX-Net | python27/1.0/lib/SimpleHTTPServer.py | Python | bsd-2-clause | 7,826 | 0.001278 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import tinymce.models
class Migration(migrations.Migration):
dependencies = [
('cms', '0004_auto_20141112_1610'),
]
operations = [
migrations.CreateModel(
name='Text',
... | Korkki/djangocms-text-tinymce | djangocms_text_tinymce/migrations/0001_initial.py | Python | bsd-3-clause | 703 | 0.001422 |
# -*- coding: utf-8 -*-
"""
Tests for validate Internationalization and Module i18n service.
"""
import gettext
from unittest import skip
import mock
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.utils import translation
from django.utils.translation impo... | stvstnfrd/edx-platform | cms/djangoapps/contentstore/tests/test_i18n.py | Python | agpl-3.0 | 10,854 | 0.002588 |
#! /usr/bin/env python
# -*- coding=utf-8 -*-
from distutils.core import setup
setup(
name='pythis',
version='1.4',
description='zen of python in Simplified Chinese',
url='https://github.com/vincentping/pythis',
author='Vincent Ping',
author_email='vincentping@gmail.com',
licen... | vincentping/pythis | setup.py | Python | mit | 1,142 | 0.016637 |
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
import sys
import json
from twit.models import User, Tweet, Mention, UserMention
from javanlp.models import Sentence, Sentiment
from javanlp.util import AnnotationException, annotate_document_with_sentiment
class Com... | arunchaganty/aeschines | django/twit/management/commands/annotate_features.py | Python | mit | 1,154 | 0.006066 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module provides a function that knows what you mean"""
def know_what_i_mean(wink, numwink=2):
""" Prints "Know what I mean?" with a variable number of winks.
Args:
wink (mixed): Represents a wink.
numwink (int): Wink multiplier. Defaults to... | rrafiringa/is210-week-04-warmup | task_01.py | Python | mpl-2.0 | 759 | 0 |
# coding:UTF-8
"""
Copyright (c) 2009-2010 Marian Tietz
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... | sushi-irc/tekka | signal_handler.py | Python | bsd-2-clause | 38,295 | 0.032208 |
"""
GravMag: Use the DipoleMagDir class to estimate the magnetization direction
of dipoles with known centers
"""
import numpy
from fatiando import mesher, gridder
from fatiando.utils import ang2vec, vec2ang, contaminate
from fatiando.gravmag import sphere
from fatiando.vis import mpl
from fatiando.gravmag.magdir impo... | eusoubrasileiro/fatiando_seismic | cookbook/gravmag_magdir_dipolemagdir.py | Python | bsd-3-clause | 2,519 | 0 |
from django.conf.urls import url
from . import views
from core.views import list_evidence_view, create_evidence_view, list_submissions_view
app_name = 'core'
urlpatterns = [
# ex: /core/
url(r'^$', views.index, name='index'),
url(r'^(?P<corecomp_id>[0-9]+)/$', views.detail, name='detail'),
url(r'^submi... | shmish/core-assess | core/urls.py | Python | mpl-2.0 | 549 | 0.014572 |
from haps.scopes.instance import InstanceScope
def test_get_object(some_class):
some_instance = InstanceScope().get_object(some_class)
assert isinstance(some_instance, some_class)
def test_get_multiple_objects(some_class):
scope = InstanceScope()
objects = {scope.get_object(some_class) for _ in ran... | ekiro/chaps | tests/test_instance_scope.py | Python | mit | 436 | 0 |
#!/usr/bin/env python
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import versioneer
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
def initialize_options(self):
TestCommand.initializ... | arsgeografica/kinderstadt-registry | setup.py | Python | gpl-3.0 | 1,548 | 0.000646 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/Users/victorgarric/Documents/INVENTAIRE/principal.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui
from PyQt5.QtWidgets import QWidget
from PyQt5.Qt... | dedichan/ChemDB | principal.py | Python | gpl-3.0 | 18,412 | 0.01423 |
"""
Ops for masked arrays.
"""
from typing import (
Optional,
Union,
)
import numpy as np
from pandas._libs import (
lib,
missing as libmissing,
)
def kleene_or(
left: Union[bool, np.ndarray],
right: Union[bool, np.ndarray],
left_mask: Optional[np.ndarray],
right_mask: Optional[np.nd... | datapythonista/pandas | pandas/core/ops/mask_ops.py | Python | bsd-3-clause | 5,124 | 0.000195 |
"""
Classes to represent the default SQL aggregate functions
"""
import copy
from django.db.models.fields import IntegerField, FloatField
# Fake fields used to identify aggregate types in data-conversion operations.
ordinal_aggregate_field = IntegerField()
computed_aggregate_field = FloatField()
class Aggregate(obje... | andrewsmedina/django | django/db/models/sql/aggregates.py | Python | bsd-3-clause | 4,116 | 0.001944 |
#
# 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... | froyobin/ironic | ironic/drivers/modules/drac/common.py | Python | apache-2.0 | 4,782 | 0 |
# Author: Jason Lu
import urllib.request
from bs4 import BeautifulSoup
import time
req_header = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
#'Accept-Language': 'en-U... | jinzekid/codehub | python/lyutil/ly_proxy_test.py | Python | gpl-3.0 | 3,046 | 0.009321 |
from contextlib import contextmanager
import pkg_resources
import os
def local_stream(name):
return pkg_resources.resource_stream(__name__, name)
def local_file(name):
return pkg_resources.resource_filename(__name__, name)
@contextmanager
def Environ(**kwargs):
orig = os.environ.copy()
replace = s... | bcsaller/layercake | tests/utils.py | Python | apache-2.0 | 671 | 0.00149 |
from django.db import models
# Django doesn't support big auto fields out of the box, see
# https://code.djangoproject.com/ticket/14286.
# This is a stripped down version of the BoundedBigAutoField from Sentry.
class BigAutoField(models.AutoField):
description = "Big Integer"
def db_type(self, connection):
... | adusca/treeherder | treeherder/model/fields.py | Python | mpl-2.0 | 1,086 | 0 |
from django.core.exceptions import ValidationError
from django.utils.deconstruct import deconstructible
from django.utils.translation import gettext_lazy as _
from django.core import validators
@deconstructible
class SkypeValidator:
message = _('Enter a valid URL.')
code = 'invalid'
... | bronycub/sugarcub | users/validators.py | Python | gpl-3.0 | 1,069 | 0.008419 |
#-*-coding:utf-8-*-
from . import about_blueprint
from flask import render_template
@about_blueprint.route("/")
def about_index():
return render_template("about.html") | PythonScientists/Shape | main/module/about/views.py | Python | apache-2.0 | 173 | 0.017341 |
"""
Caching framework.
This package defines set of cache backends that all conform to a simple API.
In a nutshell, a cache is a set of values -- which can be any object that
may be pickled -- identified by string keys. For the complete API, see
the abstract BaseCache class in django.core.cache.backends.base.
Client ... | heracek/django-nonrel | django/core/cache/__init__.py | Python | bsd-3-clause | 6,144 | 0.001302 |
class DinkyFish:
def monthsUntilCrowded(self, tankVolume, maleNum, femaleNum):
months = 0
while maleNum + femaleNum <= (tankVolume * 2):
minFishes = min(maleNum, femaleNum)
maleNum += minFishes
femaleNum += minFishes
months += 1
return ... | Oscarbralo/TopBlogCoder | SRMs/SRM180PY/250/250.py | Python | mit | 326 | 0.003067 |
import datetime
from io import StringIO
from pytest import fixture
from gnss_tec import ObsFileV2, ObsFileV3
RNX_V2 = """\
2.11 OBSERVATION DATA M (MIXED) RINEX VERSION / TYPE
teqc 2016Nov7 NOAA/NOS/NGS/CORS 20170707 04:06:33UTCPGM / RUN BY / DATE
ASPA ... | gnss-lab/gnss-tec | tests/conftest.py | Python | mit | 21,163 | 0.002755 |
# Copyright (c) 2008 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{txweb2.http_headers}.
"""
from twisted.trial import unittest
import random
import time
from txweb2 import http_headers
from txweb2.http_headers import Cookie, HeaderHandler, quoteString, generateKeyValues
from twisted.python... | red-hood/calendarserver | txweb2/test/test_http_headers.py | Python | apache-2.0 | 32,998 | 0.004273 |
import os
from jflow.utils.importlib import import_module
from jflow.conf import global_settings
#If django is installed used the django setting object
try:
from django.conf import settings as django_settings
except:
django_settings = None
ENVIRONMENT_VARIABLE = "JFLOW_SETTINGS_MODULE"
cla... | lsbardel/flow | flow/conf/__init__.py | Python | bsd-3-clause | 1,191 | 0.012594 |
# Written by Greg Ver Steeg (http://www.isi.edu/~gregv/npeet.html)
import scipy.spatial as ss
from scipy.special import digamma
from math import log
import numpy.random as nr
import numpy as np
import random
# continuous estimators
def entropy(x, k=3, base=2):
"""
The classic K-L k-nearest nei... | UltronAI/Deep-Learning | Pattern-Recognition/hw2-Feature-Selection/skfeature/utility/entropy_estimators.py | Python | mit | 7,335 | 0.00259 |
# Generated by Django 3.1.7 on 2021-09-27 16:10
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('product', '0016_product_company'),
]
operations = [
migrations.RemoveField(
model_name='product',
name='companies',
... | KlubJagiellonski/pola-backend | pola/product/migrations/0017_remove_product_companies.py | Python | bsd-3-clause | 329 | 0 |
#!/usr/bin/env python
# coding=utf-8
"""
Distinct powers
Problem 29
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
2^2=4, 2^3=8, 2^4=16, 2^5=32
3^2=9, 3^3=27, 3^4=81, 3^5=243
4^2=16, 4^3=64, 4^4=256, 4^5=1024
5^2=25, 5^3=125, 5^4=625, 5^5=3125
If they are then placed in numerical... | openqt/algorithms | projecteuler/ac/old/pe029_distinct_powers.py | Python | gpl-3.0 | 823 | 0 |
#!/usr/bin/python
#
# PubNub Real-time Cloud-Hosted Push API and Push Notification Client
# Frameworks
# Copyright (C) 2016 PubNub Inc.
# http://www.pubnub.com/
# http://www.pubnub.com/terms
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_i... | sgerhart/ansible | lib/ansible/modules/cloud/pubnub/pubnub_blocks.py | Python | mit | 23,797 | 0.00021 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import connection
from django.db import models, migrations
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.management import update_all_contenttypes
def create_notifications(apps, schema_editor):... | CMLL/taiga-back | taiga/projects/userstories/migrations/0010_remove_userstory_watchers.py | Python | agpl-3.0 | 1,220 | 0.004098 |
# Copyright 2014 Netflix, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | bunjiboys/security_monkey | security_monkey/common/sts_connect.py | Python | apache-2.0 | 3,363 | 0.000892 |
#!/usr/bin/env python
"""
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");... | alexryndin/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HBASE/package/scripts/hbase_decommission.py | Python | apache-2.0 | 2,306 | 0.009974 |
from flask import Flask, render_template, redirect, url_for, request, session, flash, jsonify, g
import sqlite3 as sql
import os
import random
import json
from flask_sqlalchemy import SQLAlchemy
import ast #To change string list to a python list
import collections #To conte duplicate in iventory list using Count... | sylverspace/craft_game | app.py | Python | mit | 10,026 | 0.033513 |
''' Work of Cameron Palk '''
import sys
import pandas as pd
def main( argv ):
try:
csv_filepath = argv[ 0 ]
output_filepath = argv[ 1 ]
except IndexError:
print( "Error, usage: \"python3 coord_bounds.py <CSV> <output_file>\"" )
return
training_data = pd.read_csv( csv_filepath )
training_data[ 'clean_... | CKPalk/SeattleCrime_DM | DataMining/Stats/coord_bounds.py | Python | mit | 801 | 0.087391 |
from glob import glob
import os
import time
import tornado.ioloop
from tornado import gen
from .core import Stream, convert_interval, RefCounter
def PeriodicCallback(callback, callback_time, asynchronous=False, **kwargs):
source = Stream(asynchronous=asynchronous)
def _():
result = callback()
... | mrocklin/streams | streamz/sources.py | Python | bsd-3-clause | 25,985 | 0.001347 |
# -*- coding: utf-8
#------------------------------------------------------------------#
__author__ = "Xavier MARCELET <xavier@marcelet.com>"
#------------------------------------------------------------------#
import json
import sys
import cherrypy
from xtd.core import logger, config
from xtd.co... | psycofdj/xtd | xtd/network/server/application.py | Python | gpl-3.0 | 5,010 | 0.020958 |
#!/usr/bin/env python
"""
MCNPX Model for Cylindrical RPM8
"""
import sys
sys.path.append('../MCNPTools/')
sys.path.append('../')
from MCNPMaterial import Materials
import subprocess
import math
import mctal
import numpy as np
import itertools
import os
class CylinderRPM(object):
# Material Dictionaries
cell... | murffer/DetectorSim | MCNPXRPMModels/WrappedCylinders/CylinderMCNPX.py | Python | apache-2.0 | 23,537 | 0.016145 |
import errors
def validate_num_arguments_eq(num_args):
"""Validate that the number of supplied args is equal to some number"""
def decorator(func):
def wrapped_func(*args, **kwargs):
if len(args[1]) != num_args:
raise errors.InvalidArgumentError
else:
... | dansackett/Todooo | todooo/validators.py | Python | mit | 1,462 | 0.001368 |
# ChangeFile
# A class which represents a Debian change file.
# Copyright 2002 Colin Walters <walters@gnu.org>
# This file 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... | xypron/mini-dinstall | minidinstall/ChangeFile.py | Python | gpl-2.0 | 4,579 | 0.005241 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis | reference/admin.py | Python | agpl-3.0 | 2,104 | 0.000476 |
from __future__ import unicode_literals
import re
import six
# TODO add tests for all of these
EQ_FUNCTION = lambda item_value, test_value: item_value == test_value # flake8: noqa
NE_FUNCTION = lambda item_value, test_value: item_value != test_value # flake8: noqa
LE_FUNCTION = lambda item_value, test_value: item_va... | Affirm/moto | moto/dynamodb2/comparisons.py | Python | apache-2.0 | 15,123 | 0.00238 |
import cPickle
import os.path as osp
from smqtk.representation.code_index import CodeIndex
from smqtk.utils import SimpleTimer
__author__ = "paul.tunison@kitware.com"
class MemoryCodeIndex (CodeIndex):
"""
Local RAM memory based index with an optional file cache
"""
@classmethod
def is_usable(... | kfieldho/SMQTK | python/smqtk/representation/code_index/memory.py | Python | bsd-3-clause | 5,235 | 0.000764 |
from issues.models import ReportedLink, ReportedUser
from issues.serializers import ReportedLinkSerializer, ReportedUserSerializer
class ReportedLinkAPI(object):
serializer_class = ReportedLinkSerializer
def get_queryset(self):
return ReportedLink.objects.all()
class ReportedLinkSelfAPI(object):
... | projectweekend/Links-API | links/issues/mixins.py | Python | mit | 849 | 0 |
# Script for building the _ssl and _hashlib modules for Windows.
# Uses Perl to setup the OpenSSL environment correctly
# and build OpenSSL, then invokes a simple nmake session
# for the actual _ssl.pyd and _hashlib.pyd DLLs.
# THEORETICALLY, you can:
# * Unpack the latest SSL release one level above your main Python ... | LaoZhongGu/kbengine | kbe/src/lib/python/PCbuild/build_ssl.py | Python | lgpl-3.0 | 9,198 | 0.002827 |
import pytest
from webtest import TestApp
from pyramid.config import Configurator
from pyramid.testing import DummyRequest
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.authentication import AuthTktAuthenticationPolicy
def make_app(config):
return TestApp(config.make_wsgi_app())
@pytest.... | wichert/rest_toolkit | tests/test_resource.py | Python | bsd-2-clause | 3,615 | 0 |
import urllib
from askbot.deps.django_authopenid.util import OAuthConnection
class Twitter(OAuthConnection):
def __init__(self):
super(Twitter, self).__init__('twitter')
self.tweet_url = 'https://api.twitter.com/1.1/statuses/update.json'
def tweet(self, text, access_token=None):
client... | PearsonIOKI/compose-forum | askbot/utils/twitter.py | Python | gpl-3.0 | 479 | 0.002088 |
# Author: Steven J. Bethard <steven.bethard@gmail.com>.
# New maintainer as of 29 August 2019: Raymond Hettinger <raymond.hettinger@gmail.com>
"""Command-line parsing library
This module is an optparse-inspired command-line parsing library that:
- handles both optional and positional arguments
- produces hi... | bruderstein/PythonScript | PythonLib/min/argparse.py | Python | gpl-2.0 | 97,984 | 0.000235 |
# 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
# distribu... | devs4v/devs4v-information-retrieval15 | project/lucene/pylucene-4.9.0-0/jcc/helpers/linux.py | Python | mit | 7,260 | 0.003306 |
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
try:
from PyQt4.QtGui import QApplication, QKeySequence
except ImportError:
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QKeySequence
from pygs import QxtGlobalShortcut
def hotkeyBinding():
SHORTCUT_SHOW = "Ctrl+Alt+S" # ... | LeunamBk/translatorPy | globalHotkeys.py | Python | gpl-3.0 | 950 | 0.009474 |
import unittest
from mock import patch, call
from chaser.controller import MotorController, LEFT_KEY, RIGHT_KEY, UP_KEY, DOWN_KEY, MotorInputError
class ControllerTestCase(unittest.TestCase):
@patch('chaser.controller.gpio')
def test_init(self, io):
io.OUT = True
calls = [call(4, True), call(... | mmilkin/cchaser | chaser/tests/test_controller.py | Python | mit | 4,019 | 0.000498 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/pikov | python/pikov/properties.py | Python | apache-2.0 | 2,766 | 0 |
#!/usr/bin/python
# encoding: utf-8
# filename: outroTipoDeProducaoBibliografica.py
#
# scriptLattes V8
# Copyright 2005-2013: Jesús P. Mena-Chalco e Roberto M. Cesar-Jr.
# http://scriptlattes.sourceforge.net/
#
#
# Este programa é um software livre; você pode redistribui-lo e/ou
# modifica-lo dentro dos termos d... | DiegoQueiroz/scriptLattes | scriptLattes/producoesBibliograficas/outroTipoDeProducaoBibliografica.py | Python | gpl-2.0 | 3,771 | 0.032388 |
from os.path import abspath
import wptools
from mycroft.messagebus.message import Message
from mycroft.skills.LILACS_knowledge.services import KnowledgeBackend
from mycroft.util.log import getLogger
__author__ = 'jarbas'
logger = getLogger(abspath(__file__).split('/')[-2])
class WikidataService(KnowledgeBackend):... | ElliotTheRobot/LILACS-mycroft-core | mycroft/skills/LILACS_knowledge/services/wikidata/__init__.py | Python | gpl-3.0 | 2,400 | 0.002917 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from IPython import get_ipython
from IPython.display import (
display,
Javascript,
HTML,
)
from IPython.core import magic_arguments
from IPython.core.magic import (
Magics,
magics_class,
cell_magic,
)
import pyjade
__version_info_... | bollwyvl/jademagic | jademagic.py | Python | bsd-3-clause | 1,775 | 0 |
# This is to see that the total memory usage doesn't increase with time
# i.e. no leakage / link between consecutive usages of hsp.
# This will run for ever, to be monitored by the printout and some external monitor.
def t():
from guppy import hsp
while 1:
import guppy.heapy.UniSet
import gc
reload( guppy.... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/core/ext-py/guppy-0.1.10/guppy/heapy/test/test_sf.py | Python | gpl-2.0 | 460 | 0.041304 |
import boto
from amslib.core.manager import BaseManager
from amslib.instance.instance import InstanceManager
import argparse
from errors import *
import pprint
import time
pp = pprint.PrettyPrinter(indent=4)
# Custom HealthCheck object to add support for failure threshold...seems to have been missed in boto
class He... | ThisLife/aws-management-suite | amslib/network/route53.py | Python | mit | 46,031 | 0.004627 |
# This test module covers support in various parts of the standard library
# for working with modules located inside zipfiles
# The tests are centralised in this fashion to make it easy to drop them
# if a platform doesn't support zipimport
import unittest
import test.test_support
import os
import os.path
import sys
im... | mancoast/CPythonPyc_test | cpython/266_test_zipimport_support.py | Python | gpl-3.0 | 10,482 | 0.000859 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Copyright (c) 2013 Miguel Moreto <http://sites.google.com/site/miguelmoreto/>
#This file is part of pyComtrade.
#
# pyComtrade is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fre... | ldemattos/openComtradeViewer | src/pyComtrade.py | Python | gpl-3.0 | 15,076 | 0.022221 |
__version__ = "0.1.3"
get_version = lambda: __version__ | eternalfame/django-russian_fields | russian_fields/__init__.py | Python | mit | 56 | 0.035714 |
# highSpeedManuveringCapacitorNeedMultiplierPostPercentCapacitorNeedLocationShipModulesRequiringHighSpeedManuvering
#
# Used by:
# Implants named like: Eifyr and Co. 'Rogue' High Speed Maneuvering HS (6 of 6)
# Skill: High Speed Maneuvering
type = "passive"
def handler(fit, container, context):
level = container.... | Ebag333/Pyfa | eos/effects/highspeedmanuveringcapacitorneedmultiplierpostpercentcapacitorneedlocationshipmodulesrequiringhighspeedmanuvering.py | Python | gpl-3.0 | 568 | 0.003521 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | dmitry-sobolev/ansible | lib/ansible/module_utils/vyos.py | Python | gpl-3.0 | 4,383 | 0.004335 |
# Copyright: (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright: (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com>
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import ... | shsingh/ansible | lib/ansible/cli/__init__.py | Python | gpl-3.0 | 20,952 | 0.002816 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from nltk.parse.generate import generate, demo_grammar
from nltk import CFG
grammar = CFG.fromstring(demo_grammar)
print(grammar)
for sentence in generate(grammar, n=10):
print(' '.join(sentence))
for sentence in generate(grammar, depth=4):
print(' '.join(sentence))
... | davidam/python-examples | nlp/nltk/howtos/generate.py | Python | gpl-3.0 | 537 | 0 |
from itertools import imap, chain
def set_name(name, f):
try:
f.__pipetools__name__ = name
except (AttributeError, UnicodeEncodeError):
pass
return f
def get_name(f):
from pipetools.main import Pipe
pipetools_name = getattr(f, '__pipetools__name__', None)
if pipetools_name:
... | katakumpo/pipetools | pipetools/debug.py | Python | mit | 672 | 0 |
# -*- coding: utf-8 -*-
# __init__.py
#
# Copyright (C) 2007 - Guillaume Desmottes
#
# 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 your option)
# any later version.
#... | paulbellamy/Rhythmbox-iPod-Plugin | plugins/jamendo/jamendo/__init__.py | Python | gpl-2.0 | 4,882 | 0.020893 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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) an... | ilpianista/ansible | lib/ansible/playbook/task.py | Python | gpl-3.0 | 20,951 | 0.002148 |
from django.conf import settings
def posthog_configurations(request):
return {
'POSTHOG_API_KEY': settings.POSTHOG_API_KEY,
'POSTHOG_API_URL': settings.POSTHOG_API_URL,
}
| pythonprobr/pythonpro-website | pythonpro/analytics/context_processors.py | Python | agpl-3.0 | 197 | 0 |
import parole
from parole.colornames import colors
from parole.display import interpolateRGB
import pygame, random
import sim_creatures, main, random
from util import *
description = \
"""
This guy should really look into another line of work.
"""
nagLines = [
'*sigh*',
"It's not been the same 'round... | tectronics/nyctos | src/data.res/scripts/npcs/retiredminer.py | Python | gpl-2.0 | 1,428 | 0.008403 |
while 1:
arr=input().split(' ')
k=arr[0]
n=arr[1]
if k=='0' and n=='0':
break
ans=int(int(k)**int(n))
print (int(ans))
| ProgDan/maratona | SPOJ/UJ.py | Python | gpl-3.0 | 129 | 0.124031 |
"""Ensure credentials are preserved through the authorization.
The Authorization Code Grant will need to preserve state as well as redirect
uri and the Implicit Grant will need to preserve state.
"""
from __future__ import absolute_import, unicode_literals
import json
import mock
from .test_utils import get_query_cre... | nirmeshk/oh-mainline | vendor/packages/oauthlib/tests/oauth2/rfc6749/endpoints/test_credentials_preservation.py | Python | agpl-3.0 | 4,860 | 0.003086 |
# 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... | Bulochkin/tensorflow_pack | tensorflow/python/kernel_tests/fft_ops_test.py | Python | apache-2.0 | 18,811 | 0.010207 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
faq_en = '''
<p>
<b>Why statistics on the site does not coincide with the statistics in the game?</b>
</p>
<p>
Algorithms collection statistics IL2 stats differs from statistics in-game. As a consequence of these... | Flyingfox646/flyingfox | src/chunks/migrations/0004_faq_fairplay.py | Python | mit | 5,970 | 0.004275 |
# encoding: 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 'Project.slug'
db.alter_column('teams_project', 'slug', self.gf('django.db.models.fie... | ofer43211/unisubs | apps/teams/migrations/0057_auto__chg_field_project_slug__chg_field_task_assignee.py | Python | agpl-3.0 | 23,628 | 0.008507 |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 19:18:58 2015
@author: alex_
"""
# General Imports
import matplotlib as mpl
mpl.use('TkAgg') # Force mpl backend not to use qt. Else we have a conflict.
import numpy as np
import pickle
import time
from datetime import datetime
from collections import namedtuple
impor... | Alex-Ian-Hamilton/solarbextrapolation | solarbextrapolation/preprocessors/base.py | Python | mit | 2,867 | 0.006278 |
import os
import sys
import getopt
import json
def main(argv):
"""Specify input to generator with:
-s : save path
-f : model_def folder
"""
opts, args = getopt.getopt(argv,"s:f:")
save_location = "models/ddpg_models/"
model_def_folder = ""
print(opts)
for opt, arg in opts:
... | fizz-ml/pytorch-aux-reward-rl | model_generator.py | Python | mit | 671 | 0.011923 |
#40/40
#Part 1: Terminology (15 points) --> 15/15
#1 1pt) What is the symbol "=" used for?
#to assign and store values to and in variables
# 1pt
#
#2 3pts) Write a technical definition for 'function'
#a named sequence of calculations which takes input and returns output
# 3pts
#
#3 1pt) What does the keyword "return" d... | ieuan1630-cmis/ieuan1630-cmis-cs2 | cs2quiz1.py | Python | cc0-1.0 | 2,934 | 0.02454 |
try:
from pygments.lexer import bygroups, include, using
from pygments.lexers.agile import PythonLexer, PythonTracebackLexer
from pygments.token import Text, Name, Number, Generic, String, Operator
except ImportError: # pragma: no cover
# this is for nose coverage which does a recursive import on the p... | g2p/xtraceback | xtraceback/lexer.py | Python | mit | 2,860 | 0.006643 |
# coding:utf-8
import logging
import regex as re
import email.quoprimime
import email.base64mime
from base64 import b64encode
from flanker.mime.message import charsets, errors
log = logging.getLogger(__name__)
#deal with unfolding
foldingWhiteSpace = re.compile(r"(\n\r?|\r\n?)(\s*)")
def unfold(value):
"""
... | alex/flanker | flanker/mime/message/headers/encodedword.py | Python | apache-2.0 | 3,690 | 0.000815 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# function: 剪切更改图片尺寸大小
import os
import os.path
import sys
import argparse
from PIL import Image
def CutImage(filein, fileout, width, height, type):
'''
# 从左上角开始 剪切 width*height的图片
filein: 输入图片
fileout: 输出图片
width: 输出图片宽度
height:输出图片高度
type:输... | congminghaoxue/learn_python | change_pic_size_by_cut.py | Python | apache-2.0 | 1,474 | 0.003634 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.