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 |
|---|---|---|---|---|---|---|
#!/usr/bin/python
#
# 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
# (at your option) any later version.
#
# Ansible is distribut... | welex91/ansible-modules-core | network/nxos/nxos_facts.py | Python | gpl-3.0 | 7,749 | 0.000645 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pymongo
from pymongo import MongoClient
from pymongo import errors
import re
class Database(object):
'''Database creation'''
def __init__(self, database_name):
self.client = MongoClient('mongodb://localhost,localhost:27017')
self.db_name = database_name
sel... | c24b/mango | database.py | Python | apache-2.0 | 5,004 | 0.034579 |
import numbers
import numpy as np
from scipy.stats.distributions import randint
from scipy.stats.distributions import rv_discrete
from scipy.stats.distributions import uniform
from sklearn.utils import check_random_state
from sklearn.utils.fixes import sp_version
from .transformers import CategoricalEncoder
from .tr... | ccauet/scikit-optimize | skopt/space/space.py | Python | bsd-3-clause | 21,426 | 0.000047 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
T... | azumimuo/family-xbmc-addon | plugin.video.salts/scrapers/filmikz_scraper.py | Python | gpl-2.0 | 4,359 | 0.004818 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
# Copyright (C) 2013 Rackspace Hosting 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 ... | pombredanne/taskflow-1 | taskflow/utils/misc.py | Python | apache-2.0 | 20,033 | 0.00005 |
# Copyright (c) 2012 - 2014 EMC 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
#
# Unle... | jumpstarter-io/cinder | cinder/volume/drivers/emc/emc_vmax_common.py | Python | apache-2.0 | 94,140 | 0 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | SHH_WT_models/SHH_WT_models_final_output_0.1_-0.1_11000/mtx1_models/SHH_WT_models11760.py | Python | gpl-3.0 | 17,567 | 0.025104 |
import pytest
from dvc.env import DVC_PAGER
from dvc.ui.pager import (
DEFAULT_PAGER,
LESS,
PAGER_ENV,
find_pager,
make_pager,
pager,
)
@pytest.fixture(autouse=True)
def clear_envs(monkeypatch):
monkeypatch.delenv(DVC_PAGER, raising=False)
monkeypatch.delenv(PAGER_ENV, raising=False)
... | efiop/dvc | tests/unit/ui/test_pager.py | Python | apache-2.0 | 2,747 | 0 |
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Mirantis/solar | solar/utils.py | Python | apache-2.0 | 3,496 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the EWF image path specification implementation."""
import unittest
from dfvfs.path import ewf_path_spec
from tests.path import test_lib
class EwfPathSpecTest(test_lib.PathSpecTestCase):
"""Tests for the EWF image path specification implementation."""
def... | manashmndl/dfvfs | tests/path/ewf_path_spec.py | Python | apache-2.0 | 1,121 | 0.005352 |
"""VASP POSCAR format."""
import numpy as np
__all__ = ["write_poscar"]
def write_poscar(
compound,
filename,
lattice_constant,
bravais=[[1, 0, 0], [0, 1, 0], [0, 0, 1]],
sel_dev=False,
coord="cartesian",
):
"""Write a VASP POSCAR file from a Compound.
See //https://www.vasp.at formo... | iModels/mbuild | mbuild/formats/vasp.py | Python | mit | 2,953 | 0 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import sys
import time
import subprocess
# Import parameters from the setup file.
sys.path.append('.')
from setup import (
setup_dict, get_project_files, print_success_message,
print_failure_message, _lint, _test, _test_all,
CODE_DIR... | hgranlund/py-chess-engine | pavement.py | Python | mit | 7,367 | 0.000814 |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 1 17:14:20 2016
@author: stephaniekwan
Plot prominent emission lines of IC 10 X-2 from TripleSpec chop-subtracted
data. He I and Pa-Gamma lines fit on one plot, Pa-Beta line goes in a separate
plot (comment/uncomment blocks to plot each set).
"""
import numpy as np
im... | skkwan/IC10X2 | palomar/TSpec_reductions/TSpec basic plot.py | Python | mit | 2,508 | 0.05303 |
# Copyright 2018 Open Source Robotics Foundation, 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... | ros2/launch | launch/doc/source/conf.py | Python | apache-2.0 | 6,246 | 0 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy... | stdweird/aquilon | lib/python2.6/aquilon/worker/anonwrappers.py | Python | apache-2.0 | 2,216 | 0.000451 |
# Copyright 2013 Virgil Dupras (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package.
import os.path as op
from urllib.request import urlopen
import subprocess
import json
from bs4 import BeautifulSoup
HERE =... | hsoft/aurdiff | update.py | Python | bsd-3-clause | 2,337 | 0.003851 |
class Solution:
# @param nums: a list of integers
# @return: an integer
def findMissing(self, nums):
# write your code here
n = len(nums)
return n * (n + 1) / 2 - sum(nums)
| Chasego/cod | lintcode/268-[DUP]-Find-the-Missing-Number/FindtheMissingNumber_001.py | Python | mit | 209 | 0 |
from navmazing import NavigateToAttribute, NavigateToSibling
from widgetastic.utils import (Parameter, ParametrizedLocator, ParametrizedString, Version,
VersionPick)
from widgetastic.widget import Checkbox, Table, Text, View
from widgetastic_manageiq import FileInput, SummaryForm, SummaryTable
from widgetastic_patt... | jkandasa/integration_tests | cfme/services/catalogs/ansible_catalog_item.py | Python | gpl-2.0 | 16,192 | 0.002347 |
#!/usr/bin/python
import json
import tempfile
import re
import traceback
DOCUMENTATION = '''
---
module: openshift_resource
short_description: Creates and patches OpenShift resources.
description:
- Creates and patches OpenShift resources idempotently
- based on template or strategic merge patch.
options:
names... | appuio/ansible-role-openshift-zabbix-monitoring | vendor/ansible-module-openshift/library/openshift_resource.py | Python | apache-2.0 | 9,578 | 0.01493 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012-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, or (at your option) any later version.
# This program is distributed ... | jhdulaney/dnf | tests/support.py | Python | gpl-2.0 | 20,691 | 0.000242 |
from __future__ import unicode_literals
__version__ = '2016.01.09'
| Hakuba/youtube-dl | youtube_dl/version.py | Python | unlicense | 68 | 0 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a dialog to enter the data for a copy or rename operation.
"""
from __future__ import unicode_literals
import os.path
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QDialog, QDia... | testmana2/test | Plugins/VcsPlugins/vcsMercurial/HgCopyDialog.py | Python | gpl-3.0 | 2,379 | 0.004203 |
import numpy as np
import theano
import theano.tensor as T
import pickle
import timeit
import os.path
import sys
class MultiNomialLR(object):
def __init__(self, in_dim, out_dim):
self.W = theano.shared(
np.zeros((out_dim, in_dim), dtype=np.float64),
name="W",
borrow=True... | seaglex/garden | learn_theano/tradition/lr.py | Python | gpl-3.0 | 5,860 | 0.003413 |
# type command prints file contents
from lib.utils import *
def _help():
usage = '''
Usage: cat (file)
Print content of (file)
Use '%' in front of global
vars to use value as file
name.
'''
print(usage)
def main(argv):
if len(argv) < 1 or '-h' in argv:
_help()
return
# The shell d... | nayas360/pyterm | bin/cat.py | Python | mit | 1,001 | 0 |
#######################################################################################################################
# Copyright (C) 2016 Regents of the University of California
#
# This is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License (GNU GPL) as publi... | ProjectIDA/ical | gui/analysis_progress_window.py | Python | gpl-3.0 | 4,458 | 0.005384 |
# -*- 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-dialogflow-cx | samples/generated_samples/dialogflow_v3_generated_entity_types_list_entity_types_sync.py | Python | apache-2.0 | 1,518 | 0.000659 |
from gi.repository import Gtk
import os
from gi.repository import GObject
import shutil
from decimal import *
from gettext import gettext as _
from documentviewercommonutils import DocumentViewerCommonUtils
from utils import is_machine_a_xo
from epubview.epub import _Epub
from epubview.webkitbackend import Browser
TO... | activitycentral/ebookreader | src/ReadTab/epubadapter.py | Python | gpl-2.0 | 17,071 | 0.002285 |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2006-2015 chimera - observatory automation system
# 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 Li... | agati/chimera | src/chimera/instruments/sk/tests/skdrv_OK_25062015.py | Python | gpl-2.0 | 8,467 | 0.006614 |
# Copyright (c) 2016 PaddlePaddle 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 applic... | QiJune/Paddle | python/paddle/dataset/tests/flowers_test.py | Python | apache-2.0 | 1,707 | 0.000586 |
#!/usr/bin/python
import sys
import lib.ssh_helper as ssh
host = sys.argv[1]
blade = sys.argv[2]
pw = ssh.prompt_password(host)
chan, sess = ssh.get_channel(host, pw)
# Eat the initial welcome text
ssh.get_output(chan)
ssh.run(chan, 'tcpcmdmode -t 3600 -T system:mm[0]')
ssh.run(chan, 'env -T system:blade[' + blade ... | mjcollin/ibm_bladecenter | bc_boot_revert.py | Python | mit | 393 | 0 |
from unittest import TestCase
from melta.transactions.transactional import Transaction
class TransactionTestClass(Transaction):
def __init__(self):
self.plant_type = 'Pointisera'
self.plant_age = 3
self.plant_pot = 'plastic'
self.combination = 'one\ntwo\nthree'
class Transactiona... | bossiernesto/melta | test/transactions/test_transactional.py | Python | bsd-3-clause | 1,365 | 0.002198 |
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'SliderItem'
db.create_table('hero_slider_slideritem', (
('id', se... | bitmazk/django-hero-slider | hero_slider/south_migrations/0001_initial.py | Python | mit | 9,348 | 0.007916 |
from SimpleCV import Image
import time
# Get the template and image
goBoard = Image('go.png')
black = Image('go-black.png')
black.show()
time.sleep(3)
goBoard.show()
time.sleep(3)
# Find the matches and draw them
matches = goBoard.findTemplate(black)
matches.draw()
# Show the board with matches print the number
goB... | vizcacha/practicalcv | chapter_10/find-black-pieces.py | Python | mit | 426 | 0.002347 |
# $Id: tns.py 23 2006-11-08 15:45:33Z dugsong $
# -*- coding: utf-8 -*-
"""Transparent Network Substrate."""
import dpkt
class TNS(dpkt.Packet):
__hdr__ = (
('length', 'H', 0),
('pktsum', 'H', 0),
('type', 'B', 0),
('rsvd', 'B', 0),
('hdrsum', 'H', 0),
('msg', '0s'... | lkash/test | dpkt/tns.py | Python | bsd-3-clause | 1,079 | 0.000927 |
#! /usr/bin/env python
import utility_function as uf
import sys
import cv2
import numpy as np
def read_file_list(file_name):
# assume the first argument is the image name and the second one is the label
name_list = list()
label_list = list()
with open(file_name, "r") as f:
s = f.read()
... | polltooh/FineGrainedAction | nn/cal_accuracy_v3.py | Python | mit | 2,845 | 0.003866 |
# clean sequences after alignment, criteria based on sequences
# make inline with canonical ordering (no extra gaps)
import os, datetime, time, re
from itertools import izip
from Bio.Align import MultipleSeqAlignment
from Bio.Seq import Seq
from scipy import stats
import numpy as np
class virus_clean(object):
"""doc... | doerlbh/Indie-nextflu | augur/src/virus_clean.py | Python | agpl-3.0 | 3,403 | 0.033206 |
import unittest, os
from mock import Mock, patch, call, sentinel
from tests.ditest import DependencyInjectionTestBase
class AddTests(DependencyInjectionTestBase):
def setUp(self):
super(AddTests, self).setUp()
self.config.dryrun = False
self.repo.byLocation.return_value = None
sel... | ilogue/niprov | tests/test_add.py | Python | bsd-3-clause | 7,954 | 0.001886 |
#!/usr/bin/env python
#coding:utf-8
##
# @file argv-test.py
# @brief
# 最底层的命令行解析,其他模块应该都是对其的封装
# @author unlessbamboo
# @version 1.0
# @date 2016-03-03
import sys
def testSys():
"""testSys"""
for arg in sys.argv[1:]:
print (arg)
if __name__ == '__main__':
testSys()
| unlessbamboo/grocery-shop | language/python/src/command-line/argv-test.py | Python | gpl-3.0 | 347 | 0.006645 |
"""The AEMET OpenData component."""
import asyncio
import logging
from aemet_opendata.interface import AEMET
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
from homeassistant.core import HomeAssistant
from .const import COMP... | turbokongen/home-assistant | homeassistant/components/aemet/__init__.py | Python | apache-2.0 | 1,866 | 0.002144 |
# This file is part of FreePC.
#
# FreePC 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.
#
# FreePC is distributed in the hope that ... | vonkarmaninstitute/FreePC | server/restriction_system/utils.py | Python | gpl-3.0 | 5,215 | 0.025503 |
# Copyright 2016 Bridgewater Associates
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | stackArmor/security_monkey | security_monkey/auditors/vpc/vpc.py | Python | apache-2.0 | 1,852 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import mptt.fields
import uchicagohvz.overwrite_fs
from django.conf import settings
import django.utils.timezone
import uchicagohvz.game.models
class Migration(migrations.Migratio... | kz26/uchicago-hvz | uchicagohvz/game/dorm_migrations/0001_initial.py | Python | mit | 11,763 | 0.003996 |
class C:
def foo(self):
x = 1
y = 2
x = 1
def foo():
pass | akosyakov/intellij-community | python/testData/copyPaste/singleLine/IndentOnTopLevel.after.py | Python | apache-2.0 | 83 | 0.024096 |
#! /usr/bin/python3
# -*- coding:utf-8 -*-
"""
Define the "status" sub-command.
"""
from lib.transaction import *
from lib.color import color
import sys
import yaml
def status(conf, args):
"""Print staging transactions.
"""
if not conf:
# The account book is not inited
print("There is n... | a2ohm/picsou | sub/status.py | Python | gpl-3.0 | 1,333 | 0.003751 |
import os
import sys
import nose
from subprocess import CalledProcessError, check_output as run
from functools import partial
GJSLINT_COMMAND = 'gjslint'
GJSLINT_OPTIONS = ['--strict']
JS_BASE_FOLDER = os.path.join('skylines', 'public', 'js')
JS_FILES = [
'baro.js',
'fix-table.js',
'flight.js',
'gen... | dkm/skylines | skylines/tests/test_gjslint.py | Python | agpl-3.0 | 1,110 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import downloads.models
import base.storage
import base.models
from django.conf import settings
import problems.models
import sortedm2m.fields
class Migration(migrations.Migration):
dependencies = [
... | rtrembecky/roots | problems/migrations/0001_initial.py | Python | mit | 12,637 | 0.00459 |
#%% Libraries: Built-In
from copy import deepcopy as copy
import pandas as pd
import numpy as np
from datetime import datetime as dt
from datetime import timedelta as td
#% Libraries: Custom
from Clusters.Data import DataCluster
from Clusters.ClusterGroup import ClusterGroup
#%%
class NetworkController(object):
def... | Calvinxc1/neural_nets | Controller.py | Python | gpl-3.0 | 7,833 | 0.010596 |
import speech_recognition as sr
# Obtain audio from the microphone
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say something!")
audio = r.listen(source, phrase_time_limit=5)
# Recognize using wit.ai
WIT_AI_KEY = "GP3LO2LIQ2Y4OSKOXZN6OAOONB55ZLN5"
try:
print("wit.ai thinks you said " + r.recognize_w... | amlannayak/apollo | src/mic_test.py | Python | gpl-3.0 | 521 | 0.015355 |
#!/usr/bin/env python
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import messagebird
ACCESS_KEY = 'test_gshuPaZoeEG6ovbc8M79w0QyM'
try:
# Create a MessageBird client with the specified ACCESS_KEY.
client = messagebird.Client(ACCESS_KEY)
# Send a new voice message.
vmsg = c... | messagebird/python-rest-api | examples/voice_message_create.py | Python | bsd-2-clause | 1,444 | 0.018006 |
# -*- coding: utf-8 -*-
# vim:set noet ts=4:
#
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2009 Hideaki ABE <abe.sendai@gmail.com>
# Copyright (c) 2007-2011 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modif... | pkg-ime/ibus-anthy | setup/anthyprefs.py | Python | gpl-2.0 | 30,030 | 0.01582 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'QuestionGroup.allow_multiples'
db.add_column(u'questionnaire_questiongroup', 'allow_multiple... | testvidya11/ejrf | questionnaire/migrations/0025_auto__add_field_questiongroup_allow_multiples.py | Python | bsd-3-clause | 17,416 | 0.007407 |
#!/usr/bin/env python3
import argparse
import requests
import time
import datetime
import random
# import pymysql
from connections import hostname, username, password, portnumber, database
class MarketKuCoin(object):
# Set variables for API String.
domain = "https://api.kucoin.com"
url = ""
uri = ""
... | infectiious/Pharaoh_script | Markets/KuCoin/kucoin_api.py | Python | mit | 1,648 | 0.01517 |
"""Utilities for working with schemas"""
import json
import keyword
import pkgutil
import re
import textwrap
import jsonschema
EXCLUDE_KEYS = ('definitions', 'title', 'description', '$schema', 'id')
def load_metaschema():
schema = pkgutil.get_data('schemapi', 'jsonschema-draft04.json')
schema = schema.dec... | ellisonbg/altair | tools/schemapi/utils.py | Python | bsd-3-clause | 12,696 | 0.001024 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/wearables/pants/shared_pants_s14.iff"
result.attribute_template_id =... | anhstudios/swganh | data/scripts/templates/object/tangible/wearables/pants/shared_pants_s14.py | Python | mit | 478 | 0.031381 |
# Copyright 2019 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | Azure/WALinuxAgent | tests/common/osutil/test_clearlinux.py | Python | apache-2.0 | 1,180 | 0.000847 |
import pytest
import sys
sys.path.append("../src/")
import cryspy
from cryspy.fromstr import fromstr as fs
import numpy as np
def test_Karussell():
metric = cryspy.geo.Cellparameters(1, 1, 1, 90, 90, 90).to_Metric()
k = cryspy.utils.Karussell(metric, fs("d 1 0 0"), fs("d 0 1 0"))
d1 = k.direction(0)
a... | cryspy-team/cryspy | tests/test_utils.py | Python | gpl-3.0 | 1,181 | 0.005927 |
from actstream.models import Action
from django.test import TestCase
from cyidentity.cyfullcontact.tests.util import create_sample_contact_info
class FullContactActivityStreamTestCase(TestCase):
def test_contact_create(self):
contact_info = create_sample_contact_info()
action = Action.objects.acto... | shawnhermans/cyborgcrm | cyidentity/cyfullcontact/tests/test_activity_stream.py | Python | bsd-2-clause | 433 | 0 |
# coding:utf-8
"""
Author : qbeenslee
Created : 2014/12/12
"""
import re
# 客户端ID号
CLIENT_ID = "TR5kVmYeMEh9M"
'''
传输令牌格式
加密方式$迭代次数$盐$结果串
举个栗子:
====start====
md5$23$YUXQ_-2GfwhzVpt5IQWp$3ebb6e78bf7d0c1938578855982e2b1c
====end====
'''
MATCH_PWD = r"md5\$(\d\d)\$([a-zA-Z0-9_\-]{20})\$([a-f0-9]{32}... | qbeenslee/Nepenthes-Server | config/configuration.py | Python | gpl-3.0 | 1,315 | 0.001668 |
#!/usr/bin/python
import argparse
from board_manager import BoardManager
from constants import *
def main():
parser = argparse.ArgumentParser(description='Board client settings')
parser.add_argument('-sp', '--PORT', help='server port', type=int,
default=80, required=False)
parser.... | TeamProxima/predictive-fault-tracker | board/board_client.py | Python | mit | 909 | 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... | GJL/flink | flink-python/pyflink/dataset/tests/test_execution_environment_completeness.py | Python | apache-2.0 | 3,235 | 0.004019 |
#!/usr/bin/env python3
from pathlib import Path
import pprint
pp = pprint.PrettyPrinter()
import logging
log = logging.getLogger(__name__)
def main():
p = Path('particles.txt')
if p.exists() and p.is_file():
parse(str(p))
def parse(filepath):
raw = ''
try:
with open(filepath) as f:
... | klingtnet/dh-project-ws14 | data/particle_parser.py | Python | mit | 1,420 | 0.005634 |
import abc
from sqlalchemy.orm import exc
from watson.auth import crypto
from watson.auth.providers import exceptions
from watson.common import imports
from watson.common.decorators import cached_property
class Base(object):
config = None
session = None
def __init__(self, config, session):
self.... | watsonpy/watson-auth | watson/auth/providers/abc.py | Python | bsd-3-clause | 3,673 | 0.000272 |
# Copyright 2014 IBM Corp.
#
# 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 ... | sebrandon1/nova | nova/tests/unit/virt/hyperv/test_vmops.py | Python | apache-2.0 | 76,595 | 0.000052 |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from broadcasts.models import BroadcastMessage
from broadcasts.forms import BroadcastMessageForm
class BroadcastAdmin(admin.ModelAdmin):
"""Admin class for the broadcast messages"""
form = BroadcastMessageForm
list_d... | Natgeoed/django-broadcasts | broadcasts/admin.py | Python | mit | 1,181 | 0.001693 |
#!/usr/bin/env python
__description__ = 'Tool to test a PDF file'
__author__ = 'Didier Stevens'
__version__ = '0.2.1'
__date__ = '2014/10/18'
"""
Tool to test a PDF file
Source code put in public domain by Didier Stevens, no Copyright
https://DidierStevens.com
Use at your own risk
History:
2009/03/27: start
20... | Dymaxion00/KittenGroomer | fs_filecheck/usr/local/bin/pdfid.py | Python | bsd-3-clause | 37,276 | 0.004614 |
from math import isclose
import numpy as np
from pytest import fixture
from hoomd.box import Box
@fixture
def box_dict():
return dict(Lx=1, Ly=2, Lz=3, xy=1, xz=2, yz=3)
def test_base_constructor(box_dict):
box = Box(**box_dict)
for key in box_dict:
assert getattr(box, key) == box_dict[key]
@... | joaander/hoomd-blue | hoomd/pytest/test_box.py | Python | bsd-3-clause | 5,889 | 0.00017 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import argparse
from configparser import SafeConfigParser
class Configurable(object):
"""
Configuration processing for the network
"""
def __i... | Impavidity/text-classification-cnn | configurable.py | Python | mit | 4,672 | 0.026327 |
import socket
import threading
bind_ip = ""
bind_port = 60007
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((bind_ip, bind_port))
server.listen(5)
print("[*] Listening on %s:%d" % (bind_ip, bind_port))
def handle_client(client_socket):
request = client_socket.recv(1024).decode()
p... | xieyajie/BackHatPython | backhatpython02/server-tcp.py | Python | apache-2.0 | 707 | 0.001414 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
def get_color(color):
if 'default'==color:
return '\x1b[39;01m'
elif 'black'==color:
return '\x1b[30;01m'
elif 'red'==color:
return '\x1b[31;01m'
elif 'green'==color:
return ... | 0x47d/atd.id | src/print.py | Python | gpl-3.0 | 989 | 0.026342 |
#(c) 2016 by Authors
#This file is a part of ABruijn program.
#Released under the BSD license (see LICENSE file)
"""
Runs polishing binary in parallel and concatentes output
"""
from __future__ import absolute_import
from __future__ import division
import logging
import subprocess
import os
from collections import de... | fenderglass/ABruijn | flye/polishing/polish.py | Python | bsd-3-clause | 11,547 | 0.002598 |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design 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:
#
# * Redistrib... | chippey/gaffer | python/GafferTest/ArrayPlugTest.py | Python | bsd-3-clause | 12,836 | 0.064194 |
import simplejson as json, os
from sklearn.decomposition import PCA
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from kettle.utils import get_beers
import numpy as np
class BeerMLData(list):
def __init__(self):
self.proj = None
self.arr = None
self.beer_map... | hacktobacillus/fermenter | kettle/scripts/formatData.py | Python | mit | 5,376 | 0.013207 |
from django import test
from model_bakery import baker
from devilry.apps.core.models import AssignmentGroup
from devilry.devilry_dbcache.customsql import AssignmentGroupDbCacheCustomSql
from devilry.devilry_cradmin.devilry_listfilter.assignmentgroup import ExaminerCountFilter, CandidateCountFilter
class TestExamine... | devilry/devilry-django | devilry/devilry_cradmin/tests/test_devilry_listfilter/test_assignmentgroup_listfilter.py | Python | bsd-3-clause | 21,241 | 0.000047 |
'''
http://jsfiddle.net/nvYZ8/1/
'''
from functionChecker import functionChecker
functionChecker("schedulePrioritizer.py", "getAllPossibleSchedules")
"function name: getNonOverlappingRanges"
"requires functions: containsOverlappingRanges, overlapsWithOthers(theArr,theIndex)"
"is defined: True"
"description: Return... | jarble/EngScript | libraries/schedulePrioritizer.py | Python | mit | 2,752 | 0.015262 |
from django.template import TemplateDoesNotExist
from django.test import (
Client, RequestFactory, SimpleTestCase, override_settings,
)
from django.utils.translation import override
from django.views.csrf import CSRF_FAILURE_TEMPLATE_NAME, csrf_failure
@override_settings(ROOT_URLCONF='view_tests.urls')
class Csrf... | auready/django | tests/view_tests/tests/test_csrf.py | Python | bsd-3-clause | 4,007 | 0.000749 |
#!/usr/bin/env python
# Based on previous work by
# Charles Menguy (see: http://stackoverflow.com/questions/10217067/implementing-a-full-python-unix-style-daemon-process)
# and Sander Marechal (see: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/)
# Adapted by M.Hendrix [2015] (deprecated)... | Mausy5043/ubundiagd | daemon15.py | Python | mit | 4,996 | 0.015212 |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
#!/usr/bin/python
OBJECTS_NUM = 100
# setup environment
import sys, os
sys.path.append('../')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.core.management import setup_environ
from treeio... | rogeriofalcone/treeio | script/testmodel.py | Python | mit | 810 | 0.008642 |
import unittest
import numpy as np
from chainer import testing
from chainercv.utils import generate_random_bbox
from chainercv.visualizations import vis_bbox
try:
import matplotlib # NOQA
_available = True
except ImportError:
_available = False
@testing.parameterize(
*testing.product_dict([
... | chainer/chainercv | tests/visualizations_tests/test_vis_bbox.py | Python | mit | 4,256 | 0 |
"""Kernel K-means"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# License: BSD 3 clause
import logging
import numpy as np
from sklearn.base import BaseEstimator, ClusterMixin
from sklearn.metrics.pairwise import pairwise_kernels
from sklearn.utils import check_random_state
logger = logging.getLogger(__name__)... | kylemvz/magichour-old | StringKernel/kernel_kmeans.py | Python | apache-2.0 | 4,707 | 0.002337 |
import collections
import io
import itertools
from ..mkExceptions import BadProQuestRecord, RecordsNotCompatible
from ..mkRecord import ExtendedRecord
from .tagProcessing.specialFunctions import proQuestSpecialTagToFunc
from .tagProcessing.tagFunctions import proQuestTagToFunc
class ProQuestRecord(ExtendedRecord):
... | networks-lab/metaknowledge | metaknowledge/proquest/recordProQuest.py | Python | gpl-2.0 | 4,491 | 0.006903 |
# -*- coding: utf-8 -*-
"""Package for suites and tests related to bots.modules package"""
import pytest
from qacode.core.bots.modules.nav_base import NavBase
from qacode.core.exceptions.core_exception import CoreException
from qacode.core.testing.asserts import Assert
from qacode.core.testing.test_info import TestIn... | netzulo/qacode | tests/001_functionals/suite_004_navbase.py | Python | gpl-3.0 | 16,880 | 0 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_fiscal_icnfefetuarpagamento.ui'
#
# Created: Mon Nov 24 22:25:57 2014
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
from pydaruma.pydaruma i... | edineicolli/daruma-exemplo-python | scripts/fiscal/ui_fiscal_icnfefetuarpagamento.py | Python | gpl-2.0 | 5,558 | 0.0036 |
"""ACME client API."""
import collections
import datetime
import heapq
import logging
import time
import six
from six.moves import http_client # pylint: disable=import-error
import OpenSSL
import requests
import sys
import werkzeug
from acme import errors
from acme import jose
from acme import jws
from acme import ... | twstrike/le_for_patching | acme/acme/client.py | Python | apache-2.0 | 23,969 | 0.000167 |
"""Suite WorldWideWeb suite, as defined in Spyglass spec.:
Level 1, version 1
Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2
AETE/AEUT resource version 1/0, language 0, script 0
"""
import aetools
import MacOS
_code = 'WWW!'
class Worl... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.3/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py | Python | mit | 16,104 | 0.005899 |
#!/usr/bin/python -u
#
# Application Monitoring (version 1.5)
# Alejandro Calderon @ ARCOS.INF.UC3M.ES
# GPL 3.0
#
import math
import time
import psutil
import threading
import multiprocessing
import subprocess
import os
import sys
import getopt
import json
def print_record ( format, data ):
try:
... | acaldero/moon | app-mon.py | Python | gpl-3.0 | 5,026 | 0.015519 |
"""
Tests for functionality in the utils module
"""
import platform
import unittest
import mock
import queries
from queries import utils
class GetCurrentUserTests(unittest.TestCase):
@mock.patch('pwd.getpwuid')
def test_get_current_user(self, getpwuid):
"""get_current_user returns value from pwd.g... | gmr/queries | tests/utils_tests.py | Python | bsd-3-clause | 4,097 | 0 |
from __future__ import print_function
from ed2d.cmdargs import CmdArgs
debugEnabled = CmdArgs.add_arg('debug', bool, 'Enable debug output.')
def debug(*args):
if debugEnabled:
print(*args)
| explosiveduck/ed2d | ed2d/debug.py | Python | bsd-2-clause | 203 | 0.004926 |
file = open('input.txt')
instructions = []
for line in file.readlines():
instructions.append(line.replace(',', '').strip().split(' '))
regs = {
'a': 0,
'b': 0
}
ptr = 0
while True:
if ptr not in range(len(instructions)):
break
instr = instructions[ptr]
inst, r = instr[0], instr[1]
... | mstoppert/adventofcode | 23/answer.py | Python | mit | 728 | 0.005495 |
#!/usr/bin/python3
import random
import copy
import enum
import jsonpickle
import pickle
import argparse
from sharedlib import Attr, Card, Config
import json
class Die:
def __init__(self, attack, defense, magic, mundane, numSides=12):
self.attack = attack
self.defense = defense
self.magic = magic
self.mundane... | psywolf/cardfight | cardfight.py | Python | gpl-3.0 | 6,620 | 0.033384 |
#!/usr/bin/env python
import unittest
from day04 import find_integer
class Test(unittest.TestCase):
cases = (
('abcdef', 609043),
('pqrstuv', 1048970),
)
def test_gets_integer(self):
for (key, expected) in self.cases:
result = find_integer(key, zeroes=5)
... | mpirnat/adventofcode | day04/test.py | Python | mit | 521 | 0.005758 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | gfsa/model/edge_supervision_models_test.py | Python | apache-2.0 | 8,558 | 0.00187 |
# coding: utf-8
from smarthumb import SMARTHUMB
from gluon.contrib.imageutils import RESIZE
# Noticias
db.noticias.titulo.requires = [
IS_NOT_EMPTY(error_message=T('Este campo não pode ficar vazio!')),
IS_NOT_IN_DB(db, db.noticias.titulo,
error_message=T('Título deve ser único.')),
IS_LENG... | pvsousalima/marolo | models/20_validators.py | Python | mit | 6,559 | 0 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | alexgorban/models | research/object_detection/core/box_list_ops.py | Python | apache-2.0 | 43,889 | 0.004124 |
"""Tests for Gosper's algorithm for hypergeometric summation. """
from sympy import binomial, factorial, gamma, Poly, S, simplify, sqrt, exp, log, Symbol
from sympy.abc import a, b, j, k, m, n, r, x
from sympy.concrete.gosper import gosper_normal, gosper_sum, gosper_term
def test_gosper_normal():
assert gosper_n... | hrashk/sympy | sympy/concrete/tests/test_gosper.py | Python | bsd-3-clause | 7,307 | 0.002053 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from .common import PurchaseTestCommon
from odoo.addons.stock_account.tests.common import StockAccountTestCommon
from odoo.tests import Form
class TestFifoPrice(PurchaseTestCommon, StockAccountTestCommon):
... | ygol/odoo | addons/purchase_stock/tests/test_fifo_price.py | Python | agpl-3.0 | 16,403 | 0.002744 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Windows API functions."""
import ctypes
import os
import sys
from ctypes import WinError, wintypes
from colorise.win.winhandle import WinHandle
# Create a separate WinDLL instance since the one from ctypes.windll.kernel32
# can be manipulated by other code that also ... | MisanthropicBit/colorise | src/colorise/win/win32_functions.py | Python | bsd-3-clause | 10,715 | 0 |
import asyncio
import uvloop
from aioactor.transports import NatsTransport
from aioactor.service import Service
from aioactor.broker import ServiceBroker
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
# TODO ADD possible actions list!
# TODO ADD abstractions to Message Handler!
# MessageHandler must be able t... | iZonex/aioactor | examples/accounts/app.py | Python | apache-2.0 | 1,531 | 0 |
#!/usr/bin/env python3
# Copyright (c) 2016-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test Hierarchical Deterministic wallet function."""
import os
import shutil
from test_framework.test_... | qtumproject/qtum | test/functional/wallet_hd.py | Python | mit | 7,811 | 0.005121 |
from django.test import TestCase
from django.core.urlresolvers import reverse
from common.factories import UserFactory
import contacts as contact_constants
from contacts import factories
from contacts import models
class ContactModelTests(TestCase):
def setUp(self):
self.book = factories.BookFactory.crea... | phildini/logtacts | contacts/tests/test_models.py | Python | mit | 9,784 | 0.000511 |
"""The tests for the logbook component."""
# pylint: disable=protected-access,invalid-name
import collections
from datetime import datetime, timedelta
import json
import unittest
import pytest
import voluptuous as vol
from homeassistant.components import logbook, recorder
from homeassistant.components.alexa.smart_hom... | GenericStudent/home-assistant | tests/components/logbook/test_init.py | Python | apache-2.0 | 61,935 | 0.001405 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.