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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
#-----------------------------------------------------------------------------------------
class GeoMap:
'''
INFO:
Map boundary edges order:
... | geoist/cattools/MapTools.py | 8,879 | INFO:
Map boundary edges order:
[LeftLowerLon,LeftLowerLat,UpperRightLon,UpperRightLat]
Background type:
'none'
'etopo'
'esri' --> background source
Background sources available for 'esri':
ESRI_Imagery_World_2D (MapServer)
ESRI_StreetMap_World_2D (MapServer)
I3_Imagery_Prime_World (GlobeServer)
NASA_C... | 2,275 | en | 0.20881 |
#!/usr/bin/env python
# Test whether a client sends a correct PUBLISH to a topic with QoS 2 and responds to a disconnect.
import context
import paho_test
rc = 1
keepalive = 60
connect_packet = paho_test.gen_connect(
"publish-qos2-test", keepalive=keepalive, clean_session=False,
)
connack_packet = paho_test.gen_c... | backend/mqtt_react/python_bugg/paho.mqtt.python/test/lib/03-publish-c2b-qos2-disconnect.py | 2,354 | !/usr/bin/env python Test whether a client sends a correct PUBLISH to a topic with QoS 2 and responds to a disconnect. Disconnect client. It should reconnect. Disconnect client. It should reconnect. Complete connection and message flow. | 236 | en | 0.802624 |
import base64
from django.http import HttpResponse
from django.contrib.auth import authenticate, login
# Reference: https://www.djangosnippets.org/snippets/243/
def view_or_basicauth(view, request, test_func, realm="", *args, **kwargs):
"""
This is a helper function used by both 'logged_in_or_basicauth' and... | django/basic_auth/example1/decorators.py | 3,740 | This is similar to the above decorator 'logged_in_or_basicauth'
except that it requires the logged in user to have a specific
permission.
Use:
@logged_in_or_basicauth('asforums.view_forumcollection')
def your_view:
...
A simple decorator that requires a user to be logged in. If they are not
logged in the request ... | 1,882 | en | 0.905676 |
# Configuration file with default options,
# There are four main sections: General, Features, LQP and Learning corresponding to different
# functionalities. You can disable any of the Features or Learning section (by commenting it out) according to your requirement.
[General]
# general options
idir=/home/hussain/dat... | face-rec/config.py | 3,958 | Configuration file with default options, There are four main sections: General, Features, LQP and Learning corresponding to different functionalities. You can disable any of the Features or Learning section (by commenting it out) according to your requirement. general options images directory path path where cropped_i... | 3,347 | en | 0.84 |
# Copyright 2020 Google LLC. 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... | tfx/dsl/compiler/testdata/iris_pipeline_sync.py | 5,497 | Builds an Iris example pipeline with slight changes.
Test pipeline for tfx.dsl.compiler.compiler.
Copyright 2020 Google LLC. 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 ... | 951 | en | 0.864836 |
"""Similar to DDPG except we only need obs and act, not the reward, etc.
"""
import numpy as np
class RingBuffer(object):
def __init__(self, maxlen, shape, dtype='float32'):
self.maxlen = maxlen
self.start = 0
self.length = 0
if dtype == 'uint8':
# Daniel: special case... | baselines/imit/memory.py | 6,202 | Daniel: careful about RAM usage. See:
https://github.com/BerkeleyAutomation/baselines-fork/issues/9
For this we can assume that in the replay buffer, the teacher samples
come first, and are fixed ahead of time, so our 'starting' index for
adding into the replay buffer should be offset by this quantity.
Keep separate c... | 1,980 | en | 0.91105 |
"""empty message
Revision ID: eb02de174736
Revises: c0de0819f9f0
Create Date: 2020-02-04 18:29:57.302993
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'eb02de174736'
down_revision = 'c0de0819f9f0'
branch_labels = None
depends_on = None
def upgrade():
# ... | starter_code/migrations/versions/eb02de174736_.py | 884 | empty message
Revision ID: eb02de174736
Revises: c0de0819f9f0
Create Date: 2020-02-04 18:29:57.302993
revision identifiers, used by Alembic. commands auto generated by Alembic - please adjust! end Alembic commands commands auto generated by Alembic - please adjust! end Alembic commands | 296 | en | 0.586837 |
# 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 u... | tools/license_header.py | 5,727 | Add or check license header
Usuage:
- add the default license header to source files that do not contain a valid
license:
python license_header.py add
- check if every files has a license header
python license_header.py check
Licensed to the Apache Software Foundation (ASF) under one or more contributor li... | 1,247 | en | 0.82806 |
"""Test service helpers."""
import asyncio
from copy import deepcopy
import unittest
from unittest.mock import patch
# To prevent circular import when running just this file
import homeassistant.components # noqa
from homeassistant import core as ha, loader
from homeassistant.const import STATE_ON, STATE_OFF, ATTR_EN... | tests/helpers/test_service.py | 6,480 | Test the Home Assistant service helpers.
Setup things to be run when tests are started.
Stop down everything that was started.
Test async_get_all_descriptions.
Test passing bad template.
Test extract_entity_ids method.
Test failing if service is missing.
Test for immutable input.
Test passing variables to templates.
Te... | 589 | en | 0.78246 |
# ----------------------------------------------------------------
# ---------- ASSOCIATION RULE MINING : NOTEABLE ATTEMPT 2 ---------
# ----------------------------------------------------------------
# ------------------ DAILY DATASET --------------------
association_rules = apriori(dailyRankedCrimes.values, min_s... | CS-383_Cloud-Computing_2020-Spring/association-rule-mining/attempt2.py | 1,136 | ---------------------------------------------------------------- ---------- ASSOCIATION RULE MINING : NOTEABLE ATTEMPT 2 --------- ---------------------------------------------------------------- ------------------ DAILY DATASET -------------------- 17 ------------------ YEARLY DATASET -------------------- 2 Not Many R... | 446 | en | 0.631751 |
# Copyright (c) 2013 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the S... | install/app_store/tk-framework-adminui/v0.1.6/python/setup_project/project_delegate.py | 4,260 | Wrapper around the ProjectWidget for delegate use
Simple widget that shows a project's thumbnail and name.
Update the styling to reflect if the widget is selected or not
Copyright (c) 2013 Shotgun Software Inc. CONFIDENTIAL AND PROPRIETARY This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit S... | 692 | en | 0.837967 |
###
# Copyright (c) 2003-2005, Daniel DiPaolo
# 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... | plugins/News/test.py | 3,747 | Copyright (c) 2003-2005, Daniel DiPaolo 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 foll... | 1,754 | en | 0.890064 |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | research/cv/resnext152_64x4d/postprocess.py | 1,988 | calculate the result
post process for 310 inference
Copyright 2021 Huawei Technologies Co., Ltd 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 req... | 692 | en | 0.80017 |
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
""" Display accelerometer data once per second """
import time
import board
import adafruit_lsm303_accel
i2c = board.I2C() # uses board.SCL and board.SDA
sensor = adafruit_lsm303_accel.LSM303_Accel(i2c)
while True:
ac... | libralli/circcuitpython/adafruit-circuitpython-bundle-7.x-mpy-20211225/examples/lsm303_accel_simpletest.py | 528 | Display accelerometer data once per second
SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries SPDX-License-Identifier: MIT uses board.SCL and board.SDA | 164 | en | 0.215643 |
#!/usr/bin/python
# Copyright 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.
"""Patch an orderfile.
Starting with a list of symbols in a binary and an orderfile (ordered list of
symbols), matches the symbols in the ... | Source/chrome/tools/cygprofile/patch_orderfile.py | 7,839 | !/usr/bin/python Copyright 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. Prefixes for the symbols. We strip them from the incoming symbols, and add them back in the output file. Map the addresses to symbols. Unprefixed c... | 525 | en | 0.873277 |
# Generated by Django 2.0.2 on 2018-09-06 13:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('institution', '0016_institution_funding_document_email'),
]
operations = [
migrations.AddField(
model_name='institution',
... | institution/migrations/0017_auto_20180906_1349.py | 627 | Generated by Django 2.0.2 on 2018-09-06 13:49 | 45 | en | 0.72903 |
# -*- coding: utf-8 -*-
"""
This file contains all the settings used in production.
This file is required and if development.py is present these
values are overridden.
"""
from server.settings.components import config
# Production flags:
# https://docs.djangoproject.com/en/2.2/howto/deployment/
DEBUG = False
ALLO... | {{cookiecutter.project_name}}/server/settings/environments/production.py | 2,051 | This file contains all the settings used in production.
This file is required and if development.py is present these
values are overridden.
-*- coding: utf-8 -*- Production flags: https://docs.djangoproject.com/en/2.2/howto/deployment/ TODO: check production hosts We need this value for `healthcheck` to work: Static... | 918 | en | 0.795388 |
# ============================================
__author__ = "Sachin Mehta and Ximing Lu"
__maintainer__ = "Sachin Mehta and Ximing Lu"
# ============================================
import torch
from utilities.print_utilities import *
import os
from utilities.lr_scheduler import get_lr_scheduler
from metrics.metric_ut... | train_and_eval/trainer.py | 15,592 | This class implemetns the training and validation functionality for training ML model for medical imaging
============================================ ============================================ maximum batch size for CNN on single GPU Let's visualize logs on tensorboard. It's awesome fetch learning rate scheduler W... | 1,612 | en | 0.842935 |
class Error(Exception):
'''Base Error.'''
def __init__(self):
self.error = 'Fatal error occured.'
super().__init__(self.error)
class ArgError(Error):
'''Argument Error.'''
def __init__(self):
self.error = 'Incorrect argument passed.'
super().__init__(self.error)
class MissingArg(ArgError):
'''Argument ... | cocasync/errors.py | 1,046 | Argument Error.
Base Error.
Error occured in HTTP.
Argument is invalid.
Argument is missing.
Missing data.
Connection timed out. | 128 | en | 0.721221 |
from sympy import symbols, integrate, Rational, lambdify
import matplotlib.pyplot as plt
import numpy as np
# Pollution from a factory is entering a lake. The rate of concentration of the pollutant at time t is given by
t = symbols( 't', positive = True )
dP = 91*t ** Rational( 5, 2 )
# where t is the number of years... | src/Classes/MSDS400/Module 7/polution.py | 939 | Pollution from a factory is entering a lake. The rate of concentration of the pollutant at time t is given by where t is the number of years since the factory started introducing pollutants into the lake. Ecologists estimate that the lake can accept a total level of pollution of 7600 units before all the fish life in ... | 476 | en | 0.949137 |
# -- --------------------------------------------------------------------------------------------------- -- #
# -- project: A python project for algorithmic trading in FXCM -- #
# -- ----------------------------------------------------------------------------------------------... | data.py | 2,816 | to download OHLC prices from FXCM broker
Parameters
----------
p_instrument: str
The name of the instrument according to fxcmpy
p_freq: str
The frequency or granularity of prices, according to fxcmpy
p_ini: str
Initial timestamp, in format "yyyy-mm-dd hh:mm:ss"
p_end: str
final timestamp, in format... | 1,923 | en | 0.284088 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/1/28 14:07
# @Author : ywl
# @Email : astralrovers@outlook.com
# @File : commit-msg.py.py
import os
import sys
import re
import json
crc_list = (
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
0x8108, 0x9129... | hooks/commit-msg.py | 4,550 | 计算CRC16
@param crc:初始校验码
@param file_bit:文件2进制流
@return:校验码
计算文件校验码,每次计算4096字节
@param file_name:文件名
@return:校验码
!/usr/bin/env python -*- coding: utf-8 -*- @Time : 2020/1/28 14:07 @Author : ywl @Email : astralrovers@outlook.com @File : commit-msg.py.py temp = crc // 256 crc = hex(sum_file_crc16(srv_name)).uppe... | 371 | zh | 0.249193 |
# Copyright 2020 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, ... | scripts/india_rbi/below_poverty_line/preprocess_test.py | 1,522 | Copyright 2020 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 distribut... | 608 | en | 0.873775 |
# coding: utf-8
###################################################################
# Copyright (c) 2016-2020 European Synchrotron Radiation Facility #
# #
# Author: Marius Retegan #
# ... | crispy/gui/quanty/calculation.py | 23,886 | Determine the electronic configurations involved in a calculation.
Use the name of the edge to determine the names of the core subshells.
e.g. for K (1s) the function returns ("1s",), while for K-L2,3 (1s2p) it
returns ("1s", "2p").
Count the number of particles (electrons) or quasiparticles
(holes) in a shell.
Edge or... | 2,625 | en | 0.787143 |
from django.core.exceptions import ObjectDoesNotExist
from rest_framework.serializers import PrimaryKeyRelatedField, RelatedField
class UniqueRelatedField(RelatedField):
"""
Like rest_framework's PrimaryKeyRelatedField, but selecting by any unique
field instead of the primary key.
"""
default_err... | apps/api/serializers.py | 1,260 | Like rest_framework's PrimaryKeyRelatedField, but selecting by any unique
field instead of the primary key. | 107 | en | 0.837743 |
import datetime
import os
import shutil
import subprocess
import urllib.request
from contextlib import closing
import numpy as np
import pandas as pd
import requests
import wbml.out
__all__ = [
"DependencyError",
"resource",
"dependency",
"asserted_dependency",
"split_df",
"data_path",
"d... | wbml/data/data.py | 6,173 | Exception raised in case of an erroneous dependency.
Specify a dependency that cannot be fetched.
Args:
target (str): Target file.
Get the path of a data file.
Args:
*xs (str): Parts of the path.
Returns:
str: Absolute path.
Convert a date to decimal year.
Args:
date (str): Date as a string.
for... | 2,131 | en | 0.695325 |
#! /usr/bin/env python
# coding utf-8
import sys
from sys import exit
import os
import socket
import requests
import smtplib
import ssl
import dns.resolver
""" Python script to monitor list of url (https/http/ns/mx)
and send mail if down"""
__author__ = "Benjamin Kittler"
__copyright__ = "Copyright 2021, KITTLER"
... | monitor2mail.py | 10,882 | Function to send email Alert
Parameters
----------
email_receiver : string
destination email for alert
service_status : string
service status
url : string
url concertned by alert
Returns
-------
None.
Function open file, read each line and complete a dictionnary
For each entry, launch check url : http/htt... | 3,231 | en | 0.59705 |
# Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import warnings
from copy import deepcopy
from mmdet.datasets.builder import PIPELINES
from mmdet.datasets.pipelines import Compose
@PIPELINES.register_module()
class MultiScaleFlipAug3D(object):
"""Test-time augmentation with multiple scales and flippi... | mmdet3d/datasets/pipelines/test_time_aug.py | 5,449 | Test-time augmentation with multiple scales and flipping.
Args:
transforms (list[dict]): Transforms to apply in each augmentation.
img_scale (tuple | list[tuple]: Images scales for resizing.
pts_scale_ratio (float | list[float]): Points scale ratios for
resizing.
flip (bool): Whether apply flip... | 1,558 | en | 0.732216 |
import FWCore.ParameterSet.Config as cms
from Configuration.Generator.Pythia8CommonSettings_cfi import *
from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import *
generator = cms.EDFilter("Pythia8GeneratorFilter",
comEnergy = cms.double(13000.0),
pythiaHepMCVerbosity = cms.untracked.bool(False),
pythiaPylis... | GEN_SIM/Configuration/GenProduction/python/ThirteenTeV/HVDS/HVDS_MZP300_MDP20_Ctau500mm_Pythia8_13TeV_cff.py | 2,027 | Z' massDark Pion Massforce dark pion to decay to diphotonsDark pion lifetime in mm | 82 | en | 0.719482 |
# code is based on https://github.com/katerakelly/pytorch-maml
import torchvision
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torch
from torch.utils.data import DataLoader,Dataset
import random
import os
from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
... | miniimgnet/KD-gan/task_generator.py | 5,249 | Samples 'num_inst' examples each from 'num_cl' pools
of examples of size 'num_per_class'
code is based on https://github.com/katerakelly/pytorch-maml Torch operations on the input image return a single list of indices, assuming that items will be grouped by class | 266 | en | 0.791366 |
# coding: utf-8
"""
Seldon Deploy API
API to interact and manage the lifecycle of your machine learning models deployed through Seldon Deploy. # noqa: E501
OpenAPI spec version: v1alpha1
Contact: hello@seldon.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future... | python/test/test_cinder_volume_source.py | 1,015 | CinderVolumeSource unit test stubs
Test CinderVolumeSource
Seldon Deploy API
API to interact and manage the lifecycle of your machine learning models deployed through Seldon Deploy. # noqa: E501
OpenAPI spec version: v1alpha1
Contact: hello@seldon.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
... | 503 | en | 0.621514 |
import whois
def get_whois(domain):
try:
query = whois.query(domain)
assert isinstance(query, whois._3_adjust.Domain)
return query.__dict__
except:
pass
return None
def get_scans(domain):
url = "http://" + domain
urls = [url]
scans = vt.get_url_reports([url])[ur... | intel_query.py | 733 | print('test domain: microsoft.com') print(get_whois('microsoft.com')) print(get_scans('pxxfmjhosgqqs.com')) | 107 | en | 0.22069 |
# Generated file, please do not change!!!
import typing
from ...models.error import ErrorResponse
from ...models.shipping_method import ShippingMethodPagedQueryResponse
if typing.TYPE_CHECKING:
from ...base_client import BaseClient
class ByProjectKeyShippingMethodsMatchingCartRequestBuilder:
_client: "Base... | src/commercetools/platform/client/matching_cart/by_project_key_shipping_methods_matching_cart_request_builder.py | 1,528 | Generated file, please do not change!!! | 39 | en | 0.734874 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | venv/lib/python3.8/site-packages/azure/mgmt/containerservice/v2019_02_01/models/_models.py | 60,806 | Agent Pool.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource ID.
:vartype id: str
:ivar name: The name of the resource that is unique within a resource
group. This name can be used to acces... | 34,445 | en | 0.315835 |
from django import forms
from django.http import QueryDict
from django.forms.formsets import formset_factory
from abc import ABCMeta, abstractmethod
from collections import OrderedDict
from datetime import date
import itertools
import re
from fields import SubmitButtonField, SubmitButtonWidget
class Filter(object):
... | reporting/base.py | 12,288 | When getting a filter attribute, looks for the corresponding filter
state and returns that instead of the filter object. If none is found,
looks for the default value on the filter object. If that's not found
either, then returns none.
filter_state will be a querydict with keys corresponding to the names
of the filter ... | 3,391 | en | 0.871459 |
"""A Mailman newsletter subscription interface.
To use this plugin, enable the newsletter module and set the newsletter module and name settings
in the admin settings page.
"""
from django.utils.translation import ugettext as _
from Mailman import MailList, Errors
from models import Subscription
from satchmo.configur... | satchmo/newsletter/mailman.py | 5,124 | Add a Satchmo contact to a mailman mailing list.
Parameters:
- `Contact`: A Satchmo Contact
- `listname`: the Mailman listname, defaulting to whatever you have set in settings.NEWSLETTER_NAME
- `send_welcome_msg`: True or False, defaulting to the list default
- `admin_notify`: True of False, defaulting... | 875 | en | 0.378435 |
# Generated by Django 3.1.7 on 2021-02-25 17:55
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('backoffice', '0005_auto_20210225_1712'),
]
operations = [
migrations.AddField(
model_name='buyi... | backoffice/migrations/0006_auto_20210225_1755.py | 928 | Generated by Django 3.1.7 on 2021-02-25 17:55 | 45 | en | 0.698664 |
#
# Copyright (c) 2017 Digital Shadows Ltd.
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
#
from ds_model import DSModel
class InfrastructureSSL(DSModel):
def __init__(self, id, payload):
self._id = id
self._payload = payload
@property
def id(self):
... | Apps/phdigitalshadows/dsapi/model/infrastructure_ssl.py | 645 | Copyright (c) 2017 Digital Shadows Ltd. Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | 115 | en | 0.687942 |
from django.urls import path
from django.views.i18n import JavaScriptCatalog
from .views import HelloWorldView
app_name = 'pokus1' # make possible use {% url 'pokus1:..' %}
# however this is maybe deprecated; you can achieve same in include(), see project level urls.py
urlpatterns = [
path('jsi18n/pokus1/', Ja... | pokus1/urls.py | 478 | make possible use {% url 'pokus1:..' %} however this is maybe deprecated; you can achieve same in include(), see project level urls.py /pokus1/: unique app url, probably important | 179 | en | 0.826065 |
#!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
from django.test.utils import get_runner
def runtests(*test_args):
"""Setup and run django-lockdowns test suite."""
os.environ['DJANGO_SETTINGS_MODULE'] = 'lockdown.tests.test_settings'
django.setup()
if not ... | runtests.py | 546 | Setup and run django-lockdowns test suite.
!/usr/bin/env python | 64 | en | 0.399101 |
import argparse
import collections
import functools
import itertools
import json
import multiprocessing as mp
import os
import pathlib
import re
import subprocess
import warnings
os.environ['NO_AT_BRIDGE'] = '1' # Hide X org false warning.
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
impor... | plotting.py | 19,791 | Hide X org false warning. First only. First only. Disable async data loading: runs = [j() for j in jobs] Discard unused baselines. Bin all runs onto the same X steps. Per-task normalization by low and high baseline. Aggregate across tasks but not methods or seeds. Ignore empty slice warnings. NaN buckets remain NaN. Em... | 388 | en | 0.846725 |
from __future__ import division
import requests
import json
import sys
import os
from elasticsearch import Elasticsearch
from elasticsearch import exceptions
try:
# idrac_ip = os.environ['IDRAC_IP']
# idrac_username = os.environ['IDRAC_USERNAME']
# idrac_password = os.environ['IDRAC_PASSWORD']
# elastic_i... | logging/logextractor/search_script.py | 2,684 | idrac_ip = os.environ['IDRAC_IP'] idrac_username = os.environ['IDRAC_USERNAME'] idrac_password = os.environ['IDRAC_PASSWORD'] elastic_ip = os.environ['ELASTIC_IP'] elastic_username = os.environ['ELASTIC_USERNAME'] elastic_password = os.environ['ELASTIC_PASSWORD'] print(data)print(i)print("\n")print(code_... | 479 | en | 0.471832 |
"""
Module Reader Writer
This module provide the ReaderWriter class as a concrete implemenation of the AbstractReaderWriter. It handles
the implementation details of interfacing with the hardware.
"""
from controlpyweb.abstract_reader_writer import AbstractReaderWriter
import requests
import json
from typing import Un... | controlpyweb/reader_writer.py | 7,144 | :param url: The address of the IO Base module from/to which IO is written
Does an http get and returns the results as key/value pairs
Returns a dictionary of all changes made since the last read or write
Returns the current IO key/values as json string
Erases the collection of changes stored in memory
Same as update_fr... | 1,294 | en | 0.883754 |
'''
Bootstrapped from https://github.com/NewKnowledge/imagenet and refined for D3M purposes
Original implementation from Craig Corcoran
'''
import os
import math
import numpy as np
import tensorflow as tf
from tensorflow.keras.applications import inception_v3, mobilenet_v2, xception
from tensorflow.keras.mode... | primitives/image_classification/utils/imagenet.py | 11,407 | Tf.Keras Sequence for ImageNet input data
A class for featurizing images using pre-trained neural nets on ImageNet
and finetuning those nets for downstream classification
Creates ImageNet base model for featurization or classification and corresponding image
preprocessing function
:param model: options are xceptio... | 3,618 | en | 0.770135 |
import sys, os
sys.path.insert(1, os.path.join(sys.path[0], '../../../'))
import script.rio as io
import script.initial_condition.noh1D as noh1D
# Domain properties
lx = 1.0
ly = 1.0
Nx = 512
Ny = 1
# Scheme execution options
T = 0.6
CFL = 0.5
gamma = 5./3.
BClayer = 1
quantityList = ['rho', 'rhou_x', 'rhou_y', '... | casepy/eulerRuO1/nNoh512x1/chars.py | 470 | Domain properties Scheme execution options | 42 | en | 0.486393 |
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... | tftrt/examples/object_detection/test.py | 3,836 | Runs an object detection test configuration
This runs an object detection test configuration. This involves
1. Download and build a model architecture (or use cached).
2. Optimize the model architecrue
3. Benchmark the optimized model against a dataset
4. (optional) Run assertions to check the benchmark output
The ... | 2,274 | en | 0.700783 |
# Copyright 2009-present MongoDB, 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 wri... | test/test_json_util.py | 19,441 | Test some utilities for working with JSON and PyMongo.
Copyright 2009-present MongoDB, 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 require... | 1,366 | en | 0.808538 |
#! -*- coding: utf-8 -*-
#
# (C) 2013 Internet Initiative Japan Inc.
# All rights reserved.
#
# Created on 2013/05/15
# @author: yosinobu@iij.ad.jp
"""Notify project owner with email when the project created successfully."""
from pkg_resources import resource_filename
from trac.config import Option, ListOption
from tra... | tracportalopt/project/notification.py | 3,227 | Notification of a project creation.
Notify project owner with email when the project created successfully.
! -*- coding: utf-8 -*- (C) 2013 Internet Initiative Japan Inc. All rights reserved. Created on 2013/05/15 @author: yosinobu@iij.ad.jp options ITemplateProvider methods IProjectCreationInterceptor methods | 312 | en | 0.739147 |
# -*- coding: utf-8 -*-
#
# python_exameple documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 26 00:29:33 2016.
#
# 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 fil... | pyBAScloudAPI/docs/conf.py | 9,591 | -*- coding: utf-8 -*- python_exameple documentation build configuration file, created by sphinx-quickstart on Fri Feb 26 00:29:33 2016. 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. All configuration... | 8,018 | en | 0.645054 |
from ipdb import set_trace as st
from icecream import ic
import gc
import os
import wandb
import pandas as pd
from fastprogress import progress_bar
from loguru import logger
import numpy as np
import torch
from sklearn.metrics import accuracy_score
import utils as U
import configuration as C
import result_handler as r... | exp/exp002/trainner.py | 10,030 | config load data init logger preparation wandb 学習を行う 格納 best model ? result --- fold end --- oof_sig 適当な値を答えとする acc_val_folds lwlrap_val_folds wandb 開放 train eval valid | 168 | ja | 0.488885 |
# Generated by Django 2.2.6 on 2019-12-28 22:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('FoodStore', '0002_auto_20191209_0246'),
]
operations = [
migrations.AddField(
model_name='foodhomepagemodel',
name='... | FoodStore/migrations/0003_auto_20191229_0057.py | 577 | Generated by Django 2.2.6 on 2019-12-28 22:57 | 45 | en | 0.724582 |
import cv2
import numpy as np
from PIL import Image
def draw_approx_polyDP(cnt, epsilon=0.01, closed=True):
"""用多边形来近似的表示曲线"""
epsilon = epsilon * cv2.arcLength(cnt, closed) # 得到轮廓的周长信息作为参考值
return cv2.approxPolyDP(cnt, epsilon, closed) # 得到近似多边形框
def draw_convex_hull(cnt):
"""画凸包,传入的是一些点"""
r... | my_cv/utils/cv2_util.py | 4,420 | 最好在改进一下关闭窗口部分的功能
建立一个窗口捕捉摄像头显示的内容
当左键点击过窗口,且按过任意键盘键,才会退出窗口
用多边形来近似的表示曲线
画凸包,传入的是一些点
得到轮廓的周长信息作为参考值 得到近似多边形框 获取处理过的轮廓信息 按任意键,图片消失 cv2.waitKey(1) 参数表示等待键盘触发的时间,返回值为-1表示没有见按下 获得设备 empire = Image.open('sphere.png') cv2.waitKey() cv2.destroyAllWindows() print(empire.shape()) empire.convert('RGB') print(empire.mode) print(... | 346 | zh | 0.886403 |
try:
from django.conf.urls import *
except ImportError: # django < 1.4
from django.conf.urls.defaults import *
urlpatterns = patterns("rush_forms.views",
#url(r"^(?P<pk>\d+)/$", 'form_view', name='form-detail'),
url(r"^(?P<pk>\d+)/$", 'rush_form_view', name='detai... | onegreek/rush_forms/urls.py | 462 | django < 1.4url(r"^(?P<pk>\d+)/$", 'form_view', name='form-detail'), | 68 | en | 0.17808 |
import logging
import Queue
import sia_client as sc
logger = logging.getLogger(__name__)
def from_upload_jobs(upload_jobs):
"""Creates a new upload queue from a list of upload jobs.
Creates a new queue of files to upload by starting with the full input
dataset and removing any files that are uploaded (... | sia_load_tester/upload_queue.py | 1,740 | Creates a new upload queue from a list of upload jobs.
Creates a new queue of files to upload by starting with the full input
dataset and removing any files that are uploaded (partially or fully) to
Sia.
Args:
upload_jobs: The unfiltered set of upload jobs.
Returns:
A Queue of upload jobs, filtered to remove... | 894 | en | 0.951789 |
# ---------------------------------------------------------------------
# Vendor: DCN
# OS: DCWS
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Pyth... | sa/profiles/DCN/DCWS/get_version.py | 1,696 | --------------------------------------------------------------------- Vendor: DCN OS: DCWS --------------------------------------------------------------------- Copyright (C) 2007-2019 The NOC Project See LICENSE for details --------------------------------------------------------------------- Python modules NOC mo... | 325 | en | 0.168004 |
"""django1 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... | python/Django/django1/urls.py | 1,150 | django1 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vi... | 623 | en | 0.597937 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, print_function, unicode_literals, absolute_import
"""
This module implements classes for reading and generating Lammps inputset.
For the ease of management we divide LAMMPS in... | pymatgen/io/lammps/sets.py | 4,785 | Implementation of LammpsInputSet that is initialized from a dict
settings. It is typically used by other LammpsInputSets for
initialization from json or yaml source files.
Args:
name (str): A name for the input set.
lammps_input (LammpsInput): The config dictionary to use.
lammps_data (LammpsData): LammpsD... | 1,472 | en | 0.59462 |
# coding=utf-8
# Exemplos para entendiemnto
"""nome = input('Qual seu nome?' )
if nome == 'Rodrigo' or nome == 'RAYANNE':
print('Que nome lindo vocé tem!')
else:
print('Que nome tão normal!!!')
print('Bom dia, {}'.format(nome))"""
n1 = float(input('Digite a primeira nota: '))
n2 = float(input('Digite a segunda ... | Python Aulas/Mundo 1/Aula 010c.py | 583 | nome = input('Qual seu nome?' )
if nome == 'Rodrigo' or nome == 'RAYANNE':
print('Que nome lindo vocé tem!')
else:
print('Que nome tão normal!!!')
print('Bom dia, {}'.format(nome))
coding=utf-8 Exemplos para entendiemnto | 230 | pt | 0.811965 |
"""
Read and plot a PPI from raw mini-MPL data
------------------------------------------
Example of how to read in raw data from the mini-MPL
and plot out the PPI by converting it to PyART
Author: Adam Theisen
"""
from matplotlib import pyplot as plt
import act
try:
import pyart
PYART_AVAILABLE = True
e... | examples/plot_raw_minimpl.py | 831 | Read and plot a PPI from raw mini-MPL data
------------------------------------------
Example of how to read in raw data from the mini-MPL
and plot out the PPI by converting it to PyART
Author: Adam Theisen
Read in sample mini-MPL data Create a PyART Radar Object Creat Plot Display | 286 | en | 0.779043 |
# 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... | tensorflow/contrib/eager/python/examples/linear_regression/linear_regression_test.py | 4,090 | Unit tests for linear regression example under TensorFlow eager execution.
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... | 754 | en | 0.824994 |
from office365.graph.graph_client import GraphClient
from settings import settings
def get_token(auth_ctx):
"""Acquire token via client credential flow (ADAL Python library is utilized)"""
token = auth_ctx.acquire_token_with_client_credentials(
"https://graph.microsoft.com",
settings['client_c... | examples/outlook/send_message.py | 1,003 | Acquire token via client credential flow (ADAL Python library is utilized) | 74 | en | 0.876541 |
import tensorflow as tf
import cv2
import numpy as np
import os
from sklearn.model_selection import train_test_split
import random
import sys
my_image_path = 'my_face'
others_image_path = 'other_people'
image_data = []
label_data = []
def get_padding_size(image):
#def get_padding_size(image):
h, ... | trainCNN.py | 8,629 | def get_padding_size(image):长,宽和通道数(0,0,0,0)os.listdir(path):path 要获得内容目录的路径。获得当前目录的所有内容。功能是从样本中随机的按比例选取train data和test data, test_size是样本占比。如果是整数的话就是样本的数量。random_state是随机数的种子。 image (height=64 width=64 channel=3) nomalizebatch_size = 128tf.placeholder() 占位符,传递一个tensor到session.run()中。 图片大小64x64 channel=3先W*X,再W*X+b,再Re... | 782 | zh | 0.741855 |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | legal-api/tests/unit/services/test_authorization.py | 27,130 | Assert that an invalid auth service URL returns False.
Assert that an invalid role returns False.
Assert that the missing args return False.
Assert that the type of user authorization is correct, based on the expected outcome.
Assert that the type of user authorization is correct, based on the expected outcome.
Assert ... | 2,232 | en | 0.846935 |
""" Tagger using mecab-service """
import traceback
import requests
from ..models import WordNode
from .base import Tagger
class MeCabServiceNode(WordNode):
"""
Parsed word node by MeCabServiceTagger
Attributes
----------
surface : str
Surface of word
part : str
Part of the w... | minette/tagger/mecabservice.py | 3,495 | Parsed word node by MeCabServiceTagger
Attributes
----------
surface : str
Surface of word
part : str
Part of the word
part_detail1 : str
Detail1 of part
part_detail2 : str
Detail2 of part
part_detail3 : str
Detail3 of part
stem_type : str
Stem type
stem_form : str
Stem form
word : str
... | 1,229 | en | 0.316885 |
from setuptools import setup, find_packages
import os.path
HERE = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
with open(os.path.join(HERE, *parts)) as f:
return f.read()
setup(
name="doc484",
version="0.3.4",
author="Chad Dombrova",
description="Generate PEP 484 type co... | setup.py | 1,730 | only required for rest format How mature is this project? Common values are 3 - Alpha 4 - Beta 5 - Production/Stable Indicate who your project is intended for Pick your license as you wish (should match "license" above) Specify the Python versions you support here. In particular, ensure that you indicate whether ... | 359 | en | 0.834777 |
from django.contrib.gis.db import models
from django.contrib.gis.tests.utils import mysql, spatialite
# MySQL spatial indices can't handle NULL geometries.
null_flag = not mysql
class Country(models.Model):
name = models.CharField(max_length=30)
mpoly = models.MultiPolygonField() # SRID, by default, is 4326
... | AppServer/lib/django-1.4/django/contrib/gis/tests/geoapp/models.py | 1,686 | MySQL spatial indices can't handle NULL geometries. SRID, by default, is 4326 This is an inherited model from City TODO: This should be implicitly inherited. Allowing NULL geometries here. Minus one SRID. | 204 | en | 0.906601 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | azure-mgmt-web/azure/mgmt/web/models/resource_metric_name.py | 1,194 | Name of a metric for any resource .
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar value: metric name value.
:vartype value: str
:ivar localized_value: Localized metric name value.
:vartype localized_value: str
coding=utf-8 ---------------------------------------------... | 714 | en | 0.572799 |
"""A CSV annotation writer that writes the bbox in x, y, w, h format."""
from .types import CSVAnnotationWriter
class WidthHeightCSV(CSVAnnotationWriter):
"""Writes annotations to a CSV file in the following format.
image_name, x_min, y_min, width, height, label
"""
def get_csv_fieldnames(self):
... | src/discolight/writers/annotation/widthheightcsv.py | 883 | Writes annotations to a CSV file in the following format.
image_name, x_min, y_min, width, height, label
Return the field names for the CSV file.
Return the CSV row corresponding to the given annotation.
A CSV annotation writer that writes the bbox in x, y, w, h format. | 271 | en | 0.717006 |
import logging
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.sites.shortcuts import get_current_site
from django.core.exceptions import ValidationError
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse_lazy
from django.utils... | rdmo/projects/views/project_create.py | 6,314 | add current site save the project add all tasks to project add all views to project add current user as owner store information in session for ProjectCreateImportView add current site and save project add user to project | 220 | en | 0.71654 |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import json
import os
import urllib2
import argparse
import sys
searchterm = str(sys.argv[1]) # will also be the name of the folder
url = "https://www.google.co.in/search?q="+searchterm+"&source=lnms&tbm=isch"
browser = webdriver.Chrome()
b... | Model/imagescrape.py | 1,690 | will also be the name of the folder | 35 | en | 0.967368 |
# Object tracking with keypoints example.
# Show the camera an object and then run the script. A set of keypoints will be extracted
# once and then tracked in the following frames. If you want a new set of keypoints re-run
# the script. NOTE: see the docs for arguments to tune find_keypoints and match_keypoints.
import... | usr/examples/09-Feature-Detection/keypoints.py | 2,184 | Object tracking with keypoints example. Show the camera an object and then run the script. A set of keypoints will be extracted once and then tracked in the following frames. If you want a new set of keypoints re-run the script. NOTE: see the docs for arguments to tune find_keypoints and match_keypoints. Reset sensor S... | 962 | en | 0.797303 |
import os
test_data_dir = os.path.join(os.path.dirname(__file__), 'data')
test_config_dir = os.path.join(test_data_dir, 'config-test')
graph_data_dir = os.path.join(test_data_dir, 'graph_data')
default_worker = {"platform": 'linux',
'arch': '64',
'label': 'linux',
... | tests/utils.py | 833 | not valid meta.yaml. Doesn't matter for test. | 46 | en | 0.886238 |
import contextlib
import ipaddress
import json
import os
import random
import re
import time
import warnings
from collections import Counter
from typing import Any, Dict, List, Optional, Set, Union
import requests
import test_infra.utils.waiting
import waiting
import yaml
from assisted_service_client import models
fro... | discovery-infra/test_infra/helper_classes/cluster.py | 52,257 | Enable some grace time for waiting for API's availability.
Validate if kube-api is ready on given address.
TODO - remove EVENTS_THRESHOLD after removing it from kni-assisted-installer-auto Update infraEnv configurations TODO remove in favor of generate_infra_env ensure file path exists before downloading Controller a... | 1,593 | en | 0.838028 |
"""
Purpose: Unsupervised learning sampler
Date created: 2020-11-06
Ref repo: https://github.com/White-Link/UnsupervisedScalableRepresentationLearningTimeSeries
Local folder: C:/Users/Work1/Desktop/Info/GitHub/python-examples-main/notebook-samples/unsupervised
Contributor(s):
Mark M.
"""
import os
from pathlib... | notebook-samples/unsupervised/pred_electricity_consumption.py | 4,532 | Purpose: Unsupervised learning sampler
Date created: 2020-11-06
Ref repo: https://github.com/White-Link/UnsupervisedScalableRepresentationLearningTimeSeries
Local folder: C:/Users/Work1/Desktop/Info/GitHub/python-examples-main/notebook-samples/unsupervised
Contributor(s):
Mark M.
Set local folder if developing... | 1,341 | en | 0.600902 |
"""
Copyright (c) 2021 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from io import BufferedReader, BytesIO
import pytest
import requests
import responses
from flexmock import flexmock
from atomic_reactor.uti... | tests/utils/test_pnc.py | 2,777 | Copyright (c) 2021 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
to mock this URL we have to construct it manually first to mock this URL we have to construct it manually first | 283 | en | 0.9257 |
from .hflip import hflip
from .resize import resize
from .pad import pad
from .random_crop import random_crop
from .to_tensor import to_tensor
from .random_erasing import random_erasing
from .random_sized_rect_crop import random_sized_rect_crop
def transforms(item, cfg, mode):
"""
:param item: sample = deepco... | MDRSREID/utils/data_utils/transforms/torch_transforms/__init__.py | 1,077 | :param item: sample = deepcopy(self.items[index])
:param cfg: cfg
:return:
eval() transform str to list, dict, tuple. Here is a series of the transform methods in turn. | 169 | en | 0.744703 |
import torch
import torch.nn as nn
import math
from arcface.utils import l2_norm, Flatten, SentVec_TFIDF
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://download.pytorch.org/models/resnet34-333f7ec4.pth',
'resnet50': 'https://download.pytorch.org... | arcface/resnet_cbam.py | 9,615 | 3x3 convolution with padding
embedding_size = 2048 drop_ratio = 0.1 layers = [3, 4, 23, 3] self.sentvec = SentVec_TFIDF(embedding_size=embedding_size, root_dir='data/') self.avgpool = nn.AvgPool2d(4, stride=1) self.fc = nn.Linear(512* block.expansion, 1000) self.output_layer = nn.Sequential( ... | 1,742 | en | 0.423286 |
# Automatically generated by pb2py
# fmt: off
if False:
from typing_extensions import Literal
Transfer = 0 # type: Literal[0]
RegisterSecondPassphrase = 1 # type: Literal[1]
RegisterDelegate = 2 # type: Literal[2]
CastVotes = 3 # type: Literal[3]
RegisterMultisignatureAccount = 4 # type: Literal[4]
CreateDapp... | monero_glue/messages/LiskTransactionType.py | 428 | Automatically generated by pb2py fmt: off type: Literal[0] type: Literal[1] type: Literal[2] type: Literal[3] type: Literal[4] type: Literal[5] type: Literal[6] type: Literal[7] | 177 | en | 0.531839 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import inspect
import setuptools
from setuptools.command.test import test as TestCommand
from setuptools import setup
if sys.version_info < (3, 4, 0):
sys.stderr.write('FATAL: This script needs to be run with Python 3.4+\n')
sys.exit(1)
__lo... | setup.py | 4,412 | !/usr/bin/env python -*- coding: utf-8 -*- Add here all kinds of additional classifiers as defined under https://pypi.python.org/pypi?%3Aaction=list_classifiers Assemble additional setup commands | 195 | en | 0.734725 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from dve.io.table import TableDataBase
from jhunt.qt.widgets.mainwindow import MainWindow
import datetime
from PyQt5.QtWidgets import QApplication
APPLICATION_NAME = "JHunt"
def main():
adverts_file_name = ".jhunt_adverts"
adverts_data_schema = [... | jhunt/qt/main.py | 4,199 | !/usr/bin/env python3 -*- coding: utf-8 -*- TODO ? TODO ? Make widgets The mainloop of the application. The event handling starts from this point. The exec_() method has an underscore. It is because the exec is a Python keyword. And thus, exec_() was used instead. TODO ? TODO ? The sys.exit() method ensures a clean exi... | 383 | en | 0.791796 |
# coding=utf-8
# Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... | models/image_segmentation/tensorflow/3d_unet_mlperf/inference/nnUNet/preprocess.py | 4,380 | coding=utf-8 Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved. Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may ... | 1,177 | en | 0.836679 |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import hashlib
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.... | python/ccxt/async_support/livecoin.py | 33,141 | -*- coding: utf-8 -*- PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.mdhow-to-contribute-code omit params to get all tickers at once conflict with CPT = Contents Protocol https://github.com/ccxt/ccxt/issues/4920 and https://github.com/ccxt/cc... | 3,444 | en | 0.683557 |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2015-present MagicStack Inc. and the EdgeDB 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... | edb/lang/ir/inference/types.py | 13,560 | This source file is part of the EdgeDB open source project. Copyright 2015-present MagicStack Inc. and the EdgeDB 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/li... | 881 | en | 0.828639 |
# Date: May 2018
# Author: Joe English, PDST
# eMail: computerscience@pdst.ie
# Name: Guessing Game v7
# Purpose: A program to demonstrate data validation
# Description: This is the exact same as version 6 except the input is validated
# Guess Game v7 - while - go again? - data validation
import random
nu... | Section 5 - Programming Logic/Guess game v7 - while - data validation.py | 1,110 | Date: May 2018 Author: Joe English, PDST eMail: computerscience@pdst.ie Name: Guessing Game v7 Purpose: A program to demonstrate data validation Description: This is the exact same as version 6 except the input is validated Guess Game v7 - while - go again? - data validation Initialise the loop guard variable Loop as l... | 443 | en | 0.822156 |
import os
import sys
import time
import datetime
import selenium
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.common.exceptions import NoSuchElementException
from compare_images import *
if __name__ == "__main__":
# Create a Firefox window driver.
... | src/testing/drawCountriesReg.py | 977 | Create a Firefox window driver. Load the vtkweb application page. Give the page some time to update the image. Take a screenshot. Compare the screenshot with the baseline, and report to stdout. Close the browser window. | 219 | en | 0.768873 |
import argparse
import os
import numpy as np
from keras.layers import Conv2D, Input, BatchNormalization, LeakyReLU, ZeroPadding2D, UpSampling2D
from keras.layers.merge import add, concatenate
from keras.models import Model
import struct
import cv2
import time
from pathlib import Path
#np.set_printoptions(threshold=np.... | yolo3_video.py | 20,354 | np.set_printoptions(threshold=np.nan) bias scale mean variance peculiar padding as darknet prefer left and top peculiar padding as darknet prefer left and top Layer 0 => 4 Layer 5 => 8 Layer 9 => 11 Layer 12 => 15 Layer 16 => 36 Layer 37 => 40 Layer 41 => 61 Layer 62 => 65 Layer 66 => 74 Layer 75 => 79 L... | 1,415 | en | 0.551683 |
"""
Copyright 2018 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
di... | activation_generator.py | 6,096 | Basic abstract activation generator for a model
Interface for an activation generator for a model
Activation generator for a basic image model
Given a filename, try to open the file. If failed, return None.
Args:
filename: location of the image file
shape: the shape of the image file to be scaled
Returns:
the i... | 1,453 | en | 0.841726 |
"""
========================
Obstacle Avoidance in 2D
========================
Plots a 2D DMP that goes through a point obstacle when there is no coupling
term for obstacle avoidance and a 2D DMP that avoids the point obstacle with
a coupling term.
"""
print(__doc__)
import matplotlib.pyplot as plt
import numpy as n... | examples/plot_obstacle_avoidance_2d.py | 1,291 | ========================
Obstacle Avoidance in 2D
========================
Plots a 2D DMP that goes through a point obstacle when there is no coupling
term for obstacle avoidance and a 2D DMP that avoids the point obstacle with
a coupling term. | 245 | en | 0.877407 |
#!/usr/bin/env python
#
# Copyright (c) 2018 All rights reserved
# This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
"""Define the classes requir... | security/onap_security/test_security_test.py | 1,058 | Define the classes required to fully cover k8s.
!/usr/bin/env python Copyright (c) 2018 All rights reserved This program and the accompanying materials are made available under the terms of the Apache License, Version 2.0 which accompanies this distribution, and is available at http://www.apache.org/licenses/LICENSE-2... | 356 | en | 0.841244 |
#!/usr/bin/env python2.6
'''
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
"Licens... | ambari-agent/src/main/python/ambari_agent/Heartbeat.py | 3,039 | !/usr/bin/env python2.6 There may be IN_PROGRESS tasks for now, just do the same work as registration this must be the last step before returning heartbeat | 155 | en | 0.810821 |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Input:
FIREWALL = "firewall"
class Output:
ALLOWED = "allowed"
CREATIONTIMESTAMP = "creationTimestamp"
DESCRIPTION = "description"
ID = "id"
KIND = "kind"
NAME = "name"
NETWORK = "network"
SELFLINK = "sel... | google_cloud_compute/komand_google_cloud_compute/actions/get_firewall/schema.py | 4,047 | GENERATED BY KOMAND SDK - DO NOT EDIT | 37 | en | 0.775658 |
"""This module contains the general information for EquipmentHealthLed ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class EquipmentHealthLedConsts:
COLOR_AMBER = "amber"
COLOR_BLUE = "blue"
COLOR_GREEN = "green"
... | ucsmsdk/mometa/equipment/EquipmentHealthLed.py | 4,220 | This is EquipmentHealthLed class.
This module contains the general information for EquipmentHealthLed ManagedObject. | 116 | en | 0.783499 |
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... | modin/config/envvars.py | 12,026 | Allows to override default size of data (shapes).
Allows to select a library that we will use for testing performance.
Engine to run on a single node of distribution.
Whether or not to perform computations synchronously.
How many CPU cores to use during initialization of the Modin engine.
Whether to gather RPyC logs (a... | 4,366 | en | 0.800851 |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... | AB/lambda/elasticindex/elasticsearch/client/monitoring.py | 2,208 | Used by the monitoring features to send monitoring data.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.10/monitor-elasticsearch-cluster.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg body: The operation definition and da... | 1,394 | en | 0.830924 |
# Simple script for updating the build number in pubspec.yaml
import re
# Regex patter to be used to ID the correct line in pubspec.yaml
version_line_pattern = "version:\s+\d+\.\d+\.\d+\+\d+"
# Open pubspec.yaml and read lines into memory
with open("pubspec.yaml", "r") as current_pubspec:
contents = current_pubsp... | increment_build.py | 833 | Simple script for updating the build number in pubspec.yaml Regex patter to be used to ID the correct line in pubspec.yaml Open pubspec.yaml and read lines into memory Reopen pubspec.yaml for writing and update Find and bump build number Write updated contents back to disk | 273 | en | 0.728784 |
import math
import warnings
import numpy as np
import matplotlib
rcParams = matplotlib.rcParams
from matplotlib.axes import Axes
import matplotlib.axis as maxis
from matplotlib import cbook
from matplotlib import docstring
from matplotlib.patches import Circle
from matplotlib.path import Path
from matplotlib.ticker i... | lib/python2.7/matplotlib/projections/polar.py | 26,693 | The inverse of the polar transform, mapping Cartesian
coordinate space *x* and *y* back to *theta* and *r*.
The affine part of the polar projection. Scales the output so
that maximum radius rests on the edge of the axes circle.
A polar graph projection, where the input dimensions are *theta*, *r*.
Theta starts pointi... | 8,954 | en | 0.682335 |
import cgi
import errno
import mimetypes
import os
import posixpath
import re
import shutil
import stat
import sys
import tempfile
try:
from urllib.request import urlretrieve
except ImportError: # Python 2
from urllib import urlretrieve
from optparse import make_option
from os import path
import django
fr... | django/core/management/templates.py | 13,280 | Copies either a Django application layout template or a Django project
layout template into the specified directory.
:param style: A color style object (see django.core.management.color).
:param app_or_project: The string 'app' or 'project'.
:param name: The name of the application or project.
:param directory: The di... | 1,782 | en | 0.858191 |
"""
Using the csv module.
"""
import csv
def parse(csvfilename):
"""
Reads CSV file named csvfilename, parses
it's content and returns the data within
the file as a list of lists.
"""
table = []
with open(csvfilename, "r") as csvfile:
csvreader = csv.reader(csvfile,
... | Rice-Python-Data-Analysis/week3/examples3_csvmodule.py | 940 | Reads CSV file named csvfilename, parses
it's content and returns the data within
the file as a list of lists.
Print out table, which must be a list
of lists, in a nicely formatted way.
Using the csv module.
Header column left justified Remaining columns right justified | 272 | en | 0.8595 |
"""
Utility functions for training one epoch
and evaluating one epoch
"""
import torch
import torch.nn as nn
import math
from train.metrics import accuracy_MNIST_CIFAR as accuracy
def train_epoch(model, optimizer, device, data_loader, epoch=0):
model.train()
epoch_loss = 0
epoch_train_acc = 0
... | train/train_superpixels_graph_classification.py | 2,249 | Utility functions for training one epoch
and evaluating one epoch
num x feat num x 1 | 87 | en | 0.728933 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import logging
import zipfile
import requests
from .record import Record
logger = logging.getLogger(__name__)
# Module API
def collec... | collectors/icdpcs/collector.py | 1,513 | Collect ICD-XX-PCS procedures.
-*- coding: utf-8 -*- Module API For more information see: https://www.cms.gov/Medicare/Coding/ICD10/2016-ICD-10-PCS-and-GEMs.html Prepare file Prepare data Format is described in instruction stored in zip archive we download Create record Write record Log info | 299 | en | 0.779409 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.