max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
examples/library-usage/querying/actions/get_actions_with_access_level.py | zscholl/policy_sentry | 1,577 | 3271670 | <filename>examples/library-usage/querying/actions/get_actions_with_access_level.py
#!/usr/bin/env python
from policy_sentry.querying.actions import get_actions_with_access_level
import json
if __name__ == '__main__':
output = get_actions_with_access_level('s3', 'Permissions management')
print(json.dumps(outp... | 0 | 0 | 0 | 0 | 0 | 0 |
database/msg/make_hall_mapping.py | atztogo/spglib | 131 | 3271745 | <gh_stars>100-1000
from transform import get_standard_hall_number
from load import get_msg_numbers, get_spg_table, get_msg_table
if __name__ == '__main__':
"""
Create magnetic_spacegroup_uni_mapping[uni_number][2] = {number of corresponding Hall numbers, the smallest Hall number}
"""
# mapping: bns_n... | 0 | 0 | 0 | 0 | 0 | 0 |
Kaggle Fisheries/fisheries_create_dataset.py | AbdullahAmer86/maskrCNN | 3,255 | 3271761 | <filename>Kaggle Fisheries/fisheries_create_dataset.py
## Kaggle Project
from __future__ import print_function
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | AngelLiang/hacking-june | 680 | 3271762 | # coding: utf-8
import june
from email.utils import parseaddr
from setuptools import setup, find_packages
kwargs = {}
try:
from babel.messages import frontend as babel
kwargs['cmdclass'] = {
'extract_messages': babel.extract_messages,
'update_catalog': babel.update_catalog,
'compile_ca... | 0 | 0 | 0 | 0 | 0 | 0 |
hyperbolic-tessellation/testing.py | dawidvdh/programmers-introduction-to-mathematics | 2,915 | 3271772 | <reponame>dawidvdh/programmers-introduction-to-mathematics
from assertpy import fail
from geometry import EPSILON
def is_close(v1, v2):
try:
return v1.is_close_to(v2)
except AttributeError:
return abs(v1 - v2) < EPSILON
def assert_are_close(v1, v2):
if not is_close(v1, v2):
fail(... | 0 | 0 | 0 | 0 | 0 | 0 |
raiwidgets/raiwidgets/interfaces.py | ms-kashyap/responsible-ai-widgets | 295 | 3271798 | # Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
class WidgetRequestResponseConstants(object):
"""Strings used to pass messages between python and javascript."""
id: str = "id"
data: str = "data"
error: str = "error"
request: str = "request"
| 0 | 0 | 4 | 0 | 4 | 0 |
src/masonite/notification/MockNotification.py | cercos/masonite | 1,816 | 3271806 | <gh_stars>1000+
from .NotificationManager import NotificationManager
from .AnonymousNotifiable import AnonymousNotifiable
from .Notification import Notification
class NotificationWithAsserts(Notification):
def assertSentVia(self, *drivers):
sent_via = self.via(self.notifiable)
for driver in driver... | 0 | 0 | 0 | 0 | 0 | 0 |
source/agent/addons/quicIO/binding.gyp | andreasunterhuber/owt-server | 890 | 3271807 | <filename>source/agent/addons/quicIO/binding.gyp
{
'targets': [{
'target_name': 'quicIO',
'sources': [
'addon.cc',
'QuicTransport.cc',
'InternalQuic.cc',
'../../../core/owt_base/MediaFramePipeline.cpp'
],
'include_dirs': [
"<!(node -e \"require('nan')\")",
'../../..... | 0 | 0 | 0 | 0 | 0 | 0 |
minemeld/comm/__init__.py | dreilly1982/minemeld-core | 147 | 3271810 | <filename>minemeld/comm/__init__.py
from __future__ import absolute_import
from .zmqredis import ZMQRedis
def factory(commclass, config):
if commclass == 'ZMQRedis':
return ZMQRedis(config)
return ZMQRedis(config)
def cleanup(commclass, config):
return ZMQRedis.cleanup(config)
| 0 | 0 | 0 | 0 | 0 | 0 |
mayan/apps/document_states/migrations/0025_alter_workflowtransitiontriggerevent_unique_together.py | bonitobonita24/Mayan-EDMS | 343 | 3271839 | <filename>mayan/apps/document_states/migrations/0025_alter_workflowtransitiontriggerevent_unique_together.py
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0008_auto_20180315_0029'),
(
'document_states',
'0024_remove_dup... | 0 | 0 | 0 | 0 | 0 | 0 |
pca/utils/compat.py | pcah/python-clean-architecture | 278 | 3271847 | from __future__ import annotations
import os
from abc import ABCMeta
from functools import (
singledispatch,
update_wrapper,
)
PY36 = (3, 6) <= os.sys.version_info < (3, 7)
PY37 = (3, 7) <= os.sys.version_info < (3, 8)
if PY36: # pragma: no cover
from typing import GenericMeta
class GenericABCMet... | 2 | 4 | 0 | 0 | 6 | 0 |
notebooks/Ch03_Processing_Wrangling_and_Visualizing_Data/read_xml.py | baoqt2/practical-machine-learning-with-python | 1,989 | 3271859 | <filename>notebooks/Ch03_Processing_Wrangling_and_Visualizing_Data/read_xml.py
# -*- coding: utf-8 -*-
"""
Created on Wed May 10 19:51:47 2017
@author: <NAME>
"""
"""
This script showcases methods to read XML type data using:
+ powerful xml library
+ xml to dict
``Execute``
$ python read_xml.py
"""... | 0 | 0 | 0 | 0 | 0 | 0 |
trench/views/__init__.py | sleeske/dev-college3 | 190 | 3271873 | <reponame>sleeske/dev-college3<gh_stars>100-1000
from trench.views.base import * # noqa
| 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/KmsBakingSalesForecastDTO.py | antopen/alipay-sdk-python-all | 213 | 3271878 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import json
from alipay.aop.api.constant.ParamConstants import *
class KmsBakingSalesForecastDTO(object):
def __init__(self):
self._forecast_date: None = None
self._forecast_level: None = None
self._sku_id: ... | 0 | 8 | 0 | 6 | 14 | 0 |
pwnlib/commandline/constgrep.py | IMULMUL/python3-pwntools | 325 | 3271886 | #!/usr/bin/env python3
import argparse
import re
import functools
from pwnlib.context import context
from pwnlib import constants
from pwnlib.asm import cpp
from pwnlib.util import safeeval
from . import common
p = argparse.ArgumentParser(
description="Looking up constants from header files.\n\nExample: constgre... | 0 | 0 | 0 | 0 | 0 | 0 |
boto3_type_annotations_with_docs/boto3_type_annotations/glue/paginator.py | cowboygneox/boto3_type_annotations | 119 | 3271892 | from typing import Dict
from typing import List
from botocore.paginate import Paginator
class GetClassifiers(Paginator):
def paginate(self, PaginationConfig: Dict = None) -> Dict:
"""
Creates an iterator that will paginate through responses from :py:meth:`Glue.Client.get_classifiers`.
See ... | 35 | 14 | 0 | 0 | 49 | 0 |
demo/stats.py | damanjitsingh/StackExchange-python- | 163 | 3271895 | <reponame>damanjitsingh/StackExchange-python-
#!/usr/bin/env python
from __future__ import print_function
# a hack so you can run it 'python demo/stats.py'
import sys
sys.path.append('.')
sys.path.append('..')
import stackexchange
so = stackexchange.Site(stackexchange.StackOverflow, impose_throttling=True)
stats = so... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/euro/serv.py | RalphWalters/thredo | 340 | 3271899 | from socket import *
import random
import time
def server(address):
sock = socket(AF_INET, SOCK_STREAM)
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
sock.bind(address)
sock.listen(5)
while True:
client, addr = sock.accept()
handler(client, addr)
def handler(client, address):
ti... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/tests/test_common.py | sandreenko/performance | 547 | 3271914 | '''
Because of how pytest finds things, all import modules must start with scripts.
'''
from scripts.performance.common import get_repo_root_path
def test_rootpath():
assert get_repo_root_path().endswith('performance') | 0 | 0 | 0 | 0 | 0 | 0 |
examples/python/rolling_ls.py | CCHiggins/statsmodels | 6,931 | 3271919 | #!/usr/bin/env python
# coding: utf-8
# DO NOT EDIT
# Autogenerated from the notebook rolling_ls.ipynb.
# Edit the notebook and then sync the output with this file.
#
# flake8: noqa
# DO NOT EDIT
# # Rolling Regression
#
# Rolling OLS applies OLS across a fixed windows of observations and then
# rolls
# (moves or sli... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/dnn/feathernet/tools/__init__.py | zongwave/libxcam | 1,439 | 3271925 | #!/usr/bin/env python3
# encoding: utf-8
# @Time : 2018/8/20 下午12:53
# @Author : yuchangqian
# @Contact : <EMAIL>
# @File : __init__.py.py
| 0 | 0 | 0 | 0 | 0 | 0 |
deprecated/interpretation/mutual_information.py | grahamwhiteuk/neutralizing-bias | 169 | 3271934 | """
get mutual information between features and bias
git add interpretation/mutual_information.py --train ../../data/v6/corpus.wordbiased.tag.train --working_dir TEST/ --checkpoint interpretation/models/inference_model_toksm_cov_4.ckpt
"""
import sys; sys.path.append('.')
from shared.args import ARGS
from shared.data ... | 0 | 1 | 0 | 0 | 1 | 0 |
application/operator/NGSI-LD-operator/scorpioOperator/main.py | jason-fox/fogflow | 102 | 3271935 | from flask import Flask, jsonify, abort, request, make_response
import requests
import json
import time
import datetime
import threading
import os
import sys
import function as fogflow
app = Flask(__name__, static_url_path='')
scorpioBrokerURL = ''
outputs = []
input = {}
scorpioIp = ''
brokerURL = ''
@app.errorh... | 0 | 0 | 0 | 0 | 0 | 0 |
ask-sdk-local-debug/ask_sdk_local_debug/config/constant_config.py | nikhilym/alexa-skills-kit-sdk-for-python | 496 | 3271939 | CONNECTION_TIMEOUT_SECONDS = 1 * 60 * 60 # Skill debug connection time to live. Set to 1 hour.
PING_INTERVAL_SECONDS = 5 * 60 # Ping duration interval set to 5 minutes.
| 0 | 0 | 0 | 0 | 0 | 0 |
alf/networks/relu_mlp_test.py | HorizonRobotics/alf | 175 | 3271940 | # Copyright (c) 2020 Horizon Robotics and ALF Contributors. 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... | 13 | 1 | 0 | 0 | 14 | 0 |
jams/sonify.py | hendriks73/jams | 135 | 3271972 | <gh_stars>100-1000
#!/usr/bin/env python
# CREATED:2015-12-12 18:20:37 by <NAME> <<EMAIL>>
r'''
Sonification
------------
.. autosummary::
:toctree: generated/
sonify
'''
from itertools import product
from collections import OrderedDict, defaultdict
import six
import numpy as np
import mir_eval.sonify
from m... | 0 | 0 | 0 | 0 | 0 | 0 |
main_ani.py | mathigatti/tree | 163 | 3271981 | <reponame>mathigatti/tree
#!/usr/bin/python
# -*- coding: utf-8 -*-
from numpy import pi
SIZE = 560
ONE = 1./SIZE
MID = 0.5
INIT_BRANCH = SIZE*0.03*ONE
GRAINS = int(SIZE*0.02)
BRANCH_DIMINISH = ONE/32
BRANCH_SPLIT_DIMINISH = 0.71
BRANCH_PROB_SCALE = 1./(INIT_BRANCH)/SIZE*20
BRANCH_SPLIT_ANGLE = 0.3*pi
BRANCH_A... | 0 | 0 | 0 | 0 | 0 | 0 |
stog/data/dataset_readers/__init__.py | sfillwo/stog | 172 | 3271989 | """
A :class:`~stog.data.dataset_readers.dataset_reader.DatasetReader`
reads a file and converts it to a collection of
:class:`~stog.data.instance.Instance` s.
The various subclasses know how to read specific filetypes
and produce datasets in the formats required by specific models.
"""
# pylint: disable=line-too-long... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/select/test_significant_change.py | MrDelik/core | 30,023 | 3272003 | <reponame>MrDelik/core
"""Test the select significant change platform."""
from homeassistant.components.select.significant_change import (
async_check_significant_change,
)
from homeassistant.core import HomeAssistant
async def test_significant_change(hass: HomeAssistant) -> None:
"""Detect select significant... | 0 | 0 | 0 | 0 | 0 | 0 |
conftest.py | swertz/dask-jobqueue | 180 | 3272016 | <filename>conftest.py
# content of conftest.py
# Make loop fixture available in all tests
from distributed.utils_test import loop # noqa: F401
import pytest
import dask_jobqueue.lsf
import dask
from dask_jobqueue import (
PBSCluster,
MoabCluster,
SLURMCluster,
SGECluster,
LSFCluster,
OARClu... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/exchange2010/test_list_events.py | tedeler/pyexchange | 128 | 3272028 |
import unittest
from pytest import raises
from httpretty import HTTPretty, httprettified
from pyexchange import Exchange2010Service
from pyexchange.connection import ExchangeNTLMAuthConnection
from pyexchange.exceptions import *
from .fixtures import *
class Test_ParseEventListResponseData(unittest.TestCase):
s... | 0 | 0 | 0 | 0 | 0 | 0 |
train.py | muchrooms/chunhu | 645 | 3272054 | <filename>train.py
from PIL import Image, ImageFont, ImageDraw
import numpy
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
def random_character():
'''
produce a random chinese character in unicode.
'''
head = random.randint(0xb0, 0xf... | 0 | 0 | 0 | 0 | 0 | 0 |
train_source.py | congw112358/pytorch-domain-adaptation | 436 | 3272056 | <reponame>congw112358/pytorch-domain-adaptation
import argparse
import numpy as np
import torch
from torch.utils.data import DataLoader
from torch.utils.data.sampler import SubsetRandomSampler
from torchvision.datasets import MNIST
from torchvision.transforms import Compose, ToTensor
from tqdm import tqdm
import conf... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_external.py | WeilerP/cellrank | 172 | 3272057 | from typing import Union, Optional
import pytest
import scanpy as sc
import cellrank.external as cre
from anndata import AnnData
from cellrank.tl.kernels import ConnectivityKernel
from cellrank.external.kernels._utils import MarkerGenes
from cellrank.external.kernels._wot_kernel import LastTimePoint
import numpy as ... | 28 | 0 | 0 | 0 | 28 | 0 |
zulipterminal/urwid_types.py | zee-bit/zulip-terminal | 407 | 3272077 | from typing import Tuple, Union
urwid_Fixed = Tuple[()]
urwid_Flow = Tuple[int]
urwid_Box = Tuple[int, int]
urwid_Size = Union[urwid_Fixed, urwid_Flow, urwid_Box]
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/twitter_bots/train_twitter_bots.py | dantreiman/ludwig | 7,739 | 3272083 | #!/usr/bin/env python
import logging
import os
import shutil
import yaml
from ludwig.api import LudwigModel
from ludwig.datasets import twitter_bots
from ludwig.utils.fs_utils import rename
from ludwig.visualize import confusion_matrix, learning_curves
if __name__ == "__main__":
# Cleans out prior results
s... | 0 | 0 | 0 | 0 | 0 | 0 |
infrastructure/deregister_batch_job_definitions.py | AlexsLemonade/refinebio | 106 | 3272093 | <reponame>AlexsLemonade/refinebio<filename>infrastructure/deregister_batch_job_definitions.py
import os
import boto3
AWS_REGION = os.environ["AWS_REGION"]
batch = boto3.client("batch", region_name=AWS_REGION)
# TODO: stop repeating this construction everywhere. Just set it once somewhere.
JOB_DEFINITION_PREFIX = os... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/set_new_scenarios.py | yixiao1/leaderboard | 447 | 3272102 | import argparse
import json
import math
from argparse import RawTextHelpFormatter
from leaderboard.utils.checkpoint_tools import fetch_dict
import carla
import os
SCENARIO_COLOR = {
"Scenario1": [carla.Color(255, 0, 0), "Red"], # Red
"Scenario2": [carla.Color(0, 255, 0), "Green"], # Green
"Sc... | 0 | 0 | 0 | 0 | 0 | 0 |
Python3/160.py | rakhi2001/ecom7 | 854 | 3272110 | <reponame>rakhi2001/ecom7
__________________________________________________________________________________________________
sample 160 ms submission
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
... | 0 | 0 | 0 | 0 | 0 | 0 |
mpBuild/common/lib/bmp280.py | devshop2019/mixlyTest | 118 | 3272137 | <reponame>devshop2019/mixlyTest
from ustruct import unpack as unp
import utime
from machine import Pin, I2C
# Author <NAME> <EMAIL>
# Power Modes
NORMAL = 0
BMP280_TEMP_OS_SKIP = 0
BMP280_TEMP_OS_1 = 1
BMP280_TEMP_OS_2 = 2
BMP280_TEMP_OS_4 = 3
BMP280_TEMP_OS_8 = 4
BMP280_TEMP_OS_16 = 5
BMP280_PRES_OS_SKIP = 0
BMP280... | 0 | 0 | 0 | 0 | 0 | 0 |
Python3/1165.py | rakhi2001/ecom7 | 854 | 3272148 | __________________________________________________________________________________________________
class Solution:
def calculateTime(self, keyboard: str, word: str) -> int:
pos = 0
ans = 0
for ch in word:
cur = keyboard.find(ch)
ans += abs(cur - pos)
pos =... | 2 | 1 | 0 | 0 | 3 | 0 |
setup.py | jingmouren/OptimalPortfolio | 279 | 3272161 | from setuptools import setup, find_packages
setup(
name='OptimalPortfolio',
version='0.0.1',
packages=find_packages(),
url='https://github.com/VivekPa/OptimalPortfolio',
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
description='Portfolio Optimisation and Analytics Library',
... | 0 | 0 | 0 | 0 | 0 | 0 |
PhysicsTools/Utilities/python/pileupFilter_cff.py | ckamtsikis/cmssw | 852 | 3272192 | import FWCore.ParameterSet.Config as cms
from PhysicsTools.Utilities.pileupFilter_cfi import *
pileupFilter.pileupInfoSummaryInputTag = cms.InputTag("addPileupInfo")
pu20to25 = pileupFilter.clone()
pu20to25.minPU = cms.double(20)
pu20to25.maxPU = cms.double(25)
pu25to30 = pileupFilter.clone()
pu25to30.minPU = cms.d... | 0 | 0 | 0 | 0 | 0 | 0 |
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/__init__.py | scott-the-programmer/pulumi | 12,004 | 3272207 | # coding=utf-8
# *** WARNING: this file was generated by test. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from . import _utilities
import typing
# Export this package's modules as members:
from .provider import *
from ._inputs import *
from . import outputs
# Make subpackages... | 0 | 0 | 0 | 0 | 0 | 0 |
proteinbert/finetuning.py | akriot/protein_bert | 124 | 3272297 | <filename>proteinbert/finetuning.py<gh_stars>100-1000
import numpy as np
import pandas as pd
from .shared_utils.util import log
from .tokenization import ADDED_TOKENS_PER_SEQ
class OutputType:
def __init__(self, is_seq, output_type):
self.is_seq = is_seq
self.output_type = output_type
... | 0 | 0 | 0 | 0 | 0 | 0 |
routeros_api/api_communicator/exception_decorator.py | davidc/RouterOS-api | 183 | 3272306 | from routeros_api import exceptions
class ExceptionAwareApiCommunicator(object):
def __init__(self, inner):
self.inner = inner
self.exception_handlers: list[object] = []
def send(self, *args, **kwargs) -> object:
try:
return self.inner.send(*args, **kwargs)
except ... | 0 | 2 | 0 | 1 | 3 | 0 |
res/TensorFlowTests/NET_0003/test.py | juitem/ONE | 255 | 3272360 | <gh_stars>100-1000
# TF_SMALL_NET_0003/test.pbtxt is create with below script
# Version info
# - Tensorflow : 1.13.1
# - Python : 3.5.2
import tensorflow as tf
input0 = tf.placeholder(tf.float32, [1, 3, 3, 5])
filter0 = tf.constant(1.0, shape=[2, 2, 5, 1])
conv = tf.nn.conv2d(input0, filter=filter0, strides=[1, 1,... | 0 | 0 | 0 | 0 | 0 | 0 |
datar/dplyr/relocate.py | stjordanis/datar | 110 | 3272384 | """Relocate columns"""
from typing import Any, Union
from pandas import DataFrame
from pipda import register_verb
from pipda.utils import CallingEnvs
from ..core.contexts import Context
from ..base import setdiff, union
from .group_data import group_vars
from .select import _eval_select
@register_verb(DataFrame, co... | 6 | 1 | 0 | 0 | 7 | 0 |
tests/nightly/dist_device_sync_kvstore_horovod.py | grygielski/incubator-mxnet | 211 | 3272389 | <filename>tests/nightly/dist_device_sync_kvstore_horovod.py
#!/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 f... | 0 | 0 | 0 | 0 | 0 | 0 |
api.py | chenmychou/TB-Crawler | 128 | 3272397 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by Em on 2018/1/9
import requests
from config import *
SERVER_HOST = 'http://xxxxx'
LOCAL_HOST = 'http://xxxxx'
# 爬取地址
API_CRAWLER_ADDRESS = '/api/import/xxxxx'
# 分类
API_CATEGORY = '/api/import/xxxxx'
# 店铺
API_STORE = '/api/import/xxxxx'
# 商品
API_PRODUCT = '/a... | 0 | 0 | 0 | 0 | 0 | 0 |
atlas/foundations_core_rest_api_components/src/test/v1/controllers/test_projects_controller.py | DeepLearnI/atlas | 296 | 3272429 |
from __future__ import annotations
import unittest
from mock import patch
from foundations_core_rest_api_components.v1.controllers.projects_controller import ProjectsController
class TestProjectsController(unittest.TestCase):
@patch('foundations_core_rest_api_components.v1.models.project.Project.all')
def t... | 0 | 2 | 0 | 0 | 2 | 0 |
lib/ansiblereview/examples/lint-rules/LineTooLongRule.py | tonyskidmore/ansible-review | 222 | 3272440 | <reponame>tonyskidmore/ansible-review
from ansiblelint import AnsibleLintRule
class LineTooLongRule(AnsibleLintRule):
id = 'EXTRA0006'
shortdesc = 'Lines should be no longer than 100 chars'
description = 'Long lines make code harder to read and ' \
'code review more difficult'
tags =... | 0 | 0 | 0 | 0 | 0 | 0 |
src/base/xsrf_test.py | justingrayston/gae-secure-scaffold-python | 163 | 3272450 | # Copyright 2014 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
BlueGecko/Python3/bglib.py | jrowberg/bglib | 145 | 3272499 | <gh_stars>100-1000
#!/usr/bin/env python
""" Blue Gecko BGAPI/BGLib implementation
Changelog:
2020-08-03 - Ported to Blue Gecko (Kris Young)
2017-06-26 - Moved to python3
2013-05-04 - Fixed single-item struct.unpack returns (@zwasson on Github)
2013-04-28 - Fixed numerous uint8array/bd_addr command ar... | 0 | 0 | 0 | 0 | 0 | 0 |
test/run/t528.py | timmartin/skulpt | 2,671 | 3272547 | print { 1: 4, 1.0: 5 } | 0 | 0 | 0 | 0 | 0 | 0 |
migrations/versions/5fec5f5e8a5e_add_post_direct_and_account_policy_keep_.py | RobbiNespu/forget | 157 | 3272560 | <gh_stars>100-1000
"""add post.direct and account.policy_keep_direct
Revision ID: 5<PASSWORD>e
Revises: 8993e80e7aa3
Create Date: 2017-08-20 18:16:26.682744
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5<PASSWORD>'
down_revision = '8993e80e7aa3'
branch_labe... | 0 | 0 | 0 | 0 | 0 | 0 |
clist/migrations/0049_auto_20200731_2037.py | horacexd/clist | 166 | 3272582 | <reponame>horacexd/clist
# Generated by Django 2.2.13 on 2020-07-31 20:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('clist', '0048_problem_time'),
]
operations = [
migrations.AlterField(
model_name='problem',
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_800_hook_http.py | manatlan/guy | 194 | 3272586 | from guy import Guy,http
@http(r"/item/(\d+)")
def getItem(web,number):
web.write( "item %s"%number )
def test_hook_with_classic_fetch(runner):
class T(Guy):
__doc__="""Hello
<script>
async function testHook() {
var r=await window.fetch("/item/42")
return await ... | 0 | 0 | 0 | 0 | 0 | 0 |
talks/bosc2013_bcbio_nextgen/build.py | bgruening/bcbb | 339 | 3272597 | <reponame>bgruening/bcbb<filename>talks/bosc2013_bcbio_nextgen/build.py
"""Convert IPython notebook into HTML reveal.js slides.
Overrides some standard functionality:
- Uses a local reveal.js with customized CSS.
- Avoids writing out the standard IPython reveal CSS overrides in favor of the default style.
"""
from... | 0 | 0 | 0 | 0 | 0 | 0 |
beartype/_util/func/utilfunccodeobj.py | vcokltfre/beartype | 1,056 | 3272604 | #!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2021 Beartype authors.
# See "LICENSE" for further details.
'''
Project-wide **callable code object** utilities.
This private submodule implements utility functions dynamically introspecting
**c... | 7 | 4 | 0 | 0 | 11 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractBcnovelsCom.py | fake-name/ReadableWebProxy | 193 | 3272618 | <gh_stars>100-1000
def extractBcnovelsCom(item):
'''
Parser for 'bcnovels.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
if 'Manga' in item['tags']:
return None
tagmap = [
('When the Protagonist ... | 0 | 0 | 0 | 0 | 0 | 0 |
leo/external/npyscreen/utilNotify.py | ATikhonov2/leo-editor | 1,550 | 3272647 | <reponame>ATikhonov2/leo-editor<filename>leo/external/npyscreen/utilNotify.py
#@+leo-ver=5-thin
#@+node:ekr.20170428084207.464: * @file ../external/npyscreen/utilNotify.py
# pylint: disable=no-member
# type: ignore
#@+others
#@+node:ekr.20170428084207.465: ** Declarations
from . import fmPopup
from . import wgmultiline... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/update_deprecated_database_columns.py | JustinKyleJames/irods | 333 | 3272675 | import argparse
import contextlib
import irods.lib
from irods import database_connect, database_interface
from irods.configuration import IrodsConfig
#--------------------------------------
# update_deprecated_database_columns.py
#
# Several columns in R_DATA_MAIN are obsolete/no longer updated as of 4.2:
# resc_... | 0 | 4 | 0 | 0 | 4 | 0 |
REST/python/Variables/find-variable-usage.py | gdesai1234/OctopusDeploy-Api | 199 | 3272680 | <filename>REST/python/Variables/find-variable-usage.py
import json
import requests
import csv
octopus_server_uri = 'https://your.octopus.app/api'
octopus_api_key = 'API-YOURAPIKEY'
headers = {'X-Octopus-ApiKey': octopus_api_key}
def get_octopus_resource(uri):
response = requests.get(uri, headers=headers)
resp... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/modules/test_can_control.py | The-Cracker-Technology/CANToolz | 194 | 3272693 | import time
from ..utils import TestCANToolz
class TestCanControl(TestCANToolz):
def test_ecu_commands_and_firewall(self):
self.CANEngine.load_config('tests/configurations/conf_can_control.py')
self.CANEngine.start_loop()
time.sleep(1)
# Call Door - Front Driver status command.
... | 0 | 0 | 0 | 0 | 0 | 0 |
Python3/730.py | rakhi2001/ecom7 | 854 | 3272721 | <reponame>rakhi2001/ecom7
__________________________________________________________________________________________________
sample 472 ms submission
class Solution:
def countPalindromicSubsequences(self, S: str) -> int:
dp0, dp1 = [0] * len(S), [0] * len(S)
ans = 0
for i in range(len(S)):
... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/call_highs_from_python.py | WTFHCN/HiGHS | 241 | 3272775 | <gh_stars>100-1000
file = "../src/interfaces/highs_python_api.py"
exec(compile(open(file).read(), file, 'exec'))
# Problem is
#
# min 8 x_1 + 10 x_2
#
# st 2 x_1 + 2 x_2 >= 7
# 3 x_1 + 4 x_2 >= 12
# 2 x_1 + x_2 >= 6
#
# x_1 >= 0 x_2 >= 0
#
inf = 1e30
col_cost = (8.0, 10.0)
col_lower = (0.0, 0.0)
co... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/opytimizer/math/test_random.py | anukaal/opytimizer | 528 | 3272800 | <filename>tests/opytimizer/math/test_random.py
import numpy as np
from opytimizer.math import random
np.random.seed(0)
def test_generate_binary_random_number():
binary_array = random.generate_binary_random_number(5)
assert binary_array.shape == (5, )
def test_generate_exponential_random_number():
exp... | 0 | 0 | 0 | 0 | 0 | 0 |
generate/internal/generate_module_test_app.py | flamencist/browser-extensions | 102 | 3272802 | <reponame>flamencist/browser-extensions
import logging
import argparse
import shutil
import os
import json
logging.basicConfig(level=logging.DEBUG, format='[%(levelname)7s] %(asctime)s -- %(message)s')
log = logging.getLogger(__name__)
def main():
parser = argparse.ArgumentParser(description='Generate a new Forge ap... | 0 | 0 | 0 | 0 | 0 | 0 |
tpu/hptuning/resnet-hypertune/resnet/hypertune_hook.py | VanessaDo/cloudml-samples | 1,552 | 3272879 | import os
import hypertune
import tensorflow as tf
class HypertuneHook(tf.train.SessionRunHook):
def __init__(self):
self.hypertune = hypertune.HyperTune()
self.hp_metric_tag = os.environ.get('CLOUD_ML_HP_METRIC_TAG', '')
self.trial_id = os.environ.get('CLOUD_ML_TRIAL_ID', 0)
def end(... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_core_cls.py | ZacheryGuan/python-pinyin | 3,853 | 3272894 | <filename>tests/test_core_cls.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pypinyin.constants import Style
from pypinyin.core import (
Pinyin, to_fixed, handle_nopinyin, single_pinyin, phrase_pinyin)
def test_use_pre_seg_to_skip_seg():
class A(Pinyin):
def pre_seg(self, han... | 0 | 0 | 0 | 0 | 0 | 0 |
taskipy/task.py | Numerlor/taskipy | 208 | 3272950 | from taskipy.exceptions import MalformedTaskError
class Task:
def __init__(self, task_name: str, task_toml_contents: object):
self.__task_name = task_name
self.__task_command = self.__extract_task_command(task_toml_contents)
self.__task_description = self.__extract_task_description(task_to... | 5 | 7 | 0 | 0 | 12 | 0 |
xs/nn/models.py | eLeVeNnN/xshinnosuke | 290 | 3272966 | from __future__ import annotations
import nn
from optim import get_optimizer
from utils.common import GLOBAL, List, Tuple
import nn.functional as F
import nn.objectives
from utils.toolkit import ProgressBar, format_time, SummaryProfile
import time
import pickle
import utils.data as data
from collections import defaultd... | 24 | 10 | 0 | 5 | 39 | 0 |
aiida/repository/__init__.py | azadoks/aiida-core | 180 | 3272972 | <reponame>azadoks/aiida-core
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
RecoLocalMuon/CSCValidation/test/CSCVal_example_cfg.py | ckamtsikis/cmssw | 852 | 3273012 | <filename>RecoLocalMuon/CSCValidation/test/CSCVal_example_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.load("Configuration/StandardSequences/Geometry_cff")
process.load("Configuration/StandardSequences/MagneticField_cff")
process.load("Configuration/StandardSequences/FrontierC... | 0 | 0 | 0 | 0 | 0 | 0 |
notebook/os_environ_getenv.py | vhn0912/python-snippets | 174 | 3273039 | <reponame>vhn0912/python-snippets<filename>notebook/os_environ_getenv.py
import os
import subprocess
print(type(os.environ))
# <class 'os._Environ'>
# print(os.environ)
print(os.environ['LANG'])
# ja_JP.UTF-8
# print(os.environ['NEW_KEY'])
# KeyError: 'NEW_KEY'
print(os.environ.get('LANG'))
# ja_JP.UTF-8
print(os... | 0 | 0 | 0 | 0 | 0 | 0 |
pydu/list.py | fakegit/pydu | 229 | 3273057 |
from __future__ import annotations
try:
# Python 3
from collections.abc import Iterable
except ImportError:
# Python 2.7
from collections import Iterable
from pydu.compat import strbytes_types
def uniq(seq, key: object | None=None) -> object:
"""
Removes duplicate elements from a list while ... | 1 | 2 | 0 | 0 | 3 | 0 |
open/core/betterself/models/sleep_log.py | lawrendran/open | 105 | 3273060 | <reponame>lawrendran/open
from django.core.exceptions import ValidationError
from django.db.models import CharField, DateTimeField
from open.core.betterself.constants import (
INPUT_SOURCES_TUPLES,
BetterSelfResourceConstants,
)
from open.utilities.date_and_time import (
format_datetime_to_human_readable,
... | 0 | 0 | 0 | 0 | 0 | 0 |
tkinter/selenium/main.py | whitmans-max/python-examples | 140 | 3273104 | <gh_stars>100-1000
import tkinter as tk
import selenium.webdriver
# --- functions ---
def on_open():
global driver
if not driver:
driver = selenium.webdriver.Firefox()
url = e.get()
driver.get(url)
# ... rest ...
def on_close():
global driver
if driver:
drive... | 0 | 0 | 0 | 0 | 0 | 0 |
lomond/selectors.py | johnashu/dataplicity-lomond | 225 | 3273105 | <filename>lomond/selectors.py
from __future__ import unicode_literals
import select
class SelectorBase(object):
"""Abstraction for a kernel object that waits for socket data."""
def __init__(self, socket):
"""Construct with an open socket."""
self._socket = socket
def wait(self, max_byt... | 0 | 0 | 0 | 0 | 0 | 0 |
pclib/test/TestSynchronizer.py | belang/pymtl | 206 | 3273110 | #=========================================================================
# TestSynchronizer
#=========================================================================
# Every synchronizer should have a unique index starting with 0. The
# synchronizers also share a synch_table between them by reference. The
# format o... | 0 | 3 | 0 | 1 | 4 | 0 |
esphome/components/bme680_bsec/sensor.py | OttoWinter/esphomeyaml | 249 | 3273164 | <gh_stars>100-1000
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import sensor
from esphome.const import (
CONF_GAS_RESISTANCE,
CONF_HUMIDITY,
CONF_PRESSURE,
CONF_TEMPERATURE,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_TEMPERATURE... | 0 | 0 | 0 | 0 | 0 | 0 |
petridish/cust_exps_gen/util.py | Bhaskers-Blu-Org2/petridishnn | 121 | 3273169 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import argparse
import itertools
import copy
import os
import numpy as np
import anytime_models.examples.ann_app_utils as ann_app_utils
from petridish.philly.generator import SCRIPT_TEMPLATE
from petridish.app.options import (
add_app_argume... | 6 | 8 | 0 | 0 | 14 | 0 |
SimPEG/electromagnetics/natural_source/utils/ediFilesUtils.py | Prithwijit-Chak/simpeg | 358 | 3273175 | from ....utils.code_utils import deprecate_module
deprecate_module("ediFilesUtils", "edi_files_utils", "0.16.0", error=True)
from .edi_files_utils import *
| 0 | 0 | 0 | 0 | 0 | 0 |
Misc/HiveMaker/solution_1.py | gbrls/CompetitiveCode | 165 | 3273178 | <filename>Misc/HiveMaker/solution_1.py
# The idea is that except if we have less than 11 sticks where the solution is trivial
# in every other case we create as much pairs of hexagons as possible. The addition of
# two pairs provides the best solution and also return to us 3 sticks. We repeat until
# no new pairs can b... | 0 | 0 | 0 | 0 | 0 | 0 |
4 - observer pattern/lib/db.py | mickeybeurskens/betterpython | 523 | 3273191 | from hashlib import blake2b
# the 'database' of users
users = []
class User:
def __init__(self, name: str, password: str, email: str):
self.name = name
self.password = <PASSWORD>(password.encode('UTF-8')).hex<PASSWORD>()
self.email = email
self.plan = "basic"
self.reset_cod... | 0 | 0 | 0 | 0 | 0 | 0 |
test/python/transpiler/aqc/test_aqc.py | Roshan-Thomas/qiskit-terra | 1,599 | 3273300 | <filename>test/python/transpiler/aqc/test_aqc.py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LI... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/common/test_evaluation.py | Yoark/Transformer-Attention | 262 | 3273316 | <reponame>Yoark/Transformer-Attention
from torchnlp.common.evaluation import convert_iob_to_segments
from torchnlp.common.evaluation import Evaluator, Metrics, BasicMetrics, IOBMetrics
from torchnlp.common.model import Model
from torchnlp.common.hparams import HParams
import torch
class DummyModel(Model):
def lo... | 0 | 0 | 0 | 0 | 0 | 0 |
support/go-NN-master/engine/NPZ.py | sjkim04/AlphaGOZero-python-tensorflow | 325 | 3273389 | <reponame>sjkim04/AlphaGOZero-python-tensorflow
#!/usr/bin/python
import numpy as np
import random
import os
import multiprocessing
import time
class RandomizingWriter:
def __init__(self, out_dir, names, shapes, dtypes, Nperfile, buffer_len):
assert buffer_len >= Nperfile
assert len(names) == len(s... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/schema/types/test_datetime.py | TheVinhLuong102/Strawberry | 2,062 | 3273397 | import datetime
import pytest
import dateutil.tz
from graphql import GraphQLError
import strawberry
@pytest.mark.parametrize(
"typing,instance,serialized",
[
(datetime.date, datetime.date(2019, 10, 25), "2019-10-25"),
(
datetime.datetime,
datetime.datetime(2019, 10,... | 3 | 8 | 1 | 0 | 12 | 0 |
mGui/runtimeCommands.py | theodox/mGui | 105 | 3273404 | """
runtimeCommands.py
Convenience methods for binding commands or callbacks to runtimeCommand objects.
"""
import maya.cmds as cmds
import mGui.events as events
import json
import inspect
def create_proxy_command(callable_object, *args, **kwargs):
"""
generates an expression which imports... | 0 | 0 | 0 | 0 | 0 | 1 |
recipes/Python/577528_Quiz_Me_25_quizcore/recipe-577528.py | tdiprima/code | 2,023 | 3273414 | <filename>recipes/Python/577528_Quiz_Me_25_quizcore/recipe-577528.py
####################
# source/quizcore.py
####################
import random
from . import testbank
################################################################################
class UnitTest:
def __init__(self, testbank):
self.na... | 0 | 0 | 0 | 0 | 0 | 0 |
leetcode/162.find-peak-element.py | geemaple/algorithm | 177 | 3273467 | class Solution(object):
def findPeakElement(self, nums) -> object:
"""
:type nums: List[int]
:rtype: int
"""
start = 0
end = len(nums) - 1
while (start + 1 < end):
mid = start + (end - start) // 2
if (nums[mid] > n... | 0 | 1 | 0 | 0 | 1 | 0 |
Trakttv.bundle/Contents/Libraries/Shared/pyllist/__init__.py | disrupted/Trakttv.bundle | 1,346 | 3273478 | from pyllist.dllist import dllist, dllistnode
from pyllist.sllist import sllist, sllistnode
| 0 | 0 | 0 | 0 | 0 | 0 |
africastalking/__init__.py | RawPlutonium/africastalking-python | 110 | 3273512 | from . Token import TokenService
from . Application import ApplicationService
from . Airtime import AirtimeService
from . SMS import SMSService
from . Payment import PaymentService
from . Voice import VoiceService
SMS = None
Airtime = None
Payment = None
USSD = None
Voice = None
Application = None
Token = None
def i... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_average_true_range.py | kylejusticemagnuson/py-financial-indicators | 635 | 3273544 | from __future__ import absolute_import
import unittest
import numpy as np
from tests.sample_data import SampleData
from pyti import average_true_range
class TestAverageTrueRange(unittest.TestCase):
def setUp(self):
"""Create data to use for testing."""
self.close_data = SampleData().get_sample_cl... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/commands/load/test_load_report_cmd.py | Clinical-Genomics/scout | 111 | 3273559 | <reponame>Clinical-Genomics/scout<gh_stars>100-1000
# -*- coding: utf-8 -*-
import os
import tempfile
from scout.commands import cli
from scout.server.extensions import store
def test_load_gene_fusion_report_research(mock_app):
"""Test command line function that load a gene fusion research report for an existing... | 0 | 0 | 0 | 0 | 0 | 0 |
dialogue-engine/test/programytest/dialog/test_sentiment.py | cotobadesign/cotoba-agent-oss | 104 | 3273565 | """
Copyright (c) 2020 COTOBA DESIGN, Inc.
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, distri... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_cli.py | jiehuan/m2cgen | 2,161 | 3273598 | from __future__ import annotations
import io
import sys
from unittest import mock
from _pytest import capture
from m2cgen import __version__, cli
from tests.utils import verify_python_model_is_expected
def _get_mock_args(
indent: int=4,
function_name: object | None=None,
namespace: object | None=None,
... | 8 | 1 | 0 | 0 | 9 | 0 |
tools/lldb/dylan/utils.py | kryptine/opendylan | 288 | 3273603 | class InvalidBindingIdentifier(Exception):
def __init__(self, message, binding):
super(InvalidBindingIdentifier, self).__init__(message, binding)
self.binding = binding
def parse_binding(binding) -> list[object]:
parts = binding.split(':')
if len(parts) != 3:
raise InvalidBindingIdentifier('Invalid b... | 0 | 1 | 0 | 0 | 1 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.