content stringlengths 27 928k | path stringlengths 4 230 | size int64 27 928k | nl_text stringlengths 21 396k | nl_size int64 21 396k | nl_language stringlengths 2 3 | nl_language_score float64 0.04 1 |
|---|---|---|---|---|---|---|
"""GoldenTimes URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | GoldenTimes/urls.py | 1,414 | GoldenTimes URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | 708 | en | 0.618022 |
import sys
##print ("This is the name of the script: ", sys.argv[0])
##print ("Number of arguments: ", len(sys.argv))
##print ("The arguments are: " , str(sys.argv))
lemmas = []
lemmas_cleaned = []
nums = ['1','2','3','4','5','6','7','8','9','0']
alphabet = ['a','b','c','d','e','f','g','h','i','j','k','k','l','m','n',... | dictionaries/archives/dict_scrape.py | 1,785 | Scrapes a dictionary for a given part of speech. POS tags in POS_tags.
POS(str), dictionaryfile(str-of-filename) -> list-of-strings
print ("This is the name of the script: ", sys.argv[0])print ("Number of arguments: ", len(sys.argv))print ("The arguments are: " , str(sys.argv))1, ... | 504 | en | 0.546791 |
"""
mbed SDK
Copyright (c) 2011-2016 ARM Limited
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 wr... | os-lib/mbed-os/tools/build_api.py | 54,457 | Convert src_paths to a list if needed Pass all params to the unified prepare_resources() Scan src_path for config files Update configuration files until added features creates no changes Update the configuration with any .json files found while scanning Add features while we find new ones For version 2, either ARM or u... | 3,735 | en | 0.811994 |
"""
Django settings for berlapan project.
Generated by 'django-admin startproject' using Django 3.2.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import os
f... | berlapan/settings.py | 4,858 | Django settings for berlapan project.
Generated by 'django-admin startproject' using Django 3.2.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
Build paths inside... | 1,780 | en | 0.739455 |
'''Faça um programa que leia o sexo de uma pessoa, mas só aceite os valores ‘M’ ou ‘F’.Caso esteja errado, peça
a digitação novamente até ter um valor correto.'''
sexo = str(input('Informe seu sexo: [M/F] ')).strip().upper()[0]
while sexo not in 'MmFf':
sexo = str(input('Dados inválidos. Por favor, informe seu sexo... | exercicios/PythonExercicios/ex057.py | 415 | Faça um programa que leia o sexo de uma pessoa, mas só aceite os valores ‘M’ ou ‘F’.Caso esteja errado, peça
a digitação novamente até ter um valor correto. | 156 | pt | 0.997607 |
""" Solver classes for domain adaptation experiments
"""
__author__ = "Steffen Schneider"
__email__ = "steffen.schneider@tum.de"
import os, time
import pandas as pd
import numpy as np
from tqdm import tqdm
import torch
import torch.utils.data
import torch.nn as nn
from .. import Solver, BaseClassSolver
from ... ... | salad/solver/da/base.py | 2,341 | A domain adaptation solver that actually does not run any adaptation algorithm
This is useful to establish baseline results for the case of no adaptation, for measurement
of the domain shift between datasets.
Base Class for Unsupervised Domain Adaptation Approaches
Base Class for Unsupervised Domain Adaptation A... | 405 | en | 0.887664 |
# -------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ----------------------------------------------------------------------... | PyStationB/projects/CellSignalling/slow_tests/simulation/test_cellsig_tutorials.py | 1,810 | ------------------------------------------------------------------------------------------- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. ------------------------------------------------------------------------------... | 550 | en | 0.605622 |
# Solution to Problem 8
# Program outputs today's date and time in the format "Monday, January 10th 2019 at 1:15pm"
# To start we import the Python datetime module as dt.
from datetime import datetime as dt
#now equals the date and time now.
now = dt.now()
# Copied verbatim initially from stacoverflow Reference 1 bel... | solution-8.py | 1,563 | Solution to Problem 8 Program outputs today's date and time in the format "Monday, January 10th 2019 at 1:15pm" To start we import the Python datetime module as dt.now equals the date and time now. Copied verbatim initially from stacoverflow Reference 1 below but amended to fit my referenceing of time as now. Suffix eq... | 1,282 | en | 0.845523 |
import math
import chainer
import chainer.functions as F
import chainer.links as L
import numpy as np
from .sn_convolution_2d import SNConvolution2D, SNDeconvolution2D
from .sn_linear import SNLinear
def _upsample(x):
h, w = x.shape[2:]
return F.unpooling_2d(x, 2, outsize=(h * 2, w * 2))
def _downsample(x):
... | nets/block.py | 15,042 | Below code copyed from https://github.com/pfnet-research/chainer-gan-lib/blob/master/minibatch_discrimination/net.py | 116 | en | 0.655731 |
#
# Copyright (c) YugaByte, 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 writing, s... | thirdparty/build_definitions/__init__.py | 5,181 | Copyright (c) YugaByte, 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 writing, software distribute... | 587 | en | 0.835045 |
#
# cbpro/order_book.py
# David Caseria
#
# Live order book updated from the Coinbase Websocket Feed
from sortedcontainers import SortedDict
from decimal import Decimal
import pickle
from cbpro.public_client import PublicClient
from cbpro.websocket_client import WebsocketClient
class OrderBook(WebsocketClient):
... | cbpro/order_book.py | 9,579 | Logs real-time changes to the bid-ask spread to the console
Currently OrderBook only supports a single product even though it is stored as a list of products.
cbpro/order_book.py David Caseria Live order book updated from the Coinbase Websocket Feed ignore older messages (e.g. before order book initialization from ... | 711 | en | 0.898401 |
import json
import boto3
import os
from helper import AwsHelper
import time
def startJob(bucketName, objectName, itemId, snsTopic, snsRole, apiName):
print("Starting job with itemId: {}, bucketName: {}, objectName: {}".format(itemId, bucketName, objectName))
response = None
client = AwsHelper().getClient... | rekognition-pipeline/lambda/asyncprocessor/lambda_function.py | 7,540 | Receive message from SQS queue14400 Delete received message from queue | 70 | en | 0.979641 |
# coding: utf-8
"""
Laserfiche API
Welcome to the Laserfiche API Swagger Playground. You can try out any of our API calls against your live Laserfiche Cloud account. Visit the developer center for more details: <a href=\"https://developer.laserfiche.com\">https://developer.laserfiche.com</a><p><strong>Build# ... | laserfiche_api/models/watermark.py | 9,163 | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Returns true if both objects are equal
Watermark - a model defined in Swagger
Returns true if both objects are not equal
For `print` and `pprint`
Gets the is_watermark_mandatory of this Watermark. # noqa: E501
A... | 3,737 | en | 0.627806 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
# pylint: disable=no-member
#
# @Author: oesteban
# @Date: 2016-02-23 19:25:39
# @Email: code@oscaresteban.es
# @Last Modified by: oesteban
# @Last Modifie... | packages/structural_dhcp_mriqc/structural_dhcp_mriqc/qc/functional.py | 8,733 | Compute the mean :abbr:`DVARS (D referring to temporal
derivative of timecourses, VARS referring to RMS variance over voxels)`
[Power2012]_.
Particularly, the *standardized* :abbr:`DVARS (D referring to temporal
derivative of timecourses, VARS referring to RMS variance over voxels)`
[Nichols2013]_ are computed.
.. no... | 3,630 | en | 0.729733 |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tutotrial.settings')
try:
from django.core.management import execute_from_command_line
except Im... | tutorial/manage.py | 665 | Run administrative tasks.
Django's command-line utility for administrative tasks.
!/usr/bin/env python | 103 | en | 0.725633 |
import torch
import torch.nn.functional as F
import argparse
import cv2
import numpy as np
from glob import glob
import matplotlib.pyplot as plt
num_classes = 2
img_height, img_width = 64, 64#572, 572
out_height, out_width = 64, 64#388, 388
GPU = False
torch.manual_seed(0)
class Mynet(torch.nn.Module):
def __ini... | Question_semaseg/my_answers/bin_loss_pytorch.py | 1,518 | 572, 572388, 388 necessarry? | 29 | es | 0.213721 |
# -*- coding: utf-8 -*-
"""
celery.result
~~~~~~~~~~~~~
Task results/state and groups of results.
"""
from __future__ import absolute_import
import time
import warnings
from collections import deque
from contextlib import contextmanager
from copy import copy
from kombu.utils import cached_property
from... | venv/lib/python2.7/site-packages/celery/result.py | 28,560 | Query task state.
:param id: see :attr:`id`.
:keyword backend: see :attr:`backend`.
Result that we know has already been executed.
Like :class:`ResultSet`, but with an associated id.
This type is returned by :class:`~celery.group`, and the
deprecated TaskSet, meth:`~celery.task.TaskSet.apply_async` method.
It enable... | 9,532 | en | 0.828099 |
import tensorflow as tf
from tensorflow.keras.models import Model
import pandas as pd
import matplotlib.pyplot as plt
import os
import logging
from .common import create_directories
def get_prepared_model(stage: str, no_classes: int, input_shape: list, loss: str, optimizer: str, metrics: list) -> \
Model:
... | src/utils/model.py | 5,188 | Args:
checkpoint_dir: Directory to save the model at checkpoint
tensorboard_logs: Directory to save tensorboard logs
stage: Stage name for training
Returns:
callback_list: List of created callbacks
Function creates ANN model and compile.
Args:
stage ([str]): stage of experiment
no_classes ([INT]... | 880 | en | 0.694404 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehumancommunity.org/
**Github Code Home Page:** https://github.com/makehumancommunity/
**Authors:** Thomas Larsson, Jonas Hauquier
**Copyright(c):** MakeHuman Team 2001-2019
*... | makehuman-master/makehuman/plugins/9_export_collada/dae_geometry.py | 9,908 | **Project Name:** MakeHuman
**Product Home Page:** http://www.makehumancommunity.org/
**Github Code Home Page:** https://github.com/makehumancommunity/
**Authors:** Thomas Larsson, Jonas Hauquier
**Copyright(c):** MakeHuman Team 2001-2019
**Licensing:** AGPL3
This file is part o... | 1,692 | en | 0.707142 |
# Copyright (c) MONAI Consortium
# 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, so... | tests/test_dataloader.py | 3,311 | Testing data loader working with the randomizable interface
Copyright (c) MONAI Consortium 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 requ... | 614 | en | 0.851058 |
# qubit number=5
# total number=45
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as ... | benchmark/startQiskit1005.py | 4,079 | qubit number=5 total number=45 implement the oracle O_f^\pm NOTE: use U1 gate (P gate) with \lambda = 180 ==> CZ gate or multi_control_Z_gate (issue 127) oracle.h(controls[n]) oracle.barrier() circuit begin number=3 number=4 number=5 number=6 number=21 number=1 number=2 number=7 number=8 number=36 number=37 number=38 n... | 580 | en | 0.222829 |
#from mq import *
import sys, time
import urllib3
#networking library
import json
try:
print("Press CTRL+C to abort.")
#mq = MQ();
while True:
http = urllib3.PoolManager()
#perc = mq.MQPercentage()
sys.stdout.write("\r")
sys.stdout.write("\033[K")
data = {
... | hardware/testing/fusecontrol.py | 821 | from mq import *networking librarymq = MQ();perc = mq.MQPercentage()create JSON objectIP add server | 99 | en | 0.515321 |
import click
from ...runner import events
from . import default
def handle_after_execution(context: events.ExecutionContext, event: events.AfterExecution) -> None:
context.endpoints_processed += 1
default.display_execution_result(context, event)
if context.endpoints_processed == event.schema.endpoints_co... | src/schemathesis/cli/output/short.py | 1,016 | Short output style shows single symbols in the progress bar.
Otherwise, identical to the default output style. | 111 | en | 0.607232 |
from ..utils import sortkey, capitalize_first
FIGURE_TEX_TEMPLATE = r'\hwgraphic{{{path}}}{{{headword}}}{{{attribution}}}'
# change to {filename} if you want to specify full paths.
FIGURE_PATH_TEMPLATE = r'figures/ill-{filename}'
class Image(object):
type = 'img'
def sk(self):
return sortkey(self.hw... | sfm2latex/dictionary/Image.py | 890 | change to {filename} if you want to specify full paths. | 55 | en | 0.612925 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | Blender 2.91/2.91/scripts/addons/space_view3d_math_vis/utils.py | 5,621 | BEGIN GPL LICENSE BLOCK This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it wi... | 1,187 | en | 0.880783 |
from django_unicorn.components import QuerySetType, UnicornView
from example.coffee.models import Flavor, Taste
class AddFlavorView(UnicornView):
is_adding = False
flavors = None
flavor_qty = 1
flavor_id = None
def __init__(self, *args, **kwargs):
super().__init__(**kwargs) # calling supe... | example/unicorn/components/add_flavor.py | 1,019 | calling super is required | 25 | en | 0.893343 |
""" Measure stent migration relative to renals
Option to visualize 2 longitudinal scans
"""
import sys, os
import visvis as vv
from stentseg.utils.datahandling import select_dir, loadvol, loadmodel, loadmesh
from stentseg.stentdirect.stentgraph import create_mesh
from stentseg.utils.visualization import show_ctvolume
f... | lspeas/analysis/stent_migration.py | 9,297 | Measure stent migration relative to renals
Option to visualize 2 longitudinal scans
sys.path.insert(0, os.path.abspath('..')) parent, 2 folders further in pythonPathimport utils_analysisfrom utils_analysis import ExcelAnalysisimport get_anaconda_ringpartstodo: from outline to script: Initialize select the ssdf basedi... | 2,548 | en | 0.594953 |
"""
Django settings for my_site project.
Generated by 'django-admin startproject' using Django 1.11.29.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import o... | my_site/settings.py | 3,452 | Django settings for my_site project.
Generated by 'django-admin startproject' using Django 1.11.29.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
Build paths ins... | 997 | en | 0.647074 |
import os
import sys
cwd = os.getcwd()
sys.path.append(cwd)
import time, math
import numpy as np
from pnc.interface import Interface
from config.manipulator_config import ManipulatorConfig
from pnc.robot_system.pinocchio_robot_system import PinocchioRobotSystem
class ManipulatorInterface(Interface):
def __init_... | pnc/manipulator_pnc/manipulator_interface.py | 1,701 | Update Robot Operational Space Control Compute Cmd Increase time variables TODO : Implement Operational Space Control | 117 | en | 0.543263 |
from __future__ import print_function, absolute_import
import argparse
import os.path as osp
import random
import numpy as np
import sys
import collections
import copy
import time
from datetime import timedelta
from sklearn.cluster import DBSCAN, KMeans
from sklearn.preprocessing import normalize
import torch
from to... | examples/rsc_baseline.py | 10,695 | from reid.models.dsbn import convert_dsbn, convert_bn from reid.models.csbn import convert_csbn from reid.models.idm_dsbn import convert_dsbn_idm, convert_bn_idm from reid.models.xbm import XBM data_dir = '/data/datasets' T.RandomErasing(probability=0.5, mean=[0.485, 0.456, 0.406]) use CUDA Create datasets Create model... | 458 | en | 0.397495 |
# Copyright 2016 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 agre... | openhtf/output/callbacks/__init__.py | 3,481 | Class that does atomic write in a contextual manner.
Output the given TestRecord to a file.
Instances of this class are intended to be used as an output callback
(see Test.add_output_callbacks) to output TestRecord results to a file.
This base implementation outputs the TestRecord by serializing it via
the pickle modu... | 1,725 | en | 0.831219 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, 9T9IT and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class CustomPurchaseReceiptItem(Document):
pass
| optic_store/optic_store/doctype/custom_purchase_receipt_item/custom_purchase_receipt_item.py | 267 | -*- coding: utf-8 -*- Copyright (c) 2019, 9T9IT and contributors For license information, please see license.txt | 112 | en | 0.816219 |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import random
import torch
import torchvision
from torchvision.transforms import functional as F
class Compose(object):
def __init__(self, transforms):
self.transforms = transforms
def __call__(self, image, target):
for ... | fcos_core/data/transforms/transforms.py | 3,275 | Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. modified from torchvision to add support for max size modified from torchvision to add support for max size | 177 | en | 0.900704 |
# -*- coding:utf-8 -*-
"""
FTX Trade module.
https://docs.ftx.com/
Project: alphahunter
Author: HJQuant
Description: Asynchronous driven quantitative trading framework
"""
import time
import zlib
import json
import copy
import hmac
import base64
from urllib.parse import urljoin
from collections import defaultdict, d... | quant/platform/ftx.py | 45,427 | FTX Trade module. You can initialize trader object with some attributes in kwargs.
FTX Trade module. You can initialize trader object with some attributes in kwargs.
Initialize.
Initialize.
将交易所订单结构转换为本交易系统标准订单结构格式
Fill update.
Args:
fill_info: Fill information.
Returns:
None.
kline up... | 7,544 | en | 0.3317 |
import os
import matplotlib.pyplot as plt
plt.style.use("seaborn")
import numpy as np
from lib.utils import read_csv, find_cargo_root
from lib.blocking import block
data_folder = os.path.join(find_cargo_root(), "data")
save_folder = os.path.join(os.path.dirname(find_cargo_root()), "report", "assets")
if not os.path.is... | vmc/result_analysis/E_vs_MCs.py | 1,298 | bruteforce_std = [np.sqrt(block(np.array(vals))[1]) for vals in [bruteforce["energy[au]"][1:up_to] for up_to in x]]importance_std = [np.sqrt(block(np.array(vals))[1]) for vals in [importance["energy[au]"][1:up_to] for up_to in x]]plt.plot(x, bruteforce_std, "-o", label="Brute-force")plt.plot(x, importance_std, "-o", la... | 337 | en | 0.391776 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-04-22 11:53
from __future__ import unicode_literals
import company.models
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | InvenTree/company/migrations/0001_initial.py | 1,286 | -*- coding: utf-8 -*- Generated by Django 1.11.12 on 2018-04-22 11:53 | 69 | en | 0.59464 |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... | docs/conf.py | 2,088 | Configuration file for the Sphinx documentation builder. This file only contains a selection of the most common options. For a full list see the documentation: http://www.sphinx-doc.org/en/master/config -- Path setup -------------------------------------------------------------- If extensions (or modules to document wi... | 1,512 | en | 0.692223 |
"""
This module lets you experience the POWER of FUNCTIONS and PARAMETERS.
Authors: David Mutchler, Vibha Alangar, Matt Boutell, Dave Fisher,
Aaron Wilkin, their colleagues, and Morgan Brown.
""" # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE.
import rosegraphics as rg
def main():
"""
Calls the other ... | src/m5_why_parameters_are_powerful.py | 7,659 | Starts out the same as the draw_circles function defined ABOVE.
You Will make it an IMPROVED, MORE POWERFUL function per the above _TODO_.
Constructs a SimpleTurtle, then uses the SimpleTurtle to draw 10 circles
such that:
-- Each is centered at the given Point, and
-- They have radii: 15 30 45 60 75 ...,... | 5,660 | en | 0.839812 |
"""
ETNA School API Wrapper
~~~~~~~~~~~~~~~~~~~~~~~
A python wrapper to help make python3 apps/bots using the ETNA API.
:copyright: (c) 2019 Yohann MARTIN
:license: MIT, see LICENSE for more details.
"""
__title__ = 'etnapy'
__author__ = 'Yohann MARTIN'
__license__ = 'MIT'
__version__ = "1.0.0"
from .user import Us... | etnapy/__init__.py | 401 | ETNA School API Wrapper
~~~~~~~~~~~~~~~~~~~~~~~
A python wrapper to help make python3 apps/bots using the ETNA API.
:copyright: (c) 2019 Yohann MARTIN
:license: MIT, see LICENSE for more details. | 197 | en | 0.383838 |
""" compatibility OpenTimelineIO 0.12.0 and older
"""
import os
import re
import sys
import json
import opentimelineio as otio
from . import utils
import clique
self = sys.modules[__name__]
self.track_types = {
"video": otio.schema.TrackKind.Video,
"audio": otio.schema.TrackKind.Audio
}
self.project_fps = Non... | openpype/hosts/resolve/otio/davinci_export.py | 10,559 | compatibility OpenTimelineIO 0.12.0 and older
get clip property regarding to type if it is file sequence try to create `ImageSequenceReference` the OTIO might not be compatible so return nothing and do it old way in case old OTIO or video file create `ExternalReference` add metadata to otio item if gap between track ... | 878 | en | 0.702404 |
""" generators for the neuron project """
# general imports
import sys
import os
import zipfile
# third party imports
import numpy as np
import nibabel as nib
import scipy
import keras
from keras.utils import np_utils
from keras.models import Model
# local packages
import pynd.ndutils as nd
import pytools.patchlib ... | ext/neuron/neuron/generators.py | 39,435 | get a list of files at the given path with the given extension
load a medical volume from one of a number of file types
taken from https://stackoverflow.com/a/43223420
Takes a path to an .npz file, which is a Zip archive of .npy files.
Generates a sequence of (name, shape, np.dtype).
namelist is a list with variable ... | 7,204 | en | 0.7314 |
from adminsortable2.admin import SortableAdminMixin
from decimal import Decimal
from django.contrib import admin
from django.contrib.gis import admin as geo_admin
from import_export import fields
from import_export import widgets
from import_export.admin import ImportExportModelAdmin
from import_export.resources import... | aclarknet/database/admin.py | 10,275 | Convert strings to boolean values
Convert strings to decimal values
Register your models here. auto fill id? 295 https://github.com/django-import-export/django-import-export... | 331 | en | 0.415009 |
from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "E07000146"
stations_name = "parl.2019-12-12/Version 1/west-norfolk.gov.uk-1572885849000-.tsv"
addresses_name = "parl... | polling_stations/apps/data_collection/management/commands/import_kings_lynn.py | 1,685 | Dersingham Village Centre Windsor Park, KING`S LYNN | 51 | en | 0.887178 |
# -*- coding: utf-8 -*-
# Django settings for basic pinax project.
import os.path
import posixpath
import pinax
PINAX_ROOT = os.path.abspath(os.path.dirname(pinax.__file__))
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
# tells Pinax to use the default theme
PINAX_THEME = "default"
DEBUG = True
TEMPLATE... | pinax/projects/basic_project/settings.py | 6,312 | -*- coding: utf-8 -*- Django settings for basic pinax project. tells Pinax to use the default theme tells Pinax to serve media through the staticfiles app. ("Your Name", "your_email@domain.com"), Add "postgresql_psycopg2", "postgresql", "mysql", "sqlite3" or "oracle". Or path to database file if using sqlite3. Not used... | 2,053 | en | 0.753954 |
"""Generates faucet config for given number of switches and number of devices per switch"""
import getopt
import sys
import yaml
from forch.utils import proto_dict
from forch.proto.faucet_configuration_pb2 import Interface, StackLink, Datapath, \
Vlan, FaucetConfig, LLDPBeacon, Stack
CORP_DP_ID = 273
T1_DP_ID_STA... | testing/python_lib/build_config.py | 10,090 | Class for generating faucet config for given switches and devices per switch
Create Faucet config for corp network
Create Faucet config with flat topology
Create Faucet config with stacking topology
main method for standalone run
Generates faucet config for given number of switches and number of devices per switch
py... | 575 | en | 0.563435 |
import logging
import yaml
from scanapi.config_loader import load_config_file
from scanapi.errors import (
BadConfigurationError,
EmptyConfigFileError,
InvalidKeyError,
InvalidPythonCodeError,
)
from scanapi.exit_code import ExitCode
from scanapi.reporter import Reporter
from scanapi.session import se... | scanapi/scan.py | 2,045 | Caller function that tries to scans the file and write the report.
Constructs a Reporter object and calls the write method of Reporter to
push the results to a file. | 165 | en | 0.905373 |
# 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... | research/object_detection/metrics/coco_tools.py | 43,170 | Wrapper for the pycocotools COCOeval class.
To evaluate, create two objects (groundtruth_dict and detections_list)
using the conventions listed at http://mscoco.org/dataset/#format.
Then call evaluation as follows:
groundtruth = coco_tools.COCOWrapper(groundtruth_dict)
detections = groundtruth.LoadAnnotations(det... | 20,226 | en | 0.763074 |
import os
from PySide2 import QtWidgets
from mapclientplugins.filechooserstep.ui_configuredialog import Ui_ConfigureDialog
INVALID_STYLE_SHEET = 'background-color: rgba(239, 0, 0, 50)'
DEFAULT_STYLE_SHEET = ''
class ConfigureDialog(QtWidgets.QDialog):
"""
Configure dialog to present the user with the optio... | mapclientplugins/filechooserstep/configuredialog.py | 5,404 | Configure dialog to present the user with the options to configure this step.
Override the accept method so that we can confirm saving an
invalid configuration.
Get the current value of the configuration from the dialog. Also
set the _previousIdentifier value so that we can check uniqueness of the
identifier over the ... | 1,191 | en | 0.841697 |
from problem import Problem
class DistinctPowers(Problem, name="Distinct powers", expected=9183):
@Problem.solution()
def brute_force(self):
# Good ol fashion set comprehension
return len({a ** b for a in range(2, 101) for b in range(2, 101)})
| problems/p029.py | 270 | Good ol fashion set comprehension | 33 | en | 0.735799 |
# terrascript/data/mrcrilly/awx.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:12:44 UTC)
import terrascript
class awx_credential(terrascript.Data):
pass
class awx_credential_azure_key_vault(terrascript.Data):
pass
class awx_credentials(terrascript.Data):
pass
__all__ = [
"awx... | terrascript/data/mrcrilly/awx.py | 397 | terrascript/data/mrcrilly/awx.py Automatically generated by tools/makecode.py (24-Sep-2021 15:12:44 UTC) | 104 | en | 0.415945 |
#
# (C) Copyright IBM Corp. 2019
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | pywren_ibm_cloud/libs/ibm_cloudfunctions/iam.py | 2,642 | (C) Copyright IBM Corp. 2019 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 distrib... | 550 | en | 0.865228 |
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2015, Luis Pedro Coelho <luis@luispedro.org>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# 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... | milk/supervised/classifier.py | 3,597 | ctransf = ctransforms(c0, c1, c2, ...)
Concatenate transforms.
model = ctransforms_model(models)
A model that consists of a series of transformations.
See Also
--------
ctransforms
threshold_model
Attributes
----------
threshold : float
threshold value
-*- coding: utf-8 -*- Copyright (C) 2008-2015, Luis Ped... | 1,431 | en | 0.831759 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | test/TEX/subdir_variantdir_include2.py | 4,355 | !/usr/bin/env python __COPYRIGHT__ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub... | 1,442 | en | 0.817864 |
#!/usr/bin/env python
"""The setup script."""
from setuptools import find_packages, setup
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
with open('requirements.txt') as requirements_file:
requirements = require... | setup.py | 1,782 | The setup script.
!/usr/bin/env python | 39 | en | 0.349468 |
# Copyright (c) 2011 Sam Rushing
"""ECC secp256k1 OpenSSL wrapper.
WARNING: This module does not mlock() secrets; your private keys may end up on
disk in swap! Use with caution!
This file is modified from python-bitcoinlib.
"""
import ctypes
import ctypes.util
import hashlib
import sys
ssl = ctypes.cdll.LoadLibrary... | test/functional/test_framework/key.py | 8,500 | Wrapper around OpenSSL's EC_KEY
An encapsulated public key
Attributes:
is_valid - Corresponds to CPubKey.IsValid()
is_fullyvalid - Corresponds to CPubKey.IsFullyValid()
is_compressed - Corresponds to CPubKey.IsCompressed()
Verify a DER signature
ECC secp256k1 OpenSSL wrapper.
WARNING: This module does not mlock... | 781 | en | 0.727319 |
# -*- coding: utf-8 -*-
import errno
import os
import re
import hashlib
import tempfile
import sys
import shutil
import logging
import click
import crayons
import delegator
import parse
import requests
import six
import stat
import warnings
try:
from weakref import finalize
except ImportError:
try:
fro... | pipenv/utils.py | 43,253 | A Beautiful hack, which allows us to tell pip which version of Python we're using.
Needed for pip-tools.
Create and return a temporary directory. This has the same
behavior as mkdtemp but can be used as a context manager. For
example:
with TemporaryDirectory() as tmpdir:
...
Upon exiting the context, th... | 8,195 | en | 0.790413 |
from ui import *
startUI()
# # - read the input data:
# import MnistLoader
# training_data, validation_data, test_data = MnistLoader.load_data_wrapper()
# training_data = list(training_data)
# # ---------------------
... | Test.py | 1,744 | - read the input data: import MnistLoader training_data, validation_data, test_data = MnistLoader.load_data_wrapper() training_data = list(training_data) --------------------- - network.py example: from Network import Network, vectorized_result from NetworkLoader import save, load netPath = "E:\\ITMO University\\Инт... | 1,365 | en | 0.176297 |
#!/usr/bin/env python
import unittest
from math import pi # , isnan
from random import random
import gemmi
from gemmi import Position, UnitCell
class TestMath(unittest.TestCase):
def test_SMat33_transformed_by(self):
tensor = gemmi.SMat33f(random(), random(), random(),
rand... | tests/test_unitcell.py | 6,124 | !/usr/bin/env python , isnan tested against values from uctbx: from cctbx import uctbx uc = uctbx.unit_cell((35.996, 41.601, 45.756, 67.40, 66.90, 74.85)) uc.d_star_sq((-3, -2, 1)) uc.d((3, 4, 5)) uc.metrical_matrix() uc.reciprocal_metrical_matrix() tested against values from cctbx: from cctbx import uctbx, adptb... | 757 | en | 0.50889 |
# Coyright 2017-2019 Nativepython 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 ... | typed_python/__init__.py | 1,868 | Coyright 2017-2019 Nativepython 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 or agreed to in writ... | 766 | en | 0.882776 |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets 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 appl... | tensorflow_datasets/text/reddit_disentanglement.py | 5,429 | Reddit Disentanglement dataset.
Remove duplicated records.
Yields examples.
Returns SplitGenerators.
reddit_disentanglement dataset.
coding=utf-8 Copyright 2020 The TensorFlow Datasets Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the Lice... | 836 | en | 0.826337 |
"""Copyright (c) 2005-2017, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms,... | python/pycml/processors.py | 50,918 | We want to see any errors Re-run validation & analysis Clear up logging Component with this name doesn't exist Create the component print "connect_variables(", src_cname, src_vname, "to", target_cname, target_vname, ")" Determine encapsulation paths from target & source to the root print "paths: src=", ... | 4,121 | en | 0.763123 |
#!/usr/bin/env python
#
# Run wasm benchmarks in various configurations and report the times.
# Run with -h for help.
#
# Note: this is a copy of wasm-bench.py adapted for d8.
#
# In the default mode which is "turbofan+liftoff", runs a single shell with
# `--no-wasm-tier-up --liftoff` and `--no-wasm-tier-up --no-liftof... | asm_v_wasm/wasm_bench-d8.py | 14,443 | !/usr/bin/env python Run wasm benchmarks in various configurations and report the times. Run with -h for help. Note: this is a copy of wasm-bench.py adapted for d8. In the default mode which is "turbofan+liftoff", runs a single shell with `--no-wasm-tier-up --liftoff` and `--no-wasm-tier-up --no-liftoff` and prints thr... | 1,948 | en | 0.883934 |
from typing import Dict, List, Any
import numpy as np
import cv2
from vcap import (
DetectionNode,
DETECTION_NODE_TYPE,
OPTION_TYPE,
BaseStreamState,
BaseBackend,
rect_to_coords)
from vcap_utils import (
BaseOpenVINOBackend,
)
SOS_INDEX = 0
EOS_INDEX = 1
MAX_SEQ_LEN = 28
ALPHABET = ' 012... | capsules/detector_text_openvino/backend.py | 4,255 | We have to do this because we need there to be a process_frame to use it | 72 | en | 0.960407 |
import dlib
from termcolor import colored
from face_cropper.core import DLIB_FACE_DETECTING_MIN_SCORE
def detect(image: str, verbose: bool = False):
"""Detects faces on a given image using dlib and returns matches.
:param image: Path to access the image to be searched
:type image: [string]
:param ve... | face_cropper/core/detector.py | 1,197 | Detects faces on a given image using dlib and returns matches.
:param image: Path to access the image to be searched
:type image: [string]
:param verbose: Wether or not command should output informations
:type image: [bool], default to False
:raises RuntimeError: When the provided image_path is invalid
:return: The ... | 395 | en | 0.632029 |
import numpy as np
import os
from sklearn.neighbors import NearestNeighbors
from pydrake.multibody.rigid_body import RigidBody
from pydrake.all import (
AddFlatTerrainToWorld,
AddModelInstancesFromSdfString,
AddModelInstanceFromUrdfFile,
FindResourceOrThrow,
FloatingBaseType,
... | src/utils.py | 6,215 | From https://www.opengl.org/discussion_boards/showthread.php/197893-View-and-Perspective-matrices Angle from rotation matrix If misalignment_tol = None, returns the average distance between the model clouds when transformed by est_tf and gt_tf (using nearest-point lookups for each point in the gt-tf'd model cloud). If ... | 1,048 | en | 0.877532 |
import os
import sys
import tarfile
from six.moves.urllib.request import urlretrieve
url = 'https://commondatastorage.googleapis.com/books1000/'
last_percent_reported = None
data_root = '.' # Change me to store data elsewhere
def download_progress_hook(count, blockSize, totalSize):
"""A hook to report the progr... | udacity_deep_learning/download_data.py | 2,658 | A hook to report the progress of a download. This is mostly intended for users with
slow internet connections. Reports every 5% change in download progress.
Download a file if not present, and make sure it's the right size.
Change me to store data elsewhere remove .tar.gz You may override by setting force=True. | 314 | en | 0.90038 |
#!/usr/bin/env python3
# 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 habitat.core.registry import registry
from habitat.core.simulator import Simulator
def _try_register_igibson_socia... | habitat/sims/igibson_challenge/__init__.py | 1,216 | !/usr/bin/env python3 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. noqa: F401 noqa: F401 noqa: F401 | 223 | en | 0.790096 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts import render, get_object_or_404
from .forms imp... | blog/blog/views.py | 2,075 | -*- coding: utf-8 -*- Show 25 contacts per page If page is not an integer, deliver first page. If page is out of range (e.g. 9999), deliver last page of results. | 161 | en | 0.682142 |
import numpy as np
import hypothesis
import strax.testutils
import straxen
def channel_split_naive(r, channel_ranges):
"""Slower but simpler implementation of straxen.split_channel_ranges"""
results = []
for left, right in channel_ranges:
results.append(r[np.in1d(r['channel'], np.arange(left, rig... | tests/test_channel_split.py | 944 | Slower but simpler implementation of straxen.split_channel_ranges | 65 | en | 0.501886 |
import sys
import resource
from recommender import recommender
reload(sys)
sys.setdefaultencoding("UTF8")
import os
import uuid
from flask import *
from flask.ext.socketio import SocketIO, emit
from flask_socketio import join_room, leave_room
import psycopg2
import psycopg2.extras
psycopg2.extensions.register_type(psyc... | .~c9_invoke_iUgkLr.py | 11,249 | return psycopg2.connect('dbname=movie_recommendations user=postgres password=Cmpgamer1 host=localhost') check whether user already exists add user to database flash error message user does not exist flash errorget dynamic top 12print("are we getting here?????????????")get dynamic top 12print("are we getting here???????... | 637 | en | 0.466049 |
import os
import sys
import tempfile
import pytest
import logging
from pathlib import Path
from dtaidistance import dtw, dtw_ndim, clustering, util_numpy
import dtaidistance.dtw_visualisation as dtwvis
from dtaidistance.exceptions import PyClusteringException
logger = logging.getLogger("be.kuleuven.dtai.distance")
d... | tests/test_clustering.py | 9,708 | show_ts_label = list(range(len(s))) def test_hook(from_idx, to_idx, distance): assert (from_idx, to_idx) in [(3, 0), (4, 1), (5, 2), (6, 2), (1, 0), (2, 0)] assert cluster_idx[0] == {0, 1, 2, 3, 4, 5, 6} test_clustering_tree() test_clustering_tree_maxdist() test_linkage_tree() test_controlchart() test_plotbug1() te... | 344 | en | 0.318576 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import OrderedDict
import logging
import numpy as np
from ray.rllib.policy.policy import Policy
from ray.rllib.policy.sample_batch import SampleBatch
from ray.rllib.policy.tf_policy import TFP... | rllib/policy/dynamic_tf_policy.py | 14,878 | A TFPolicy that auto-defines placeholders dynamically at runtime.
Initialization of this class occurs in two phases.
* Phase 1: the model is created and model variables are initialized.
* Phase 2: a fake batch of data is created, sent to the trajectory
postprocessor, and then used to create placeholders for th... | 3,080 | en | 0.732407 |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator, MultipleLocator, MaxNLocator
from matplotlib.path import Path
from matplotlib.patches import PathPatch
from matplotlib.colors import BoundaryNorm
import matplotlib.image as mpimg
Uinf=1
R=15
PI=np.pi
a... | util/unit_test/potential_test/cp_potential.py | 946 | ax.plot(angle, Z[edge_x,edge_y], 'ok', markersize=5)ax.set_ylim(limits[0], limits[1]) Grid | 90 | en | 0.218231 |
"""
Configuration for docs
"""
# source_link = "https://github.com/[org_name]/jrdsite"
# docs_base_url = "https://[org_name].github.io/jrdsite"
# headline = "App that does everything"
# sub_heading = "Yes, you got that right the first time, everything"
def get_context(context):
context.brand_html = "jrdsite"
| jrdsite/config/docs.py | 313 | Configuration for docs
source_link = "https://github.com/[org_name]/jrdsite" docs_base_url = "https://[org_name].github.io/jrdsite" headline = "App that does everything" sub_heading = "Yes, you got that right the first time, everything" | 238 | en | 0.734275 |
# MIT License
#
# Copyright (c) 2017 Tom Runia
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... | assignment_2/part3/model.py | 1,932 | MIT License Copyright (c) 2017 Tom Runia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribut... | 791 | en | 0.775571 |
'''
xbmcswift2.cli.cli
------------------
The main entry point for the xbmcswift2 console script. CLI commands can be
registered in this module.
:copyright: (c) 2012 by Jonathan Beluch
:license: GPLv3, see LICENSE for more details.
'''
import sys
from optparse import OptionParser
... | resources/lib/xbmcswift2/cli/cli.py | 2,208 | The entry point for the console script xbmcswift2.
The 'xbcmswift2' script is command bassed, so the second argument is always
the command to execute. Each command has its own parser options and usages.
If no command is provided or the -h flag is used without any other
commands, the general help message is shown.
xbmc... | 899 | en | 0.808266 |
from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, 'datadog_checks', 'logstash', '__about__.py')) as f:
exec(f.read(), ABOUT)
# Get the long description from ... | logstash/setup.py | 2,325 | To use a consistent encoding Get version info Get the long description from the README file Windows \r\n prevents match The project's main homepage. Author details License See https://pypi.org/classifiers The package we're going to ship Run-time dependencies Extra files to ship with the wheel package | 301 | en | 0.816398 |
import json
import os
import pathlib
from decouple import config
LIVE_DEMO_MODE = config('DEMO_MODE', cast=bool, default=False)
PORT = config('PORT', cast=int, default=5000)
APP_URL = 'https://bachelor-thesis.herokuapp.com/'
DEBUG_MODE = config('DEBUG', cast=bool, default=False)
NO_DELAYS = config('NO_DELAYS', cast=b... | settings.py | 1,635 | Insert google private key into a template of the json configuration and add it to environment vars Whether to remove the ForceReply markup in Telegram for any non-keyboard message (useful for demo) | 197 | en | 0.554569 |
# Generated by Django 2.1.4 on 2018-12-29 01:40
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='bankaccount',
old_na... | account/migrations/0002_auto_20181228_1940.py | 604 | Generated by Django 2.1.4 on 2018-12-29 01:40 | 45 | en | 0.637675 |
import logging
import os
import types
from datetime import datetime
import pandas as pd
from sdgym.data import load_dataset
from sdgym.evaluate import compute_scores
from sdgym.synthesizers import BaseSynthesizer
LOGGER = logging.getLogger(__name__)
BASE_DIR = os.path.dirname(__file__)
LEADERBOARD_PATH = os.path.jo... | sdgym/benchmark.py | 9,819 | Get the name of the synthesizer function or class.
If the given synthesizer is a function, return its name.
If it is a method, return the name of the class to which
the method belongs.
Args:
synthesizer (function or method):
The synthesizer function or method.
Returns:
str:
Name of the functi... | 5,457 | en | 0.825382 |
"""
# Hello
Demonstrate:
* conversion of regular python script into _Jupyter notebook_
* support **Markdown**
* this is a list
"""
from __future__ import absolute_import, print_function, division
"""
## Hello
This is a *hello world* function.
"""
def hello():
"""
This is a docstring
"""
print("he... | tests/example.py | 508 | This is a docstring
# Hello
Demonstrate:
* conversion of regular python script into _Jupyter notebook_
* support **Markdown**
* this is a list | 143 | en | 0.831156 |
"""Parser for envpy config parser"""
# Errors
class EnvpyError(Exception):
"""Base class for all envpy errors."""
class MissingConfigError(EnvpyError):
"""Raised when a config item is missing from the environment and has
no default.
"""
class ValueTypeError(EnvpyError):
"""Raised when a Schema i... | envpy/parser.py | 2,871 | Base class for all envpy errors.
Raised when a config item is missing from the environment and has
no default.
Raised when the value pulled from the environment cannot be parsed
as the given value type.
Schema that describes a single environment config item
Args:
value_type (optional, default=str): The type that e... | 1,094 | en | 0.738606 |
# -*- coding: utf-8 -*-
"""Application configuration.
Most configuration is set via environment variables.
For local development, use a .env file to set
environment variables.
"""
from environs import Env
env = Env()
env.read_env()
ENV = env.str("FLASK_ENV", default="production")
DEBUG = ENV == "development"
SQLALC... | cataloger/settings.py | 1,712 | Application configuration.
Most configuration is set via environment variables.
For local development, use a .env file to set
environment variables.
-*- coding: utf-8 -*- Can be "memcached", "redis", etc. can be 'LDAP', 'OMERO' | 231 | en | 0.729694 |
# -*- coding: utf-8 -*-
"""Test human2bytes function."""
import pytest
from pcof import bytesconv
@pytest.mark.parametrize(
"size, unit, result",
[
(1, "KB", "1024.00"),
(1, "MB", "1048576.00"),
(1, "GB", "1073741824.00"),
(1, "TB", "1099511627776.00"),
(1, "PB", "1125... | tests/test_bytesconv_human2bytes.py | 1,665 | Test human2bytes function.
-*- coding: utf-8 -*- vim: ts=4 | 60 | en | 0.566855 |
# Copyright (c) 2018 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 app... | python/paddle/fluid/executor.py | 40,765 | An Executor in Python, supports single/multiple-GPU running,
and single/multiple-CPU running. Python executor takes a program,
adds feed operators and fetch operators to this program according
to feed map and fetch_list. Feed map provides input data for the
program. fetch_list provides the variables(or names) that user... | 15,609 | en | 0.708901 |
import numpy as np
import pandas as pd
from pandas import DataFrame, MultiIndex, Index, Series, isnull
from pandas.compat import lrange
from pandas.util.testing import assert_frame_equal, assert_series_equal
from .common import MixIn
class TestNth(MixIn):
def test_first_last_nth(self):
# tests for first... | lib/python3.6/site-packages/pandas/tests/groupby/test_nth.py | 9,976 | tests for first / last / nth it works! v0.14.0 whatsnew tests for first / last / nth GH 2763, first/last shifting dtypes out of bounds, regression from 0.13.1 GH 6621 GH 7559 from the vbench validate first this is NOT the same as .first (as sorted is default!) as it keeps the order in the series (and not the group orde... | 579 | en | 0.733399 |
import tensorflow as tf
class Layers(object):
def __init__(self):
self.name_bank, self.params_trainable = [], []
self.num_params = 0
self.initializer_xavier = tf.initializers.glorot_normal()
def elu(self, inputs): return tf.nn.elu(inputs)
def relu(self, inputs): return tf.nn.relu... | source/layers.py | 4,209 | https://arxiv.org/pdf/1502.03167.pdf zero one | 45 | en | 0.394813 |
# python3 imports
from re import compile as compile_regex
from gettext import gettext as _
# project imports
from wintersdeep_postcode.postcode import Postcode
from wintersdeep_postcode.exceptions.validation_fault import ValidationFault
## A wrapper for validation of standard postcodes
# @remarks see \ref wintersdee... | wintersdeep_postcode/postcode_types/standard_postcode/standard_postcode_validator.py | 12,360 | python3 imports project imports A wrapper for validation of standard postcodes @remarks see \ref wintersdeep_postcode.postcode_types.standard_postcode Areas that only have single digit districts (ignoring sub-divisions) @remarks loaded from JSON file 'standard_postcode_validator.json' Checks if a postcode is in an a... | 5,188 | en | 0.812558 |
# Generated by Django 2.2.8 on 2019-12-20 17:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('m2mbasic', '0002_auto_20191220_1716'),
]
operations = [
migrations.CreateModel(
name='Product',
fields=[
... | django/models/m2mbasic/migrations/0003_product.py | 644 | Generated by Django 2.2.8 on 2019-12-20 17:32 | 45 | en | 0.718499 |
"""
Tests for the :mod:`fiftyone.utils.cvat` module.
You must run these tests interactively as follows::
python tests/intensive/cvat_tests.py
| Copyright 2017-2022, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
from bson import ObjectId
from collections import defaultdict
import numpy as np
import ... | tests/intensive/cvat_tests.py | 31,748 | Tests for the :mod:`fiftyone.utils.cvat` module.
You must run these tests interactively as follows::
python tests/intensive/cvat_tests.py
| Copyright 2017-2022, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
Test images Test Videos Get a subset that contains at least 2 objects Ensure ids and attrs are... | 1,000 | en | 0.867601 |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | google/appengine/api/api_base_pb.py | 10,601 | !/usr/bin/env python Copyright 2007 Google 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 writin... | 569 | en | 0.841457 |
# Copyright 2015 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 ... | c3d_model/predict_c3d_ucf101.py | 10,602 | Generate placeholder variables to represent the input tensors.
These placeholders are used as inputs by the rest of the model building
code and will be fed from the downloaded data in the .run() loop, below.
Args:
batch_size: The batch size will be baked into both placeholders.
Returns:
images_placeholder: Imag... | 2,699 | en | 0.757486 |
#!/usr/bin/env python
"""GRR HTTP server implementation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import base64
import hashlib
import hmac
import logging
import os
import string
from cryptography.hazmat.primitives import constant_time
from futu... | grr/server/grr_response_server/gui/wsgiapp.py | 12,098 | Base class for WSGI GRR app.
HTTP request object to be used in GRR.
Error raised when accessing a user of an unautenticated request.
Generates a CSRF token based on a secret key, id and time.
Decorator that ensures that HTTP access is logged.
Decorator for WSGI handler that inserts CSRF cookie into response.
Decorator ... | 2,834 | en | 0.863156 |
# coding: utf8
# try something like
# coding: utf8
# try something like
def index():
rows = db((db.activity.type=='stand')&(db.activity.status=='accepted')).select()
if rows:
return dict(projects=rows)
else:
return plugin_flatpage()
| controllers/stands.py | 262 | coding: utf8 try something like coding: utf8 try something like | 63 | en | 0.858722 |
"""Deep Q learning graph
The functions in this file can are used to create the following functions:
======= act ========
Function to chose an action given an observation
Parameters
----------
observation: object
Observation that can be feed into the output of make_obs_ph
stochastic: bool... | baselines/deepq/build_graph.py | 21,701 | Appends parent scope name to `relative_scope_name`
Creates the act function:
Parameters
----------
make_obs_ph: str -> tf.compat.v1.placeholder or TfInput
a function that take a name and creates a placeholder of input with that name
q_func: (tf.Variable, int, str, bool) -> tf.Variable
t... | 10,006 | en | 0.744969 |
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | vistrails/db/versions/v0_9_4/domain/vistrail.py | 5,665 | Copyright (C) 2014-2016, New York University. Copyright (C) 2011-2014, NYU-Poly. Copyright (C) 2006-2011, University of Utah. All rights reserved. Contact: contact@vistrails.org This file is part of VisTrails. "Redistribution and use in source and binary forms, with or without modification, are permitted provided that ... | 1,835 | en | 0.870224 |
# Copyright (c) 2013, TeamPRO and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from six.moves import range
from six import string_types
import frappe
import json
from frappe.utils import (getdate, cint, add_months, date_diff, add_days,
nowdate, get_datetime_st... | hrpro/hrpro/report/continuous_absent_report/continuous_absent_report.py | 2,718 | Copyright (c) 2013, TeamPRO and contributors For license information, please see license.txt _("Present Shift") + ":Data:120" | 125 | en | 0.658433 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
from useradmin.models import HuePermission
try:
perm = HuePermission.objects.get(app='metastore', act... | apps/useradmin/src/useradmin/old_migrations/0003_remove_metastore_readonly_huepermission.py | 5,620 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
"""
.. module: lemur.users.models
:platform: unix
:synopsis: This module contains all of the models need to create a user within
lemur
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
""... | lemur/users/models.py | 2,766 | Hash a given password and check it against the stored value
to determine it's validity.
:param password:
:return:
Helper function that is a listener and hashes passwords before
insertion into the database.
:param mapper:
:param connect:
:param target:
Generate the secure hash for the password.
:return:
Determine if ... | 701 | en | 0.766496 |
# SPDX-License-Identifier: MIT
# (c) 2019 The TJHSST Director 4.0 Development Team & Contributors
import asyncio
import json
from typing import Any, Dict
import websockets
from docker.models.services import Service
from ..docker.services import get_director_service_name, get_service_by_name
from ..docker.utils impor... | orchestrator/orchestrator/consumers/logs.py | 1,930 | SPDX-License-Identifier: MIT (c) 2019 The TJHSST Director 4.0 Development Team & Contributors | 93 | de | 0.332441 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.