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 |
|---|---|---|---|---|---|---|---|---|---|---|
review_ingester.py | Purus/LaunchKitDocker | 2,341 | 3333965 | #!/usr/bin/env python2.7
#
# Copyright 2016 Cluster Labs, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_querybuilder.py | vladimarius/imapy | 269 | 3333974 | <filename>tests/test_querybuilder.py
# -*- coding: utf-8 -*-
import pytest
from imapy import (imap, mail_folder, exceptions as e)
from imapy.query_builder import Q
def test_query_builder_size_parsing():
# Byte
q = Q()
q.smaller('3')
assert '3' in q.queries
# Byte
q = Q()
q.smaller(10)
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_template_shortcodes.py | asmeurer/nikola | 1,901 | 3333999 | """Test template-based shortcodes."""
import pytest
from nikola import Nikola
def test_mixedargs(site):
test_template = """
arg1: {{ _args[0] }}
arg2: {{ _args[1] }}
kwarg1: {{ kwarg1 }}
kwarg2: {{ kwarg2 }}
"""
site.shortcode_registry["test1"] = site._make_renderfunc(test_template)
site.shortcode_regi... | 0 | 2 | 0 | 0 | 2 | 0 |
examples/example_head.py | dimanil/fast_request | 857 | 3334001 | <filename>examples/example_head.py
import faster_than_requests as requests
print(requests.head("http://httpbin.org/get")) # HTTP HEAD.
| 0 | 0 | 0 | 0 | 0 | 0 |
maths/factorial_iterative.py | NavpreetDevpuri/Python | 145,614 | 3334006 | """Factorial of a positive integer -- https://en.wikipedia.org/wiki/Factorial
"""
def factorial(number: int) -> int:
"""
Calculate the factorial of specified number (n!).
>>> import math
>>> all(factorial(i) == math.factorial(i) for i in range(20))
True
>>> factorial(0.1)
Traceback (most ... | 1 | 1 | 0 | 0 | 2 | 0 |
mayan/apps/documents/__init__.py | eshbeata/open-paperless | 2,743 | 3334017 | <reponame>eshbeata/open-paperless
from __future__ import unicode_literals
default_app_config = 'documents.apps.DocumentsApp'
| 0 | 0 | 0 | 0 | 0 | 0 |
data/transcoder_evaluation_gfg/python/MINIMUM_ROTATIONS_REQUIRED_GET_STRING.py | mxl1n/CodeGen | 241 | 3334018 | <filename>data/transcoder_evaluation_gfg/python/MINIMUM_ROTATIONS_REQUIRED_GET_STRING.py
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( str ) :
tmp = str + st... | 0 | 0 | 0 | 0 | 0 | 0 |
test/studies/amr/regressions.py | jhh67/chapel | 1,602 | 3334065 | <gh_stars>1000+
def approximatelyEqual(x,y,tolerance):
if x==y:
return True
try:
if abs(float(x) - float(y)) < tolerance:
return True
except:
return False
def approximateDiff(file_name_1, file_name_2, tolerance):
file_1 = open(file_name_1, 'r')
file_2 = open(f... | 0 | 0 | 0 | 0 | 0 | 0 |
prysm/polynomials/legendre.py | diplodocuslongus/prysm | 110 | 3334079 | <filename>prysm/polynomials/legendre.py
"""Legendre polynomials."""
from .jacobi import (
jacobi,
jacobi_sequence,
jacobi_der,
jacobi_der_sequence,
)
def legendre(n, x):
"""Legendre polynomial of order n.
Parameters
----------
n : int
order to evaluate
x : numpy.ndarray
... | 0 | 0 | 0 | 0 | 0 | 0 |
prometeo/cmdline/__init__.py | kokizzu/prometeo | 509 | 3334084 | from .pmt import *
| 0 | 0 | 0 | 0 | 0 | 0 |
mlfromscratch/naivebayes.py | USPA-Technology/MLfromscratch | 665 | 3334106 | <gh_stars>100-1000
import numpy as np
class NaiveBayes:
def fit(self, X, y):
n_samples, n_features = X.shape
self._classes = np.unique(y)
n_classes = len(self._classes)
# calculate mean, var, and prior for each class
self._mean = np.zeros((n_classes, n_features),... | 0 | 0 | 0 | 0 | 0 | 0 |
oft/model/__init__.py | tom-roddick/oft | 157 | 3334141 | <reponame>tom-roddick/oft<gh_stars>100-1000
from .oftnet import OftNet
from .loss import huber_loss, masked_l1_loss, heatmap_loss | 0 | 0 | 0 | 0 | 0 | 0 |
nodevectors/grarep.py | ashuk203/nodevectors | 313 | 3334176 | <gh_stars>100-1000
import numpy as np
from sklearn.decomposition import TruncatedSVD
import csrgraph as cg
from nodevectors.embedders import BaseNodeEmbedder
def grarep_sum_merger(x):
"""default pooling method for GraRep (summing along axes)"""
return np.sum(x, axis=0)
class GraRep(BaseNodeEmbedder):
de... | 0 | 0 | 0 | 0 | 0 | 0 |
src/compas/utilities/datetime.py | XingxinHE/compas | 235 | 3334239 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import time
import datetime
__all__ = [
'timestamp',
'now'
]
def timestamp() -> object:
"""Generate a timestamp using the current date and time.
Returns
-------
str
The time... | 0 | 2 | 0 | 0 | 2 | 0 |
Chapter_4/ch04_ex4.py | pauldevos/Mastering-Object-Oriented-Python-Second-Edition | 108 | 3334252 | #!/usr/bin/env python3.7
"""
Mastering Object-Oriented Python 2e
Code Examples for Mastering Object-Oriented Python 2nd Edition
Chapter 4. Example 4.
"""
from typing import Any, Optional
from Chapter_4.ch04_ex1 import Suit
class Card:
"""A poor replacement for polymorphism."""
def __init__(cls, rank: int,... | 12 | 7 | 0 | 0 | 19 | 0 |
benchmarks/array_slice_2dbench.py | leonardt/magma | 167 | 3334259 | import magma as m
import timeit
import pygal
def array_2d(i: int=128, j: int=128):
class Foo(m.Circuit):
io = m.IO(I=m.In(m.Array[i, m.Array[j, m.Bit]]), O=m.Out(m.Array[i, m.Array[j, m.Bit]]))
k = i // 2
io.O[:k] @= io.I[k:]
io.O[k:] @= io.I[:k]
data = {
"frontend": {},
... | 2 | 0 | 0 | 0 | 2 | 0 |
ptsites/sites/msg.py | kbnq/flexget_qbittorrent_mod | 202 | 3334276 | from ..schema.nexusphp import Visit
class MainClass(Visit):
URL: str = 'https://pt.msg.vg/'
USER_CLASSES: dict[str,list[float] | list[int]] = {
'downloaded': [1099511627776, 3298534883328],
'share_ratio': [3.55, 4.55],
'days': [420, 700]
}
| 0 | 0 | 2 | 0 | 2 | 0 |
Python/Sakha/run.py | thefool76/hacktoberfest2021 | 448 | 3334322 | <reponame>thefool76/hacktoberfest2021<gh_stars>100-1000
# import os
from Sakha import app
# from Sakha.config import DevelopmentConfig, ProductionConfig
# env = os.getenv('ENV')
# if env == 'dev': app.config.from_object(DevelopmentConfig)
# elif env == 'prod': app.config.from_object(ProductionConfig)
if... | 0 | 0 | 0 | 0 | 0 | 0 |
AV_LordOfTheMachines/build_model_xgb.py | galileoSolution/ML | 212 | 3334342 | import numpy as np
import pandas as pd
from sklearn import metrics, model_selection, ensemble, preprocessing, linear_model
import lightgbm as lgb
import xgboost as xgb
def getCountVar(compute_df, count_df, var_name, count_var="v1"):
grouped_df = count_df.groupby(var_name)[count_var].agg('count').reset_index()
groupe... | 0 | 0 | 0 | 0 | 0 | 0 |
anaconda-mode/0.1.13/parso-0.5.0-py3.7.egg/parso/python/token.py | space-scl/emacs.d | 6,989 | 3334356 | from __future__ import absolute_import
class TokenType(object):
def __init__(self, name, contains_syntax: bool=False):
self.name = name
self.contains_syntax = contains_syntax
def __repr__(self) -> object:
return '%s(%s)' % (self.__class__.__name__, self.name)
class TokenTypes(object... | 1 | 1 | 0 | 0 | 2 | 0 |
LeetCode/python3/127.py | ZintrulCre/LeetCode_Archiver | 279 | 3334371 | <reponame>ZintrulCre/LeetCode_Archiver
class Solution:
def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:
n, count = len(beginWord), 0
dict = {}
for word in wordList:
dict[word] = 1
queue = [beginWord]
size = 1
word = beginWo... | 0 | 0 | 0 | 0 | 0 | 0 |
maskrcnn_benchmark/modeling/roi_heads/ke_head/loss.py | happog/Box_Discretization_Network | 285 | 3334381 | <reponame>happog/Box_Discretization_Network<gh_stars>100-1000
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from torch.nn import functional as F
from maskrcnn_benchmark.layers import smooth_l1_loss
from maskrcnn_benchmark.modeling.matcher import Matcher
from maskrcnn_benchmark.st... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/create_config.py | paulu/opensurfaces | 137 | 3334405 | #!/usr/bin/env python2.7
#
# Sets up the scripts/config.sh file
#
import re
import os
import sys
import glob
import string
import socket
import readline
# script directory
DIR = os.path.dirname(os.path.abspath(__file__))
CONFIG_TEMPLATE = os.path.join(DIR, 'config_template.sh')
CONFIG = os.path.join(DIR, 'config.sh')... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/python/feast/importer.py | tpvasconcelos/feast | 810 | 3334410 | <gh_stars>100-1000
import importlib
from feast.errors import (
FeastClassImportError,
FeastInvalidBaseClass,
FeastModuleImportError,
)
def import_class(module_name: str, class_name: str, class_type: str = None):
"""
Dynamically loads and returns a class from a module.
Args:
module_na... | 0 | 0 | 0 | 0 | 0 | 0 |
pulumi/infra/consul_config.py | inickles/grapl | 313 | 3334429 | <filename>pulumi/infra/consul_config.py<gh_stars>100-1000
import json
from typing import Optional
import pulumi_consul as consul
import pulumi
class ConsulConfig(pulumi.ComponentResource):
"""
Consul config entries
"""
def __init__(
self,
name: str,
tracing_endpoint: str,
... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/deeplearning/sparse_training/resnet/ResNetLearner.py | breuera/libxsmm | 651 | 3334456 | from __future__ import annotations
import torch
import torchvision.models as models
from fastai2.data.external import *
from fastai2.data.transforms import *
from fastai2.data.block import *
from fastai2.vision.models.xresnet import *
from fastai2.vision.core import *
from fastai2.vision.data import *
from fastai2.vis... | 5 | 1 | 0 | 0 | 6 | 0 |
flybirds/utils/pkg_helper.py | LinuxSuRen/flybirds | 183 | 3334462 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
py ns load
"""
import importlib
import os
import pkgutil
import pkg_resources
def load_pkg_by_ns(pkg_ns):
"""
py ns load
"""
base = importlib.import_module(pkg_ns)
for loader, module_name, is_pkg in \
pkgutil.walk_packages(... | 0 | 2 | 0 | 0 | 2 | 0 |
lemur/migrations/versions/f2383bf08fbc_.py | rajatsharma94/lemur | 1,656 | 3334487 | <reponame>rajatsharma94/lemur
"""Create index on certificates table for id desc
Revision ID: <KEY>
Revises: <KEY>
Create Date: 2018-10-11 11:23:31.195471
"""
revision = "<KEY>"
down_revision = "<KEY>"
import sqlalchemy as sa
from alembic import op
def upgrade():
op.create_index(
"ix_certificates_id_d... | 0 | 0 | 0 | 0 | 0 | 0 |
two1/wallet/base_wallet.py | febuiles/two1-python | 415 | 3334516 | import decimal
satoshi_to_btc = decimal.Decimal(1e8)
btc_to_satoshi = 1 / satoshi_to_btc
def convert_to_satoshis(btc) -> object:
""" Converts an amount in BTC to satoshis.
This function takes care of rounding and quantization issues
(i.e. IEEE-754 precision/representation) and guarantees the
correc... | 0 | 3 | 1 | 0 | 4 | 0 |
e2e/cli/mount/operation/test_mkdir.py | ZMaratovna/cloud-pipeline | 126 | 3334526 | <gh_stars>100-1000
import os
import pytest
from pyfs import mkdir, rm
from pyio import write_dirs, read_dirs
operation_config = [
{
'case': 'TC-PIPE-FUSE-27',
'name': 'mkdir folder',
'target': 'folder',
'before': {},
'after': {
'folder': {}
}
},
... | 0 | 0 | 0 | 0 | 0 | 0 |
programs/program_chair_4.py | aluo-x/shape2prog | 109 | 3334536 | from .utils import *
import math
import os
from .label_config import max_step, max_param
from misc import get_distance_to_center
from .complex_base import draw_new_base
###################################
# generate club chairs
# seat-top can be: square, circle, rectangle
# supports can be: circle, square
# bottom bas... | 0 | 3 | 0 | 0 | 3 | 0 |
carla/recourse_methods/catalog/actionable_recourse/model.py | jayanthyetukuri/CARLA | 140 | 3334645 | from typing import Dict, Optional, Tuple
import numpy as np
import pandas as pd
import recourse as rs
from lime.lime_tabular import LimeTabularExplainer
from carla import log
from carla.recourse_methods.processing import encode_feature_names
from ...api import RecourseMethod
from ...processing.counterfactuals import... | 5 | 4 | 1 | 0 | 10 | 0 |
RecoJets/FFTJetProducers/python/fftjeteflowsmoother_cfi.py | ckamtsikis/cmssw | 852 | 3334677 | <gh_stars>100-1000
import math
import FWCore.ParameterSet.Config as cms
from RecoJets.FFTJetProducers.fftjetcommon_cfi import *
# FFTJet pattern recognition module configuration
fftjetEflowSmoother = cms.EDProducer(
"FFTJetEFlowSmoother",
#
# The main eta and phi scale factors for the pattern recognition ... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow_constrained_optimization/python/rates/expression.py | RMKruse/tensorflow_constrained_optimization | 276 | 3334679 | # Copyright 2018 The TensorFlow Constrained Optimization 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
#
#... | 1 | 45 | 0 | 1 | 47 | 0 |
Python/Tests/GlassTests/PythonTests/Python/StepNativeToPython/py_mod.py | techkey/PTVS | 404 | 3334698 | <filename>Python/Tests/GlassTests/PythonTests/Python/StepNativeToPython/py_mod.py
import cpp_mod
def callback():
print('ok')
cpp_mod.global_func(callback)
| 0 | 0 | 0 | 0 | 0 | 0 |
src/lib/time.py | alvarosg/covid-19-open-data | 316 | 3334702 | <gh_stars>100-1000
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | 0 | 0 | 0 | 0 | 0 | 0 |
basic/events/views.py | neechadi/django-basic-apps | 548 | 3334709 | import re, datetime
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.http import Http404
from django.views.generic import date_based, list_detail
from basic.events.models import *
def event_list(request, page: int=0) -> object:
return list_... | 1 | 5 | 0 | 0 | 6 | 0 |
torch_geometric/nn/aggr/set2set.py | rusty1s/pytorch-geometric | 2,350 | 3334710 | <reponame>rusty1s/pytorch-geometric
from typing import Optional
import torch
from torch import Tensor
from torch_geometric.nn.aggr import Aggregation
from torch_geometric.utils import softmax
class Set2Set(Aggregation):
r"""The Set2Set aggregation operator based on iterative content-based
attention, as desc... | 0 | 0 | 0 | 0 | 0 | 0 |
python/dnslog.py | taomujian/linbing | 351 | 3334740 | #!/usr/bin/env python3
from __future__ import annotations
import ssl
import time
import random
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
try:
_create_unverified_https_context = ssl._create_unverified_c... | 0 | 2 | 0 | 1 | 3 | 0 |
Anaconda-files/Program_01b.py | arvidl/dynamical-systems-with-applications-using-python | 106 | 3334780 | # Program 01b: A program that solves a second order ODE.
from sympy import Function, Eq, dsolve, symbols, exp
t = symbols('t')
y = symbols('y', cls=Function)
deqn2 = Eq(y(t).diff(t, t) + y(t).diff(t) + y(t), exp(t))
sol2 = dsolve(deqn2, y(t))
print(sol2)
| 0 | 0 | 0 | 0 | 0 | 0 |
tiny_fd.py | alues/hr101_mxnet | 105 | 3334796 | <filename>tiny_fd.py<gh_stars>100-1000
import logging
import mxnet as mx
import numpy as np
import cv2 as cv
import pickle
import os, sys
from collections import namedtuple
import time
Batch = namedtuple('Batch', ['data'])
class TinyFacesDetector:
def __init__(self, model_root='./', prob_thresh=0.5, gpu_idx=0, cu... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/augment_mnist.py | bohniti/tormentor | 101 | 3334801 | <filename>examples/augment_mnist.py
import tormentor
import torch
import torchvision
ds = torchvision.datasets.CIFAR100(download="True", train=True,root="/tmp/downloads")
print(ds.train) | 0 | 0 | 0 | 0 | 0 | 0 |
proof/__init__.py | fernandowaitman/proof | 149 | 3334813 | #!/usr/bin/env python
from proof.analysis import Analysis, never_cache
| 0 | 0 | 0 | 0 | 0 | 0 |
optimization/image_editor.py | pytti-tools/blended-diffusion | 121 | 3334871 | from __future__ import annotations
import os
from pathlib import Path
from optimization.constants import ASSETS_DIR_NAME, RANKED_RESULTS_DIR
from utils.metrics_accumulator import MetricsAccumulator
from utils.video import save_video
from numpy import random
from optimization.augmentations import ImageAugmentations
f... | 1 | 7 | 0 | 0 | 8 | 0 |
alipay/aop/api/domain/AlipayCommerceEducateFacefeatureDeleteModel.py | antopen/alipay-sdk-python-all | 213 | 3334940 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.ScenicFaceInfo import ScenicFaceInfo
class AlipayCommerceEducateFacefeatureDeleteModel(object):
def __init__(self):
self._biz_... | 0 | 0 | 0 | 0 | 0 | 0 |
front/migrations/0001_initial.py | llazzaro/django-front | 135 | 3334948 | <reponame>llazzaro/django-front
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Placeholder',
fields=[
... | 0 | 0 | 0 | 0 | 0 | 0 |
misc/experiments/test_gl.py | sethvargo/vaex | 337 | 3334951 | <filename>misc/experiments/test_gl.py
#!/usr/bin/env python
"""PySide port of the opengl/hellogl example from Qt v4.x"""
import sys
import math
#from PySide import QtCore, QtGui, QtOpenGL
from PyQt4 import QtCore, QtGui, QtOpenGL
from OpenGL.arrays import vbo
try:
from OpenGL import GL, GLU
except ImportError:... | 0 | 0 | 0 | 0 | 0 | 0 |
utilities/docker/build_geppetto_docker.py | sanjayankur31/org.geppetto | 164 | 3334966 | <reponame>sanjayankur31/org.geppetto
from __future__ import with_statement
import tempfile, os, shlex, subprocess, glob, shutil
#########################################
# Launches Geppetto via Docker
# Will be running on http://localhost:8080/org.geppetto.frontend
# by: <NAME> (<EMAIL>)
# To use:
# * Make sure Docker... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/bazel/gcs_fetch.py | leozz37/makani | 1,178 | 3334970 | <gh_stars>1000+
#!/usr/bin/python
# Copyright 2020 Makani Technologies 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow_serving/servables/xgboost/testdata/export_test_model.py | hzy001/xgboost-serving-1 | 106 | 3334975 | # Written by <NAME> <<EMAIL>>, May 2020.
#!/usr/bin/env python3.7
import xgboost as xgb
import scipy
import time
if __name__ == "__main__":
dtrain = xgb.DMatrix("bazel-out/k8-py3-opt/bin/tensorflow_serving/servables/xgboost/testdata/export_test_model.runfiles/tf_serving/tensorflow_serving/servables/xgboost/test... | 0 | 0 | 0 | 0 | 0 | 0 |
parsifal/apps/reviews/migrations/0035_auto_20210829_0005.py | ShivamPytho/parsifal | 342 | 3335000 | # Generated by Django 3.2.6 on 2021-08-29 00:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('reviews', '0034_auto_20170809_2034'),
]
operations: list[object] = [
migrations.AlterField(
model_name='a... | 0 | 0 | 2 | 0 | 2 | 0 |
torch_geometric/nn/conv/utils/helpers.py | NucciTheBoss/pytorch_geometric | 12,651 | 3335018 | <gh_stars>1000+
import torch
def expand_left(src: torch.Tensor, dim: int, dims: int) -> torch.Tensor:
for _ in range(dims + dim if dim < 0 else dim):
src = src.unsqueeze(0)
return src
| 0 | 0 | 0 | 0 | 0 | 0 |
keras_bert_ner/predict.py | wzz8850563/keras-bert-ner | 149 | 3335058 | # -*- coding: utf-8 -*-
"""
@Author: Shaoweihua.Liu
@Contact: <EMAIL>
@Site: github.com/liushaoweihua
@File: predict.py
@Time: 2020/3/3 10:37 AM
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import codecs
import pickle
import numpy as np
... | 0 | 2 | 0 | 0 | 2 | 0 |
sdk/python/pulumi_gcp/memcache/instance.py | sisisin/pulumi-gcp | 121 | 3335063 | <reponame>sisisin/pulumi-gcp
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** 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, U... | 0 | 0 | 0 | 0 | 0 | 0 |
ide/utils/project.py | Ramonrlb/cloudpebble | 147 | 3335123 | <filename>ide/utils/project.py
import logging
import abc
import json
from django.utils.translation import ugettext as _
__author__ = 'katharine'
PACKAGE_MANIFEST = 'package.json'
APPINFO_MANIFEST = 'appinfo.json'
MANIFEST_KINDS = [PACKAGE_MANIFEST, APPINFO_MANIFEST]
class InvalidProjectArchiveException(Exception)... | 0 | 0 | 0 | 0 | 0 | 0 |
chrome/content/papermachines/processors/mallet.py | papermachines/papermachines | 134 | 3335182 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import annotations
import sys
import os
import shutil
import logging
import tempfile
import time
import subprocess
import math
import re
import urllib
import json
import codecs
import csv
import traceback
import platform
import xml.etree.ElementTree as et
from ... | 4 | 1 | 0 | 0 | 5 | 0 |
ikalog/utils/config_loader.py | fetus-hina/IkaLog | 285 | 3335211 | #!/usr/local/bin/python3
# -*- coding: utf-8 -*-
#
# IkaLog
# ======
# Copyright (C) 2015 <NAME>
#
# 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/... | 0 | 4 | 0 | 0 | 4 | 0 |
core/virus_total.py | daemon604/ph0neutria | 277 | 3335219 | <filename>core/virus_total.py<gh_stars>100-1000
#!/usr/bin/python3
from .class_utils import MalwareUrl
from .config_utils import get_base_config
from datetime import datetime, timedelta
from .log_utils import get_module_logger
from .string_utils import clean_url, get_host_from_url
import dateutil.parser
import json
... | 0 | 0 | 0 | 0 | 0 | 0 |
suiron/utils/functions.py | 3keepmovingforward3/suiron | 800 | 3335234 | <reponame>3keepmovingforward3/suiron
import numpy as np
#Map function from arduino
def arduino_map(x, in_min, in_max, out_min, out_max):
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
# Converts raw values to target (Y) values
# for the convolutional neural network
def raw_to_cnn(y, min_a... | 0 | 0 | 0 | 0 | 0 | 0 |
flexneuart/models/base_bert_split_slide_window.py | gitter-badger/FlexNeuART | 101 | 3335242 | <filename>flexneuart/models/base_bert_split_slide_window.py
#
# This code is based on CEDR: https://github.com/Georgetown-IR-Lab/cedr
#
# (c) Georgetown IR lab & Carnegie Mellon University
#
# It's distributed under the MIT License
# MIT License is compatible with Apache 2 license for the code in this repo.
#
import to... | 0 | 0 | 0 | 0 | 0 | 0 |
Software/AX3/cwa-recover/cwa-recover.py | digitalinteraction/openmovement | 113 | 3335266 | <filename>Software/AX3/cwa-recover/cwa-recover.py
#!/usr/bin/env python
# coding=UTF-8
# CWA Dump File Recovery
import sys
import os
from struct import *
def checksum512(data):
sum = 0
for o in range(256):
value = data[2 * o] | (data[2 * o + 1] << 8)
sum = (sum + value) & 0xffff
return sum
def singleBi... | 0 | 0 | 0 | 0 | 0 | 0 |
src/1233.remove-sub-folders-from-the-filesystem/remove-sub-folders-from-the-filesystem.py | lyphui/Just-Code | 782 | 3335299 | <reponame>lyphui/Just-Code
class Solution:
def removeSubfolders(self, folder: List[str]) -> List[str]:
if not folder: return []
folder.sort()
ans, prev = [folder[0]], folder[0]+'/'
for f in folder[1:]:
if not f.startswith(prev):
ans.append(f)
... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/core/minos-microservice-saga/minos/saga/definitions/steps/remote.py | sorasful/minos-python | 247 | 3335314 | from __future__ import (
annotations,
)
from typing import (
Any,
Iterable,
Optional,
Union,
)
from minos.common import (
classname,
)
from ...context import (
SagaContext,
)
from ...exceptions import (
EmptySagaStepException,
MultipleOnErrorException,
MultipleOnExecuteExcepti... | 13 | 8 | 0 | 0 | 21 | 0 |
src/openvr/glframework/sdl_app.py | risa2000/pyopenvr | 204 | 3335327 | <reponame>risa2000/pyopenvr
#!/bin/env python
# file sdl_app.py
import ctypes
from OpenGL.GL import glFlush # @UnusedWildImport # this comment squelches an IDE warning
from sdl2 import * # @UnusedWildImport
"""
Minimal sdl programming example which colored OpenGL cube scene that can be closed by pressing ESCAPE.
... | 0 | 0 | 0 | 0 | 0 | 0 |
adi_analyze/aggregate/handler/BaseHandler.py | Bertlk/ADI | 226 | 3335339 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/9/2 2:01 下午
# @Author : kewen
# @File : BaseHandler.py
from aggregate.GlobalAggregateInfo import GlobalAggregateInfo
class BaseHandler:
def shouldHandle(self, eventName) -> bool:
return False
def handle(self, event, globalInfo: Glob... | 1 | 2 | 0 | 0 | 3 | 0 |
examples/design_search/plot.py | ONLYA/RoboGrammar | 156 | 3335341 | import argparse
import ast
from design_search import make_graph, build_normalized_robot
from matplotlib.patches import ConnectionPatch
import matplotlib.pyplot as plt
import pandas as pd
import pyrobotdesign as rd
from results import get_robot_image
import seaborn as sns
import tasks
def main():
parser = argparse.Ar... | 0 | 0 | 0 | 0 | 0 | 0 |
warehouse/migrations/versions/b5bb5d08543d_create_missing_primary_key_constraints.py | fairhopeweb/warehouse | 3,103 | 3335351 | <gh_stars>1000+
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distribu... | 0 | 0 | 0 | 0 | 0 | 0 |
ScanNet/test_scannet_grid.py | DLPerf/PointASNL | 209 | 3335352 | # *_*coding:utf-8 *_*
from __future__ import annotations
import os
import sys
from os import makedirs
from os.path import exists, join
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(BASE_DIR)
sys.path.append(os.path.join(ROOT_DIR, 'models'))
sys.path.append(os... | 4 | 2 | 0 | 1 | 7 | 0 |
src/sage/matroids/all.py | UCD4IDS/sage | 1,742 | 3335357 | """
Matroids
"""
# install the docstring of this module to the containing package
from sage.misc.namespace_package import install_doc
install_doc(__package__, __doc__)
from sage.misc.lazy_import import lazy_import
# from constructor import Matroid
# import matroids_catalog as matroids
lazy_import('sage.matroids.constr... | 0 | 0 | 0 | 0 | 0 | 0 |
thespian/system/transport/__init__.py | dendron2000/Thespian | 210 | 3335360 | from __future__ import annotations
"This module provides various low-level inter-Actor transport implementations."
from datetime import timedelta
from thespian.system.timing import ExpirationTimer, currentTime
from thespian.system.utilis import thesplog
import logging
DEFAULT_MAX_TRANSMIT_PERIOD = timedelta(minutes=... | 14 | 27 | 4 | 3 | 48 | 0 |
mathematics_dataset/sample/linear_system_test.py | PhysicsTeacher13/Mathematics_Dataset | 1,577 | 3335378 | # Copyright 2018 DeepMind Technologies Limited.
#
# 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 ag... | 0 | 0 | 0 | 0 | 0 | 0 |
frappe/www/robots.py | naderelabed/frappe | 3,755 | 3335379 |
import frappe
base_template_path = "www/robots.txt"
def get_context(context) -> dict[str,object]:
robots_txt = (
frappe.db.get_single_value('Website Settings', 'robots_txt') or
(frappe.local.conf.robots_txt and frappe.read_file(frappe.local.conf.robots_txt)) or '')
return { 'robots_txt': robots_txt }
| 0 | 1 | 0 | 0 | 1 | 0 |
tfidf/mapper1.py | Finite-Abelian/Data_Analytics_with_Hadoop | 177 | 3335463 | <gh_stars>100-1000
#!/usr/bin/env python
# mapper1.py
# Emits the term frequency of every term in each document.
#
# Author: <NAME> <<EMAIL>>
# Created: Tue Dec 01 12:55:21 2015 -0500
"""
Emits the term frequency of every term in each document.
To execute this mapper and associated reducer on Hadoop Streaming use ... | 0 | 0 | 0 | 0 | 0 | 0 |
gitpython_examples/common.py | DazEB2/SimplePyScripts | 117 | 3335470 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
LOGIN = None
PASSWORD = <PASSWORD>
# http://user:password@proxy_host:proxy_port
PROXY = None
if PROXY:
import os
os.environ['http_proxy'] = PROXY
NEW_REPO = 'Test-Repo'
import os
REPO_PATH = os.path.abspath(NEW_REPO)
# How use witho... | 0 | 0 | 0 | 0 | 0 | 0 |
ezibpy/__init__.py | victorjourne/ezibpy | 296 | 3335486 | <reponame>victorjourne/ezibpy
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# ezIBpy: a Pythonic Client for Interactive Brokers API
# https://github.com/ranaroussi/ezibpy
#
# Copyright 2015-2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance... | 0 | 0 | 0 | 0 | 0 | 0 |
example/benchmark.py | animuku/pyk4a | 186 | 3335523 | <filename>example/benchmark.py
from argparse import Action, ArgumentParser, Namespace
from enum import Enum
from time import monotonic
from pyk4a import FPS, ColorResolution, Config, DepthMode, ImageFormat, PyK4A, WiredSyncMode
class EnumAction(Action):
"""
Argparse action for handling Enums
"""
def... | 0 | 0 | 0 | 0 | 0 | 0 |
test/hummingbot/strategy/spot_perpetual_arbitrage/test_arb_proposal.py | BGTCapital/hummingbot | 3,027 | 3335617 | from os.path import join, realpath
import sys; sys.path.insert(0, realpath(join(__file__, "../../")))
import logging; logging.basicConfig(level=logging.ERROR)
import unittest
from unittest.mock import MagicMock
from decimal import Decimal
from hummingbot.strategy.spot_perpetual_arbitrage.arb_proposal import ArbProposa... | 0 | 0 | 1 | 0 | 1 | 0 |
openrasp_iast/test/scan_plugin/test_sql_basic.py | G3G4X5X6/openrasp-iast | 380 | 3335679 | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Copyright 2017-2020 Baidu Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | 1 | 3 | 0 | 0 | 4 | 0 |
sts-b-dir/trainer.py | mzl9039/imbalanced-regression | 370 | 3335691 | from __future__ import annotations
import os
import time
import copy
import random
import logging
import itertools
import ipdb as pdb
import numpy as np
import torch
import torch.optim.lr_scheduler
from torch.nn.utils.clip_grad import clip_grad_norm
from allennlp.common import Params
from allennlp.common.checks impor... | 11 | 11 | 0 | 3 | 25 | 0 |
tests/datasources/test_pcap.py | limkokhian/beagle | 1,139 | 3335695 | from io import BytesIO
from scapy.all import Ether, PcapWriter, Packet, IP, UDP, TCP, DNS, DNSQR, DNSRR
from scapy.layers.http import HTTPRequest, HTTP
from typing import List
from beagle.datasources.pcap import PCAP
def packets_to_datasource_events(packets: List[Packet]) -> PCAP:
f = BytesIO()
PcapWriter(f).... | 1 | 1 | 0 | 0 | 2 | 0 |
tools/conv.py | gatehouse/cppcms | 388 | 3335713 | <reponame>gatehouse/cppcms
#!/usr/bin/python
import sys
import re
class converter():
confline=re.compile(r'^\s*#include\s*"config.h"\s*$')
bline=re.compile(r'^\s*#include\s*<boost/(.*)>\s*$')
locline=re.compile(r'^(locale/.*|locale.hpp)$')
included=0
assigned=0
lst=[];
def print_list(self):
if not self.ls... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/Vitis-AI-Library/xmodel_image/test/debug_xmodel_image.py | hito0512/Vitis-AI | 848 | 3335721 | <filename>tools/Vitis-AI-Library/xmodel_image/test/debug_xmodel_image.py
#
# Copyright 2019 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/... | 0 | 0 | 0 | 0 | 0 | 0 |
tractseg/experiments/pretrained_models/TractSeg_BXTensAg.py | inaccel/TractSeg | 148 | 3335749 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from tractseg.experiments.base_legacy.tract_seg_legacy import Config as TractSegConfig
#todo: remove this model when CSD+BX input properly integrated
class Config(TractSegConfig):
EXP_NAME = os.path.basename(__file__).split(".")[0]
DATASET_FOLDER: str ... | 0 | 0 | 4 | 0 | 4 | 0 |
alipay/aop/api/domain/FullGiftDTO.py | antopen/alipay-sdk-python-all | 213 | 3335768 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import json
from alipay.aop.api.constant.ParamConstants import *
class FullGiftDTO(object):
def __init__(self):
self._gift_amount: None = None
self._gift_min_consumption: None = None
self._gift_nums: None = ... | 0 | 9 | 0 | 7 | 16 | 0 |
ioflo/base/monitoring.py | BradyHammond/ioflo | 128 | 3335769 | """monitoring.py monitoring communications etc
"""
#print("module {0}".format(__name__))
from ..aid.sixing import *
from .globaling import *
from ..aio.udp import PeerUdp
from . import excepting
from . import tasking
from ..aid.consoling import getConsole
console = getConsole()
#Class definitions
class Monitor(t... | 8 | 1 | 0 | 2 | 11 | 0 |
regtests/list/neg_index.py | bpmbank/PythonJS | 319 | 3335781 | """negative list indices"""
def main():
a = [1,2,3,4]
idx = -2
TestError( a[-1]==4 ) ## this works in javascript mode because the translator knows index is negative
TestError( a[idx]==3 ) ## this fails in javascript mode.
| 0 | 0 | 0 | 0 | 0 | 0 |
beit/masking_generator.py | Maria-philna/unilm | 5,129 | 3335826 | from __future__ import annotations
"""
Originally inspired by impl at https://github.com/zhunzhong07/Random-Erasing, Apache 2.0
Copyright <NAME> & <NAME>
Hacked together by / Copyright 2020 <NAME>
Modified by <NAME>, for generating the masked position for visual image transformer
"""
# -------------------------------... | 4 | 4 | 0 | 1 | 9 | 0 |
proselint/checks/security/__init__.py | kerri-hicks/proselint | 4,163 | 3335837 | <reponame>kerri-hicks/proselint
"""Security."""
| 0 | 0 | 0 | 0 | 0 | 0 |
programs/exceptions/syntax_error.py | dasari-mohana/100_page_python_intro | 163 | 3335891 | print('hello')
def main():
num = 5
total = num + 09
print(total)
main)
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test.py | darshanime/skor | 1,157 | 3335926 | #!/usr/bin/env python3
from __future__ import annotations
import socketserver
import threading
import http.server
import json
import queue
from http import HTTPStatus
from sqlalchemy import create_engine
from sqlalchemy.schema import MetaData
respQ = queue.Queue(maxsize=1)
class WebhookHandler(http.server.BaseHTTPR... | 1 | 11 | 0 | 0 | 12 | 0 |
book/graphs/prims_spanning_tree_test.py | Web-Dev-Collaborative/algos | 153 | 3335938 | <gh_stars>100-1000
import unittest
from prims_spanning_tree import create_spanning_tree, example_graph
expected_tree = {
'A': set(['B']),
'B': set(['C', 'D']),
'D': set(['E']),
'E': set(['F']),
'F': set(['G'])
}
class TestCorrectness(unittest.TestCase):
def test_example_graph(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
spirit/core/utils/timezone.py | Ke-xueting/Spirit | 974 | 3335940 | # -*- coding: utf-8 -*-
from __future__ import annotations
import logging
import datetime
import pytz
__all__ = ['timezones']
logger = logging.getLogger('django')
def is_standard_time(time_zone, date_time) -> object:
try:
dst_delta = time_zone.dst(date_time, is_dst=False)
except TypeError:
... | 1 | 6 | 0 | 0 | 7 | 0 |
pycorrector/seq2seq/train.py | ParikhKadam/pycorrector | 3,153 | 3335959 | # -*- coding: utf-8 -*-
"""
@author:XuMing(<EMAIL>)
@description: train seq2seq model
# #### PyTorch代码
# - [seq2seq-tutorial](https://github.com/spro/practical-pytorch/blob/master/seq2seq-translation/seq2seq-translation.ipynb)
# - [Tutorial from <NAME>](https://github.com/bentrevett/pytorch-seq2seq)
# - [IBM seq2seq](... | 2 | 0 | 0 | 0 | 2 | 0 |
accounts/templatetags/auth_tags.py | annevandalfsen/screenbird | 121 | 3335987 |
from django import template
from django.core.validators import email_re
register = template.Library()
def get_email_localpart(email) -> object:
"""
Generates a string based on the email. email must be a valid email address.
Uses characters before the '@', generates string from the email so as not to sho... | 0 | 2 | 0 | 0 | 2 | 0 |
leetcode.com/python/1055_Shortest_Way_to_Form_String.py | XSoyOscar/Algorithms | 713 | 3336018 | <reponame>XSoyOscar/Algorithms
from collections import defaultdict
import bisect
class Solution(object):
# # Greedy solution using two pointer. time O(M*N)
# def shortestWay(self, source, target):
# """
# :type source: str
# :type target: str
# :rtype: int
# """
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
spacy_transformers/__init__.py | thomashacker/spacy-transformers | 744 | 3336062 | from . import architectures
from . import annotation_setters
from . import span_getters
from .layers import TransformerModel
from .pipeline_component import Transformer, install_extensions
from .data_classes import TransformerData, FullTransformerBatch
from .util import registry
__all__ = [
"install_extensions",
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/workflows/tasks/success.py | apikay/celery-director | 351 | 3336088 | from director import task
@task(name="TASK_A")
def task_a(*args, **kwargs) -> str:
return "task_a"
@task(name="TASK_B")
def task_b(*args, **kwargs) -> str:
return "task_b"
@task(name="TASK_C")
def task_c(*args, **kwargs) -> str:
return "task_c"
| 0 | 3 | 0 | 0 | 3 | 0 |
python/craftassist/test/interactive_memory_explorer.py | boldsort/craftassist | 626 | 3336098 | """
Copyright (c) Facebook, Inc. and its affiliates.
"""
import shapes
from base_craftassist_test_case import BaseCraftassistTestCase
from typing import List
from mc_util import Block
from all_test_commands import * # noqa
def add_two_cubes(test):
triples = {"has_name": "cube", "has_shape": "cube"}
test.cub... | 0 | 0 | 0 | 2 | 2 | 0 |
evaluate.py | ruiming46zrm/CurricularFace | 433 | 3336104 | import torch
import torch.nn as nn
import torch.optim as optim
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import torch.nn.functional as F
from config import configurations
from backbone.model_resnet import ResNet_50, ResNet_101, ResNet_152
from backbone.model_irse import IR_50,... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/kafka-jvm/topologies/pixelcount.py | Pandinosaurus/streamparse | 1,050 | 3336113 | """
Pixel count topology
"""
from streamparse import Grouping, JavaSpout, Topology
from bolts.pixel_count import PixelCounterBolt
from bolts.pixel_deserializer import PixelDeserializerBolt
class PixelCount(Topology):
pixel_spout = JavaSpout.spec(
name="pixel-spout",
full_class_name="pixelcount.s... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.