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 |
|---|---|---|---|---|---|---|
#
# (C) Copyright 2020 Pavel Tisnovsky
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Pavel... | pygame_zero/39_animation_framework.py | 998 | (C) Copyright 2020 Pavel Tisnovsky All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: Pavel Tisnovsky | 309 | en | 0.887556 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Daniel Standage <daniel.standage@gmail.com>
# Copyright (c) 2008 Sascha Steinbiss <steinbiss@zbh.uni-hamburg.de>
# Copyright (c) 2008 Center for Bioinformatics, University of Hamburg
#
# Permission to use, copy, modify, and distribute this software fo... | gtpython/gt/annotationsketch/image_info.py | 3,532 | !/usr/bin/env python -*- coding: utf-8 -*- Copyright (c) 2014 Daniel Standage <daniel.standage@gmail.com> Copyright (c) 2008 Sascha Steinbiss <steinbiss@zbh.uni-hamburg.de> Copyright (c) 2008 Center for Bioinformatics, University of Hamburg Permission to use, copy, modify, and distribute this software for any purpose w... | 933 | en | 0.809277 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
from django import http
from django.urls import reverse
from django.utils.http import unquote
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
MiddlewareMixin = object
class AngularUrlMiddleware(MiddlewareM... | djng/middleware.py | 3,359 | If the request path is <ANGULAR_REVERSE> it should be resolved to actual view, otherwise return
``None`` and continue as usual.
This must be the first middleware in the MIDDLEWARE_CLASSES tuple!
Reads url name, args, kwargs from GET parameters, reverses the url and resolves view function
Returns the result of resolved ... | 1,561 | en | 0.812032 |
from tests.base_case import ChatBotTestCase
from chatterbot.logic import LogicAdapter
from chatterbot.conversation import Statement
class ChatterBotResponseTestCase(ChatBotTestCase):
def test_conversation_values_persisted_to_response(self):
response = self.chatbot.get_response('Hello', persist_values_to_... | tests/test_chatbot.py | 16,176 | Test that the initialization functions are returned.
Test that the initialization functions are returned.
Test that the initialization functions are returned.
Test the case that a string contains "corrupted" text.
Test that a new statement is not learned if `read_only` is set to True.
Test the case that the input strin... | 1,668 | en | 0.92572 |
__I_MSG = { # ASMAxxxI
33 : lambda info, line: 'Storage alignment for {0} unfavorable'.format(line[info[1]:info[2]]),
}
__N_MSG = { # ASMAxxxN
}
__W_MSG = { # ASMAxxxW
45 : lambda info, line: 'Register or label not previously used - {0}'.fo... | zPE/base/pgm/asma90_err_code_rc.py | 4,495 | ASMAxxxI ASMAxxxN ASMAxxxW ASMAxxxE ASMAxxxS standard info message | 66 | en | 0.139766 |
import pytest
from rate.users.forms import UserCreationForm
from rate.users.tests.factories import UserFactory
pytestmark = pytest.mark.django_db
class TestUserCreationForm:
def test_clean_username(self):
# A user with proto_user params does not exist yet.
proto_user = UserFactory.build()
... | rate/users/tests/test_forms.py | 1,108 | A user with proto_user params does not exist yet. Creating a user. The user with proto_user params already exists, hence cannot be created. | 139 | en | 0.89852 |
"""Animations that try to transform Mobjects while keeping track of identical parts."""
__all__ = ["TransformMatchingShapes", "TransformMatchingTex"]
from typing import TYPE_CHECKING, List, Optional
import numpy as np
from .._config import config
from ..mobject.mobject import Group, Mobject
from ..mobject.opengl_mo... | manim/animation/transform_matching_parts.py | 9,735 | Abstract base class for transformations that keep track of matching parts.
Subclasses have to implement the two static methods
:meth:`~.TransformMatchingAbstractBase.get_mobject_parts` and
:meth:`~.TransformMatchingAbstractBase.get_mobject_key`.
Basically, this transformation first maps all submobjects returned
by th... | 3,261 | en | 0.728317 |
"""Tests for distutils.
The tests for distutils are defined in the distutils.tests package;
the test_suite() function there returns a test suite that's ready to
be run.
"""
import distutils.tests
import test.support
def load_tests(*_):
# used by unittest
return distutils.tests.test_suite()
def tearDownMod... | pypy3.9-v7.3.9-win64/Lib/test/test_distutils.py | 409 | Tests for distutils.
The tests for distutils are defined in the distutils.tests package;
the test_suite() function there returns a test suite that's ready to
be run.
used by unittest | 185 | en | 0.761038 |
# Copyright 2018 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | mycroft/skills/common_query_skill.py | 6,404 | Question answering skills should be based on this class.
The skill author needs to implement `CQS_match_query_phrase` returning an
answer and can optionally implement `CQS_action` to perform additional
actions if the skill's answer is selected.
This class works in conjunction with skill-query which collects
answers f... | 2,815 | en | 0.875282 |
import numpy as np
from .. import ArrayStringReader
def test_arraystringreader():
"""here is my test code
https://docs.pytest.org/en/stable/getting-started.html#create-your-first-test
"""
size = 8
sample_array = np.random.rand(size).astype('float32')
text = ','.join([str(x) for x in sample_a... | crafters/numeric/ArrayStringReader/tests/test_arraystringreader.py | 519 | here is my test code
https://docs.pytest.org/en/stable/getting-started.html#create-your-first-test | 99 | en | 0.693023 |
from __future__ import unicode_literals
import json
import collections
import string
from django.http import JsonResponse, HttpResponseRedirect, HttpResponseNotFound
from django.http import Http404
from django.shortcuts import render
import threading
import json
from django.views.decorators.csrf import csrf_exempt
from... | app/views.py | 19,204 | if a GET (or any other method) we'll create a blank formquary = init_tweet_accumulation_tweet_list(user, region, place) ["followers_slider", "retweet_slider", "favorites_slider", "tweets_slider"] ["followers, statusses, favorites (likes), retweets]print(mylist)print(total_tweets) [id, text, user_id, screen_name, full_d... | 413 | en | 0.487576 |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.tools.mo.front.extractor import FrontExtractorOp
from openvino.tools.mo.ops.lrn import AttributedLRN
class LRNExtractor(FrontExtractorOp):
"""
TF and IE(CAFFE) parameters in LRN differs in several places :
... | tools/mo/openvino/tools/mo/front/tf/lrn_ext.py | 1,279 | TF and IE(CAFFE) parameters in LRN differs in several places :
region (IE) : in TF there is no such parameter, they just use last dimension (feature dimension in case of NHWC)
local-size (IE) : it's the size of 1D vector in Caffe. In TF they have 'depth_radius' that eq
'(local-size * 2) + 1'
alpha (IE) ... | 640 | en | 0.64217 |
import simpy
import logging
"""
Recursive GraphQL schema for JSON StructureItem - passed as Python dictionary
type StructureItem {
id: ID!
type: StructureType
# optional annotation for a Branch
annotation: String
# reference UUID / Name / Num for: Function, Exit / ExitCondition (Exit), Replicate (DomainSet... | simmbse/structure_item.py | 3,753 | The base class for all call StructureItems (Branch, Parallel, Select, Loop, Function, etc.)
Recursively print CallStructure
from .exit import Exit, ExitCondition , LoopExitfrom .replicate import Replicate overidden by subclass overidden by subclass Check for override function No function override exists indent by cons... | 351 | en | 0.72884 |
import asyncio
import contextlib
import email.utils
import functools
import logging
import os
import time
import unittest
DATE = email.utils.formatdate(usegmt=True)
class GeneratorTestCase(unittest.TestCase):
def assertGeneratorRunning(self, gen):
"""
Check that a generator-based coroutine hasn'... | tests/utils.py | 3,561 | Base class for tests that sets up an isolated event loop for each test.
Convert test coroutines to test functions.
This supports asychronous tests transparently.
Check recorded deprecation warnings match a list of expected messages.
Check that a generator-based coroutine completes and return its value.
Check that a ge... | 1,001 | en | 0.885617 |
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | test/functional/test_f_xcompat.py | 7,238 | Customer raw key descriptor used by StaticStoredMasterKeyProvider.
Scenario details.
Provides static key
Finds a loaded raw key.
Build a key ID from instance parameters.
Tests decrypt from known good files.
Functional test suite testing decryption of known good test files encrypted using static RawMasterKeyProvider.
... | 1,095 | en | 0.85693 |
import os
import sys
import gen_database as gendb
import json
from shutil import copyfile
def run_cmd(cmd):
cmd_pipe = os.popen(cmd)
cmd_print = cmd_pipe.read()
print(cmd_print)
if __name__ == '__main__':
print("")
root_read_dir = sys.argv[1]
if root_read_dir[-1] != r"/" or r... | doc/gen_javadoc.py | 1,626 | Generate java doc by javadoc command copy js and css to target dir Read the html documents under /com to generate json data to a .js | 132 | en | 0.676585 |
# Copyright (C) 2011 Google Inc. All rights reserved.
# Copyright (C) 2019 Apple Inc. 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 ... | Tools/Scripts/webkitpy/tool/mocktool.py | 3,413 | Mock implementation of optparse.Values.
Copyright (C) 2011 Google Inc. All rights reserved. Copyright (C) 2019 Apple Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source c... | 2,055 | en | 0.861068 |
"""
This script implements an outlier interpretation method of the following paper:
"Beyond Outlier Detection: Outlier Interpretation by Attention-Guided Triplet Deviation Network". in WWW'21.
@ Author: Hongzuo Xu
@ email: hongzuo.xu@gmail.com or leogarcia@126.com or xuhongzuo13@nudt.edu.cn
"""
import numpy as np
imp... | model_aton/datasets.py | 8,022 | This script implements an outlier interpretation method of the following paper:
"Beyond Outlier Detection: Outlier Interpretation by Attention-Guided Triplet Deviation Network". in WWW'21.
@ Author: Hongzuo Xu
@ email: hongzuo.xu@gmail.com or leogarcia@126.com or xuhongzuo13@nudt.edu.cn
anom_x = self.x[anom_idx] x_no... | 747 | en | 0.41591 |
# Defines a bluetooth exception
class BluetoothException(Exception):
pass | src/main/python/exceptions/BluetoothException.py | 77 | Defines a bluetooth exception | 29 | en | 0.41585 |
from unittest import TestCase
import torch
from model.lstm2d_cell import LSTM2dCell
class LSTM2dCellTest(TestCase):
"""
Unit tests for the 2D-LSTM cell.
"""
embed_dim = 50
encoder_state_dim = 20
input_dim = 2 * encoder_state_dim + embed_dim
cell_state_dim = 25
batch_size = 42
def ... | test/test_lstm2d_cell.py | 3,014 | Unit tests for the 2D-LSTM cell.
Tests if the input and output dimensions of the cell are as expected.
Tests if the outputs of the cell are the same over the batch if the same input is fed in multiple times.
create toy values and repeat them over the batch check if the cell and hidden state are the same across the wh... | 329 | en | 0.841679 |
# Copyright (c) 2020, NVIDIA CORPORATION. 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 appli... | nemo/collections/asr/metrics/rnnt_wer.py | 19,845 | Used for performing RNN-T auto-regressive decoding of the Decoder+Joint network given the encoder state.
Args:
decoding_cfg: A dict-like object which contains the following key-value pairs.
strategy: str value which represents the type of decoding that can occur.
Possible values are :
... | 10,205 | en | 0.756981 |
'''
Created on 2021-08-19
@author: wf
'''
from unittest import TestCase
import time
import getpass
import os
class BaseTest(TestCase):
'''
base test case
'''
def setUp(self,debug=False,profile=True):
'''
setUp test environment
'''
TestCase.setUp(self)
self.... | tests/basetest.py | 1,616 | base test case
simple profiler
construct me with the given msg and profile active flag
Args:
msg(str): the message to show if profiling is active
profile(bool): True if messages should be shown
are we running in a public Continuous Integration Environment?
setUp test environment
time the action and print if pr... | 370 | en | 0.747034 |
# Auto-generated at 2021-09-27T17:12:31.553030+08:00
# from: Justice Iam Service (4.1.0)
# Copyright (c) 2018 - 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
# pylint: disable=duplicate-code
# pylint: ... | accelbyte_py_sdk/api/iam/models/model_get_users_response_with_pagination_v3.py | 3,723 | Model get users response with pagination V3
Properties:
data: (data) REQUIRED List[ModelUserResponseV3]
paging: (paging) REQUIRED AccountcommonPaginationV3
Auto-generated at 2021-09-27T17:12:31.553030+08:00 from: Justice Iam Service (4.1.0) Copyright (c) 2018 - 2021 AccelByte Inc. All Rights Reserved. This ... | 1,085 | en | 0.653974 |
# Generated by Django 2.1.3 on 2019-01-07 17:44
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import services.models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | services/migrations/0001_initial.py | 1,100 | Generated by Django 2.1.3 on 2019-01-07 17:44 | 45 | en | 0.717498 |
#!/usr/bin/python3
import pymysql
db = pymysql.connect("localhost","root","123456","tboxdb" )
cursor = db.cursor()
#create table
cursor.execute("DROP TABLE IF EXISTS EMPLOYEE")
sql = """CREATE TABLE EMPLOYEE (
FIRST_NAME CHAR(20) NOT NULL,
LAST_NAME CHAR(20),
AGE INT,
... | scripts/mysql.py | 1,541 | !/usr/bin/python3create tableinsertsql = "INSERT INTO EMPLOYEE(FIRST_NAME, \ LAST_NAME, AGE, SEX, INCOME) \ VALUES ('%s', '%s', '%d', '%c', '%d' )" % \ ('Mac', 'Mohan', 20, 'M', 2000)queryupdatedelete | 218 | en | 0.203614 |
# Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk)
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
"""The structure cla... | Bio/PDB/Structure.py | 2,079 | The Structure class contains a collection of Model instances.
Initialize the class.
Return the structure identifier.
Create/update internal coordinates from Atom X,Y,Z coordinates.
Internal coordinates are bond length, angle and dihedral angles.
:param verbose bool: default False
describe runtime problems
Return ... | 947 | en | 0.763503 |
#!/usr/bin/env python
import os
from matplotlib.path import Path
import numpy as np
import pandas as pd
from scipy.interpolate import griddata
from qcore import geo
DATA = os.path.join(os.path.dirname(os.path.abspath(__file__)), "zdata")
# constant regions and max bounds for faster processing
POLYGONS = [
(os.... | calculation/gmhazard_calc/gmhazard_calc/nz_code/nzs1170p5/nzs_zfactor_2016/ll2z.py | 2,817 | Computes the z-value for the given lon, lat tuple or
list of lon, lat tuples
:param locations:
:param radius_search: Checks to see if a city is within X km from the given location,
removes the search if value is set to 0
:return: Array of z-values, one for each location specified
!/usr/bin/env p... | 472 | en | 0.680361 |
#!/usr/bin/env python3
# Copyright (c) 2019 MindAffect B.V.
# Author: Jason Farquhar <jason@mindaffect.nl>
# This file is part of pymindaffectBCI <https://github.com/mindaffect/pymindaffectBCI>.
#
# pymindaffectBCI is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public... | mindaffectBCI/decoder/UtopiaDataInterface.py | 53,839 | Adaptor class for interfacing between the decoder logic and the data source
This class provides functionality to wrap a real time data and stimulus stream to make
it easier to implement standard machine learning pipelines. In particular it provides streamed
pre-processing for both EEG and stimulus streams, and ring-b... | 18,501 | en | 0.644834 |
"""
Module to read / write wav files using NumPy arrays
Functions
---------
`read`: Return the sample rate (in samples/sec) and data from a WAV file.
`write`: Write a NumPy array as a WAV file.
"""
from __future__ import division, print_function, absolute_import
import sys
import numpy
import struct
import warnings... | scipy/io/wavfile.py | 14,414 | Returns
-------
size : int
size of format subchunk in bytes (minus 8 for "fmt " and itself)
format_tag : int
PCM, float, or compressed format
channels : int
number of channels
fs : int
sampling frequency in samples per second
bytes_per_second : int
overall byte rate for the file
block_align : int
... | 5,452 | en | 0.674868 |
import requests
from datetime import datetime
import psycopg2
import time
def setup():
# Create database connection
conn = psycopg2.connect(database="postgres", user="postgres",
password="password", host="127.0.0.1", port="5432")
return conn
def call_api():
URL = "https://api... | server/models/bitcoin_price_API.py | 771 | Create database connection | 26 | en | 0.402593 |
"""
This file offers the methods to automatically retrieve the graph Streptomyces sp. NRRLF5008.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--pro... | bindings/python/ensmallen/datasets/string/streptomycesspnrrlf5008.py | 3,565 | Return new instance of the Streptomyces sp. NRRLF5008 graph.
The graph is automatically retrieved from the STRING repository.
Parameters
-------------------
directed: bool = False
Wether to load the graph as directed or undirected.
By default false.
preprocess: bool = True
Whether to preprocess the gr... | 2,819 | en | 0.702965 |
from django.db import models
from django.contrib.auth.models import User
# Which data the user already has:
# SuperUserInformation
# User: Jose
# Email: training@pieriandata.com
# Password: testpassword
# Create your models here.
class UserProfileInfo(models.Model):
# Create relationship (don't inherit... | Python learnings/Django projects/learning_users/basic_app/models.py | 840 | Which data the user already has: SuperUserInformation User: Jose Email: training@pieriandata.com Password: testpassword Create your models here. Create relationship (don't inherit from User!) Add any additional attributes to the user you want pip install pillow to use this, so that users do not need to upload their pic... | 401 | en | 0.841985 |
#pythran export compute_mask(int[:,:], int[:,:])
#runas import numpy as np; coords = np.array([[0, 0, 1, 1, 2, 2]]); indices = np.array([[0, 3, 2]]); compute_mask(coords, indices)
import numpy as np
def compute_mask(coords, indices): # pragma: no cover
"""
Gets the mask for the coords given the indices in sli... | pythran/tests/pydata/compute_mask.py | 8,385 | Converts all the pairs into a single integer mask, additionally filtering
by the indices.
Parameters
----------
starts, stops : list[int]
The starts and stops to convert into an array.
coords : np.ndarray
The coordinates to filter by.
indices : np.ndarray
The indices in the form of slices such that indices... | 5,115 | en | 0.689044 |
# Copyright (c) OpenMMLab. All rights reserved.
import argparse
import math
import os
import os.path as osp
import mmcv
from mmocr.utils import convert_annotations
def collect_files(img_dir, gt_dir):
"""Collect all images and their corresponding groundtruth files.
Args:
img_dir (str): The image dir... | tools/data/textdet/funsd_converter.py | 4,462 | Collect the annotation information.
Args:
files (list): The list of tuples (image_file, groundtruth_file)
nproc (int): The number of process to collect annotations
Returns:
images (list): The list of image information dicts
Collect all images and their corresponding groundtruth files.
Args:
img_dir (... | 965 | en | 0.669068 |
# Thai Thien
# 1351040
import pytest
import cv2
import sys
import sys, os
import numpy as np
import upload
# make sure it can find matcher.py file
sys.path.append(os.path.realpath(os.path.dirname(__file__)+"/.."))
import util
from matcher import Matcher
# make sure it can find detector.py file
sys.path.append(os.pat... | test/test_meow_data.py | 1,658 | Thai Thien 1351040 make sure it can find matcher.py file make sure it can find detector.py file | 95 | en | 0.832974 |
# Generated by Django 3.2.4 on 2021-07-23 15:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pythons_auth', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='pythonsuser',
name='is_staff',
... | pythons/pythons/pythons_auth/migrations/0002_auto_20210723_1847.py | 553 | Generated by Django 3.2.4 on 2021-07-23 15:47 | 45 | en | 0.688065 |
"""
Classes and functions useful for rewriting expressions for optimized code
generation. Some languages (or standards thereof), e.g. C99, offer specialized
math functions for better performance and/or precision.
Using the ``optimize`` function in this module, together with a collection of
rules (represented as instan... | sympy/codegen/rewriting.py | 7,721 | Abstract base class for rewriting optimization.
Subclasses should implement ``__call__`` taking an expression
as argument.
Parameters
==========
cost_function : callable returning number
priority : number
Rewriting optimization calling replace on expressions.
The instance can be used as a function on expressions for... | 3,123 | en | 0.635032 |
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing/
##
## This file is part of the Qt for Python examples of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:BSD$
## ... | gen/Lib/site-packages/PySide2/examples/network/fortuneserver.py | 4,576 | PySide2 port of the network/fortuneserver example from Qt v5.x
Copyright (C) 2013 Riverbank Computing Limited. Copyright (C) 2016 The Qt Company Ltd. Contact: http://www.qt.io/licensing/ This file is part of the Qt for Python examples of the Qt Toolkit. $QT_BEGIN_LICENSE:BSD$ You may use this file under the terms of ... | 1,814 | en | 0.869654 |
"""This module takes the data.log file produced by main.cpp and
fetches Bogota's addresses based on the coordinates in the file.
TODO: check if system has requirements - if not, install them
* requests
* subprocess (upcoming)
TODO: include exact time of match
TODO: progress bar
FIXME: select best from multiple addres... | locate.py | 1,330 | Main function. Read coordinates, fetch addresses and write on file.
This module takes the data.log file produced by main.cpp and
fetches Bogota's addresses based on the coordinates in the file.
TODO: check if system has requirements - if not, install them
* requests
* subprocess (upcoming)
TODO: include exact time of ... | 418 | en | 0.825222 |
"""
SC101 Baby Names Project
Adapted from Nick Parlante's Baby Names assignment by
Jerry Liao.
YOUR DESCRIPTION HERE
"""
import tkinter
import babynames
import babygraphicsgui as gui
FILENAMES = [
'data/full/baby-1900.txt', 'data/full/baby-1910.txt',
'data/full/baby-1920.txt', 'data/full/baby-1930.txt',
... | stancode_project/baby_names/babygraphics.py | 5,395 | Erases all existing information on the given canvas and then
draws the fixed background lines on it.
Input:
canvas (Tkinter Canvas): The canvas on which we are drawing.
Returns:
This function does not return any value.
Given a dict of baby name data and a list of name, plots
the historical trend of those name... | 2,121 | en | 0.817814 |
# -*- 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.base.exchange import Exchange
# -----------------------------------------------------------------------------
try:
basestri... | python/ccxt/bigone.py | 27,013 | -*- 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 ----------------------------------------------------------------------------- Python 3 Python 2 timestamp in nanoseconds HARDCODING IS DEPRECATED TH... | 8,338 | en | 0.452137 |
# -*- test-case-name: wokkel.test.test_muc -*-
#
# Copyright (c) Ralph Meijer.
# See LICENSE for details.
"""
XMPP Multi-User Chat protocol.
This protocol is specified in
U{XEP-0045<http://xmpp.org/extensions/xep-0045.html>}.
"""
from dateutil.tz import tzutc
from zope.interface import implements
from twisted.inter... | wokkel/muc.py | 45,576 | Item representing role and/or affiliation for admin request.
An admin request or response.
Availability presence sent from MUC client to service.
@type history: L{HistoryOptions}
Configure MUC room request.
http://xmpp.org/extensions/xep-0045.html#roomconfig
Room destruction request.
@param reason: Optional reason f... | 17,745 | en | 0.75668 |
#!/usr/bin/env python3
"""
Copyright Google Inc. 2019
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | blogs/beamadvent/day2a.py | 2,425 | Copyright Google Inc. 2019
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed u... | 621 | en | 0.836704 |
# coding: utf-8
"""
Velo Payments APIs
## Terms and Definitions Throughout this document and the Velo platform the following terms are used: * **Payor.** An entity (typically a corporation) which wishes to pay funds to one or more payees via a payout. * **Payee.** The recipient of funds paid out by a payor.... | test/test_ping.py | 5,383 | Ping unit test stubs
Test Ping
Velo Payments APIs
## Terms and Definitions Throughout this document and the Velo platform the following terms are used: * **Payor.** An entity (typically a corporation) which wishes to pay funds to one or more payees via a payout. * **Payee.** The recipient of funds paid out by a payo... | 4,918 | en | 0.843792 |
"""
Cubic spline planner
Author: Atsushi Sakai(@Atsushi_twi)
"""
import math
import numpy as np
import bisect
class Spline:
"""
Cubic Spline class
"""
def __init__(self, x, y):
self.b, self.c, self.d, self.w = [], [], [], []
self.x = x
self.y = y
self.nx = len(x) # ... | cubic_spline_planner.py | 5,546 | Cubic Spline class
2D Cubic Spline class
calc matrix A for spline coefficient c
calc matrix B for spline coefficient c
search data segment index
Calc position
if t is outside of the input x, return None
calc curvature
calc position
calc yaw
Calc first derivative
if t is outside of the input x, return None
Calc second d... | 557 | en | 0.670681 |
#!/usr/bin/env python3
## Copyright 2021 Aon plc
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law o... | libcsce/bin/csce.py | 2,721 | Parse configuration options from Cobalt Strike Beacon.
!/usr/bin/env python3 Copyright 2021 Aon plc 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 ... | 618 | en | 0.827367 |
"""
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft Corporation (“Microsoft”) grants you a nonexclusive, perpetual,
royalty-free right to use, copy, and modify the software code provided by us
("Software Code"). You may not sublicense the Software Code or any use of it
(except to your affiliates... | scripts/train_model.py | 4,592 | Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft Corporation (“Microsoft”) grants you a nonexclusive, perpetual,
royalty-free right to use, copy, and modify the software code provided by us
("Software Code"). You may not sublicense the Software Code or any use of it
(except to your affiliates and... | 1,626 | en | 0.876909 |
"""This module provides functionality for wrapping key infrastructure components
from distutils and setuptools.
"""
from __future__ import print_function
import argparse
import copy
import json
import os
import os.path
import platform
import stat
import sys
import warnings
from contextlib import contextmanager
# pyl... | skbuild/setuptools_wrap.py | 39,088 | Collect the list of prefixes for all packages
The list is used to match paths in the install manifest to packages
specified in the setup.py script.
The list is sorted in decreasing order of prefix length so that paths are
matched with their immediate parent package, instead of any of that
package's ancestors.
For ex... | 11,875 | en | 0.772919 |
# The code for this extension is based on https://github.com/ulrobix/sphinxcontrib-contentui
| doc/src/site/sphinx/extensions/contentui/__init__.py | 93 | The code for this extension is based on https://github.com/ulrobix/sphinxcontrib-contentui | 90 | en | 0.881727 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2020 Ansible Project
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
from an... | exercises/networking_selfpaced/networking-workshop/collections/ansible_collections/community/general/tests/unit/plugins/become/test_ksu.py | 1,364 | (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> (c) 2020 Ansible Project GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) Make coding more python3-ish | 201 | en | 0.545499 |
# Copyright 2019 The Meson development team
# 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 ... | mesonbuild/cmake/traceparser.py | 31,540 | Handler for the CMake set() function in all variaties.
comes in three flavors:
set(<var> <value> [PARENT_SCOPE])
set(<var> <value> CACHE <type> <docstring> [FORCE])
set(ENV{<var>} <value>)
We don't support the ENV variant, and any uses of it will be ignored
silently. the other two variates are supported, with some ca... | 5,819 | en | 0.816458 |
# -*- coding: utf-8 -*-
'''
A Runner module interface on top of the salt-ssh Python API.
This allows for programmatic use from salt-api, the Reactor, Orchestrate, etc.
'''
# Import Python Libs
from __future__ import absolute_import
# Import Salt Libs
import salt.client.ssh.client
def cmd(
tgt,
fun,... | salt/runners/ssh.py | 847 | Execute a single command via the salt-ssh subsystem and return all
routines at once
.. versionaddedd:: 2015.2
A wrapper around the :py:meth:`SSHClient.cmd
<salt.client.ssh.client.SSHClient.cmd>` method.
A Runner module interface on top of the salt-ssh Python API.
This allows for programmatic use from salt-api, the R... | 405 | en | 0.555653 |
# coding=utf-8
import os, clr
os.chdir(os.path.dirname(__file__))
clr.AddReference('System.Drawing')
clr.AddReference('System.Windows.Forms')
from System import Drawing, Array, ComponentModel, Diagnostics, IO
from System.Windows import Forms
import System.Object as object
import System.String as string
from ... | 2021/changeLineWidth.py | 8,788 | coding=utf-8-------------------------------------------------------------------------------------------------------------------------------------------------------- label1 label2 listBox_selection comboBox_layer textBox_net label3 textBox_linewidth button_change label4 Form1form.Show()oDesktop.PauseScript() | 308 | en | 0.215302 |
from src.NN import NetWrapper
from src.games.Tictactoe import Tictactoe
from src.Player import *
from src.MCTS import MCTS
import yaml
with open("config.yaml", 'r') as f:
config = yaml.safe_load(f)
game = Tictactoe(**config['GAME'])
nn = NetWrapper(game, **config['NN'])
nn.load_model("models/the_bestest_of_model... | test.py | 643 | player_vs_player(game, p1 = AlphaZeroPlayer(nn, mcts), p2 = AlphaZeroPlayer(nn1, mcts), n_games = 100, treshold = 0.5, print_b = False) | 138 | en | 0.822004 |
#
# Copyright 2019 Xilinx 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 writi... | tools/RNN/rnn_quantizer/pytorch_binding/pytorch_nndct/export/op_descriptor.py | 17,308 | Copyright 2019 Xilinx Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distribut... | 3,510 | en | 0.228573 |
# -*- coding: utf-8 -*-
import os
import tempfile
import pytest
@pytest.fixture(scope="module")
def master(request, salt_factories):
return salt_factories.spawn_master(request, "master-1")
@pytest.fixture(scope="module")
def minion(request, salt_factories, master):
return salt_factories.spawn_minion(reques... | tests/integration/factories/master/test_master.py | 3,343 | Test copying a file from the master to the minion
-*- coding: utf-8 -*- | 73 | en | 0.845682 |
# -*- coding: utf-8 -*-
import click
import logging
from pathlib import Path
from os import listdir
from os.path import isfile, join
import numpy as np
import soundfile as sf
from scipy import io
import scipy.signal as sp
from src.features import gtgram
ROOT = Path(__file__).resolve().parents[2]
# set the path to th... | src/data/generateData.py | 6,947 | This script creates HRTF filtered sound samples of the sounds given in the folder SOUND_FILES.
This is done for each participant's HRTF specified in participant_numbers.
ALL ELEVATIONS (50) are taken to filter the data.
-*- coding: utf-8 -*- set the path to the sound files create a list of the sound files Define up t... | 1,472 | en | 0.713997 |
# pylint: disable=too-many-lines
# 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) AutoRe... | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py | 24,285 | VirtualMachineScaleSetRollingUpgradesOperations operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.compute.v2... | 6,151 | en | 0.571294 |
# MIT License
# Copyright (c) 2022 Muhammed
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publi... | LuciferMoringstar_Robot/admins/chat.py | 2,760 | MIT License Copyright (c) 2022 Muhammed Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute... | 1,287 | en | 0.817865 |
#!/usr/bin/env python
import common
import json
import docker_utils
nginx_sites_available = '/etc/nginx/sites-available'
CERT_DIR = '/root/certs'
import subprocess
def create_certificates(domains):
format_args = {'cert_dir': CERT_DIR}
import os.path
if not os.path.isfile(os.path.join(CERT_DIR, 'acmeCA.... | py/update_nginx_vhosts.py | 10,877 | !/usr/bin/env python create_certificates([host.domains[0] for host in common.get_vhost_config()]) print params | 110 | en | 0.292679 |
# -*- coding: utf-8 -*-
"""Main IPython class."""
#-----------------------------------------------------------------------------
# Copyright (C) 2001 Janko Hauser <jhauser@zscout.de>
# Copyright (C) 2001-2007 Fernando Perez. <fperez@colorado.edu>
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distribu... | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | 148,921 | A dummy module used for IPython's interactive module when
a namespace must be assigned to the module's __dict__.
The arguments used for a call to :meth:`InteractiveShell.run_cell`
Stores information about what is going to happen.
The result of a call to :meth:`InteractiveShell.run_cell`
Stores information about what ... | 55,482 | en | 0.795241 |
# Copyright 2022 StackHPC
#
# 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... | nova/tests/unit/limit/test_placement.py | 15,495 | Copyright 2022 StackHPC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw... | 1,196 | en | 0.943894 |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | src/oci/devops/models/create_deployment_details.py | 8,093 | The information about new deployment.
Initializes a new CreateDeploymentDetails object with values from keyword arguments. This class has the following subclasses and if you are using this class as input
to a service operations then you should favor using a subclass over the base class:
* :class:`~oci.devops.models.Cr... | 4,497 | en | 0.668083 |
import song_generator
from markov_gen import markov_generator
import os, json
nino_dir = '/'.join(os.path.dirname(os.path.realpath(__file__)).split('/')[:-1])
import generator
generator.set_dir_write_note(nino_dir + '/trainer/generated_notes')
def gen_kwargs():
kwargs = {
#What the general scale for t... | ninopianino/markov_trainer.py | 4,473 | What the general scale for the shond should be - chosen randomly from this list. How many segments the song has. The range of BPMs for each segment. Chooses randomly for each segment. A range for beats per bar for each segment. Will choose randomly. A range for how many chords each segment should have. Chooses randomly... | 1,924 | en | 0.912029 |
"""
Main agent for DQN
"""
import math
import random
import shutil
import gym
import torch
from tensorboardX import SummaryWriter
from torch.backends import cudnn
from tqdm import tqdm
from agents.base import BaseAgent
from graphs.losses.huber_loss import HuberLoss
from graphs.models.dqn import DQN
from utils.env_uti... | agents/dqn.py | 9,475 | Finalize all the operations of the 2 Main classes of the process the operator and the data loader
:return:
performs a single step of optimization for the policy model
:return:
This function will the operator
:return:
The action selection function, it either uses the model to choose an action or samples one uniformly.
:... | 1,224 | en | 0.823175 |
# Copyright (c) 2013, RC and contributors
# For license information, please see license.txt
import frappe
from frappe import _
def execute(filters=None):
columns = get_columns()
data = get_data(filters)
return columns, data
def get_columns():
return [
{
"fieldname": "po_number",
"fieldtype": "Data",
"... | turk/turk/report/pending_order_detail/pending_order_detail.py | 2,153 | Copyright (c) 2013, RC and contributors For license information, please see license.txt | 87 | en | 0.781642 |
# 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 string
from telethon import events
from telethon.utils import add_surrogate
from telethon.tl.types import Messag... | userbot/plugins/new.py | 3,119 | Pretty formats the given object as a YAML string which is returned.
(based on TLObject.pretty_format)
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/. truncate long strings a... | 531 | en | 0.82901 |
from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from accounts.models import BookingAgent
class Station(models.Model):
name=models.CharField(max_length=30)
def __str__(self):
return self.name
# Create your models here.
class Train(models.Model):
... | reserway/bookings/models.py | 5,409 | Create your models here. | 24 | en | 0.920486 |
# Copyright (c) 2020, NVIDIA CORPORATION.
#
# 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... | python/cuml/dask/preprocessing/label.py | 6,715 | A distributed version of LabelBinarizer for one-hot encoding
a collection of labels.
Examples
--------
Examples
--------
Create an array with labels and dummy encode them
.. code-block:: python
import cupy as cp
from cuml.dask.preprocessing import LabelBinarizer
from dask_cuda import LocalCUDACluster
... | 3,201 | en | 0.612729 |
#!/usr/bin/env python
#
# Copyright (C) 2019 The Android Open Source 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 req... | tools/check_target_files_vintf.py | 8,010 | Checks VINTF metadata of a target files zip or extracted target files
directory.
Args:
inp: path to the (possibly extracted) target files archive.
info_dict: The build-time info dict. If None, it will be loaded from inp.
Returns:
True if VINTF check is skipped or compatible, False if incompatible. Raise
a Run... | 2,264 | en | 0.758394 |
# coding: utf-8
import re
from sqlalchemy import BigInteger
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import DDL
from sqlalchemy import DefaultClause
from sqlalchemy import event
from sqlalchemy import exc
from sqlalchemy import ForeignKey
from sqlalchemy import Index
from sqlalche... | test/dialect/mysql/test_reflection.py | 39,787 | Test reflection of column defaults.
test reflection of NULL/NOT NULL, in particular with TIMESTAMP
defaults where MySQL is inconsistent in how it reports CREATE TABLE.
Test reflection of include_columns to be sure they respect case.
coding: utf-8 Early 5.0 releases seem to report more "general" for columns in a view,... | 1,479 | en | 0.803281 |
"""
Django settings for myproject project.
Generated by 'django-admin startproject' using Django 2.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
... | myproject/myproject/settings.py | 3,674 | Django settings for myproject project.
Generated by 'django-admin startproject' using Django 2.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
Build paths insid... | 990 | en | 0.648801 |
from __future__ import annotations
import operator
import re
import sys
import types
from enum import Enum
from typing import TYPE_CHECKING, Optional, List, Union, Iterable, Type, Tuple
from olo.expression import UnaryExpression, BinaryExpression, Expression
from olo.funcs import DISTINCT, Function
if TYPE_CHECKING:... | olo/query.py | 22,303 | pragma: no cover noqa pragma: no cover pylint: disable=W noqa pragma: no cover pylint: disable=W pylint: disable=E1101 FIXME(PG) f == field will return an Expression object, so must compare with True explicitly copy ast self._entities must casting to set or pk in self._entities will always be True!!! FIXME(PG) pylint: ... | 379 | en | 0.664824 |
# 6. Больше числа п. В программе напишите функцию, которая принимает два
# аргумента: список и число п. Допустим, что список содержит числа. Функция
# должна показать все числа в списке, которые больше п.
import random
def main():
list_num = [random.randint(0, 100) for i in range(20)]
print(list_num)
n = ... | chapter_07/06_larger_than_n.py | 848 | 6. Больше числа п. В программе напишите функцию, которая принимает два аргумента: список и число п. Допустим, что список содержит числа. Функция должна показать все числа в списке, которые больше п. | 198 | ru | 0.998898 |
import ast
import math
import copy
with open('input.txt', 'r') as f:
lines = f.readlines()
lines = [line[:-1] for line in lines]
lines = [ast.literal_eval(line) for line in lines]
def reduce(num):
explodeCriteriaMet = True
splitCriteriaMet = True
while explodeCriteriaMet or splitCriteriaMet:
... | 07-AdventOfCode2021/18/day-18.py | 5,527 | check for pair nested inside four pairs regular number is 10 or greater print("SPLIT") print("IDX:", idx) print("VAL:", value) store values to add: the exploding pair is replaced with the regular number 0 adding the values to their neighbors left: there is a neighbour to the left when the indexValue is 1 right there is... | 384 | en | 0.817395 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import unittest
import code
class TestDay01(unittest.TestCase):
# Part 01
def test_example01(self):
expense_report = [1721, 299]
expected = 514579
result = code.part01(expense_report)
self.assertEqual(result, expected)
# Do... | 2020/01/test.py | 791 | !/usr/bin/env python3 -*- encoding: utf-8 -*- Part 01 Don't count a 2020/2 value twice Part 02 | 94 | en | 0.645452 |
import sys
import cj_function_lib as cj
import init_file as variables
import mdbtools as mdt
#print variables.ProjMDB
#print variables.QSWAT_MDB
wwqrng = cj.extract_table_from_mdb(variables.QSWAT_MDB, 'wwqrng', variables.path + "\\wwqrng.tmp~")
wwq_defaults={}
for record in wwqrng: # Getting a list of parameter n... | workflow_lib/wwq_dbase.py | 785 | print variables.ProjMDBprint variables.QSWAT_MDB Getting a list of parameter names for wwq and their defaults | 109 | en | 0.302346 |
from rdkit import Chem
from AnalysisModule.routines.util import load_pkl
# logit_result = yaml_fileread("../logistic.yml")
logit_result = load_pkl("../clf3d/logistic.pkl")
"""
epg-string --> maxscore
--> [(f, s)] --> xx, yy, zz, [(x, y, d)] --> refcode, amine
"""
from rdkit.Chem import rdDepictor
from r... | Revision/vis3d/prepare.py | 2,137 | logit_result = yaml_fileread("../logistic.yml") drawer.DrawMolecule(mc, legend="lalala") legend fontsize hardcoded, too small It seems that the svg renderer used doesn't quite hit the spec. Here are some fixes to make it work in the notebook, although I think the underlying issue needs to be resolved at the generatio... | 374 | en | 0.869516 |
#Copyright 2019 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, so... | tensorflow_graphics/version.py | 906 | Defines tensorflow_graphics version information (https://semver.org/).
Copyright 2019 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... | 619 | en | 0.842227 |
"Plugin registration"
from pylint.lint import PyLinter
from .checkers import register_checkers
from .suppression import suppress_warnings
def register(linter: PyLinter) -> None:
"Register the plugin"
register_checkers(linter)
suppress_warnings(linter)
| pylint_django_translations/plugin.py | 267 | Register the plugin
Plugin registration | 39 | en | 0.47103 |
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from __future__ import division
import copy
from fnmatch import translate
from math import isinf, isnan
from os.path import isfile
from re import compile
import requests
from prometheus_client.samples im... | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | 56,304 | Decumulate buckets in a given histogram metric and adds the lower_bound label (le being upper_bound)
If hostname is None, look at label_to_hostname setting
Extracts metrics from a prometheus histogram and sends them as gauges
Extracts metrics from a prometheus summary metric and sends them as gauges
Filters out the tex... | 10,770 | en | 0.793608 |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | simulator_control/simulator_util.py | 26,410 | The object for simulator in MacOS.
Creates a new simulator according to arguments.
If neither device_type nor os_version is given, will use the latest iOS
version and latest iPhone type.
If os_version is given but device_type is not, will use latest iPhone type
according to the OS version limitation. E.g., if the give... | 9,238 | en | 0.722948 |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter # useful for `logit` scale
# Fixing random state for reproducibility
np.random.seed(19680801)
# make up some data in the interval ]0, 1[
y = np.random.normal(loc=0.5, scale=0.4, size=1000)
y = y[(y > 0) & (y < 1)]
y.sort(... | logAxes.py | 1,247 | useful for `logit` scale Fixing random state for reproducibility make up some data in the interval ]0, 1[ plot with various axes scales linear log symmetric log logit Format the minor tick labels of the y-axis into empty strings with `NullFormatter`, to avoid cumbering the axis with too many labels. Adjust the subplot ... | 421 | en | 0.778543 |
# The MIT License (MIT)
#
# Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the ... | adafruit_bus_device/i2c_device.py | 6,679 | Represents a single I2C device and manages locking the bus and the device
address.
:param ~busio.I2C i2c: The I2C bus the device is on
:param int device_address: The 7 bit device address
.. note:: This class is **NOT** built into CircuitPython. See
:ref:`here for install instructions <bus_device_installation>`.
Ex... | 4,310 | en | 0.805833 |
# Solution of;
# Project Euler Problem 564: Maximal polygons
# https://projecteuler.net/problem=564
#
# A line segment of length $2n-3$ is randomly split into $n$ segments of
# integer length ($n \ge 3$). In the sequence given by this split, the
# segments are then used as consecutive sides of a convex $n$-polygon, ... | py/py_0564_maximal_polygons.py | 1,599 | Solution of; Project Euler Problem 564: Maximal polygons https://projecteuler.net/problem=564 A line segment of length $2n-3$ is randomly split into $n$ segments of integer length ($n \ge 3$). In the sequence given by this split, the segments are then used as consecutive sides of a convex $n$-polygon, formed in suc... | 1,401 | en | 0.831628 |
# Copyright Red Hat, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | contrib/example.py | 3,134 | Copyright Red Hat, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in... | 679 | en | 0.829444 |
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver import Firefox, Chrome, PhantomJS
... | main.py | 11,423 | 发件人邮箱账号 发件人邮箱密码 收件人邮箱账号 指定图片为当前目录 定义图片 ID,在 HTML 文本中引用 发件人邮箱中的SMTP服务器,端口是25 括号中对应的是发件人邮箱账号、邮箱密码 括号中对应的是发件人邮箱账号、收件人邮箱账号、发送邮件 关闭连接 如果 try 中的语句没有执行,则会执行下面的 ret=False driver = Firefox() driver = Chrome() macOS linux windows | 219 | zh | 0.932475 |
#!/usr/bin/python
# Copyright (c) 2017, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... | plugins/modules/oci_identity_mfa_totp_device_facts.py | 8,111 | Supported operations: get, list
!/usr/bin/python Copyright (c) 2017, 2021 Oracle and/or its affiliates. This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license. GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) Apache License v2.0... | 415 | en | 0.744328 |
from django.views.generic.base import TemplateResponseMixin, View
from django.http import HttpResponseRedirect
from django.forms.formsets import formset_factory
from django.forms.models import modelformset_factory, inlineformset_factory
from django.views.generic.detail import SingleObjectMixin, SingleObjectTemplateResp... | extra_views/formsets.py | 7,560 | Base class for constructing a FormSet within a view
A base view for displaying a formset
A base view for displaying a modelformset for a queryset belonging to a parent model
A base view for displaying a modelformset
A view for displaying a formset, and rendering a template response
A view for displaying a modelformset ... | 515 | en | 0.785298 |
from __future__ import unicode_literals
from flask import Flask,render_template,url_for,request
from text_summarization import text_summarizer
import time
import spacy
nlp = spacy.load('en_core_web_sm')
app = Flask(__name__)
# Web Scraping Pkg
from bs4 import BeautifulSoup
# from urllib.request import urlo... | Automatic extractive Text Summarization using RoBERTa/Deploy Flask app/app.py | 2,003 | Web Scraping Pkg from urllib.request import urlopen Reading Time Fetch Text From Url | 84 | en | 0.503018 |
import os
import sys
import time
import shutil
import random
import subprocess
from itertools import starmap
from tempfile import mkdtemp, NamedTemporaryFile
from .. import current, FlowSpec
from ..metaflow_config import DATATOOLS_S3ROOT
from ..util import is_stringish,\
to_bytes,\
... | metaflow/datatools/s3.py | 22,915 | This object represents a path or an object in S3,
with an optional local copy.
Get or list calls return one or more of S3Objects.
Initialize a new context for S3 operations. This object is based used as
a context manager for a with statement.
There are two ways to initialize this object depending whether you want
to ... | 5,642 | en | 0.841049 |
#© 2017-2020, ETH Zurich, D-INFK, lubu@inf.ethz.ch
from rpcudp.protocol import RPCProtocol
from twisted.internet import reactor
from talosstorage.checks import QueryToken
from talosstorage.chunkdata import CloudChunk
class RPCServer(RPCProtocol):
# Any methods starting with "rpc_" are available to clients.
... | talosblockchain/global_tests/test_udprpc_server.py | 733 | © 2017-2020, ETH Zurich, D-INFK, lubu@inf.ethz.ch Any methods starting with "rpc_" are available to clients. This could return a Deferred as well. sender is (ip,port) start a server on UDP port 1234 | 198 | en | 0.898942 |
import datetime
import os
import re
from peewee import *
from playhouse.reflection import *
from .base import IS_SQLITE_OLD
from .base import ModelTestCase
from .base import TestModel
from .base import db
from .base import requires_models
from .base import requires_sqlite
from .base import skip_if
from .base_models i... | tests/reflection.py | 21,029 | Tests for is_foreign_key=False. Tests for is_foreign_key=True. There do not appear to be separate constants for the blob and text field types in MySQL's drivers. See GH1034. Re-create table using the introspected schema. Verify that the introspected schema has not changed. Re-create table using the introspected schema.... | 373 | en | 0.832393 |
#!/usr/bin/env python
import datetime
import logging
import os
import re
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# https://www2.ed.gov/about/offices/list/oig/areports.html
# Oldest report: 1995
# options:
# standard since/year options for a year range to f... | inspectors/education.py | 8,302 | !/usr/bin/env python https://www2.ed.gov/about/offices/list/oig/areports.html Oldest report: 1995 options: standard since/year options for a year range to fetch from. report_id: limit to a single report Notes for IG's web team: - Fix the row for A17C0008 on http://www2.ed.gov/about/offices/list/oig/areports2003.htm... | 1,082 | en | 0.834926 |
from combat import Combat, RecursiveCombat
with open("test_input.txt") as f:
game = Combat.parse_from_file(f)
f.seek(0)
recursive_game = RecursiveCombat.parse_from_file(f)
# 1st round
round_1 = game[1]
assert round_1.player_1==[2, 6, 3, 1, 9, 5]
assert round_1.player_2==[8, 4, 7, 10]
# 28th round
round_... | day-22/test.py | 898 | 1st round 28th round error if checking score/winner before end end recursive game | 81 | en | 0.762432 |
#!/usr/bin/env python
# Copyright 2016 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.
"""
Replaces GN files in tree with files from here that
make the build use system libraries.
"""
from __future__ import print_function... | build/linux/unbundle/replace_gn_files.py | 2,520 | Replaces GN files in tree with files from here that
make the build use system libraries.
!/usr/bin/env python Copyright 2016 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. Restore original file, and also remove the backup. Th... | 477 | en | 0.8967 |
from random import choice, randint, sample, shuffle
from ga4stpg import graph
from ga4stpg.edgeset import EdgeSet
from ga4stpg.graph import UGraph
from ga4stpg.graph.disjointsets import DisjointSets
from ga4stpg.graph.priorityqueue import PriorityQueue
class MutatitionReplaceByLowerEdge:
def __init__(s... | ga4stpg/edgeset/mutate.py | 3,313 | if len(disjoints.get_disjoint_sets()) >= 2: result.add(selected_edge) | 73 | ka | 0.144041 |
# Lint as: python2, python3
# Copyright 2019 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 req... | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | 16,031 | Kubeflow Pipelines runner.
Constructs a pipeline definition YAML file based on the TFX logical pipeline.
Runtime configuration parameters specific to execution on Kubeflow.
Creates a KubeflowDagRunnerConfig object.
The user can use pipeline_operator_funcs to apply modifications to
ContainerOps used in the pipeline. F... | 7,227 | en | 0.721316 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from refinery.units.pattern import PatternExtractor
from refinery.units import RefineryCriticalException
from refinery.lib.patterns import wallets
class xtw(PatternExtractor):
"""
Extract Wallets: Extracts anything that looks like a cryptocurrency wallet address.... | refinery/units/pattern/xtw.py | 1,019 | Extract Wallets: Extracts anything that looks like a cryptocurrency wallet address.
This works similar to the `refinery.xtp` unit.
!/usr/bin/env python3 -*- coding: utf-8 -*- | 175 | en | 0.885118 |
# pylint: disable=missing-class-docstring,missing-module-docstring
# Discord Packages
from discord.ext.commands.errors import CommandError
class NoDM(CommandError):
pass
class NoToken(Exception):
pass
| cogs/utils/my_errors.py | 213 | pylint: disable=missing-class-docstring,missing-module-docstring Discord Packages | 81 | en | 0.593245 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.