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
from django.contrib.auth.models import User from django.views.generic.edit import CreateView, FormView from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt from django.utils.decorators import method_decorator from django.core.context_processors import csrf from django.http import Htt...
godlike64/typhon
typhon/views.py
Python
gpl-3.0
468
0.004274
#!/usr/bin/python def message(to, text): print "this is ", to, ":\n", text def add(a, b): return a + b; message('xichen', 'eyu') print add(1,2); def mul(a, b): return a * b; print mul(2, 3); print mul('a', 3); print mul(b=2, a='dd'); print 2 ** 100; print message; func = add; print func(1, 2);
cxsjabc/basic
python/message.py
Python
agpl-3.0
308
0.061688
# coding: utf-8 """ EVE Swagger Interface An OpenAPI for EVE Online OpenAPI spec version: 0.4.6 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re class GetUniverseMoonsMoonIdPosition(object): """ NOTE: ...
minlexx/pyevemon
esi_client/models/get_universe_moons_moon_id_position.py
Python
gpl-3.0
4,328
0.000231
from __future__ import annotations import logging from os.path import exists from typing import TYPE_CHECKING from .helpers import BumprError, execute if TYPE_CHECKING: from typing import Optional logger = logging.getLogger(__name__) __all_ = ( "Hook", "ReadTheDocHook", "ChangelogHook", "Comman...
noirbizarre/bumpr
bumpr/hooks.py
Python
lgpl-3.0
6,499
0.001077
import abc import subprocess import logging from observables import BLOperator, MCObservable from data import BLDataChannel, GIDataChannel import util class Channel(metaclass=abc.ABCMeta): ISOSPIN_MAP = { 'singlet': "0", 'doublet': "1h", 'triplet': "1", 'quartet': "3h", 'quintet': "2"...
andrewhanlon/QCD_scripts
sigmond/channel.py
Python
gpl-3.0
7,175
0.012683
import os from jenkins_jobs import cmd from tests.base import mock from tests.cmd.test_cmd import CmdTestsBase @mock.patch('jenkins_jobs.builder.Jenkins.get_plugins_info', mock.MagicMock) class DeleteTests(CmdTestsBase): @mock.patch('jenkins_jobs.cmd.Builder.delete_job') def test_delete_single_job(self, del...
lukas-bednar/jenkins-job-builder
tests/cmd/subcommands/test_delete.py
Python
apache-2.0
1,878
0
# -*- coding: utf-8 -*- import copy from functools import wraps import json import sys import django from django.contrib.admin.helpers import AdminForm from django.conf import settings from django.conf.urls import url from django.contrib import admin, messages from django.contrib.admin.models import LogEntry, CHANGE f...
donce/django-cms
cms/admin/pageadmin.py
Python
bsd-3-clause
67,669
0.002941
#!/usr/bin/python # Copyright 2016 Google 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 by appli...
Sarsate/compute-image-packages
google_compute_engine/instance_setup/tests/instance_setup_test.py
Python
apache-2.0
14,219
0.004009
#------------------------------------------------------------------------------ # # Copyright (c) 2005, Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions d...
HyperloopTeam/FullOpenMDAO
lib/python2.7/site-packages/traits-4.3.0-py2.7-macosx-10.10-x86_64.egg/traits/trait_base.py
Python
gpl-2.0
19,017
0.018089
############################################################################### ## ## Copyright (C) 2014-2015, New York University. ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## ...
hjanime/VisTrails
vistrails/core/modules/basic_modules.py
Python
bsd-3-clause
69,112
0.002879
# 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 applicab...
xcyan/models
ptn/model_ptn.py
Python
apache-2.0
8,258
0.004481
from django.shortcuts import render_to_response from django.template import RequestContext from webinars_web.webinars.views import syncs def show(request, sync_id): from webinars_web.webinars import models as wm return syncs._show(request, 'hub', wm.HubSync.objects.select_related('hub').get(pk=sync_id)) def n...
prior/webinars
webinars_web/webinars/views/hub_syncs.py
Python
apache-2.0
1,234
0.010535
"""Tutorial on how to create a convolutional autoencoder w/ Tensorflow. Parag K. Mital, Jan 2016 """ import tensorflow as tf import numpy as np import math from libs.activations import lrelu from libs.utils import corrupt # %% def autoencoder(input_shape=[None, 784], n_filters=[1, 10, 10, 10], ...
apoorva-sharma/deep-frame-interpolation
tensorflow_tutorials-master/python/09_convolutional_autoencoder.py
Python
mit
5,033
0.000199
#!/bin/env python """ This file defines a set of system_info classes for getting information about various resources (libraries, library directories, include directories, etc.) in the system. Currently, the following classes are available: atlas_info atlas_threads_info atlas_blas_info atlas_blas_threads_info ...
dwillmer/numpy
numpy/distutils/system_info.py
Python
bsd-3-clause
85,113
0.000881
from __future__ import unicode_literals from __future__ import absolute_import, division, print_function """ Tests for RecordView module and view Note: this module tests for rendering specifically for RecordView values, using view description sitedata files, and as such duplicates some tests covered by module test_en...
gklyne/annalist
src/annalist_root/annalist/tests/test_recordview.py
Python
mit
56,603
0.010918
''' Copyright 2013 Cosnita Radu Viorel 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, distribute...
rcosnita/fantastico
fantastico/oauth2/models/tests/__init__.py
Python
mit
1,175
0.00766
import re from django.conf import settings from django.http import HttpResponsePermanentRedirect class SecurityMiddleware(object): def __init__(self): self.sts_seconds = settings.SECURE_HSTS_SECONDS self.sts_include_subdomains = settings.SECURE_HSTS_INCLUDE_SUBDOMAINS self.content_type_no...
BitWriters/Zenith_project
zango/lib/python3.5/site-packages/django/middleware/security.py
Python
mit
1,753
0.001141
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'UserProject.drive_auth' db.add_column(u'user_project', 'drive_auth', s...
taikoa/wevolver-server
wevolve/projects/migrations/0006_auto__add_field_userproject_drive_auth.py
Python
agpl-3.0
8,173
0.007708
#!/usr/bin/env python import fnmatch import glob import os import sys from setuptools import setup with open("requirements.txt") as f: required = f.read().splitlines() VERSION = "1.2.4" setup( name='shmooze', version=VERSION, description='Framework for processed-backed web applications', author...
zbanks/shmooze
setup.py
Python
mit
1,029
0.013605
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: david@reciprocitylabs.com # Maintained By: david@reciprocitylabs.com from ggrc import db from ggrc.login import get_current_user from ggrc.models i...
prasannav7/ggrc-core
src/ggrc/fulltext/mysql.py
Python
apache-2.0
16,137
0.00471
from functools import partial import threading from PIL import Image from PyQt4.Qt import Qt from PyQt4.Qt import QGridLayout, QInputDialog, QPushButton from PyQt4.Qt import QVBoxLayout, QLabel, SIGNAL from electrum_gui.qt.main_window import StatusBarButton from electrum_gui.qt.password_dialog import PasswordDialog fr...
joelstanner/electrum
plugins/trezor/qt_generic.py
Python
gpl-3.0
24,003
0.00025
""" SALTS XBMC Addon Copyright (C) 2014 tknorris 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. T...
felipenaselva/repo.felipe
plugin.video.salts/scrapers/onlinedizi_scraper.py
Python
gpl-2.0
4,998
0.005002
from __future__ import division, print_function, absolute_import import itertools from numpy.testing import (assert_, assert_equal, assert_almost_equal, assert_array_almost_equal, assert_array_equal, assert_allclose) from pytest import raises as assert_raises from numpy import mgrid, pi, sin, ogrid, ...
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/scipy/interpolate/tests/test_interpolate.py
Python
mit
102,313
0.000958
#!/usr/bin/env python #coding: utf-8 class Solution: # @param prices, a list of integer # @return an integer def maxProfit(self, prices):# if not prices: return 0 n = len(prices) min_p = prices[0] max_profict = 0 for i in range(1, n): if prices[i] < min_...
wh-acmer/minixalpha-acm
LeetCode/Python/best_time_to_buy_and_sell_stock.py
Python
mit
708
0.008475
from django.utils.encoding import force_text from .models import Tree def get_survey(trigger, connection): """Returns a survey only if it matches the connection's tenant.""" from decisiontree.multitenancy.utils import multitenancy_enabled queryset = Tree.objects.filter(trigger__iexact=trigger) if mul...
caktus/rapidsms-decisiontree-app
decisiontree/utils.py
Python
bsd-3-clause
4,043
0
import sys from services.spawn import MobileTemplate from services.spawn import WeaponTemplate from resources.datatables import WeaponType from resources.datatables import Difficulty from resources.datatables import Options from java.util import Vector def addTemplate(core): mobileTemplate = MobileTemplate...
agry/NGECore2
scripts/mobiles/corellia/greck_mugger.py
Python
lgpl-3.0
1,920
0.022917
class BinaryOperator: def __init__(self, left, right): self.left = left self.right = right def __str__(self): return '%s(%s, %s)' % (self.__class__.__name__, self.left, self.right) def toCalchas(self, op): return '(%s%s%s)' % (self.left.toCalchas(), op, self.right.toCalchas...
iScienceLuvr/PPP-CAS
ppp_cas/mathematicaTree.py
Python
mit
6,347
0.019064
class __WorkerPool__: def create_webworker(self, cpuid): ## this is lazy because if the blob is created when the js is first executed, ## then it will pick all functions of `window` but they will be `undefined` ## if their definition comes after the construction of this singleton. print 'creating blob' ## ...
pombredanne/Rusthon
src/runtime/builtins_webworker.py
Python
bsd-3-clause
10,276
0.041845
"""Helper methods to handle the time in Home Assistant.""" from __future__ import annotations from contextlib import suppress import datetime as dt import re from typing import Any, cast import ciso8601 import pytz import pytz.exceptions as pytzexceptions import pytz.tzinfo as pytzinfo from homeassistant.const impor...
w1ll1am23/home-assistant
homeassistant/util/dt.py
Python
apache-2.0
12,636
0.000554
""" Test lldb data formatter subsystem. """ from __future__ import print_function import os import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class SkipSummaryDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) ...
apple/swift-lldb
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
Python
apache-2.0
7,621
0.002099
from tf_idf import * class EventAnalysis: """ Class that contains all the necessary operation to process to a text analysis """ @staticmethod def get_id_website(id_doc, is_website): """ Apply the processing to have a website id """ return id_doc if not...
Diego999/Social-Recommendation-System
event_analyse/event_analysis.py
Python
mit
2,010
0.002985
#!/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. # # Test pruning code # ******** # WARNING: # This test uses 4GB of disk space. # This test takes 30 mins...
psionin/smartcoin
qa/rpc-tests/pruning.py
Python
mit
21,037
0.005371
from django.db import models # Create your models here. class Autor(models.Model): nombre = models.TextField(max_length=100) apellido = models.TextField(max_length=100) class Libro(models.Model): nombre = models.TextField(max_length=100) editorial = models.TextField(max_length=100) genero = mod...
pollitosabroson/pycarribean
src/books/models.py
Python
apache-2.0
515
0
from django.views.generic import TemplateView from django.conf import settings from volunteer.apps.events.utils import get_active_event class SiteIndexView(TemplateView): template_name = 'home.html' def get_context_data(self, **kwargs): context = super(SiteIndexView, self).get_context_data(**kwargs)...
Apogaea/voldb
volunteer/core/views.py
Python
gpl-3.0
481
0
# PyDia SQL.py : SQL dump. # Copy it to /usr/share/dia/python import dia # import sys # import os import string import re import datetime class SQLRenderer: def __init__(self): self.f = None def begin_render(self, data, filename): self.f = open(filename, "w") # name = os.path.spl...
tedlaz/pyted
pymiles/pyMiles2.old/pymiles/sqlite/diasql.py
Python
gpl-3.0
5,065
0.001579
from __future__ import division import json import os import copy import collections import argparse import csv import neuroglancer import neuroglancer.cli import numpy as np class State(object): def __init__(self, path): self.path = path self.body_labels = collections.OrderedDict() def loa...
janelia-flyem/neuroglancer
python/neuroglancer/tool/filter_bodies.py
Python
apache-2.0
6,932
0.001587
# Author: Trevor Perrin # See the LICENSE file for legal information regarding use of this file. """TLS Lite is a free python library that implements SSL and TLS. TLS Lite supports RSA and SRP ciphersuites. TLS Lite is pure python, however it can use other libraries for faster crypto operations. TLS Lite integrates wi...
Teamxrtc/webrtc-streaming-node
third_party/webrtc/src/chromium/src/third_party/tlslite/tlslite/__init__.py
Python
mit
904
0.002212
class ParamsException(Exception): """Exception raised when tp, fmt and size values are wrongs""" pass class LineSizeException(Exception): """Exception raised when line size is bigger then specified""" pass class LineIdentifierException(Exception): """Exception raised when line indentifier rased ...
anderson89marques/PyFixedFlatFile
pyFixedFlatFile/exceptions.py
Python
mit
476
0.002101
"""Extended file operations available in POSIX. f = posixfile.open(filename, [mode, [bufsize]]) will create a new posixfile object f = posixfile.fileopen(fileobject) will create a posixfile object from a builtin file object f.file() will return the original builtin file object f.dup() will r...
huran2014/huran.github.io
wot_gateway/usr/lib/python2.7/posixfile.py
Python
gpl-2.0
8,003
0.004748
# -*- coding: utf-8 -*- # Copyright (c) 2014 Tampere University of Technology, # Intel Corporation, # OptoFidelity, # and authors # # 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 res...
teroc/Otero
tests/run_tests.py
Python
mit
1,499
0.002668
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CMS.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
IEEEDTU/CMS
manage.py
Python
mit
246
0
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2019-03-01 02:16 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('file_tags', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='filetags', name...
miurahr/seahub
seahub/file_tags/migrations/0002_remove_filetags_parent_folder_uuid.py
Python
apache-2.0
360
0
"""Calculate exact solutions for the zero dimensional LLG as given by [Mallinson2000] """ from __future__ import division from __future__ import absolute_import from math import sin, cos, tan, log, atan2, acos, pi, sqrt import scipy as sp import matplotlib.pyplot as plt import functools as ft import simpleode.core.u...
davidshepherd7/Landau-Lifshitz-Gilbert-ODE-model
llg/mallinson.py
Python
gpl-3.0
4,251
0.000235
''' Created on Feb 4, 2016 Decoding tables taken from https://github.com/typiconman/Perl-Lingua-CU @author: mike kroutikov ''' from __future__ import print_function, unicode_literals import codecs def ucs_decode(input_, errors='strict'): return ''.join(decoding_table[x] for x in input_), len(input_) def ucs_e...
pgmmpk/cslavonic
cslavonic/ucs_decode.py
Python
mit
9,501
0.001053
## BTisWatchingU ## # # This program scans for bluetooth devices and add their address and name to a # centralized database. This database have some simple facilities to determine # where and when the device have been spotted. # Copyright (C) 2008,2009 Philippe Chretien # # This program is free software; you can redi...
pchretien/btiswatchingu
python/bt_device.py
Python
gpl-2.0
1,349
0.004448
"""Support for RESTful API sensors.""" import json import logging from xml.parsers.expat import ExpatError import httpx from jsonpath import jsonpath import voluptuous as vol import xmltodict from homeassistant.components.sensor import DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA from homeassistant.const import ( CONF_...
balloob/home-assistant
homeassistant/components/rest/sensor.py
Python
apache-2.0
9,072
0.000882
from SPARQLWrapper import SPARQLWrapper, JSON sparql = SPARQLWrapper("http://dbpedia.org/sparql") sparql.setQuery(""" PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?label WHERE { <http://dbpedia.org/resource/Asturias> rdfs:label ?label } """) sparql.setReturnFormat(JSON) results = sparql.quer...
davidam/python-examples
sparql/dbpedia-asturias.py
Python
gpl-3.0
416
0.002404
#!/usr/bin/env python3 import apts from distutils.core import setup setup( name = apts.__name__, packages = [apts.__name__], scripts = ['bin/apts'], version = apts.__version__, description = apts.__description__, author = apts.__author__, author_email = apts.__author_email__, license ...
Ilias95/apts
setup.py
Python
gpl-3.0
1,102
0.024501
# Copyright (c) 2018, Xilinx Inc. # # Siva Durga Prasad Paladugu # # SPDX-License-Identifier: GPL-2.0 import pytest import re import random import u_boot_utils """ Note: This test relies on boardenv_* containing configuration values to define the network available and files to be used for testing. Without this, this ...
Digilent/u-boot-digilent
test/py/tests/test_zynqmp_secure.py
Python
gpl-2.0
3,375
0.001778
######################################################################## # Rancho - Open Source Group/Project Management Tool # Copyright (C) 2008 The Rancho Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by t...
joaquimrocha/Rancho
rancho/message/management.py
Python
agpl-3.0
1,442
0.002774
""" Apple Push Notification Service Documentation is available on the iOS Developer Library: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html """ import time from apns2 import client as apns2_client from apns2 import credentials as apns2_c...
shigmas/django-push-notifications
push_notifications/apns.py
Python
mit
5,297
0.020578
# coding: utf-8 # # Clean the raw data # # ## Data from U.S. Energy Information Administration # # Data URL: [eia.gov](http://www.eia.gov/coal/data.cfm) # # Combining and cleaning the raw csv files into a cleaned data set and coherent database. # # Generally a good idea to have a separate data folder with the ra...
jbwhit/OSCON-2015
deliver/coal_data_cleanup.py
Python
mit
2,214
0.006323
from property import * # Neuron common parameters iaf_neuronparams = {'E_L': -70., 'V_th': -50., 'V_reset': -67., 'C_m': 2., 't_ref': 2., 'V_m': -60., 'tau_syn_ex': 1., 'tau_syn_i...
magnastrazh/NEUCOGAR
nest/GDP/scripts/parameters.py
Python
gpl-2.0
3,431
0.001749
#!/opt/python3.3/bin/python3.3 from threading import Thread import RPi.GPIO as GPIO import time import datetime import os import sys import dht11_sensor import psycopg2 import copy ###-----------------Hardware Settings----------------------- PIN_LC=25 #Light Sensor (GPIO.IN, pull_up_down=GPIO.PUD_UP) PIN_MC=17 #Mo...
warkanum/warkanums-pi-device-snippets
build1/boot_special.py
Python
mit
8,959
0.018306
"""Test that sys.modules is used properly by import.""" from .. import util from . import util as import_util import sys from types import MethodType import unittest class UseCache: """When it comes to sys.modules, import prefers it over anything else. Once a name has been resolved, sys.modules is checked t...
michalliu/OpenWrt-Firefly-Libraries
staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/lib/python3.4/test/test_importlib/import_/test_caching.py
Python
gpl-2.0
3,643
0.000823
u"""Entry points for job execution :copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved. :license: http://www.apache.org/licenses/LICENSE-2.0.html """ from __future__ import absolute_import, division, print_function from pykern import pkinspect, pkjson from pykern.pkcollections import PKDict from pykern....
mrakitin/sirepo
sirepo/job_api.py
Python
apache-2.0
8,078
0.002723
# # Copyright 2010-2014 Fabric Technologies Inc. All rights reserved. # import os import json import collections from kraken.ui.Qt import QtGui, QtWidgets, QtCore class PreferenceEditor(QtWidgets.QDialog): """A widget providing the ability to nest """ def __init__(self, parent=None): # constructo...
oculusstorystudio/kraken
Python/kraken/ui/preference_editor.py
Python
bsd-3-clause
7,028
0.001565
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
fsschneider/DeepOBS
docs/conf.py
Python
mit
5,559
0
def primesSum(a, b): return sum([a for a in range(a, b+1) if not (a < 2 or any(a % x == 0 for x in range(2, int(a ** 0.5) + 1))) ])
emirot/codefights
python/primesSum.py
Python
apache-2.0
136
0.014706
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/__init__.py
Python
mit
524
0.003817
# 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...
alsrgv/tensorflow
tensorflow/python/keras/utils/generic_utils.py
Python
apache-2.0
19,553
0.007978
#!/usr/bin/env python """ Command-line utility for administrative tasks. """ import os import sys if __name__ == "__main__": os.environ.setdefault( "DJANGO_SETTINGS_MODULE", "AzureAuthSample.settings" ) from django.core.management import execute_from_command_line execute_from_command...
ElliottMiller/python-azuread-sample
manage.py
Python
mit
336
0
from copy import deepcopy import h5py import numpy as np import pytest import six from ...util.functions import virtual_file from .. import (CartesianGrid, CylindricalPolarGrid, SphericalPolarGrid, AMRGrid, OctreeGrid) ALL_GRID_TYPES = ['car', 'sph', 'c...
hyperion-rt/hyperion
hyperion/grid/tests/test_io.py
Python
bsd-2-clause
6,744
0.000148
def is_perfect_number(n): sum = 0 for x in range(1, n): if n % x == 0: sum += x return sum == n num = int(input("Please enter a number to check if it is perfect or not")) print(is_perfect_number(num))
OpenGenus/cosmos
code/mathematical_algorithms/src/perfect_number/perfect_number.py
Python
gpl-3.0
235
0
import os from setuptools import setup ROOT = os.path.dirname(os.path.realpath(__file__)) with open(os.path.join(ROOT, 'README.rst'), encoding='utf-8') as inp: LONG_DESCRIPTION = inp.read() setup( # Meta data name='user_agent', version='0.1.10', author="Gregory Petukhov", author_email='lorie...
lorien/user_agent
setup.py
Python
mit
1,599
0.000625
#!/usr/bin/env python import nltk import os import sys import include title = sys.argv[1].lower() html = sys.argv[2].lower() cate_id = sys.argv[3] def do_read_train(uni_dict, bi_dict, file): lines = file.readlines() for line in lines: words = line.split() bi_dict[words[0]] = int(words[2]) uni_dict[words[0].s...
jiayisuse/cs73
wp-admin/data_delete.py
Python
gpl-2.0
2,483
0.024567
from django.conf.urls import patterns, url from . import views urlpatterns = patterns('', url(r'^$', views.IndexView.as_view(), name='index'), url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'), url(r'^(?P<pk>\d+)/results/$', views.ResultsView.as_view(), name='results'), url(r'^(?P<pol...
alirazabhayani/django_workshop_poll_app
polls/urls.py
Python
bsd-3-clause
424
0.007075
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ .. module:: measurematrix.py .. moduleauthor:: Jozsef Attila Janko, Bence Takacs, Zoltan Siki (code optimalization) Sample application of Ulyxes PyAPI to measure within a rectangular area :param argv[1] (int): number of horizontal intervals (between measurements), ...
zsiki/ulyxes
pyapps/measurematrix.py
Python
gpl-2.0
4,051
0.005431
# -*- coding: utf-8 -*- from module.common.json_layer import json_loads from module.plugins.Account import Account class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" __type__ = "account" __version__ = "0.05" __description__ = """Simply-Premium.com account plugin""" __license__ ...
immenz/pyload
module/plugins/accounts/SimplyPremiumCom.py
Python
gpl-3.0
1,650
0.008485
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2017-01-29 16:14 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import modelcluster.fields import wagtail.wagtailcore.blocks import wagtail.wagtailcore.fields import wagtail.wagtailimages.blocks ...
willysbrewing/willys_website
willys_website/core/migrations/0002_auto_20170129_1714.py
Python
apache-2.0
7,007
0.001284
# 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, ...
tensorflow/neural-structured-learning
research/gam/gam/trainer/trainer_classification_gcn.py
Python
apache-2.0
38,149
0.004351
import unittest from payment_terminal.tests import test_loader import payment_terminal.drivers.bbs.tests as test_bbs def suite(): loader = unittest.TestLoader() suite = unittest.TestSuite(( loader.loadTestsFromModule(test_bbs), loader.loadTestsFromModule(test_loader), )) return suite
bwhmather/python-payment-terminal
payment_terminal/tests/__init__.py
Python
bsd-3-clause
320
0
# 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...
ryfeus/lambda-packs
Tensorflow_Pandas_Numpy/source3.6/tensorboard/plugins/beholder/beholder.py
Python
mit
7,267
0.007706
""" Copyright (c) 2017-2022, Vanessa Sochat 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 retain the above copyright notice, this list of conditions and the f...
expfactory/expfactory
expfactory/database/relational.py
Python
bsd-3-clause
8,107
0.000617
# drivers.py - high-level functions for filtering SQLAlchemy queries # # Copyright 2011 Lincoln de Sousa <lincoln@comum.org>. # Copyright 2012, 2013, 2014, 2015, 2016 Jeffrey Finkelstein # <jeffrey.finkelstein@gmail.com> and contributors. # # This file is part of Flask-Restless. # # Flask-Restless is distribu...
jfinkels/flask-restless
flask_restless/search/drivers.py
Python
agpl-3.0
6,012
0
# -*- encoding: utf-8 -*- from cliff.interactive import InteractiveApp class FakeApp(object): NAME = 'Fake' def make_interactive_app(*command_names): fake_command_manager = [(x, None) for x in command_names] return InteractiveApp(FakeApp, fake_command_manager, stdin=None, stdo...
sjsucohort6/openstack
python/venv/lib/python2.7/site-packages/cliff/tests/test_interactive.py
Python
mit
1,743
0
import rules from rules.predicates import is_staff, is_superuser from .models import Policy @rules.predicate def is_policy_manager(user, policy=None): if policy is None: return bool(Policy.objects.filter(managers=user).count()) else: return bool(policy.managers.filter(id=user.id).count()) @...
thetoine/eruditorg
erudit/core/subscription/rules.py
Python
gpl-3.0
748
0.001337
# -*- coding: utf-8 -*- __version__ = '$Id: 11c92177ab93084552b8d68021da6545c4b7674f $' from pywikibot import family # The Wikimedia Incubator family class Family(family.WikimediaFamily): def __init__(self): super(Family, self).__init__() self.name = 'incubator' self.langs = { ...
wpoa/wiki-imports
lib/python2.7/site-packages/pywikibot-2.0b1-py2.7.egg/pywikibot/families/incubator_family.py
Python
gpl-3.0
373
0
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2013-2014, Martín Gaitán # Copyright (c) 2012-2013, Alexander Jung-Loddenkemper # This file is part of Waliki (http://waliki.nqnwebs.com/) # License: BSD (https://github.com/mgaitan/waliki/blob/master/LICENSE) #============================================...
mgaitan/waliki_flask
waliki/markup.py
Python
bsd-3-clause
7,181
0.003343
import sys import errno import json import os from argparse import ArgumentParser sys.path.insert(1, 'py-bindings') from squad import SQUADConverter def get_samples(test_file, vocab_file, output_dir): print("Test file:", test_file) print("Vocab file:", vocab_file) print("Output dir:", output_dir) max_s...
mlperf/inference_results_v0.7
closed/Intel/code/resnet/resnet-ov/py-bindings/convert.py
Python
apache-2.0
2,497
0.007609
""" Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. For reposit...
saltstack/salt
salt/modules/aptpkg.py
Python
apache-2.0
105,007
0.001
import inspect import sys import types from copy import deepcopy import pickle as pypickle try: import cPickle as cpickle except ImportError: cpickle = None if sys.version_info < (2, 6): # pragma: no cover # cPickle is broken in Python <= 2.5. # It unsafely and incorrectly uses relative instead of a...
frac/celery
celery/utils/serialization.py
Python
bsd-3-clause
4,836
0.000414
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. """ Utilities for versioned caching and automatic timeout determin...
shoopio/shoop
shuup/core/cache/__init__.py
Python
agpl-3.0
1,316
0
from unittest import TestCase from instructions.pop import Pop from context import Context from registers import AX, SP __author__ = "Sébastien Guimmara" class TestPop(TestCase): def test_execute(self): p = Pop.parse(['ax']) ctx = Context(None) ctx.registers.set(SP, 0xFFFE) self.a...
Groutcho/exii
tests/instructions/test_pop.py
Python
gpl-2.0
762
0
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.6.1 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys im...
skuda/client-python
kubernetes/test/test_v1beta1_network_policy_ingress_rule.py
Python
apache-2.0
991
0.004036
""" A response received to a Swagger API operation. """ import logging __all__ = ["Response"] log = logging.getLogger(__name__) class CaseInsensitiveDict(dict): """Dictionary with case insensitive lookup of string keys.""" def __getitem__(self, key): return {k.lower(): v for k, v in self.items()}[k...
olipratt/swagger-conformance
swaggerconformance/response.py
Python
mit
1,388
0
# misc.py # Copyright (C) 2012-2016 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at your option) any later version. # This program is distributed in the hope tha...
rpm-software-management/dnf
dnf/yum/misc.py
Python
gpl-2.0
11,251
0.001867
# SPDX-License-Identifier: GPL-2.0 # Copyright (c) 2015 Stephen Warren # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. import pytest import u_boot_utils @pytest.mark.buildconfigspec('cmd_memory') def test_md(u_boot_console): """Test that md reads memory as expected, and that memory can be modi...
Digilent/u-boot-digilent
test/py/tests/test_md.py
Python
gpl-2.0
1,426
0.001403
# -*- coding: utf-8 -*- # This file is part of Gtfslib-python. # # Gtfslib-python 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...
afimb/gtfslib-python
gtfslib/orm.py
Python
gpl-3.0
22,956
0.008059
#!/usr/bin/python3 #-*- coding:utf-8 -*- from functools import wraps def xxx(func): @wraps(func) def my(n): func(n*100) return return my @xxx def abc(n): print(n) if __name__ == '__main__': abc(10) abc.__wrapped__(10) xx = abc.__wrapped__ xx(1234)
yuncliu/Learn
python/decorator.py
Python
bsd-3-clause
299
0.013378
#!/bin/env python # vim: expandtab:tabstop=4:shiftwidth=4 """ This script is used to check the psad logs for positive port scanning traffic and report its findings to Zabbix. """ from __future__ import print_function from datetime import datetime import os import re import boto3 import botocore import yaml # Rea...
blrm/openshift-tools
docker/oso-psad/src/scripts/check_psad.py
Python
apache-2.0
5,322
0.004134
# ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- """ Bitbake "Fetch" implementation for osc (Opensuse build service client). Based on the svn "Fetch" implementation. """ import os import sys import logging import bb from bb import data from bb.fetch2 import Fetch...
martiert/bitbake
lib/bb/fetch2/osc.py
Python
gpl-2.0
4,506
0.00466
from data.conditional_import import ( dump, # dumps, # load, # loads, )
PyCQA/astroid
tests/testdata/python3/data/conditional.py
Python
lgpl-2.1
87
0.011494
# coding: utf-8 # Module: actions # Created on: 27.07.2015 # Author: Roman Miroshnychenko aka Roman V.M. (romanvm@yandex.ua) # Licence: GPL v.3: http://www.gnu.org/copyleft/gpl.html import os import xbmcgui import xbmcplugin from simpleplugin import Plugin import json_requests as jsonrq from buffering import buffer_to...
kreatorkodi/repository.torrentbr
plugin.video.yatp/libs/client/actions.py
Python
gpl-2.0
8,310
0.003851
# -*- coding: utf-8 -*- # Copyright 2007-2016 The HyperSpy developers # # This file is part of HyperSpy. # # HyperSpy 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...
sem-geologist/hyperspy
hyperspy/tests/misc/test_test_utils.py
Python
gpl-3.0
5,176
0
import os import random import time import hashlib import warnings from tempfile import mkdtemp from shutil import rmtree from six.moves.urllib.parse import urlparse from six import BytesIO from twisted.trial import unittest from twisted.internet import defer from scrapy.pipelines.files import FilesPipeline, FSFilesS...
Parlin-Galanodel/scrapy
tests/test_pipeline_files.py
Python
bsd-3-clause
17,823
0.002749
from tests.test_pip import (reset_env, run_pip, _create_test_package, _change_test_package_version) from tests.local_repos import local_checkout def test_install_editable_from_git_with_https(): """ Test cloning from Git with https. """ reset_env() result = run_pip('install', ...
radiosilence/pip
tests/test_vcs_backends.py
Python
mit
5,930
0.003373
import logging from collections import defaultdict class EventInsightsHelper(object): @classmethod def calculate_event_insights(cls, matches, year): INSIGHTS_MAP = { 2016: cls.calculate_event_insights_2016 } if year in INSIGHTS_MAP: return INSIGHTS_MAP[year](ma...
synth3tk/the-blue-alliance
helpers/event_insights_helper.py
Python
mit
6,320
0.002848
import copy pattern_raw_digits = [ [' _ ', '| |', '|_|'], [' ', ' |', ' |'], [' _ ', ' _|', '|_ '], [' _ ', ' _|', ' _|'], [' ', '|_|', ' |'], [' _ ', '|_ ', ' _|'], [' _ ', '|_ ', '|_|'], [' _ ', ' |', ' |'], [' _ ', '|_|', '|_|'], [' ...
brunorijsman/coding-katas
bank-ocr-python/bank-ocr.py
Python
mit
3,837
0.019547
import sys sys.path.insert(0, ".") import unittest from coalib.settings.Section import Section from coalib.bears.LocalBear import LocalBear, BEAR_KIND class LocalBearTest(unittest.TestCase): def test_api(self): test_object = LocalBear(Section("name"), None) self.assertRaises(NotImplementedError, ...
Tanmay28/coala
coalib/tests/bears/LocalBearTest.py
Python
agpl-3.0
585
0.005128