text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from . import _ccallback_c
import ctypes
PyCFuncPtr = ctypes.CFUNCTYPE(ctypes.c_void_p).__bases__[0]
ffi = None
class CData(object):
pass
def _import_cffi():
global ffi, CData
if ffi is not None:
return
try:
import cffi
ffi = cffi.FFI()
CData = ffi.CData
except... | Eric89GXL/scipy | scipy/_lib/_ccallback.py | Python | bsd-3-clause | 6,196 | 0.001453 |
#!/usr/bin/env python
# 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
Unle... | QuantiModo/QuantiModo-SDK-Python | SwaggerPetstore/models/json_error_response.py | Python | gpl-2.0 | 1,773 | 0.00564 |
# -*- coding: utf-8 -*-
appid = 'example'
apikey = 'c5dd7e7dkjp27377l903c42c032b413b'
sender = '01000000000' # FIXME - MUST BE CHANGED AS REAL PHONE NUMBER
receivers = ['01000000000', ] # FIXME - MUST BE CHANGED AS REAL PHONE NUMBERS
content = u'나는 유리를 먹을 수 있어요. 그래도 아프지 않아요'
| BlueHouseLab/sms-openapi | python-requests/conf.py | Python | apache-2.0 | 324 | 0.003521 |
##
# Copyright 2009-2017 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | ULHPC/easybuild-easyblocks | easybuild/easyblocks/generic/cmakemake.py | Python | gpl-2.0 | 4,702 | 0.002552 |
# coding=utf-8
from __future__ import unicode_literals
"""
Name: MyArgparse
Author: Andy Liu
Email : [email protected]
Created: 3/26/2015
Copyright: All rights reserved.
Licence: This program is free software: you can redistribute it
and/or modify it under the te... | asiroliu/MyTools | MyArgparse.py | Python | gpl-2.0 | 2,738 | 0.004018 |
from django.contrib import admin
from trainer.models import Language, Word, Card, Set
admin.site.register(Language)
admin.site.register(Word)
admin.site.register(Card)
admin.site.register(Set)
| chrigu6/vocabulary | vocabulary/trainer/admin.py | Python | gpl-3.0 | 195 | 0 |
# -*- coding: utf-8 -*-
import logging
import random
from collections import (
namedtuple,
defaultdict,
)
from itertools import repeat
import cachetools
import gevent
from gevent.event import (
_AbstractLinkable,
AsyncResult,
Event,
)
from ethereum import slogging
from raiden.exceptions import (
... | tomashaber/raiden | raiden/network/protocol.py | Python | mit | 24,753 | 0.000485 |
# Copyright (C) 2012-2015 ASTRON (Netherlands Institute for Radio Astronomy)
# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This file is part of the LOFAR software suite.
# The LOFAR software suite is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as p... | kernsuite-debian/lofar | SAS/ResourceAssignment/ResourceAssignmentEditor/config/default.py | Python | gpl-3.0 | 967 | 0 |
# -*- coding: utf-8 -*-
import json
import logging
import vobject
from datetime import datetime
from contextlib import contextmanager
from radicale import ical
from yats.shortcuts import get_ticket_model, build_ticket_search_ext, touch_ticket, remember_changes, mail_ticket, jabber_ticket, check_references, add_histo... | mediafactory/yats | modules/yats/caldav/storage.py | Python | mit | 12,605 | 0.002697 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | our-city-app/oca-backend | src/rogerthat/bizz/payment/to.py | Python | apache-2.0 | 1,164 | 0.000859 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Romain Bignon
#
# This file is part of weboob.
#
# weboob 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 License, or
# (at your opti... | laurent-george/weboob | modules/cmso/__init__.py | Python | agpl-3.0 | 788 | 0 |
import datetime
import itertools
import re
import urllib2
import mimetypes
import operator
import logging
import sys
import traceback
import warnings
import tagging
import tagging.models
import vidscraper
from bs4 import BeautifulSoup
from django.conf import settings
from django.contrib.auth.models import User
from dj... | pculture/mirocommunity | localtv/models.py | Python | agpl-3.0 | 55,425 | 0.000902 |
from rest_framework import exceptions as drf_exceptions
from rest_framework import versioning as drf_versioning
from rest_framework.compat import unicode_http_header
from rest_framework.utils.mediatypes import _MediaType
from api.base import exceptions
from api.base import utils
from api.base.renderers import Browsabl... | caseyrollins/osf.io | api/base/versioning.py | Python | apache-2.0 | 5,741 | 0.003135 |
# -*- coding: utf-8 -*-
from module.plugins.internal.XFSAccount import XFSAccount
class FilerioCom(XFSAccount):
__name__ = "FilerioCom"
__type__ = "account"
__version__ = "0.07"
__status__ = "testing"
__description__ = """FileRio.in account plugin"""
__license__ = "GPLv3"
__au... | Guidobelix/pyload | module/plugins/accounts/FilerioCom.py | Python | gpl-3.0 | 407 | 0.014742 |
import pytest
from ray.train.callbacks.results_preprocessors import (
ExcludedKeysResultsPreprocessor,
IndexedResultsPreprocessor,
SequentialResultsPreprocessor,
AverageResultsPreprocessor,
MaxResultsPreprocessor,
WeightedAverageResultsPreprocessor,
)
def test_excluded_keys_results_preprocess... | ray-project/ray | python/ray/train/tests/test_results_preprocessors.py | Python | apache-2.0 | 7,269 | 0.001238 |
import re
from django.core.exceptions import ImproperlyConfigured
from sqlalchemy import create_engine, MetaData
from sqlalchemy.orm import sessionmaker
from tranquil.models import Importer
__all__ = ( 'engine', 'meta', 'Session', )
class EngineCache(object):
__shared_state = dict(
engine = None,
meta = None,
... | g2p/tranquil | tranquil/__init__.py | Python | bsd-3-clause | 1,717 | 0.041351 |
"""
Tests outgoing calls created with InitialAudio and/or InitialVideo, and
exposing the initial contents of incoming calls as values of InitialAudio and
InitialVideo
"""
import operator
from servicetest import (
assertContains, assertEquals, assertLength,
wrap_channel, EventPattern, call_async, make_channel_... | jku/telepathy-gabble | tests/twisted/jingle/initial-audio-video.py | Python | lgpl-2.1 | 7,213 | 0.004298 |
#
# 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... | markflyhigh/incubator-beam | sdks/python/apache_beam/io/textio_test.py | Python | apache-2.0 | 43,198 | 0.006898 |
from django.dispatch import receiver
from pretix.base.signals import register_payment_providers
@receiver(register_payment_providers, dispatch_uid="payment_paypal")
def register_payment_provider(sender, **kwargs):
from .payment import Paypal
return Paypal
| awg24/pretix | src/pretix/plugins/paypal/signals.py | Python | apache-2.0 | 267 | 0 |
from django.db import models
class AdjacencyListModel(models.Model):
title = models.CharField(max_length=100)
parent = models.ForeignKey(
'self', related_name='%(class)s_parent', on_delete=models.CASCADE, db_index=True, null=True, blank=True)
def __str__(self):
return 'adjacencylistmode... | idlesign/django-admirarchy | admirarchy/tests/testapp/models.py | Python | bsd-3-clause | 633 | 0.00158 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2019-04-10 03:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('netdevice', '0006_auto_20190409_0325'),
]
operations = [
migrations.RenameField(
... | lkmhaqer/gtools-python | netdevice/migrations/0007_auto_20190410_0358.py | Python | mit | 567 | 0 |
from functools import reduce
class ScopedString (object):
def __init__ (self):
self._stack = []
def push (self, frame):
self._stack.append (frame)
def pop (self):
frame = self._stack.pop()
return frame
def __str__ (self... | doffm/dbuf | src/dbuf/util.py | Python | bsd-3-clause | 3,108 | 0.026705 |
"""A likelihood function representing a Student-t distribution.
Author:
Ilias Bilionis
Date:
1/21/2013
"""
__all__ = ['StudentTLikelihoodFunction']
import numpy as np
import scipy
import math
from . import GaussianLikelihoodFunction
class StudentTLikelihoodFunction(GaussianLikelihoodFunction):
"""An... | ebilionis/py-best | best/random/_student_t_likelihood_function.py | Python | lgpl-3.0 | 2,586 | 0.001933 |
# 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.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/search/azure-search-documents/samples/async_samples/sample_index_crud_operations_async.py | Python | mit | 3,884 | 0.00309 |
def RGB01ToHex(rgb):
"""
Return an RGB color value as a hex color string.
"""
return '#%02x%02x%02x' % tuple([int(x * 255) for x in rgb])
def hexToRGB01(hexColor):
"""
Return a hex color string as an RGB tuple of floats in the range 0..1
"""
h = hexColor.lstrip('#')
return tuple([x... | bohdon/maya-pulse | src/pulse/scripts/pulse/colors.py | Python | mit | 381 | 0 |
"""
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 use this ... | arenadata/ambari | ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/ECS/package/scripts/service_check.py | Python | apache-2.0 | 1,514 | 0.004624 |
# Copyright (c) 2008 Mikeal Rogers
#
# 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 agre... | abo-abo/edx-platform | common/djangoapps/mitxmako/middleware.py | Python | agpl-3.0 | 1,006 | 0 |
"""
Module with functionality for splitting and shuffling datasets.
"""
import numpy as np
from sklearn.utils import murmurhash3_32
from spotlight.interactions import Interactions
def _index_or_none(array, shuffle_index):
if array is None:
return None
else:
return array[shuffle_index]
de... | maciejkula/spotlight | spotlight/cross_validation.py | Python | mit | 6,519 | 0 |
# encoding: utf-8
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'MEP.stg_office'
db.delete_column('meps_mep', 'stg_office')
def backwards(self, orm):
# User chose to not deal... | alirizakeles/memopol-core | memopol/meps/migrations/0017_auto__del_field_mep_stg_office.py | Python | gpl-3.0 | 12,677 | 0.008046 |
# importing libraries:
import maya.cmds as cmds
import maya.mel as mel
# global variables to this module:
CLASS_NAME = "Arm"
TITLE = "m028_arm"
DESCRIPTION = "m029_armDesc"
ICON = "/Icons/dp_arm.png"
def Arm(dpAutoRigInst):
""" This function will create all guides needed to compose an arm.
"""
# chec... | SqueezeStudioAnimation/dpAutoRigSystem | dpAutoRigSystem/Scripts/dpArm.py | Python | gpl-2.0 | 3,972 | 0.007301 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-28 15:26
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | madprime/genevieve | genevieve_client/migrations/0004_auto_20160328_1526.py | Python | mit | 1,731 | 0.001733 |
from __future__ import print_function, division
import sys
import os
sys.path.append(os.path.abspath("."))
sys.dont_write_bytecode = True
from distribution import *
import operator as o
from utils.lib import gt, lt, gte, lte, neq, eq
__author__ = "bigfatnoob"
def sample(values, size=100):
return np.random.choice(v... | dr-bigfatnoob/quirk | language/functions.py | Python | unlicense | 1,698 | 0.009423 |
#!/usr/bin/env python
"""Distutils setup file, used to install or test 'setuptools'"""
import textwrap
import sys
try:
import setuptools
except ImportError:
sys.stderr.write("Distribute 0.7 may only upgrade an existing "
"Distribute 0.6 installation")
raise SystemExit(1)
long_description = textwr... | timohtey/mediadrop_copy | mediacore_env/Lib/site-packages/distribute-0.7.3/setup.py | Python | gpl-3.0 | 1,879 | 0.000532 |
from django.core.management.base import BaseCommand, CommandError
from tweets.tasks import stream
#The class must be named Command, and subclass BaseCommand
class Command(BaseCommand):
# Show this when the user types help
help = "My twitter stream command"
# A command must define handle()
def handle(s... | shazadan/mood-map | tweets/management/commands/stream.py | Python | gpl-2.0 | 361 | 0.00554 |
#!/usr/bin/env python
# coding=utf-8
"""
Created on April 15 2017
@author: yytang
"""
from scrapy import Selector
from libs.misc import get_spider_name_from_domain
from libs.polish import polish_title, polish_subtitle, polish_content
from novelsCrawler.spiders.novelSpider import NovelSpider
class PiaotianSpider(No... | yytang2012/novels-crawler | novelsCrawler/spiders/piaotian.py | Python | mit | 1,931 | 0.000518 |
a, b = <warning descr="Need more values to unpack">None</warning> | signed/intellij-community | python/testData/inspections/PyTupleAssignmentBalanceInspectionTest/unpackNonePy3.py | Python | apache-2.0 | 65 | 0.076923 |
"""
@author: dhoomakethu
"""
from __future__ import absolute_import, unicode_literals | dhoomakethu/apocalypse | apocalypse/server/__init__.py | Python | mit | 86 | 0.011628 |
#!/usr/env/bin/ python3
from setuptools import setup, Extension
#
#CXX_FLAGS = "-O3 -std=gnu++11 -Wall -Wno-comment"
#
## List of C/C++ sources that will conform the library
#sources = [
#
# "andrnx/clib/android.c",
#
#]
setup(name="andrnx",
version="0.1",
description="Package to convert from GNSS log... | rokubun/android_rinex | setup.py | Python | bsd-2-clause | 547 | 0.007313 |
class DrawingDimensioningWorkbench (Workbench):
# Icon generated using by converting linearDimension.svg to xpm format using Gimp
Icon = '''
/* XPM */
static char * linearDimension_xpm[] = {
"32 32 10 1",
" c None",
". c #000000",
"+ c #0008FF",
"@ c #0009FF",
"# c #000AFF",
"$ c ... | ulikoehler/FreeCAD_drawing_dimensioning | InitGui.py | Python | gpl-3.0 | 3,832 | 0.008351 |
# Copyright (c) 2009-2010 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:[email protected]
#
# 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, o... | gilshwartz/tortoisehg-caja | tortoisehg/hgqt/filelistmodel.py | Python | gpl-2.0 | 7,732 | 0.002069 |
"""Maya initialisation for Mindbender pipeline"""
from maya import cmds
def setup():
assert __import__("pyblish_maya").is_setup(), (
"pyblish-mindbender depends on pyblish_maya which has not "
"yet been setup. Run pyblish_maya.setup()")
from pyblish import api
api.register_gui("pyblish_l... | pyblish/pyblish-mindbender | mindbender/maya/pythonpath/userSetup.py | Python | mit | 488 | 0 |
""":mod:`kinsumer.checkpointer` --- Persisting positions for Kinesis shards
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import abc
import json
import os.path
from typing import Optional, Dict
class Checkpointer(abc.ABC, object):
"""Checkpointer is the interface for persisting ... | balancehero/kinsumer | kinsumer/checkpointer.py | Python | mit | 1,882 | 0.000531 |
class ParametrizedError(Exception):
def __init__(self, problem, invalid):
self.problem = str(problem)
self.invalid = str(invalid)
def __str__(self):
print('--- Error: {0}\n--- Caused by: {1}'.format(self.problem, self.invalid))
class InvalidToken(ParametrizedError):
pass
class ToneError(Parametri... | gribvirus74/Bee-per | Error.py | Python | gpl-3.0 | 534 | 0.035581 |
# 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 agreed to in writi... | F5Networks/f5-common-python | f5/bigip/tm/cm/test/functional/test_failover_status.py | Python | apache-2.0 | 1,104 | 0.000906 |
# third party
# third party
import numpy as np
import pytest
# syft absolute
# absolute
from syft.core.tensor.smpc.share_tensor import ShareTensor
@pytest.mark.smpc
def test_bit_extraction() -> None:
share = ShareTensor(rank=0, parties_info=[], ring_size=2**32)
data = np.array([[21, 32], [-54, 89]], dtype=np... | OpenMined/PySyft | tests/integration/smpc/tensor/share_tensor_test.py | Python | apache-2.0 | 975 | 0 |
### hierarchical_clustering.py
#Author Nathan Salomonis - [email protected]
#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
#t... | nsalomonis/BAM-to-Junction-BED | multiBAMtoBED.py | Python | apache-2.0 | 19,040 | 0.024685 |
#!/usr/bin/env python3
from django.shortcuts import render
# Create your views here.
from CnbetaApis.datas.Models import *
from CnbetaApis.datas.get_letv_json import get_letv_json
from CnbetaApis.datas.get_youku_json import get_youku_json
from django.views.decorators.csrf import csrf_exempt
from django.http import... | kagenZhao/cnBeta | CnbetaApi/CnbetaApis/views.py | Python | mit | 3,183 | 0.002513 |
"""The tests for the google calendar platform."""
import copy
from unittest.mock import Mock, patch
import httplib2
import pytest
from homeassistant.components.google import (
CONF_CAL_ID,
CONF_CLIENT_ID,
CONF_CLIENT_SECRET,
CONF_DEVICE_ID,
CONF_ENTITIES,
CONF_NAME,
CONF_TRACK,
DEVICE_... | fbradyirl/home-assistant | tests/components/google/test_calendar.py | Python | apache-2.0 | 11,260 | 0.000977 |
# Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of t... | capoe/espressopp.soap | src/Int3D.py | Python | gpl-3.0 | 3,721 | 0.017468 |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2018-2020)
#
# This file is part of GWpy.
#
# GWpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option)... | areeda/gwpy | gwpy/plot/tests/test_segments.py | Python | gpl-3.0 | 5,755 | 0 |
# Copyright (c) 2008 Chris Moyer http://coredumped.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, ... | kumar303/rockit | vendor-local/boto/mturk/qualification.py | Python | bsd-3-clause | 6,761 | 0.005177 |
# Determine whether an integer is a palindrome. Do this without extra space.
class Solution:
# @return a boolean
def isPalindrome1(self, x):
if x < 0 or x % 10 == 0 and x:
return False
xhalf = 0
while x > xhalf:
xhalf = xhalf * 10 + x % 10
x... | ammzen/SolveLeetCode | 9PalindromeNumber.py | Python | mit | 727 | 0.008253 |
'''
Created on Aug 27, 2013
@author: Devon
Define gui events
'''
from pyHopeEngine import BaseEvent
class Event_ButtonPressed(BaseEvent):
'''Sent when a button is pressed'''
eventType = "ButtonPressed"
def __init__(self, value):
'''Contains a value identifying the button'''
self.val... | Trinak/PyHopeEngine | src/pyHopeEngine/event/guiEvents.py | Python | gpl-3.0 | 550 | 0.007273 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import mysql.connector
import time
import datetime
conn = mysql.connector.connect(host="localhost",user="spike",password="valentine", database="drupal")
cann = mysql.connector.connect(host="localhost",user="spike",password="valentine", database="content_delivery_weather")... | gandalf-the-white/foundation | amaryl/scripts/initdatabase.py | Python | mit | 1,705 | 0.021114 |
# I made some modifications to termcolor so you can pass HEX colors to
# the colored function. It then chooses the nearest xterm 256 color to
# that HEX color. This requires some color functions that I have added
# in my python path.
#
# 2015/02/16
#
#
# coding: utf-8
# Copyright (c) 2008-2011 Volvox Development Team
... | marchdf/dotfiles | mypython/mypython/mytermcolor.py | Python | mit | 5,928 | 0.000337 |
#! /usr/bin/python
'''
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
Find the minimum element.
'''
class Solution:
# @param num, a list of integer
# @return an integer
# You may assume no duplicate exists in the array.
def fi... | shub0/algorithm-data-structure | python/find_minimum.py | Python | bsd-3-clause | 1,730 | 0.004046 |
import pytest
import re
import capybara
class TestHasSelector:
@pytest.fixture(autouse=True)
def setup_session(self, session):
session.visit("/with_html")
def test_is_true_if_the_given_selector_is_on_the_page(self, session):
assert session.has_selector("xpath", "//p")
assert sess... | elliterate/capybara.py | capybara/tests/session/test_has_selector.py | Python | mit | 7,185 | 0.004454 |
#
# Copyright (C) 2017 Smithsonian Astrophysical Observatory
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#... | anetasie/sherpa | sherpa/astro/sim/tests/test_astro_sim_unit.py | Python | gpl-3.0 | 1,513 | 0 |
from impl import FixedClientDeauthAttack,\
SniffedClientDeauthAttack,\
GlobalDisassociationAttack
class WiFiDeauthAttackBuilder(object):
'''This object finds the appropriate attack for the options supplied by the
user.'''
@classmethod
def build_from(cls, opt... | lukius/wifi-deauth | attack/builder.py | Python | mit | 2,286 | 0.010499 |
# Copyright 2021 The HuggingFace Team. 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 applicabl... | huggingface/pytorch-transformers | tests/test_modeling_flax_gpt2.py | Python | apache-2.0 | 14,464 | 0.00401 |
from xyz.location import build_location
def test_build_location_simple():
# test
Location = build_location()
location = Location("Canada", "Charlottetown")
assert location.country == "Canada"
assert location.city == "Charlottetown"
| codetojoy/gists | python/pipenv_jun_2020/tests/test_location.py | Python | apache-2.0 | 257 | 0.007782 |
# -*- coding: utf-8 -*-
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# non-exclusive license to e... | Haynie-Research-and-Development/jarvis | deps/lib/python3.4/site-packages/Cryptodome/Hash/SHA224.py | Python | gpl-2.0 | 6,132 | 0.001794 |
"""
Braces for type definition(class / struct / union / enum) should be located in the seperate line.
== Violation ==
class K() { <== ERROR
}
struct K { <== ERROR
}
== Good ==
struct A()
{ <== CORRECT
}
class K()
{ <== CORRECT
public :
void Hello... | kunaltyagi/nsiqcppstyle | rules/RULE_4_5_A_braces_for_type_definition_should_be_located_in_seperate_line.py | Python | gpl-2.0 | 3,220 | 0.001242 |
#########################################################################
# Uniprot XML parser to parse phosphorylation info of proteins
#
# eg 29/07/2009
#########################################################################
#from xml.etree.ElementTree import ElementTree
from xml.etree.ElementTree import iterparse... | quimaguirre/diana | diana/toolbox/parse_uniprot.py | Python | mit | 9,091 | 0.0055 |
"""Add autoincrement
Revision ID: 73b63ad41d3
Revises: 331f2c45f5a
Create Date: 2017-07-25 17:09:55.204538
"""
# revision identifiers, used by Alembic.
revision = '73b63ad41d3'
down_revision = '331f2c45f5a'
from alembic import op
from sqlalchemy import Integer
import sqlalchemy as sa
def upgrade():
op.alter_c... | porduna/appcomposer | alembic/versions/73b63ad41d3_add_autoincrement.py | Python | bsd-2-clause | 446 | 0.008969 |
# -*- 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-certificate-manager | samples/generated_samples/certificatemanager_v1_generated_certificate_manager_update_dns_authorization_async.py | Python | apache-2.0 | 1,818 | 0.00165 |
#!/usr/bin/env python
#---coding=utf8---
from HomeHandler import HomeHandler
from LoginHandler import LoginHandler
from LogoutHandler import LogoutHandler
from ArchivesHandler import ArchivesHandler
from CategoryHandler import CategoryHandler
from TagHandler import TagHandler
from PageHandler import PageHandler
from Se... | grepcook/blog | blog/handlers.py | Python | mit | 1,071 | 0.013072 |
from __future__ import absolute_import
from collections import defaultdict
from django.db import transaction
from django.utils.translation import ugettext as _
from zerver.lib.exceptions import JsonableError
from zerver.models import UserProfile, Realm, UserGroupMembership, UserGroup
from typing import Dict, Iterable,... | jackrzhang/zulip | zerver/lib/user_groups.py | Python | apache-2.0 | 3,997 | 0.005504 |
from bing_search_api import BingSearchAPI
my_key = "MEL5FOrb1H5G1E78YY8N5mkfcvUK2hNBYsZl1aAEEbE"
def query(query_string):
bing = BingSearchAPI(my_key)
params = {'ImageFilters':'"Face:Face"',
'$format': 'json',
'$top': 10,
'$skip': 0}
results = bing.search('web',qu... | mzweilin/HashTag-Understanding | test/test_bing_search.py | Python | apache-2.0 | 529 | 0.015123 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('editorial', '0062_auto_20171202_1413'),
]
operations = [
migrations.AddField(
model_name='assignment',
... | ProjectFacet/facet | project/editorial/migrations/0063_assignment_complete.py | Python | mit | 453 | 0.002208 |
# -*- coding: utf-8 -*-
# © <2016> <ToproERP liujing>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from json import *
import logging
import string
import hashlib
import urllib2
from openerp import http
from openerp.http import request
import Cookie
import base64
import pytz
import datetime
from... | xhair/TopOdoo_Addons | ToproERP_WeChat_GLD/controllers/wechat_gld.py | Python | agpl-3.0 | 43,140 | 0.004475 |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are ... | sangh/LaserShow | pyglet-hg/examples/window_platform_event.py | Python | bsd-3-clause | 3,351 | 0.001492 |
# Copyright (c) 2015 Huawei Technologies Co., Ltd.
# 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
#
# ... | Paul-Ezell/cinder-1 | cinder/volume/drivers/huawei/huawei_driver.py | Python | apache-2.0 | 49,899 | 0 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import unittest
import imgchili
import lxml.html
from os.path import join, getsize, isfile
class TestImgchili(unittest.TestCase):
def setUp(self):
self.basedir = '/mnt/d/Maidens/Uploads/'
self.url = 'http://imgchili.com/show/2765/2765317_9.jpg'
... | Donearm/PyImagedownloader | pyimagedownloader/tests/imgchili_test.py | Python | gpl-3.0 | 12,411 | 0.005076 |
from audioop import reverse
from time import sleep
import pytest
import requests
from utils import *
from conftest import file_dir as test_home
from conftest import ref_version
import json
import datetime
class TestsortMajor:
def test_sort_with_reminderState_1(self):
filter_response = call_ref_url("get", make_book... | soumyaslab/pythonlab | py2/excel_example/test_planner_extended_filters.py | Python | gpl-2.0 | 83,909 | 0.017841 |
# 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... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/models/object_detection/exporter.py | Python | bsd-2-clause | 13,779 | 0.006387 |
import os
import glob
#####################################################
######Init the files##################################
#####################################################
os.remove("a0.txt")
os.remove("a1.txt")
os.remove("a2.txt")
os.remove("a3.txt")
os.remove("a4.txt")
os.remove("a5.txt")
os.remove("a6... | doylew/detectionsc | format_py/ngram_nskip.py | Python | mit | 6,042 | 0.015227 |
import random
from django.dispatch import receiver
from django.conf import settings
from readthedocs.restapi.signals import footer_response
from readthedocs.donate.models import SupporterPromo
from readthedocs.donate.constants import INCLUDE, EXCLUDE
from readthedocs.donate.utils import offer_promo
PROMO_GEO_PATH =... | tddv/readthedocs.org | readthedocs/donate/signals.py | Python | mit | 6,234 | 0.000642 |
"""Device tracker support for OPNSense routers."""
from homeassistant.components.device_tracker import DeviceScanner
from . import CONF_TRACKER_INTERFACE, OPNSENSE_DATA
async def async_get_scanner(hass, config, discovery_info=None):
"""Configure the OPNSense device_tracker."""
interface_client = hass.data[OP... | home-assistant/home-assistant | homeassistant/components/opnsense/device_tracker.py | Python | apache-2.0 | 2,172 | 0 |
#!/usr/bin/env python
# Convert line elements with overlapping endpoints into polylines in an
# SVG file.
import os
import sys
try:
from lxml import etree
except ImportError:
import xml.etree.ElementTree as etree
from collections import defaultdict
from optparse import OptionParser
SVG_NS = 'http://www.w... | johnnovak/polylinize.py | polylinize.py | Python | mit | 6,224 | 0.002731 |
from __future__ import absolute_import
import errno
import logging
import sys
import warnings
from socket import error as SocketError, timeout as SocketTimeout
import socket
from .exceptions import (
ClosedPoolError,
ProtocolError,
EmptyPoolError,
HeaderParsingError,
HostChangedError,
Locatio... | LukeMurphey/splunk-google-drive | src/bin/google_drive_app/urllib3/connectionpool.py | Python | apache-2.0 | 36,488 | 0.000658 |
import os
import sys
here = os.path.abspath(os.path.split(__file__)[0])
sys.path.insert(0, os.path.join(here, os.pardir, os.pardir, os.pardir))
import localpaths as _localpaths # noqa: F401
| UK992/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/__init__.py | Python | mpl-2.0 | 193 | 0 |
import sys
import time
import json
import logging
import random
import tornado.options
from tornado.options import define, options
from tornado import gen
define('srp_root',default='http://192.168.56.1')
#define('srp_root',default='https://remote-staging.utorrent.com')
#define('srp_root',default='https://remote.utorre... | leiferikb/bitpop-private | bitpop_specific/extensions/bittorrent_surf/app/lib/falcon-api/python/falcon_api/test/classic.py | Python | bsd-3-clause | 2,962 | 0.015868 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2010 Benny Malengier
# Copyright (C) 2011 Tim G L Lyons
#
# 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 versio... | beernarrd/gramps | gramps/gen/filters/rules/_matchessourcefilterbase.py | Python | gpl-2.0 | 2,456 | 0.0057 |
#
# 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... | mxm/incubator-beam | sdks/python/apache_beam/runners/test/__init__.py | Python | apache-2.0 | 1,360 | 0.002941 |
# Copyright (c) 2020, Manfred Moitzi
# License: MIT License
import sys
import time
from datetime import datetime
from pathlib import Path
from ezdxf.acc import USE_C_EXT
from ezdxf.render.forms import ellipse
if USE_C_EXT is False:
print("C-extension disabled or not available.")
sys.exit(1)
from ezdxf.math._... | mozman/ezdxf | profiling/construct.py | Python | mit | 3,719 | 0.000269 |
from pylab import *
from scipy.io import loadmat, savemat
import time
import dicom
Rel = 4.5 # assumed Relaxivity of Gd-DTPA at 3 T [s^-1 [mmol Gd-DTPA]^{-1}]
flip_angle = 30 * pi / 180.0 # rad
TR = 5e-3 # sec
nx = 80
ny = 50
nt = 1321
noise_sigma = 0.2
random_seed = 1337
seed(random_seed)
dx = 1
deltat = 1
data... | JuliaPackageMirrors/DCEMRI.jl | test/q6/prep6.py | Python | mit | 2,599 | 0.014236 |
# Copyright (C) 2015 – 2021 Noa-Emil Nissinen (4shadoww)
from core.hakkuframework import *
from core import getpath
import http.client
import socket
conf = {
"name": "apache_users", # Module's name (should be same as file's name)
"version": "1.1", # Module version
"shortdesc": "scan directory of apache us... | 4shadoww/usploit | modules/apache_users.py | Python | mit | 1,754 | 0.005137 |
from __future__ import unicode_literals
from django.apps import AppConfig
class MergeserverConfig(AppConfig):
name = 'MergeServer'
| zeqing-guo/SPAKeyManager | MergeServer/apps.py | Python | gpl-3.0 | 138 | 0 |
##
# Copyright 2009-2013 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... | ULHPC/modules | easybuild/easybuild-easyblocks/easybuild/easyblocks/f/fastqc.py | Python | mit | 1,735 | 0.002882 |
# -*- coding: utf-8 -*-
"""
plotting.py
Part of douglib. Used for general data plotting.
Created on Tue June 06 08:44:12 2014
@author: dthor
"""
# ---------------------------------------------------------------------------
### Imports
# ----------------------------------------------------------------------... | dougthor42/douglib | douglib/plotting.py | Python | mit | 1,474 | 0.000678 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# *************************************... | elijah513/ice | scripts/TestController.py | Python | gpl-2.0 | 3,512 | 0.008827 |
import warnings
from xigt.consts import (
ID,
TYPE,
ALIGNMENT,
CONTENT,
SEGMENTATION
)
from xigt.errors import (
XigtError,
XigtStructureError
)
from xigt.ref import id_re
# list.clear() doesn't exist in Python2, but del list[:] has other problems
try:
[].clear
except AttributeError:
... | goodmami/xigt | xigt/mixins.py | Python | mit | 9,014 | 0.000888 |
"""
# A Better Where
WHERE2 is a near-linear time top-down clustering alogithm.
WHERE2 updated an older where with new Python tricks.
## Standard Header Stuff
"""
from __future__ import division, print_function
from pdb import set_trace
import sys
import types
from demos import *
from libWhere import *
from nas... | ai-se/Tree-Learner | _imports/where2.py | Python | unlicense | 11,309 | 0.02131 |
# Exercise 16: Reading and Writing Files
from sys import argv
script, filename = argv
print "We're going to erase %r." % filename
print "If you don't want that, hit CTRL-C (^C)."
print "If you do want that, hit RETURN."
raw_input("?")
print "Opening the file..."
target = open(filename, 'w')
print "Truncating the f... | paulcarroty/Learn-Python-The-Hard-Way | ex16.py | Python | gpl-3.0 | 740 | 0 |
import unittest
class StringProcessingTestBase(unittest.TestCase):
# The backslash character. Needed since there are limitations when
# using backslashes at the end of raw-strings in front of the
# terminating " or '.
bs = "\\"
# Basic test strings all StringProcessing functions should test.
... | yland/coala | tests/parsing/StringProcessing/StringProcessingTestBase.py | Python | agpl-3.0 | 5,848 | 0.000171 |
# -*- coding: utf-8 -*-
import os
import KBEngine
from KBEDebug import *
def onBaseAppReady(isBootstrap):
"""
KBEngine method.
baseapp已经准备好了
@param isBootstrap: 是否为第一个启动的baseapp
@type isBootstrap: BOOL
"""
INFO_MSG('onBaseAppReady: isBootstrap=%s, appID=%s, bootstrapGroupIndex=%s, bootstrapGlobalIndex=%s' % \
... | dreamsxin/kbengine | assets/scripts/base/kbemain.py | Python | lgpl-3.0 | 2,796 | 0.051105 |
'''
This module controls the dialog to set filter criteria
'''
from PyQt5 import QtCore, Qt, QtWidgets
from views.filter_dialog import Ui_FilterDialog
class FilterGamesController(QtWidgets.QDialog):
'''
Controller object for the filter games dialog.
'''
def __init__(self, table, parent=None):
... | pablosuau/pyBacklogger | controllers/filter_games_controller.py | Python | gpl-2.0 | 7,069 | 0.002405 |
from interface.design.ui_screen import Ui_wnd_gifextract
from PyQt5 import QtWidgets
import sys
import listener
import config
import ffmpeg
import queue
import interface.menus.Frame_CreateGif
import interface.menus.Frame_ExtractFrames
import interface.menus.Frame_Queue
class Screen(QtWidgets.QMainWindow):
def ... | KaiAPaulhus/GifExtract | src/alpha.py | Python | mit | 1,716 | 0.003497 |
#
# Copyright 2007 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 ve... | miurahr/translate | translate/convert/ical2po.py | Python | gpl-2.0 | 4,527 | 0.000884 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.