code
stringlengths
2
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int32
2
1.05M
import os import logging import MySQLdb import time import sys import Queue import threading import json createUserSQL = "INSERT IGNORE INTO users (name) VALUES (%s);" getUserByUsernameSQL = "SELECT * FROM users WHERE name=%s;" getAuthorByNameSQL = "SELECT * FROM authors WHERE name=%s;" createAuthorSQL = "INSERT...
mellanox-senior-design/docker-volume-rdma
benchmarking/book_store/bench.py
Python
apache-2.0
5,515
from typing import List from dbt.clients.jinja import MacroStack from dbt.contracts.connection import AdapterRequiredConfig from dbt.contracts.graph.manifest import Manifest from dbt.context.macro_resolver import TestMacroNamespace from .configured import ConfiguredContext from .macros import MacroNamespaceBuilder ...
analyst-collective/dbt
core/dbt/context/manifest.py
Python
apache-2.0
2,929
# -*- coding: utf-8 -*- # # 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 #...
owlabs/incubator-airflow
airflow/task/task_runner/base_task_runner.py
Python
apache-2.0
6,779
__author__ = 'shuai' class Solution(object): def countSmaller(self, nums): """ :type nums: List[int] :rtype: List[int] """ count = [] ret = [0] * len(nums) for i in range(len(nums)): count.append({'index': i, 'value': num...
shuaizi/leetcode
leetcode-python/num315.py
Python
apache-2.0
1,742
"""Support for Legacy MQTT vacuum.""" import logging import json import voluptuous as vol from homeassistant.components import mqtt from homeassistant.components.vacuum import ( SUPPORT_BATTERY, SUPPORT_CLEAN_SPOT, SUPPORT_FAN_SPEED, SUPPORT_LOCATE, SUPPORT_PAUSE, SUPPORT_RETURN_HOME, SUPP...
fbradyirl/home-assistant
homeassistant/components/mqtt/vacuum/schema_legacy.py
Python
apache-2.0
19,586
# # Copyright (c) SAS Institute 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 w...
sassoftware/mint
mint/django_rest/rbuilder/platforms/image_type_descriptors/rawFsImage.py
Python
apache-2.0
3,614
import os from flask import Flask, render_template, request from PIL import Image import sys import pyocr import pyocr.builders import re import json __author__ = 'K_K_N' app = Flask(__name__) APP_ROOT = os.path.dirname(os.path.abspath(__file__)) def ocr(image_file): tools = pyocr.get_available_tools() if l...
ankutty/OCR-Tesseract
ocr_app.py
Python
apache-2.0
1,764
from haystack import indexes from common.models import Person, CustomPage, NewsArticle, Job class PersonIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) first_name = indexes.CharField(model_attr='first_name') last_name = indexes.CharField(model_attr...
baylee-d/cos.io
common/search_indexes.py
Python
apache-2.0
1,112
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ***************************************** Author: zhlinh Email: zhlinhng@gmail.com Version: 0.0.1 Created Time: 2016-03-02 Last_modify: 2016-03-02 ****************************************** ''' ''' A message containing letters from A-Z is b...
zhlinh/leetcode
0091.Decode Ways/solution.py
Python
apache-2.0
1,111
class Solution: def decodeString(self, s): """ :type s: str :rtype: str """ stack = [] multi = 0 ret = '' for c in s: if c == '[': stack.append(ret) stack.append(multi) ret = '' ...
MingfeiPan/leetcode
stack/394.py
Python
apache-2.0
616
from charmhelpers.cli import cmdline from charmhelpers.core import hookenv from charmhelpers.core import unitdata from charms.reactive.bus import FlagWatch from charms.reactive.trace import tracer __all__ = [ 'set_flag', 'clear_flag', 'toggle_flag', 'register_trigger', 'is_flag_set', 'all_fla...
juju-solutions/charms.reactive
charms/reactive/flags.py
Python
apache-2.0
9,936
"""Auto-generated file, do not edit by hand. RE metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_RE = PhoneMetadata(id='RE', country_code=None, international_prefix=None, general_desc=PhoneNumberDesc(national_number_pattern='1\\d\\d?', possible_length=(2, 3)), ...
daviddrysdale/python-phonenumbers
python/phonenumbers/shortdata/region_RE.py
Python
apache-2.0
690
# Copyright (c) 2012-2021, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 import elasticsearch import json import logging import os import random import string import swiftclient import unittest import utils class MetadataSyncTest(unittest.TestCase): ES_HOST = 'https://localhost:9200' ES_VERSION =...
swiftstack/swift-metadata-sync
test/integration/test_metadata_sync.py
Python
apache-2.0
5,118
# # Copyright (c) SAS Institute 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 w...
sassoftware/rbuild
rbuild/facade/rbuilderfacade.py
Python
apache-2.0
41,160
import datetime import json import math import re import time import uuid from django import forms from django.http import HttpResponseRedirect from django.shortcuts import render from django.utils import timezone from keychain import captcha as captcha_generator from keychain import cryptool from keychain.models imp...
osgee/keychainserver
keychain/views/web/userview.py
Python
apache-2.0
10,760
import unittest import os import pickle import numpy as np from copy import copy from QGL import * from QGL.drivers import APS2Pattern class APSPatternUtils(unittest.TestCase): def setUp(self): self.cl = ChannelLibrary(":memory:") #self.q1gate = Channels.LogicalMarkerChannel(label='q1-gate', ...
BBN-Q/QGL
tests/test_APS2Pattern.py
Python
apache-2.0
5,403
# 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
structformer/utils.py
Python
apache-2.0
1,703
# coding=utf-8 # Copyright 2018 The Google AI Language Team 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 ...
google-research/language
language/mentionmemory/encoders/mauto_encoder.py
Python
apache-2.0
8,445
def simpleSort(arr): n = len(arr) for i in range(n): j = 0 stop = n - i while j < stop - 1: if arr[j] > arr[j + 1]: arr[j], arr[j+1] = arr[j+1], arr[j] j += 1 return arr
emirot/codefights
python/simpleSort.py
Python
apache-2.0
248
""" 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 ...
alexryndin/ambari
ambari-server/src/main/resources/stacks/ADH/1.0/services/YARN/package/scripts/service_check.py
Python
apache-2.0
5,633
#!/homes/janeway/zhuww/bin/py import numpy import pyfits from pylab import * #from Pgplot import * #from ppgplot import * #import ppgplot from numpy import * class Cursor: badtimestart=[] badtimeend=[] lines = [] def __init__(self, ax): self.ax = ax #self.lx = ax.axhline(color='k') #...
zhuww/planetclient
gti.py
Python
apache-2.0
6,453
# Boto script for invoking: http://docs.aws.amazon.com/cli/latest/reference/lambda/create-alias.html import json import sys import boto3 import yaml if len(sys.argv) != 5: raise Exception("Invalid Usage") environment = str(sys.argv[1]) version = str(sys.argv[2]) aliasName = str(sys.argv[3]) functionVersion = st...
neil-power-hs/aws-lambda-sample
scripts/createLambdaAlias.py
Python
apache-2.0
1,225
import socket import pytest from urllib3.exceptions import ( NewConnectionError, ProtocolError, ProxyError, ) from tests import mock, unittest from botocore.awsrequest import ( AWSRequest, AWSHTTPConnectionPool, AWSHTTPSConnectionPool, ) from botocore.httpsession import ( get_cert_path, ...
boto/botocore
tests/unit/test_http_session.py
Python
apache-2.0
18,102
#!/usr/bin/env python # # Copyright 2010-2011 The Regents of the University of California # # 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 #...
TonyApuzzo/fuzzyjoin
fuzzyjoin-hadoop/src/test/scripts/plot/timeline.py
Python
apache-2.0
2,845
import os import sys from django.db.backends import BaseDatabaseClient class DatabaseClient(BaseDatabaseClient): executable_name = 'psql' def runshell(self): settings_dict = self.connection.settings_dict args = [self.executable_name] if settings_dict['DATABASE_USER']: ...
greggian/TapdIn
django/db/backends/postgresql/client.py
Python
apache-2.0
795
# Copyright (c) 2003-2014 CORE Security Technologies # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # $Id: wkst.py 1117 2014-01-25 19:04:39Z bethus $ # # Author: Alberto Solino # # Description: # [MS-W...
hecchi777/S3-SlaacSecuritySolution
impacket-0.9.11/impacket/dcerpc/v5/wkst.py
Python
apache-2.0
34,960
board = [] for i in range(3): board.append(["*"] * 3) #a function that creats the board def print_board(board): for row in board: print (" ".join(row)) print("Let\'s play Tic Tac Toe! the rules are simple. you, the players, is given two choices: the row and column of your symbol. note that the numbers are between 0...
orwa1902/code-exemples
TicTacToe.py
Python
apache-2.0
4,091
""" Copyright 2021 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software d...
google-research/DBAP-simulation
adept_envs/utils/math_utils.py
Python
apache-2.0
2,819
# -*- coding: utf-8 -*- import warnings from libnmap.objects.cpe import CPE class OSFPPortUsed(object): """ Port used class: this enables the user of NmapOSFingerprint class to have a common and clear interface to access portused data which were collected and used during os fingerprint sc...
pyphrb/myweb
app/plugin/nmap/libnmap/objects/os.py
Python
apache-2.0
13,080
# -*- coding: utf-8 -*- from operator import attrgetter from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType from pyangbind.lib.yangtypes import RestrictedClassType from pyangbind.lib.yangtypes import TypedListType from pyangbind.lib.yangtypes import YANGBool from pyangbind.lib.yangtypes import YANGListTy...
napalm-automation/napalm-yang
napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/isis/levels/level/link_state_database/lsp/tlvs/tlv/hostname/__init__.py
Python
apache-2.0
11,660
import json import urllib2 import re class CIDRReportASNameDump(object): """ASNNameDump represents the full list of registered AS Numbers on CIDR report. Acts as an iterator that will provide tuples: (AS Number, AS Name)""" CIDR_REPORT_URL = "http://www.cidr-report.org/as2.0/autnums.html" ENTRY_RE...
zmap/zannotate
asnames/__main__.py
Python
apache-2.0
3,472
# Copyright 2017 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 by applicable law or a...
google/upvote_py2
common/ng_template.py
Python
apache-2.0
1,657
# $language = "python" # $interface = "1.0" # for GCCLABVM1,GCCLABVM2 import os import csv def main(): crt.Screen.Synchronous = True # Create an Excel compatible spreadsheet filename = crt.Dialog.Prompt("Enter file name to write to: ", "Show Interface Description", "intdesc.csv", False) fileobj = open(filename...
kelvinongtoronto/SecureCRT
shintdesc_legacy.py
Python
artistic-2.0
1,392
from django.test import TestCase from django.utils import timezone from .. import utils from .. import models as survey_models from myvoice.core.tests import factories from operator import itemgetter class TestDisplayFeedback(TestCase): def test_false(self): bad_feedback = [None, '', ' ', ' 1', '1'...
myvoice-nigeria/myvoice
myvoice/survey/tests/test_utils.py
Python
bsd-2-clause
7,181
from .geom_line import geom_line class geom_path(geom_line): """ Sequence of connected (x, y) coordinates Parameters ---------- x: x values for (x, y) coordinates y: y values for (x, y) coordinates color: color of line alpha: transparency of color l...
yhat/ggplot
ggplot/geoms/geom_path.py
Python
bsd-2-clause
485
import binascii import logging from flask import Blueprint, redirect, render_template, request, session, url_for from functools import wraps import ob2.config as config from ob2.database import DbCursor from ob2.database.helpers import ( get_photo, get_user_by_id, get_user_by_github, get_user_by_studen...
octobear2/ob2
ob2/web/blueprints/onboarding/__init__.py
Python
bsd-2-clause
10,932
# Copyright (c) 2016, Rogerthat # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the fol...
rogerthat-platform/rogerthat-gig-g8
src/gig/__init__.py
Python
bsd-2-clause
1,334
import os from hunter import CallPrinter TIMEOUT = int(os.getenv('HUNTER_TEST_TIMEOUT', 60)) class DebugCallPrinter(CallPrinter): def __init__(self, suffix='', **kwargs): self.suffix = suffix super(DebugCallPrinter, self).__init__(**kwargs) def __call__(self, event): self.output("de...
ionelmc/python-hunter
tests/utils.py
Python
bsd-2-clause
615
from datetime import datetime def prettyDateNow(): """ Returns a good looking string for the local time. """ return datetime.now().ctime() def prettyDateNowUTC(): """ Returns a good looking string for utc time. """ return datetime.utcnow().ctime() def timestampNowLongUTC(): """ ...
0xPoly/ooni-probe
ooni/otime.py
Python
bsd-2-clause
479
#!/usr/bin/env python3 import sys from pathlib import Path from procedures import PROCEDURES std_options = { 'avx2': '-O3 -mavx2 -S %(cpp_file)s -o %(asm_file)s', 'avx512': '-O3 -mavx512f -mavx512dq -mavx512bw -mavx512vbmi -mavx512vbmi2 -mavx512vl ' '-S %(cpp_file)s -o %(asm_file)s', } compile...
WojciechMula/toys
autovectorization-tests/scripts/compile_all.py
Python
bsd-2-clause
1,263
#!/usr/bin/python import feedparser import os import pickle import logging from episode import Episode log = logging.getLogger() class Feed: """ Class representing a single podcast feed """ def __init__( self, name, url, destPath, episodes, ...
obmarg/pypod
feed.py
Python
bsd-2-clause
6,209
import claripy def test_complex_guy(): guy_wide = claripy.widen( claripy.union( claripy.union( claripy.union(claripy.BVV(0L, 32), claripy.BVV(1, 32)), claripy.union(claripy.BVV(0L, 32), claripy.BVV(1, 32)) + claripy.BVV(1, 32) ), claripy.u...
chubbymaggie/claripy
tests/test_balancer.py
Python
bsd-2-clause
4,706
# coding: utf-8 """ MINDBODY Public API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: v6 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 impor...
mindbody/API-Examples
SDKs/Python/swagger_client/models/get_contracts_request.py
Python
bsd-2-clause
8,098
"""Views for the URYPlayer submodule of the URY website. --- Copyright (c) 2013, University Radio York. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the...
UniversityRadioYork/lass-pyramid
uryplayer/views.py
Python
bsd-2-clause
3,553
import pymongo import mongotron conn = pymongo.Connection() mongotron.GetConnectionManager().add_connection(conn) class Doc(mongotron.Document): __db__ = 'test' structure = { 'name': unicode, 'age': int, 'events': [int] } d = Doc() d.age = 103 #d.age = "dave" d.save() pprint((...
Narrato/mongotron
test.py
Python
bsd-2-clause
337
import npyscreen import curses def sliderTest(screen): F = npyscreen.Form() F.add(npyscreen.TitleSlider, name="Slider 1") F.add(npyscreen.TitleSlider, color='STANDOUT', name="Slider 2") F.add(npyscreen.Slider, name="Slider 3") F.edit() if __name__ == "__main__": curses.wrapper(sliderTest)
tescalada/npyscreen-restructure
tests/testingSliders.py
Python
bsd-2-clause
314
from tkp.accessors.dataaccessor import RequiredAttributesMetaclass class LofarAccessor(object): __metaclass__ = RequiredAttributesMetaclass """ Additional metadata required for processing LOFAR images through QC checks. Attributes: antenna_set (string): Antenna set in use during observati...
transientskp/tkp
tkp/accessors/lofaraccessor.py
Python
bsd-2-clause
886
# -*- coding: utf-8 -*- # __init__.py --- Initialization of the condconfigparser package. # # Copyright (c) 2014, Florent Rougon # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistribut...
frougon/CondConfigParser
condconfigparser/__init__.py
Python
bsd-2-clause
2,270
import dateparser from datetime import date class Citation: FIELDS = { 'type': str, 'url': str, 'title': str, 'date': date, 'accessdate': date, 'year': int, 'authors': list, 'editors': list, 'publisher': str, 'work': str, 'web...
zhaofengli/refill
backend/refill/models/citation.py
Python
bsd-2-clause
5,016
from base import * # noqa
praekelt/molo-ndoh-yep
ndohyep/settings/__init__.py
Python
bsd-2-clause
27
# Author: Rojuienx <rojuinex@gmail.com http://github.com/rojuinex> # Version: 0.1.0 # Date Created: December 28th, 2012 # Copyright (c) 2012, Rojuinex (See license agreement) # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # # Created using Sam Hocevar's <sam@hocevar.net> Leafify Script a...
Rojuinex/leafify
leafify.py
Python
bsd-2-clause
4,283
from alembic.config import Config from alembic.environment import EnvironmentContext from alembic.migration import MigrationContext from alembic.script import ScriptDirectory from difflib import unified_diff from pytest import fixture from re import split from sqlalchemy import engine_from_config from subprocess import...
pyfidelity/rest-seed
backend/backrest/tests/test_migrations.py
Python
bsd-2-clause
3,745
#!/usr/bin/env python #-*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals from __future__ import print_function import __builtin__ from os import environ, path, isatty, makedirs from contextlib import closing import shelve import pickle from anydbm import error as DBE...
BenLubar/dag-jbo
jbo.py
Python
bsd-2-clause
27,426
import os SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) RES_DIR = os.path.join(SCRIPT_DIR, 'res') WEIGHTS_DIR = os.path.expanduser('~/.autocolorize') WEIGHTS_URL = 'http://people.cs.uchicago.edu/~larsson/colorization/res/autocolorize.caffemodel.h5' TOTAL_SIZE = 588203256
gustavla/autocolorize
autocolorize/config.py
Python
bsd-3-clause
284
from django.core.serializers.json import DjangoJSONEncoder from django.db import models from .fields import ( ArrayField, BigIntegerRangeField, CICharField, CIEmailField, CITextField, DateRangeField, DateTimeRangeField, FloatRangeField, HStoreField, IntegerRangeField, JSONField, SearchVectorField, ) clas...
alexallah/django
tests/postgres_tests/models.py
Python
bsd-3-clause
5,090
# pure-Python Douglas-Peucker line simplification/generalization # # this code was written by Schuyler Erle <schuyler@nocat.net> and is # made available in the public domain. # # the code was ported from a freely-licensed example at # http://www.3dsoftware.com/Cartography/Programming/PolyLineReduction/ # # the orig...
sunlightlabs/upwardly
src/movingup/utils/douglaspeucker.py
Python
bsd-3-clause
2,902
__author__ = 'mdavid' from attrdict import AttrDict import os # Addressimo Configuration config = AttrDict() # General Setup config.site_url = 'addressimo.netki.com' config.cache_loader_process_pool_size = 4 config.cache_loader_blocktx_pool_size = 15 config.bip32_enabled = True config.bip70_enabled = True config.bip...
netkicorp/addressimo
addressimo/config.py
Python
bsd-3-clause
2,378
from django.db import models from django.conf import settings from django.db.models import permalink from django.contrib.auth.models import User from django.utils.translation import ugettext as _ from django.contrib.comments.models import Comment from django.contrib.contenttypes.generic import GenericRelation class Ve...
myles/django-issues
src/issues/models.py
Python
bsd-3-clause
3,687
"""The scaled dot-product attention mechanism defined in Vaswani et al. (2017). The attention energies are computed as dot products between the query vector and the key vector. The query vector is scaled down by the square root of its dimensionality. This attention function has no trainable parameters. See arxiv.org/...
ufal/neuralmonkey
neuralmonkey/attention/scaled_dot_product.py
Python
bsd-3-clause
15,590
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 from django.template.loader import render_to_string from datetime import datetime, timedelta from apps.reports.models import Case from apps.hq.utils import get_dates import logging '''Report file for custom Pathfinder reports''' # see mvp.py for an explanatio...
commtrack/temp-aquatest
apps/reports/custom/pathfinder.py
Python
bsd-3-clause
12,361
# encoding: utf-8 # Useful decorators from functools import wraps from fabric.api import * # These variables must be defined in the actual fabfile.py for the proxy decorators: # env.proxy_server = 'proxy.com.br' Address of the proxy server intermediating the executation # env.proxy_home = '/home/me/fabric' Lo...
dalembertian/fabmanager
fabmanager/decorators.py
Python
bsd-3-clause
3,353
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. from parlai.core.fbdialog_...
calee88/ParlAI
parlai/tasks/opensubtitles/agents.py
Python
bsd-3-clause
872
# pylint: disable-msg=W0401,W0511,W0611,W0612,W0614,R0201,E1102 """Tests suite for MaskedArray & subclassing. :author: Pierre Gerard-Marchant :contact: pierregm_at_uga_dot_edu """ from __future__ import division, absolute_import, print_function __author__ = "Pierre GF Gerard-Marchant" import warnings import pickle i...
argriffing/numpy
numpy/ma/tests/test_core.py
Python
bsd-3-clause
167,699
import nox @nox.session(python=["3.7", "3.8", "3.9"]) def test(session): session.install("-r", "requirements-dev.txt") session.run("pytest")
joerick/pyinstrument
noxfile.py
Python
bsd-3-clause
151
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from fairseq.data.encoders import register_tokenizer @register_tokenizer('nltk') class NLTKTokenizer(object): def __init__(self, source...
hfp/libxsmm
samples/deeplearning/sparse_training/fairseq/fairseq/data/encoders/nltk_tokenizer.py
Python
bsd-3-clause
707
# -*- coding: utf-8 -*- """urls module of the website.""" from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: url(r'^$', 'restfulwebapisite.views.home', name='home...
juliotrigo/restfulwebapi
restfulwebapisite/urls.py
Python
bsd-3-clause
1,035
from __future__ import unicode_literals import sys import os import re import mimetypes from copy import copy from importlib import import_module from io import BytesIO from django.conf import settings from django.contrib.auth import authenticate, login, logout, get_user_model from django.core.handlers.base import Ba...
ericholscher/django
django/test/client.py
Python
bsd-3-clause
22,448
# Author: Kratarth Goel # BITS Pilani (2014) # LSTM-RBM for music generation import sys import os import tables import tarfile import fnmatch import random import numpy import numpy as np from scipy.io import wavfile import theano import theano.tensor as T from theano.tensor.shared_randomstreams import RandomStreams f...
kastnerkyle/speech_density
speech_lstmrbm.py
Python
bsd-3-clause
18,687
from __future__ import unicode_literals from tempfile import NamedTemporaryFile from unittest import TestCase import corehq.blobs.util as mod class TestClosingContextProxy(TestCase): def test_proxy_is_iterable(self): with NamedTemporaryFile() as tmp: tmp.write("line 1\nline 2\n") ...
qedsoftware/commcare-hq
corehq/blobs/tests/test_util.py
Python
bsd-3-clause
904
# -*- coding: utf-8 -*- from __future__ import absolute_import from datetime import datetime from django.db import models from django.contrib.auth.admin import User from django.core.urlresolvers import reverse #from django.contrib.contenttypes import generic #from django.contrib.contenttypes.models import ContentType ...
xgfone/homepage
homepage/homepage/blog/models.py
Python
bsd-3-clause
5,131
from django.core.management.base import BaseCommand from ...factories import PubmedFactory from ...models import Pubmed from ....users.factories import UserFactory from ....users.models import User class Command(BaseCommand): """Populate fake data.""" help = __doc__ def add_arguments(self, parser): ...
bionikspoon/Annotation-Tool
server/annotation_tool/pubmed/management/commands/fake_data.py
Python
bsd-3-clause
1,179
import subprocess from random import choice, randint from time import sleep import yaml from ooni.otime import timestamp import const class Test(object): def __init__(self, testfile, args=[]): self.testfile = testfile self.args = args self.output = None self.status = None ...
edagar/censorship-analyser
test.py
Python
bsd-3-clause
5,035
"""Command for running unit tests for the module from setup.py""" from distutils.cmd import Command from unittest import TextTestRunner, TestLoader import offtheshelf.tests class TestCommand(Command): """Command for running unit tests for the module from setup.py""" user_options = [] def initialize_op...
dotpy/offtheshelf
offtheshelf/tests/cmd.py
Python
bsd-3-clause
527
import csv import numpy as np import numpy.random as nprand import util class GeoVidCorpus(object): def __init__(self, pairs, country_lookup=None): '''Initialize from (country, video) tuples.''' countries = dict() videos = dict() for country, video in pairs: countri...
c4fcm/WhatWeWatch-Analysis
geovidcorpus.py
Python
bsd-3-clause
2,764
import numpy as np from pax import plugin, datastructure from pax.dsputils import find_intervals_above_threshold_no_splitting import matplotlib.pyplot as plt class SoftwareZLE(plugin.TransformPlugin): """Emulate the Zero-length encoding of the CAEN 1724 digitizer Makes no attempt to emulate the 2-sample wo...
XENON1T/pax
pax/plugins/ZLE.py
Python
bsd-3-clause
6,092
from .api import Xero # NOQA: F401 __version__ = "0.9.3"
freakboy3742/pyxero
xero/__init__.py
Python
bsd-3-clause
59
"""Color palettes in addition to matplotlib's palettes.""" from typing import Mapping, Sequence from matplotlib import cm, colors # Colorblindness adjusted vega_10 # See https://github.com/theislab/scanpy/issues/387 vega_10 = list(map(colors.to_hex, cm.tab10.colors)) vega_10_scanpy = vega_10.copy() vega_10_scanpy[2] ...
theislab/scanpy
scanpy/plotting/palettes.py
Python
bsd-3-clause
4,616
# coding=utf-8 from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from qa.models import Question, Answer class AskForm(forms.Form): title = forms.CharField(max_length=1024, label="Заголовок вопроса") text = forms.CharField(widget=forms...
a-shar/web_tech
ask/qa/forms.py
Python
bsd-3-clause
1,986
from ctypes.util import find_library from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db.backends.sqlite3.base import ( DatabaseWrapper as SQLiteDatabaseWrapper, SQLiteCursorWrapper, ) from .client import SpatiaLiteClient from .features import DatabaseFeatures f...
mattseymour/django
django/contrib/gis/db/backends/spatialite/base.py
Python
bsd-3-clause
3,105
"""This creates a TestExamples test class and adds a method for each python file in the examples directory. examples/01-web/01-google.py -> TestExamples.test_01web_01google The test itself calls this python file, and asserts that it exits with exit code 0 (i.e. it was successful). If it wasn't it raises an AssertionE...
textioHQ/pattern
test/test_examples.py
Python
bsd-3-clause
2,048
import re from datetime import datetime, timedelta from django.test.client import Client from django.test.testcases import TestCase from django.core import mail from django.contrib.auth.models import User from django.conf import settings from emailauth.models import UserEmail from emailauth.utils import email_verific...
redvasily/django-emailauth
emailauth/tests.py
Python
bsd-3-clause
14,812
from .base import * DEBUG = True EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' try: from .local import * except ImportError: pass MIDDLEWARE_CLASSES += [ 'debug_toolbar.middleware.DebugToolbarMiddleware', ]
greven/vagrant-django
project_name/settings/dev.py
Python
bsd-3-clause
233
# # Copyright (c) 2010-2011, Nick Blundell # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list of cond...
blundeln/pylens
scripts/generate_docs.py
Python
bsd-3-clause
5,581
import csv import argparse import json import logging import textwrap from edgar_importing import db from edgar_importing import ala from geoalchemy import WKTSpatialElement import geoalchemy.functions import sqlalchemy import shapely.wkt from shapely.geometry import Polygon, MultiPolygon # map of BLA categories to db...
jcu-eresearch/Edgar
importing/edgar_importing/birdlife_shapefile_import.py
Python
bsd-3-clause
8,026
# proxy module from __future__ import absolute_import from mayavi.modules.slice_unstructured_grid import *
enthought/etsproxy
enthought/mayavi/modules/slice_unstructured_grid.py
Python
bsd-3-clause
107
# -*- coding: utf-8 -*- # # desispec documentation build configuration file, created by # sphinx-quickstart on Tue Dec 9 10:43:33 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # ...
desihub/desispec
doc/conf.py
Python
bsd-3-clause
10,086
#!/usr/bin/env python # -*- coding: utf-8 -*- ######################################################################### # Copyright/License Notice (Modified BSD License) # ######################################################################### ###################################################...
knaggsy2000/stormforce-mq
plugins/plugin_core_debug.py
Python
bsd-3-clause
4,779
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'MapLandmark.importance' db.delete_column(u'eve_db_mapla...
gtaylor/django-eve-db
eve_db/migrations/0017_auto__del_field_maplandmark_importance__del_field_maplandmark_radius.py
Python
bsd-3-clause
72,063
# -*- coding: utf-8 -*- """ pyalgs ~~~~~ pyalgs provides the python implementation of the Robert Sedgwick's Coursera course on Algorithms (Part I and Part II). :copyright: (c) 2017 by Xianshun Chen. :license: BSD, see LICENSE for more details. """ __version__ = '0.0.14'
chen0040/pyalgs
pyalgs/__init__.py
Python
bsd-3-clause
291
#-*- coding: utf-8 -*- """\ ====== Grades ====== For managing student grades, most teachers use spreadsheet tools. With these tools, it is hard to maintain grades in plain text files that are easily readable by humans. The goal of **Grades** is to let teachers manage their students's grade in plain text file while pro...
loicseguin/grades
grades/__init__.py
Python
bsd-3-clause
878
from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Filter import Filter from PLC.AddressTypes import AddressType, AddressTypes from PLC.Auth import Auth class GetAddressTypes(Method): """ Returns an array of structs containing details about address ty...
dreibh/planetlab-lxc-plcapi
PLC/Methods/GetAddressTypes.py
Python
bsd-3-clause
1,109
from setuptools import setup, find_packages import os version = '1.3.0' setup(name='collective.webservicespfgadapter', version=version, description="PloneFormGen adapter that sends the form submission \ to a web service", long_description=open("README.md").read() + "\n" + ...
PSUEducationalEquity/collective.webservicespfgadapter
setup.py
Python
bsd-3-clause
1,153
#!/usr/bin/env python # -*- coding: utf-8 -*- """ author: Panagiotis Mavrogiorgos email : gmail, pmav99 """ from __future__ import division from __future__ import print_function from __future__ import unicode_literals from __future__ import absolute_import import sys if sys.version_info.major < 3: from future_...
pmav99/interpolation
tests/__init__.py
Python
bsd-3-clause
370
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Wrappers for gsutil, for basic interaction with Google Cloud Storage.""" import cStringIO import hashlib import logging import os import subprocess i...
ChromiumWebApps/chromium
tools/telemetry/telemetry/page/cloud_storage.py
Python
bsd-3-clause
6,562
"""This section introduces classes used by pulsar :ref:`wsgi application <apps-wsgi>` to pass a request/response state during an HTTP request. .. contents:: :local: The :class:`WsgiRequest` is a thin wrapper around a WSGI ``environ`` dictionary. It contains only the ``environ`` as its private data. The :class:`Ws...
quantmind/pulsar
pulsar/apps/wsgi/wrappers.py
Python
bsd-3-clause
13,989
# -*- coding: utf-8 -*- """ werkzeug._internal ~~~~~~~~~~~~~~~~~~ This module provides internally used helpers and constants. :copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import re import string import inspect from weakre...
syrrim/werkzeug
werkzeug/_internal.py
Python
bsd-3-clause
13,953
""" API for communicating with the i3 window manager. """ import json import subprocess class I3Msg(object): """Send messages to i3.""" def __init__(self, socket=None, msgbin=None): """ Initialize the messager. @param socket The socket to connect to i3 via. @param msgbin The...
BlueDragonX/fm-dot
i3/lib/i3.py
Python
bsd-3-clause
4,205
# -*- coding: utf-8 -* """HydraTK installation commands .. module:: lib.install.command :platform: Unix :synopsis: HydraTK installation commands .. moduleauthor:: Petr Rašek <bowman@hydratk.org> """ from subprocess import call, Popen, PIPE from os import path, environ from sys import exit from hydratk.lib.syst...
hydratk/hydratk
src/hydratk/lib/install/command.py
Python
bsd-3-clause
6,457
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Disease', fields=[ ...
ohmini/thaifoodapi
thaifood/migrations/0001_initial.py
Python
bsd-3-clause
10,416
#! /usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) 2014, Nicolas P. Rougier # Distributed under the (new) BSD License. See LICENSE.txt for more info. # ----------------------------------------------------------------------------...
duyuan11/glumpy
examples/transform-pan-zoom.py
Python
bsd-3-clause
1,497