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 |
|---|---|---|---|---|---|---|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/job/models/job_information.py | Python | mit | 6,107 | 0.000655 |
def neighbors(node, all_nodes):
dirs = [[0, 1], [1, 0], [-1, 0], [0, -1]]
ddirs = [[1, 1], [1, -1], [-1, 1], [-1, -1]]
result = set()
# cdef bool x
for dir in dirs:
nx, ny = node[0] + dir[0], node[1] + dir[1]
try:
all_nodes[nx][ny]
except IndexError:
... | NiclasEriksen/importANT | pypf.py | Python | mit | 3,410 | 0 |
import demistomock as demisto
from CommonServerPython import BaseClient
import BitSightForSecurityPerformanceManagement as bitsight
from datetime import datetime
def test_get_companies_guid_command(mocker):
# Positive Scenario
client = bitsight.Client(base_url='https://test.com')
res = {"my_company": {"g... | demisto/content | Packs/BitSight/Integrations/BitSightForSecurityPerformanceManagement/BitSightForSecurityPerformanceManagement_test.py | Python | mit | 2,406 | 0.003325 |
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "Amazon Mechanical Turk"
prefix = "mechanicalturk"
class Action(BaseAction):
def __init__(self, action: str = None) -> ... | cloudtools/awacs | awacs/mechanicalturk.py | Python | bsd-2-clause | 4,190 | 0.000716 |
# Copyright 2015 Cisco Systems, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | Gitweijie/first_project | networking_cisco/db/migration/models/head.py | Python | apache-2.0 | 1,228 | 0 |
''' -- imports from python libraries -- '''
import os
import csv
import json
import ast
import time
import datetime
''' imports from installed packages '''
from django.core.management.base import BaseCommand, CommandError
from mongokit import IS
try:
from bson import ObjectId
except ImportError: # old pymongo
f... | AvadootNachankar/gstudio | gnowsys-ndf/gnowsys_ndf/ndf/management/commands/data_entry.py | Python | agpl-3.0 | 45,442 | 0.004577 |
from flask import Flask
from flask import make_response
from flask import request
from flask import render_template
from flask import redirect
from flask import url_for
import logging
from logging.handlers import RotatingFileHandler
app = Flask(__name__)
@app.route('/')
def index():
app.logger.info('index')
... | CoderDojoSG/todo | todo1/application.py | Python | apache-2.0 | 1,472 | 0.007473 |
class EmptyResult(object):
'''
Null Object pattern to prevent Null reference errors
when there is no result
'''
def __init__(self):
self.status = 0
self.body = ''
self.msg = ''
self.reason = ''
def __nonzero__(self):
return False
class HapiError(ValueEr... | jonathan-s/happy | happy/error.py | Python | apache-2.0 | 2,606 | 0.005372 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from bs4 import BeautifulSoup as bs
from sasila.system_normal.spider.spider_core import SpiderCore
from sasila.system_normal.pipeline.console_pipeline import ConsolePipeline
from sasila.system_normal.processor.base_processor import BaseProcessor
from sasila.sys... | DarkSand/Sasila | sasila/system_normal/processor/first_processor.py | Python | apache-2.0 | 1,026 | 0.000975 |
#############################################################################
# Copyright (c) 2010 by Casey Duncan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source c... | wrightjb/bolt-planar | transform.py | Python | bsd-3-clause | 12,182 | 0.002545 |
# Author: Abhishek Divekar, Jan 2016. Licence: Creative Commons.
import os
import sqlite3
import datetime
def get_conn(db_file_name):
#makes a new file if it does not exist
BASE_DIR = os.path.dirname(os.path.abspath(__file__)) #gets direcotry path in which file is stored.
db_path = os.path.join(BASE_DI... | ARDivekar/SearchDistribute | other/Legacy/sqliteDefaults.py | Python | mit | 9,396 | 0.038314 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-logic/azure/mgmt/logic/models/business_identity.py | Python | mit | 1,162 | 0 |
# -*- coding: utf-8 -*-
from peewee import *
import urllib
import tempfile
import os
from contextlib import contextmanager
from sshtunnel import SSHTunnelForwarder
import traceback
db = MySQLDatabase(
"cod", host="127.0.0.1", user="cod_reader", port=3308, connect_timeout=10000
)
# Get
# ssh wout@axil1.ua.ac.be... | woutdenolf/spectrocrunch | scraps/cod.py | Python | mit | 6,727 | 0.000743 |
from tests.base import TestBase
from pascal.program import Program
class TestVariables(TestBase):
def test_pass_valid_var(self):
file_name = "tests/mock_pas/all_var.pas"
pascal_program = Program(file_name)
pascal_program.run()
self.assertEqual(len(pascal_program.symbol_table), 7)
... | TheLampshady/pascompiler | tests/test_variables.py | Python | apache-2.0 | 537 | 0.001862 |
import _plotly_utils.basevalidators
class ShowlegendValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(self, plotly_name="showlegend", parent_name="cone", **kwargs):
super(ShowlegendValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/cone/_showlegend.py | Python | mit | 404 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Lucterios mailing documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 22 17:11:37 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in... | Lucterios2/contacts | lucterios/mailing/docs/fr/conf.py | Python | gpl-3.0 | 9,330 | 0 |
# Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
from orthography import add_suffix
import unittest
class OrthographyTestCase(unittest.TestCase):
def test_add_suffix(self):
cases = (
('artistic', 'ly', 'artistically'),
('cosmetic', 'ly', 'cosmetically'),
... | blockbomb/plover | plover/test_orthography.py | Python | gpl-2.0 | 4,487 | 0.002452 |
'''
chg1: first change to multi-person pose estimation
'''
from __future__ import print_function, absolute_import
import argparse
import time
import matplotlib.pyplot as plt
import os
import torch
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torchvision.datasets as datase... | weigq/pytorch-pose | example/main.py | Python | gpl-3.0 | 12,764 | 0.014964 |
#!/usr/bin/env python
from ConfigParser import ConfigParser
from ordereddict import OrderedDict
import sys
def make_parser():
parser = ConfigParser(dict_type=OrderedDict)
parser.optionxform = str
return parser
def transform(sectionName):
sectionName = sectionName.replace(",Dialog=", ", Dialog=")
... | emilybache/texttest-runner | src/main/python/storytext/bin/migrate_uimap.py | Python | mit | 1,119 | 0.004468 |
# -*- coding: utf-8 -*-
"""
"Sandbox" module for exploring API useful for digital labbooks.
Examples
--------
>>> from chempy.units import to_unitless, default_units as u
>>> s1 = Solution(0.1*u.dm3, {'CH3OH': 0.1 * u.molar})
>>> s2 = Solution(0.3*u.dm3, {'CH3OH': 0.4 * u.molar, 'Na+': 2e-3*u.molar, 'Cl-': 2e-3*u.mola... | bjodah/aqchem | chempy/_solution.py | Python | bsd-2-clause | 5,994 | 0.001835 |
from django import forms
from django.contrib.auth.models import User
from django.forms.models import ModelForm
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from .models import UserProfile
class UserForm(ModelForm):
password = forms.CharField(widget=forms.PasswordInput())
... | kburts/django-playlist | django_playlist/auth/forms.py | Python | mit | 954 | 0.008386 |
# This file is part of Rubber and thus covered by the GPL
# (c) Sebastian Reichel, 2012
"""
Dependency analysis for package 'ltxtable' in Rubber.
"""
def setup (document, context):
global doc
doc = document
doc.hook_macro('LTXtable', 'aa', hook_ltxtable)
def hook_ltxtable (loc, width, file):
# If the file name lo... | sre/rubber | src/latex_modules/ltxtable.py | Python | gpl-2.0 | 484 | 0.022727 |
# Copyright (c) 2006-2012 Mitch Garnaat http://garnaat.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, modi... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/boto/ec2/cloudwatch/dimension.py | Python | agpl-3.0 | 1,532 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###
# Copyright (2016-2017) Hewlett Packard Enterprise Development LP
#
# 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/licen... | HewlettPackard/oneview-ansible | library/oneview_sas_logical_jbod_attachment_facts.py | Python | apache-2.0 | 3,330 | 0.002402 |
"""
pynipap - a Python NIPAP client library
=======================================
pynipap is a Python client library for the NIPAP IP address planning
system. It is structured as a simple ORM.
There are three ORM-classes:
* :class:`VRF`
* :class:`Pool`
* :class:`Prefix`
Each of... | ettrig/NIPAP | pynipap/pynipap.py | Python | mit | 37,369 | 0.003131 |
# -*- coding: utf-8 -*-
"""
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
This program is distributed in... | estaban/pyload | module/plugins/hoster/FilepostCom.py | Python | gpl-3.0 | 6,081 | 0.00296 |
"""Driver module for Newport's Spectra-Physics Quanta-Ray INDI, PRO, and LAB
Series Nd:YAG lasers.
NOTE: the watchdog parameter is important! The laser will turn off if it does
not receive a command within the watchdog time period. Therefore, it is
advised to use a command like QRstatus().get_status() at regular int... | PALab/PLACE | place/plugins/quanta_ray/qray_driver.py | Python | lgpl-3.0 | 21,278 | 0.001222 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette_driver.by import By
from marionette_harness import MarionetteTestCase
class TestPosition(MarionetteTe... | Yukarumya/Yukarum-Redfoxes | testing/marionette/harness/marionette_harness/tests/unit/test_position.py | Python | mpl-2.0 | 664 | 0 |
import unittest2
from zounds.util import simple_in_memory_settings
from .preprocess import MeanStdNormalization, PreprocessingPipeline
import featureflow as ff
import numpy as np
class MeanStdTests(unittest2.TestCase):
def _forward_backward(self, shape):
@simple_in_memory_settings
class Model(ff.B... | JohnVinyard/zounds | zounds/learn/test_meanstd.py | Python | mit | 1,301 | 0 |
#!/usr/bin/env python
#-*-coding:utf-8-*-
from evaluator import Evaluator
from loader import Loader
import matplotlib.pyplot as plt
from confidence_weighted import ConfidenceWeighted
def graph_plot(plt_obj, show=False):
plt_obj.ylim(0, 1)
plt_obj.xlabel("Number of trials")
plt_obj.ylabel("Accuracy")
... | smrmkt/online_learning_algorithms | exec_cw.py | Python | bsd-3-clause | 1,188 | 0.000842 |
#!/usr/bin/env python
# coding: utf-8
import os
import csv
from schedule_entry import EntryStatus
from machine import MachineStatus
def dump_stat(path, data, headers):
with open(path, 'w') as out:
csv_out = csv.writer(out)
csv_out.writerow(headers)
for row in data:
csv_out.wri... | rika/dynamic-provisioning | statistics.py | Python | gpl-3.0 | 3,837 | 0.011207 |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2019
# Separated test code with Python 3.6 syntax.
import typing
import decimal
from streamsx.spl.types import int64
class NTS(typing.NamedTuple):
x: int
msg: str
class NamedTupleBytesSchema(typing.NamedTuple):
idx: str
msg... | IBMStreams/streamsx.topology | test/python/topology/py36_types.py | Python | apache-2.0 | 6,604 | 0.011508 |
# Copyright 2010 Michael Murr
#
# This file is part of LibForensics.
#
# LibForensics 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
# (at your option) any later ver... | 306777HC/libforensics | code/lf/win/shell/link/__init__.py | Python | lgpl-3.0 | 1,769 | 0.000565 |
# -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2015 Trustcode - www.trustcode.com.br #
# ... | Trust-Code/trust-addons | trust_second_unit_of_measure/models/mrp_bom.py | Python | agpl-3.0 | 3,943 | 0 |
# -*- coding: utf-8 -*
import uuid
import random
import string
from test import DjangoTestCase
class Account(object):
def __init__(self, email=None, password=None):
self.email = email
self.password = password
@staticmethod
def create_email():
return u"some.one+%s@example.com" % u... | kaeawc/django-auth-example | test/account.py | Python | mit | 1,507 | 0.000664 |
# Copyright (c) 2008, 2012 testtools developers. See LICENSE for details.
from testtools import TestCase
from testtools.matchers import Equals, MatchesException, Raises
from testtools.content_type import (
ContentType,
JSON,
UTF8_TEXT,
)
class TestContentType(TestCase):
def test___init___None_er... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/testtools/tests/test_content_type.py | Python | agpl-3.0 | 2,543 | 0.001573 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import contextlib
import imp
import os
import sys
import inspect
# Python 3.3's importlib caches filesystem reads for faster imports in the
# general case. But sometimes it's necessary to manually invalidate those
# caches so that the import system can ... | astrofrog/astropy-helpers | astropy_helpers/utils.py | Python | bsd-3-clause | 6,917 | 0.000434 |
"""
Django settings for dfiid project.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file_... | ellipticaldoor/dfiid | project/dfiid/settings/base.py | Python | gpl-2.0 | 2,415 | 0.015735 |
#Evaluate semantic space against MEN dataset
import sys
import utils
from scipy import stats
import numpy as np
from math import sqrt
#Note: this is scipy's spearman, without tie adjustment
def spearman(x,y):
return stats.spearmanr(x, y)[0]
def readMEN(annotation_file):
pairs=[]
humans=[]
f=open(annotation_f... | minimalparts/Tutorials | FruitFly/MEN.py | Python | mit | 989 | 0.034378 |
# Copyright (C) 2007, 2011, One Laptop Per Child
# Copyright (C) 2014, Ignacio Rodriguez
#
# 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) ... | icarito/sugar | src/jarabe/journal/volumestoolbar.py | Python | gpl-3.0 | 13,211 | 0 |
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Python Software Foundation.
# All rights reserved.
"""Tokenization help for Python programs.
generate_tokens(readline) is a generator that breaks a stream of
text into Python tokens. It accepts a readline-like method which is called
repeatedly to get the next line o... | timm/timmnix | pypy3-v5.5.0-linux64/lib-python/3/lib2to3/pgen2/tokenize.py | Python | mit | 19,320 | 0.001967 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hack_plot', '0005_auto_20150505_1940'),
]
operations = [
migrations.AddField(
model_name='sshhackip',
... | hellsgate1001/graphs | hack_plot/migrations/0006_sshhackip_located.py | Python | mit | 444 | 0 |
from trackers.fitbit_tracker import FitbitTracker
__author__ = 'doughyde'
# FitBit connection
f = FitbitTracker()
f.authenticate()
f.get_devices() | doughyde/fitbit-cal-sync | fitbit-cal-sync.py | Python | gpl-2.0 | 149 | 0.006711 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 th... | lakshmi-kannan/st2 | st2tests/st2tests/action_aliases.py | Python | apache-2.0 | 4,628 | 0.003025 |
from sft.runner.Trainer import Trainer
import sft.config.exp
if __name__ == "__main__":
Trainer().run(sft.config.exp)
| kevinkepp/look-at-this | run_trainer.py | Python | mit | 121 | 0.008264 |
import time
import sqlite3
from base_model import BaseModel
from datetime import datetime
from contextlib import contextmanager
class SSIDTrafficHistory(BaseModel):
def __init__(self, dbfile, table_name, time_limit):
super(SSIDTrafficHistory, self).__init__(dbfile, table_name)
self.time_limit = time_limit
de... | putrasattvika/ssidstat | ssidstat/common/models/ssid_traffic_history.py | Python | apache-2.0 | 3,044 | 0.031866 |
'''
Created on 28/set/2014
@author: Vincenzo Pirrone <pirrone.v@gmail.com>
'''
import serial, time
class Connector:
def readline(self):
pass
def writeline(self, line):
pass
def close(self):
pass
class FakeSerial(Connector):
def __init__(self, port):
p... | sp4x/osnf | osnf/connectors.py | Python | apache-2.0 | 1,423 | 0.026704 |
# Generated by Django 1.11.15 on 2018-08-08 18:28
import django.db.models.deletion
import django_extensions.db.fields
import stdimage.models
from course_discovery.apps.course_metadata.utils import UploadToFieldNamePath
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies... | edx/course-discovery | course_discovery/apps/course_metadata/migrations/0097_degree_lead_capture_image.py | Python | agpl-3.0 | 772 | 0.001295 |
import os.path
from subprocess import call
class InstallerTools(object):
@staticmethod
def update_environment(file_path,environment_path):
update_file = open(file_path, 'r')
original_lines = update_file.readlines()
original_lines[0] = environment_path+'\n'
update_file.close()
update_file = open(file_path,... | femmerling/backyard | builder/installer_tools.py | Python | mit | 1,906 | 0.028856 |
##############################################################################
# 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... | lgarren/spack | var/spack/repos/builtin/packages/r-protgenerics/package.py | Python | lgpl-2.1 | 1,699 | 0.001177 |
# Input:
# 2
# 5
# 1 2 3 4 5
# 6
# 2 4 6 7 5 1
#
# Output:
# 3
# 7
def findMid(head):
if head == None:
return -1
fast, slow = head, head
while fast.next != None and fast.next.next != None:
fast = fast.next.next
slow = slow.next
if fast.next != None:
return slow.next
... | HoussemCharf/FunUtils | linked_lists/1_finding_middle_element_in_a_linked_list.py | Python | mit | 335 | 0.01194 |
from tests.util.base import event
def test_invite_generation(event, default_account):
from inbox.events.ical import generate_icalendar_invite
event.sequence_number = 1
event.participants = [{'email': 'helena@nylas.com'},
{'email': 'myles@nylas.com'}]
cal = generate_icalendar... | Eagles2F/sync-engine | tests/events/test_inviting.py | Python | agpl-3.0 | 2,071 | 0 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | briancurtin/python-openstacksdk | openstack/network/v2/service_profile.py | Python | apache-2.0 | 1,571 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | cvandeplas/plaso | plaso/formatters/mac_securityd.py | Python | apache-2.0 | 1,215 | 0.005761 |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe Technologies and contributors
# License: MIT. See LICENSE
# import frappe
from frappe.model.document import Document
class UserDocumentType(Document):
pass
| frappe/frappe | frappe/core/doctype/user_document_type/user_document_type.py | Python | mit | 212 | 0.009434 |
from protorpc import messages
from protorpc import message_types
from protorpc import remote
from google.appengine.api import taskqueue
import json
import endpoints
import urllib2
import logging, os
import settings
import inspect
from seqid import SeqidIssuer, seqid2str
from endpointshelper import EndpointsHelper
fr... | SkyTruth/skytruth-automation-hub | gae/geofeed_api.py | Python | mit | 5,854 | 0.007345 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | Slezhuk/ansible | lib/ansible/module_utils/_text.py | Python | gpl-3.0 | 12,325 | 0.00211 |
# -*- coding: utf-8 -*-
# Aualé oware graphic user interface.
# Copyright (C) 2014-2020 Joan Sala Soler <contact@joansala.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3... | joansalasoler/auale | src/auale/book/opening_book.py | Python | gpl-3.0 | 3,781 | 0.000794 |
# Copyright 2019, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | tensorflow/federated | tensorflow_federated/python/core/backends/mapreduce/__init__.py | Python | apache-2.0 | 12,271 | 0.000733 |
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2017 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by th... | QuantumElephant/horton | horton/io/test/test_wfn.py | Python | gpl-3.0 | 19,258 | 0.002181 |
# -*- coding: utf-8 -*-
#
# clopath_synapse_spike_pairing.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 ... | heplesser/nest-simulator | pynest/examples/clopath_synapse_spike_pairing.py | Python | gpl-2.0 | 6,051 | 0.003636 |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import director
from cocos.sprite import Sprite
import pyglet
import random
class TestLayer(cocos.layer.Layer):
def _... | adamwiggins/cocos2d | test/test_schedule.py | Python | bsd-3-clause | 1,034 | 0.024178 |
import tornado.web
import json
from tornado_cors import CorsMixin
from common import ParameterFormat, EnumEncoder
class DefaultRequestHandler(CorsMixin, tornado.web.RequestHandler):
CORS_ORIGIN = '*'
def initialize(self):
self.default_format = self.get_argument("format", "json", True)
self.s... | sebastianwebber/pgconfig-api | common/util.py | Python | bsd-2-clause | 5,642 | 0.001241 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'D:\github repos\Python\A05_SimplyGame\Binaries\MyView.ui'
#
# Created: Tue Oct 25 22:22:12 2016
# 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... | lzuba-tgm/A05_SimplyGame | Ui_MainWindow.py | Python | gpl-3.0 | 13,842 | 0.003396 |
# ----------------------------------------------------------------------------------------------------------------------
# Introdução a Programação de Computadores - IPC
# Universidade do Estado do Amazonas - UEA
# Prof. Jucimar Jr
# Edson de Lima Barros 1715310043
# Tiago Ferreira Aranha 1715310047
# Vitor Simôes A... | jucimarjr/IPC_2017-1 | lista08/lista08_lista02_questao16.py | Python | apache-2.0 | 799 | 0 |
import mcpi.minecraft as minecraft
import mcpi.block as Block
import serial
import time
# The location where redstone torch needs to spawn.
a0 = (-112, 0, 62) # <- YOU MUST SET THIS VALUE (x,y,z)
"""
Helper method: get_pin(pin)
Returns whether the minecraft pin is turned on or off (based on redstone torch type)
B... | FoamyGuy/mcpi_with_espruino | examples/example2_led/example2_led.py | Python | unlicense | 1,489 | 0.003358 |
#!/usr/bin/env python
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | flgiordano/netcash | +/google-cloud-sdk/lib/googlecloudsdk/gcloud_main.py | Python | bsd-3-clause | 7,025 | 0.00911 |
DEBUG = False
USERNAME = 'hikaru'
CHANNEL = 'random'
VOCAB = {
'RANDOM': ['random', ':troll:', ':trollface:'],
'PASS': ['pass', 'skip'],
'RESIGN': ['resign', 'give up'],
'VOTE': ['vote', 'move', 'play'],
'VOTES': ['votes', 'moves', 'voted', 'chance'],
'CAPTURES': ['captures'],
'SHOW': ['s... | shobute/go-slack | config.py | Python | isc | 1,009 | 0.001982 |
# Copyright 2018 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 | official/transformer/v2/transformer_test.py | Python | apache-2.0 | 2,619 | 0.001909 |
from . import mne # noqa
from .mne.spectral import TFRmorlet # noqa
| neuropycon/ephypype | ephypype/interfaces/__init__.py | Python | bsd-3-clause | 70 | 0.028571 |
# Copyright (C) 2010-2017 GRNET S.A.
#
# 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.
#
# This program is distributed i... | grnet/synnefo | snf-cyclades-app/synnefo/logic/management/commands/backend-update-status.py | Python | gpl-3.0 | 1,489 | 0 |
"""Defines all search scopes used in this project."""
from os import path
ROOT_PATH = path.abspath('/')
class TreeSearchScope:
"""Encapsulation of a search scope to search up the tree."""
def __init__(self,
from_folder=ROOT_PATH,
to_folder=ROOT_PATH):
"""Initialize ... | niosus/EasyClangComplete | plugin/utils/search_scope.py | Python | mit | 2,889 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_stack
----------------------------------
Tests for `python_algorithms.stack` module.
"""
import unittest
from python_algorithms.basic.stack import Stack
class TestStack(unittest.TestCase):
def setUp(self):
self.empty_stack = Stack()
self.... | cjauvin/python_algorithms | tests/basic/test_stack.py | Python | bsd-3-clause | 1,843 | 0.000543 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import pytest
from pootle.core.delegate imp... | claudep/pootle | tests/search/units.py | Python | gpl-3.0 | 10,939 | 0 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | platform/polycommon/tests/test_options/test_feature.py | Python | apache-2.0 | 1,739 | 0 |
import sqlalchemy as sa
from sqlalchemy_utils.functions.sort_query import make_order_by_deterministic
from tests import assert_contains, TestCase
class TestMakeOrderByDeterministic(TestCase):
def create_models(self):
class User(self.Base):
__tablename__ = 'user'
id = sa.Column(sa.... | cheungpat/sqlalchemy-utils | tests/functions/test_make_order_by_deterministic.py | Python | bsd-3-clause | 3,482 | 0 |
from gooddataclient.dataset import Dataset
from gooddataclient.columns import ConnectionPoint, Label, Reference
class Employee(Dataset):
employee = ConnectionPoint(title='Employee', folder='Employee')
firstname = Label(title='First Name', reference='employee', folder='Employee')
lastname = Label(ti... | comoga/gooddata-python | tests/examples/employee.py | Python | bsd-3-clause | 6,397 | 0.00766 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | keras-team/keras | keras/feature_column/dense_features_v2.py | Python | apache-2.0 | 6,123 | 0.00343 |
from autoprotocol.unit import Unit
def dna_mass_to_mole(length, mass, ds=True):
"""
For the DNA Length and mass given, return the mole amount of DNA
Example Usage:
.. code-block:: python
from autoprotocol_utilities import dna_mass_to_mole
from autoprotocol.unit import Unit
... | autoprotocol/autoprotocol-utilities | autoprotocol_utilities/bio_calculators.py | Python | bsd-3-clause | 16,561 | 0 |
"""
Revision ID: 0356_add_webautn_auth_type
Revises: 0355_add_webauthn_table
Create Date: 2021-05-13 12:42:45.190269
"""
from alembic import op
revision = '0356_add_webautn_auth_type'
down_revision = '0355_add_webauthn_table'
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.e... | alphagov/notifications-api | migrations/versions/0356_add_webautn_auth_type.py | Python | mit | 1,380 | 0.003623 |
import fileinput
import argparse
from astexport import __version__, __prog_name__
from astexport.parse import parse
from astexport.export import export_json
def create_parser():
parser = argparse.ArgumentParser(
prog=__prog_name__,
description="Python source code in, JSON AST out. (v{})".format(
... | fpoli/python-astexport | astexport/cli.py | Python | mit | 1,148 | 0 |
from copy import deepcopy
from distutils.spawn import find_executable
class Settings(object):
_upload_limit = 0
def __init__(self, settings=None):
if settings:
self._upload_limit = settings.up_kbytes_sec
@property
def upload_limit(self):
""" Returns the value as required ... | MatiasSM/fcb | fcb/utils/trickle.py | Python | lgpl-3.0 | 1,657 | 0.001811 |
#!/usr/bin/env python
"""
simple example script for running notebooks and reporting exceptions.
Usage: `checkipnb.py foo.ipynb [bar.ipynb [...]]`
Each cell is submitted to the kernel, and checked for errors.
"""
import os
import glob
from runipy.notebook_runner import NotebookRunner
from pyfolio.utils import pyfolio_... | quantopian/pyfolio | pyfolio/tests/test_nbs.py | Python | apache-2.0 | 666 | 0 |
import sys
import traceback
import unittest
import unittest.mock
import rail
class TestIdentity(unittest.TestCase):
def test_returns_input_value(self):
value = unittest.mock.Mock()
self.assertEqual(value, rail.identity(value))
class TestNot(unittest.TestCase):
def test_returns_inverse_for_b... | rob-earwaker/rail | test_rail.py | Python | mit | 23,712 | 0 |
ad = 1.
# this statement will be ignored at the codegen
x = ad is None
| ratnania/pyccel | tests/warnings/codegen/is.py | Python | mit | 72 | 0 |
import json
from django.utils import unittest
from django.test.client import RequestFactory
from formalizr.tests.views import SimpleFormView, SimpleCreateView, SimpleUpdateView
from formalizr.tests.models import SimpleModel
class AjaxFormViewTest(unittest.TestCase):
view_class = SimpleFormView
VALUE = 1
... | krasnoperov/django-formalizr | formalizr/tests/tests.py | Python | bsd-3-clause | 4,412 | 0.002947 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Created on 2016. 10. 11.
@author: "comfact"
'''
import yaml
from ansible.module_utils.basic import *
from acidipy import deployACI
DOCUMENTATION = '''
---
module: acibuilder
version_added: historical
short_description: acidipy ansible module.
description... | HyechurnJang/acidipy | tools/ansible/acibuilder.py | Python | apache-2.0 | 1,055 | 0.010427 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'GenericCommandDialog.ui'
#
# Created: Wed Mar 25 17:15: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
try:
_fromUtf8 = QtCore.QString.fromUtf8
... | CACTUS-Mission/TRAPSat | TRAPSat_cFS/cfs/cfe/tools/cFS-GroundSystem/Subsystems/cmdGui/GenericCommandDialog.py | Python | mit | 49,087 | 0.004339 |
# coding=utf-8
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from contextlib impo... | pombredanne/pants | tests/python/pants_test/build_graph/test_subproject_integration.py | Python | apache-2.0 | 3,193 | 0.006577 |
#!/usr/bin/env python
##################################################
# Parallel MLMC: Config class #
# #
# Jun Nie #
# Last modification: 19-09-2017 #
##########################################... | henrynj/PMLMC | v0.0/config.py | Python | gpl-3.0 | 2,156 | 0.008813 |
########################################################################
# amara/xslt/expressions/avt.py
"""
Implementation of XSLT attribute value templates
"""
from amara.xpath import datatypes
from amara.xpath.expressions import expression
from amara.xslt import XsltError
from amara.xslt.expressions import _avt
_p... | zepheira/amara | lib/xslt/expressions/avt.py | Python | apache-2.0 | 1,540 | 0.001299 |
#!/usr/bin/env python
from distutils.core import setup
from pip.req import parse_requirements
install_reqs = parse_requirements("requirements.txt", session=False)
reqs = [str(ir.req) for ir in install_reqs]
setup(name='pgoapi',
version='1.0',
url='https://github.com/tejado/pgoapi',
packages=['pgoa... | earthchie/PokemonGo-Bot | setup.py | Python | mit | 355 | 0 |
from oracleplsqlsource import OraclePLSQLSource
class OracleJavaSource(OraclePLSQLSource):
def __init__(self, name, source):
self.name = name
#debug_message("debug: generating java source ")
OraclePLSQLSource.__init__(self,source)
| sawdog/OraclePyDoc | oraclepydoc/oracleobjects/oraclejavasource.py | Python | gpl-2.0 | 261 | 0.007663 |
from cupy import elementwise
_id = 'out0 = in0'
# TODO(okuta): Implement convolve
_clip = elementwise.create_ufunc(
'cupy_clip',
('???->?', 'bbb->b', 'BBB->B', 'hhh->h', 'HHH->H', 'iii->i', 'III->I',
'lll->l', 'LLL->L', 'qqq->q', 'QQQ->Q', 'eee->e', 'fff->f', 'ddd->d'),
'out0 = min(in2, max(in1, i... | tscohen/chainer | cupy/math/misc.py | Python | mit | 4,772 | 0 |
""" Configuration values.
"""
# Command paths (you can change these to e.g. absolute paths in calling code)
CMD_FLAC = "flac"
CMD_FFMPEG = "ffmpeg"
CMD_IM_MONTAGE = "montage"
CMD_IM_MOGRIFY = "mogrify"
CMD_IM_CONVERT = "convert"
| pyroscope/auvyon | src/auvyon/config.py | Python | gpl-2.0 | 230 | 0 |
# python3
class HeapBuilder:
def __init__(self):
self._swaps = []
self._data = []
def ReadData(self):
n = int(input())
self._data = [int(s) for s in input().split()]
assert n == len(self._data)
def WriteResponse(self):
print(len(self._swaps))
for swap in self._swaps:
print(swa... | xunilrj/sandbox | courses/coursera-sandiego-algorithms/data-structures/assignment002/make_heap/build_heap.py | Python | apache-2.0 | 1,100 | 0.010909 |
# -*- coding: utf-8 -*-
import StringIO
import csv
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
from xml.dom import minidom
import configdb
def prettify(elem):
"""Return a pretty-printed XML string for the Element.
"""
rough_string = tostring(elem, 'utf-8')
reparsed = mini... | Som-Energia/invoice-janitor | Taxes/municipaltax.py | Python | agpl-3.0 | 9,574 | 0.004493 |
import android
import android.activity
from os import unlink
from jnius import autoclass, cast
from plyer_lach.facades import Camera
from plyer_lach.platforms.android import activity
Intent = autoclass('android.content.Intent')
PythonActivity = autoclass('org.renpy.android.PythonActivity')
MediaStore = autoclass('andr... | locksmith47/turing-sim-kivy | src/plyer_lach/platforms/android/camera.py | Python | mit | 2,169 | 0.000461 |
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
'fbcode_builder steps to build Facebook Thrift'
import specs.fbthrift as fbthrift
def fbcode_builder_spec(builder):
return {
'depends_... | getyourguide/fbthrift | build/fbcode_builder_config.py | Python | apache-2.0 | 449 | 0 |
from setuptools import setup
import pybvc
setup(
name='pybvc',
version=pybvc.__version__,
description='A python library for programming your network via the Brocade Vyatta Controller (BVC)',
long_description=open('README.rst').read(),
author='Elbrys Networks',
author_email='jeb@elbrys.com',
... | tnadeau/pybvc | setup.py | Python | bsd-3-clause | 1,243 | 0.000805 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.