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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gi.repository import GObject
from gi.repository import Peas
from gi.repository import RB
from gi.repository import Gio
from gi.repository import GLib
from gi.repository.GLib import Variant
from remember_prefs import RememberPreferences
import subprocess
GSETTINGS_KE... | fossfreedom/remember-the-rhythm | remember-the-rhythm.py | Python | gpl-3.0 | 9,865 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-documentai | google/cloud/documentai_v1/services/document_processor_service/async_client.py | Python | apache-2.0 | 23,644 |
import numpy as np
def numeric_grad(f,x,eps=1e-9,method="central"):
if method == "central":
xpert = x.copy()
out = np.zeros_like(x)
for i in xrange(x.size):
xpert.flat[i] = x.flat[i] + eps
yplus = f(xpert)
xpert.flat[i] = x.flat[i] - eps
yminu... | nebw/cgt | cgt/numeric_diff.py | Python | mit | 869 |
# encoding: utf-8
__author__ = 'jesuejunior'
| jesuejunior/golingo | quiz/tests/test_view.py | Python | bsd-3-clause | 45 |
"""Session model class."""
from datetime import datetime, timezone
from typing import cast
class Session:
"""Class representing a user session."""
def __init__(self, session_data: dict[str, datetime | str]) -> None:
self.__session_data = session_data or {}
def is_valid(self) -> bool:
""... | ICTU/quality-time | components/server/src/external/model/session.py | Python | apache-2.0 | 875 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import argparse
import os
import signal
import sys
import csv
import time
import datetime
import re
import subprocess
import glob
from pprint import pprint, pformat
import pymongo
# logging with colors
import logging
from termcolor import colored
import color_log
log =... | knmkr/perGENIE | pergenie/lib/mongo/import_LD_data.py | Python | agpl-3.0 | 9,621 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | sarvex/tensorflow | tensorflow/python/framework/convert_to_constants_test.py | Python | apache-2.0 | 65,071 |
# -*- coding: utf-8 -*-
## begin license ##
#
# "Meresco Components" are components to build searchengines, repositories
# and archives, based on "Meresco Core".
#
# Copyright (C) 2007-2009 SURF Foundation. http://www.surf.nl
# Copyright (C) 2007 SURFnet. http://www.surfnet.nl
# Copyright (C) 2007-2010 Seek You Too (CQ... | seecr/meresco-components | meresco/components/xmlpump.py | Python | gpl-2.0 | 3,643 |
"""Tests for grouping_op_handler."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import mock
from morph_net.framework import grouping_op_handler
from morph_net.framework import op_regularizer_manager as orm
import tensorflow.compat.v1 as tf
from tensorf... | google-research/morph-net | morph_net/framework/grouping_op_handler_test.py | Python | apache-2.0 | 16,324 |
from bears.css.CSSAutoPrefixBear import CSSAutoPrefixBear
from tests.LocalBearTestHelper import verify_local_bear
good_file = """
.example {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
"""
bad_file = """
.example {
display: flex;
}
"""
CSSAutoPrefixBear = verify_local_bear(CSSAutoPr... | sounak98/coala-bears | tests/css/CSSAutoPrefixBearTest.py | Python | agpl-3.0 | 459 |
# -*- coding: utf-8 -*-
from cradmin_legacy import crapp
from cradmin_legacy.crinstance import reverse_cradmin_url
from devilry.devilry_deadlinemanagement.cradmin_app import ExaminerDeadlineManagementApp
from devilry.devilry_deadlinemanagement.views import manage_deadline_view
class ManageDeadlineView(manage_deadl... | devilry/devilry-django | devilry/devilry_group/views/examiner/manage_deadline.py | Python | bsd-3-clause | 1,086 |
"""
perf is a tool included in the linux kernel tree that
supports functionality similar to oprofile and more.
@see: http://lwn.net/Articles/310260/
"""
import time, os, stat, subprocess, signal
import logging
from autotest_lib.client.bin import profiler, os_dep, utils
class perf(profiler.profiler):
version = 1... | clebergnu/autotest | client/profilers/perf/perf.py | Python | gpl-2.0 | 2,846 |
# -*- 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 'TwitterAccount'
db.create_table(u'TwitterAccount_twittera... | gkoehler/TootList | TootList/TwitterAccount/migrations/0001_initial.py | Python | mit | 3,628 |
"""
Copyright (C) 2016 Quinn D Granfor <spootdev@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
... | MediaKraken/MediaKraken_Deployment | source/testing/test_common/test_common_hardware_hdhomerun_py.py | Python | gpl-3.0 | 1,826 |
# Copyright 2014 - Rackspace Hosting
#
# 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 ... | stackforge/solum | solum/objects/sqlalchemy/image.py | Python | apache-2.0 | 5,222 |
import unittest
from google.appengine.api import datastore
from google.appengine.api import datastore_errors
from google.appengine.ext.db import non_transactional
from django.db import models
from django.http import HttpRequest
from django.core.signals import request_finished, request_started
from django.core.cache i... | trik/djangae | djangae/tests/test_caching.py | Python | bsd-3-clause | 27,318 |
"""Tests for WebSocket API commands."""
from async_timeout import timeout
import voluptuous as vol
from homeassistant.components.websocket_api import const
from homeassistant.components.websocket_api.auth import (
TYPE_AUTH,
TYPE_AUTH_OK,
TYPE_AUTH_REQUIRED,
)
from homeassistant.components.websocket_api.co... | turbokongen/home-assistant | tests/components/websocket_api/test_commands.py | Python | apache-2.0 | 29,182 |
# coding: UTF-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import pygame
import os
import json
from functools import partial
import scenes.main_menu
from scenes.base import Scene
from consts.default import TIMER_OPTIONS
from scenes.interfaces.config_... | GRUPO-ES2-GJLRT/XADREZ_ES2 | src/scenes/config_menu.py | Python | mit | 4,411 |
################################################################################
#
# _/_/_/_/_/ _/_/_/ _/ _/_/_/
# _/ _/ _/ _/_/ _/ _/
# _/ _/ _/ _/ _/ _/ _/
# _/ _/_/_/ _/_/_/_/ _/_/_/
# _/ _/ _/ _/ _/ _/
# ... | socrocket/trap-gen | cxx_writer/CustomCode.py | Python | gpl-3.0 | 3,844 |
import os
import sys
import subprocess
from numpy.distutils.core import setup
from numpy.distutils.core import Extension
import numpy as np
import pele
## Numpy header files
numpy_lib = os.path.split(np.__file__)[0]
numpy_include = os.path.join(numpy_lib, 'core/include')
# find pele path
# note: this is used both... | kjs73/PyCG_DESCENT | setup.py | Python | gpl-3.0 | 4,110 |
def resample_to_1km( x ):
'''
template_raster_mask should be a mask in in the res/extent/origin/crs of the
existing TEM IEM products.
'''
fn, output_filename, template_raster_mask_fn = x
import rasterio, os
from rasterio.warp import RESAMPLING, reproject
import numpy as np
rst = rasterio.open( fn )
rst_arr ... | ua-snap/downscale | old/old_bin/alfresco_cmip5_crop_mask_resample_non_tem.py | Python | mit | 7,823 |
# -*- coding: utf-8 -*-
# (c) 2017 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import wiz_close_analytic_account_contract
| esthermm/odoo-addons | account_analytic_mass_close/wizard/__init__.py | Python | agpl-3.0 | 182 |
"""
The :mod:`sklearn.pls` module implements Partial Least Squares (PLS).
"""
# Author: Edouard Duchesnay <edouard.duchesnay@cea.fr>
# License: BSD 3 clause
from ..base import BaseEstimator, RegressorMixin, TransformerMixin
from ..utils import check_arrays
from ..externals import six
import warnings
from abc import ... | depet/scikit-learn | sklearn/cross_decomposition/pls_.py | Python | bsd-3-clause | 28,547 |
# Copyright (C) 2005-2010 Canonical Ltd
#
# 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.
#
# This program is distribute... | Distrotech/bzr | bzrlib/transport/sftp.py | Python | gpl-2.0 | 38,593 |
# -*- coding: utf-8 -*-
from flask import Blueprint, render_template, g
from dataviva.apps.general.views import get_locale
from dataviva import view_cache
from dataviva.utils.cached_query import api_cache_key
mod = Blueprint('rankings', __name__, template_folder='templates',
url_prefix='/<lang_code>/ra... | DataViva/dataviva-site | dataviva/apps/rankings/views.py | Python | mit | 2,868 |
from django.contrib.auth.models import User
from student.models import UserStanding
def users_unenrolled_in(course_id):
"""
Returns users which are not enrolled in specify course_id.
"""
return User.objects.filter(
is_active = True
).exclude(
standing__account_status = UserStanding.... | nttks/jenkins-test | common/djangoapps/course_global/management/commands/__init__.py | Python | agpl-3.0 | 442 |
# -*- coding: utf-8 -*-
from core import httptools
from core import scrapertools
from lib import jsunpack
from platformcode import logger
def test_video_exists(page_url):
logger.info("(page_url='%s')" % page_url)
global data
data = httptools.downloadpage(page_url).data
if "Not Found" in d... | alfa-addon/addon | plugin.video.alfa/servers/watchvideo.py | Python | gpl-3.0 | 1,365 |
import requests
import bs4
import os
import time
import logging
import sys
import traceback
import settings
log = logging.getLogger(__name__)
class TeamInfo(object):
def __init__(self, team):
self.team = team
self.team_name = settings.teams[team]
self.exec_url = "http://www.pro-football-ref... | VikParuchuri/ownerchange | scrape_data.py | Python | mit | 5,083 |
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
#
# All rights reserved.
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
#
#
... | DLR-SC/DataFinder | src/datafinder/persistence/search/searcher.py | Python | bsd-3-clause | 2,906 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
*****************************************
Author: zhlinh
Email: zhlinhng@gmail.com
Version: 0.0.1
Created Time: 2016-03-21
Last_modify: 2016-03-21
******************************************
'''
'''
Compare two version numbers version1 and v... | zhlinh/leetcode | 0165.Compare Version Numbers/solution.py | Python | apache-2.0 | 1,699 |
"Base classes for lookup creation."
from __future__ import unicode_literals
import json
import operator
import re
from functools import reduce
from django.conf import settings
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.core.urlresolvers import reverse
from django.core.serializers.... | hzlf/openbroadcast | website/tools/selectable/base.py | Python | gpl-3.0 | 5,321 |
# pylint: disable=no-member, redefined-outer-name
"""
Annalist resource types module
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
__author__ = "Graham Klyne (GK@ACM.ORG)"
__copyright__ = "Copyright 2015, G. Klyne"
__license__ = "MIT (http://o... | gklyne/annalist | src/annalist_root/annalist/resourcetypes.py | Python | mit | 4,340 |
#!/usr/bin/env python3
# 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
# "... | zhreshold/mxnet | example/extensions/lib_custom_op/test_relu.py | Python | apache-2.0 | 2,798 |
BASE_URL='http://sebest.api.dev.int.dmcloud.net'
USER_ID='4cadc039dede832941000000'
API_KEY='f728debf25de13d367c2b73a6647979dd4f234e6'
from cloudkey import CloudKey
from cloudkey import AuthenticationError, NotFound, InvalidParameter, Exists, MissingParameter
from flask import Flask
from flask import render_template,... | dailymotion/cloudkey-py | examples/upload_html/upload.py | Python | lgpl-3.0 | 1,661 |
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright (C) 2006 Fluendo, S.A. (www.fluendo.com).
# Copyright 2006, Frank Scholz <coherence@beebits.net>
import time
from urlparse import urlsplit
from twisted.internet import reactor, defer
from twisted.web import resource, server... | palfrey/coherence | coherence/upnp/core/event.py | Python | mit | 15,208 |
# -*- coding: utf-8 -*-
# Copyright 2020 OpenSynergy Indonesia
# Copyright 2020 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import fields, models
class HrEmployee(models.Model):
_name = "hr.employee"
_inherit = "hr.employee"
accrue_expense_j... | open-synergy/opnsynid-hr | hr_timesheet_accrue_expense/models/hr_employee.py | Python | agpl-3.0 | 702 |
#! /usr/bin/env python
#
# Copyright 2008-2012 NVIDIA Corporation
#
# 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 ... | copperhead/copperhead | tests/test_unify.py | Python | apache-2.0 | 2,555 |
# Generated by Django 1.11.15 on 2018-10-30 14:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0124_course_faq_and_learner_testimonials'),
]
operations = [
migrations.AddField(
model_name='course',
... | edx/course-discovery | course_discovery/apps/course_metadata/migrations/0125_course_additional_information.py | Python | agpl-3.0 | 489 |
I=lambda:map(int,raw_input().split());N,Q=I();p,r,f=range(N+1),[0]*(N+1),lambda x:(p[x]==x)*x or f(p[x])
def u(x, y):
x,y=f(x),f(y)
if x==y:return
if r[x]<r[y]:p[x]=y
else:
p[y] = x
if r[x]==r[y]:r[x]+=1
for a,b,c in[I()for _ in[0]*Q]:
k=[u,lambda x,y:['NO','YES'][f(x)==f(y)]][a](b,c)
if a: print k
| knuu/competitive-programming | atcoder/corp/codefes2015_short_b.py | Python | mit | 310 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2004-2012 Pexego Sistemas Informáticos All Rights Reserved
# $Marta Vázquez Rodríguez$ <marta@pexego.es>
#
# This program is free software: you can redistribute it and/or modify
# it unde... | Pexego/alimentacion | eln_product/ingredients.py | Python | agpl-3.0 | 2,550 |
from typing import Tuple, Generator, Any
from amino import List, Map, Lists, _, Regex, Either, Right, Left, Id, Path
from amino.state import EitherState, State
from amino.regex import Match
from amino.do import do
from amino.util.numeric import parse_int
Files = Map[Path, List[str]]
Entry = Map[str, Any]
excludes = L... | tek/amino | amino/util/coconut_mypy.py | Python | mit | 2,846 |
"""
Support for the NetAtmo Weather Service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.netatmo/
"""
import logging
from datetime import timedelta
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
fro... | mikaelboman/home-assistant | homeassistant/components/sensor/netatmo.py | Python | mit | 4,916 |
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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 versi... | tomprince/gemrb | gemrb/GUIScripts/iwd2/CSound.py | Python | gpl-2.0 | 2,413 |
import numpy as np
from scipy import linalg as LA
import mxnet as mx
import argparse
import utils
import pdb
def fc_decomposition(model, args):
W = model.arg_params[args.layer+'_weight'].asnumpy()
b = model.arg_params[args.layer+'_bias'].asnumpy()
W = W.reshape((W.shape[0],-1))
b = b.reshape((b.shape[0],-1)) ... | yhpeng-git/mxnet | tools/accnn/acc_fc.py | Python | apache-2.0 | 1,897 |
from __future__ import unicode_literals
import frappe
from frappe.model.utils.rename_field import rename_field
def execute():
"""
Rename Total Margin field to Rate With Margin in
"Sales Order Item", "Sales Invoice Item", "Delivery Note Item",
"Quotation Item"
"""
for d in ("Sales Order Item", "Sales Invoic... | gsnbng/erpnext | erpnext/patches/v8_0/rename_total_margin_to_rate_with_margin.py | Python | agpl-3.0 | 649 |
bl_info = {
"name": "G - Pack",
"author": "Velem Novak",
"version": (0, 2, 0),
"blender": (2, 77, 0),
"location": "Object > G-Pack",
"description": "UV packing game",
"warning": "",
"wiki_url": "http://www.blendercam.blogspot.com",
"category": "Object"
}
import bpy
import math, random, os
import mathutils
fr... | vilemnovak/blendercam | scripts/addons/GPack/__init__.py | Python | gpl-2.0 | 18,106 |
#! /usr/bin/env python2
'''
# ****************** LANGUAGE DETECTOR ******************
#
# Using a set of training data in a variety of languages,
# determines the language of a test documents using ngram
# character counts.
#
# *******************************************************
'''
from __future__ import divisio... | jvasilakes/language_detector | main.py | Python | unlicense | 10,207 |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 10 18:05:01 2012
License: GPL version 3.0
January 25, 2016
Copyright:
This file is part of AutoPatcher_IG.
AutoPatcher_IG 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 So... | chubykin/AutoPatcher_IG | Autopatcher/test.py | Python | gpl-3.0 | 1,656 |
'''
Created on Oct 8, 2014
@author: baskaran_k
'''
from getDistanceMatrix import getDistanceMatrix
from getSurfaceResidues import getSurfaceResidues
from random import sample
from pylab import mean,var,sqrt
from MySQLdb import Connect
class analyzeSurface(object):
def calZsocre(self,core,surface,sampleSize):
... | kumar-physics/eppic-pred | EPPICPrediction/src/analyzeSurface_xtal.py | Python | gpl-3.0 | 3,161 |
print("Welcome to super-spoon")
print("This is a WIP program")
print("Please check back later when we have made more progress")
| supershadow899/super-spoon | main.py | Python | mit | 128 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class LinkTracker(models.Model):
_inherit = "link.tracker"
mass_mailing_id = fields.Many2one('mail.mass_mailing', string='Mass Mailing')
mass_mailing_campaign_id = fiel... | t3dev/odoo | addons/mass_mailing/models/link_tracker.py | Python | gpl-3.0 | 1,807 |
import collections
# Base
class BaseInstanceDict(collections.Mapping):
def __init__(self, descriptor, instance):
self.descriptor = descriptor
self.instance = instance
def __repr__(self):
return repr(dict(self))
def __iter__(self):
return self.descriptor.model_configs.ite... | revpoint/prefs-n-perms | prefs_n_perms/managers.py | Python | mit | 2,705 |
""".. Ignore pydocstyle D400.
===============
Signal Handlers
===============
"""
from asgiref.sync import async_to_sync
from django.conf import settings
from django.db import transaction
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
from resolwe.flow.managers impo... | genialis/resolwe | resolwe/flow/signals.py | Python | apache-2.0 | 2,030 |
from RMPY.rig.biped.rig import reverseFeet
import pymel.core as pm
from RMPY.rig import rigFK
from RMPY.rig import constraintSwitch
class IkFkFeetModel(constraintSwitch.ConstraintSwitchModel):
def __init__(self):
super(IkFkFeetModel, self).__init__()
self.ik_feet = None
self.fk_feet = None... | rendermotion/RMPY | rig/biped/rig/rigIkFkFeet.py | Python | lgpl-3.0 | 2,537 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('taskzilla', '0006_task_description'),
]
operations = [
migrations.AddField(
model_name='task',
name=... | jailuthra/taskzilla | taskzilla/migrations/0007_auto_20151011_0415.py | Python | mit | 554 |
#!/usr/bin/env python2.6
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... | stdweird/aquilon | tests/broker/test_del_dns_domain.py | Python | apache-2.0 | 3,942 |
#!/usr/bin/env python3
"""
For every line in the makefile ending in a backslash, locate the longest
line and then reformat all lines to match the proper tailing whitespace.
"""
import os
import sys
_MAX_LENGTH = 120
filename = sys.argv[1]
def count_prefix_tabs(line):
count = 0
for ch in line:
if ch... | GNOME/gnome-builder | src/plugins/beautifier/internal/align_makefile.py | Python | gpl-3.0 | 1,357 |
from django.template import Library
from simplemooc.courses.models import Enrollment
register = Library()
@register.inclusion_tag('courses/templatetags/my_courses.html')
def my_courses(user):
enrollments = Enrollment.objects.filter(user=user)
context = {
'enrollments':enrollments
}
return cont... | ricardogtx/estudoDjango | simplemooc/courses/templatetags/courses_tags.py | Python | gpl-3.0 | 424 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This tool creates a tarball with all the sources, but without .svn directories.
It can also remove files which are not strictl... | zcbenz/cefode-chromium | tools/export_tarball/export_tarball.py | Python | bsd-3-clause | 5,165 |
import pytest
import pandas.util.testing as tm
@pytest.fixture
def datetime_series():
"""
Fixture for Series of floats with DatetimeIndex
"""
s = tm.makeTimeSeries()
s.name = "ts"
return s
@pytest.fixture
def string_series():
"""
Fixture for Series of floats with Index of unique str... | toobaz/pandas | pandas/tests/series/conftest.py | Python | bsd-3-clause | 595 |
from PyQt4 import QtCore
from xml.dom.minidom import parseString
import re
from xml.parsers.expat import ExpatError
__author__ = 'postrowski'
# -*-coding: utf-8-*-
class Playlist(object):
"""
Class Playlist which get information and show it.
"""
def __init__(self, parent):
self.nowPla... | 19po/rtl102.5-playlist | Playlist.py | Python | mit | 6,386 |
# -*- coding: utf-8 -*-
"""
flask.cli
~~~~~~~~~
A simple command line application to run flask apps.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from threading import Lock, Thread
from functools import update_wrapper
import click
... | adrianmoisey/cptdevops | flask/cli.py | Python | bsd-3-clause | 18,141 |
#!/usr/bin/python
import json
from flask import Flask, request
from steamweb.database import db_session, init_db
from steamweb.models import *
from steamweb.game_config import initialize
from steamweb.resolver import resolve_action, get_domain
import socketio
import eventlet
import eventlet.wsgi
from flask_cors import ... | PiotrZakrzewski/steamweb | steamweb/app.py | Python | mit | 14,342 |
from functions_text import *
###### GET PLAYERS INFORMATION ######
def getNumber(minimum):
players = getInt(0, "Combien de joueurs êtes-vous ?")
while players < minimum:
print("Il faut minimum {0} joueurs...".format(minimum))
players = getInt(players, "Combien de joueurs êtes-vous?")
print... | cpvannier/western | functions.py | Python | apache-2.0 | 781 |
import ipaddress
from netbox import exceptions
class Ipam(object):
def __init__(self, netbox_con):
self.netbox_con = netbox_con
def get_choices(self, choice_id=None):
"""Return choices for all fields if choice_id is not defined
:param choice_id: Optional model:field tuple
"... | jagter/python-netbox | netbox/ipam.py | Python | apache-2.0 | 18,851 |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... | balajikris/autorest | src/generator/AutoRest.Python.Azure.Tests/AcceptanceTests/xms_request_clientid_tests.py | Python | mit | 5,206 |
from __future__ import absolute_import
from .. import models
import factory
class UserFactory(factory.django.DjangoModelFactory):
username = factory.Sequence('user-{0}'.format)
email = factory.Sequence('user-{0}@example.com'.format)
password = factory.PostGenerationMethodCall('set_password', 'password')
... | ad-m/foundation-manager | foundation/users/tests/factories.py | Python | bsd-3-clause | 410 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | sparkslabs/kamaelia_ | Sketches/MPS/BugReports/FixTests/Kamaelia/Examples/SimpleGraphicalApps/TextBox/Source_TextDisplayer_Demo.py | Python | apache-2.0 | 2,375 |
params = [int(x) for x in input().split()]
for i in range(params[0]):
line = input()
for j in line:
out = "".join([ x*params[3] for x in line ])
for j in range(params[2]):
print(out) | rvrheenen/OpenKattis | Python/skener/skener.py | Python | mit | 211 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Time-stamp: <2017-03-23 Thu 17:39:33 Shaikh>
"""
Project Euler #3: Largest Prime Factor
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of a given number N?
The following code (3.py) costs very much time when the given number N is larg... | SyrakuShaikh/python | hackerrank/project_euler/3v3.py | Python | gpl-3.0 | 1,828 |
# Copyright 2020 Noisy-FewShot-Learning Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | google-research/noisy-fewshot-learning | load_args.py | Python | apache-2.0 | 1,645 |
#!/usr/bin/python
#
# Copyright 2014 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 b... | dietrichc/streamline-ppc-reports | examples/dfp/v201403/network_service/get_current_network.py | Python | apache-2.0 | 1,335 |
"""
Book: Building RESTful Python Web Services
Chapter 2: Working with class based views and hyperlinked APIs in Django
Author: Gaston C. Hillar - Twitter.com/gastonhillar
Publisher: Packt Publishing Ltd. - http://www.packtpub.com
"""
from games.models import GameCategory
from games.models import Game
from games.models... | xianjunzhengbackup/code | http/REST/Building-RESTful-Python-Web-Services-master/Chapter 2/restful_python_chapter_02_03/gamesapi/games/views.py | Python | mit | 2,444 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_06_01/operations/_p2_svpn_gateways_operations.py | Python | mit | 43,836 |
'''
N-Queens problem
Naive approach, board stored as double N arrays with
the presence of a queen represented with a 1.
Raw action: place a queen at one of each of the squares
on the board (total of N*N at each state).
Problem olved using A* search
5/10/2015 - Olafur Bogason
MIT... | multivac61/nqueens | nqueens_square.py | Python | mit | 3,253 |
from srtools import sam, seq
import sys
from collections import Counter
def summary_statistics(reads):
"""Returns a dictionary of summary statistics of the reads. The keys are:
"rnames": a Counter of the rnames of the reads
"flags": a Counter of the bitflags of the reads
... | ahammel/srtools-sacred | srtools/stats.py | Python | bsd-3-clause | 3,696 |
#!/usr/bin/python
# must define functions before usage
def fib(n):
a, b = 0, 1
while a < n:
print(a, end=' ') # use ' ' as EOL, not '\n'
a, b = b, a+b
print()
fib(2000)
| dterei/Scraps | python/tutorial/ex7-functions.py | Python | bsd-3-clause | 185 |
# -*- coding: utf-8 -*-
import logging
import time
log = logging.getLogger(__name__)
"""
The original purpose of this runner is to verify that proceeding with an
upgrade is safe. All expected services are running.
A secondary purpose is a utility to check the current state of all services.
"""
def check(**kwargs... | supriti/DeepSea | srv/salt/_modules/cephprocesses.py | Python | gpl-3.0 | 2,124 |
# -*- coding: utf-8 -*-
from email.utils import formataddr
from .common import TestMail
from openerp.tools import mute_logger
import socket
MAIL_TEMPLATE = """Return-Path: <whatever-2a840@postmaster.twitter.com>
To: {to}
cc: {cc}
Received: by mail1.openerp.com (Postfix, from userid 10002)
id 5DF9ABFB2A; Fri, 10 ... | vileopratama/vitech | src/addons/mail/tests/test_mail_gateway.py | Python | mit | 33,252 |
import numpy as N
from tracer.surface import *
from tracer.quadric import *
from tracer.cone import *
from tracer.cylinder import *
from tracer.flat_surface import *
from tracer.assembly import *
from tracer.optics_callables import *
from tracer.object import *
from tracer.spatial_geometry import *
from tracer.sources... | casselineau/Tracer | emissive_losses/view_factors_3D.py | Python | gpl-3.0 | 28,621 |
# Copyright 2020 kubeflow.org.
#
# 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,... | kubeflow/kfserving-lts | test/e2e/batcher/test_batcher.py | Python | apache-2.0 | 3,316 |
# coding=utf-8
#
# Copyright 2016 F5 Networks 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 or a... | F5Networks/f5-common-python | f5/bigiq/cm/device/licensing/__init__.py | Python | apache-2.0 | 1,033 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | danielfrg/jupyterhub-kubernetes_spawner | kubernetes_spawner/swagger_client/models/v1_local_object_reference.py | Python | apache-2.0 | 3,216 |
import ConfigParser
import sys
from xml.dom import minidom
from credentials import Credentials
class TwitterCredentials(Credentials):
"""Defines a class which manages a set of twitter credentials. This class currently only supports the tweepy api.
"""
def __init__(self,credentialFileName=None,credentialFileForma... | oduprogrammer16/CredentialManager | src/credentials/twitter_credentials.py | Python | gpl-3.0 | 7,286 |
# Copyright (c) 2015 Mirantis 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 or agreed to in writ... | ekasitk/sahara | sahara/service/ntp_service.py | Python | apache-2.0 | 3,714 |
# coding=utf-8
__author__ = 'javon'
import sys
rdfTemplate = """<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns="http://vocab.cdmk-caribbean.net/cdmk#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns... | JA-VON/python-helpers-msbm | converter.py | Python | mit | 10,280 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | tqchen/tvm | jvm/core/src/test/scripts/test_graph_runtime.py | Python | apache-2.0 | 2,153 |
def test_is_admin_or_owner_permission(refresh_token, admin_user, mocker,
alice):
from refreshtoken.permissions import IsOwnerOrAdmin
request = mocker.Mock()
anonymous_user = mocker.Mock()
anonymous_user.is_authenticated = False
request.user = anonymous_user
... | lock8/django-rest-framework-jwt-refresh-token | tests/test_permissions.py | Python | mit | 726 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Faraday Penetration Test IDE - Community Version
Copyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/)
See the file 'doc/LICENSE' for the license information
'''
from __future__ import with_statement
from plugins import core
from model import api
import re
im... | Snifer/BurpSuite-Plugins | faraday/plugins/repo/maltego/plugin.py | Python | gpl-2.0 | 7,097 |
"""
The Interface Region Imaging Spectrometer (IRIS) instrument routines.
Currently this module only includes a simple hack to convert SJI mode files to
a `sunpy.map.MapSequence` instance.
.. note::
More comprehensive IRIS tools are now being developed in the `IRISPy
<https://github.com/sunpy/irispy>`__ affi... | dpshelio/sunpy | sunpy/instr/iris/__init__.py | Python | bsd-2-clause | 360 |
from . import *
import helpers
import random
import re
class Dataset:
"""Class to manage a simple dataset"""
def __init__(self, data):
self.raw_data = data
def random(self, data_subset=None):
choice = None
if data_subset is not None:
choice = random.sample(data_subset,1).pop()
elif self._is_list():
... | nolanbrown/bluff | bluff/dataset.py | Python | mit | 1,630 |
#-
# Copyright (c) 2011 Robert N. M. Watson
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# License... | 8l/beri | cheritest/trunk/tests/cp0/test_tgei_lt_sign.py | Python | apache-2.0 | 1,398 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019 SUNET
# 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
# noti... | SUNET/eduid-webapp | src/eduid_webapp/orcid/settings/common.py | Python | bsd-3-clause | 2,210 |
from DIRAC.WorkloadManagementSystem.Client.SandboxStoreClient import SandboxStoreClient
from WebAppDIRAC.Lib.WebHandler import WebHandler, WErr, WOK, asyncGen
from DIRAC.Core.DISET.RPCClient import RPCClient
from DIRAC import gConfig, S_OK, S_ERROR, gLogger
from DIRAC.Core.Utilities import Time
from WebAppDIRAC.WebApp... | atsareg/WebAppDIRAC | WebApp/handler/JobMonitorHandler.py | Python | gpl-3.0 | 22,096 |
# @Author: ganeshkumarm
# @Date: 2016-11-19T19:20:11+05:30
# @Last modified by: ganeshkumarm
# @Last modified time: 2016-11-19T19:20:45+05:30
#Built in modules
import os
import sys
import time
import subprocess
import datetime
import platform
from win10toast import ToastNotifier
#Used defined module
import except... | GaneshmKumar/Alertify | alertify/alertify.py | Python | mit | 3,659 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_etree_fromstring
from ..utils import (
ExtractorError,
int_or_none,
sanitized_Request,
parse_iso8601,
)
class VevoIE(InfoExtractor):
'''
Accepts urls from vevo.com or in the format... | nandhp/youtube-dl | youtube_dl/extractor/vevo.py | Python | unlicense | 12,215 |
###########################################################
#
# Copyright (c) 2012, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | CeltonMcGrath/TACTIC | src/tactic/ui/widget/ckeditor_wdg.py | Python | epl-1.0 | 4,594 |
"""
[04/01/13] Challenge #122 [Easy] Sum Them Digits
https://www.reddit.com/r/dailyprogrammer/comments/1berjh/040113_challenge_122_easy_sum_them_digits/
# [](#EasyIcon) *(Easy)*: Sum Them Digits
As a crude form of hashing function, Lars wants to sum the digits of a number. Then he wants to sum the digits of the
resul... | DayGitH/Python-Challenges | DailyProgrammer/DP20130401A.py | Python | mit | 1,338 |
#!/usr/bin/python -i
# -*- coding: utf-8 -*-
import math
# Pascal's Triangle
#
def pascal(n):
if n==0:
return [1]
else:
prev = pascal(n-1)
xs = map(lambda i: prev[i] + prev[i+1], range(len(prev)-1))
return [1] + xs + [1]
# Pascal's Triangle - another way
#
def pascal2(row, col):
... | alcarruth/fullstack-p2-tournament-results | vagrant/tournament/pascal.py | Python | gpl-2.0 | 1,027 |
#!/usr/bin/env python
# Copyright 2017 Google, 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 or... | BrandonY/python-docs-samples | video/cloud-client/shotchange/shotchange_test.py | Python | apache-2.0 | 928 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.