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 |
|---|---|---|---|---|---|
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | rangadi/beam | sdks/python/apache_beam/runners/portability/fn_api_runner.py | Python | apache-2.0 | 68,611 |
from __future__ import absolute_import
import autograd.numpy.numpy_grads as npg
import autograd.numpy as anp
from autograd.core import getval
from builtins import range
# ----- Functions that are constant w.r.t. continuous inputs -----
anp.nan_to_num.defjvp(lambda g, ans, gvs, vs, x: anp.where(anp.isfinite(x), g, 0.)... | BB-UCL/autograd-forward | autograd_forward/numpy/numpy_grads.py | Python | mit | 13,433 |
# better_button.py
# A simple Button widget, based on Zelle's textbook Button widget
# but changed to be more consistent with Zelle's own graphics library!
from graphics import *
class Button:
"""A button is a labeled rectangle in a window.
It is activated or deactivated with the activate()
and deac... | LirenFish/EasyRegistration | better_button.py | Python | gpl-2.0 | 2,648 |
# PYGTKMVC Predicate contribution
# Copyright (C) 2011 Tobias Weber
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later v... | roboogle/gtkmvc3 | gtkmvco/examples/treeview/predicates.py | Python | lgpl-2.1 | 1,485 |
#
# Copyright (C) 2001 Andrew T. Csillag <drew_csillag@geocities.com>
#
# You may distribute under the terms of either the GNU General
# Public License or the SkunkWeb License, as specified in the
# README file.
#
import time
class Timer:
def __init__(self):
self.time=time.time()
... | drewcsillag/skunkweb | pylibs/DT/timer.py | Python | gpl-2.0 | 737 |
#!/usr/bin/python
"""
H.265 video codec.
Copyright (c) 2014 struktur AG, Joachim Bauch <bauch@struktur.de>
This file is part of libde265.
libde265 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... | tejainece/bypass_dec_tstgen | scripts/decodestreams.py | Python | gpl-3.0 | 3,688 |
# -*- coding: utf-8 -*-
import sys
from os.path import join, dirname
from setuptools import setup, find_packages
VERSION = (2, 1, 0)
__version__ = VERSION
__versionstr__ = '.'.join(map(str, VERSION))
f = open(join(dirname(__file__), 'README'))
long_description = f.read().strip()
f.close()
install_requires = [
's... | REVLWorld/elasticsearch-dsl-py | setup.py | Python | apache-2.0 | 1,886 |
# coding: utf-8
from __future__ import unicode_literals, division
"""
This module implements basic kinds of jobs for Nwchem runs.
"""
__author__ = "Shyue Ping Ong"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "ongsp@ucsd.edu"
__status__ = "Beta"
__date__ = "5/20/13"
import subprocess
import s... | alberthxf/custodian | custodian/nwchem/jobs.py | Python | mit | 2,294 |
import codecs
import os
import re
import json
from . import WIKI_DIR
from collections import defaultdict
def _get_filename(slug):
return os.path.join(WIKI_DIR, '%s.md' % (slug,))
class Index(object):
def __init__(self):
self.texts, self.words = {}, set()
self.finvindex = defaultdict(set)
... | apruden/genwiki | genwiki/model.py | Python | lgpl-3.0 | 5,404 |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# 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 applicabl... | openstack/tempest | tempest/api/object_storage/test_object_formpost.py | Python | apache-2.0 | 4,607 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-23 19:08
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('birthday', '0003_apisession'),
]
operations = [
migrations.RenameModel(
ol... | AlexKopen/Notification-System | src/birthday/migrations/0004_auto_20151223_1308.py | Python | mit | 390 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin.mock/packages/cmake/package.py | Python | lgpl-2.1 | 2,636 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""Top-level script for app_template.
"""
# Import standard packages.
import argparse
import inspect
import logging
import os
import sys
import tempfile
import time
# Import installed packages.
# Import local packages as top-level script.
sys.path.inser... | stharrold/demo | demo/app_template/main.py | Python | mit | 4,093 |
import hashlib
from django.core.management.base import LabelCommand
from corehq.apps.sms.models import MessageLogOld, MessageLog
class Command(LabelCommand):
help = "Migrates old django-based sms message log model of 2010 to new couch based model of Nov. 2011."
args = ""
label = ""
def handle(self, *l... | gmimano/commcaretest | corehq/apps/sms/management/commands/migrate_message_log.py | Python | bsd-3-clause | 1,685 |
import os
import re
import cmd
import sys
import time
import util
host = sys.argv[1]
cmd.run ("virsh shutdown %s"%(host))
while util.vm_is_running(host):
time.sleep(1)
| alobbs/qvm | qvm/qvm-stop.py | Python | apache-2.0 | 171 |
# -*- encoding: utf-8 -*-
from datetime import datetime
import time
from osv import fields,osv
import xmlrpclib
import xlrd
class aps(osv.osv):
_name='aps'
_description='APS'
def _get_silk(self,cr,uid,context=None):
obj=self.pool.get('select.selection')
ids=obj.search(cr,uid,[('type','=','silk_colour')],c... | alangwansui/mtl_ordercenter | openerp/addons/001_aps/aps.py | Python | agpl-3.0 | 5,466 |
class Solution:
def minFlipsMonoIncr(self, S):
"""
:type S: str
:rtype: int
"""
one_cnt = 0
for s in S:
if s == '1':
one_cnt += 1
ans = one_cnt
zero_cnt = 0
for s in S[::-1]:
if s == '0':
... | YiqunPeng/Leetcode-pyq | solutions/926FlipStringToMonotoneIncreasing.py | Python | gpl-3.0 | 459 |
"""Implement an API wrapper around Ikea Tradfri."""
from .error import (
PyTradFriError, RequestError, ClientError, ServerError, RequestTimeout)
from .gateway import Gateway
__all__ = ['Gateway', 'PyTradFriError', 'RequestError', 'ClientError',
'ServerError', 'RequestTimeout']
| r41d/pytradfri | pytradfri/__init__.py | Python | mit | 295 |
import itertools
import os
from distutils.spawn import find_executable
import mdtraj as md
import numpy as np
import pytest
from mdtraj.geometry.dihedral import (compute_chi1, compute_chi2, compute_chi3,
compute_chi4, compute_omega, compute_phi,
... | dwhswenson/mdtraj | tests/test_dihedral.py | Python | lgpl-2.1 | 6,980 |
import threading
import Queue
import statvent
jobs = Queue.Queue()
done = Queue.Queue()
def do_inc():
while True:
job = jobs.get()
if job is None:
done.put(None)
break
statvent.incr('thread.test')
def test_10k_iterations_in_N_threads_results_in_10k_incrs():
n... | dowski/statvent | tests/test_thread_safety.py | Python | bsd-2-clause | 677 |
"""Settings for devel."""
import os
from settings.base_settings import * # pylint: disable=W0614,W0401
DEBUG = True
ALLOWED_HOSTS = ['*']
FULL_DOMAIN = 'http://127.0.0.1:8000'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
# Extra places for collectstatic to f... | edvm/tero | settings/dev_settings.py | Python | gpl-3.0 | 726 |
from __future__ import annotations
import re
import sys
from typing import Any, Callable, TypeVar
from pathlib import Path
import numpy as np
import numpy.typing as npt
AR_f8: npt.NDArray[np.float64]
AR_i8: npt.NDArray[np.int64]
bool_obj: bool
suppress_obj: np.testing.suppress_warnings
FT = TypeVar("FT", bound=Call... | simongibbons/numpy | numpy/typing/tests/data/reveal/testing.py | Python | bsd-3-clause | 8,824 |
# -*- coding: utf-8 -*-
'''
Primary interfaces for the salt-cloud system
'''
# Need to get data from 4 sources!
# CLI options
# salt cloud config - CONFIG_DIR + '/cloud'
# salt master config (for master integration)
# salt VM config, where VMs are defined - CONFIG_DIR + '/cloud.profiles'
#
# The cli, master and cloud c... | smallyear/linuxLearn | salt/salt/cloud/cli.py | Python | apache-2.0 | 16,210 |
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | infinyte/oppia | core/storage/base_model/gae_models.py | Python | apache-2.0 | 17,305 |
#!/usr/bin/env python
def collapse(x):
if not isinstance(x, list):
return [x]
elif len(x) == 0:
return x
else:
return collapse(x[0]) + collapse(x[1:])
| genos/online_problems | prog_praxis/collapse.py | Python | mit | 188 |
from l10n.models import Country, AdminArea
from django.contrib import admin
from django.utils.translation import get_language, ugettext_lazy as _
class AdminArea_Inline(admin.TabularInline):
model = AdminArea
extra = 1
class CountryOptions(admin.ModelAdmin):
def make_active(self, request, queryset):... | Ryati/satchmo | satchmo/apps/l10n/admin.py | Python | bsd-3-clause | 1,406 |
# Copyright (c) 2012 - 2015 EMC Corporation, 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
#
# ... | dims/cinder | cinder/tests/unit/test_emc_vnx.py | Python | apache-2.0 | 290,903 |
# coding=utf-8
import sys
import struct
import types
import unittest
from gi.repository import GObject
from gi.repository.GObject import GType, new, PARAM_READWRITE, \
PARAM_CONSTRUCT, PARAM_READABLE, PARAM_WRITABLE, PARAM_CONSTRUCT_ONLY
from gi.repository.GObject import \
TYPE_INT, TYPE_UINT, TYPE_LONG, TYPE... | davibe/pygobject | tests/test_properties.py | Python | lgpl-2.1 | 34,347 |
import BaseHTTPServer
import os
from ConfigParser import ConfigParser
"""
Modular request handler.
The config contains sections called [handler:xyz]. This registers a
handler for any request to /xyz/ or below to be handled by the class
"module" (optionally sourced from library "location", defaulting to
the same name ... | BumblingBunny/ImageServer | Server/ImageServer/RequestHandler.py | Python | unlicense | 6,534 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2020 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost 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 versio... | tfroehlich82/EventGhost | eg/Classes/SimpleInputDialog.py | Python | gpl-2.0 | 2,026 |
# -*- coding: utf-8 -*-
import inspect
import sys
from abc import abstractmethod, ABCMeta
from typing import ( # NOQA
Dict,
List,
Optional,
Tuple,
)
from django.utils.module_loading import import_string
class BaseCR(metaclass=ABCMeta):
"""
Abstract base collision resolver. All collision reso... | django-extensions/django-extensions | django_extensions/collision_resolvers.py | Python | mit | 10,644 |
from setuptools import setup, Extension, Command
# from pip.req import parse_requirements
# import pip.download
# parse_requirements() returns generator of pip.req.InstallRequirement objects
# install_reqs = parse_requirements("requirements2.txt",
# session=pip.download.PipSession())
# reqs is a list of requirement
#... | tmfoltz/worldengine | setup.py | Python | mit | 1,289 |
"""Tests for cement.ext.ext_handlebars."""
import sys
import random
from cement.core import exc, foundation, handler, backend, controller
from cement.utils import test
from nose.plugins.attrib import attr
class HandlebarsTestApp(test.TestApp):
class Meta:
extensions = ['handlebars']
output_handler... | akhilman/cement | tests/ext/handlebars_tests.py | Python | bsd-3-clause | 2,134 |
# 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, ... | googleinterns/bizview-semi-supervised-learning | Mixmatch/libml/models.py | Python | apache-2.0 | 9,009 |
# 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... | drpngx/tensorflow | tensorflow/python/data/util/nest_test.py | Python | apache-2.0 | 17,835 |
# Copyright (C) 2012 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman 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 opt... | hcs/mailman | src/mailman/core/tests/test_pipelines.py | Python | gpl-3.0 | 6,010 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-ClipboardContents',
'Author': ['@harmj0y'],
'Description': ('Monitors the clipboard on a specified interval for changes to copied text.'),
'B... | pierce403/EmpirePanel | lib/modules/collection/clipboard_monitor.py | Python | bsd-3-clause | 2,846 |
#zenlib.services
import re
#Mapping from service ID URI too URL template and/or callable
SERVICES = {}
def register_service(s):
'''
info - either a callable, which has its URL as the serviceid attribute
or a tuple of (serviceid, callable)
Note: registration of remote services is done in the Zen... | zepheira/zenpub | lib/services.py | Python | apache-2.0 | 1,993 |
import os.path
from getpass import getpass
from collections import OrderedDict
from fabric.api import sudo, run, cd, prefix, settings, task, env, prompt, shell_env
from fabric.contrib.console import confirm
from fabric.contrib.files import exists, upload_template, contains
env.hosts = ['vergeev@meetup-bot.me']
PROJE... | Stark-Mountain/meetup-facebook-bot | fabfile.py | Python | mit | 9,692 |
# Copyright (C) 2003-2005 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ... | liyongyue/dnsspider | dns/rdtypes/IN/NSAP_PTR.py | Python | isc | 889 |
#-*-coding:utf-8-*-
'''
@author: Hung-Hsin Chen
@mail: chenhh@par.cse.nsysu.edu.tw
@license: GPLv2
'''
import functools
def symbol(sym):
'''
Decorator that assigns a symbol to a function.
The symbol is stored in the function.symbol attribute.
@param sym: symbol to a function
'''
def decorator(... | chenhh/PyMOGEP | src/PyMOGEP/decorator.py | Python | gpl-2.0 | 2,384 |
class DispatcherCannotBeNullException(Exception):
def __init__(self, message):
super(DispatcherCannotBeNullException, self).__init__(message)
class NoUserAssignedToSession(Exception):
def __init__(self, message):
super(NoUserAssignedToSession, self).__init__(message)
class UserNotFound(Excep... | blackms/myTelegramBot | myTelegramBot/Exceptions.py | Python | mit | 670 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-12 10:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('weblog', '0007_auto_20160112_1115'),
]
operations = [
migrations.AlterField(
... | drxos/kuiqblog | weblog/migrations/0008_auto_20160112_1117.py | Python | bsd-3-clause | 487 |
'''
PathwayGenie (c) GeneGenie Bioinformatics Ltd. 2018
PathwayGenie is licensed under the MIT License.
To view a copy of this license, visit <http://opensource.org/licenses/MIT/>.
@author: neilswainston
'''
# pylint: disable=invalid-name
# pylint: disable=no-member
# pylint: disable=wrong-import-order
import json
... | neilswainston/PathwayGenie | pathway_genie/app.py | Python | mit | 7,289 |
from logs import sonarlog
import configuration
import json
import numpy as np
# Setup Sonar logging
logger = sonarlog.getLogger('controller')
'''
Simulates the wait time for a transaction.
'''
class SimulatedMigration:
def __init__(self, pump, domain, node_from, node_to, migration_callback, info):
# Refe... | jacksonicson/paper.IS2015 | control/Control/src/balancer/strategy.py | Python | mit | 8,848 |
# Copyright (C) 2009 Nokia Corporation
# Copyright (C) 2009-2013 Collabora Ltd.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) ... | freedesktop-unofficial-mirror/telepathy__telepathy-salut | tests/twisted/servicetest.py | Python | lgpl-2.1 | 28,246 |
# -*- coding: utf-8 -*-
#
# pyhdf documentation build configuration file, created by
# sphinx-quickstart2 on Sun Jul 27 02:07:57 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... | fhs/pyhdf | doc/conf.py | Python | mit | 8,182 |
#!/usr/bin/env python
import os
import sys
from setuptools import setup
SETUP_DIR = os.path.dirname(__file__)
README = os.path.join(SETUP_DIR, "README.rst")
NEEDS_PYTEST = {"pytest", "test", "ptr"}.intersection(sys.argv)
PYTEST_RUNNER = ["pytest-runner", "pytest-cov"] if NEEDS_PYTEST else []
setup(
name="cwl-u... | common-workflow-language/cwl-upgrader | setup.py | Python | apache-2.0 | 2,104 |
#
# gPrime - A web-based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 optio... | sam-m888/gprime | gprime/filters/rules/note/_hastype.py | Python | gpl-2.0 | 1,978 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
import gettext
import json
import os
import unittest
from os import path
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import (
LiveServerTestCase, TestCase, modify_settings, override_settings,
)
from d... | hackerbot/DjangoDev | tests/view_tests/tests/test_i18n.py | Python | bsd-3-clause | 12,636 |
import base64
from functools import partial
import hashlib
import hmac
import uuid
from django.conf import settings
from django.db.models import Q
from django.utils.encoding import force_bytes
import commonware.log
from olympia.users.models import UserProfile, DeniedName
log = commonware.log.getLogger('z.users')
... | mstriemer/olympia | src/olympia/users/utils.py | Python | bsd-3-clause | 2,607 |
"""hypergolic URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | Hattivat/hypergolic-django | hypergolic/hypergolic/urls.py | Python | agpl-3.0 | 1,056 |
__version__ = '2.0.3'
| tiagocardosos/receita-tools | receita/__init__.py | Python | mit | 23 |
# -*- coding: utf-8 -*-
"""
Drive-It competition simulation environment map
@author: Jean-Claude Manoli
"""
import math
import numpy as np
from numpy import cos, sin, pi
from utils import right_angle, three_quarter_turn
# track metrics
median_radius = 0.375
loop_curvature = 1.0 / median_radius # 2.67
line_length = 2.0... | jcsharp/DriveIt | DriveItCircuit.py | Python | mit | 7,470 |
#!/usr/bin/env python
# encoding: utf-8
"""
@version: 1.0
@author: Juay
@file: kNN_Helen.py
@time: 2015/11/16 13:39
"""
import numpy as np
import operator
def label_tran(lable_str):
tran_dict = {'didntLike': 0, 'smallDoses': 1, 'largeDoses': 2}
return tran_dict[lable_str]
def file2matrix(file_path):
f... | LLPLab/LearningPyML | kNN/kNN_Helen.py | Python | mit | 2,251 |
# Generated by Django 3.1.5 on 2021-03-02 10:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('protector', '0008_auto_20191128_1246'),
]
operations = [
migrations.AlterField(
model_name='historygenericusertogroup',
... | grey0ne/django-protector | protector/migrations/0009_auto_20210302_1013.py | Python | mit | 1,448 |
# Copyright 2014 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.
from measurements import loading_trace
from telemetry.core import wpr_modes
from telemetry.unittest import options_for_unittests
from telemetry.unittest impo... | 7kbird/chrome | tools/perf/measurements/loading_trace_unittest.py | Python | bsd-3-clause | 966 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import RequestFactory
from djaloha.views import aloha_init
class AlohaConfigTest(TestCase):
def setUp(self):
super(AlohaConf... | ljean/djaloha | djaloha/tests/test_aloha_config.py | Python | bsd-3-clause | 1,932 |
# Guillaume Valadon <guillaume@valadon.net>
"""
Scapy BSD native support - constants
"""
import ctypes
from scapy.libs.structures import bpf_program
from scapy.data import MTU
SIOCGIFFLAGS = 0xc0206911
BPF_BUFFER_LENGTH = MTU
# From sys/ioccom.h
IOCPARM_MASK = 0x1fff
IOC_VOID = 0x20000000
IOC_OUT = 0x40000000
IOC... | secdev/scapy | scapy/arch/bpf/consts.py | Python | gpl-2.0 | 1,295 |
"""
@file
@brief Publishing coverage
"""
import os
import re
from collections import Counter
import shutil
import pprint
import sqlite3
from contextlib import redirect_stderr, redirect_stdout
from io import StringIO
def _attr_(var, name1, name2):
try:
return getattr(var, name1, getattr(var, name2))
ex... | sdpython/pyquickhelper | src/pyquickhelper/pycode/coverage_helper.py | Python | mit | 11,724 |
#!/usr/bin/env python3
###############################################################################
# Module Imports
###############################################################################
import jinja2
###############################################################################
# Jinja2
##############... | anqxyr/jarvis | jarvis/utils.py | Python | mit | 1,851 |
# -*- coding: latin-1 -*-
from __future__ import print_function
import re, json
def typeof(t):
if t is None: return 'undefined'
elif isinstance(t, bool): return 'boolean'
elif isinstance(t, str): return 'string'
elif isinstance(t, int) or isinstance(t, float): return 'number'
elif hasattr(t, '__call... | int3/js2py | prelude.py | Python | mit | 1,605 |
# -*- coding: utf-8 -*-
#
# This file is part of the Christine project
#
# Copyright (c) 2006-2007 Marco Antonio Islas Cruz
#
# Christine 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... | markuz/Christine | libchristine/gui/About.py | Python | gpl-2.0 | 1,905 |
# -*- coding: utf8 -*-
#***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> ... | cypsun/FreeCAD | src/Mod/Arch/ArchCommands.py | Python | lgpl-2.1 | 51,048 |
from rest_framework import serializers
from products.models import Product
class ProductSerializer(serializers.ModelSerializer):
class Meta:
model = Product
fields = ('id', 'name', 'description', 'thumbnail')
| matachi/product-gallery | products/serializers.py | Python | mit | 230 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'gui/rn_roadnet_password_ui.ui'
#
# Created: Wed Oct 28 16:22:12 2015
# by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
from PyQt4.Qt import Qt
try:
_fromU... | thinkWhere/Roadnet | gui/rn_password_ui.py | Python | gpl-2.0 | 5,029 |
#!/usr/bin/env python
#
# ___INFO__MARK_BEGIN__
#######################################################################################
# Copyright 2016-2021 Univa Corporation (acquired and owned by Altair Engineering Inc.)
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file ex... | gridengine/config-api | test/test_parallel_environment.py | Python | apache-2.0 | 5,641 |
threads_init = lambda *a, **k: None
def init(a):
pass
class Source(object):
pass
class Pipeline(object):
pass
class ElementFactory(object):
def make(self, a, b):
pass
class IOCondition:
IN = 1
ERR = 8
HUP = 16
| timvideos/gst-switch | docs/fake-lib/gi/repository/Gst.py | Python | gpl-3.0 | 227 |
"""
Views for groups info API
"""
from rest_framework import generics, status, mixins
from rest_framework.response import Response
from django.conf import settings
import facebook
from ...utils import mobile_view
from . import serializers
@mobile_view()
class Groups(generics.CreateAPIView, mixins.DestroyModelMixin)... | beni55/edx-platform | lms/djangoapps/mobile_api/social_facebook/groups/views.py | Python | agpl-3.0 | 4,938 |
"""!
@brief Test templates for K-Means clustering module.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
from pyclustering.tests.assertion import assertion
from pyclustering.cluster.encoder import type_encoding, cluster_encoder
from pyclustering.cluster.... | annoviko/pyclustering | pyclustering/cluster/tests/kmeans_templates.py | Python | gpl-3.0 | 5,793 |
import aip
import cam
import FileDialog
client = aip.AipFace("Enter Your APP_ID", "Enter Your API_KEY", "Enter Your SECRET_KEY")
cam.photo_capture("d:\\1.jpg","q")
print(client.match(FileDialog.getOneFile(),FileDialog.getOneFile(), options={})["score"])
| xbed/Mixly_Arduino | mixly_arduino/sample/mixpy/人工智能Py/05人脸识别-2.py | Python | apache-2.0 | 258 |
import os
from lib.base_plugin import BasePlugin
from lib.paths import SteamCloudPath, SteamGamesPath
class CogsPlugin(BasePlugin):
Name = "Cogs"
support_os = ["Windows"]
def backup(self, _):
_.add_folder('Data', os.path.join(SteamCloudPath, '26500'), 'remote')
def restore(self, _):
... | Pr0Ger/SGSB | plugins/Cogs.py | Python | mit | 526 |
from vsg.vhdlFile.classify import full_type_declaration
from vsg.vhdlFile.classify import incomplete_type_declaration
def detect(iToken, lObjects):
'''
type_declaration ::=
full_type_declaration
| incomplete_type_declaration
'''
iReturn = full_type_declaration.detect(iToken, lObjects)... | jeremiah-c-leary/vhdl-style-guide | vsg/vhdlFile/classify/type_declaration.py | Python | gpl-3.0 | 506 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# au... | lxndrp/kutscher | docs/conf.py | Python | apache-2.0 | 8,390 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from io import StringIO
import numpy as np
from .. import core, funcs
from ...tests.helper import pytest, quantity_allclose as allclose
from ...... | piotroxp/scibibscan | scib/lib/python3.5/site-packages/astropy/cosmology/tests/test_cosmology.py | Python | mit | 55,704 |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = ""
services_str = "/home/gl/catkin_hrg/src/hrg_pick/hrg_camera/srv/CameraStatus.srv"
pkg_name = "hrg_camera"
dependencies_str = "std_msgs"
langs = "gencpp;genlisp;genpy"
dep_include_paths_str = "std_msgs;/opt/ros/indigo/share/std_msgs/cmake/../msg"
PYT... | iglstone/catkin_hrg | build/hrg_pick/hrg_camera/cmake/hrg_camera-genmsg-context.py | Python | mit | 502 |
import asyncio
import socket
from copy import copy
from cloudbot import hook
socket.setdefaulttimeout(10)
# Auto-join on Invite (Configurable, defaults to True)
@hook.irc_raw('INVITE')
@asyncio.coroutine
def invite(irc_paramlist, conn):
"""
:type irc_paramlist: list[str]
:type conn: cloudbot.client.Clie... | MuffinMedic/CloudBot | plugins/core/core_misc.py | Python | gpl-3.0 | 4,966 |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... | deepmind/acme | examples/open_spiel/run_dqn.py | Python | apache-2.0 | 2,566 |
from Screens.Screen import Screen
from Components.Label import Label
from Components.ServiceEventTracker import ServiceEventTracker
from os import system, rename as os_rename
from enigma import eTimer, iServiceInformation, iPlayableService, eDVBFrontendParametersSatellite
import re
import socket
from Tools.Direc... | popazerty/bh1 | lib/python/Blackhole/BhEI.py | Python | gpl-2.0 | 15,188 |
# -*- coding: utf-8 -*-
"""Test string variable expansion and unexpansion."""
import bibpy
import bibpy.entry
from bibpy.parser import parse_string_expr
from funcparserlib.lexer import Token
import pytest
@pytest.fixture
def test_entries():
result = bibpy.read_file('tests/data/string_variables.bib', 'bibtex')
... | MisanthropicBit/bibpy | tests/test_string_expansion.py | Python | mit | 6,477 |
"""
Plot panel.
"""
from __future__ import print_function
import logging
import traceback
import wx
# Try a normal import first
# If it fails, try specifying a version
import matplotlib
matplotlib.interactive(False)
#Use the WxAgg back end. The Wx one takes too long to render
matplotlib.use('WXAgg')
from matplotli... | lewisodriscoll/sasview | src/sas/sasgui/plottools/PlotPanel.py | Python | bsd-3-clause | 74,722 |
# -*- coding: utf-8 -*-
import logging
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from .models import Student
@receiver(post_save, sender=Student)
def log_student_updated_added_event(sender, **kwargs):
"""Writes info about updated or newly added student into... | hddn/studentsdb | students/signals.py | Python | mit | 1,010 |
from multiprocessing import Process, Queue
from multiprocessing.queues import Queue as QueueType
import serial
from serial.tools import list_ports
from cmd_list import CMD_LIST
import time
from packets import encode_packet, decode_packet
import logging
#<<<<<<< HEAD
#PORT_VID = 1155
#PORT_PID = 22336
#PORT_SNR = '367... | SkRobo/Eurobot-2017 | NewCommunication/driver.py | Python | mit | 3,933 |
"""SCons.Tool.suncc
Tool-specific initialization for Sun Solaris (Forte) CC and cc.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# Permission is hereby ... | pnorman/mapnik | scons/scons-local-2.4.1/SCons/Tool/suncc.py | Python | lgpl-2.1 | 1,957 |
from django.apps import AppConfig
class FundConfig(AppConfig):
name = 'fund'
| szu-stu/ezFund | fund/apps.py | Python | apache-2.0 | 83 |
from django.test import SimpleTestCase
from django.urls.resolvers import RegexPattern, RoutePattern
from django.utils.translation import gettext_lazy as _
class RegexPatternTests(SimpleTestCase):
def test_str(self):
self.assertEqual(str(RegexPattern(_('^translated/$'))), '^translated/$')
class RoutePat... | frankvdp/django | tests/urlpatterns/test_resolvers.py | Python | bsd-3-clause | 449 |
#-*- coding: utf-8 -*-
import os
from flask import Flask, render_template, request, redirect, url_for, jsonify
import modules.base as base
import numpy as np
from modules.decorators.minified_response import minified_response
import config
import sqlite3
import csv
import config
app = Flask(__name__)
# from flask.ext.... | jongha/stock-ai | app.py | Python | mit | 3,455 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 The HiSchool! Project
#
# This file is part of HiSchool!.
#
# HiSchool! is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or... | HiSchoolProject/BackSchool | core/dispatcher/dispatchers.py | Python | lgpl-3.0 | 4,474 |
__author__ = 'David Dexter'
"""
COPYRIGHT (C) 2016 BLACKSPACE KENYA LIMITED www.blackspace.co.ke
Author : Dexter Engineering
dexter@blackspacekenya.com , dmwangimail@gmail.com
SPACE GATEWAY CLASS IS A MODIFIED VERSION OF AFRICASTALKING GATEWAY FREE SOFTWARE.
THIS VERSION IS MEANT TO SUPPORT AND NOT REPLACE THE O... | daviddexter/SpaceGateway | SpaceGateway.py | Python | gpl-2.0 | 8,267 |
from django.conf import settings
from django.db import connection, models
from django.db.models import F
from analytics.models import InstallationCount, RealmCount, \
UserCount, StreamCount, BaseCount, FillState, Anomaly, installation_epoch, \
last_successful_fill
from zerver.models import Realm, UserProfile, ... | Galexrt/zulip | analytics/lib/counts.py | Python | apache-2.0 | 23,031 |
# -*- coding: utf-8 -*-
import json
from unittest import mock
from oauthlib.oauth2.rfc6749 import errors
from oauthlib.openid import RequestValidator, UserInfoEndpoint
from tests.unittest import TestCase
def set_scopes_valid(token, scopes, request):
request.scopes = ["openid", "bar"]
return True
class Use... | idan/oauthlib | tests/openid/connect/core/endpoints/test_userinfo_endpoint.py | Python | bsd-3-clause | 2,522 |
w = float(input("the width is "))
# input("the height is ", h)
print(w)
| darkless456/Python | input().py | Python | mit | 72 |
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license
"""
DNS: Domain Name System.
"""
import socket,struct
from scapy.packet import *
from scapy.fields import *
from scapy.... | mytliulei/Scapy | scapy/layers/dns.py | Python | apache-2.0 | 23,389 |
#
# Radek Vykydal <rvykydal@redhat.com>
#
# Copyright 2018 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. This program is distributed in the hope that it
# will be us... | atodorov/pykickstart | pykickstart/handlers/rhel8.py | Python | gpl-2.0 | 5,764 |
# Copyright 2013 NEC Corporation
# 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 ... | ntymtsiv/tempest | tempest/api/compute/v3/admin/test_simple_tenant_usage_negative.py | Python | apache-2.0 | 2,835 |
"""
Copyright (c) 2015. 2016, 1017 Alan Yorinks All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
Version 3 as published by the Free Software Foundation; either
or (at your option) any later version.
This library ... | MrYsLab/pymata-aio | test/test_all.py | Python | agpl-3.0 | 5,410 |
from django.conf.urls import url
from xui.cloudendure import views
xui_urlpatterns = [
# CloudEndure connection urls
url(r'^cloudendure/add_cloudendure_endpoint/$', views.add_cloudendure_endpoint,
name='add_cloudendure_endpoint'),
url(r'^cloudendure/edit_cloudendure_endpoint/$', views.edit_cloudend... | CloudBoltSoftware/cloudbolt-forge | ui_extensions/cloudendure/urls.py | Python | apache-2.0 | 1,400 |
import urllib2
import zipfile
import re
url = "http://www.pythonchallenge.com/pc/def/channel.zip"
data = urllib2.urlopen(url).read()
file1='ttt.zip'
with open(file1,'wb+') as fzip:
fzip.write(data)
#dd=re.compile(r'[from|is] (\d+$)')
dd = re.compile(r'(?<=[from|is] )(\d+)')
zf = zipfile.ZipFile(file1,'r')
text=... | gregorianzhang/pythonchallenge | 6.py | Python | apache-2.0 | 761 |
# localrepo.py - read/write repository class for mercurial
#
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from node import hex, nullid, short
from i18n import _
import peer, c... | iaddict/mercurial.rb | vendor/mercurial/mercurial/localrepo.py | Python | mit | 102,052 |
from functools import wraps
from .base_primitive import BasePrimitive
from .. import helpers
from ..mutation_context import MutationContext
def _may_recurse(f):
@wraps(f)
def safe_recurse(self, *args, **kwargs):
self._recursion_flag = True
result = f(self, *args, **kwargs)
self._recur... | jtpereyda/boofuzz | boofuzz/primitives/mirror.py | Python | gpl-2.0 | 2,805 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.