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 |
|---|---|---|---|---|---|
# coding: utf-8
from django.contrib.auth.models import User
from django.conf import settings
from rest_framework import exceptions
from rest_framework.authentication import BaseAuthentication, get_authorization_header
import requests
class TokenServiceAuthentication(BaseAuthentication):
"""
Token based authen... | telminov/sw-django-rest-auth | sw_rest_auth/authentication.py | Python | mit | 2,768 |
from numpy import *
def run(posmat, xyz):
'''expecting a n by 3 array as posmat and an
x,y,z to fit against
ex. x=.025;y=3.479,z=8.517;'''
if len(xyz.shape) == 1:
xyz=array([xyz])
if len(xyz.shape) == 2:
xyz=array(xyz[0])
x = xyz[0];
y = xyz[1];
z = xyz[2];
... | badbytes/pymeg | meg/closestposition.py | Python | gpl-3.0 | 786 |
class Sync(object):
def __init__(self, source_ldap, target_ldap, dry_run, logfile=None, write_sync_entries=None):
self.this_run_start_timestamp = LdapTimeStamp(datetime.now(pytz.utc))
self.targets_processed = 0
self.targets_written = 0
self.source_ldap = source_ldap
self.tar... | edushare-at/py-etd | unused/sync.py | Python | mit | 7,704 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Kylin OS, 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
#
#... | Havate/havate-openstack | proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/dashboards/admin/instances/forms.py | Python | apache-2.0 | 3,609 |
# -*- coding: utf-8 -*-
"""
HTCAP - beta 1
Author: filippo.cavallarin@wearesegment.com
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any lat... | delvelabs/htcap | core/scan/scanners/curl.py | Python | gpl-2.0 | 1,004 |
# -*- coding: utf-8 -*-
# XStreamCDN resolver for URLResolver
# Feb 22 2019
import json
from lib import helpers
from urlresolver.common import Net, RAND_UA
from urlresolver.resolver import UrlResolver, ResolverError
class XStreamCDNResolver(UrlResolver):
name = 'XStreamCDN'
domains = ['xstreamcdn.com']
... | koditr/xbmc-tr-team-turkish-addons | script.module.urlresolver/lib/urlresolver/plugins/xstreamcdn.py | Python | gpl-2.0 | 1,795 |
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
import json
import os
import shlex
import signal
import subprocess
import time
from collections import namedtuple
from operator import attrgetter
import yaml
from docker import errors
from .. import mock
from compose.cli.c... | tiry/compose | tests/acceptance/cli_test.py | Python | apache-2.0 | 52,496 |
import numpy
import chainer
from chainer import backend
from chainer import function_node
from chainer.utils import type_check
def _as_mat(x):
if x.ndim == 2:
return x
return x.reshape(len(x), -1)
def _ij_ik_il_to_jkl(a, b, c):
ab = chainer.functions.matmul(a[:, :, None], b[:, None, :]) # ijk
... | okuta/chainer | chainer/functions/connection/bilinear.py | Python | mit | 9,015 |
# Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | vishnu-kumar/ec2-api | ec2api/tests/functional/api/test_routes.py | Python | apache-2.0 | 13,671 |
#!/usr/bin/python
#
# Copyright (C) 2006 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 ... | arsfeld/conduit | conduit/modules/GoogleModule/gdata/youtube/__init__.py | Python | gpl-2.0 | 23,051 |
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
'''
Insights Forex live source
--------------------------
:copyright (c) 2014 Xavier Bruhiere
:license: Apache 2.0, see LICENSE for more details.
'''
import time
import pandas as pd
import dna.logging
import intuition.data.forex as forex
log = dna.logging.logger(__n... | intuition-io/insights | insights/sources/live/currencies.py | Python | apache-2.0 | 1,793 |
from data_importers.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "RUH"
addresses_name = "2021-03-25T09:29:47.041150/Rushmoor Democracy_Club__06May2021.tsv"
stations_name = "2021-03-25T09:29:47.041150/Rushmoor Democracy_Club__... | DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_importers/management/commands/import_rushmoor.py | Python | bsd-3-clause | 391 |
def outer(x):
outer_val = x * 2
inner(outer_val)
pass
def inner(y):
inner_val = y * 5
innermost(inner_val)
pass
def innermost(z):
innermost_val = z + 1
pass
global_val = 5
outer(5)
| MetSystem/PTVS | Python/Tests/TestData/DebuggerProject/DebugReplTest2.py | Python | apache-2.0 | 232 |
import half_integer_grid as hig
import level_lines as ll
import match_tjoints as mt
import propagation as pp
import rectangular_region as rr
import region_intersection as ri
import tjoints as tj
img_gradient = "img/gradient.png"
img_lena = "img/lena_256.png"
| danoan/image-processing | packages/improc/inpainting/all.py | Python | mit | 266 |
#!/usr/bin/env python
# coding=utf-8
"""
Instructions:
.. code-block:: shell
$ make install
$ python examples/development_basics.py
Demonstrates requests are made once per unique arguments.
Sample output below.
"""
import logging
from cache_requests import Session
# setup log (used internally)
format_ =... | bionikspoon/cache_requests | examples/development_basics.py | Python | mit | 3,206 |
from django import forms
from django.contrib import admin
from django.core.exceptions import ValidationError
from mobile_framework.version.models import Version, AppVersion
class AppVersionAdminForm(forms.ModelForm):
version = forms.CharField()
class Meta:
model = AppVersion
fields = ('versi... | mstarinteractive/django-mobile-framework | mobile_framework/version/admin.py | Python | mit | 1,369 |
# -*- coding: utf-8 -*-
###############################################################################
#
# CreateServerXMLInput
# Creates a RightScale server instance using a given XML template.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "... | willprice/arduino-sphere-project | scripts/example_direction_finder/temboo/Library/RightScale/CreateServerXMLInput.py | Python | gpl-2.0 | 8,025 |
from typing import Any, Dict, List, Optional, Union
from typing import TYPE_CHECKING
from pynamodb.constants import (
ATTRIBUTE_TYPES, BINARY_SET, LIST, MAP, NUMBER, NUMBER_SET, STRING, STRING_SET
)
from pynamodb.expressions.condition import (
BeginsWith, Between, Comparison, Contains, Exists, In, IsType, NotE... | jlafon/PynamoDB | pynamodb/expressions/operand.py | Python | mit | 13,382 |
import time
import serial
from interp import Interp
ser = serial.Serial("/dev/ttyAMA0", 115200)
print "Reading from Teensy"
while True:
out = ''
try:
n = ser.inWaiting()
if n > 0:
out = ser.read()
except:
print "Could not read"
if out != '' and out != '\n':
... | n8many/Pixel-Interpreter-Framework | lightswitch.py | Python | gpl-2.0 | 628 |
"""Trust Region Reflective algorithm for least-squares optimization.
The algorithm is based on ideas from paper [STIR]_. The main idea is to
account for presence of the bounds by appropriate scaling of the variables (or
equivalently changing a trust-region shape). Let's introduce a vector v:
| ub[i] - x[i]... | lhilt/scipy | scipy/optimize/_lsq/trf.py | Python | bsd-3-clause | 19,749 |
from __future__ import absolute_import
from django.contrib.admin import widgets as admin_widgets
from django.contrib.staticfiles.storage import staticfiles_storage
from django.forms.utils import flatatt
from django.template.loader import get_template
from django.utils.encoding import force_unicode
from django.utils.ht... | Phoenix1369/site | judge/widgets/pagedown.py | Python | agpl-3.0 | 4,361 |
import re
def First_Part(ids):
two = 0
three = 0
for ID in ids:
if any(ID.count(i) == 2 for i in ID):
two += 1
if any(ID.count(i) == 3 for i in ID):
three += 1
return two * three
Input = open("Inputs/Day_02.txt", "r").read().split('\n')[:-1]
print(First_Part(In... | ImpregnableProgrammer/Advent-of-Code | 2018/Day_02.py | Python | gpl-3.0 | 624 |
#!/usr/bin/env python
import sys
import os
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QApplication, QTreeWidget, QTreeWidgetItem, QMenu
from ui.rep_output import Ui_RepOutput
from output_parser import RepertoireOutput
import config
class RepOutput(QtGui.QMainWindow):
def __init__(self, rep_out_path, ... | ChongTang/CloneDetection | Repertoire/display_rep.py | Python | mit | 3,335 |
from __future__ import print_function
import sys
import numpy as np
from ase import Atoms
from ase.io import write, read
from ase.calculators.singlepoint import SinglePointCalculator
a = 5.0
d = 1.9
c = a / 2
atoms = Atoms('AuH',
positions=[(c, c, 0), (c, c, d)],
cell=(a, a, 2 * d),
... | suttond/MODOI | ase/test/fio/oi.py | Python | lgpl-3.0 | 3,087 |
# 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... | Huyuwei/tvm | tests/python/relay/test_cmp_op.py | Python | apache-2.0 | 1,161 |
from neurovault.apps.statmaps.forms import StatisticMapForm, AtlasForm, NIDMResultsForm
from neurovault.apps.statmaps.models import Collection, Image
from django.core.files.uploadedfile import SimpleUploadedFile
from neurovault.settings import PRIVATE_MEDIA_ROOT
import shutil
import os
def clearDB():
Image.object... | burnash/NeuroVault | neurovault/apps/statmaps/tests/utils.py | Python | mit | 2,856 |
## 2.2.6 Particle
import random
from deap import base
from deap import creator
from deap import tools
creator.create("FitnessMax", base.Fitness, weights=(1.0, 1.0))
creator.create("Particle", list, fitness=creator.FitnessMax, speed=None,
smin=None, smax=None, best=None)
def initParticle(pcls, size, pm... | marcioweck/PSSLib | reference/deap/doc/code/tutorials/part_2/2_2_5_particle.py | Python | lgpl-3.0 | 681 |
"""
Wrapper class for `PolicyGradient`.
"""
from __future__ import absolute_import, division
import imp
import os
import sys
from . import configs
from .performance import Performance2AFC
from .policygradient import PolicyGradient
class Struct():
"""
Treat a dictionary like a module.
"... | frsong/pyrl | pyrl/model.py | Python | mit | 3,821 |
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
import configparser
from UM.Signal import Signal, signalemitter
from UM.Logger import Logger
from UM.MimeTypeDatabase import MimeTypeDatabase, MimeType #To register the MIME type of the preference file.
from UM.SaveFile... | thopiekar/Uranium | UM/Preferences.py | Python | lgpl-3.0 | 8,239 |
import unittest
from http import HTTPStatus
from abstract_test_case import AbstractTestCase
from cloudfoundry_client.v3.entities import Entity
class TestServiceOfferings(unittest.TestCase, AbstractTestCase):
@classmethod
def setUpClass(cls):
cls.mock_client_class()
def setUp(self):
self.... | antechrestos/cf-python-client | test/v3/test_service_offerings.py | Python | apache-2.0 | 2,606 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... | ubiar/odoo | addons/anonymization/anonymization.py | Python | agpl-3.0 | 28,690 |
from setuptools import setup, find_packages
setup(
name='yandextank',
version='1.12.7',
description='a performance measurement tool',
longer_description='''
Yandex.Tank is a performance measurement and load testing automatization tool.
It uses other load generators such as JMeter, ab or phantom inside ... | fomars/yandex-tank | setup.py | Python | lgpl-2.1 | 3,327 |
#!/usr/bin/env python
__author__ = 'greg'
from aggregation_api import AggregationAPI,InvalidMarking
import agglomerative
import clustering
import math
import pandas as pd
import numpy as np
from scipy.spatial.distance import pdist,squareform
from scipy.cluster.hierarchy import linkage
import abc
import re
import random... | camallen/aggregation | engine/tate.py | Python | apache-2.0 | 25,413 |
# Jan Huiskes
# 10740929
import csv
import json
import sys
reload(sys)
sys.setdefaultencoding('utf8')
jsonfile = open('data.json', 'w')
csvfile3 = open('data.csv', 'r')
def p2f(x):
return float(x.strip('%'))
jsonfile.write('{"data" : {')
jsonfile.write('\n')
i = 0
for row in csvfile3:
row = row.split()
... | jan-huiskes/Project | data/csv2json.py | Python | gpl-3.0 | 1,876 |
from datetime import timedelta
import numpy as np
import pytest
from pandas.errors import UnsupportedFunctionCall
import pandas.util._test_decorators as td
import pandas as pd
from pandas import DataFrame, Series
import pandas.core.window as rwindow
from pandas.tests.window.common import Base
import pandas.util.test... | toobaz/pandas | pandas/tests/window/test_rolling.py | Python | bsd-3-clause | 12,288 |
#
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
#
# 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; version 2 of the License.
#
# This program is distributed in th... | scavarda/mysql-dbcompare | mysql-utilities-1.6.0/mysql/utilities/common/server.py | Python | apache-2.0 | 80,854 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operatio... | tobiasgoecke/django-messages | django_messages/migrations/0001_initial.py | Python | bsd-3-clause | 2,049 |
"""
Support for Vera scenes.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/scene.vera/
"""
import logging
from homeassistant.util import slugify
from homeassistant.components.scene import Scene
from homeassistant.components.vera import (
VERA_CONTR... | PetePriority/home-assistant | homeassistant/components/vera/scene.py | Python | apache-2.0 | 1,559 |
import os
import shutil
BASE_FOLDER = os.path.dirname(os.path.abspath(__file__).replace('.pyc', '.py'))
def install(dst_folder):
target_folder = os.path.join(dst_folder, 'Base')
sup_folder = os.path.abspath(os.path.join(BASE_FOLDER, 'assets', 'src', 'IMC', 'Base'))
# Running from source tree.
prin... | oceanscan/imctrans | imctrans/cpp/base.py | Python | apache-2.0 | 560 |
# -*- coding: utf-8 -*-
# *****************************************************************************
#
# 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... | alenz33/ippchef_tgbot | ippchef/util.py | Python | gpl-2.0 | 1,316 |
from mediawords.util.config import env_value
class CLIFFTagsFromAnnotationConfig(object):
"""CLIFF tagger configuration."""
@staticmethod
def version_tag() -> str:
"""CLIFF version tag, e.g. "cliff_clavin_v2.6.1"."""
return env_value('MC_CLIFF_VERSION_TAG')
@staticmethod
def geon... | berkmancenter/mediacloud | apps/cliff-fetch-annotation-and-tag/src/python/cliff_fetch_annotation_and_tag/config.py | Python | agpl-3.0 | 1,300 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# 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 the Free Software Foundation, either version 3 of the
# Li... | RamonGuiuGou/l10n-spain | l10n_es_aeat_mod216/models/res_partner.py | Python | agpl-3.0 | 1,074 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2005 Donald N. Allingham
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2008 Peter Landgren
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012,2017 Paul Franklin
# Copyright (C) 2014 Nick Hall
#
# This program... | jralls/gramps | gramps/gui/plug/report/_styleeditor.py | Python | gpl-2.0 | 23,885 |
from __future__ import absolute_import, unicode_literals
from django.core.management.base import BaseCommand
from django_comments.models import Comment
class Command(BaseCommand):
"Remove the given string from the comments"
def add_arguments(self, parser):
parser.add_argument('string', type=str)
... | praekelt/molo-gem | gem/management/commands/remove_placeholder_text_from_comments.py | Python | bsd-2-clause | 629 |
class Holder:
def __init__(self, x):
self.x = x
def get(self):
return self.x | siosio/intellij-community | python/testData/pyi/type/genericClassDefinitionInOtherFile/other.py | Python | apache-2.0 | 101 |
# read_hadamard_file.py
# Reads data from a text file to create a 3D
# version of a given Hadamard Matrix.
# Created by Rick Henderson
# Created on June 4, 2015
# Completed June 5, 2015
# Note: A "Hadamard File" is a text file containing rows
# rows of + and - where the + indicates a 1 or a cube
# and th... | rickhenderson/code-samples | python-blender/read_hadamard_file.py | Python | gpl-3.0 | 1,503 |
# -*- coding: utf-8 -*-
"""
Topic Models (e.g. LDA) visualization using D3
=============================================
Functions: General Use
----------------------
:func:`prepare`
transform and prepare a LDA model's data for visualization
:func:`prepared_data_to_html`
convert prepared data to an html strin... | codingafuture/pyLDAvis | pyLDAvis/__init__.py | Python | bsd-3-clause | 1,167 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from future.builtins import bytes, open
from csv import writer
from mimetypes import guess_type
from os.path import join
from datetime import datetime
from io import BytesIO, StringIO
from json import loads
from django.conf.urls import patterns, url
fro... | Afnarel/django-forms-builder | forms_builder/forms/admin.py | Python | bsd-2-clause | 11,528 |
# maths_fermat_brute_force.py written by Duncan Murray 8/11/2014
import os
import sys
from random import randint
sys.path.append('..')
import aikif.config as mod_cfg
import aikif.cls_log as mod_log
def main():
"""
Example of logging the success of a Brute force using AIKIF.
This uses http://en.wikipedi... | acutesoftware/AIKIF | aikif/.z_prototype/maths_fermat_brute_force.py | Python | gpl-3.0 | 4,464 |
import numpy as np
a = np.array([1, 2, 3], dtype=np.int64)
print(a.dtype)
# int64
a = np.array([1, 2, 3], dtype='int64')
print(a.dtype)
# int64
a = np.array([1, 2, 3], dtype='i8')
print(a.dtype)
# int64
print(int is np.int)
# True
a = np.array([1, 2, 3], dtype=int)
print(a.dtype)
# int64
a = np.array([1, 2, 3], d... | nkmk/python-snippets | notebook/numpy_dtype.py | Python | mit | 1,154 |
# The MIT License (MIT)
# Copyright (c) 2014-2017 University of Bristol
#
# 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 us... | IRC-SPHERE/HyperStream | hyperstream/tools/stream_broadcaster_from_stream/2016-11-10_v0.0.1.py | Python | mit | 3,206 |
from ..base import Event
class UpdateCheckFinishedEvent(Event):
def __init__(self, updates):
self.__updates = updates
@property
def updates(self):
return self.__updates
| umlfri/umlfri2 | umlfri2/application/events/application/updatecheckfinished.py | Python | gpl-3.0 | 204 |
"""
============
Array basics
============
Array types and conversions between types
=========================================
NumPy supports a much greater variety of numerical types than Python does.
This section shows which are available, and how to modify an array's data-type.
============ ======================... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/numpy/doc/basics.py | Python | bsd-2-clause | 7,900 |
# 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... | apache/airflow | tests/charts/test_statsd.py | Python | apache-2.0 | 4,837 |
from __future__ import unicode_literals
from django import template
from temba.channels.views import get_channel_icon
register = template.Library()
@register.filter
def channel_icon(channel):
return get_channel_icon(channel.channel_type)
| praekelt/rapidpro | temba/channels/templatetags/channels.py | Python | agpl-3.0 | 246 |
# Copyright 2016, 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 retain the above copyright
# notice, this list of conditions and the f... | ppietrasa/grpc | src/python/grpcio_tests/tests/unit/_rpc_test.py | Python | bsd-3-clause | 32,015 |
from keras import models, layers, optimizers
from keras.preprocessing.image import img_to_array
from imutils import paths
import cv2
import os
import numpy as np
from sklearn.model_selection import train_test_split
from keras.utils import to_categorical
from keras.preprocessing.image import ImageDataGenerator
# import ... | vivaxy/course | libraries/kerasjs/training/train.py | Python | mit | 2,603 |
import logging
from urllib.parse import unquote
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.views.generic import ListView, RedirectView, TemplateView
from rest_framework import status
from rest_framework.authentication import Se... | delving/nave | nave/void/views.py | Python | gpl-2.0 | 12,274 |
#!/usr/bin/python2.4
# -*- coding: utf-8 -*-
""" Logging setup.
Copyright (c) Karol Będkowski, 2013
This file is part of wxGTD
Licence: GPLv2+
"""
__author__ = "Karol Będkowski"
__copyright__ = "Copyright (c) Karol Będkowski, 2013"
__version__ = "2013-04-27"
import sys
import os.path
import logging
import tempfile
im... | KarolBedkowski/wxgtd | wxgtd/lib/logging_setup.py | Python | gpl-2.0 | 2,318 |
class BasePiece:
job = None
def __init__(self, color, identifier=None):
self.color = color
self.identifier = identifier
def __str__(self):
return self.color + "_" + self.job
def hash(self):
str_representation = str(self)
if self.identifier is None:
... | pablo-meier/screamchess | src/chess/models.py | Python | mit | 9,838 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.db.models import Q
from django.conf import settings
from django.http import HttpResponse
from django.test import TestCase, override_settings
from django.utils.timezone import now as timezone_now
from zerver.lib import bugdown
from zerver.decorat... | SmartPeople/zulip | zerver/tests/test_messages.py | Python | apache-2.0 | 86,949 |
# -*- coding: utf-8 -*-
# pylint: disable=C0111
from micropython import const
# Error Codes as specified by the specification
# according to the spec the error codes range
# from 0x00 to 0x3F
# Standard error codes
# See Core v 4.1, Vol. 2, part D.
ERR_CMD_SUCCESS = const(0x00)
BLE_STATUS_SUCCESS = const(0x00)
ERR_... | dmazzella/uble | bluetooth_low_energy/protocols/hci/status.py | Python | mit | 1,241 |
# Source: https://github.com/Xangis/extra-stopwords (MIT License)
STOP_WORDS = set(
"""
అందరూ
అందుబాటులో
అడగండి
అడగడం
అడ్డంగా
అనుగుణంగా
అనుమతించు
అనుమతిస్తుంది
అయితే
ఇప్పటికే
ఉన్నారు
ఎక్కడైనా
ఎప్పుడు
ఎవరైనా
ఎవరో ఒకరు
ఏ
ఏదైనా
ఏమైనప్పటికి
ఏమైనప్పటికి
ఒక
ఒక ప్రక్కన
కనిపిస్తాయి
కాదు
కాదు
కూడా
గా
గురించి
చుట్టూ
చేయగలిగ... | spacy-io/spaCy | spacy/lang/te/stop_words.py | Python | mit | 1,107 |
import uuid
import json
from .models import TelepatContext, TelepatUser, TelepatBaseObject
from telepat import httpmanager
from .response import TelepatResponse
from .transportnotification import *
class TelepatChannel:
context = None
user = None
model_name = ""
object_type = None
parent_model_nam... | ov1d1u/telepat-python | channel.py | Python | apache-2.0 | 6,090 |
from twisted.words.protocols.irc import ERR_NEEDMOREPARAMS, ERR_NOSUCHCHANNEL, ERR_BADCHANNELKEY
class Command(object):
"""
The MODE command is provided so that users may query and change the
characteristics of a channel. For more details on available modes
and their uses, see "Internet Relay Chat: C... | kevelbreh/betternet | betternet/command/mode.py | Python | apache-2.0 | 4,030 |
from django.conf.urls import url
from django.conf.urls.i18n import i18n_patterns
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
view = TemplateView.as_view(template_name='dummy.html')
urlpatterns = i18n_patterns('',
url(_(r'^register/$'), view, name='registe... | openhatch/new-mini-tasks | vendor/packages/Django/tests/regressiontests/i18n/patterns/urls/wrong_namespace.py | Python | apache-2.0 | 327 |
"""."""
l1 = [1, 2, 3, 4]
l2 = [11, 22, 33, 44]
print(zip(l1, l2))
| mayank-johri/LearnSeleniumUsingPython | Section 1 - Core Python/Chapter 05 - Data Types/code/zip_1.py | Python | gpl-3.0 | 70 |
"""Tests for per-course verification status on the dashboard. """
import unittest
from datetime import datetime, timedelta
import ddt
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import override_settings
from mock import patch
from nose.plugins.attrib import attr
from ... | Lektorium-LLC/edx-platform | common/djangoapps/student/tests/test_verification_status.py | Python | agpl-3.0 | 16,804 |
#!/usr/bin/env python
import datetime
import json
import unittest
from unittest.mock import MagicMock, PropertyMock, patch
from data.variable import Variable
from data.variable_list import VariableList
from oceannavigator import DatasetConfig, create_app
app = create_app(testing=True)
# Note that patches are applie... | DFO-Ocean-Navigator/Ocean-Data-Map-Project | tests/test_api_v_1_0.py | Python | gpl-3.0 | 26,272 |
from argparse import Action
from flexget.options import ArgumentParser
def test_subparser_nested_namespace():
p = ArgumentParser()
p.add_argument('--outer')
p.add_subparsers(nested_namespaces=True)
sub = p.add_subparser('sub')
sub.add_argument('--inner')
sub.add_subparsers()
subsub = sub.... | Flexget/Flexget | flexget/tests/test_argparse.py | Python | mit | 2,272 |
#!/usr/bin/env python
"""
Serves the files in current directorys by using Python's SimpleHTTPServer.
https://github.com/caglartoklu/servhere
When starting serving, it will copy the URL to clipboard,
so that it can be easily distributed in internal network.
Please see:
servhere.py --help
"""
import os
import pla... | caglartoklu/servhere | servhere.py | Python | bsd-2-clause | 6,525 |
#!/usr/bin/env python
# Implements daemon class to poll network stats more frequently than cron
# Daemon from http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
# Found via http://stackoverflow.com/questions/16420092/how-to-make-python-script-run-as-service
import sys, os, inspect, time, subpr... | arobb/charlotte | bin/stats_daemon.py | Python | mit | 3,186 |
from __future__ import absolute_import
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.config import ConfigSubsection, ConfigSelection, getConfigListEntry
from Components.SystemInfo import SystemInfo
from Components.Task import job_manager
from Screens.InfoBarGeneric... | atvcaptain/enigma2 | lib/python/Screens/TaskView.py | Python | gpl-2.0 | 5,728 |
"""
.. note:: This module is mainly for internal use.
Pty implements a terminal abstraction. This can be around the default stdin/out
pair, but also around a pseudo terminal that was created through the
``openpty`` system call.
"""
import StringIO
import array
import fcntl
import os
import select as _select
import sy... | jonathanslenders/python-deployer | deployer/pseudo_terminal.py | Python | bsd-2-clause | 6,523 |
__author__ = 'djw'
class FieldNodeItem(object):
"""
An item built on a player's field board, held within a node/cell on that board
"""
def __init__(self):
self.cattle = 0
self.boars = 0
self.sheep = 0
self.grain = 0
self.vegetables = 0
def update_animals(s... | sourlows/pyagricola | src/field/node_item.py | Python | mit | 3,158 |
# -*- coding: utf-8 -*-
__author__ = 'Danyang'
class Solution(object):
def solve(self, cipher):
"""
main solution function
:param cipher: the cipher
"""
if __name__=="__main__":
import sys
f = open("0.in", "r")
# f = sys.stdin
solution = Solution()... | ee08b397/HackerRankAlgorithms | template.py | Python | apache-2.0 | 570 |
# Copyright 2009 One Laptop Per Child
# Author: Sayamindu Dasgupta <sayamindu@laptop.org>
#
# 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)... | activitycentral/ebookreader | src/ReadTab/epubview/jobs.py | Python | gpl-2.0 | 9,227 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
import re
import os
import sys
name = 'django-drip'
package = 'drip'
description = 'Simple drip campaigns for Django.'
url = 'https://github.com/zapier/django-drip'
author = 'Bryan Helmig'
author_email = 'bryan@zapier.com'
license = 'MIT'
ins... | cloudControl/django-drip | setup.py | Python | mit | 2,759 |
from setuptools import setup, find_packages, os
import json
with open('package.json') as packageFile:
version = json.load(packageFile)['version']
setup(
name="jasmine-core",
version=version,
url="http://pivotal.github.io/jasmine/",
author="Pivotal Labs",
author_email="jasmine-js@googlegroups.com... | vendavo/yowie | yowie-web/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/setup.py | Python | mit | 1,983 |
import os
import subprocess
# This is an example for using Kataja to launch a visualisation from a python script that doesn't use kataja
# structures, but can output bracket trees. Kataja is launched as a separate process so it doesn't stop the
# main script.
def send_to_kataja(tree, image_file=''):
# return os... | jpurma/Kataja | kataja/runner.py | Python | gpl-3.0 | 1,380 |
import matplotlib.pyplot as plt
import numpy as np
from phuzzy.mpl import TruncNorm
def test_truncnorm():
alpha0 = [0, 2]
# alpha1 = [2]
p = TruncNorm(alpha0=alpha0, alpha1=None, number_of_alpha_levels=7)
print(p)
print(p.df)
print(p.df.values.tolist())
ref = [[0.0, 0.0, 2.0], [0.1666666... | lepy/phuzzy | tests/test_truncnorm.py | Python | mit | 885 |
#!/usr/bin/env python
"""
Copyright 2015 Brocade Communications Systems, 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 applicab... | BRCDcomm/pynos | tests/versions/base/test_services.py | Python | apache-2.0 | 3,821 |
from coalib.bears.requirements.PackageRequirement import PackageRequirement
from coalib.misc.Shell import call_without_output
from coala_utils.string_processing import escape
class JuliaRequirement(PackageRequirement):
"""
This class is a subclass of ``PackageRequirement``. It specifies the proper
type f... | sils1297/coala | coalib/bears/requirements/JuliaRequirement.py | Python | agpl-3.0 | 1,637 |
from Components.Converter.Converter import Converter
from enigma import iServiceInformation, iPlayableService
from Components.Element import cached
from os import path
WIDESCREEN = [1, 3, 4, 7, 8, 0xB, 0xC, 0xF, 0x10]
class ServiceInfo(Converter, object):
HAS_TELETEXT = 1
IS_MULTICHANNEL = 2
AUDIO_STEREO = 3
IS_... | wetek-enigma/enigma2 | lib/python/Components/Converter/ServiceInfo.py | Python | gpl-2.0 | 10,419 |
# Copyright 2020, 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 retain the above copyright
# notice, this list of conditions and the f... | endlessm/chromium-browser | third_party/pywebsocket3/src/mod_pywebsocket/request_handler.py | Python | bsd-3-clause | 12,201 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# 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
#... | thaim/ansible | lib/ansible/modules/cloud/ovirt/ovirt_cluster_info.py | Python | mit | 4,126 |
from __future__ import absolute_import
import logging
import time
from datetime import datetime, timedelta
import six
from django.conf import settings
from django.utils.http import urlquote
from django.views.decorators.csrf import csrf_exempt
from enum import Enum
from pytz import utc
from rest_framework.authenticati... | zenefits/sentry | src/sentry/api/base.py | Python | bsd-3-clause | 8,859 |
#
# compssort.py
#
# Copyright (C) 2005, 2006, 2007 Red Hat, Inc. All rights reserved.
#
# 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) ... | mattias-ohlsson/anaconda | pyanaconda/compssort.py | Python | gpl-2.0 | 2,093 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/nitroml | nitroml/automl/autodata/__init__.py | Python | apache-2.0 | 1,010 |
# 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):
# Adding model 'Map'
db.create_table('race_map', (
('id', self.gf('django.db.models.fields.Aut... | SushiTee/teerace | teerace/race/south_migrations/0001_initial.py | Python | bsd-3-clause | 14,421 |
import os.path
import textwrap
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
define("port", default=8000, help="run on the given port", type=int)
# class ReverseHandler(tornado.web.RequestHandler):
# def get(self, input):
# ... | chen2aaron/SnirteneCodes | TornadoPra/Hello/hello1.py | Python | gpl-2.0 | 2,037 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted ... | DoubleNegativeVisualEffects/gaffer | python/GafferUI/NodeSetEditor.py | Python | bsd-3-clause | 7,924 |
#-*- coding=utf-8 -*-
#author: zhihua.ye@spreadtrum.com
from config import config
from helper.avcevent import *
from helper.mediaevent import *
MEDIANAME="Media"
AVCNAME="SPRDAVC"
class Process():
def __init__(self, name='', key='', pidlist=None, pevent=None):
self.name = name
self.k... | deevarvar/myLab | sprd/vowifi/mengine_parser/helper/processmap.py | Python | mit | 1,388 |
#!/usr/bin/python
from fvregress import *
import sys
import xmlrpclib
import re
# start up a flowvisor with 1 switch (default) and two guests
#h= HyperTest(guests=[('localhost',54321),('localhost',54322)],
# hyperargs=["-v0", "-a", "flowvisor-conf.d-base", "ptcp:%d"% HyperTest.OFPORT],valgrind=valgrindArgs)
def... | routeflow/AutomaticConfigurationRouteFlow | FLOWVISOR/regress/tests-api.py | Python | apache-2.0 | 10,593 |
# Outspline - A highly modular and extensible outliner.
# Copyright (C) 2011 Dario Giovannetti <dev@dariogiovannetti.net>
#
# This file is part of Outspline.
#
# Outspline 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 F... | kynikos/outspline | src/outspline/info/plugins/wxscheduler_basicrules.py | Python | gpl-3.0 | 1,173 |
# -*- coding: utf-8 -*-
import re
import time
from config import core
from irc.connection import servers as base
class irc_schedule:
def __init__(self, db_name):
self.db_name = db_name
self.jobs = core.obtconfig(self.db_name)
if not self.jobs:
self.jobs = {}
core... | IsmaelRLG/UserBot | sysb/schedule.py | Python | mit | 3,491 |
__author__ = 'Brian Hicks'
__email__ = 'brian@brianthicks.com'
__version__ = '0.1.1'
from .tinyobj import TinyObj # noqa
| BrianHicks/tinyobj | tinyobj/__init__.py | Python | mit | 123 |
"""
fileName: testing.py
Authors: Jacob Krantz
Date Modified: 3/14/17
Contains classes for testing the performance of Syllabifiers.
- CompareNIST
* compare
* viewDifferences
"""
from __future__ import print_function
# from utils import SyllabParser
class CompareNIST:
def __init__(self):
... | jacobkrantz/ProbSyllabifier | nist/testing.py | Python | mit | 4,197 |
import os
import sys
import json
import signal
import argparse
from fable.back.interpreter import Interpreter
from fable.back.repl_proto import Events, encode, decode
from fable.logs import log
_log = log('repl')
class IO:
def __init__(self, inp, out):
self.inp = inp
self.out = out
def write... | yrapop01/fable | legacy/back/repl.py | Python | mit | 2,815 |
from django.contrib import messages
from django.contrib.auth import login as auth_login, logout as auth_logout, update_session_auth_hash
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseRedirect
from django.shortcuts ... | Alphalink/netbox | netbox/users/views.py | Python | apache-2.0 | 7,255 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.