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 |
|---|---|---|---|---|---|---|---|---|---|---|
open_seq2seq/encoders/transformer_encoder.py | VoiceZen/OpenSeq2Seq | 1,459 | 1632727 | # This code is heavily based on the code from MLPerf
# https://github.com/mlperf/reference/tree/master/translation/tensorflow
# /transformer
from __future__ import annotations
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import tensorflow as tf
from six.moves... | 2 | 4 | 0 | 3 | 9 | 0 |
doc/examples/scripts/structure/leontis_westhof.py | alex123012/biotite | 208 | 1632747 | """
Leontis-Westhof Nomenclature
============================
In this example we plot a secondary structure diagram annotated with
Leontis-Westhof nomenclature :footcite:`Leontis2001` of the sarcin-ricin
loop from E. coli (PDB ID: 6ZYB).
"""
# Code source: <NAME>
# License: BSD 3 clause
from tempfile import gettemp... | 0 | 0 | 0 | 0 | 0 | 0 |
bookwyrm/models/__init__.py | mouse-reeve/fedireads | 270 | 1632753 | """ bring all the models into the app namespace """
import inspect
import sys
from .book import Book, Work, Edition, BookDataModel
from .author import Author
from .link import Link, FileLink, LinkDomain
from .connector import Connector
from .shelf import Shelf, ShelfBook
from .list import List, ListItem
from .status... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/structured/python/needsthis.py | sorphin/py2app | 193 | 1632780 | from __future__ import print_function
print("needsthis found")
print("data file: ", open('data/datafile.txt', 'r').read())
| 0 | 0 | 0 | 0 | 0 | 0 |
discomll/regression/linear_regression.py | romanorac/discomll | 103 | 1632829 | <gh_stars>100-1000
"""
Linear regression with MapReduce
The linear regression fits theta parameters to training data.
Reference:
MapReduce version of algorithm is proposed by <NAME>; <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>. "Map-Reduce for Machine Learning on Multicore". NIPS 2006.
"""
def simple_ini... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_collections.py | michaelpetrov/dataclasses-json | 811 | 1632858 | from collections import deque
from tests.entities import (DataClassIntImmutableDefault,
DataClassMutableDefaultDict,
DataClassMutableDefaultList, DataClassWithDeque,
DataClassWithDict, DataClassWithDictInt,
... | 0 | 0 | 0 | 0 | 0 | 0 |
okta/models/user_status.py | corylevine/okta-sdk-python | 145 | 1632864 | # flake8: noqa
"""
Copyright 2020 - Present Okta, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | 0 | 0 | 8 | 0 | 8 | 0 |
RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusterOOTECAL_cff.py | ckamtsikis/cmssw | 852 | 1632877 | import FWCore.ParameterSet.Config as cms
from RecoEcal.EgammaClusterProducers.particleFlowSuperClusterECAL_cfi import *
particleFlowSuperClusterOOTECAL = particleFlowSuperClusterECAL.clone(
PFClusters = "particleFlowClusterOOTECAL",
ESAssociation = "particleFlowClusterOOTEC... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/pymedphys/_utilities/createshells.py | ethanio12345/pymedphys | 207 | 1632946 | <filename>lib/pymedphys/_utilities/createshells.py
# Copyright (C) 2015-2018 <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/LICENSE-2.0
# Unless r... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/user/tests.py | parekhpriyanshu/website | 312 | 1632950 | <reponame>parekhpriyanshu/website<gh_stars>100-1000
import random
from django.test import TestCase
# Create your tests here.
lis =[1,2,67,4,5]
print(max(lis))
for i in range(100):
print(int(random.random()*5))
| 0 | 0 | 0 | 0 | 0 | 0 |
python/ql/test/query-tests/Variables/unused/type_annotation_fp.py | madhurimamandal/codeql | 4,036 | 1632961 | <filename>python/ql/test/query-tests/Variables/unused/type_annotation_fp.py<gh_stars>1000+
# FP Type annotation counts as redefinition
# See https://github.com/Semmle/ql/issues/2652
def type_annotation(x):
foo = 5
if x:
foo : int
do_stuff_with(foo)
else:
foo : float
do_other... | 0 | 0 | 0 | 0 | 0 | 0 |
proyecto/flask/Lib/operator.py | grupoprog3/proyecto_final | 207 | 1632988 | from __future__ import annotations
"""
Operator Interface
This module exports a set of functions corresponding to the intrinsic
operators of Python. For example, operator.add(x, y) is equivalent
to the expression x+y. The function names are those used for special
methods; variants without leading and trailing... | 1 | 63 | 3 | 2 | 69 | 0 |
pandasdmx/source/estat.py | sosna/pandaSDMX | 105 | 1632992 | <reponame>sosna/pandaSDMX<filename>pandasdmx/source/estat.py<gh_stars>100-1000
from tempfile import NamedTemporaryFile
from time import sleep
from urllib.parse import urlparse
from zipfile import ZipFile
from typing import Tuple
import requests
from . import Source as BaseSource
class Source(BaseSource):
"""Han... | 0 | 0 | 0 | 0 | 0 | 0 |
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/p/postponed_evaluation_activated_with_alias.py | ciskoinch8/vimrc | 463 | 1633004 | <filename>vimfiles/bundle/vim-python/submodules/pylint/tests/functional/p/postponed_evaluation_activated_with_alias.py
# pylint: disable=missing-docstring,no-self-use,unused-argument,pointless-statement
# pylint: disable=too-few-public-methods,no-name-in-module
from __future__ import annotations as __annotations__
cl... | 0 | 0 | 0 | 0 | 0 | 0 |
django/contrib/admindocs/urls.py | webjunkie/django | 790 | 1633011 | from django.conf.urls import patterns, url
from django.contrib.admindocs import views
urlpatterns = patterns('',
url('^$',
views.doc_index,
name='django-admindocs-docroot'
),
url('^bookmarklets/$',
views.bookmarklets,
name='django-admindocs-bookmarklets'
),
url('^tag... | 0 | 0 | 0 | 0 | 0 | 0 |
raspberryio/qanda/migrations/0001_initial.py | cvautounix/raspberryio | 113 | 1633018 | <reponame>cvautounix/raspberryio
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Question'
db.create_table('qanda_question', (
(... | 0 | 0 | 0 | 0 | 0 | 0 |
main.py | ikostrikov/TensorFlow-Pointer-Networks | 223 | 1633051 | """Implementation of Pointer networks: http://arxiv.org/pdf/1506.03134v1.pdf.
"""
from __future__ import absolute_import, division, print_function
import random
import numpy as np
import tensorflow as tf
from dataset import DataGenerator
from pointer import pointer_decoder
flags = tf.app.flags
FLAGS = flags.FLAGS
... | 0 | 1 | 0 | 4 | 5 | 0 |
modules/nltk_contrib/seqclass.py | h4ck3rm1k3/NLP-project | 123 | 1633064 | <reponame>h4ck3rm1k3/NLP-project
from nltk.classify import iis
import yaml
import os
class SequentialClassifier(object):
def __init__(self, left=2, right=0):
#left = look back
#right = look forward
self._model = []
self._left = left
self._right = right
self._leftcontext = [N... | 0 | 0 | 0 | 0 | 0 | 0 |
flowtorch/bijectors/volume_preserving.py | vmoens/flowtorch | 207 | 1633065 | # Copyright (c) Meta Platforms, Inc
from typing import Optional, Sequence
import torch
import torch.distributions
from flowtorch.bijectors.base import Bijector
class VolumePreserving(Bijector):
def _log_abs_det_jacobian(
self, x: torch.Tensor, y: torch.Tensor, params: Optional[Sequence[torch.Tensor]]
... | 3 | 1 | 0 | 0 | 4 | 0 |
lldb/test/API/lang/swift/async/stepping/step-in/TestSwiftStepInAsync.py | LaudateCorpus1/llvm-project | 605 | 1633067 | import lldb
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbtest as lldbtest
import lldbsuite.test.lldbutil as lldbutil
import re
class TestCase(lldbtest.TestBase):
mydir = lldbtest.TestBase.compute_mydir(__file__)
@swiftTest
@skipIf(oslist=['windows', 'linux'])
def test(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/synapse/azure-synapse/azure/synapse/accesscontrol/models/__init__.py | rsdoherty/azure-sdk-for-python | 2,728 | 1633082 | <gh_stars>1000+
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
pgoapi/protos/pogoprotos/settings/master/item/fort_modifier_attributes_pb2.py | aroo135/pgoapi | 842 | 1633122 | <gh_stars>100-1000
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/settings/master/item/fort_modifier_attributes.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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
.ycm_extra_conf.py | bh107/bohrium | 236 | 1633136 | from __future__ import annotations
import os
# Canidates for the builddir (relative to the path of this file),
# which we use to find some generated files:
builddir_canidates = [ "build", "b" ]
# Determine actual builddir
builddir = builddir_canidates[0]
for d in builddir_canidates:
if os.path.exists(d):
buildd... | 0 | 2 | 0 | 0 | 2 | 0 |
dataset_code/form_df_all.py | mapicccy/Stock-Market-Trend-Analysis-Using-HMM-LSTM | 147 | 1633154 | """
将原来的数据库,变成一个stock id一个文件的数据库
"""
import os
import pandas as pd
import numpy as np
import pickle
# 导入行情数据
file_path = 'C:/Users/Administrator/Desktop/program/data/hangqing/'
file_list = os.listdir(file_path)
columns_name = pd.read_csv(file_path+file_list[0]).columns
hangqing_record = []
temp_r... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_utils.py | jdai8/artificial-adversary | 363 | 1633166 | from Adversary.utils import *
def test_flatten_unique():
l = [[1, 2], [1, 3, 4], [5]]
assert(flatten_unique(l) == [1, 2, 3, 4, 5])
def test_combinations_of_len():
l = [1, 2, 3]
assert(combinations_of_len(l, 2) == [(1,), (2,), (3,), (1, 2), (1, 3), (2, 3)])
def test_fancy_titles():
cols = ['change... | 0 | 0 | 0 | 0 | 0 | 0 |
marley/gamey/aggregating.py | cool-RR/grid_royale | 255 | 1633202 | # Copyright 2020 <NAME> and collaborators.
# This program is distributed under the MIT license.
from __future__ import annotations
import math
import inspect
import re
import abc
import random
import itertools
import collections.abc
import statistics
import concurrent.futures
import enum
import functools
import numbe... | 32 | 27 | 2 | 1 | 62 | 0 |
tests/rc/predictors/dialog_qa_test.py | matt-peters/allennlp-models | 402 | 1633241 | <filename>tests/rc/predictors/dialog_qa_test.py
from allennlp.models.archival import load_archive
from allennlp.predictors import Predictor
from tests import FIXTURES_ROOT
class TestDialogQAPredictor:
def test_uses_named_inputs(self):
inputs = {
"paragraphs": [
{
... | 0 | 0 | 0 | 0 | 0 | 0 |
uflow/export/freeze_model_test.py | deepneuralmachine/google-research | 23,901 | 1633277 | <reponame>deepneuralmachine/google-research
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 |
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/tests/test_casting.py | jeikabu/lumberyard | 1,738 | 1633314 | <reponame>jeikabu/lumberyard<gh_stars>1000+
from numba import unittest_support as unittest
import numpy as np
from numba.compiler import compile_isolated
from numba import types, njit
import struct
def float_to_int(x):
return types.int32(x)
def int_to_float(x):
return types.float64(x) / 2
def float_to_uns... | 0 | 0 | 0 | 0 | 0 | 0 |
image_synthesis/data/build.py | buxiangzhiren/VQ-Diffusion_office | 236 | 1633348 | from __future__ import annotations
import torch
# from image_synthesis.data.base_dataset import ConcatDatasetWithIndex as ConcatDataset
from torch.utils.data import ConcatDataset
from image_synthesis.utils.misc import instantiate_from_config
from image_synthesis.distributed.distributed import is_distributed
def build_... | 2 | 1 | 0 | 0 | 3 | 0 |
cudatbx/cufft/__init__.py | dperl-sol/cctbx_project | 155 | 1633352 | <reponame>dperl-sol/cctbx_project
from __future__ import absolute_import, division, print_function
import atexit
def real_to_complex_3d_in_place(data):
import boost_adaptbx.boost.python as bp
ext = bp.import_ext("cudatbx_cufft_ext")
real_type = type(data).__name__
if (real_type == "double"):
return ext.re... | 0 | 0 | 0 | 0 | 0 | 0 |
transifex_utils/core/validators/whats_new_json_validator.py | BotLordd/aulanet-app-android | 308 | 1633358 | import os.path
import json
from core import constants, log, json_util
from core.validators import validator_util
def validate(file_path, template):
log.log_subline_bold(f"Reading source file : '{file_path}'.")
source_data = json_util.read_json_data(file_path)
for language in constants.languages.values():
... | 0 | 0 | 0 | 0 | 0 | 0 |
hwt/serializer/mode.py | ufo2011/hwt | 134 | 1633367 | from __future__ import annotations
"""
Serializer mode specifies if hdl objects derived from parent unit
should be serialized to target HDL or not
use serialize* methods to specify serialization mode for unit class
.. code-block:: python
@serializeExclude
class MyUnit(Unit):
# ...
pass
"""
... | 0 | 8 | 0 | 0 | 8 | 0 |
voltron/plugins/api/write_memory.py | jonasmr/voltron | 5,856 | 1633369 | <reponame>jonasmr/voltron
import voltron
import logging
import six
import struct
from voltron.api import *
log = logging.getLogger('api')
class APIWriteMemoryRequest(APIRequest):
"""
API write memory request.
{
"type": "request",
"request": "write_memory",
"data": {... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | sysid/pyAHP | 102 | 1633439 | from setuptools import setup, find_packages
setup(
name='pyAHP',
version='0.1.2',
packages=find_packages(),
install_requires=[
'numpy>=1.14.0',
'scipy>=1.0.0'
],
author='<NAME>',
author_email='<EMAIL>',
description='Analytic Hierarchy Process solver',
license='MIT',
... | 0 | 0 | 0 | 0 | 0 | 0 |
biosppy/stats.py | megrao/BioSPPy | 491 | 1633446 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
biosppy.stats
---------------
This module provides statistica functions and related tools.
:copyright: (c) 2015-2021 by Instituto de Telecomunicacoes
:license: BSD 3-clause, see LICENSE for more details.
"""
# Imports
# compat
from __future__ import abso... | 8 | 4 | 0 | 0 | 12 | 0 |
tests/syntax/name_is_param_and_nonlocal.py | matan-h/friendly | 287 | 1633456 | """Should raise SyntaxError: name 'x' is parameter and nonlocal"""
def f(x):
nonlocal x
| 0 | 0 | 0 | 0 | 0 | 0 |
qa/L0_profile/check_results.py | MarkMoTrin/model_analyzer | 115 | 1633457 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | 0 | 1 | 0 | 0 | 1 | 0 |
src/sage/homology/simplicial_complex.py | UCD4IDS/sage | 1,742 | 1633464 | # -*- coding: utf-8 -*-
r"""
Finite simplicial complexes: deprecated
The current version is :mod:`sage.topology.simplicial_complexes`.
"""
from sage.misc.superseded import deprecated_function_alias
import sage.topology.simplicial_complex
for f in ['lattice_paths',
'rename_vertex',
'Simplex',
... | 0 | 0 | 0 | 0 | 0 | 0 |
factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/general/utils.py | kaka-lin/azure-intelligent-edge-patterns | 176 | 1633484 | """General utils that does not belong to any app
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | birdFSS/iSearch | 255 | 1633491 | <filename>setup.py
#!/usr/bin/env python
# coding=utf-8
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import iSearch
setup(
name='iSearch',
keywords=['dictionary', 'youdao', 'word'],
version=iSearch.__version__,
packages=['iSearch'],
url='https://g... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/win32/Demos/security/regsecurity.py | ajayiagbebaku/NFL-Model | 150 | 1633495 | import win32api, win32con, win32security, ntsecuritycon
new_privs = (
(
win32security.LookupPrivilegeValue("", ntsecuritycon.SE_SECURITY_NAME),
win32con.SE_PRIVILEGE_ENABLED,
),
(
win32security.LookupPrivilegeValue("", ntsecuritycon.SE_TCB_NAME),
win32con.SE_PRIVILEGE_ENABLE... | 0 | 0 | 0 | 0 | 0 | 0 |
python/ql/test/query-tests/Metrics/cyclo/code.py | vadi2/codeql | 4,036 | 1633509 | def f_linear(x) -> object:
y = x
z = y
return z
def one_branch(x) -> int:
if x:
return 1
else:
return 2
def two_branch(x, y) -> int:
if x:
y += 1
else:
y += 2
if y:
return 1
else:
return 2
def nested(x, y) -> int:
if x:
... | 0 | 5 | 0 | 0 | 5 | 0 |
recipes/Python/577322_AutoInitialisatidefault_attribute/recipe-577322.py | tdiprima/code | 2,023 | 1633514 | ### The suggested superclass ###
class AutoInit (object) :
"""
Each class that inherits from AutoInit (directly or indirectly) can
specify all standard attributes and their initials in dictionary called
classinitials.
Important: if used, it is recommended to specify an attribute with default value None (for c... | 0 | 0 | 0 | 0 | 0 | 0 |
scratch/old/server_sent_events.py | mcx/ml_logger | 107 | 1633535 | # author: <EMAIL>
#
# Make sure your gevent version is >= 1.0
from __future__ import annotations
import gevent
from gevent.pywsgi import WSGIServer
from gevent.queue import Queue
from flask import Flask, Response
import time
# SSE "protocol" is described here: http://mzl.la/UPFyxY
class ServerSentEvent(object):
... | 0 | 5 | 0 | 3 | 8 | 0 |
tkinter/embed-matplotlib/minimal-examples/main-1-gcf.py | whitmans-max/python-examples | 140 | 1633539 | <filename>tkinter/embed-matplotlib/minimal-examples/main-1-gcf.py
import tkinter
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import matplotlib.pyplot as plt
data = [1, 3, 2, 4]
root = tkinter.Tk()
# create plot
plt.plot(data)
fig = plt.gcf() # get current figure
# create canvas with plot and add... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_schema_priority.py | zhPavel/dataclass_factory | 189 | 1633565 | from dataclasses import dataclass
from unittest import TestCase
from dataclass_factory import Factory, Schema
@dataclass
class Data:
a: str = ""
b: str = ""
c_: str = ""
_d: str = ""
class TestFactory(TestCase):
def test_only_mapping(self):
factory = Factory(
schemas={
... | 0 | 0 | 4 | 0 | 4 | 0 |
examples/convert.py | AlexDLSy/canmatrix | 656 | 1633568 | <reponame>AlexDLSy/canmatrix
#!/usr/bin/env python3
import sys
sys.path.append('..')
import canmatrix.cli.convert
canmatrix.cli.convert.cli_convert()
| 0 | 0 | 0 | 0 | 0 | 0 |
lambda-sns-cdk/src/app.py | jeremycare/serverless-patterns | 883 | 1633570 | #!/usr/bin/env python3
from aws_cdk import (
aws_lambda as _lambda,
aws_logs as logs,
aws_sns as sns,
core as cdk
)
from constructs import Construct
class LambdaSnsCdkStack(cdk.Stack):
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, const... | 2 | 1 | 0 | 0 | 3 | 0 |
examples/pass_colormaps.py | MaksHess/napari | 1,345 | 1633580 | <gh_stars>1000+
"""
Add named or unnamed vispy colormaps to existing layers.
"""
import numpy as np
from skimage import data
import napari
histo = data.astronaut() / 255
rch, gch, bch = np.transpose(histo, (2, 0, 1))
v = napari.Viewer()
rlayer = v.add_image(
rch, name='red channel', colormap='red', blending='a... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/harmony/conftest.py | MrDelik/core | 30,023 | 1633602 | <reponame>MrDelik/core
"""Fixtures for harmony tests."""
from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch
from aioharmony.const import ClientCallbackType
import pytest
from homeassistant.components.harmony.const import ACTIVITY_POWER_OFF
from .const import NILE_TV_ACTIVITY_ID, PLAY_MUSIC_ACTIVITY_... | 0 | 0 | 0 | 0 | 0 | 0 |
vit/formatter/scheduled_formatted.py | kinifwyne/vit | 179 | 1633633 | <gh_stars>100-1000
from vit.formatter.scheduled import Scheduled
class ScheduledFormatted(Scheduled):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
doubi_sdust/0007.py | saurabh896/python-1 | 3,976 | 1633663 | '''
第 0007 题: 有个目录,里面是你自己写过的程序,统计一下你写过多少行代码。包括空行和注释,但是要分别列出来。
'''
import os.path
import re
def mainKeywords(dirPath):
blank, comments, codelines, totalines, count, temp = 0, 0, 0, 0, 0, 0
f_list = os.listdir(dirPath)
for i in f_list:
if os.path.splitext(i)[1] == '.py':
print(i)
... | 0 | 0 | 0 | 0 | 0 | 0 |
moldesign/utils/docparsers/__init__.py | Autodesk/molecular-design-toolkit | 147 | 1633668 | <reponame>Autodesk/molecular-design-toolkit
from .google import GoogleDocArgumentInjector
| 0 | 0 | 0 | 0 | 0 | 0 |
other-materials/python-intro/test.py | inferential/drug-computing | 103 | 1633705 | <reponame>inferential/drug-computing
def multiply(x, y):
return x*y
if __name__ == "__main__":
#only executed if run directly from the command line
print(multiply(4, 5))
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/models/mx_model/base.py | justinkterry/MAgent | 121 | 1633728 | <reponame>justinkterry/MAgent
import os
import mxnet as mx
from magent.utility import has_gpu
from model import BaseModel
class MXBaseModel(BaseModel):
def __init__(self, env, handle, name, subclass_name):
"""init a model
Parameters
----------
env: magent.Environment
hand... | 0 | 0 | 0 | 0 | 0 | 0 |
Find_Stocks/IBD_RS_Rating.py | vhn0912/Finance | 441 | 1633736 | # Imports
from pandas_datareader import data as pdr
from yahoo_fin import stock_info as si
import yfinance as yf
import pandas as pd
import datetime
import time
yf.pdr_override()
# Variables
tickers = si.tickers_sp500()
tickers = [item.replace(".", "-") for item in tickers] # Yahoo Finance uses dashes instead of dots
... | 0 | 0 | 0 | 0 | 0 | 0 |
cruft/__init__.py | tdhopper/cruft | 293 | 1633746 | <reponame>tdhopper/cruft
"""**cruft**
Allows you to maintain all the necessary cruft for packaging and building projects separate from
the code you intentionally write. Built on-top of, and fully compatible with, CookieCutter.
"""
from cruft._commands import check, create, diff, link, update
from cruft._version import... | 0 | 0 | 0 | 0 | 0 | 0 |
predict-daily-temperature/utils.py | Featuretools/predict_next_purchase | 105 | 1633750 | <filename>predict-daily-temperature/utils.py
import numpy as np
import matplotlib.pyplot as plt
import featuretools as ft
import pandas as pd
import sklearn
from sklearn.ensemble import RandomForestRegressor
plt.rcdefaults()
def plot_model_performances(baseline_evalml_score, random_forest_evalml_score, baseline_scor... | 0 | 0 | 0 | 0 | 0 | 0 |
arelle/examples/plugin/hello_i18n.py | DataFinnovation/Arelle | 292 | 1633766 | '''
Hello dolly is a simple "Hello world" to demonstrate how plug-ins
are written for Arelle
(c) Copyright 2012 Mark V Systems Limited, All rights reserved.
'''
def menuEntender(cntlr, menu):
menu.add_command(label="Hello i18n", underline=0, command=lambda: menuCommand(cntlr) )
def menuCommand(cntlr):
... | 0 | 0 | 0 | 0 | 0 | 0 |
server/mturk/management/commands/mtexpire.py | paulu/opensurfaces | 137 | 1633777 | """
.. describe:: ./manage.py mtexpire '<regex>'
Expire all experiments whose ``slug`` matches a regex. When a HIT is expired,
any current workers may finish, but no new workers may start the HIT.
This script expires in decreasing order of pay.
"""
from django.conf import settings
from django.core.manag... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_estimator.py | kento-forest/heamy | 560 | 1633803 | <reponame>kento-forest/heamy
# coding:utf-8
import random
import numpy as np
import pytest
from sklearn.model_selection import train_test_split
from sklearn.datasets import load_boston
from sklearn.linear_model import LinearRegression, LogisticRegression
from heamy.dataset import Dataset
from heamy.estimator import R... | 0 | 0 | 0 | 0 | 0 | 0 |
seoanalyzer/__main__.py | cobolbaby/python-seo-analyzer | 743 | 1633820 | #!/usr/bin/env python3
from __future__ import annotations
import argparse
import inspect
import json
import os
from jinja2 import Environment
from jinja2 import FileSystemLoader
from seoanalyzer import analyze
def main(args: object | None=None):
if not args:
module_path = os.path.dirname(inspect.getfile... | 1 | 0 | 0 | 0 | 1 | 0 |
scripts/external_libs/scapy-2.4.5/scapy/contrib/automotive/obd/scanner.py | dariusgrassi/trex-core | 250 | 1633842 | # This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) <NAME> <<EMAIL>>
# Copyright (C) <NAME> <<EMAIL>>
# Copyright (C) <NAME> <<EMAIL>>
# This program is published under a GPLv2 license
# scapy.contrib.description = OnBoardDiagnosticScanner
# scapy.contrib.status... | 9 | 20 | 10 | 0 | 39 | 0 |
tfimm/architectures/pit.py | gietema/tensorflow-image-models | 154 | 1633868 | """
We provide an implementation and pretrained weights for Pooling-based Vision
Transformers (PiT).
Paper: Rethinking Spatial Dimensions of Vision Transformers.
`[arXiv:2103.16302] <https://arxiv.org/abs/2103.16302>`_.
Original pytorch code and weights from
`NAVER AI <https://github.com/naver-ai/pit>`_.
This code h... | 10 | 17 | 22 | 3 | 52 | 0 |
graalpython-notebook-example/test1.py | MartinBalin/graalvm-demos | 323 | 1633876 | [
'''import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
png = Image.open("imgs/pet.png")
png = png.quantize(colors=32)
png = png.convert(mode="RGB")
w,h = png.size
png''',
'''im = np.array(png)
im.shape
plt.imshow(im)
plt''',
'''# Calculate horizontal differences only finding increasing brightnes... | 0 | 0 | 0 | 0 | 0 | 0 |
mermaid/image_manipulations.py | HastingsGreer/mermaid | 120 | 1633878 | """
Various methods to manipulate images
"""
from __future__ import print_function
from builtins import object
import numpy as np
class IntensityNormalizeImage(object):
def __init__(self):
"""
Constructor
"""
self.default_normalization_mode: str = 'percentile_normalization'
... | 1 | 3 | 0 | 1 | 5 | 0 |
luminoth/models/fasterrcnn/roi_pool.py | jsdussanc/luminoth | 2,584 | 1633880 | import sonnet as snt
import tensorflow as tf
# Types of RoI "pooling"
CROP = 'crop'
ROI_POOLING = 'roi_pooling'
class ROIPoolingLayer(snt.AbstractModule):
"""ROIPoolingLayer applies ROI Pooling (or tf.crop_and_resize).
RoI pooling or RoI extraction is used to extract fixed size features from a
variable ... | 2 | 3 | 0 | 0 | 5 | 0 |
applications/tensorflow2/bert/run_pretraining.py | payoto/graphcore_examples | 260 | 1633891 | # Copyright (c) 2021 Graphcore Ltd. All rights reserved.
from datetime import datetime
from pathlib import Path
import tensorflow as tf
from tensorflow.python import ipu
from transformers import BertConfig
from data_utils.batch_config import BatchConfig, Task
from data_utils.wikipedia.load_wikipedia_data import get_... | 0 | 1 | 0 | 0 | 1 | 0 |
third_party/blink/tools/blinkpy/web_tests/models/test_expectations.py | zealoussnow/chromium | 14,668 | 1633915 | <filename>third_party/blink/tools/blinkpy/web_tests/models/test_expectations.py<gh_stars>1000+
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistribu... | 0 | 0 | 0 | 0 | 0 | 0 |
kmip/tests/unit/services/test_kmip_protocol.py | ondrap/PyKMIP | 179 | 1633927 | <reponame>ondrap/PyKMIP<gh_stars>100-1000
# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
# 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
#... | 0 | 0 | 0 | 0 | 0 | 0 |
zhaquirks/imagic/gs1117s.py | WolfRevo/zha-device-handlers | 213 | 1633938 | <reponame>WolfRevo/zha-device-handlers
"""Device handler for iMagic by Greatstar."""
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import (
Basic,
Identify,
Ota,
PollControl,
PowerConfiguration,
)
from zigpy.zcl.clusters.homeautomation import Di... | 0 | 0 | 0 | 0 | 0 | 0 |
django_docker/django_docker/urls.py | tthayer/django-docker | 386 | 1633964 | <gh_stars>100-1000
from django.conf.urls import include, url
from hello_world import views as hello_world_views
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^$', hello_world_views.hello_world, name='hello_world'),
]
| 0 | 0 | 0 | 0 | 0 | 0 |
turtle/flower-color/main-colors-asymmetrical.py | whitmans-max/python-examples | 140 | 1633973 | import turtle
def item(lenght, level, color) -> None:
if level <= 0:
return
for _ in range(5): # 5
turtle.color(colors[color])
turtle.forward(lenght)
item(lenght/4, level-1, color+1)
turtle.penup() # there is no need to draw again the same line... | 0 | 1 | 0 | 0 | 1 | 0 |
tensorflow/contrib/timeseries/python/timeseries/state_space_models/varma_test.py | PaulWang1905/tensorflow | 848 | 1633983 | <reponame>PaulWang1905/tensorflow
# Copyright 2017 The TensorFlow 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-... | 0 | 0 | 0 | 0 | 0 | 0 |
flash_tutorials/electricity_forecasting/electricity_forecasting.py | sunil-s/lightning-tutorials | 114 | 1634004 | # %% [markdown]
# In this tutorial we'll look at using [Lightning Flash](https://github.com/PyTorchLightning/lightning-flash) and it's
# integration with [PyTorch Forecasting](https://github.com/jdb78/pytorch-forecasting) for autoregressive modelling of
# electricity prices using [the N-BEATS model](https://arxiv.org/a... | 5 | 1 | 0 | 0 | 6 | 0 |
tests/test_cases/test_cocotb/test_synchronization_primitives.py | lavanyajagan/cocotb | 350 | 1634020 | # Copyright cocotb contributors
# Licensed under the Revised BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-3-Clause
"""
Tests for synchronization primitives like Lock and Event
"""
import pytest
import cocotb
from cocotb.triggers import Lock, Timer, _InternalEvent
from cocotb.utils import get_si... | 0 | 0 | 0 | 0 | 0 | 0 |
filterpy/examples/__init__.py | QamarQuqa/Real-time-Traffic-and-Pedestrian-Counting | 2,264 | 1634026 | # -*- coding: utf-8 -*-
#pylint: disable=wildcard-import
""" Contains various example, mostly very outdated now."""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
__all__ = ["radar_sim"]
from .radar_sim import *
| 0 | 0 | 0 | 0 | 0 | 0 |
KM/03code/cpp/chenshuo/muduo-protorpc/examples/zurg/client/rpc.py | wangcy6/weekly.github.io | 138 | 1634087 | #!/usr/bin/python
import socket
import struct
import sys
import zlib
from google.protobuf import service
import rpc_pb2
import rpcservice_pb2
def encode(message):
body = "RPC0" + message.SerializeToString()
cksum = zlib.adler32(body)
return "".join((struct.pack(">l", len(body) + 4), body, struct.pack(">... | 0 | 0 | 0 | 0 | 0 | 0 |
src/python/pants/backend/project_info/peek.py | yoav-orca/pants | 1,806 | 1634102 | # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import collections
import json
from dataclasses import asdict, dataclass, is_dataclass
from typing import Any, Iterable, cast
from pants.engine.collect... | 0 | 0 | 0 | 0 | 0 | 1 |
django_th/tests/test_views.py | Leopere/django-th | 1,069 | 1634110 | # coding: utf-8
import django.contrib.messages
from django.core.cache import caches
from django.shortcuts import reverse
from django.test import RequestFactory
from django_th.models import TriggerService, UserService
from django_th.views import TriggerEditedTemplateView
from django_th.views import TriggerDeletedTempla... | 0 | 0 | 0 | 0 | 0 | 0 |
aiida/restapi/translator/user.py | azadoks/aiida-core | 180 | 1634118 | <gh_stars>100-1000
# -*- 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 |
test/templates/Test/apps/Hello/views.py | timgates42/uliweb | 202 | 1634148 | <filename>test/templates/Test/apps/Hello/views.py<gh_stars>100-1000
#coding=utf-8
from uliweb import expose, functions
@expose('/')
def index():
return {}
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/contact_form/forms.py | grimmen/django-multiupload | 290 | 1634155 | <reponame>grimmen/django-multiupload
from django import forms
from multiupload.fields import MultiFileField
from .models import Message, Attachment
class ContactForm(forms.ModelForm):
class Meta:
model = Message
fields = ['author_name', 'author_email', 'content'] # not attachments!
files =... | 0 | 0 | 0 | 0 | 0 | 0 |
froide/account/menu.py | xenein/froide | 198 | 1634198 | from __future__ import annotations
from collections import namedtuple, defaultdict
MenuItem = namedtuple("MenuItem", "section order label url")
def menu_order(item) -> object:
return item.order
class MenuRegistry(object):
def __init__(self):
self.callbacks: list[object] = []
def register(self,... | 0 | 2 | 0 | 1 | 3 | 0 |
tests/application_tests/test_general_module.py | joelvisroman/dataviva-site | 126 | 1634219 | <filename>tests/application_tests/test_general_module.py<gh_stars>100-1000
from flask import url_for
from test_base import BaseTestCase
class GeneralModuleTests(BaseTestCase):
def test_should_redirect_when_access_root(self):
assert '302 FOUND' == self.client.get('/').status
def test_should_redirect_... | 0 | 0 | 0 | 0 | 0 | 0 |
cctbx/examples/structure_factor_derivatives_3.py | dperl-sol/cctbx_project | 155 | 1634241 | from __future__ import absolute_import, division, print_function
from cctbx import xray
from scitbx.math import tensor_rank_2_gradient_transform_matrix
from scitbx import matrix
from scitbx.array_family import flex
import cmath
import math
from six.moves import zip
def scatterer_as_list(self) -> object:
if (self.fla... | 0 | 11 | 0 | 0 | 11 | 0 |
sqlalchemy_continuum/version.py | vhermecz/sqlalchemy-continuum | 401 | 1634248 | import sqlalchemy as sa
from .reverter import Reverter
from .utils import get_versioning_manager, is_internal_column, parent_class
class VersionClassBase(object):
@property
def previous(self) -> object:
"""
Returns the previous version relative to this version in the version
history. ... | 1 | 5 | 0 | 0 | 6 | 0 |
omaha_server/feedback/migrations/0005_auto_20150722_0930.py | fiadm/omaha-server | 142 | 1634256 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
def set_feedbacks_size(apps, schema_editor):
Feedback = apps.get_model("feedback", "Feedback")
feedbacks = Feedback.objects.iterator()
for feedback in feedbacks:
... | 0 | 0 | 2 | 0 | 2 | 0 |
source/remediation_runbooks/scripts/EnableAWSConfig_createtopic.py | j-erickson/aws-security-hub-automated-response-and-remediation | 129 | 1634265 | #!/usr/bin/python
###############################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache License Version 2.0 (the "License... | 0 | 3 | 0 | 0 | 3 | 0 |
aiohttp_debugtoolbar/tbtools/__init__.py | tonywu7/aiohttp-debugtoolbar | 144 | 1634279 | <reponame>tonywu7/aiohttp-debugtoolbar
# TODO: remove somehow
def text_(s, encoding='latin-1', errors='strict'):
if isinstance(s, bytes):
return s.decode(encoding, errors)
return s # pragma: no cover
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_verilog/test_log.py | leonardt/magma | 167 | 1634296 | import magma as m
import magma.testing
import shutil
import os
import fault
def test_log(capsys):
FF = m.define_from_verilog("""
module FF(input I, output reg O, input CLK, input CE);
always @(posedge CLK) begin
if (CE) O <= I;
end
endmodule
""", type_map={"CLK": m.In(m.Clock), "CE": m.In(m.Enable)})[0]
... | 0 | 0 | 0 | 0 | 0 | 0 |
components/stdproc/orbit/orbit2sch/Orbit2sch.py | vincentschut/isce2 | 1,133 | 1634334 | <reponame>vincentschut/isce2
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2010 California Institute of Technology. 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.
... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/580751_Testing_Tkinter_or_Selenium/recipe-580751.py | tdiprima/code | 2,023 | 1634350 | # Author: <NAME>
from rpyc.utils.server import ThreadedServer
from rpyc.utils.classic import DEFAULT_SERVER_PORT
from rpyc.core.service import Service, ModuleNamespace
from rpyc.lib.compat import execute, is_py3k
import sys
import os
import threading
import argparse
EXECUTED_PYTHON_FILE = False
def exec_python... | 0 | 3 | 1 | 0 | 4 | 0 |
stacker/commands/__init__.py | theister/stacker | 372 | 1634370 | <reponame>theister/stacker
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from .stacker import Stacker # NOQA
| 0 | 0 | 0 | 0 | 0 | 0 |
rfcatomni/bin/bolus.py | yeagerm/openomni | 115 | 1634398 | #!/usr/bin/env python
from openomni.message import Message
from openomni.nonce import generate_nonces
import sys
import struct
def main(argv):
if len(argv) != 4:
# ./openomni/bin/bolus.py 42539 310475 7dc0c970 0.1
print "Usage: bolus.py lot_id tid last_nonce amount"
exit(-1)
print("a... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | suryatmodulus/localstack | 31,928 | 1634418 | <filename>setup.py
#!/usr/bin/env python
import re
from collections import defaultdict
from plugin.setuptools import load_entry_points
from setuptools import find_packages, setup
def parse_requirements(lines):
requirements = defaultdict(list)
extra = "install"
for line in lines:
line = line.stri... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/engine/test_transport.py | aiidateam/aiida_core | 153 | 1634429 | <gh_stars>100-1000
# -*- 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 |
matchzoo/preprocessors/units/stop_removal.py | ChrisRBXiong/MatchZoo-py | 2,209 | 1634487 | <reponame>ChrisRBXiong/MatchZoo-py
import nltk
from .unit import Unit
class StopRemoval(Unit):
"""
Process unit to remove stop words.
Example:
>>> unit = StopRemoval()
>>> unit.transform(['a', 'the', 'test'])
['test']
>>> type(unit.stopwords)
<class 'list'>
""... | 0 | 0 | 0 | 0 | 0 | 0 |
Data/Corpus/RedditData/redditparser.py | puneet739/ChatLearner | 590 | 1634524 | <reponame>puneet739/ChatLearner<gh_stars>100-1000
"""
This file was modified from the reddit parser on https://github.com/pender/chatbot-rnn.
When unzipped, the generated files contains conversations in the same format as those
in other data files in this Papaya Data Set corpus. They will be further cleaned and
proce... | 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.