max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
tests/orm/data/test_enum.py | aiidateam/aiida_core | 153 | 11182070 | # -*- coding: utf-8 -*-
"""Tests for the :class:`aiida.orm.nodes.data.enum.Enum` data plugin."""
import enum
import pytest
from aiida.common import links
from aiida.orm import load_node
from aiida.orm.nodes.data.enum import EnumData
class DummyEnum(enum.Enum):
"""Dummy enum for testing."""
OPTION_A = 'a'
... |
orc8r/gateway/python/magma/common/redis/mocks/mock_redis.py | Aitend/magma | 849 | 11182133 | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
scripts/eval/eval.py | bertinetto/r2d2 | 111 | 11182136 | <reponame>bertinetto/r2d2
# This file originally appeared in https://github.com/jakesnell/prototypical-networks
# and has been modified for the purpose of this project
import os
import json
import math
import torch
import torchnet as tnt
from fewshots.utils import filter_opt, merge_dict
import fewshots.utils.data as... |
examples/object_serialization.py | wyfo/apimodel | 118 | 11182141 | <reponame>wyfo/apimodel<filename>examples/object_serialization.py
from dataclasses import dataclass
from typing import Any
from apischema import alias, serialize, type_name
from apischema.json_schema import JsonSchemaVersion, definitions_schema
from apischema.objects import get_field, object_serialization
@dataclass... |
utility/preprocess/queries_split.py | techthiyanes/ColBERT | 421 | 11182191 | <filename>utility/preprocess/queries_split.py
"""
Divide a query set into two.
"""
import os
import math
import ujson
import random
from argparse import ArgumentParser
from collections import OrderedDict
from colbert.utils.utils import print_message
def main(args):
random.seed(12345)
"""
Load the q... |
nautobot/tenancy/migrations/0002_auto_slug.py | psmware-ltd/nautobot | 384 | 11182220 | # Generated by Django 3.1.13 on 2021-08-05 03:23
from django.db import migrations
import nautobot.core.fields
class Migration(migrations.Migration):
dependencies = [
("tenancy", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="tenant",
name="s... |
biliup/engine/__init__.py | xxxxuanran/biliup | 145 | 11182229 | <filename>biliup/engine/__init__.py<gh_stars>100-1000
from .decorators import Plugin
def invert_dict(d: dict):
inverse_dict = {}
for k, v in d.items():
for item in v:
inverse_dict[item] = k
return inverse_dict
__all__ = ['invert_dict', 'Plugin']
|
mayan/apps/motd/permissions.py | eshbeata/open-paperless | 2,743 | 11182235 | from __future__ import absolute_import, unicode_literals
from django.utils.translation import ugettext_lazy as _
from permissions import PermissionNamespace
namespace = PermissionNamespace('motd', _('Message of the day'))
permission_message_create = namespace.add_permission(
name='message_create', label=_('Crea... |
src/ZODB/tests/testZODB.py | pretagov/ZODB | 514 | 11182262 | <reponame>pretagov/ZODB<filename>src/ZODB/tests/testZODB.py<gh_stars>100-1000
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# ... |
src/alphabet.py | meghbhalerao/cnnormaliztion | 221 | 11182301 | <reponame>meghbhalerao/cnnormaliztion<filename>src/alphabet.py
class Alphabet(dict):
def __init__(self, start_feature_id=1):
self.fid = start_feature_id
def add(self, item):
idx = self.get(item, None)
if idx is None:
idx = self.fid
self[item] = idx
self.fid += 1
return idx
def... |
app/handler/encoder.py | cdlaimin/pity | 135 | 11182323 | <reponame>cdlaimin/pity
import json
from datetime import datetime
from typing import Any
class JsonEncoder(json.JSONEncoder):
def default(self, o: Any) -> Any:
if isinstance(o, set):
return list(o)
if isinstance(o, datetime):
return o.strftime("%Y-%m-%d %H:%M:%S")
... |
neutron/db/migration/alembic_migrations/versions/xena/expand/1bb3393de75d_add_qos_pps_rule.py | congnt95/neutron | 1,080 | 11182327 | <filename>neutron/db/migration/alembic_migrations/versions/xena/expand/1bb3393de75d_add_qos_pps_rule.py<gh_stars>1000+
# Copyright (c) 2021 China Unicom Cloud Data Co.,Ltd.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance w... |
hls4ml/model/flow/flow.py | jaemyungkim/hls4ml | 380 | 11182361 | <filename>hls4ml/model/flow/flow.py<gh_stars>100-1000
class Flow(object):
def __init__(self, name, optimizers, requires=None):
self.name = name
if optimizers is None:
self.optimizers = []
else:
self.optimizers = optimizers
if requires is None:
sel... |
FinMind/plotting/pie.py | vishalbelsare/FinMind | 1,106 | 11182379 | import typing
from IPython.display import HTML, display
from pyecharts import options as opts
from pyecharts.charts import Pie
from FinMind.schema.plot import Labels, Series, convert_labels_series_schema
def pie(
labels: typing.Union[typing.List[typing.Union[str, int]], Labels],
series: typing.Union[typing.... |
tests/test_distfit.py | ksachdeva/distfit | 126 | 11182512 | import numpy as np
from distfit import distfit
def test_distfit():
X = np.random.normal(0, 2, 1000)
y = [-14,-8,-6,0,1,2,3,4,5,6,7,8,9,10,11,15]
# Initialize
dist = distfit()
assert np.all(np.isin(['method', 'alpha', 'bins', 'distr', 'multtest', 'n_perm'], dir(dist)))
# Fit and transform data
... |
rqt_carla_control/setup.py | SebastianHuch/ros-bridge | 314 | 11182517 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup for rqt_carla_control
"""
import os
ROS_VERSION = int(os.environ['ROS_VERSION'])
if ROS_VERSION == 1:
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['rqt_... |
src/third_party/angle/src/commit_id.py | Chilledheart/naiveproxy | 2,219 | 11182542 | <reponame>Chilledheart/naiveproxy<gh_stars>1000+
#!/usr/bin/env python
# Copyright 2018 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Generate commit.h with git commit hash.
#
import subprocess as sp
import sy... |
rest_registration/decorators.py | psibean/django-rest-registration | 329 | 11182549 | <filename>rest_registration/decorators.py
import types
def api_view_serializer_class_getter(serializer_class_getter):
def _get_serializer_class(self):
return serializer_class_getter()
def _get_serializer(self, *args, **kwargs):
serializer_class = self.get_serializer_class()
return se... |
bookwyrm/tests/views/test_get_started.py | mouse-reeve/fedireads | 270 | 11182550 | """ test for app action functionality """
from unittest.mock import patch
from django.template.response import TemplateResponse
from django.test import TestCase
from django.test.client import RequestFactory
from bookwyrm import forms, models, views
from bookwyrm.tests.validate_html import validate_html
@patch("bookw... |
plugin.video.xbmcfilm/resources/lib/utils/rowbalance.py | mrknow/filmkodi | 105 | 11182583 | #!/usr/bin/env python2
# -*- coding: UTF-8 -*-
import random
servers = [ '172.16.58.3:1935',
'192.168.3.11:1935',
'172.16.31.10:1935',
'192.168.127.12:1935',
'192.168.127.12:1935',
'192.168.3.11:1935',
'172.16.58.3:1935',
'172.16.17.32... |
test/library/draft/DataFrames/psahabu/IterSeries.py | jhh67/chapel | 1,602 | 11182632 | import pandas as pd
I = ["A", "B", "C", "D", "E"]
A = ["a", "b", "c", "d", "e"]
letters = pd.Series(A, pd.Index(I))
for i in letters.index:
print i
print
for i in zip(letters.index, range(0, 5)):
print i
print
for i in letters:
print i
print
for i in letters.items():
print i
|
examples/tutorials/03_vision/03_annotate.py | rootless4real/cozmo-python-sdk | 794 | 11182640 | #!/usr/bin/env python3
# Copyright (c) 2016 Anki, 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 in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
examples/train.py | amirjaber/vaegan | 101 | 11182692 | # coding : utf-8
import sys
import os
module_path = os.path.abspath( u'..' )
sys.path.append( module_path )
import json
import numpy as np
import theano
from vaegan.data import load_data
from vaegan import Morph, Reconstruct
from vaegan import VAEGAN
from vaegan.optimizers import Adam
def load_json( infile_name ):
... |
openshift_tools/web/rest.py | fahlmant/openshift-tools | 164 | 11182701 | <reponame>fahlmant/openshift-tools
#!/usr/bin/env python2
# vim: expandtab:tabstop=4:shiftwidth=4
"""
Generic REST class using python requests module
see zagg_client.py for example on how to use
"""
import requests
# pylint: disable=import-error,no-name-in-module
import requests.packages.urllib3.connectionpool as htt... |
RankFlair/rankflair.py | zatherz/reddit | 444 | 11182745 | #/u/GoldenSights
import praw
import time
import traceback
''' USER CONFIGURATION '''
APP_ID = ""
APP_SECRET = ""
APP_URI = ""
APP_REFRESH = ""
# https://www.reddit.com/comments/3cm1p8/how_to_make_your_bot_use_oauth2/
USERAGENT = ""
#This is a short description of what the bot does.
#For example "/u/GoldenSights' New... |
django/load_devices.py | fallenfuzz/pynet | 528 | 11182780 | from net_system.models import NetworkSwitch, InventoryGroup
from net_system.models import Credentials
from getpass import getpass
import django
def main():
django.setup()
management_ip = raw_input("Please enter IP address: ")
my_switches = (('pynet-sw1', 8222, '10.220.88.28'),
('pynet-... |
tests/tools/assigner/models/test_replica_election.py | akashvacher/kafka-tools | 578 | 11182794 | import json
import unittest
from mock import patch, ANY
from kafka.tools.models.broker import Broker
from kafka.tools.models.topic import Topic
from kafka.tools.assigner.models.replica_election import ReplicaElection
class ReplicaElectionTests(unittest.TestCase):
def setUp(self):
self.topic = Topic('tes... |
napari/layers/utils/_color_manager_constants.py | MaksHess/napari | 1,345 | 11182815 | <gh_stars>1000+
from enum import Enum
class ColorMode(str, Enum):
"""
ColorMode: Color setting mode.
DIRECT (default mode) allows each point to be set arbitrarily
CYCLE allows the color to be set via a color cycle over an attribute
COLORMAP allows color to be set via a color map over an attribute
... |
aleph/views/notifications_api.py | Rosencrantz/aleph | 1,213 | 11182816 | <filename>aleph/views/notifications_api.py
from flask import Blueprint, request
from aleph.search import NotificationsQuery
from aleph.views.serializers import NotificationSerializer
from aleph.views.util import require
blueprint = Blueprint("notifications_api", __name__)
@blueprint.route("/api/2/notifications", m... |
transly/seq2seq/config.py | nikgit17/transly | 116 | 11182847 | <reponame>nikgit17/transly<filename>transly/seq2seq/config.py
import pickle
import pandas as pd
from transly.base.config import Config
class SConfig(Config):
"""
Configuration for encoder decoder model
"""
def __init__(
self,
configuration_file=None,
training_data_path="khoj... |
gym_collision_avoidance/envs/__init__.py | krishna-bala/gym-collision-avoidance | 128 | 11182874 | # Find the config file (path provided as an environment variable),
# import and instantiate it here so all modules have access
import os
gym_config_path = os.environ.get('GYM_CONFIG_PATH', os.path.join(os.path.dirname(os.path.realpath(__file__)), 'config.py'))
gym_config_class = os.environ.get('GYM_CONFIG_CLASS', 'Conf... |
2010/aes-encrypt-pycrypto/pycrypto_aes.py | minimum-necessary-change/code-for-blog | 1,199 | 11182896 | from Crypto.Cipher import AES
import hashlib
password = b'<PASSWORD>'
key = hashlib.sha256(password).digest()
key = b'<KEY>'
IV = 16 * '\x00'
mode = AES.MODE_CBC
encryptor = AES.new(key, mode, IV=IV)
text = b'j' * 32 + b'i' * 64
ciphertext = encryptor.encrypt(text)
decryptor = AES.new(key, mode, IV=IV)
plain = decr... |
kb/knowbert_utils.py | XuhuiZhou/kb | 295 | 11183051 | <reponame>XuhuiZhou/kb
from typing import Union, List
from allennlp.common import Params
from allennlp.data import Instance, DataIterator, Vocabulary
from allennlp.common.file_utils import cached_path
from kb.include_all import TokenizerAndCandidateGenerator
from kb.bert_pretraining_reader import replace_candidates... |
mutant/contrib/geo/migrations/0002_update_field_defs_app_label.py | pombredanne/django-mutant | 152 | 11183078 | <reponame>pombredanne/django-mutant<filename>mutant/contrib/geo/migrations/0002_update_field_defs_app_label.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import functools
from django.db import migrations
def _update_field_def_cts_app_label(from_app_label, to_app_label, apps, schema_editor):
... |
net/settings_bbc.py | juandesant/astrometry.net | 460 | 11183087 | from __future__ import absolute_import
from .settings_common import *
TEMPDIR = '/data2/tmp'
DATABASES['default']['NAME'] = 'an-bbc'
LOGGING['loggers']['django.request']['level'] = 'WARN'
SESSION_COOKIE_NAME = 'BBCAstrometrySession'
ssh_solver_config = 'an-bbc'
sitename = 'bbc'
SOCIAL_AUTH_GITHUB_KEY = github_s... |
videos/067_you_should_put_this_in_all_your_python_scripts/if_name_main_pkg/import_func.py | matthewstidham/VideosSampleCode | 285 | 11183088 | from if_name_main_pkg.bad_script import useful_function
def main():
print(f'{useful_function(3)=}')
if __name__ == '__main__':
main() |
glance/tests/functional/db/migrations/test_ocata_expand01.py | Steap/glance | 309 | 11183095 | <reponame>Steap/glance
# 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 w... |
RecoBTag/Combined/python/caloDeepCSVTagInfos_cfi.py | ckamtsikis/cmssw | 852 | 11183100 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
from RecoBTag.SecondaryVertex.combinedSecondaryVertexCommon_cff import combinedSecondaryVertexCommon
caloDeepCSVTagInfos = cms.EDProducer(
'TrackDeepNNTagInfoProducer',
svTagInfos = cms.InputTag('inclusiveSecondaryVertexFinderTagInfos'),
computer =... |
audit-forked-sites/check_status.py | t-develo/covid19 | 6,890 | 11183101 | import csv
import datetime
import markdown
import pandas as pd
import re
import urllib.request
def markdown_to_html(input: str):
return markdown.markdown(
input,
extensions=['markdown.extensions.tables']
)
def now_in_jst():
jst = datetime.timezone(datetime.timedelta(hours=9))
return ... |
tests/test_pipeline.py | huntrax11/redis-shard | 284 | 11183121 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
from nose.tools import eq_
from redis.exceptions import WatchError
from redis_shard.shard import RedisShardAPI
from redis_shard._compat import b, xrange
from .config import settings
class TestShard(unittest.TestCase):
def setUp(self):
self.clien... |
xmasctf2020/doiknowyou/exploit.py | nhtri2003gmail/ctf-write-ups | 101 | 11183127 | #!/usr/bin/env python3
from pwn import *
p = remote('challs.xmas.htsp.ro', 2008)
payload = b''
payload += (0x38 - 0x18) * b'A'
payload += p64(0xdeadbeef)
p.sendlineafter('you?\n', payload)
p.stream()
|
data/source/tests/pyyal_test_type/open_file_object-end.py | libyal/libyal | 176 | 11183142 |
${library_name_suffix}_${type_name}.open_file_object(file_object)
with self.assertRaises(IOError):
${library_name_suffix}_${type_name}.open_file_object(file_object)
${library_name_suffix}_${type_name}.close()
with self.assertRaises(TypeError):
${library_name_suffix}_${type_na... |
observations/r/train.py | hajime9652/observations | 199 | 11183160 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def train(path):
"""Stated Preferences for Train Traveling
a cross-sec... |
silverstrike/tests/test_importers.py | CodingForVega/silverstrike | 298 | 11183171 | <reponame>CodingForVega/silverstrike
import os
from datetime import date
from unittest import skipUnless
from django.test import TestCase
from silverstrike import importers
class ImportTests(TestCase):
def setUp(self):
super(ImportTests, self).setUp()
self.base_dir = os.path.join(os.path.dirname... |
test/cli/test_readelf.py | rakati/ppci-mirror | 161 | 11183176 | import unittest
import io
import os
from unittest.mock import patch
from ppci.cli.readelf import readelf
bash_path = '/usr/bin/bash'
class ReadelfTestCase(unittest.TestCase):
@patch('sys.stdout', new_callable=io.StringIO)
def test_help(self, mock_stdout):
""" Check readelf help message """
... |
scripts/reimage.py | varshar16/teuthology | 117 | 11183179 | <filename>scripts/reimage.py
import docopt
import sys
import teuthology.reimage
doc = """
usage: teuthology-reimage --help
teuthology-reimage --os-type distro --os-version version [options] <nodes>...
Reimage nodes without locking using specified distro type and version.
The nodes must be locked by the curren... |
corehq/apps/case_search/urls.py | rochakchauhan/commcare-hq | 471 | 11183245 | from django.conf.urls import url
from corehq.apps.case_search.views import CaseSearchView
urlpatterns = [
url(r'^search/$', CaseSearchView.as_view(), name=CaseSearchView.urlname),
]
|
packages/Python/lldbsuite/test/lang/swift/protocols/class_protocol/TestClassConstrainedProtocolArgument.py | xiaobai/swift-lldb | 765 | 11183252 | """
Test that variables passed in as a class constrained protocol type
are correctly printed.
"""
import lldbsuite.test.lldbinline as lldbinline
from lldbsuite.test.decorators import *
lldbinline.MakeInlineTest(
__file__, globals(), decorators=[skipUnlessDarwin])
|
contrib/opencensus-ext-azure/opencensus/ext/azure/metrics_exporter/statsbeat_metrics/__init__.py | serjshevchenko/opencensus-python | 650 | 11183262 | # Copyright 2020, OpenCensus 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/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
python/ql/src/Security/CWE-079/examples/jinja2.py | vadi2/codeql | 4,036 | 11183263 | from flask import Flask, request, make_response, escape
from jinja2 import Environment, select_autoescape, FileSystemLoader
app = Flask(__name__)
loader = FileSystemLoader( searchpath="templates/" )
unsafe_env = Environment(loader=loader)
safe1_env = Environment(loader=loader, autoescape=True)
safe2_env = Environment... |
lib/data_utils/kp_utils.py | ziniuwan/maed | 145 | 11183266 | <gh_stars>100-1000
import numpy as np
def convert_kps_to_mask(kp_2d, visibility, mask_size):
"""
Args:
kp_2d: size (49, 2) range from 0 to 224
visibility: size (49,)
"""
img_size = 224
mask = np.zeros((mask_size,mask_size), dtype=np.float16)
kp_2d = kp_2d.copy()
kp_2d = kp_... |
volttrontesting/testutils/test_getinstance_2.py | cloudcomputingabc/volttron | 406 | 11183273 | <filename>volttrontesting/testutils/test_getinstance_2.py
import pytest
from volttrontesting.utils.platformwrapper import PlatformWrapper
@pytest.mark.wrapper
def test_fixture_starts_platforms(get_volttron_instances):
num_instances = 5
wrappers = get_volttron_instances(num_instances)
assert num_instance... |
mmfashion/models/losses/margin_ranking_loss.py | RyanJiang0416/mmfashion | 952 | 11183286 | <gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..registry import LOSSES
@LOSSES.register_module
class MarginRankingLoss(nn.Module):
def __init__(self,
margin=0.2,
loss_weight=5e-5,
size_average=None,
... |
image_thumbnailer.py | susannahsoon/oldperth | 302 | 11183305 | <filename>image_thumbnailer.py<gh_stars>100-1000
#!/usr/bin/python
import record
import fetcher
import os
rs = record.AllRecords()
f = fetcher.Fetcher('images', 0)
rs = [r for r in rs if (r.photo_url and f.InCache(r.photo_url))]
for idx, r in enumerate(rs):
in_image = f.CacheFile(r.photo_url)
out_image = 'thumbn... |
notifiers/providers/email.py | JonShedden/notifiers | 1,508 | 11183307 | <filename>notifiers/providers/email.py
import getpass
import mimetypes
import smtplib
import socket
from email.message import EmailMessage
from email.utils import formatdate
from pathlib import Path
from smtplib import SMTPAuthenticationError
from smtplib import SMTPSenderRefused
from smtplib import SMTPServerDisconnec... |
tensorflow_decision_forests/component/inspector/blob_sequence.py | Saduf2019/decision-forests | 412 | 11183316 | # Copyright 2021 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
cgan.py | ruifan831/mnistGANs | 138 | 11183353 | <filename>cgan.py<gh_stars>100-1000
# [Conditional Generative Adversarial Nets](https://arxiv.org/pdf/1411.1784.pdf)
import tensorflow as tf
from tensorflow import keras
import numpy as np
from visual import save_gan, cvt_gif
from tensorflow.keras.layers import Dense, Reshape, Input, Embedding
from utils import set_so... |
mindinsight/backend/debugger/debugger_api.py | mindspore-ai/mindinsight | 216 | 11183355 | <reponame>mindspore-ai/mindinsight
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# 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... |
tests/test_pair.py | HRI-EU/HRI-nanomsg-python | 334 | 11183361 | import unittest
import os
from nanomsg_wrappers import set_wrapper_choice, get_default_for_platform
set_wrapper_choice(os.environ.get('NANOMSG_PY_TEST_WRAPPER',
get_default_for_platform()))
from nanomsg import (
PAIR,
Socket
)
SOCKET_ADDRESS = os.environ.get('NANOMSG_PY_TEST... |
tests/st/dynamic_shape/test_getnext_dynamic_pipeline.py | PowerOlive/mindspore | 3,200 | 11183412 | <gh_stars>1000+
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 ... |
anuga/utilities/mem_time_equation.py | samcom12/anuga_core | 136 | 11183413 | <gh_stars>100-1000
import sys
from . import system_tools
TEST_CON = 'test_constants'
test_constants = {'tri_a_T':1, 'tri_b_T': 1,
'tim_a_T':1,'fil_a_T':1.,'cons_T':1,
'tri_a_S':1,'cons_S':1}
# These constants come from the Major Variables script that ran on
# tornado in serial
sy... |
testing/MLDBFB-545-incorrect_result_on_merged_ds.py | kstepanmpmg/mldb | 665 | 11183420 | #
# MLDBFB-545-incorrect_result_on_merged_ds.py
# Mich, 2016-05-27
# This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved.
#
import unittest
from mldb import mldb, MldbUnitTest, ResponseException
class Mldbfb545MergeDsWhereQueryTest(MldbUnitTest): # noqa
def test_MLDBFB_545_where_query_beh... |
genie-examples/explore_vlans.py | fallenfuzz/netdevops_demos | 104 | 11183427 | #! /usr/bin/env python
"""Example script using Genie
Intended to be ran interactively (ie from iPython)
This script will retrieve information from a device.
Copyright (c) 2018 Cisco and/or its affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated doc... |
modin/core/dataframe/algebra/default2pandas/dataframe.py | Rubtsowa/modin | 7,258 | 11183438 | <reponame>Rubtsowa/modin<filename>modin/core/dataframe/algebra/default2pandas/dataframe.py
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licen... |
tests/instagram_basic/conftest.py | sns-sdks/python-facebook | 181 | 11183472 | <gh_stars>100-1000
import pytest
from pyfacebook import IGBasicDisplayApi
@pytest.fixture
def api():
return IGBasicDisplayApi(
app_id="123456",
app_secret="xxxxx",
access_token="token",
)
|
parsifal/library/migrations/0005_auto_20150626_1649.py | michelav/parsifal | 342 | 11183498 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('library', '0004_auto_20150626_0841'),
]
operations = [
migrations.AlterModelOptions(
name='folder',
... |
querybook/migrations/versions/22c9a254b41e_initial_commit.py | shivammmmm/querybook | 1,144 | 11183507 | """Initial commit
Revision ID: 22c9a254b41e
Revises:
Create Date: 2019-06-17 17:42:47.075692
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "22c9a254b41e"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
MediumText = sa.Text(len... |
flows/ablations/abl_nomixlog.py | evanlohn/flowpp | 131 | 11183509 | """
Ablation: no mixture of logistics
Filters: 108 (to compensate for parameter count)
Params: 32,045,708
Dropout 0.2
"""
import tensorflow as tf
from flows.flow_training import train, evaluate
from flows.flows import (
Flow, Compose, Inverse, ImgProc, Sigmoid,
TupleFlip, CheckerboardSplit, ChannelSplit, Sp... |
cpython-pycopy/test.py | AEMICS/pycopy-lib | 126 | 11183539 | <reponame>AEMICS/pycopy-lib
import pycopy
from pycopy import const
FOO = const(1)
@pycopy.native
def func1():
return 2
@pycopy.viper
def func2() -> int:
return 3
assert FOO == 1
assert func1() == 2
assert func2() == 3
|
libs/fuel/tests/test_caltech101_silhouettes.py | dendisuhubdy/attention-lvcsr | 767 | 11183551 | import numpy
from numpy.testing import assert_raises
from fuel.datasets import CalTech101Silhouettes
from tests import skip_if_not_available
def test_caltech101_silhouettes16():
skip_if_not_available(datasets=['caltech101_silhouettes16.hdf5'])
for which_set, size, num_examples in (
('train', 16, ... |
curriculum/envs/goal_env.py | ACampero/rllab-curriculum | 115 | 11183553 | <reponame>ACampero/rllab-curriculum
"""
Goal based environments. The classes inside this file should inherit the classes
from the state environment base classes.
"""
import random
from rllab import spaces
import sys
import os.path as osp
import numpy as np
import scipy.misc
import tempfile
import math
from rllab.en... |
angr/engines/soot/expressions/newArray.py | Kyle-Kyle/angr | 6,132 | 11183578 | <gh_stars>1000+
import logging
from ..values import SimSootValue_ArrayBaseRef
from .base import SimSootExpr
l = logging.getLogger('angr.engines.soot.expressions.newarray')
class SimSootExpr_NewArray(SimSootExpr):
def _execute(self):
element_type = self.expr.base_type
size = self._translate_expr... |
model/sequential_recommender/GRU4Rec.py | jasonshere/NeuRec | 978 | 11183607 | """
Paper: Session-based Recommendations with Recurrent Neural Networks
Author: <NAME>, <NAME>, <NAME>, and <NAME>
Reference: https://github.com/hidasib/GRU4Rec
https://github.com/Songweiping/GRU4Rec_TensorFlow
@author: <NAME>
"""
import numpy as np
from model.AbstractRecommender import SeqAbstractRecommend... |
library/python/symbols/python/ut/test_ctypes.py | ibr11/catboost | 6,989 | 11183608 | <gh_stars>1000+
from ctypes import (
byref, POINTER, c_int, c_char, c_char_p,
c_void_p, py_object, c_ssize_t, pythonapi, Structure
)
c_ssize_p = POINTER(c_ssize_t)
class Py_buffer(Structure):
_fields_ = [
('buf', c_void_p),
('obj', py_object),
('len', c_ssize_t),
('itemsiz... |
tests/test_model_lognormal.py | confusedcrib/riskquant | 567 | 11183657 | import unittest
from riskquant.model import lognormal_magnitude
class MyTestCase(unittest.TestCase):
def setUp(self):
self.logn = lognormal_magnitude.LognormalMagnitude(1, 10)
def testDistribution(self):
# We defined the cdf(low) ~ 0.05 and the cdf(hi) ~ 0.95 so that
# it would be th... |
meteostat/series/fetch.py | mitchkaden/meteostat-python | 133 | 11183677 | <gh_stars>100-1000
"""
Fetch Data
Meteorological data provided by Meteostat (https://dev.meteostat.net)
under the terms of the Creative Commons Attribution-NonCommercial
4.0 International Public License.
The code is licensed under the MIT license.
"""
from copy import copy
import pandas as pd
def fetch(self) -> pd... |
moya/cache/disabledcache.py | moyaproject/moya | 129 | 11183689 | from __future__ import unicode_literals
from .base import Cache
class DisabledCache(Cache):
cache_backend_name = "disabled"
enabled = False
def get(self, key, default=None):
return default
def set(self, key, value, time=0):
pass
def delete(self, key):
pass
|
urizen/core/tile.py | vurmux/urizen | 107 | 11183742 | #!/usr/bin/python3
class Tile(object):
"""
Tile class
Attributes:
name -- Metatile name
index -- Tile index
orientation -- Tile orientation for non-default metatile geometry
frame -- Tile frame for animated tiles
image -- PIL Image of a tile
tileset_name -- Name of the tileset
... |
janitor/functions/select_columns.py | farhanreynaldo/pyjanitor | 674 | 11183749 | <reponame>farhanreynaldo/pyjanitor<filename>janitor/functions/select_columns.py
import pandas_flavor as pf
import pandas as pd
from janitor.utils import deprecated_alias
from janitor.functions.utils import _select_column_names
from pandas.api.types import is_list_like
@pf.register_dataframe_method
@deprecated_alias... |
pycaw/api/endpointvolume/__init__.py | Jan-Zeiseweis/pycaw | 234 | 11183773 | <reponame>Jan-Zeiseweis/pycaw<gh_stars>100-1000
from ctypes import HRESULT, POINTER, c_float
from ctypes.wintypes import BOOL, DWORD, UINT
from comtypes import COMMETHOD, GUID, IUnknown
from .depend import PAUDIO_VOLUME_NOTIFICATION_DATA
class IAudioEndpointVolumeCallback(IUnknown):
_iid_ = GUID('{b1136c83-b6b5... |
src/pipelines/epidemiology/us_imperial.py | chrismayemba/covid-19-open-data | 430 | 11183793 | # 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 agreed to in writing, ... |
alipay/aop/api/domain/AlipayPcreditLoanCollateralCarModifyModel.py | snowxmas/alipay-sdk-python-all | 213 | 11183807 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayPcreditLoanCollateralCarModifyModel(object):
def __init__(self):
self._apply_no = None
self._car_brand_id = None
self._car_brand_name = None
self._car_color ... |
alipay/aop/api/domain/BenefitDetailInfo.py | antopen/alipay-sdk-python-all | 213 | 11183811 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.BenefitAmountInfo import BenefitAmountInfo
from alipay.aop.api.domain.BenefitDateInfo import BenefitDateInfo
from alipay.aop.api.domain.BenefitDisplayInfo import BenefitDisplayInfo
... |
python/runtime/model/metadata_test.py | lhw362950217/sqlflow | 4,742 | 11183824 | # Copyright 2020 The SQLFlow Authors. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
os/example_getenv.py | Carglglz/micropython-lib | 1,556 | 11183857 | <gh_stars>1000+
import os
print(os.getenv("HOME", "def"))
|
pypy/module/binascii/moduledef.py | nanjekyejoannah/pypy | 381 | 11183868 |
"""
Mixed-module definition for the binascii module.
Note that there is also a pure Python implementation in lib_pypy/binascii.py;
the pypy/module/binascii/ version takes precedence if it is enabled.
"""
from pypy.interpreter.mixedmodule import MixedModule
class Module(MixedModule):
"""binascii - Conversion bet... |
data_analysis/study_numpy/numpy_functions/np_arange.py | 2581676612/python | 112 | 11183870 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 17-9-7 下午3:10
# @Author : Tom.Lee
# @File : np_arange.py
# @Product : PyCharm
# @Docs :
# @Source :
import numpy as np
# 四维数组
t = np.arange(3 * 4 * 5 * 6).reshape((3, 4, 5, 6))
print len(t), len(t[0]), len(... |
src/dal_select2/fields.py | robertispas/django-autocomplete-light | 1,368 | 11183872 | """Select2 field implementation module."""
from django.forms import ChoiceField
class ChoiceCallable:
def __init__(self, choices):
self.choices = choices
def __call__(self):
result = []
choices = self.choices() if callable(self.choices) else self.choices
for choice in choices... |
examples/volumetric/probePoints.py | evanphilip/vedo | 836 | 11183891 | """Probe a voxel dataset at specified points
and plot a histogram of the values"""
from vedo import *
from vedo.pyplot import histogram
import numpy as np
vol = Volume(dataurl+'embryo.slc')
pts = np.random.rand(5000, 3)*256
mpts = probePoints(vol, pts).pointSize(3)
mpts.print()
# valid = mpts.pointdata['vtkValidPoi... |
packages/pyright-internal/src/tests/samples/genericTypes78.py | martindemello/pyright | 3,934 | 11183926 | # This sample tests the case where a generic function
# returns a generic Callable.
from typing import Callable, TypeVar
_T = TypeVar("_T")
def func1(val1: _T) -> Callable[[_T], None]:
def f(a: str):
...
# This should generate an error because str isn't
# compatible with _T.
return f
def... |
napari/_vispy/visuals/image.py | MaksHess/napari | 1,345 | 11183946 | <gh_stars>1000+
from vispy.scene.visuals import Image as BaseImage
# If data is not present, we need bounds to be None (see napari#3517)
class Image(BaseImage):
def _compute_bounds(self, axis, view):
if self._data is None:
return None
elif axis > 1:
return (0, 0)
el... |
qmpy/web/views/materials/element_groups.py | tachyontraveler/qmpy | 103 | 11183950 | from django.template import RequestContext
from django.shortcuts import render_to_response
from django.template.context_processors import csrf
from qmpy.data import element_groups
def element_group_view(request):
data = {}
data["element_groups"] = dict(
[(k, ", ".join(v)) for k, v in list(element_gro... |
neurvps/models/__init__.py | keatonkraiger/neurvps | 133 | 11183968 | from .hourglass_pose import hg
from .vanishing_net import VanishingNet
|
react/__init__.py | kjkta/python-react | 1,603 | 11183998 | <filename>react/__init__.py
__version__ = '4.3.0'
default_app_config = 'react.apps.ReactConfig' |
tools/crates/lib/consts.py | chromium/chromium | 14,668 | 11184011 | # python3
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import re
from datetime import datetime
CRATES_IO_VIEW = "https://crates.io/crates/{crate}"
CRATES_IO_DOWNLOAD = "https://static.crates.... |
notebook/calendar_day_of_nth_dow.py | vhn0912/python-snippets | 174 | 11184047 | import calendar
import datetime
def get_day_of_nth_dow(year, month, nth, dow):
'''dow: Monday(0) - Sunday(6)'''
if nth < 1 or dow < 0 or dow > 6:
return None
first_dow, n = calendar.monthrange(year, month)
day = 7 * (nth - 1) + (dow - first_dow) % 7 + 1
return day if day <= n else... |
airmozilla/new/views.py | mozilla/airmozilla | 115 | 11184092 | <reponame>mozilla/airmozilla
# -*- coding: utf-8 -*-
import json
import os
from cStringIO import StringIO
from xml.parsers.expat import ExpatError
import requests
import xmltodict
from PIL import Image
from slugify import slugify
from django import http
from django.shortcuts import render, get_object_or_404, redirec... |
create_submission.py | hoytak/diabetic-retinopathy-code-private | 103 | 11184098 | import graphlab as gl
import re
import random
from copy import copy
import os
import graphlab.aggregate as agg
import array
import sys
# gl.set_runtime_config("GRAPHLAB_CACHE_FILE_LOCATIONS", os.path.expanduser("~/data/tmp/"))
model_path = "/data/hoytak/diabetic/models/models/model-0-pooling-3"
train_sf = []
test_s... |
Configuration/ProcessModifiers/python/genJetSubEvent_cff.py | ckamtsikis/cmssw | 852 | 11184128 | import FWCore.ParameterSet.Config as cms
genJetSubEvent = cms.Modifier()
|
release/src/router/samba3/source/python/gtkdictbrowser.py | ghsecuritylab/tomato_egg | 278 | 11184149 | <gh_stars>100-1000
#!/usr/bin/python
#
# Browse a Python dictionary in a two pane graphical interface written
# in GTK.
#
# The GtkDictBrowser class is supposed to be generic enough to allow
# applications to override enough methods and produce a
# domain-specific browser provided the information is presented as a
# Py... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.