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 |
|---|---|---|---|---|---|---|
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
#SESSION_COOKIE_SECURE = True
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
| config.py | 186 | SESSION_COOKIE_SECURE = True | 28 | es | 0.121752 |
"""
DIRBS module for utility classes and functions.
Copyright (c) 2018 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the
limitations in the disclaimer below) provided that the following conditions are m... | src/dirbs/utils.py | 27,857 | Profile a block of code and store duration.
Custom exception class to indicate the user does not have the correct roles for this job.
Custom exception class to indicate there was a problem validating the schema.
Custom JSONEncoder class which serializes dates in ISO format.
Named tuple cursor that logs to DIRBS.
Python... | 7,019 | en | 0.849367 |
import config
import pandas as pd
import pickle
import numpy as np
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import classification_report
import tensorflow as tf
from keras import Sequ... | classification/src/train.py | 10,962 | Gibt den classification-report aus Nimmt ein history-Objekt und zeichnet den loss für sowohl testing als auch training Daten. labels, title and ticks Erstellen eines Tokenizers für das LSTM Modell Laden und speichern des Tokenizers Tokenizing der Link Informationen Tokenizing der Meta Informationen Tokenizing der Titel... | 1,500 | de | 0.947908 |
"""Returns full pathname of backup directory."""
import os
import pytest
from pathlib import Path
from mklists.constants import CONFIGFILE_NAME
from mklists.returns import get_backupdir_path
def test_get_backupdir_path(tmp_path):
"""Returns backups Path named for default working directory."""
os.chdir(tmp_pa... | tests/returns/test_get_backupdir_path.py | 2,295 | Returns backups Path named for default working directory.
Returns backups Path named for specified working directory.
Returns backups Path named for specified working directory ending with slash.
Raises exception if no rootdir is found (rootdir is None).
Returns full pathname of backup directory. | 297 | en | 0.809935 |
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | timesketch/lib/datastores/elastic.py | 39,901 | Implements the datastore.
Create a Elasticsearch client.
Build Elasticsearch query for one or more document ids.
Args:
events: List of Elasticsearch document IDs.
Returns:
Elasticsearch query as a dictionary.
Build Elasticsearch query for Timesketch labels.
Args:
sketch_id: Integer of sketch primary key.... | 8,628 | en | 0.767653 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from .mininode import *
from .blockstore import BlockStore, TxStore
from .util import p2p_port
'''
This ... | qa/rpc-tests/test_framework/comptool.py | 18,661 | Outcome that expects rejection of a transaction or block.
!/usr/bin/env python3 Copyright (c) 2015-2016 The Bitcoin Core developers Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. TestNode behaves as follows: Configure with a BlockSto... | 4,734 | en | 0.893412 |
# exported from PySB model 'model'
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('Ligand', ['Receptor'])
Monomer('ParpU', ['C3A'])
Monomer('C8A', ['BidU', 'C3pro'])
Monomer('SmacM', ['BaxA'])
Monomer('BaxM', ['BidM', '... | log_complete/model_160.py | 18,818 | exported from PySB model 'model' | 32 | en | 0.742345 |
# Copyright 2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | euca2ools/commands/cloudformation/liststackresources.py | 1,847 | Copyright 2014 Eucalyptus Systems, Inc. Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following dis... | 1,292 | en | 0.883337 |
# encoding: utf-8
# ## Imports
from threading import local as __local
# Expose these as importable from the top-level `web.core` namespace.
from .application import Application
from .util import lazy
# ## Module Globals
__all__ = ['local', 'Application', 'lazy'] # Symbols exported by this package.
# This is to... | web/core/__init__.py | 424 | encoding: utf-8 Imports Expose these as importable from the top-level `web.core` namespace. Module Globals Symbols exported by this package. This is to support the web.ext.local extension, and allow for early importing of the variable. | 237 | en | 0.84951 |
import sys, os, json
version = (3,7)
assert sys.version_info >= version, "This script requires at least Python {0}.{1}".format(version[0],version[1])
# Game loop functions
def render(game,current):
''' Displays the current room '''
print('You are in the ' + game['rooms'][current]['name'])
print(game['... | main.py | 1,155 | Asks the user for input and returns a stripped, uppercase version of what they typed
Displays the current room
Process the input and update the state of the world
Game loop functions | 187 | en | 0.730608 |
import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
#print(tf.__version__)
def plot_image(i, predictions_array, true_label, img):
predictions_array, true_label, img = predictions_array[i], true_label[i], img[i]
plt.grid(False)
plt.xticks([])
plt.yticks([])
... | MNIST/mnist.py | 2,603 | print(tf.__version__) | 21 | mk | 0.086436 |
"""Test all API endpoints.
This test class exercises all client facing APIs. It is also usesful as a tool for
demonstrating how to interact with the various APIs.
"""
import json
import pytest
from expects import (be, be_above, be_above_or_equal, contain, equal, expect,
raise_error)
from flask ... | tests/api/test_all_apis.py | 9,869 | Helper function that creates (and tests creating) a collection of Clients.
Test all API endpoints.
This test class exercises all client facing APIs. It is also usesful as a tool for
demonstrating how to interact with the various APIs.
Common headers go in this dict Create users, and clients Create roles Assign clien... | 537 | en | 0.869314 |
# Copyright The PyTorch Lightning 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 i... | flash/image/embedding/vissl/transforms/utilities.py | 2,742 | MOCO collate function for VISSL integration.
Run custom collate on a single key since VISSL transforms affect only DefaultDataKeys.INPUT
Multi-crop collate function for VISSL integration.
Run custom collate on a single key since VISSL transforms affect only DefaultDataKeys.INPUT
Multi-crop collate function for VISSL ... | 987 | en | 0.797343 |
"""Abstract Base Class for posteriors over states after applying filtering/smoothing"""
from abc import ABC, abstractmethod
class FiltSmoothPosterior(ABC):
"""Posterior Distribution over States after Filtering/Smoothing"""
@abstractmethod
def __call__(self, location):
"""Evaluate the time-continu... | src/probnum/filtsmooth/filtsmoothposterior.py | 2,129 | Posterior Distribution over States after Filtering/Smoothing
Evaluate the time-continuous posterior for a given location
Parameters
----------
location : float
Location, or time, at which to evaluate the posterior.
Returns
-------
rv : `RandomVariable`
Return the corresponding index/slice of the discrete-time sol... | 1,376 | en | 0.831998 |
import logging
from typing import (
Iterable,
List,
)
from lxml import etree
from sciencebeam_parser.document.semantic_document import (
SemanticContentWrapper,
SemanticFigure,
SemanticHeading,
SemanticLabel,
SemanticParagraph,
SemanticRawEquation,
SemanticSection,
SemanticSect... | sciencebeam_parser/document/tei/section.py | 4,994 | rendered at parent level | 24 | en | 0.655194 |
import logging
import sys
from pathlib import Path
from dotenv import load_dotenv
from flask import Flask
from code_runner.extensions import db, limiter
from . import code
def create_app(config_object='code_runner.settings'):
"""Creates and returns flask app instance as well as register all the extensions and b... | code_runner/app.py | 1,625 | Configure loggers.
Creates and returns flask app instance as well as register all the extensions and blueprints
Registers the blueprints
Register environment
Register Flask extensions
Registers the pluggable views | 213 | en | 0.860433 |
#!/usr/bin/env python3
print( 'hello world' )
| hello_world.py | 47 | !/usr/bin/env python3 | 21 | fr | 0.448822 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 23 20:32:12 2018
Functions to correctly fold and bin a light curve.
Calculate the lpp metric: transform to lower dimensions, knn
Depends on class from reading in a previously created LPP metric Map
Depends on reading in the light curve to data stru... | lpp/newlpp/lppTransform.py | 8,388 | This function takes a data class with light curve info
and the mapInfo with information about the mapping to use.
It then returns a lpp metric value.
Perform the matrix transformation with LPP
Do the knn test to get a raw LPP transit metric number.
Fold and bin light curve for input to LPP metric calculation
data cont... | 2,838 | en | 0.817715 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-07-17 06:14
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('iiits', '0059_auto_20160717_0609'),
]... | iiits/migrations/0060_auto_20160717_0614.py | 720 | -*- coding: utf-8 -*- Generated by Django 1.9 on 2016-07-17 06:14 | 65 | en | 0.721973 |
""""
defines a class that maps to the JSON input format and can be used with pydantic.
"""
import json
import os
import pickle
from hashlib import md5
from typing import List, Optional
from pydantic import BaseModel
from mldc.util import NLGEvalOutput
class MetaDlgDataDialog(BaseModel):
id: Optional[str]
domain:... | mldc/data/schema.py | 4,054 | "
defines a class that maps to the JSON input format and can be used with pydantic.
convert to list for json-serializability the next few fields/functions are here to make PartitionSpec behave like a pytext ConfigBase object. This way, we can use it directly in a task config. It would be easier if we could just inher... | 541 | en | 0.850629 |
from seatable_api import Base, context
import requests
import time
import os
"""
该脚本用于从图片链接下载图片到图片列。你可以在一个文本列中记录图片的地址,然后用这个
脚本自动下载图片并上传到图片列中。
"""
###################---基本信息配置---###################
SERVER_URL = context.server_url or 'https://cloud.seatable.cn/'
API_TOKEN = context.api_token or 'cacc4249788... | examples/python/image_transfer.py | 3,759 | ---基本信息配置--- 图片的格式 包含图片链接的列名,需要是 URL 或者文本类型 用于存储图片的列名,需要是图片类型 图片上传后使用的文件名称前缀---基本信息配置--- 1. 创建 base 对象并且认证 2. 获取行信息, 数据结构--列表嵌套字典3. 遍历每一行,获取‘图片链接‘列的信息若无图片链接或者img列有数据的话跳过,防止重复添加通过url链接获取文件扩展名通过uuid对下载的文件进行重命名 IMG_NAME_PRE + 时间戳 + 扩展名下载文件文件上传上传完成之后删除发现异常打印行数等信息方便回查 | 264 | zh | 0.988975 |
import os as _os
from glob import glob as _glob
import functools as _functools
from concurrent.futures import ProcessPoolExecutor as _Executor
import tempfile as _tempfile
from six import string_types as _string_types
import tqdm as _tqdm
# expose these two exceptions as part of the API. Everything else should feed ... | src/conda_package_handling/api.py | 6,846 | For the new pkg format, we return the size and hashes of the inner pkg part of the file
expose these two exceptions as part of the API. Everything else should feed into these. NOQA NOQA don't leave broken files around | 220 | en | 0.902269 |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 4 16:39:50 2013
@author: Xiaoxuan Jia
"""
import json
import csv
import re
import scipy.io
import scipy.stats
import random
import numpy as np
import os
import itertools
import cPickle as pk
import pymongo
import scipy
from scipy.stats import norm
import matplotlib.pyplo... | code/learningutil.py | 28,030 | Created on Thu Oct 4 16:39:50 2013
@author: Xiaoxuan Jia
-*- coding: utf-8 -*- H = hit/(hit+miss) F = False alarm/(false alarm+correct rejection)have problem when called by module name, artificially change to n by 5 matrix H = target diagnal/target column delete the target columnif H == 1: H = 1-1/(2*sum(CF[0][:,... | 3,372 | en | 0.808501 |
# -*- coding: utf-8 -*-
# IFD.A-8 :: Версия: 1 :: Проверка ввода невалидного значения в поле "код IATA" для выбора аэропорта
# Шаг 1
def test_check_invalid_value_IATA_to_select_airport(app):
app.session.enter_login(username="test")
app.session.enter_password(password="1245")
app.airport.open_form_add_airpo... | test/test_check_invalid_value_IATA_code.py | 1,130 | -*- coding: utf-8 -*- IFD.A-8 :: Версия: 1 :: Проверка ввода невалидного значения в поле "код IATA" для выбора аэропорта Шаг 1 IFD.A-8 :: Версия: 1 :: Проверка ввода невалидного значения в поле "код IATA" для выбора аэропорта Шаг 2 | 231 | ru | 0.94779 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import logging
import multiprocessing as mp
import numpy as np
import os
import torch
from detectron2.config import get_cfg
from detectron2.data import MetadataCatalog
from detectron2.da... | demo/demo.py | 8,075 | Args:
cfg (CfgNode):
vis_highest_scoring (bool): If set to True visualizes only
the highest scoring prediction
Args:
image (np.ndarray): an image of shape (H, W, C) (in BGR order).
This is the format used by OpenCV.
focal_length (float): the focal_length of the im... | 820 | en | 0.711004 |
#coding=utf-8
#author@alingse
#2016.06.21
hdfs_schema = 'hdfs://'
file_schema = 'file://'
class hdfsCluster(object):
""" 一个hdfs 资源 hdfs uri,path,账户密码认证
"""
def __init__(self,host,port=9000,schema=hdfs_schema):
""" 目前只需要host和port """
self.host = host
self.port = port
self.... | hdfshell/cluster.py | 1,322 | 一个hdfs 资源 hdfs uri,path,账户密码认证
目前只需要host和port
返回当前路径
返回 uri 的 head
coding=utf-8author@alingse2016.06.21 | 110 | zh | 0.846039 |
#!/usr/bin/env python
import click
from ..log import get_logger, verbosity_option
from . import bdt
logger = get_logger(__name__)
@click.command(
epilog="""\b
Examples:
bdt gitlab update-bob -vv
bdt gitlab update-bob -vv --stable
"""
)
@click.option(
"--stable/--beta",
help="To use the stable ... | bob/devtools/scripts/update_bob.py | 3,017 | Updates the Bob meta package with new packages.
!/usr/bin/env python download order.txt form nightlies and get the list of packages find the list of public packages determine package visibility if requires stable versions, add latest tag versions to the names modify conda/meta.yaml and requirements.txt in bob/bob | 315 | en | 0.602838 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | airflow/contrib/sensors/emr_base_sensor.py | 2,221 | Contains general sensor behavior for EMR.
Subclasses should implement get_emr_response() and state_from_response() methods.
Subclasses should also implement NON_TERMINAL_STATES and FAILED_STATE constants.
-*- coding: utf-8 -*- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agre... | 981 | en | 0.868648 |
from DejaVu.IndexedPolygons import IndexedPolygons
from Volume.Grid3D import Grid3D
class ClipMeshWithMask:
"""Clip method of this class takes a mesh i.e. IndexedPolgons and
selects all vertices which fall onto voxel witha true value in a mask grid.
It returns a new IndexedPolygons geometry with the triangles for... | resources/mgltools_x86_64Linux2_1.5.6/MGLToolsPckgs/Volume/Operators/clip.py | 2,073 | Clip method of this class takes a mesh i.e. IndexedPolgons and
selects all vertices which fall onto voxel witha true value in a mask grid.
It returns a new IndexedPolygons geometry with the triangles for which
3 vertices are selected.
compute the voxel on which each vertex falls array of indiced into grid for the ve... | 469 | en | 0.880596 |
################################################################################
# CSE 151B: Programming Assignment 4
# Code snippet by Ajit Kumar, Savyasachi
# Updated by Rohin
# Winter 2022
################################################################################
from experiment import Experiment
import sys
... | main.py | 709 | CSE 151B: Programming Assignment 4 Code snippet by Ajit Kumar, Savyasachi Updated by Rohin Winter 2022 Main Driver for your code. Either run `python main.py` which will run the experiment with default config or specify the configuration by running `python main.py custom` | 271 | en | 0.767103 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-02-12 11:43
from __future__ import unicode_literals
import core.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0040_page_draft_title'),... | great_international/migrations/0005_internationalukhqpages.py | 1,158 | -*- coding: utf-8 -*- Generated by Django 1.11.18 on 2019-02-12 11:43 | 69 | en | 0.568029 |
"""
Test what happens if Python was built without SSL
* Everything that does not involve HTTPS should still work
* HTTPS requests must fail with an error that points at the ssl module
"""
import sys
import unittest
class ImportBlocker(object):
"""
Block Imports
To be placed on ``sys.meta_path``. This e... | search_on_tablestore_and_elasticsearch/web/flask/ots/python/pymodules/urllib3-1.11/test/test_no_ssl.py | 2,369 | Block Imports
To be placed on ``sys.meta_path``. This ensures that the modules
specified cannot be imported, even if they are a builtin.
Stashes away previously imported modules
If we reimport a module the data from coverage is lost, so we reuse the old
modules
Test what happens if Python was built without SSL
* Eve... | 561 | en | 0.849083 |
# -*- coding: utf-8 -*-
import os
import io
import json
import shutil
import six
import zipfile
from .. import base
from girder.constants import AccessType
from girder.models.assetstore import Assetstore
from girder.models.folder import Folder
from girder.models.item import Item
from girder.models.token import Token
... | tests/cases/item_test.py | 33,180 | Downloads a single-file item from the server
:param item: The item to download.
:type item: dict
:param contents: The expected contents.
:type contents: str
Uploads a non-empty file to the server.
We make sure a cookie is sufficient for authentication for the item
download endpoint. Also, while we're at it, we make sur... | 3,886 | en | 0.883291 |
## -------------------------------------------------------- ##
# Trab 2 IA 2019-2
#
# Rafael Belmock Pedruzzi
#
# probOneR.py: implementation of the probabilistic OneR classifier.
#
# Python version: 3.7.4
## -------------------------------------------------------- ##
import numpy as np
from sklearn.base impor... | trab2/probOneR.py | 2,869 | -------------------------------------------------------- Trab 2 IA 2019-2 Rafael Belmock Pedruzzi probOneR.py: implementation of the probabilistic OneR classifier. Python version: 3.7.4 -------------------------------------------------------- check that x and y have correct shape store the classes seen during... | 909 | en | 0.643774 |
#!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License");... | ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py | 1,573 | Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file... | 777 | en | 0.872181 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | ernie/classification/service/client.py | 4,663 | Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agree... | 592 | en | 0.859942 |
"""
Functions computing the signal shapes
"""
import numpy as np
from time import time
import src.constants as const
def subtract_signal(t, signal, fit_params=3):
"""
Returns the subtracted signal
"""
# fit dphi(t) to polynomials and subtract the contribution from n=0, 1 and 2
coef = np.p... | src/signals.py | 9,165 | Returns the phase shift due to the Doppler delay for subhalos of mass, mass
TODO: add use_closest option
Compute dphi but in chunks over the subhalos, use when Nt x N is too large an array to
store in memory
Compute dphi but in chunks over the subhalos, use when Nt x N is too large an array to
store in memory
Returns ... | 871 | en | 0.774415 |
"""Archive Tests
Copyright 2015 Archive Analytics Solutions - University of Liverpool
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... | indigo-web/archive/tests.py | 673 | Archive Tests
Copyright 2015 Archive Analytics Solutions - University of Liverpool
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... | 630 | en | 0.856954 |
from ... import exc
from ... import util
from ...sql.base import _exclusive_against
from ...sql.base import _generative
from ...sql.base import ColumnCollection
from ...sql.dml import Insert as StandardInsert
from ...sql.elements import ClauseElement
from ...sql.expression import alias
from ...util.langhelpers import p... | virtual/lib/python3.8/site-packages/sqlalchemy/dialects/mysql/dml.py | 6,208 | MySQL-specific implementation of INSERT.
Adds methods for MySQL-specific syntaxes such as ON DUPLICATE KEY UPDATE.
The :class:`~.mysql.Insert` object is created using the
:func:`sqlalchemy.dialects.mysql.insert` function.
.. versionadded:: 1.2
Provide the "inserted" namespace for an ON DUPLICATE KEY UPDATE statement... | 3,115 | en | 0.563438 |
import json
import unittest
from bitmovin import Bitmovin, Response, TextFilter, Font
from bitmovin.errors import BitmovinApiError
from tests.bitmovin import BitmovinTestCase
class TextFilterTests(BitmovinTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
@classmethod
def tea... | tests/bitmovin/services/filters/text_filter_tests.py | 6,867 | :param first: TextFilter
:param second: TextFilter
:return: bool | 64 | en | 0.310434 |
# -*- coding: utf-8 -*-
# noqa: B950
import logging
from collections import Counter
import tqdm
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from detectron2.data import build_detection_test_loader
from detectron2.engine import default_argument_parser
from detectron2.mo... | tools/analyze_model.py | 3,216 | -*- coding: utf-8 -*- noqa: B950 noqa noqa | 42 | en | 0.374063 |
# Copyright Bruno da Silva de Oliveira 2003. Use, modification and
# distribution is subject to the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
| origin/libs/python/pyste/src/Pyste/__init__.py | 239 | Copyright Bruno da Silva de Oliveira 2003. Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | 222 | en | 0.741836 |
#!/usr/bin/env python
# Demonstration GET users/search
# See https://dev.twitter.com/rest/reference/get/users/search
from secret import twitter_instance
tw = twitter_instance()
response = tw.users.search(
q='bot',
page=0,
count=20,
include_entities=False)
for i in response:
print('''
{screen_na... | source/_sample/ptt/users-search.py | 489 | !/usr/bin/env python Demonstration GET users/search See https://dev.twitter.com/rest/reference/get/users/search | 111 | en | 0.43083 |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_tabular.pd.ipynb (unless otherwise specified).
__all__ = ['PartDep']
# Cell
from fastai.tabular.all import *
from .core import *
# Cell
from plotnine import *
# Cell
from IPython.display import clear_output
# Cell
class PartDep(Interpret):
"""
Calculate Pa... | fastinference/tabular/pd.py | 17,699 | Calculate Partial Dependence. Countinious vars are divided into buckets and are analized as well
Fields is a list of lists of what columns we want to test. The inner items are treated as connected fields.
For ex. fields = [['Store','StoreType']] mean that Store and StoreType is treated as one entity
(it's values are su... | 4,390 | en | 0.906866 |
# -*- coding: utf-8 -*-
from django.shortcuts import render
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.throttling import ScopedRateThrottle
from rest_framework.views import APIView
from rest_framework.status import HTTP_200_OK, HTTP_400_BAD_REQUEST
from rest_framework.response imp... | Backend/judgestatus/views.py | 5,871 | -*- coding: utf-8 -*- 封榜特判 注意这里只是临时这么写!如果OJ使用的人多!这里会有性能问题!! 这里有bug,不应该在queryset里写filter。时间会提前算好,导致不准确 | 101 | zh | 0.970549 |
#Neural Networks
#MLP classifier is optimal algorithm for classifications
from sklearn.neural_network import MLPClassifier
clf = MLPClassifier(solver='lbfgs', alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1)
clf.fit(X_train_clean, y_train)
clf.predict(X_test_clean)
scoreN = clf.score(X_test_clean, y_test)
prin... | models/model_NN.py | 329 | Neural NetworksMLP classifier is optimal algorithm for classifications | 70 | en | 0.83492 |
"""common logic for all queries"""
import json
from functools import partial, singledispatch
from operator import itemgetter
import snug
from gentools import (compose, map_yield, map_send, oneyield, reusable,
map_return)
from .load import registry
API_URL = 'https://slack.com/api/'
class ApiE... | examples/slack/query.py | 2,105 | parse the response body as JSON, raise on errors
decorator factory for json POST queries
decorator factory for retrieval queries from query params
common logic for all queries | 175 | en | 0.83418 |
#!/usr/bin/env python3
# Data schema:
# (start) (12b junk) artist (5* byte) (1b junk) title (col) (1b junk) date and time (col) (1b junk) url (urldur) duration (col) (1b junk) thumbnail url (end)
keybytes = {
"row_start": "80 09 80 00 80", # row start
"col": "5F 10", # column delimeter
"urldur": "58", # u... | playlist_parser.py | 1,291 | !/usr/bin/env python3 Data schema: (start) (12b junk) artist (5* byte) (1b junk) title (col) (1b junk) date and time (col) (1b junk) url (urldur) duration (col) (1b junk) thumbnail url (end) row start column delimeter url/duration delimeter row end convert hex to bytes cut off everything after the row end cut off junk ... | 325 | en | 0.42237 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
# 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 applic... | python/paddle/fluid/layers/detection.py | 174,992 | :alias_main: paddle.nn.functional.anchor_generator
:alias: paddle.nn.functional.anchor_generator,paddle.nn.functional.vision.anchor_generator
:old_api: paddle.fluid.layers.anchor_generator
**Anchor generator operator**
Generate anchors for Faster RCNN algorithm.
Each position of the input produce N anchors, N... | 112,188 | en | 0.701008 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Charts about the national vaccines data.
@author: riccardomaldini
"""
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
from data_extractors.vaccines_regions import benchmark_dict, marche_df
from data_extractors.vaccines_italy import italy_df
from data... | chart-generation/charts/vaccines.py | 5,076 | Administration data about Italy.
Administration data about Italy.
Computes and plots relations between the population of a place and people that took the second shot.
Comparation between doses administrated in various regions
Charts about the national vaccines data.
@author: riccardomaldini
!/usr/bin/env python3 -*- c... | 475 | en | 0.782426 |
#!/usr/bin/env python
"""Create two randomly generated matrices, of the specified sizes and write them
to JSON files.
"""
import json
import numpy as np
def read(path):
with open(path, 'rb') as f:
matrix = np.fromfile(f, dtype=np.float32)
return matrix
def write(path, matrix):
with open(path, 'wb') as f:
... | android/platforms/android/assets/www/web/node_modules/weblas/test/data/binary_matrix.py | 382 | Create two randomly generated matrices, of the specified sizes and write them
to JSON files.
!/usr/bin/env python | 114 | en | 0.580681 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | parl/remote/tests/cluster_test.py | 3,981 | Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agree... | 688 | en | 0.83132 |
'''
lanhuage: python
Descripttion:
version: beta
Author: xiaoshuyui
Date: 2020-07-10 10:33:39
LastEditors: xiaoshuyui
LastEditTime: 2021-01-05 10:21:49
'''
import glob
import os
from tqdm import tqdm
from convertmask.utils.methods import getMultiShapes
from convertmask.utils.methods.logger import logger
def getJs... | convertmask/utils/mask2json_script.py | 2,282 | imgPath: origin image path
maskPath : mask image path
savePath : json file save path
>>> getJsons(path-to-your-imgs,path-to-your-maskimgs,path-to-your-jsonfiles)
lanhuage: python
Descripttion:
version: beta
Author: xiaoshuyui
Date: 2020-07-10 10:33:39
LastEditors: xiaoshuyui
LastEditTime: 2021-01-05 10:21:49
... | 338 | en | 0.623211 |
from collections import namedtuple
Vote = namedtuple('Vote', 'user post vote')
def create_vote(vote_dict, cutoff):
"""
changes the vote to the [-1, 1] range
"""
modified_vote = 1 if float(vote_dict['vote']) > cutoff else -1
return Vote(
user=str(vote_dict['user']),
post=str(vote_d... | kiwi-content/kiwi/TransferTypes.py | 367 | changes the vote to the [-1, 1] range | 37 | en | 0.762016 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
from nose.plugins.attrib import attr
import hgvs.dataproviders.uta
import hgvs.location
import hgvs.parser
from hgvs.exceptions import HGVSError
from hgvs.transcriptmapper import TranscriptMapp... | tests/test_hgvs_transcriptmapper.py | 23,928 | NM_033445.2: LCE3C single exon, strand = -1, all coordinate input/output are in HGVS
NM_014357.4: LCE2B, two exons, strand = +1, all coordinate input/output are in HGVS
NM_178434.2: LCE3C single exon, strand = +1, all coordinate input/output are in HGVS
Use NM_178434.2 tests to test mapping with uncertain positions
NM_... | 13,784 | en | 0.317898 |
from django.test import TestCase
from django.contrib.sites.models import Site
from django.utils import unittest
from django.conf import settings
from .factories import GalleryFactory, PhotoFactory
class SitesTest(TestCase):
urls = 'photologue.tests.test_urls'
def setUp(self):
"""
Create two... | photologue/tests/test_sites.py | 5,750 | Create two example sites that we can use to test what gets displayed
where.
Objects should not be automatically associated with a particular site when
``PHOTOLOGUE_MULTISITE`` is ``True``.
See if objects were added automatically (by the factory) to the current site.
Only those photos are supposed to be shown in a gall... | 703 | en | 0.91365 |
# -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""Test the decompose pass"""
from sympy import pi
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
fr... | test/python/transpiler/test_decompose.py | 2,726 | Tests the decompose pass.
Test decompose a single H into u2.
Test decompose a 1-qubit gates with a conditional.
Test to decompose a single H, without the rest
Test decompose CCX.
Test the decompose pass
-*- coding: utf-8 -*- Copyright 2018, IBM. This source code is licensed under t... | 423 | en | 0.84139 |
"""
ASGI config for animeDjangoApp project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANG... | animeDjangoApp/asgi.py | 405 | ASGI config for animeDjangoApp project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ | 220 | en | 0.676117 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: service_method_same_name.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 message as _message
from google.protobuf import ref... | internal/twirptest/service_method_same_name/service_method_same_name_pb2.py | 2,077 | Generated by the protocol buffer compiler. DO NOT EDIT! source: service_method_same_name.proto @@protoc_insertion_point(imports) @@protoc_insertion_point(class_scope:Msg) @@protoc_insertion_point(module_scope) | 210 | en | 0.553739 |
"""
Django settings for backend project.
Generated by 'django-admin startproject' using Django 3.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib... | backend/settings.py | 3,794 | Django settings for backend project.
Generated by 'django-admin startproject' using Django 3.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
Build paths inside ... | 981 | en | 0.697623 |
import os
import wget
import tarfile
import argparse
import subprocess
from utils import create_manifest
from tqdm import tqdm
import shutil
parser = argparse.ArgumentParser(description='Processes and downloads LibriSpeech dataset.')
parser.add_argument("--target-dir", default='LibriSpeech_dataset/', type=str, help="D... | data/librispeech.py | 5,613 | process transcript check if we want to dl this file Prune to min/max duration | 77 | en | 0.731211 |
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2017, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
"""Implements the... | code/venv/lib/python3.6/site-packages/pgadmin4/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py | 28,367 | class CheckConstraintModule(CollectionNodeModule):
This class represents The Check Constraint Module.
Methods:
-------
* __init__(*args, **kwargs)
- Initialize the Check Constraint Module.
* get_nodes(gid, sid, did, scid)
- Generate the Check Constraint collection node.
* node_inode(gid, sid, did, scid)
-... | 5,778 | en | 0.420776 |
import json
import subprocess
import ipaddress
import pytest
@pytest.fixture
def add_host():
def _inner(hostname, rack, rank, appliance):
cmd = f'stack add host {hostname} rack={rack} rank={rank} appliance={appliance}'
result = subprocess.run(cmd.split())
if result.returncode != 0:
pytest.fail('unable to ad... | test-framework/test-suites/integration/tests/fixtures/add_data.py | 9,805 | Adds a host with a network. The first network this adds defaults to pxe=True.
Adds a network to the stacki db. For historical reasons the first test network this creates is pxe=False.
Creates a fake local firmware file and returns a pathlib.Path object that points to it.
This fixture is used to run `stack load` on the ... | 2,499 | en | 0.822155 |
#!/usr/bin/python
# Copyright (c) 2018-2019 Intel Corporation
#
# 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, m... | src/rdb/tests/rdb_test_runner.py | 10,659 | !/usr/bin/python Copyright (c) 2018-2019 Intel Corporation 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, ... | 2,098 | en | 0.891118 |
"""
Self-supervised learning samplers.
"""
# Authors: Hubert Banville <hubert.jbanville@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
from . import RecordingSampler
class RelativePositioningSampler(RecordingSampler):
"""Sample examples for the relative positioning task from [Banville2020]_.
Sa... | braindecode/samplers/ssl.py | 4,282 | Sample examples for the relative positioning task from [Banville2020]_.
Sample examples as tuples of two window indices, with a label indicating
whether the windows are close or far, as defined by tau_pos and tau_neg.
Parameters
----------
metadata : pd.DataFrame
See RecordingSampler.
tau_pos : int
Size of th... | 1,835 | en | 0.698177 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# (C)Eduardo Ribeiro - 1600820
class Contract:
id = 0
school_code = 0
school_name = ""
n_contract = 0
n_hours_per_week = 0
contract_end_date = ""
application_deadline = ""
recruitment_group = ""
county = ""
district = ""
clas... | sigrhe_contract.py | 1,158 | !/usr/bin/env python3 -*- coding: utf-8 -*- (C)Eduardo Ribeiro - 1600820 | 72 | en | 0.405016 |
"""
Django settings for profiles_project project.
Generated by 'django-admin startproject' using Django 3.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
impo... | profiles_project/settings.py | 3,349 | Django settings for profiles_project project.
Generated by 'django-admin startproject' using Django 3.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
Build path... | 990 | en | 0.69694 |
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class CbtfArgonavis(CMakePackage):
"""CBTF Argo Navis project contains the CUDA collector and su... | var/spack/repos/builtin/packages/cbtf-argonavis/package.py | 4,995 | CBTF Argo Navis project contains the CUDA collector and supporting
libraries that was done as a result of a DOE SBIR grant.
Set up the compile and runtime environments for a package.
Set up the compile and runtime environments for a package.
Copyright 2013-2019 Lawrence Livermore National Security, LLC and other Spac... | 696 | en | 0.856767 |
"""SentencePiece based word tokenizer module"""
from pathlib import Path
from typing import List
import sentencepiece as spm
from urduhack.stop_words import STOP_WORDS
def _is_token(pieces: list, special_symbol: str = "▁") -> List[str]:
"""
Check for stopwords and actual words in word pieces
Args:
... | urduhack/tokenization/wtk.py | 1,756 | Check if the models file exist.
Args:
model_path (str): path to the tokenizer model file
Raises:
FileNotFoundError: If model_path does not exist
Returns: None
Check for stopwords and actual words in word pieces
Args:
pieces (list): word pieces returned by sentencepiece model
special_symbol (str): sp... | 569 | en | 0.750329 |
"""command line interface for mutation_origin"""
import os
import time
import pickle
from collections import defaultdict
import click
from tqdm import tqdm
import pandas
from numpy import log
from numpy.random import seed as np_seed
from scitrack import CachingLogger
from sklearn.model_selection import train_test_split... | mutation_origin/cli.py | 20,002 | logistic regression training, validation, dumps optimal model
mutori -- for building and applying classifiers of mutation origin
Naive Bayes training, validation, dumps optimal model
one-class svm training for outlier detection
produce measures of classifier performance
predict labels for data
creates train/test sample... | 1,151 | en | 0.812313 |
"""
My first application
"""
import toga
from toga.style import Pack
from toga.style.pack import COLUMN, ROW
class HelloWorld(toga.App):
def startup(self):
"""
Construct and show the Toga application.
Usually, you would add your application to a main content box.
We then create a... | src/helloworld/app.py | 1,427 | Construct and show the Toga application.
Usually, you would add your application to a main content box.
We then create a main window (with a name matching the app), and
show the main window.
My first application | 212 | en | 0.912014 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2015 by Gaik Tamazian
# gaik (dot) tamazian (at) gmail (dot) com
class Error(Exception):
"""
The class describes a basic error that may occur in any of the
Chromosomer-related routines.
"""
pass
class MapError(Error):
"""
The... | chromosomer/exception.py | 588 | The class describes an error that may occur while creating a
fragment __map from alignments.
The class describes a basic error that may occur in any of the
Chromosomer-related routines.
The class describes an error that may occur while working with a
fragment __map object.
!/usr/bin/env python -*- coding: utf-8 -*- Co... | 394 | en | 0.804161 |
# coding: utf-8
import os
import numpy as np
import copy
from PyQt5.QtWidgets import (QPushButton, QScrollArea)
from PyQt5.QtCore import QThread, pyqtSignal
from multiprocessing import Process, Manager
from ..malss import MALSS
from .waiting_animation import WaitingAnimation
from .rfpimp import oob_importanc... | malss/app/learning_curve.py | 6,063 | coding: utf-8 "parent.parent()" must be modified. To be modified. some features deleted no features deleted | 107 | en | 0.972022 |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Input:
_REF = "_ref"
class Output:
_REF = "_ref"
class DeleteHostInput(komand.Input):
schema = json.loads("""
{
"type": "object",
"title": "Variables",
"properties": {
"_ref": {
"type": "string",
"... | infoblox/komand_infoblox/actions/delete_host/schema.py | 961 | GENERATED BY KOMAND SDK - DO NOT EDIT | 37 | en | 0.775658 |
# coding: utf-8
from __future__ import unicode_literals
import os
import re
import sys
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..compat import (
compat_etree_fromstring,
compat_str,
compat_urllib_parse_unquote,
compat_urlparse,
compat_xml_parse_error,
)
from ..utils ... | yt_dlp/extractor/generic.py | 149,939 | Returns None if no camtasia video can be found.
Report information extraction.
coding: utf-8 Direct link to a video Direct link to media delivered compressed (until Accept-Encoding is *) Direct download with broken HEAD infinite live stream Direct link with incorrect MIME type RSS feed RSS feed with enclosure RSS fe... | 12,854 | en | 0.780254 |
'''
Source code developed by DI2AG.
Thayer School of Engineering at Dartmouth College
Authors: Dr. Eugene Santos, Jr
Mr. Chase Yakaboski,
Mr. Gregory Hyde,
Dr. Keum Joo Kim
'''
import json
import argparse
import os
import sys
import pickle
import subprocess
from chp.query impor... | chp/babel/bkb-service.py | 3,552 | Source code developed by DI2AG.
Thayer School of Engineering at Dartmouth College
Authors: Dr. Eugene Santos, Jr
Mr. Chase Yakaboski,
Mr. Gregory Hyde,
Dr. Keum Joo Kim
--Collect vars_dict from vars_file-- Consume JSON File passed by UI-- Process the passed JSON file into recogni... | 453 | en | 0.777485 |
# Proximal
import sys
sys.path.append('../../')
from proximal.utils.utils import *
from proximal.halide.halide import *
from proximal.lin_ops import *
import numpy as np
from scipy import signal
from scipy import ndimage
import matplotlib.pyplot as plt
############################################################
#... | proximal/examples/test_conv.py | 2,524 | Proximal Load image Force recompile in local dir Force recompile in local dir Test the runner Call Error Check correlation Calloutput_corr_ref = signal.convolve2d(np_img, np.flipud(np.fliplr(K)), mode='same', boundary='wrap') Adjoint. Error | 240 | en | 0.378435 |
# coding: UTF-8
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import warnings
warnings.filterwarnings("ignore")
import argparse
import numpy as np
import shutil
import PIL
import time
from imageio import imread, imsave
from googletrans import Translator
import torch
import torchvision
import torch.nn.functional as ... | illustrip.py | 18,400 | coding: UTF-8 progress bar for notebooks normal console training motion tweaks 0.04 Overriding some parameters, depending on other settings 1.7.1 1.8+ on 1.8+ also pads Load CLIP models Encode inputs if a.verbose is True: print(' translated to:', a.in_txt0) [glob]steps = for save/move, opt_steps = for optimization cy... | 618 | en | 0.550404 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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
from ... import _utilities, _tables
from... | sdk/python/pulumi_azure_nextgen/apimanagement/v20200601preview/api_operation.py | 9,981 | Api Operation details.
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the re... | 2,566 | en | 0.640209 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
平安行动自动打卡
请事先安装好 lxml 和 requests 模块
pip install lxml requests
然后修改 27-31 行为自己的数据,未使用的变量保持原样即可
如有需要请自行配置 149-171 行的 SMTP 发信或 174-177 行的 Server 酱微信提醒
Created on 2020-04-13 20:20
@author: ZhangJiawei & Liu Chongpeng & Liu Lu
"""
import requests
import lxml.html
i... | Server/checkin.py | 8,098 | 平安行动自动打卡
请事先安装好 lxml 和 requests 模块
pip install lxml requests
然后修改 27-31 行为自己的数据,未使用的变量保持原样即可
如有需要请自行配置 149-171 行的 SMTP 发信或 174-177 行的 Server 酱微信提醒
Created on 2020-04-13 20:20
@author: ZhangJiawei & Liu Chongpeng & Liu Lu
!/usr/bin/env python3 -*- coding: UTF-8 -*- mysckey = "SCKEY" 登陆校园网络认证界面 进入平安行动界面 提交平安行动表单... | 1,762 | en | 0.281167 |
# 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/jms/models/jre_usage.py | 21,334 | Java Runtime usage during a specified time period. A Java Runtime is identified by its vendor and version.
Initializes a new JreUsage object with values from keyword arguments.
The following keyword arguments are supported (corresponding to the getters/setters of this class):
:param id:
The value to assign to the ... | 11,938 | en | 0.778658 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | tests/lax_numpy_test.py | 140,061 | Tests for LAX-backed Numpy implementation.
Decorator that promotes the arguments of `fun` to `jnp.result_type(*args)`.
jnp and onp have different type promotion semantics; this decorator allows
tests make an onp reference implementation act more like an jnp
implementation.
Test the set of inputs onp.geomspace is well-... | 7,540 | en | 0.813467 |
# -*- coding: utf-8 -*-
from .. import OratorTestCase
from lorator.support.collection import Collection
class CollectionTestCase(OratorTestCase):
def test_first_returns_first_item_in_collection(self):
c = Collection(["foo", "bar"])
self.assertEqual("foo", c.first())
def test_last_returns_la... | tests/support/test_collection.py | 8,037 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
#!/usr/bin/env python
#
# Copyright (c) 2018 SAP SE
# 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
#
# ... | scripts/cinder-consistency.py | 27,184 | !/usr/bin/env python Copyright (c) 2018 SAP SE 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 a... | 4,030 | en | 0.917885 |
"""
Evrything Docs
https://dashboard.evrythng.com/documentation/api/actiontypes
"""
from evrythng import assertions, utils
field_specs = {
'datatypes': {
'name': 'str',
'customFields': 'dict',
'tags': 'dict_of_str',
'scopes': 'dict',
},
'required': ('name',),
'readonly'... | src/evrythng/entities/action_types.py | 1,787 | Create an Action Type
Delete an Action Type
List Action Types
Update an Action Type
Evrything Docs
https://dashboard.evrythng.com/documentation/api/actiontypes | 159 | en | 0.547064 |
import json
# try:
# redis_connection = redis.Redis(host='dorresteinappshub.ucsd.edu', port=6378, db=0)
# except:
# redis_connection = None
redis_connection = None
def acquire_motifdb(db_list):
db_list_key = json.dumps(db_list)
if redis_connection is not None:
if redis_connection.exists(db_li... | lda/offline_analysis/ms2lda_runfull_test.py | 2,048 | try: redis_connection = redis.Redis(host='dorresteinappshub.ucsd.edu', port=6378, db=0) except: redis_connection = None Trying to cache db_list = ['gnps_binned_005'] Can update this later with multiple motif sets db_list.append(2) db_list.append(4) db_list.append(1) db_list.append(3) db_list.append(5) db_list... | 382 | en | 0.43725 |
"""
Mapping from iana timezones to windows timezones and vice versa
"""
from datetime import tzinfo
import pytz
# noinspection SpellCheckingInspection
IANA_TO_WIN = {
"Africa/Abidjan": "Greenwich Standard Time",
"Africa/Accra": "Greenwich Standard Time",
"Africa/Addis_Ababa": "E. Africa Standard Time",
... | O365/utils/windows_tz.py | 29,985 | Returns a valid pytz TimeZone (Iana/Olson Timezones) from a given
windows TimeZone
:param windows_tz: windows format timezone usually returned by
microsoft api response
:return:
:rtype:
Returns a valid windows TimeZone from a given pytz TimeZone
(Iana/Olson Timezones)
Note: Windows Timezones are SHIT!... no ... reall... | 629 | en | 0.677821 |
# pip install freegames
# Click on screen to control ball
# import modules
from random import *
import turtle as t
from freegames import vector
# Set window title, color and icon
t.title("Flappy Ball")
root = t.Screen()._root
root.iconbitmap("logo-ico.ico")
t.bgcolor('#80ffd4')
bird = vector(0, 0)
balls = []
... | games/Flappy.py | 1,397 | pip install freegames Click on screen to control ball import modules Set window title, color and icon Functions Move bird up in response to screen tap Return True if point on screen Draw screen objects Update object positions | 225 | en | 0.630688 |
"""Base test cases for RBTools unit tests."""
from __future__ import unicode_literals
import os
import re
import shutil
import sys
import tempfile
import unittest
from contextlib import contextmanager
import six
from rbtools.utils.filesystem import cleanup_tempfiles, make_tempdir
import kgb
from rbtools.utils.file... | rbtools/testing/testcase.py | 7,565 | The base class for RBTools test cases.
This provides helpful utility functions, environment management, and
better docstrings to help craft unit tests for RBTools functionality.
All RBTools unit tests should use this this class or a subclass of it
as the base class.
Assert that two diffs are equal.
Args:
diff (by... | 3,558 | en | 0.840669 |
#!/usr/bin/env python
'''
Pull random words from http://world.std.com/~reinhold/diceware.wordlist.asc
Written 2013 Hal Canary.
Dedicated to the public domain.
'''
import random,math,sys,os
useDevRandom = True
dicewareWordlist = '~/Downloads/diceware.wordlist.asc'
with open(os.path.expanduser(dicewareWordlist)) as f:
... | RandomWords.py | 780 | Pull random words from http://world.std.com/~reinhold/diceware.wordlist.asc
Written 2013 Hal Canary.
Dedicated to the public domain.
!/usr/bin/env python | 155 | en | 0.642213 |
from django.conf.urls import url
from . import views
urlpatterns = [
# 商品列表页
url(r'^list/(?P<category_id>\d+)/(?P<page_num>\d+)/$', views.ListView.as_view(), name='list'),
# 热销排行数据
url(r'^hot/(?P<category_id>\d+)/$', views.HotGoodsView.as_view()),
# 商品详情页
url(r'^detail/(?P<sku_id>\d+)/$', view... | E_business_project/apps/goods/urls.py | 598 | 商品列表页 热销排行数据 商品详情页 统计分类商品访问量 浏览记录 | 33 | zh | 0.999546 |
import asyncio
import discord
from discord.ext import commands
from discord.commands import slash_command, Option
import wavelink
import json
from dotenv import load_dotenv
import os
load_dotenv()
# Initiate json
file = open("config.json")
data = json.load(file)
# Public variables
guildID = data["guildID"][0]
clas... | Music/play.py | 2,081 | Initiate json Public variables | 30 | en | 0.273592 |
import timeit
mapx = 512
mapy = 512
# Good seeds:
# 772855 Spaced out continents
# 15213 Tight continents
# 1238 What I've been working with, for the most part
# 374539 Sparse continents
# 99999
seed = 773202
sea_level = 0.6
DEBUG = 0
GFXDEBUG = 0
setup_time = timeit.default_timer()
tiles = [[None] * mapx for _ in ... | ginit.py | 691 | Good seeds: 772855 Spaced out continents 15213 Tight continents 1238 What I've been working with, for the most part 374539 Sparse continents 99999 9 AM | 151 | en | 0.803054 |
import sympy
import antlr4
from antlr4.error.ErrorListener import ErrorListener
from sympy.core.operations import AssocOp
try:
from gen.PSParser import PSParser
from gen.PSLexer import PSLexer
from gen.PSListener import PSListener
except Exception:
from .gen.PSParser import PSParser
from .gen.PSLex... | latex2sympy.py | 28,709 | Apply ceil() then return the ceil-ed expression.
expr: Expr - sympy expression as an argument to ceil()
Apply floor() then return the floored expression.
expr: Expr - sympy expression as an argument to floor()
Return the result of gcd() or lcm(), as UnevaluatedExpr
f: str - name of function ("gcd" or "lcm")
args: Li... | 2,426 | en | 0.423612 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_resource_skus_operations.py | 5,835 | ResourceSkusOperations 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.v2021_07_01.models
:param c... | 1,959 | en | 0.581253 |
import os
import signal
import sys
from builtins import id as identifier
from toga.command import CommandSet
from toga.handlers import wrapped_handler
from toga.icons import Icon
from toga.platform import get_platform_factory
from toga.window import Window
class MainWindow(Window):
_WINDOW_CLASS = 'MainWindow'
... | src/core/toga/app.py | 7,707 | The App is the top level of any GUI program. It is the manager of all
the other bits of the GUI app: the main window and events that window
generates like user input.
When you create an App you need to provide it a name, an id for uniqueness
(by convention, the identifier is a "reversed domain name".) and an
optional ... | 3,296 | en | 0.831589 |
# this file is deprecated and will soon be folded into all.py
from collections import namedtuple
from pycoin.serialize import h2b
NetworkValues = namedtuple('NetworkValues',
('network_name', 'subnet_name', 'code', 'wif', 'address',
'pay_to_script', 'prv32', 'pu... | pycoin/networks/legacy_networks.py | 3,640 | this file is deprecated and will soon be folded into all.py VIA viacoin mainnet : xprv/xpub VIA viacoin testnet : tprv/tpub FTC feathercoin mainnet : xprv/xpub FTC feathercoin testnet : tprv/tpub DOGE Dogecoin mainnet : dogv/dogp DOGE Dogecoin testnet : tgpv/tgub BC BlackCoin mainnet : bcpv/bcpb DRK Dash mainnet : drkv... | 678 | en | 0.339948 |
# -*- coding: utf-8 -*-
__title__ = "Universal Notifications"
__version__ = "1.5.0"
__author__ = "Pawel Krzyzaniak"
__license__ = "MIT"
__copyright__ = "Copyright 2017-2018 Arabella; 2018+ Ro"
# Version synonym
VERSION = __version__
| universal_notifications/__init__.py | 234 | -*- coding: utf-8 -*- Version synonym | 37 | en | 0.933493 |
#
# The OpenDiamond Platform for Interactive Search
#
# Copyright (c) 2009-2019 Carnegie Mellon University
# All rights reserved.
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.
# ANY USE, REPRODUCTION OR DISTRIBUTION OF T... | opendiamond/scopeserver/mirage/urls.py | 526 | The OpenDiamond Platform for Interactive Search Copyright (c) 2009-2019 Carnegie Mellon University All rights reserved. This software is distributed under the terms of the Eclipse Public License, Version 1.0 which can be found in the file named LICENSE. ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS SOFTWARE CONSTI... | 367 | en | 0.877803 |
#!/usr/bin/env python3
# Copyright (c) 2016-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test compact blocks (BIP 152).
Version 1 compact blocks are pre-segwit (txids)
Version 2 compact block... | test/functional/p2p_compactblocks.py | 39,816 | Sends a message to the node and wait for disconnect.
This is used when we want to send a message into the node that we expect
will get us disconnected, eg an invalid block.
Test compact blocks (BIP 152).
Version 1 compact blocks are pre-segwit (txids)
Version 2 compact blocks are post-segwit (wtxids)
!/usr/bin/env p... | 7,297 | en | 0.911786 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.