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 |
|---|---|---|---|---|---|---|
# Copyright 2021 AIPlan4EU project
#
# 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... | unified_planning/engines/parallel.py | 6,688 | Create a parallel instance of multiple Engines.
Copyright 2021 AIPlan4EU project 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 ap... | 994 | en | 0.86482 |
# coding: utf-8
"""
Purity//FB REST Client
Client for Purity//FB REST API (1.0), developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/).
OpenAPI spec version: 1.5
Contact: info@purestorage.com
Gene... | purity_fb/purity_fb_1dot5/models/hardware_connector_response.py | 4,266 | 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
HardwareConnectorResponse - a model defined in Swagger
Returns true if both objects are not equal
For `print` and `pprint`
Gets the items of this HardwareConnectorResponse.
a ... | 1,467 | en | 0.686063 |
#####################
# IMPORT DEPENDENCIES
######################
# flask (server)
from flask import(
Flask,
render_template,
jsonify,
request,
redirect)
#######################
# FLASK SET-UP
#######################
app = Flask(__name__)
#######################
# FLASK ROUTES
###############... | app.py | 542 | IMPORT DEPENDENCIES flask (server) FLASK SET-UP FLASK ROUTES @app.route("/outcomes") def charts(): return render_template("outcomes.html") | 142 | en | 0.35529 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015 Felix Wunsch, Communications Engineering Lab (CEL) / Karlsruhe Institute of Technology (KIT) <wunsch.felix@googlemail.com>.
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | gr-ieee802-15-4/python/qa_dqpsk_soft_demapper_cc.py | 2,147 | !/usr/bin/env python -*- coding: utf-8 -*- Copyright 2015 Felix Wunsch, Communications Engineering Lab (CEL) / Karlsruhe Institute of Technology (KIT) <wunsch.felix@googlemail.com>. This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Fr... | 875 | en | 0.857501 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2021 Snowflake Computing Inc. All right reserved.
#
from snowflake.connector.util_text import construct_hostname
def test_construct_hostname_basic():
assert (
construct_hostname("eu-central-1", "account1")
== "account1.eu-centra... | test/unit/test_construct_hostname.py | 1,253 | !/usr/bin/env python -*- coding: utf-8 -*- Copyright (c) 2012-2021 Snowflake Computing Inc. All right reserved. | 111 | en | 0.581805 |
#
# -*- coding: utf-8 -*-
#
import unittest
import os
import shutil
import yaml
import tensorflow as tf
from neural_compressor.experimental import model_conversion
tf.compat.v1.enable_eager_execution()
from tensorflow import keras
from tensorflow.python.framework import graph_util
from neural_compressor.adaptor.tf_u... | test/test_model_conversion.py | 5,228 | -*- coding: utf-8 -*- Load MNIST dataset Normalize the input image so that each pixel value is between 0 to 1. Define the model architecture. Train the digit classification model q_aware stands for for quantization aware. `quantize_model` requires a recompile. out of 60000 | 273 | en | 0.781932 |
"""Template helper methods for rendering strings with Home Assistant data."""
from __future__ import annotations
from ast import literal_eval
import asyncio
import base64
import collections.abc
from contextlib import suppress
from contextvars import ContextVar
from datetime import datetime, timedelta
from functools im... | homeassistant/helpers/template.py | 49,660 | Class to expose all HA states as attributes.
Class to expose a specific HA domain as attributes.
Log on undefined variables.
Holds information about a template render.
Result wrapper class to store render result.
Class to hold a template and manage caching and rendering.
The Home Assistant template environment.
Class t... | 8,315 | en | 0.760687 |
import threading, queue
import time
import random
import logging
logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-9s) %(message)s',)
NUMBER_OF_THREADS = 4
TIMEOUT_SECONDS = 5
class SampleThread(threading.Thread):
def __init__(self, group=None, target=None, name=None, id=None, kwargs=None):
... | multithreading/multithreading_simple.py | 1,368 | do some work here create a list to hold running SampleThread object instances build a single queue to send to all thread objects wait until all threads are finished | 164 | en | 0.903764 |
'''
Class Name: File
Purpose: The purpose of this class is represent data of a particular file
in a file system.
'''
class File:
def __init__(self, name = None, directory = None, date = None, fId = None, folderId = None, extension = ""):
self.__name = name
self.__directory = directory
self.__date = date
... | scripts/File.py | 1,380 | Class Name: File
Purpose: The purpose of this class is represent data of a particular file
in a file system. | 125 | en | 0.919856 |
import csv
import numpy as np
import os
import sys
import time
import jismesh.utils as ju
import pandas as pd
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)
from common.datastructure.Point import Point
from common.datastructure.Mesh imp... | meshdynamic/meshDynamic-Density.py | 26,018 | meshTokyo = Mesh('tokyo','500m') GRIDNUMBER = meshTokyo.lonNum * meshTokyo.latNum print(meshTokyo.size, GRIDNUMBER) InterpolatedStep = 12 tid = line[0] tid = line[0] timestamp = line[1] set().add print(np.array(INDEX).shape) set().add This grid transit version is for 1minutes trajectory, more accurate, not for 5minutes... | 2,587 | en | 0.568947 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Test the quoted APOGEE uncertainties from individual (rebinned) spectra. """
__author__ = "Andy Casey <arc@ast.cam.ac.uk>"
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
from glob import glob
from itertools import combinations
def ge... | data/check_apogee_spectra.py | 2,167 | Test the quoted APOGEE uncertainties from individual (rebinned) spectra.
!/usr/bin/env python -*- coding: utf-8 -*- Generate all permutations. | 144 | en | 0.687536 |
from __future__ import annotations
import abc
from dataclasses import asdict as asdict_, fields, is_dataclass
from pathlib import Path
from typing import Dict, Union, Tuple
from pprint import pformat
from covid_shared import ihme_deps
import numpy as np
import pandas as pd
import yaml
class YamlIOMixin:
"""Mixi... | src/covid_model_seiir_pipeline/lib/utilities.py | 3,287 | Generic class for pipeline stage specifications.
Mixin for reading and writing yaml files.
Type coerce items for easy serialization
Writes this specification to a file.
Builds the specification from a dictionary.
Builds the specification from a file path.
Parses a dict representation of the specification into init args... | 357 | en | 0.854518 |
import tensorflow as tf
from tensorflow.contrib.losses.python.metric_learning.metric_loss_ops import pairwise_distance
def dist_weighted_sampling(labels, embeddings, high_var_threshold=0.5, nonzero_loss_threshold=1.4, neg_multiplier=1):
"""
Distance weighted sampling.
# References
- [sampling matt... | loss.py | 8,087 | Distance weighted sampling.
# References
- [sampling matters in deep embedding learning]
(https://arxiv.org/abs/1706.07567)
# Arguments:
labels: 1-D tf.int32 `Tensor` with shape [batch_size] of
multi-class integer labels.
embeddings: 2-D float `Tensor` of embedding vectors. Embeddings should
... | 2,621 | en | 0.659532 |
import tensorflow as tf
import numpy as np
class WindowGenerator():
def __init__(self, input_width, label_width, shift,
train_df, val_df, test_df, label_columns=None):
# Store the raw data.
self.train_df = train_df
self.val_df = val_df
self.test_df = test_df
# Work out the label ... | src/data_cleaning/window_generator.py | 2,919 | Get and cache an example batch of `inputs, labels` for plotting.
Store the raw data. Work out the label column indices. Work out the window parameters. Slicing doesn't preserve static shape information, so set the shapes manually. This way the `tf.data.Datasets` are easier to inspect. No example batch was found, so g... | 379 | en | 0.826151 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-10 14:38
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('studies', '0015_auto_20170707_1820'),
]
operations = [
migrations.AlterModelOptions... | studies/migrations/0016_auto_20170710_1438.py | 1,256 | -*- coding: utf-8 -*- Generated by Django 1.11.2 on 2017-07-10 14:38 | 68 | en | 0.675996 |
from src.analysis.QQZoneAnalysis import QQZoneAnalysis
import json
from src.util.constant import BASE_DIR
from src.util.util import get_mktime2
import pandas as pd
import re
from src.analysis.SentimentClassify import SentimentClassify
class TrainMood(QQZoneAnalysis):
"""
生成各种训练需要的数据集
"""
def __init_... | src/analysis/TrainMood.py | 12,717 | 生成各种训练需要的数据集
利用谷歌nima模型对图片进行评分
paper: https://arxiv.org/abs/1709.05424
pytorch model: https://github.com/truskovskiyk/nima.pytorch.git
计算每条说说中图片的平均分
对于没有图片的按均值进行填充
:return:
计算每条说说的发送时间
分为以下五种类型:
0.午夜:0点-4点
1.凌晨:4点-8点
2.上午:8点-12点
3.下午:12点-16点
4.傍晚:16点-20点
5.晚上:20点-24点
:return:
导出待分类待的数据
:return:
nima模型预测结果文件 四个小时的时间差... | 902 | zh | 0.431836 |
from __future__ import absolute_import, unicode_literals
from django import forms
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from mayan.apps.common.classes import ModelProperty
from mayan.apps.common.forms import FilteredSelectionForm
from mayan.apps.documents... | mayan/apps/document_indexing/forms.py | 1,701 | A standard model form to allow users to create a new index template node | 72 | en | 0.51357 |
import io
import json
import os
from django.conf import settings
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from cms.menu_bases import CMSAttachMenu
from menus.base import NavigationNode
from menus.menu_pool import menu_pool
class DocumentationMenu(CMSAttachMenu):
... | cmsplugin_cascade/sphinx/cms_menus.py | 1,271 | This method is used to build the menu tree.
give the menu a name this is required. | 84 | en | 0.93677 |
"""Constants for Airly integration."""
from __future__ import annotations
from typing import Final
from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT
from homeassistant.const import (
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
DEVICE_CLASS_AQI,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_PM1,
... | homeassistant/components/airly/const.py | 3,325 | Constants for Airly integration. | 32 | en | 0.853098 |
#!/usr/bin/env python3
# Copyright 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Ignore indention messages, since legacy scripts use 2 spaces instead of 4.
# pylint: disable=bad-indentation,docstring-section-... | chip/mchp/util/pack_ec.py | 17,094 | Update CRC8 value.
Read entry point from payload EC image.
Read payload and pad it to 64-byte aligned.
Read payload and pad it to 64-byte aligned.
Extract public exponent and modulus from PEM file.
Create a temp file with the
first image_size bytes from the loader file and append bytes
from the rorw file.
return the fi... | 4,217 | en | 0.76291 |
#!/usr/bin/env python
"""Configuration parameters for the client."""
from grr.lib import config_lib
from grr.lib import rdfvalue
from grr.lib.rdfvalues import crypto
# General Client options.
config_lib.DEFINE_string("Client.name", "GRR",
"The name of the client. This will be used as a base "... | grr/config/client.py | 11,990 | Configuration parameters for the client.
!/usr/bin/env python General Client options. Deprecated. Remove when all installations switch to Client.server_urls. Windows client specific options. Client Cryptographic options. Here we define defaults for key values. The following configuration options are defined here but a... | 408 | en | 0.584208 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
i... | kubernetes/client/apis/batch_v1_api.py | 91,264 | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
create a Job
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_nam... | 44,272 | en | 0.840544 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-12-06 16:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('roster', '0021_auto_20180825_1843'),
]
operations = [
migrations.AlterField... | roster/migrations/0022_auto_20181206_1148.py | 564 | -*- coding: utf-8 -*- Generated by Django 1.11.9 on 2018-12-06 16:48 | 68 | en | 0.63487 |
# author : chenxi
# encoding:utf-8
import time
import run
if __name__ == "__main__":
mutex = 1
user = 0
users = []
while True:
if mutex == 1:
mutex = mutex - 1
try:
users.append(user)
users[user] = run.Score()
users[user].run_server()
user = user + 1
mutex = mutex +1
... | main.py | 455 | author : chenxi encoding:utf-8 | 30 | en | 0.693339 |
# -*- coding: utf-8 -*-
#
# Submittable API Client documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 9 15:21:21 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenera... | docs/source/conf.py | 8,406 | -*- coding: utf-8 -*- Submittable API Client documentation build configuration file, created by sphinx-quickstart on Mon Jun 9 15:21:21 2014. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All config... | 7,000 | en | 0.666306 |
"""Carbon Scraper Plugin for Userbot. //text in creative way.
usage: .karb //as a reply to any text message
Thanks to @r4v4n4 for vars,,, Random RGB feature by @PhycoNinja13b"""
from selenium.webdriver.support.ui import Select
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
fr... | userbot/plugins/carbonRGB (2).py | 4,229 | Carbon Scraper Plugin for Userbot. //text in creative way.
usage: .karb //as a reply to any text message
Thanks to @r4v4n4 for vars,,, Random RGB feature by @PhycoNinja13b
@borg.on(events.NewMessage(pattern=r"\.karb ", outgoing=True)) Importing message to module Converting to urlencoded this might take a bit.Waiting... | 385 | en | 0.624235 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
__author__ = 'Andreas Bader'
__version__ = "0.01"
# db_folders -> List of DB Folder (for space check)
# db_client -> name of ycsb client
# db_args -> special ycsb arguments for this db
# db_name -> name of this db (e.g. for workload file)
# db_desc -> more detailed name/... | vagrant_files/generator/files/databases/druid_cl5_rf1.py | 8,214 | !/usr/bin/env python2 -*- coding: utf-8 -*- db_folders -> List of DB Folder (for space check) db_client -> name of ycsb client db_args -> special ycsb arguments for this db db_name -> name of this db (e.g. for workload file) db_desc -> more detailed name/description jvm_args -> special jvm_args for this db and ycsb pre... | 3,808 | en | 0.817976 |
"""Tensorflow trainer class."""
import logging
import math
import os
from typing import Callable, Dict, Optional
import numpy as np
import tensorflow as tf
from .modeling_tf_utils import TFPreTrainedModel, shape_list
from .optimization_tf import GradientAccumulator, create_optimizer
from .trainer_utils import PREFIX... | src/transformers/trainer_tf.py | 17,412 | Accumulates the gradients across all the replica.
Accumulates the gradients from the next element in dataset.
Applies the gradients (cross-replica).
Create a checkpoint manager in order to be able to make the training
fault-tolerant.
Args:
max_to_keep: the maximum number of checkpoints to keep in the checkpoint path.... | 2,265 | en | 0.859607 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Unselected(_BaseTraceHierarchyType):
# marker
# ------
@property
def marker(self):
"""
The 'marker' property is an instance of Marker
that may be specified as:
... | plotly/graph_objs/scattergeo/__init__.py | 104,192 | Construct a new Unselected object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of plotly.graph_objs.scattergeo.Unselected
marker
plotly.graph_objs.scattergeo.unselected.Marker instance
or dict with compatible properties
textfont
plotly.graph_objs.scat... | 57,532 | en | 0.589549 |
"""MxShop 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-bas... | MxShop/MxShop/urls.py | 3,226 | MxShop 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-based ... | 750 | en | 0.56614 |
from inspect import isclass
from django.conf import settings
from django.core.files.storage import get_storage_class
from celery.datastructures import AttributeDict
from tower import ugettext_lazy as _
__all__ = ('LOG', 'LOG_BY_ID', 'LOG_KEEP',)
class _LOG(object):
action_class = None
class CREATE_ADDON(_LOG... | apps/amo/log.py | 18,434 | Expects: license, addon
Expects: author.user, role, addon
Expecting: addon, filename, version
Because the file is being deleted, filename and version
should be strings and not the object.
Requires review.id and add-on objects.
Expects: addon
e.g. amo.log(amo.LOG.CREATE_ADDON, []),
amo.log(amo.LOG.ADD_FILE_TO_VE... | 1,390 | en | 0.849065 |
# -*- coding: latin-1 -*-
#
# Turn off logging in extensions (too loud!)
from vb2py.test.testframework import *
import vb2py.extensions
import vb2py.utils
vb2py.extensions.disableLogging()
from vb2py.vbparser import buildParseTree, VBParserError
#
# Set some config options which are appropriate for testing
import vb... | vb2py/test/testdotnet.py | 2,212 | Holder class which gets built into a whole test case
Create a test method
-*- coding: latin-1 -*- Turn off logging in extensions (too loud!) Set some config options which are appropriate for testing String methods Expression calls VB.NET Decorated Class Handlers Shared methods Add tests to main test class | 308 | en | 0.830207 |
# -*- coding: utf-8 -*-
"""
pyvisa-py.protocols.usbtmc
~~~~~~~~~~~~~~~~~~~~~~~~~~
Implements Session to control USBTMC instruments
Loosely based on PyUSBTMC:python module to handle USB-TMC(Test and
Measurement class) devices.
by Noboru Yamamot, Accl. Lab, KEK, JAPAN
This file is an offsp... | pyvisa-py/protocols/usbtmc.py | 13,564 | The Host uses the Bulk-IN endpoint to read USBTMC response messages from
the device.
The Host must first send a USBTMC command message that expects a response
before attempting to read a USBTMC response message.
The Host uses the Bulk-OUT endpoint to send USBTMC command messages to
the device.
From USB-TMC table2
... | 2,583 | en | 0.797806 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | kubernetes/test/test_v1_scale_io_volume_source.py | 1,006 | V1ScaleIOVolumeSource unit test stubs
Test V1ScaleIOVolumeSource
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
coding: utf-8 FIXME: construct object wit... | 444 | en | 0.489993 |
import datetime
import json
import os
import re
import time
import uuid
import warnings
from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Union
from urllib.parse import urljoin
# if simplejson is installed, `requests` defaults to using it instead of json
# this allows th... | src/prefect/client/client.py | 55,892 | Client for communication with Prefect Cloud
If the arguments aren't specified the client initialization first checks the prefect
configuration and if the server is not set there it checks the current context. The
token will only be present in the current context.
Args:
- api_server (str, optional): the URL to sen... | 17,601 | en | 0.717949 |
# Enter your code here. Read input from STDIN. Print output to STOUT
import re
for _ in range(int(input())):
try:
re.compile(input())
print (True)
except re.error:
print (False)
| Hackerrank_python/9.erros and exceptions/66.Incorrect Regex.py | 222 | Enter your code here. Read input from STDIN. Print output to STOUT | 66 | en | 0.812699 |
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from .agent import agent
from .ci import ci
from .clean import clean
from .config import config
from .create import create
from .dep import dep
from .docs import docs
from .env import env
from .meta import... | datadog_checks_dev/datadog_checks/dev/tooling/commands/__init__.py | 533 | (C) Datadog, Inc. 2018-present All rights reserved Licensed under a 3-clause BSD style license (see LICENSE) | 108 | en | 0.821201 |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: mediapipe/framework/formats/annotation/rasterization.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import... | GestureVolume/venv/lib/python3.8/site-packages/mediapipe/framework/formats/annotation/rasterization_pb2.py | 4,479 | -*- coding: utf-8 -*- Generated by the protocol buffer compiler. DO NOT EDIT! source: mediapipe/framework/formats/annotation/rasterization.proto @@protoc_insertion_point(imports) @@protoc_insertion_point(class_scope:mediapipe.Rasterization.Interval) @@protoc_insertion_point(class_scope:mediapipe.Rasterization) @@proto... | 351 | en | 0.468195 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | server/src/experiments/ud_xilinx/watertank_simulation.py | 12,701 | Watertank Model
Output example:
{"water": 0.0, "inputs": [0.5, 0.5], "temperatures": [716, 20], "outputs": [1.0]}
Changes that have been applied lately to this model (Dec 2015)
- There is no longer a separate temperatures mode. Now there is a single model with temperatures.
- There are no longer temperature worki... | 5,438 | en | 0.799177 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/creature/npc/base/shared_dantari_base_male.iff"
result.attribute_template_id... | data/scripts/templates/object/creature/npc/base/shared_dantari_base_male.py | 455 | NOTICE: THIS FILE IS AUTOGENERATED MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES BEGIN MODIFICATIONS END MODIFICATIONS | 168 | en | 0.698026 |
import datetime
import itertools
import logging
import os
import platform
import time
from collections import defaultdict
from operator import itemgetter
from typing import (
AbstractSet,
Any,
Callable,
Dict,
Iterable,
List,
Mapping,
MutableMapping,
Optional,
Sequence,
Set,
... | zerver/lib/actions.py | 257,820 | The Django ORM is too slow for bulk operations. This class
is optimized for the simple use case of inserting a bunch of
rows into zerver_usermessage.
Create a message object and checks it, but doesn't send it or save it to the database.
The internal function that calls this can therefore batch send a bunch of created
... | 38,781 | en | 0.922326 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from msccl.collectives import *
from msccl.algorithm import *
from msccl.instance import *
from msccl.topologies import *
def _alltoall_subproblem(local_nodes, num_copies):
remote_node = local_nodes
local_end = local_nodes * local_nodes... | msccl/distributors/alltoall_subproblem.py | 10,140 | Copyright (c) Microsoft Corporation. Licensed under the MIT License. Create a distributed topology where copies of relay nodes that connect to the remote node in the subproblem topology are connected to all the relay nodes in the other copies. Also make copies of switches with a similar expansion of the remote node int... | 1,807 | en | 0.869265 |
import logging
from collections import OrderedDict
from pathlib import Path
from typing import List, Optional, Set, Tuple, Union
import numpy as np
import torch
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.preprocessing import minmax_scale
from tqdm import tqdm
import flair
from flair.data impo... | flair/models/tars_model.py | 35,323 | TARS model for text classification. In the backend, the model uses a BERT based binary
text classifier which given a <label, text> pair predicts the probability of two classes
"True", and "False". The input data is a usual Sentence object which is inflated
by the model internally before pushing it through the transform... | 7,322 | en | 0.813444 |
# -*- coding: utf-8 -*-
"""Console script for python_learn."""
import sys
import click
@click.command()
def main(args=None):
"""Console script for python_learn."""
click.echo("Replace this message by putting your code into "
"python_learn.cli.main")
click.echo("See click documentation at h... | python_learn/cli.py | 428 | Console script for python_learn.
Console script for python_learn.
-*- coding: utf-8 -*- pragma: no cover | 106 | en | 0.696841 |
# -------------------------------------------------------------------------
# Copyright (C) 2018 BMW Car IT GmbH
# -------------------------------------------------------------------------
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distrib... | scripts/code_style_checker/common_modules/config.py | 1,721 | Contains configurations constants
------------------------------------------------------------------------- Copyright (C) 2018 BMW Car IT GmbH ------------------------------------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy o... | 493 | en | 0.639477 |
import time
import random
import highfive
# This is the remote worker for the sum example. Here, we define what the
# workers do when they get a call from the master. All we need is a single
# function which takes the call, does some processing, and returns a response.
# An interesting way to play with the workers ... | examples/sum_worker.py | 1,495 | This is the remote worker for the sum example. Here, we define what the workers do when they get a call from the master. All we need is a single function which takes the call, does some processing, and returns a response. An interesting way to play with the workers is to spin some up, then shut them down before the job... | 1,174 | en | 0.948911 |
import datetime
import inspect
import os
import pprint as pretty_print
import jinja2
from jinja2 import Environment, FileSystemLoader
DEFAULT_TEMPLATE_FOLDERS = ["templates"]
def get_log_errors(logs):
return [e for e in logs.list() if e["level"] >= 40]
def make_list(obj):
return list(obj)
def pprint(obj... | spidermon/templates.py | 2,354 | If provided an absolute path to a template | 42 | en | 0.388684 |
# -*- coding: utf-8 -*-
#
# github-cli documentation build configuration file, created by
# sphinx-quickstart on Tue May 5 17:40:34 2009.
#
# 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.
#
# ... | docs/source/conf.py | 6,307 | -*- coding: utf-8 -*- github-cli documentation build configuration file, created by sphinx-quickstart on Tue May 5 17:40:34 2009. 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 valu... | 5,552 | en | 0.712869 |
from __future__ import print_function
import argparse
import os
import pickle
import sys
import cv2
import numpy as np
import torch
import vlfeat # calls constructor
from sklearn.cluster import MiniBatchKMeans
from src.utils.cluster.eval_metrics import _hungarian_match, _original_match, \
_acc
from src.utils.segm... | src/scripts/segmentation/baselines/kmeans_and_sift.py | 11,132 | calls constructor returns num unmasked pixels x SIFT_DLEN, in uint8 format operates on greyscale 128 bit images estimate cluster individual (box central) pixels when descriptor matrix flattened, goes along rows first (rows change slow) test dataloader training dataloader imgs currently channel first, [0-1] range, float... | 1,229 | en | 0.7232 |
from django.db import models
from django.template.defaultfilters import truncatechars
from django.utils import timezone
from camper.sked.models import Event, Session
from camper.twit.threads import SendTweetThread
class TweetTooLongError(Exception):
def __init__(self, msg=None):
self.msg = msg
if... | camper/twit/models.py | 5,444 | ''' This is weird. It can only be called from the first tweet in a series, raising NotImplementedError if called on a non-initial tweet. It spins off a thread to make the actual api calls, which manages state within the series. ''' | 247 | en | 0.907311 |
# 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 (t... | Allura/allura/model/index.py | 9,962 | Collection mapping shorthand_ids for artifacts to ArtifactReferences
Parse a shortlink into its nbhd/project/app/artifact parts
Look up the artifact referenced
Upsert logic to generate an ArtifactReference object from an artifact
Convert a sequence of shortlinks to the matching Shortlink objects
Licensed to the... | 1,528 | en | 0.857202 |
import os, sys
sys.path.insert(0, os.path.join("..",".."))
from nodebox.graphics.context import *
from nodebox.graphics import *
from nodebox.graphics.geometry import coordinates
from nodebox.graphics.shader import dropshadow, OffscreenBuffer, transparent, stretch
from time import time
flower = Image("cell.png")
... | examples/07-filter/09-buffer.py | 5,633 | Updates each root in the given list to a new position.
Roots can branch and will disappear over time.
Returns the updated list.
= image(blur(flower), color=(0,0,0,1)) Each "flower" is drawn with a shadow underneath to add some depth. The global shadow layer is at the bottom of the plant. Ideally, each growing root wo... | 1,952 | en | 0.891721 |
import tkinter as tk
from PIL import Image, ImageTk
# The Custom Variable Widgets
class MyBar(tk.Canvas) :
def __init__(self, master:object, shape:object, value=0, maximum=100,
bg="#231303", trough_color='#8a7852', bar_color='#f7f4bf'):
"""Creating the alpha mask and creating a custom wid... | Scripts/mybar.py | 1,778 | Creating the alpha mask and creating a custom widget of the given shape and dimensions.
Return bar's value.
Set bar's value.
The Custom Variable Widgets open shape mask with PIL create bar shape image with the choosen backgroound color apply shape as alpha mask to "cut out" the bar shape create the canvas bar value m... | 487 | en | 0.682302 |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
'''btDown.py - Download resource for HTTP/HTTPS/FTP/Thunder/Magnet/BT
Usage: python3 btDown.py <url> [path]
Required:
url HTTP/HTTPS/FTP/Thunder/MagNet/BT downloading URL
Optionals:
path The store path for the downloaded file
Notice: Python3 requ... | btDown.py | 5,205 | btDown.py - Download resource for HTTP/HTTPS/FTP/Thunder/Magnet/BT
Usage: python3 btDown.py <url> [path]
Required:
url HTTP/HTTPS/FTP/Thunder/MagNet/BT downloading URL
Optionals:
path The store path for the downloaded file
Notice: Python3 required for btDown.py
Author: zanran (wayne@zanran.m... | 480 | en | 0.691049 |
"""Commands for starting daemons."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import pprint
import confpy.api
import confpy.core.option
from .. import messages
cfg = confpy.api.Configuration... | pyperf/cmd/daemons.py | 3,964 | ArgumentParser setup for all CLI commands.
Fetch an error from the transport.
Fetch a result from the transport.
Manage a profiler daemon.
Send a profile request to the daemon.
Commands for starting daemons. | 207 | en | 0.652331 |
from kat.harness import Query, EDGE_STACK
from abstract_tests import AmbassadorTest, HTTP
from abstract_tests import ServiceType
from selfsigned import TLSCerts
from kat.utils import namespace_manifest
#####
# XXX This file is annoying.
#
# RedirectTestsWithProxyProto and RedirectTestsInvalidSecret used to be subcla... | python/tests/kat/t_redirect.py | 9,608 | This test tests that even if the specified secret is invalid, the rest of TLS Context should
go through. In this case, even though the secret does not exist, redirect_cleartext_from
should still take effect.
XXX This file is annoying. RedirectTestsWithProxyProto and RedirectTestsInvalidSecret used to be subclasses of... | 3,135 | en | 0.878628 |
#!/usr/bin/env python3
# Copyright (C) 2019 - Virtual Open Systems SAS
#
# 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 ... | src/bjointsp/main.py | 909 | !/usr/bin/env python3 Copyright (C) 2019 - Virtual Open Systems SAS 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... | 708 | en | 0.808647 |
"""
A simple Line class.
NOTE: This is NOT rosegraphics -- it is your OWN Line class.
Authors: David Mutchler, Vibha Alangar, Matt Boutell, Dave Fisher,
Mark Hays, Amanda Stouder, Aaron Wilkin, their colleagues,
and Jacob Jarski.
""" # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE.
import math
impor... | src/m1_Line.py | 38,309 | Represents a line segment in 2-dimensional space.
Represents a point in 2-dimensional space.
Defines == for Points: a == b is equivalent to a.__eq__(b).
Treats two numbers as "equal" if they are within 6 decimal
places of each other for both x and y coordinates.
What comes in:
-- self
-- a Line object
What go... | 17,728 | en | 0.743491 |
# Auto generated by generator.py. Delete this line if you make modification.
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
XPATH = {
'name' : "//div[@class='product-name']/h1",
'price' : "//p[@class='special-price']/span[@class='price']|//span[@class='regular-price']/span[@cla... | scraper/storage_spiders/azoravn.py | 1,029 | Auto generated by generator.py. Delete this line if you make modification.Rule(LinkExtractor(), 'parse_item'),Rule(LinkExtractor(), 'parse'), | 141 | en | 0.518468 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#
import re
import base64
import json
import os
import tempfile
import requests
import urllib3
from kubernetes_py.utils.ConvertData import conver... | kubernetes_py/utils/HttpRequest.py | 3,446 | !/usr/bin/env python -*- coding: utf-8 -*- This file is subject to the terms and conditions defined in file 'LICENSE.md', which is part of this source code package. TODO: TLS issue with Python 2.7 and urllib3 when hostname is an IP address A better fix should be found but I can't think of anything else for now. There w... | 449 | en | 0.950389 |
"""
The code below crawls the annotations of the MADE 1.0 Train Data and stores them
as Corpus ID, Annotation ID, Type, Length, Offset, Text in the
CSV_Annotations.csv file.
Input Files:
All xml files in the annotations folder in the made_train_data folder
Output Files:
CSV_Annotati... | Code/PreProcessing/Regex/annotation_crawling.py | 1,919 | The code below crawls the annotations of the MADE 1.0 Train Data and stores them
as Corpus ID, Annotation ID, Type, Length, Offset, Text in the
CSV_Annotations.csv file.
Input Files:
All xml files in the annotations folder in the made_train_data folder
Output Files:
CSV_Annotations.csv
Note: Make sure to delet... | 506 | en | 0.809458 |
#!/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.
"""
One of the trickier parts of creating a mock btrfs filesystem is tracking
the structures of the write forks, respec... | antlir/btrfs_diff/extents_to_chunks.py | 18,147 | Connects a part of a HOLE/DATA leaf Extent to a location in an Inode.
Although the Extent is shared between many inodes and/or disjoint
locations in the same inode, each _CloneExtentRef object is specific to
one occurrence of this Extent in the `gen_trimmed_leaves` of one inode.
We initially create a _CloneExtentRef ... | 10,867 | en | 0.894589 |
from sympy.vector.coordsysrect import CoordSysCartesian
from sympy.vector.scalar import BaseScalar
from sympy import sin, cos, pi, ImmutableMatrix as Matrix, \
symbols, simplify, zeros, expand
from sympy.vector.functions import express
from sympy.vector.point import Point
from sympy.vector.vector import Vector
fro... | sympy/vector/tests/test_coordsysrect.py | 12,706 | Tests the coordinate variables functionality with respect to
reorientation of coordinate systems.
Tests Point class, and locate_new method in CoordSysCartesian.
Tests the effects of orientation of coordinate systems on
basic vector operations.
Note that the name given on the lhs is different from A.x._nameTest to_mat... | 341 | en | 0.793412 |
# Webhooks for external integrations.
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.models import get_client
from zerver.lib.actions import check_send_stream_message
from zerver.lib.response import json_success, json_error
from zerver.decorator import... | zerver/webhooks/semaphore/view.py | 2,201 | Webhooks for external integrations. type: (HttpRequest, UserProfile, Dict[str, Any], str) -> HttpResponse semaphore only gives the last commit, even if there were multiple commits since the last build should never get here | 222 | en | 0.874717 |
#!/usr/bin/env python
#$Id: rotate_molecule.py,v 1.2.10.1 2016/02/11 09:24:08 annao Exp $
import os
from MolKit import Read
from MolKit.pdbWriter import PdbWriter, PdbqsWriter, PdbqWriter, PdbqtWriter
from mglutil.math.rotax import rotax
import numpy
if __name__ == '__main__':
import sys
import getopt
... | AutoDockTools/Utilities24/rotate_molecule.py | 5,544 | Print helpful, accurate usage statement to stdout.
!/usr/bin/env python$Id: rotate_molecule.py,v 1.2.10.1 2016/02/11 09:24:08 annao Exp $ process command arguments initialize required parameters-f: pdb_filename_stem optional parametersarbitrary axis angle for rotation'f:o:v'rotate the atoms herefor rotation around z-a... | 489 | en | 0.412342 |
import subprocess
import socket
import tempfile
import redis
import time
import os
import itertools
import sys
# Environment variable pointing to the redis executable
REDIS_PATH_ENVVAR = 'REDIS_PATH'
def get_random_port():
sock = socket.socket()
sock.listen(0)
_, port = sock.getsockname()
sock.close(... | RAMP/disposableredis/__init__.py | 2,250 | :param port: port number to start the redis server on. Specify none to automatically generate
:type port: int|None
:param extra_args: any extra arguments kwargs will be passed to redis server as --key val
:rtype: redis.StrictRedis
Environment variable pointing to the redis executable this will hold the actual port th... | 512 | en | 0.512678 |
# Copyright (c) 2020, RTE (https://www.rte-france.com)
# See AUTHORS.txt
# This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0.
# If a copy of the Mozilla Public License, version 2.0 was not distributed with this file,
# you can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-Lice... | lightsim2grid/tests/test_DataConverter.py | 16,742 | Copyright (c) 2020, RTE (https://www.rte-france.com) See AUTHORS.txt This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0. If a copy of the Mozilla Public License, version 2.0 was not distributed with this file, you can obtain one at http://mozilla.org/MPL/2.0/. SPDX-License-Identifi... | 572 | en | 0.681502 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from .video_record import VideoRecord
from datetime import timedelta
import time
def timestamp_to_sec(timestamp):
x = time.strptime(timestamp, '%H:%M:%S.%f')
sec = float(timedelta(hours=x.tm_hour,
... | slowfast/datasets/epickitchens_record.py | 1,577 | !/usr/bin/env python3 Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | 91 | en | 0.864982 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import unittest
import torch
import torch.nn as nn
from opacus import PerSampleGradientClipper
from opacus.dp_model_inspector import DPModelInspector
from opacus.layers import DPLSTM, DPMultiheadAttention, SequenceBias
from o... | DP_FL_recreate/opacus/tests/layers_grad_test.py | 6,316 | !/usr/bin/env python3 Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved run without DP run with DP compare input size : 25 output size : 12 minibatch : 30 sequence length : 20 Test batch_first=True case input size : 25 output size : 12 minibatch : 30 sequence length : 20 Test batch_first=False case | 318 | en | 0.499042 |
import os
import shutil
import yaml
from mock import patch
from dsl_parser.exceptions import DSLParsingLogicException
from .. import cfy
from ... import env
from ...config import config
from ...commands import init
from .test_base import CliCommandTest
from .constants import BLUEPRINTS_DIR, SAMPLE_INPUTS_PATH, \
... | cloudify_cli/tests/commands/test_init.py | 7,217 | Config values shouldn't change between init resets Config values should change between hard init resets Simply verifying the overwrite flag doesn't break the first init TODO: put back possible solutions make sure no error is thrown | 231 | en | 0.824172 |
import atexit
import logging
import multiprocessing
import gc
import os
from sys import exit
import warnings
import click
import dask
from distributed import Nanny, Worker
from distributed.security import Security
from distributed.cli.utils import check_python_3, install_signal_handlers
from distributed.comm import ge... | distributed/cli/dask_worker.py | 11,096 | https://github.com/dask/distributed/issues/1653 we only need this to verify it is getting parsed if contact address is not present we use the listen_address for contact Unregister all workers from scheduler We already log the exception in nanny / worker. Don't do it again. | 273 | en | 0.89385 |
# --- Imports --- #
import torch
import torch.nn.functional as F
# --- Perceptual loss network --- #
class LossNetwork(torch.nn.Module):
def __init__(self, vgg_model):
super(LossNetwork, self).__init__()
self.vgg_layers = vgg_model
self.layer_name_mapping = {
'3': "relu1_2",
... | perceptual.py | 1,001 | --- Imports --- --- Perceptual loss network --- | 49 | en | 0.924908 |
import heapq
import math
import random as rnd
from functools import partial
from .core import Bag
def sample(population, k):
"""Chooses k unique random elements from a bag.
Returns a new bag containing elements from the population while
leaving the original population unchanged.
Parameters
---... | ServerComponent/venv/Lib/site-packages/dask/bag/random.py | 3,552 | Map function used on the sample and choices functions.
Parameters
----------
population : list
List of elements to sample.
k : int, optional
Number of elements to sample. Default is 1.
Returns
-------
sample: list
List of sampled elements from the partition.
lx: int
Number of elements on the partition.... | 1,640 | en | 0.577329 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pip install nvidia-ml-py3 --user
import pynvml
try:
pynvml.nvmlInit()
except pynvml.NVMLError as error:
print(error)
# Driver Not Loaded 驱动加载失败(没装驱动或者驱动有问题)
# Insufficent Permission 没有以管理员权限运行 pynvml.NVMLError_DriverNotLoaded: Driver Not Loaded
... | setup/nvidia/nvml-test.py | 919 | !/usr/bin/env python -*- coding: utf-8 -*- pip install nvidia-ml-py3 --user Driver Not Loaded 驱动加载失败(没装驱动或者驱动有问题) Insufficent Permission 没有以管理员权限运行 pynvml.NVMLError_DriverNotLoaded: Driver Not Loaded total gpu count = 1 396.54 GeForce GTX 1060 6078 MB 531 MB 5546 MB | 272 | en | 0.346293 |
# Time: O(n * n!/(c_a!*...*c_z!), n is the length of A, B,
# c_a...c_z is the count of each alphabet,
# n = sum(c_a...c_z)
# Space: O(n * n!/(c_a!*...*c_z!)
# 854
# Strings A and B are K-similar (for some non-negative integer K)
# if we can swap the po... | Python/k-similar-strings.py | 3,813 | :type A: str
:type B: str
:rtype: int
Time: O(n * n!/(c_a!*...*c_z!), n is the length of A, B, c_a...c_z is the count of each alphabet, n = sum(c_a...c_z) Space: O(n * n!/(c_a!*...*c_z!) 854 Strings A and B are K-similar (for some non-negative integer... | 2,748 | en | 0.878143 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import subprocess
from ..utils.scripts import make_path
from ..utils.testing import Checker
from .obs_table import ObservationTable
from .hdu_index_table impo... | gammapy/data/data_store.py | 11,584 | IACT data store.
The data selection and access happens using an observation
and an HDU index file as described at :ref:`gadf:iact-storage`.
See :gp-extra-notebook:`cta_1dc_introduction` for usage examples.
Parameters
----------
hdu_table : `~gammapy.data.HDUIndexTable`
HDU index table
obs_table : `~gammapy.data.... | 3,102 | en | 0.551857 |
# -*- coding: utf-8 -*-
from django import forms
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _
from tcms.core.utils import string_to_list
from tcms.core.forms.fields import UserField
from tcms.management.models import Product, Version, Build
from tcms.testplans.... | telemetryPlugin/forms.py | 685 | Includes *only* fields used in search.html b/c
the actual search is now done via JSON RPC.
-*- coding: utf-8 -*- =========== Forms for search/filter ============== | 165 | en | 0.736794 |
# pylint: disable=no-member
from logging.config import fileConfig
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from alembic import context
from playthrough-bot.models import ModelBase, get_engine
# this is the Alembic Config object, which provides
# access to the values within the .ini file... | src/playthrough-bot/models/alembic/env.py | 2,339 | pylint: disable=no-member this is the Alembic Config object, which provides access to the values within the .ini file in use. Interpret the config file for Python logging. This line sets up loggers basically. add your model's MetaData object here for 'autogenerate' support from myapp import mymodel target_metadata = my... | 495 | en | 0.745483 |
"""
Experimemtal code for trimming primers & polyA tails from high error rate long reads
"""
import os, sys, pdb
from csv import DictWriter
from collections import namedtuple
from multiprocessing import Process
from Bio.Seq import Seq
from Bio import SeqIO
import parasail
ScoreTuple = namedtuple('ScoreTuple', ['score5... | beta/trim_primers.py | 8,323 | Search for 5' and 3' in the first and last 100 bp window
Experimemtal code for trimming primers & polyA tails from high error rate long reads
for ONT using ClontechSEQ_5P = 'AAGCAGTGGTATCAACGCAGAGTACATGGGG'SEQ_3P_REV = 'GTATCAACGCAGAGTAC'SEQ_5P = 'GCAATGAAGTCGCAGGGTTGGGG'SEQ_5P = 'CAGGAAACAGCTATGACC'SEQ_3P_REV = 'AAG... | 521 | en | 0.716636 |
#!/usr/bin/env python
"""
Tests for ohsome client
"""
import os
import pandas as pd
from nose.tools import raises
import geojson
import geopandas as gpd
import ohsome
@raises(ohsome.OhsomeException)
def test_handle_multiple_responses_throw_timeouterror():
"""
Tests counting elements within a bounding box for... | src/ohsome/tests/test_ohsome_client.py | 8,157 | Tests counting elements within a bounding box for two timestamps
:return:
Tests whether a TypeError is raised if the result cannot be converted to a geodataframe object
:return:
Tests counting elements within a bounding box and grouping them by keys
:return:
Tests whether the result of an elements/geometry query can be... | 834 | en | 0.689362 |
import os, sys, glob, argparse
import logging
import types
from collections import OrderedDict
import torch
import torch.nn.functional as F
import utils
import models
import main as entry
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]="0"
def export_onnx(args):
model_name = args... | tools.py | 11,829 | force cpu mode force cpu mode force cpu modelists = lists[45000:] | 65 | en | 0.697406 |
from selenium import webdriver
#import itertools
from openpyxl import Workbook, load_workbook
import re
import datetime
driver = webdriver.Firefox()
driver.get("https://www.worldometers.info/coronavirus/")
countries = []
cases = []
newCases = []
data = []
casesInt = []
newCasesInt = []
cells = []
cellsB = []
datez = da... | corona.py | 1,688 | import itertoolsprint(data)for country, percentage in zip(countries, percentages): print(country, ":", percentage)for countries column | 134 | en | 0.651423 |
import epaper2in13
from machine import Pin,SPI
from time import sleep_ms
# SPI #2 on ESP32
spi = SPI(2,baudrate=2000000, polarity=0, phase=0) # miso=Pin(12), mosi=Pin(23), sck=Pin(18))
cs = Pin(5)
dc = Pin(2)
rst = Pin(15)
busy = Pin(4)
e = epaper2in13.EPD(spi, cs, dc, rst, busy)
e.init(e.FULL_UPDATE)
y_start = 6 ... | examples/2in13-hello-world/test.py | 1,035 | SPI 2 on ESP32 miso=Pin(12), mosi=Pin(23), sck=Pin(18)) Y addresses start at 6 due to the memory layout -------------------- wait for 2 seconds before doing a partial update -------------------- 8px from bottom, 25px from left | 226 | en | 0.65852 |
import datetime
import os
import typing
from dataclasses import dataclass
import pandas
import pytest
from dataclasses_json import dataclass_json
import flytekit
from flytekit import ContainerTask, SQLTask, dynamic, kwtypes, maptask
from flytekit.common.translator import get_serializable
from flytekit.core import con... | tests/flytekit/unit/core/test_type_hints.py | 26,978 | Testing that when a workflow is local executed but a local wf execution context already exists, Promise objects
are returned wrapping Flyte literals instead of the unpacked dict.
Write some text to a file not in that directory above Since we're using local as remote, we should be able to just read the file from the '... | 925 | en | 0.939458 |
# coding=utf-8
# *** WARNING: this file was generated by pulumigen. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from ... import me... | sdk/python/pulumi_kubernetes/storage/v1beta1/CSIStorageCapacity.py | 23,669 | The set of arguments for constructing a CSIStorageCapacity resource.
:param pulumi.Input[str] storage_class_name: The name of the StorageClass that the reported capacity applies to. It must meet the same requirements as the name of a StorageClass object (non-empty, DNS subdomain). If that object no longer exists, the C... | 13,506 | en | 0.828207 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-10-15 15:04
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ContestAnalyzerOnline', '0006_auto_20171015_1445'),
]
operations = [
migrations.Del... | ContestAnalyzerOnline/utils/migrations/0007_delete_comment.py | 375 | -*- coding: utf-8 -*- Generated by Django 1.10.2 on 2017-10-15 15:04 | 68 | en | 0.646813 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | desktop/libs/metadata/src/metadata/optimizer_api.py | 16,037 | !/usr/bin/env python Licensed to Cloudera, Inc. under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Cloudera, Inc. licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use thi... | 905 | en | 0.799255 |
# -*- coding: utf-8 -*-
"""
walle-web
:copyright: © 2015-2019 walle-web.io
:created time: 2019-02-24 10:47:53
:author: wushuiyong@walle-web.io
"""
import os
import re
import os.path as osp
import git as PyGit
from git import Repo as PyRepo
class Repo:
path = None
def __init__(self, path=Non... | walle/service/git/repo.py | 3,713 | 获取所有分支
@param branch:
@param kwargs:
@return:
@todo 未完成
@param branch:
@param commit:
@return:
检出项目
@param branch:
@param kwargs:
@return:
获取分支的commits
@param branch:
@param kwargs:
@return:
判断是否为git目录
@param path:
@return:
更新项目
@param branch:
@param kwargs:
@return:
获取所有tag
@param branch:
@param kwargs:
@return:... | 630 | zh | 0.220087 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import datetime
import logging
import os
import time
import isodate
from testlib import mini_poster
logger = logging... | tests/systemtest/test_post_crash.py | 3,937 | Post a compressed crash and verify contents made it to S3.
Post a valid crash and verify the contents made it to S3.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Verify t... | 739 | en | 0.915402 |
import requests
import argparse
import logging
import coloredlogs
import threading
from flask import Flask, request, jsonify
from flask_swagger import swagger
from waitress import serve
import subprocess
import json
from kafka import KafkaConsumer
from threading import Thread
from threading import Timer
from datetime i... | dcs_rest_client.py | 12,429 | Get status.
---
describe: get status
responses:
200:
description: OK
Get swagger specification.
---
describe: get swagger specification
responses:
swagger:
description: swagger specification
Start signalling topics.
---
describe: start signalling topics
responses:
201:
description: accepted request
... | 1,756 | en | 0.800227 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 21 19:14:52 2020
@author: prachi
"""
import pickle
import numpy as np
der='swbd_diar/exp_new/callhome/plda_oracle/der.scp'
der_pickle = 'swbd_diar/exp_new/callhome/plda_oracle/derdict'
der=open(der,'r').readlines()
DER={}
for line i... | services/gen_der_dict.py | 501 | Created on Tue Jan 21 19:14:52 2020
@author: prachi
!/usr/bin/env python3 -*- coding: utf-8 -*- | 97 | en | 0.598251 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import sys
from six import StringIO
from pants.base.workunit import WorkUnitL... | src/python/pants/reporting/reporting.py | 7,709 | Initialize with the given RunTracker.
TODO: See `RunTracker.start`.
Updates reporting config once we've parsed cmd-line flags.
coding=utf-8 Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). Licensed under the Apache License, Version 2.0 (see LICENSE). Capture initial console reporting into a buffer. W... | 847 | en | 0.851744 |
import numpy as np
import pygame as pg
from numba import njit
def main():
size = np.random.randint(20,60) # size of the map
posx, posy, posz = 1.5, np.random.uniform(1, size -1), 0.5
rot, rot_v = (np.pi/4, 0)
lx, ly, lz = (size*20, size*30, 1000)
mr, mg, mb, maph, mapr, exitx, exity,... | RayTracingMazeEnem.py | 31,953 | size of the map pause new game toggle auto resolution toggle auto resolution manually change resolution fpss = int(clock.get_fps())pg.time.get_ticks()/100000auto adjust render resolution player's movement brick wallvertical loop horizontal vision loop LoDev DDA for optimization end of LoDev DDA check ceiling... | 612 | en | 0.57328 |
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
# Analog to digital converter example.
# Will loop forever printing ADC channel 1 raw and mV values every second.
# NOTE the ADC can only read voltages in the range of ~900mV to 1800mV!
import time
import board
impo... | Lights/adafruit-circuitpython-bundle-6.x-mpy-20210310/examples/lis3dh_adc.py | 1,427 | SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries SPDX-License-Identifier: MIT Analog to digital converter example. Will loop forever printing ADC channel 1 raw and mV values every second. NOTE the ADC can only read voltages in the range of ~900mV to 1800mV! Uncomment if using SPI import digitalio Hardware I... | 842 | en | 0.506 |
import datetime
from datetime import datetime, timedelta
from time import sleep
from app.search import add_to_index, delete_index, create_index, query_index
from app import db
from app.models import Post, User
from tests.BaseDbTest import BaseDbTest
class SearchTest(BaseDbTest):
index_name = "test_index"
d... | tests/SearchTest.py | 1,812 | create four users create four posts | 35 | en | 0.430308 |
# ---------------------------------------------------------------------
# CPE check
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modules
import... | services/discovery/jobs/box/cpe.py | 3,285 | CPE check
@todo: Remove stale CPE
--------------------------------------------------------------------- CPE check --------------------------------------------------------------------- Copyright (C) 2007-2019 The NOC Project See LICENSE for details --------------------------------------------------------------------- ... | 346 | en | 0.128131 |
"""The tests for the Entity component helper."""
# pylint: disable=protected-access
import asyncio
from collections import OrderedDict
import logging
import unittest
from unittest.mock import patch, Mock
from datetime import timedelta
import pytest
import homeassistant.core as ha
import homeassistant.loader as loader... | tests/helpers/test_entity_component.py | 17,404 | Test homeassistant.helpers.entity_component module.
Handle all exception inside the core loop.
Test the platform setup.
Test the platform setup.
Initialize a test Home Assistant instance.
Clean up the test Home Assistant instance.
Test the extraction of entity from service and device is available.
Test the extraction o... | 1,274 | en | 0.838819 |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... | groupdocs/models/GetBillingAddressResponse.py | 1,169 | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Copyright 2012 GroupDocs.
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
... | 751 | en | 0.81734 |
# Generated by Django 3.0.4 on 2020-03-29 13:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('analyzer', '0004_auto_20200328_1750'),
]
operations = [
migrations.AddField(
model_name='diseas... | analyzer/migrations/0005_auto_20200329_1308.py | 685 | Generated by Django 3.0.4 on 2020-03-29 13:08 | 45 | en | 0.628438 |
# encoding=utf8
# This is temporary fix to import module from parent folder
# It will be removed when package is published on PyPI
import sys
sys.path.append('../')
# End of fix
import random
from NiaPy.algorithms.basic import MultiStrategyDifferentialEvolution
from NiaPy.util import StoppingTask, OptimizationType
fro... | examples/run_msde.py | 676 | encoding=utf8 This is temporary fix to import module from parent folder It will be removed when package is published on PyPI End of fixwe will run Differential Evolution for 5 independent runs | 192 | en | 0.857897 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.