hexsha stringlengths 40 40 | size int64 4 996k | ext stringclasses 8
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 4 996k | avg_line_length float64 1.33 58.2k | max_line_length int64 2 323k | alphanum_fraction float64 0 0.97 | content_no_comment stringlengths 0 946k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
790b34773520eea8188589b367d6905a106d2963 | 14,543 | py | Python | pre_commit/main.py | utek/pre-commit | 282527ef16588b943fe7c2ab8aadd3269946922f | [
"MIT"
] | null | null | null | pre_commit/main.py | utek/pre-commit | 282527ef16588b943fe7c2ab8aadd3269946922f | [
"MIT"
] | null | null | null | pre_commit/main.py | utek/pre-commit | 282527ef16588b943fe7c2ab8aadd3269946922f | [
"MIT"
] | null | null | null | import argparse
import logging
import os
import sys
from typing import Any
from typing import Optional
from typing import Sequence
from typing import Union
import pre_commit.constants as C
from pre_commit import color
from pre_commit import git
from pre_commit.commands.autoupdate import autoupdate
from pre_commit.comm... | 35.384428 | 79 | 0.638864 | import argparse
import logging
import os
import sys
from typing import Any
from typing import Optional
from typing import Sequence
from typing import Union
import pre_commit.constants as C
from pre_commit import color
from pre_commit import git
from pre_commit.commands.autoupdate import autoupdate
from pre_commit.comm... | true | true |
790b34d7ab15c08ea0abc256b7e65c13114a4651 | 45,383 | py | Python | tensorflow_model_analysis/api/model_eval_lib.py | Bobgy/model-analysis | a964d2e8430b447c898d271fb6e6d8f5b99adf4b | [
"Apache-2.0"
] | null | null | null | tensorflow_model_analysis/api/model_eval_lib.py | Bobgy/model-analysis | a964d2e8430b447c898d271fb6e6d8f5b99adf4b | [
"Apache-2.0"
] | 1 | 2020-03-03T03:34:37.000Z | 2020-03-03T03:34:37.000Z | tensorflow_model_analysis/api/model_eval_lib.py | Bobgy/model-analysis | a964d2e8430b447c898d271fb6e6d8f5b99adf4b | [
"Apache-2.0"
] | null | null | null | # Lint as: python3
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | 42.138347 | 82 | 0.721019 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import pickle
import tempfile
from typing import Any, Dict, List, NamedTuple, Optional, Text, Tuple, Union
import apache_beam as beam
import six
import tensorflow as tf
from tens... | true | true |
790b35051ca753b6a976f562d7c99939df28b5f2 | 269 | py | Python | src/hdcp_source.py | imamotts/hdcp_test | 0830829037a8d8e107f75e9a306179bf3f164d10 | [
"MIT"
] | 3 | 2017-01-06T08:24:44.000Z | 2020-07-13T03:19:58.000Z | src/hdcp_source.py | imamotts/hdcp_test | 0830829037a8d8e107f75e9a306179bf3f164d10 | [
"MIT"
] | null | null | null | src/hdcp_source.py | imamotts/hdcp_test | 0830829037a8d8e107f75e9a306179bf3f164d10 | [
"MIT"
] | 1 | 2021-10-13T08:55:47.000Z | 2021-10-13T08:55:47.000Z |
import yaml
class HdcpSource:
def __init__(self, conf_yaml):
f = open(conf_yaml, "r")
conf = yaml.load(f)
f.close()
def process_request(req):
msg_type, msg = req
if __name__ == "__main__":
HdcpSource("yaml/rx1.yaml")
| 14.157895 | 34 | 0.583643 |
import yaml
class HdcpSource:
def __init__(self, conf_yaml):
f = open(conf_yaml, "r")
conf = yaml.load(f)
f.close()
def process_request(req):
msg_type, msg = req
if __name__ == "__main__":
HdcpSource("yaml/rx1.yaml")
| true | true |
790b3807375d1144379c018e82b0ad95968c4ace | 205 | py | Python | examples/get_file_name_demo.py | smilelight/lightUtils | e9b7ed35ed50cf6b7c6284fe60918ce4dc71beac | [
"MIT"
] | 2 | 2020-01-23T02:03:19.000Z | 2020-12-13T09:05:45.000Z | examples/get_file_name_demo.py | smilelight/lightUtils | e9b7ed35ed50cf6b7c6284fe60918ce4dc71beac | [
"MIT"
] | null | null | null | examples/get_file_name_demo.py | smilelight/lightUtils | e9b7ed35ed50cf6b7c6284fe60918ce4dc71beac | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# @Time : 2020/7/7 9:11
# @Author : lightsmile
# @Software: PyCharm
from lightutils import get_file_name
if __name__ == '__main__':
print(get_file_name("hello_world.py"))
| 20.5 | 42 | 0.663415 |
from lightutils import get_file_name
if __name__ == '__main__':
print(get_file_name("hello_world.py"))
| true | true |
790b398ee916546032454898d539b421420123e1 | 329 | py | Python | examples/crashing.py | diconart/zerogw | 6bd124a470424fbf32b3a2fb51b6fbd8c4ca2f13 | [
"MIT"
] | 83 | 2015-01-11T06:08:43.000Z | 2021-03-31T00:41:11.000Z | examples/crashing.py | asvetlov/zerogw | b8728862ba28368b8d306c1b674c9c264a25b575 | [
"MIT"
] | 7 | 2015-05-26T12:03:35.000Z | 2020-02-25T11:28:33.000Z | examples/crashing.py | asvetlov/zerogw | b8728862ba28368b8d306c1b674c9c264a25b575 | [
"MIT"
] | 12 | 2015-04-20T16:29:25.000Z | 2019-03-15T14:04:58.000Z | import zmq
import random
ctx = zmq.Context(1)
sock = ctx.socket(zmq.REP)
sock.connect('tcp://127.0.0.1:7001')
while True:
parts = sock.recv_multipart()
print("GOT", parts)
if random.randrange(3) == 0:
import os, signal
os.kill(os.getpid(), signal.SIGKILL)
sock.send(b"Echo: " + b' '.join... | 23.5 | 44 | 0.62614 | import zmq
import random
ctx = zmq.Context(1)
sock = ctx.socket(zmq.REP)
sock.connect('tcp://127.0.0.1:7001')
while True:
parts = sock.recv_multipart()
print("GOT", parts)
if random.randrange(3) == 0:
import os, signal
os.kill(os.getpid(), signal.SIGKILL)
sock.send(b"Echo: " + b' '.join... | true | true |
790b3b06a9335fb7a81c645f577f8954748f0c35 | 4,030 | py | Python | Raw_Socket_Protos/rawIPV4.py | UsamaMehboob/RawSocketsPython | 04277efed77a75653cc0f006c787659bd8beac32 | [
"MIT"
] | 1 | 2020-04-08T09:29:03.000Z | 2020-04-08T09:29:03.000Z | Raw_Socket_Protos/rawIPV4.py | UsamaMehboob/RawSocketsPython | 04277efed77a75653cc0f006c787659bd8beac32 | [
"MIT"
] | null | null | null | Raw_Socket_Protos/rawIPV4.py | UsamaMehboob/RawSocketsPython | 04277efed77a75653cc0f006c787659bd8beac32 | [
"MIT"
] | 1 | 2020-04-08T09:29:12.000Z | 2020-04-08T09:29:12.000Z | import struct
import socket
import ipaddress
from .utils import calculate_checksum
IPV4_HEAD_FMT="!BBHHHBBHII" #H is unsigned short (2 bytes) ! is for network (big-endian)
class IPV4Datagram:
"""
This class contains 20 bytes IPV4 Datagram
https://en.wikipedia.org/wiki/IPv4
|0|1|2|3|4|5|6|7|8|9|10|11|1... | 48.554217 | 135 | 0.531762 | import struct
import socket
import ipaddress
from .utils import calculate_checksum
IPV4_HEAD_FMT="!BBHHHBBHII"
class IPV4Datagram:
def __init__(self, source_ip="1.1.1.1",destination_ip="1.1.1.1" , version=4, ihl=5, tos=0,identification=54321,fragment_offset = 0,
ttl=253,protocol = socket.IPPROT... | true | true |
790b3dcead80e5e0b06be7a487cb1e8db6cf319d | 10,880 | py | Python | bot.py | XMYSTERlOUSX/ssh-creator-bot | 68452adac6dfcc81629cd8d23d7631827e12c6b6 | [
"Apache-2.0"
] | null | null | null | bot.py | XMYSTERlOUSX/ssh-creator-bot | 68452adac6dfcc81629cd8d23d7631827e12c6b6 | [
"Apache-2.0"
] | null | null | null | bot.py | XMYSTERlOUSX/ssh-creator-bot | 68452adac6dfcc81629cd8d23d7631827e12c6b6 | [
"Apache-2.0"
] | null | null | null | import random
import string
import time
import os
try:
import telepot
from telepot.loop import MessageLoop
except:
os.system('pip install telepot --user')
try:
import requests
except:
os.system('pip install requests --user')
class host:
def __init__(self, host):
h = ho... | 44.048583 | 1,093 | 0.536581 | import random
import string
import time
import os
try:
import telepot
from telepot.loop import MessageLoop
except:
os.system('pip install telepot --user')
try:
import requests
except:
os.system('pip install requests --user')
class host:
def __init__(self, host):
h = ho... | true | true |
790b3e5fb14d6e8d518bcda3bda455a223e93fe5 | 6,679 | py | Python | adafruit_bus_device/i2c_device.py | rhthomas/Adafruit_CircuitPython_NRF24L01 | a8507fca5585b1f2d1258a24a51f360be336142a | [
"MIT"
] | null | null | null | adafruit_bus_device/i2c_device.py | rhthomas/Adafruit_CircuitPython_NRF24L01 | a8507fca5585b1f2d1258a24a51f360be336142a | [
"MIT"
] | null | null | null | adafruit_bus_device/i2c_device.py | rhthomas/Adafruit_CircuitPython_NRF24L01 | a8507fca5585b1f2d1258a24a51f360be336142a | [
"MIT"
] | 4 | 2019-06-21T00:01:04.000Z | 2021-11-17T08:49:51.000Z | # The MIT License (MIT)
#
# Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the ... | 40.23494 | 91 | 0.636473 |
__version__ = "3.0.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_BusDevice.git"
class I2CDevice:
def __init__(self, i2c, device_address):
while not i2c.try_lock():
pass
try:
i2c.writeto(device_address, b'')
except OSError:
... | true | true |
790b3f0878cde69c567ac20a3f2110095bd45e49 | 50,944 | py | Python | src/sage/functions/piecewise.py | hsm207/sage | 020bd59ec28717bfab9af44d2231c53da1ff99f1 | [
"BSL-1.0"
] | 4 | 2020-07-17T04:49:44.000Z | 2020-07-29T06:33:51.000Z | src/sage/functions/piecewise.py | Ivo-Maffei/sage | 467fbc70a08b552b3de33d9065204ee9cbfb02c7 | [
"BSL-1.0"
] | 1 | 2020-04-18T16:30:43.000Z | 2020-04-18T16:30:43.000Z | src/sage/functions/piecewise.py | dimpase/sage | 468f23815ade42a2192b0a9cd378de8fdc594dcd | [
"BSL-1.0"
] | null | null | null | r"""
Piecewise-defined Functions
This module implement piecewise functions in a single variable. See
:mod:`sage.sets.real_set` for more information about how to construct
subsets of the real line for the domains.
EXAMPLES::
sage: f = piecewise([((0,1), x^3), ([-1,0], -x^2)]); f
piecewise(x|-->x^3 on (0, 1),... | 36.942712 | 272 | 0.457816 |
from __future__ import absolute_import, division, print_function
from sage.symbolic.function import BuiltinFunction
from sage.sets.real_set import RealSet
from sage.symbolic.ring import SR
from sage.rings.infinity import minus_infinity, infinity
class PiecewiseFunction(BuiltinFunction):
def __init__... | true | true |
790b40cd1d4b459ce34cb5c965af23b74dee9a12 | 444 | py | Python | accounts/migrations/0004_auto_20201019_1200.py | Dev-Mehta/AskaDev | 4514383cb1f94178e8082f0b710c7efbdd3225a7 | [
"MIT"
] | 7 | 2020-08-26T12:32:50.000Z | 2020-09-20T09:17:12.000Z | accounts/migrations/0004_auto_20201019_1200.py | Dev-Mehta/AskaDev | 4514383cb1f94178e8082f0b710c7efbdd3225a7 | [
"MIT"
] | null | null | null | accounts/migrations/0004_auto_20201019_1200.py | Dev-Mehta/AskaDev | 4514383cb1f94178e8082f0b710c7efbdd3225a7 | [
"MIT"
] | 3 | 2020-08-27T06:06:43.000Z | 2020-10-10T15:53:26.000Z | # Generated by Django 3.0 on 2020-10-19 06:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_auto_20200922_1738'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='id',
... | 23.368421 | 108 | 0.628378 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_auto_20200922_1738'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='id',
field=models.AutoField(auto_created... | true | true |
790b41b3dd8834829b1b5ea6c01ae8d77974220d | 25,381 | py | Python | elasticsearch_dsl/search.py | cfpb/elasticsearch-dsl-py | 8abbeca9c000074eb1d627272790a97233848f8e | [
"Apache-2.0"
] | null | null | null | elasticsearch_dsl/search.py | cfpb/elasticsearch-dsl-py | 8abbeca9c000074eb1d627272790a97233848f8e | [
"Apache-2.0"
] | null | null | null | elasticsearch_dsl/search.py | cfpb/elasticsearch-dsl-py | 8abbeca9c000074eb1d627272790a97233848f8e | [
"Apache-2.0"
] | 1 | 2020-10-01T14:52:27.000Z | 2020-10-01T14:52:27.000Z | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... | 31.104167 | 105 | 0.560065 |
import copy
try:
import collections.abc as collections_abc
except ImportError:
import collections as collections_abc
from six import iteritems, string_types
from elasticsearch7.helpers import scan
from elasticsearch7.exceptions import TransportError
from .query import Q, Bool
from .aggs i... | true | true |
790b42c839725716a3e3214198a6178998c23ccf | 7,887 | py | Python | examples/wmt/tools/align/extract_bilingual_vocabulary.py | godweiyang/ParaGen | 9665d1244ea38a41fc06b4e0a7f6411985e2221f | [
"Apache-2.0"
] | 50 | 2022-01-18T07:25:46.000Z | 2022-03-14T13:06:18.000Z | examples/wmt/tools/align/extract_bilingual_vocabulary.py | JiangtaoFeng/ParaGen | 509334bf16e3674e009bb9dc37ecc38ae3b5c977 | [
"Apache-2.0"
] | 2 | 2022-01-19T09:36:42.000Z | 2022-02-23T07:16:02.000Z | examples/wmt/tools/align/extract_bilingual_vocabulary.py | JiangtaoFeng/ParaGen | 509334bf16e3674e009bb9dc37ecc38ae3b5c977 | [
"Apache-2.0"
] | 6 | 2022-01-19T09:28:53.000Z | 2022-03-10T10:20:08.000Z | import argparse
import json
import os
from collections import Counter, defaultdict
from helper import _is_token_alnum
THRESHOLD = 0.01
GAP = 10
def get_full_mapping(src_filename, trg_filename, align_filename,
mapping_filename, reverse_src2trg=False, lowercase=True):
""" Get full mapping giv... | 37.918269 | 85 | 0.52035 | import argparse
import json
import os
from collections import Counter, defaultdict
from helper import _is_token_alnum
THRESHOLD = 0.01
GAP = 10
def get_full_mapping(src_filename, trg_filename, align_filename,
mapping_filename, reverse_src2trg=False, lowercase=True):
print('src: {}, trg: {},... | true | true |
790b43070866a446cdd819e9d236dc0f36072554 | 10,302 | py | Python | JIT_Baseline/baseline.py | ZZR0/ISSTA21-JIT-DP | c2916f7c3b1d235ff2858220886d6a7da068bf8a | [
"MIT"
] | 14 | 2021-07-12T07:29:57.000Z | 2022-01-18T07:01:46.000Z | JIT_Baseline/baseline.py | ZZR0/ISSTA21-JIT-DP | c2916f7c3b1d235ff2858220886d6a7da068bf8a | [
"MIT"
] | null | null | null | JIT_Baseline/baseline.py | ZZR0/ISSTA21-JIT-DP | c2916f7c3b1d235ff2858220886d6a7da068bf8a | [
"MIT"
] | 7 | 2021-05-19T21:51:36.000Z | 2022-03-29T13:57:54.000Z | import math
import random
import time
import argparse
from sklearn import preprocessing
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score, precision_score, recall_score, roc_curve, auc
import pandas as pd
import numpy as np
import torch.nn as nn
import torch
from LR import... | 35.402062 | 122 | 0.631722 | import math
import random
import time
import argparse
from sklearn import preprocessing
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score, precision_score, recall_score, roc_curve, auc
import pandas as pd
import numpy as np
import torch.nn as nn
import torch
from LR import... | true | true |
790b43c41ba693b53623a612b0afe868c0fa7c66 | 2,958 | py | Python | pennylane_cirq/cirq_operation.py | tonybruguier/pennylane-cirq | 48db8bbdfd234516c8e4704e097a37a8ea45e8fd | [
"Apache-2.0"
] | 21 | 2020-08-06T16:16:07.000Z | 2022-03-24T06:25:28.000Z | pennylane_cirq/cirq_operation.py | tonybruguier/pennylane-cirq | 48db8bbdfd234516c8e4704e097a37a8ea45e8fd | [
"Apache-2.0"
] | 67 | 2020-07-28T07:42:58.000Z | 2022-03-24T14:32:59.000Z | pennylane_cirq/cirq_operation.py | tonybruguier/pennylane-cirq | 48db8bbdfd234516c8e4704e097a37a8ea45e8fd | [
"Apache-2.0"
] | 10 | 2020-10-14T15:13:13.000Z | 2022-02-20T10:51:38.000Z | # Copyright 2019-2020 Xanadu Quantum Technologies 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... | 33.235955 | 97 | 0.694388 |
from collections.abc import Sequence
import cirq
import pennylane as qml
class CirqOperation:
def __init__(self, parametrization):
self.parametrization = parametrization
self.parametrized_cirq_gates = None
self.is_inverse = False
def parametrize(self, *args):
se... | true | true |
790b43fed1d81433a5aa762856647e244de191b7 | 8,505 | py | Python | src/model/encoder_decoder_module.py | saridormi/commit_message_generation | c25db61a5f41accfb566caaea5feb0d275751293 | [
"MIT"
] | 1 | 2021-01-15T13:17:33.000Z | 2021-01-15T13:17:33.000Z | src/model/encoder_decoder_module.py | saridormi/commit_message_generation | c25db61a5f41accfb566caaea5feb0d275751293 | [
"MIT"
] | 1 | 2020-11-10T13:44:26.000Z | 2020-11-26T15:20:42.000Z | src/model/encoder_decoder_module.py | saridormi/commit_message_generation | c25db61a5f41accfb566caaea5feb0d275751293 | [
"MIT"
] | null | null | null | from copy import copy
from typing import Optional
import torch
import pytorch_lightning as pl
from transformers import (
EncoderDecoderModel,
RobertaModel,
RobertaConfig,
GPT2LMHeadModel,
GPT2Config,
RobertaTokenizer,
GPT2Tokenizer,
AdamW,
get_linear_schedule_with_warmup,
)
import ... | 42.313433 | 124 | 0.663139 | from copy import copy
from typing import Optional
import torch
import pytorch_lightning as pl
from transformers import (
EncoderDecoderModel,
RobertaModel,
RobertaConfig,
GPT2LMHeadModel,
GPT2Config,
RobertaTokenizer,
GPT2Tokenizer,
AdamW,
get_linear_schedule_with_warmup,
)
import ... | true | true |
790b4408c840cdd98f96427833a0a90fcceb1cf2 | 3,887 | py | Python | test/data/test_common_data_multiprocess.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | 1 | 2018-12-09T06:09:29.000Z | 2018-12-09T06:09:29.000Z | test/data/test_common_data_multiprocess.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | null | null | null | test/data/test_common_data_multiprocess.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
import sys
import traceback
import numpy as np
import os
import Putil.base.logger as plog
plog.PutilLogConfig.config_file_handler(filename='./test/data/_log_test_common_data_multiprocess.log', mode='w')
plog.PutilLogConfig.config_log_level(stream=plog.INFO, file=plog.DEBUG)
plog.PutilLogConfig.config_fo... | 29.225564 | 112 | 0.621045 |
import sys
import traceback
import numpy as np
import os
import Putil.base.logger as plog
plog.PutilLogConfig.config_file_handler(filename='./test/data/_log_test_common_data_multiprocess.log', mode='w')
plog.PutilLogConfig.config_log_level(stream=plog.INFO, file=plog.DEBUG)
plog.PutilLogConfig.config_format(plog.Form... | true | true |
790b4442fff9865e295ebbcbe378b193f872cc15 | 299 | py | Python | pypv/scripts/sun_path.py | TomLXXVI/pypv | df3dfba586bdec171e3fa9795b7bae48f76f83f2 | [
"MIT"
] | null | null | null | pypv/scripts/sun_path.py | TomLXXVI/pypv | df3dfba586bdec171e3fa9795b7bae48f76f83f2 | [
"MIT"
] | null | null | null | pypv/scripts/sun_path.py | TomLXXVI/pypv | df3dfba586bdec171e3fa9795b7bae48f76f83f2 | [
"MIT"
] | 1 | 2022-03-09T06:26:28.000Z | 2022-03-09T06:26:28.000Z | from sun.geometry import Location, SunPath
from date_time import Date
loc = Location(
name='Ghent',
region='Belgium',
latitude=51.07,
longitude=3.69,
timezone='Europe/Brussels',
altitude=9.0
)
date = Date(year=2019, month=7, day=29)
sp = SunPath(loc, date)
sp.print_table()
| 19.933333 | 42 | 0.682274 | from sun.geometry import Location, SunPath
from date_time import Date
loc = Location(
name='Ghent',
region='Belgium',
latitude=51.07,
longitude=3.69,
timezone='Europe/Brussels',
altitude=9.0
)
date = Date(year=2019, month=7, day=29)
sp = SunPath(loc, date)
sp.print_table()
| true | true |
790b448853419d178189e69c3ab9a004b01917ac | 2,231 | py | Python | jupyter_notebook_config.py | colinjbrown/dfext-dockerstack | 9496793162c67707fd8bb0b0207392b3d4f651b9 | [
"BSD-3-Clause"
] | null | null | null | jupyter_notebook_config.py | colinjbrown/dfext-dockerstack | 9496793162c67707fd8bb0b0207392b3d4f651b9 | [
"BSD-3-Clause"
] | null | null | null | jupyter_notebook_config.py | colinjbrown/dfext-dockerstack | 9496793162c67707fd8bb0b0207392b3d4f651b9 | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from jupyter_core.paths import jupyter_data_dir
import subprocess
import os
import errno
import stat
c = get_config() # noqa: F821
c.NotebookApp.ip = "0.0.0.0"
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = F... | 31.422535 | 142 | 0.636934 |
from jupyter_core.paths import jupyter_data_dir
import subprocess
import os
import errno
import stat
c = get_config()
c.NotebookApp.ip = "0.0.0.0"
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = False
c.Spawner.args = ['--NotebookApp.tornado_settings={"headers":{"Content-Security-Policy": "frame-ancestors... | true | true |
790b44aca3f687434ba362d7b3c00873f8ece524 | 10,602 | py | Python | example_client/multi_inputs.py | Xaenalt/model_server | f977dbf1246ebf85e960ca058e814deac7c6a16c | [
"Apache-2.0"
] | 305 | 2018-10-01T12:41:28.000Z | 2020-04-24T10:36:08.000Z | example_client/multi_inputs.py | Xaenalt/model_server | f977dbf1246ebf85e960ca058e814deac7c6a16c | [
"Apache-2.0"
] | 199 | 2020-04-29T08:43:21.000Z | 2022-03-29T09:05:52.000Z | example_client/multi_inputs.py | Xaenalt/model_server | f977dbf1246ebf85e960ca058e814deac7c6a16c | [
"Apache-2.0"
] | 80 | 2020-04-29T14:54:41.000Z | 2022-03-30T14:50:29.000Z | #
# Copyright (c) 2019-2020 Intel Corporation
#
# 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 agre... | 36.43299 | 91 | 0.658083 |
from __future__ import print_function
from argparse import ArgumentParser, SUPPRESS
from tensorflow_serving.apis import predict_pb2
from tensorflow_serving.apis import prediction_service_pb2_grpc
from time import time, sleep
import sys
import os
import cv2
import grpc
import threading
import... | true | true |
790b457c2b67f172a92496547778a9b74a81f161 | 5,460 | py | Python | improver_tests/ensemble_copula_coupling/ensemble_copula_coupling/test_ConvertLocationAndScaleParameters.py | LaurenceBeard/improver | b7cfe44f3a802d2a3d65f76a325215033c9de074 | [
"BSD-3-Clause"
] | null | null | null | improver_tests/ensemble_copula_coupling/ensemble_copula_coupling/test_ConvertLocationAndScaleParameters.py | LaurenceBeard/improver | b7cfe44f3a802d2a3d65f76a325215033c9de074 | [
"BSD-3-Clause"
] | 2 | 2020-03-30T17:25:18.000Z | 2021-06-25T15:30:29.000Z | improver_tests/ensemble_copula_coupling/ensemble_copula_coupling/test_ConvertLocationAndScaleParameters.py | LaurenceBeard/improver | b7cfe44f3a802d2a3d65f76a325215033c9de074 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2019 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | 41.679389 | 79 | 0.694139 |
import unittest
import numpy as np
from scipy import stats
from iris.tests import IrisTest
from improver.ensemble_copula_coupling.ensemble_copula_coupling import (
ConvertLocationAndScaleParameters as Plugin)
class Test__init__(IrisTest):
def test_valid_distribution(self):
... | true | true |
790b4699dd5dd31c9f37723a99fcf6ed5a48c298 | 2,002 | py | Python | tests/unittests/completion/complete.py | wilzbach/storyscript-sls | d71d74a53852ebae54bdaab341678b04f2775411 | [
"Apache-2.0"
] | null | null | null | tests/unittests/completion/complete.py | wilzbach/storyscript-sls | d71d74a53852ebae54bdaab341678b04f2775411 | [
"Apache-2.0"
] | null | null | null | tests/unittests/completion/complete.py | wilzbach/storyscript-sls | d71d74a53852ebae54bdaab341678b04f2775411 | [
"Apache-2.0"
] | null | null | null | from unittest.mock import call
from sls.completion.complete import Completion
from sls.completion.context import CompletionContext
from sls.document import Document
import sls.sentry as sentry
def test_complete(magic, patch):
patch.init(Document)
patch.many(Document, ["line_to_cursor", "word_to_cursor"])
... | 29.880597 | 76 | 0.653846 | from unittest.mock import call
from sls.completion.complete import Completion
from sls.completion.context import CompletionContext
from sls.document import Document
import sls.sentry as sentry
def test_complete(magic, patch):
patch.init(Document)
patch.many(Document, ["line_to_cursor", "word_to_cursor"])
... | true | true |
790b47d371223d86c745da820c22453f2e1f195c | 14,205 | py | Python | google/cloud/vision/v1p3beta1/vision-v1p3beta1-py/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 7 | 2021-02-21T10:39:41.000Z | 2021-12-07T07:31:28.000Z | google/cloud/vision/v1p3beta1/vision-v1p3beta1-py/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 6 | 2021-02-02T23:46:11.000Z | 2021-11-15T01:46:02.000Z | google/cloud/vision/v1p3beta1/vision-v1p3beta1-py/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 4 | 2021-01-28T23:25:45.000Z | 2021-08-30T01:55:16.000Z | # -*- coding: utf-8 -*-
# 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... | 45.822581 | 94 | 0.638226 |
import warnings
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
from google.api_core import grpc_helpers
from google.api_core import operations_v1
from google.api_core import gapic_v1
import google.auth
from google.auth import credentials as ga_cr... | true | true |
790b483c1a649cac7ac504a8b759324430b31b1f | 8,241 | py | Python | cumulusci/robotframework/CumulusCI.py | jdominiczak/CumulusCI | f706c1906f9eb6d604c571a9dd16f5d0ed38599f | [
"BSD-3-Clause"
] | null | null | null | cumulusci/robotframework/CumulusCI.py | jdominiczak/CumulusCI | f706c1906f9eb6d604c571a9dd16f5d0ed38599f | [
"BSD-3-Clause"
] | null | null | null | cumulusci/robotframework/CumulusCI.py | jdominiczak/CumulusCI | f706c1906f9eb6d604c571a9dd16f5d0ed38599f | [
"BSD-3-Clause"
] | null | null | null | import logging
from robot.api import logger
from robot.libraries.BuiltIn import BuiltIn
from simple_salesforce import Salesforce
from cumulusci.cli.config import CliRuntime
from cumulusci.core.config import TaskConfig
from cumulusci.core.exceptions import TaskOptionsError
from cumulusci.core.tasks import CURRENT_TASK... | 38.509346 | 109 | 0.62638 | import logging
from robot.api import logger
from robot.libraries.BuiltIn import BuiltIn
from simple_salesforce import Salesforce
from cumulusci.cli.config import CliRuntime
from cumulusci.core.config import TaskConfig
from cumulusci.core.exceptions import TaskOptionsError
from cumulusci.core.tasks import CURRENT_TASK... | true | true |
790b491e6f3712b5dc5c12f2a5c793aae2a5f057 | 2,718 | py | Python | tests/api/test_contacts_endpoint.py | mathematicalmichael/cannlytics | acc2b8c73fd3689283b41bd275a1885fe37153a6 | [
"MIT"
] | null | null | null | tests/api/test_contacts_endpoint.py | mathematicalmichael/cannlytics | acc2b8c73fd3689283b41bd275a1885fe37153a6 | [
"MIT"
] | null | null | null | tests/api/test_contacts_endpoint.py | mathematicalmichael/cannlytics | acc2b8c73fd3689283b41bd275a1885fe37153a6 | [
"MIT"
] | null | null | null | """
Test Contacts API Endpoint | Cannlytics API
Author: Keegan Skeate
Contact: <keegan@cannlytics.com>
Created: 7/19/2021
Updated: 7/19/2021
License: MIT License <https://opensource.org/licenses/MIT>
"""
import os
import requests
from dotenv import load_dotenv
# Test using development server.
BASE = 'http://127.0.0.1... | 29.543478 | 79 | 0.513245 | import os
import requests
from dotenv import load_dotenv
BASE = 'http://127.0.0.1:8000/api'
load_dotenv('../../.env')
API_KEY = os.getenv('CANNLYTICS_API_KEY')
HEADERS = {
'Authorization': 'Bearer %s' % API_KEY,
'Content-type': 'application/json',
}
ORG_ID = 'test-company'
ENDPOINT = 'contacts'
... | true | true |
790b49b567e9535f1f3902bdb1b6cb997fb43092 | 9,907 | py | Python | tests/system/test_dbapi.py | jpburbank/python-spanner-tmp | 02114181a2baf4b178d4e67e672b45b1d49e835d | [
"Apache-2.0"
] | null | null | null | tests/system/test_dbapi.py | jpburbank/python-spanner-tmp | 02114181a2baf4b178d4e67e672b45b1d49e835d | [
"Apache-2.0"
] | null | null | null | tests/system/test_dbapi.py | jpburbank/python-spanner-tmp | 02114181a2baf4b178d4e67e672b45b1d49e835d | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 Google LLC All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 26.071053 | 84 | 0.66559 |
import hashlib
import pickle
import pytest
from google.cloud import spanner_v1
from google.cloud.spanner_dbapi.connection import Connection
from . import _helpers
DATABASE_NAME = "dbapi-txn"
DDL_STATEMENTS = (
"""CREATE TABLE contacts (
contact_id INT64,
first_name STRING(1024),
... | true | true |
790b49c6aa358e86089bdfefcaaf2050a0f02eb6 | 6,830 | py | Python | contract_api/testcases/unit_testcases/consumers/test_service_event_consumer.py | vinthedark/snet-marketplace-service | 66ed9d093b00f09d3e28ef4d86c4e4c125037d06 | [
"MIT"
] | null | null | null | contract_api/testcases/unit_testcases/consumers/test_service_event_consumer.py | vinthedark/snet-marketplace-service | 66ed9d093b00f09d3e28ef4d86c4e4c125037d06 | [
"MIT"
] | null | null | null | contract_api/testcases/unit_testcases/consumers/test_service_event_consumer.py | vinthedark/snet-marketplace-service | 66ed9d093b00f09d3e28ef4d86c4e4c125037d06 | [
"MIT"
] | null | null | null | import unittest
from datetime import datetime
from unittest.mock import patch
from common.repository import Repository
from contract_api.config import NETWORKS, NETWORK_ID
from contract_api.consumers.service_event_consumer import ServiceCreatedEventConsumer
from contract_api.dao.service_repository import ServiceReposi... | 65.047619 | 413 | 0.569985 | import unittest
from datetime import datetime
from unittest.mock import patch
from common.repository import Repository
from contract_api.config import NETWORKS, NETWORK_ID
from contract_api.consumers.service_event_consumer import ServiceCreatedEventConsumer
from contract_api.dao.service_repository import ServiceReposi... | true | true |
790b4a221e2df9c50e46d7aa03425102110463da | 1,337 | py | Python | simplestatistics/statistics/harmonic_mean.py | tmcw-up-for-adoption/simple-statistics-py | aea5de1c4b853e746c67b44734027464650abe1c | [
"MIT"
] | 92 | 2016-05-12T20:16:29.000Z | 2022-03-11T22:24:07.000Z | simplestatistics/statistics/harmonic_mean.py | sheriferson/simplestatistics | aea5de1c4b853e746c67b44734027464650abe1c | [
"MIT"
] | 6 | 2016-05-12T19:14:28.000Z | 2017-11-17T02:07:58.000Z | simplestatistics/statistics/harmonic_mean.py | sheriferson/simple-statistics-py | aea5de1c4b853e746c67b44734027464650abe1c | [
"MIT"
] | 18 | 2016-05-13T16:30:23.000Z | 2021-06-05T04:45:41.000Z | """
Implements harmonic_mean() function.
"""
from .mean import mean
def harmonic_mean(x):
"""
The `harmonic mean`_ is a kind of average that is calculated as
the reciprocal_ of the arithmetic mean of the reciprocals.
It is appropriate when calculating averages of rates_.
.. _`harmonic mean`: http... | 28.446809 | 81 | 0.617801 |
from .mean import mean
def harmonic_mean(x):
if type(x) not in [list, tuple]:
raise TypeError('harmonic_mean() expects a list or a tuple.')
reciprocals = [1 / float(num) for num in x]
return(1 / mean(reciprocals))
| true | true |
790b4a497c425262730b0b32075cdb46dedd2792 | 4,154 | py | Python | exodus/exodus.py | UAMS-DBMI/PosdaTools | 7d33605da1b88e4787a1368dbecaffda1df95e5b | [
"Apache-2.0"
] | 6 | 2019-01-17T15:47:44.000Z | 2022-02-02T16:47:25.000Z | exodus/exodus.py | UAMS-DBMI/PosdaTools | 7d33605da1b88e4787a1368dbecaffda1df95e5b | [
"Apache-2.0"
] | 23 | 2016-06-08T21:51:36.000Z | 2022-03-02T08:11:44.000Z | exodus/exodus.py | UAMS-DBMI/PosdaTools | 7d33605da1b88e4787a1368dbecaffda1df95e5b | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python3 -u
import json
import time
import os
import hashlib
import redis
from typing import NamedTuple
import requests
import psycopg2
USER=os.environ['EXODUS_USER']
PASS=os.environ['EXODUS_PASS']
RETRY_COUNT=int(os.environ['EXODUS_RETRY_COUNT'])
PSQL_DB_NAME=os.environ['EXODUS_PSQL_DB_NAME']
REDIS_HOST=o... | 29.884892 | 93 | 0.613866 |
import json
import time
import os
import hashlib
import redis
from typing import NamedTuple
import requests
import psycopg2
USER=os.environ['EXODUS_USER']
PASS=os.environ['EXODUS_PASS']
RETRY_COUNT=int(os.environ['EXODUS_RETRY_COUNT'])
PSQL_DB_NAME=os.environ['EXODUS_PSQL_DB_NAME']
REDIS_HOST=os.environ['POSDA_REDI... | true | true |
790b4abfcb0e688d48be5e849c857e886ddcb0bb | 2,003 | py | Python | Automatic extractive Text Summarization using RoBERTa/Deploy Flask app/app.py | ramachandra742/Text-Summarization-projects | 80ff101ed399a2bbbbbcecf3316a1aa8cce3b516 | [
"MIT"
] | null | null | null | Automatic extractive Text Summarization using RoBERTa/Deploy Flask app/app.py | ramachandra742/Text-Summarization-projects | 80ff101ed399a2bbbbbcecf3316a1aa8cce3b516 | [
"MIT"
] | null | null | null | Automatic extractive Text Summarization using RoBERTa/Deploy Flask app/app.py | ramachandra742/Text-Summarization-projects | 80ff101ed399a2bbbbbcecf3316a1aa8cce3b516 | [
"MIT"
] | null | null | null | from __future__ import unicode_literals
from flask import Flask,render_template,url_for,request
from text_summarization import text_summarizer
import time
import spacy
nlp = spacy.load('en_core_web_sm')
app = Flask(__name__)
# Web Scraping Pkg
from bs4 import BeautifulSoup
# from urllib.request import urlo... | 31.793651 | 182 | 0.751872 | from __future__ import unicode_literals
from flask import Flask,render_template,url_for,request
from text_summarization import text_summarizer
import time
import spacy
nlp = spacy.load('en_core_web_sm')
app = Flask(__name__)
from bs4 import BeautifulSoup
from urllib.request import urlopen
def readingT... | true | true |
790b4b2cde73f57c55c82e3db02ef2939283d73a | 1,586 | py | Python | 2021/day4_part1.py | rogall-e/advent_of_code | a8c41fb63478dd7b99c88c4fa99b7ba0bab3842d | [
"MIT"
] | null | null | null | 2021/day4_part1.py | rogall-e/advent_of_code | a8c41fb63478dd7b99c88c4fa99b7ba0bab3842d | [
"MIT"
] | null | null | null | 2021/day4_part1.py | rogall-e/advent_of_code | a8c41fb63478dd7b99c88c4fa99b7ba0bab3842d | [
"MIT"
] | null | null | null | import numpy as np # import numpy
with open("data/day4.txt") as f:
drawing_numbers = f.readline()
board_lst = []
board_line = []
counter = 0
for line in f:
if line != '\n':
board_line.append(line.strip())
if len(board_line) == 5:
board_lst.append(board_li... | 31.72 | 94 | 0.552333 | import numpy as np
with open("data/day4.txt") as f:
drawing_numbers = f.readline()
board_lst = []
board_line = []
counter = 0
for line in f:
if line != '\n':
board_line.append(line.strip())
if len(board_line) == 5:
board_lst.append(board_line)
... | true | true |
790b4ba261fe601b64808fc5eebd5c2badfc475e | 5,824 | py | Python | cron/email_receive.py | dotskapes/dotSkapes | 50228926f42a9c3bbc050b08922342a83a974755 | [
"MIT"
] | 1 | 2016-01-01T12:22:48.000Z | 2016-01-01T12:22:48.000Z | cron/email_receive.py | ptressel/sahana-eden-madpub | b16418b36d0fb781fd045f7e7edd1a30259a1f35 | [
"MIT"
] | 1 | 2016-03-11T06:05:39.000Z | 2016-03-11T06:05:39.000Z | cron/email_receive.py | dotskapes/dotSkapes | 50228926f42a9c3bbc050b08922342a83a974755 | [
"MIT"
] | 1 | 2020-04-29T13:58:31.000Z | 2020-04-29T13:58:31.000Z | # -*- coding: utf-8 -*-
# This is a simple mailbox polling script for the Sahana Messaging Module
# If there is a need to collect from non-compliant mailers then suggest using the robust Fetchmail to collect & store in a more compliant mailer!
# This script doesn't handle MIME attachments
import sys, socket, email, ... | 37.333333 | 145 | 0.589973 |
import sys, socket, email, uuid
# Read-in configuration from Database
settings = db(db.msg_email_settings.id == 1).select(limitby=(0, 1)).first()
host = settings.inbound_mail_server
server_type = settings.inbound_mail_type
ssl = settings.inbound_mail_ssl
port = settings.inbound_mail_port
username = settings.inb... | false | true |
790b4bdad6cc5361a652e0c4a545d443b372a6d5 | 24,225 | py | Python | sympy/physics/hep/gamma_matrices.py | ricopicone/sympy | de27c97214d540247a35c8215c7920e9a46b54ed | [
"BSD-3-Clause"
] | 445 | 2019-01-26T13:50:26.000Z | 2022-03-18T05:17:38.000Z | Library/lib/python3.7/site-packages/sympy/physics/hep/gamma_matrices.py | gengyong/Carnets | 8930a14f69360d4db115a85ff9e0f6efa80fa2e7 | [
"BSD-3-Clause"
] | 242 | 2019-01-29T15:48:27.000Z | 2022-03-31T22:09:21.000Z | Library/lib/python3.7/site-packages/sympy/physics/hep/gamma_matrices.py | gengyong/Carnets | 8930a14f69360d4db115a85ff9e0f6efa80fa2e7 | [
"BSD-3-Clause"
] | 31 | 2019-03-10T09:51:27.000Z | 2022-02-14T23:11:12.000Z | """
Module to handle gamma matrices expressed as tensor objects.
Examples
========
>>> from sympy.physics.hep.gamma_matrices import GammaMatrix as G, LorentzIndex
>>> from sympy.tensor.tensor import tensor_indices
>>> i = tensor_indices('i', LorentzIndex)
>>> G(i)
GammaMatrix(i)
N... | 33.739554 | 180 | 0.588483 | from sympy import S, Mul, eye, trace
from sympy.tensor.tensor import TensorIndexType, TensorIndex,\
TensMul, TensAdd, tensor_mul, Tensor, TensorHead, TensorSymmetry
from sympy.core.compatibility import range
LorentzIndex = TensorIndexType('LorentzIndex', dim=4, dummy_fmt="L")
GammaMatrix = TensorHead("GammaM... | true | true |
790b4c8b76a5ed0fd11341ca90d83351298a921a | 4,542 | py | Python | examples/rnnlm/rnnlm.py | kashif/dynet | 95145a3808c5dd54b17eb9ed109c5815142a9b6c | [
"Apache-2.0"
] | null | null | null | examples/rnnlm/rnnlm.py | kashif/dynet | 95145a3808c5dd54b17eb9ed109c5815142a9b6c | [
"Apache-2.0"
] | 1 | 2020-07-01T18:31:27.000Z | 2020-07-01T18:31:27.000Z | examples/rnnlm/rnnlm.py | kashif/dynet | 95145a3808c5dd54b17eb9ed109c5815142a9b6c | [
"Apache-2.0"
] | 1 | 2018-12-26T19:04:47.000Z | 2018-12-26T19:04:47.000Z | import dynet as dy
import time
import random
LAYERS = 2
INPUT_DIM = 256 #50 #256
HIDDEN_DIM = 256 # 50 #1024
VOCAB_SIZE = 0
from collections import defaultdict
from itertools import count
import argparse
import sys
import util
class RNNLanguageModel:
def __init__(self, model, LAYERS, INPUT_DIM, HIDDEN_DIM, VOC... | 32.676259 | 105 | 0.568692 | import dynet as dy
import time
import random
LAYERS = 2
INPUT_DIM = 256 DEN_DIM = 256 B_SIZE = 0
from collections import defaultdict
from itertools import count
import argparse
import sys
import util
class RNNLanguageModel:
def __init__(self, model, LAYERS, INPUT_DIM, HIDDEN_DIM, VOCAB_SIZE, builder=dy.SimpleRNN... | true | true |
790b4cdbb2b430cbe7f136c7a2d9884c8512dd46 | 503 | py | Python | 17. Chapter_/poem_pub.py | Mikma03/Python_Bill_Lubanovic_BookCodes | 8b5b228bb500a08af645a1db6f7c5f33ef5f0512 | [
"MIT"
] | null | null | null | 17. Chapter_/poem_pub.py | Mikma03/Python_Bill_Lubanovic_BookCodes | 8b5b228bb500a08af645a1db6f7c5f33ef5f0512 | [
"MIT"
] | null | null | null | 17. Chapter_/poem_pub.py | Mikma03/Python_Bill_Lubanovic_BookCodes | 8b5b228bb500a08af645a1db6f7c5f33ef5f0512 | [
"MIT"
] | null | null | null | import string
import zmq
host = '127.0.0.1'
port = 6789
ctx = zmq.Context()
pub = ctx.socket(zmq.PUB)
pub.bind('tcp://%s:%s' % (host, port))
with open('lokomotywa.txt', 'rt') as poem:
words = poem.read()
for word in words.split():
word = word.strip(string.punctuation)
data = word.encode('utf-8')
if wo... | 26.473684 | 74 | 0.586481 | import string
import zmq
host = '127.0.0.1'
port = 6789
ctx = zmq.Context()
pub = ctx.socket(zmq.PUB)
pub.bind('tcp://%s:%s' % (host, port))
with open('lokomotywa.txt', 'rt') as poem:
words = poem.read()
for word in words.split():
word = word.strip(string.punctuation)
data = word.encode('utf-8')
if wo... | true | true |
790b4e8080eb902f22d0acc2ff516cfd68038122 | 2,201 | py | Python | zerver/webhooks/semaphore/view.py | rtzll/zulip | b831df8f7fc2f5b89ec998266901ac491d52a7fc | [
"Apache-2.0"
] | null | null | null | zerver/webhooks/semaphore/view.py | rtzll/zulip | b831df8f7fc2f5b89ec998266901ac491d52a7fc | [
"Apache-2.0"
] | 11 | 2021-02-08T20:59:55.000Z | 2022-03-12T00:51:41.000Z | zerver/webhooks/semaphore/view.py | usmanmuhd/zulip | 0600646fbfdcfb20c0c0d47950690a6efac873aa | [
"Apache-2.0"
] | null | null | null | # Webhooks for external integrations.
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.models import get_client
from zerver.lib.actions import check_send_stream_message
from zerver.lib.response import json_success, json_error
from zerver.decorator import... | 38.614035 | 91 | 0.664244 |
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.models import get_client
from zerver.lib.actions import check_send_stream_message
from zerver.lib.response import json_success, json_error
from zerver.decorator import REQ, has_request_variables, api_key_... | true | true |
790b4ec6d0ff056774100aa38894b6bfbee68bd6 | 5,040 | py | Python | chart/chart/python/spectralsequence_chart/page_property.py | JoeyBF/sseq | d553df5e2466aaad47f4a36bf5e051a3922b0dd0 | [
"Apache-2.0",
"MIT"
] | 7 | 2021-04-22T04:06:09.000Z | 2022-01-25T04:05:49.000Z | chart/chart/python/spectralsequence_chart/page_property.py | JoeyBF/sseq | d553df5e2466aaad47f4a36bf5e051a3922b0dd0 | [
"Apache-2.0",
"MIT"
] | 68 | 2020-03-21T22:37:24.000Z | 2022-03-31T02:51:35.000Z | chart/chart/python/spectralsequence_chart/page_property.py | JoeyBF/sseq | d553df5e2466aaad47f4a36bf5e051a3922b0dd0 | [
"Apache-2.0",
"MIT"
] | 5 | 2021-02-17T06:37:43.000Z | 2022-02-01T03:53:22.000Z | from .infinity import INFINITY
import json
from typing import List, Tuple, Any, Type, Union, TypeVar, Generic, Optional, Dict, cast, Callable
T = TypeVar('T')
class PageProperty(Generic[T]):
"""
A class to represent a property that varies depending on the pages of a spectral sequence.
This... | 34.520548 | 104 | 0.547619 | from .infinity import INFINITY
import json
from typing import List, Tuple, Any, Type, Union, TypeVar, Generic, Optional, Dict, cast, Callable
T = TypeVar('T')
class PageProperty(Generic[T]):
def __init__(self,
value : T,
parent : Optional[Any] = None,
callback : Optional[Callable... | true | true |
790b4ee44cef0eaca03d5473dd5685654cdebb5e | 11,990 | py | Python | grr/config/client.py | theGreenJedi/grr | d9e11e304dc299d49c76b7fdf6fdbfcd4b8eec39 | [
"Apache-2.0"
] | null | null | null | grr/config/client.py | theGreenJedi/grr | d9e11e304dc299d49c76b7fdf6fdbfcd4b8eec39 | [
"Apache-2.0"
] | null | null | null | grr/config/client.py | theGreenJedi/grr | d9e11e304dc299d49c76b7fdf6fdbfcd4b8eec39 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
"""Configuration parameters for the client."""
from grr.lib import config_lib
from grr.lib import rdfvalue
from grr.lib.rdfvalues import crypto
# General Client options.
config_lib.DEFINE_string("Client.name", "GRR",
"The name of the client. This will be used as a base "... | 40.506757 | 80 | 0.643453 |
from grr.lib import config_lib
from grr.lib import rdfvalue
from grr.lib.rdfvalues import crypto
config_lib.DEFINE_string("Client.name", "GRR",
"The name of the client. This will be used as a base "
"name to generate many other default parameters such "
... | true | true |
790b4ff35d6db34f32b724826572e3ca28c13a53 | 8,505 | py | Python | gamse/utils/onedarray.py | wangleon/gamse | ed2a3730469a1eeef3def1beca990e9d2641a53b | [
"Apache-2.0"
] | 10 | 2019-04-10T15:05:50.000Z | 2021-11-28T15:31:38.000Z | gamse/utils/onedarray.py | wangleon/gamse | ed2a3730469a1eeef3def1beca990e9d2641a53b | [
"Apache-2.0"
] | 15 | 2020-04-07T07:29:27.000Z | 2022-02-19T15:47:04.000Z | gamse/utils/onedarray.py | wangleon/gamse | ed2a3730469a1eeef3def1beca990e9d2641a53b | [
"Apache-2.0"
] | 2 | 2020-04-02T09:04:27.000Z | 2020-10-14T15:29:10.000Z | from itertools import tee
import numpy as np
import scipy.interpolate as intp
from scipy.signal import savgol_filter
def get_edge_bin(array):
"""Detect the edge indcies of a binary 1-D array.
Args:
array (:class:`numpy.ndarray`): A list or Numpy 1d array, with binary
(0/1) or boolean (True... | 31.735075 | 83 | 0.544033 | from itertools import tee
import numpy as np
import scipy.interpolate as intp
from scipy.signal import savgol_filter
def get_edge_bin(array):
array1 = np.int64(array)
array1 = np.insert(array1, 0, 0)
array1 = np.append(array1, 0)
tmp = array1 - np.roll(array1, 1)
i1_lst = np.nonzero(tmp == 1)[0] - ... | true | true |
790b50ddf6e81681112961b12f0414a0cce079a3 | 1,236 | py | Python | assignment_day_13.py | anjali0503/Letsupgrade_Advance_Python_Django | 40e9468607b94d4aab70ca760f3b2e62cd693dc3 | [
"Apache-2.0"
] | null | null | null | assignment_day_13.py | anjali0503/Letsupgrade_Advance_Python_Django | 40e9468607b94d4aab70ca760f3b2e62cd693dc3 | [
"Apache-2.0"
] | null | null | null | assignment_day_13.py | anjali0503/Letsupgrade_Advance_Python_Django | 40e9468607b94d4aab70ca760f3b2e62cd693dc3 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""Assignment Day :13
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1hCwbVUHmWUKYdN7xNNeZcze9aGEmlGKz
"""
# Q1.
#Remove the hardcoded part from the code with the help of configparser
import os
from configparser import Con... | 25.22449 | 132 | 0.68123 |
import os
from configparser import ConfigParser
config=ConfigParser()
config.read("D://Py Ex/Advance-py//ex_config.ini")
path=config.get("Exten", "path")
old_text=config.get("Exten","OE")
New_text=config.get("Exten","NE")
os.chdir(path)
os.getcwd()
for file in os.listdir():
if file.endswith(old_te... | true | true |
790b51685325f4443457e426c465aef7492da339 | 16,030 | py | Python | Real Topology Graph/GNN Model 1/Fully Connected Graph/Main_MLP_line.py | HusseinLezzaik/Consensus-Algorithm-for-2-Mobile-Robots | 0109c78106dff7640a8fc5601e0333b5397f5b4e | [
"MIT"
] | 9 | 2021-04-20T08:12:47.000Z | 2022-02-18T02:25:29.000Z | Real Topology Graph/GNN Model 1/Fully Connected Graph/Main_MLP_line.py | HusseinLezzaik/Deep-Learning-for-Multi-Robotics | ecdb28793cc1f5fa6cded752908105ec37e9bfc7 | [
"MIT"
] | null | null | null | Real Topology Graph/GNN Model 1/Fully Connected Graph/Main_MLP_line.py | HusseinLezzaik/Deep-Learning-for-Multi-Robotics | ecdb28793cc1f5fa6cded752908105ec37e9bfc7 | [
"MIT"
] | 1 | 2021-11-16T08:16:36.000Z | 2021-11-16T08:16:36.000Z | """
Consensus Algorithm for 6 Mobile robots using MLP Model for Line Graph Implementation
Inputs: Mx, My
Outputs: Ux, Uy
"""
import torch
import MLP_Model
import math
import numpy as np
import rclpy
from rclpy.node import Node
from tf2_msgs.msg import TFMessage
from std_msgs.msg import Float32
import time
L = 1
d =... | 42.073491 | 162 | 0.581347 | import torch
import MLP_Model
import math
import numpy as np
import rclpy
from rclpy.node import Node
from tf2_msgs.msg import TFMessage
from std_msgs.msg import Float32
import time
L = 1
d = 0.5
A = np.ones(6) - np.identity(6)
ux = np.zeros((6,1))
uy = np.zeros((6,1))
FILE = "model.pth"
loaded_model = MLP_Mod... | true | true |
790b522cc3dd60825737300e5cdb957d52ed0a5f | 820 | py | Python | demos/localized/MainWindow.py | hsoft/xibless | a7393d28b4a31698869b2203d4d8b3398de1de7f | [
"BSD-3-Clause"
] | 2 | 2016-09-13T12:34:34.000Z | 2018-05-15T01:06:53.000Z | demos/localized/MainWindow.py | hsoft/xibless | a7393d28b4a31698869b2203d4d8b3398de1de7f | [
"BSD-3-Clause"
] | null | null | null | demos/localized/MainWindow.py | hsoft/xibless | a7393d28b4a31698869b2203d4d8b3398de1de7f | [
"BSD-3-Clause"
] | null | null | null | ownerclass = 'AppDelegate'
ownerimport = 'AppDelegate.h'
# Init
result = Window(330, 110, "Tell me your name!")
nameLabel = Label(result, text="Name:")
nameLabel.width = 45
nameField = TextField(result, text="")
helloLabel = Label(result, text="")
button = Button(result, title="Say Hello", action=Action(owner, 'sayHel... | 30.37037 | 76 | 0.776829 | ownerclass = 'AppDelegate'
ownerimport = 'AppDelegate.h'
result = Window(330, 110, "Tell me your name!")
nameLabel = Label(result, text="Name:")
nameLabel.width = 45
nameField = TextField(result, text="")
helloLabel = Label(result, text="")
button = Button(result, title="Say Hello", action=Action(owner, 'sayHello'))
... | true | true |
790b5279a1b26a859351ee80c80c069b39ca7510 | 5,790 | py | Python | cave/analyzer/parameter_importance/fanova.py | deslay1/CAVE | e4b9abc3812034f49dddd27ffc17dbab39782a1c | [
"BSD-3-Clause"
] | 45 | 2018-01-11T11:26:11.000Z | 2021-06-22T06:14:39.000Z | cave/analyzer/parameter_importance/fanova.py | deslay1/CAVE | e4b9abc3812034f49dddd27ffc17dbab39782a1c | [
"BSD-3-Clause"
] | 150 | 2017-12-20T16:14:45.000Z | 2021-09-28T11:26:33.000Z | cave/analyzer/parameter_importance/fanova.py | automl/SpySMAC | afcbecd0b9cb97276625c16a89cb6df141e6f6f2 | [
"BSD-3-Clause"
] | 17 | 2018-03-17T04:46:09.000Z | 2021-02-18T18:31:38.000Z | import operator
import os
from collections import OrderedDict
from pandas import DataFrame
from cave.analyzer.parameter_importance.base_parameter_importance import BaseParameterImportance
class Fanova(BaseParameterImportance):
"""
fANOVA (functional analysis of variance) computes the fraction of the varianc... | 49.067797 | 120 | 0.604836 | import operator
import os
from collections import OrderedDict
from pandas import DataFrame
from cave.analyzer.parameter_importance.base_parameter_importance import BaseParameterImportance
class Fanova(BaseParameterImportance):
def __init__(self,
runscontainer,
marginal_thresho... | true | true |
790b52ca08302587366902f6c3c2a553c5bee8de | 1,548 | py | Python | config/wsgi.py | Murithi/lacuna | 752c86f9f28bc431fba1e19cec9669da89beb1aa | [
"BSD-3-Clause"
] | null | null | null | config/wsgi.py | Murithi/lacuna | 752c86f9f28bc431fba1e19cec9669da89beb1aa | [
"BSD-3-Clause"
] | null | null | null | config/wsgi.py | Murithi/lacuna | 752c86f9f28bc431fba1e19cec9669da89beb1aa | [
"BSD-3-Clause"
] | null | null | null | """
WSGI config for lacuna project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` s... | 39.692308 | 79 | 0.805556 | import os
from django.core.wsgi import get_wsgi_application
from raven.contrib.django.raven_compat.middleware.wsgi import Sentry
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
# setting points here.
application = get_wsgi_application()
application = Sentry(application)
# Appl... | true | true |
790b53142173212bb718f366b723b78c3ebc9deb | 7,028 | py | Python | qtmultimedia/tests/auto/runautotests.py | wgnet/wds_qt | 8db722fd367d2d0744decf99ac7bafaba8b8a3d3 | [
"Apache-2.0"
] | 1 | 2020-04-30T15:47:35.000Z | 2020-04-30T15:47:35.000Z | qtmultimedia/tests/auto/runautotests.py | wgnet/wds_qt | 8db722fd367d2d0744decf99ac7bafaba8b8a3d3 | [
"Apache-2.0"
] | null | null | null | qtmultimedia/tests/auto/runautotests.py | wgnet/wds_qt | 8db722fd367d2d0744decf99ac7bafaba8b8a3d3 | [
"Apache-2.0"
] | null | null | null | #! /usr/bin/env python
#############################################################################
##
## Copyright (C) 2015 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing/
##
## This file is part of the build configuration tools of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL21$
## Commercial License Usag... | 34.45098 | 132 | 0.581816 | false | true | |
790b534925e3065065ceefebd43933f99abb3e34 | 392 | py | Python | selenium_test/action.py | fuandenghuo/100-days-of-python | 50f3263b0984bb6690e565d58604c1882aaf465e | [
"MIT"
] | null | null | null | selenium_test/action.py | fuandenghuo/100-days-of-python | 50f3263b0984bb6690e565d58604c1882aaf465e | [
"MIT"
] | null | null | null | selenium_test/action.py | fuandenghuo/100-days-of-python | 50f3263b0984bb6690e565d58604c1882aaf465e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
__author__ = 'abbot'
from selenium import webdriver
from selenium.webdriver import ActionChains
driver = webdriver.PhantomJS(executable_path='/Users/wangbo/Downloads/phantomjs-2.1.1-macosx/bin/phantomjs')
ac = driver.find_element_by_xpath('element')
ActionChains(driver).move_to_element(ac).p... | 26.133333 | 108 | 0.783163 |
__author__ = 'abbot'
from selenium import webdriver
from selenium.webdriver import ActionChains
driver = webdriver.PhantomJS(executable_path='/Users/wangbo/Downloads/phantomjs-2.1.1-macosx/bin/phantomjs')
ac = driver.find_element_by_xpath('element')
ActionChains(driver).move_to_element(ac).perform()
ActionChains(... | true | true |
790b55568cd5002de26cd12a8eb550d80d758f5d | 2,764 | py | Python | rr/views/contact.py | UniversityofHelsinki/sp-registry | b1336b89788c076bf93f61b97b5469a99acd902c | [
"MIT"
] | null | null | null | rr/views/contact.py | UniversityofHelsinki/sp-registry | b1336b89788c076bf93f61b97b5469a99acd902c | [
"MIT"
] | 1 | 2020-08-10T13:16:58.000Z | 2020-08-18T06:30:20.000Z | rr/views/contact.py | UniversityofHelsinki/sp-registry | b1336b89788c076bf93f61b97b5469a99acd902c | [
"MIT"
] | null | null | null | import logging
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.utils import timezone
from django.utils.translation import ugettext as _
from rr.forms.contact import ContactForm
from rr.models.contact import Contact
from rr.u... | 33.301205 | 83 | 0.596599 | import logging
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.utils import timezone
from django.utils.translation import ugettext as _
from rr.forms.contact import ContactForm
from rr.models.contact import Contact
from rr.u... | true | true |
790b55cdd7a462b46bdc4689951b961f789788c7 | 1,311 | py | Python | setup.py | ChihHsuanLin/bevel | c8ac7f203aa3e2b9b44a9d66d1b283ac32680d8b | [
"MIT"
] | null | null | null | setup.py | ChihHsuanLin/bevel | c8ac7f203aa3e2b9b44a9d66d1b283ac32680d8b | [
"MIT"
] | null | null | null | setup.py | ChihHsuanLin/bevel | c8ac7f203aa3e2b9b44a9d66d1b283ac32680d8b | [
"MIT"
] | null | null | null | import os
from setuptools import setup
def filepath(fname):
return os.path.join(os.path.dirname(__file__), fname)
exec(compile(open('bevel/version.py').read(),
'bevel/version.py', 'exec'))
readme_md = filepath('README.md')
try:
import pypandoc
readme_rst = pypandoc.convert_file(readm... | 24.277778 | 60 | 0.591915 | import os
from setuptools import setup
def filepath(fname):
return os.path.join(os.path.dirname(__file__), fname)
exec(compile(open('bevel/version.py').read(),
'bevel/version.py', 'exec'))
readme_md = filepath('README.md')
try:
import pypandoc
readme_rst = pypandoc.convert_file(readm... | true | true |
790b55e49938b8165c6db7fcf0fb013c3c3c54cf | 7,923 | py | Python | support/standardize.py | AMOOOMA/stocktwits-svm-nlp | 7abf533dcbe1f7e81b822e7b0b897f4319f89290 | [
"MIT"
] | 2 | 2021-04-02T08:21:00.000Z | 2021-08-31T15:28:47.000Z | support/standardize.py | AMOOOMA/stocktwits-svm-nlp | 7abf533dcbe1f7e81b822e7b0b897f4319f89290 | [
"MIT"
] | 4 | 2020-10-30T03:35:36.000Z | 2020-11-19T03:48:47.000Z | support/standardize.py | AMOOOMA/stocktwits-svm-nlp | 7abf533dcbe1f7e81b822e7b0b897f4319f89290 | [
"MIT"
] | 3 | 2021-03-15T04:33:56.000Z | 2022-01-13T08:22:21.000Z | import random
# averaging the embeddings between 2 words
# return the averaged embeddings
def average_two_embeddings_vectors(a, b):
avg_embeddings = []
i = 0
for embed in a:
z = (embed + b[i]) / 2.0
avg_embeddings.append(z)
i += 1
return avg_embeddings
# helper func; updates... | 40.423469 | 119 | 0.616686 | import random
def average_two_embeddings_vectors(a, b):
avg_embeddings = []
i = 0
for embed in a:
z = (embed + b[i]) / 2.0
avg_embeddings.append(z)
i += 1
return avg_embeddings
def update_tok_and_embed(tokens, embeddings, index, embed2_index, averaged_embeddings):
... | true | true |
790b55eeaf7fbc18fc81ddc57a5a3363dc5632f7 | 3,674 | py | Python | myproject/myproject/settings.py | panipp/cs459_2019 | 7ec13e69904180b88405de02fe2d9b7001e55557 | [
"BSD-2-Clause"
] | null | null | null | myproject/myproject/settings.py | panipp/cs459_2019 | 7ec13e69904180b88405de02fe2d9b7001e55557 | [
"BSD-2-Clause"
] | null | null | null | myproject/myproject/settings.py | panipp/cs459_2019 | 7ec13e69904180b88405de02fe2d9b7001e55557 | [
"BSD-2-Clause"
] | null | null | null | """
Django settings for myproject project.
Generated by 'django-admin startproject' using Django 2.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
... | 24.993197 | 91 | 0.685084 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '@=ozqw=1&(*&)$sdvl_o1#r=+kf=5s#0g^#mo72^ctn1mmzse$'
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.cont... | true | true |
790b56c8fb09bb60030fb0e92ccaee1eab80ddda | 3,395 | py | Python | test/functional/wallet_zapwallettxes.py | gingfinger/divi99 | 3b0602b41bf35fb1e30c12b1bf06ef1da58935eb | [
"MIT"
] | null | null | null | test/functional/wallet_zapwallettxes.py | gingfinger/divi99 | 3b0602b41bf35fb1e30c12b1bf06ef1da58935eb | [
"MIT"
] | null | null | null | test/functional/wallet_zapwallettxes.py | gingfinger/divi99 | 3b0602b41bf35fb1e30c12b1bf06ef1da58935eb | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2014-2018 The Divi Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the zapwallettxes functionality.
- start two divid nodes
- create two transactions on node 0 - one i... | 40.903614 | 112 | 0.706922 |
from test_framework.test_framework import DiviTestFramework
from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
wait_until,
)
class ZapWalletTXesTest (DiviTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 2
def skip_t... | true | true |
790b5724c8920e5ce2e89dddd49d96d69307028a | 2,336 | py | Python | test/integration/test_focal.py | tdchaitanya/kornia | 6dd16563f66f979c7a95846ef86678894b7d54fd | [
"Apache-2.0"
] | 1 | 2021-08-04T14:42:26.000Z | 2021-08-04T14:42:26.000Z | test/integration/test_focal.py | tdchaitanya/kornia | 6dd16563f66f979c7a95846ef86678894b7d54fd | [
"Apache-2.0"
] | null | null | null | test/integration/test_focal.py | tdchaitanya/kornia | 6dd16563f66f979c7a95846ef86678894b7d54fd | [
"Apache-2.0"
] | null | null | null | import logging
import pytest
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import kornia as kornia
logger = logging.getLogger(__name__)
class TestIntegrationFocalLoss:
# optimization
thresh = 1e-1
lr = 1e-3
num_iterations = 1000
num_classes = 2
... | 30.736842 | 70 | 0.602312 | import logging
import pytest
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import kornia as kornia
logger = logging.getLogger(__name__)
class TestIntegrationFocalLoss:
thresh = 1e-1
lr = 1e-3
num_iterations = 1000
num_classes = 2
alpha ... | true | true |
790b58d295bd25056c4766a0bfb060d252c6ca7b | 6,316 | py | Python | DP_FL_recreate/opacus/tests/layers_grad_test.py | RosaYen/DP_FL_recreation | 30607645d9633483a4afa50c0e00bea65c0fb355 | [
"Apache-2.0"
] | null | null | null | DP_FL_recreate/opacus/tests/layers_grad_test.py | RosaYen/DP_FL_recreation | 30607645d9633483a4afa50c0e00bea65c0fb355 | [
"Apache-2.0"
] | null | null | null | DP_FL_recreate/opacus/tests/layers_grad_test.py | RosaYen/DP_FL_recreation | 30607645d9633483a4afa50c0e00bea65c0fb355 | [
"Apache-2.0"
] | 1 | 2020-12-09T05:56:32.000Z | 2020-12-09T05:56:32.000Z | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import unittest
import torch
import torch.nn as nn
from opacus import PerSampleGradientClipper
from opacus.dp_model_inspector import DPModelInspector
from opacus.layers import DPLSTM, DPMultiheadAttention, SequenceBias
from o... | 34.326087 | 101 | 0.611146 |
import unittest
import torch
import torch.nn as nn
from opacus import PerSampleGradientClipper
from opacus.dp_model_inspector import DPModelInspector
from opacus.layers import DPLSTM, DPMultiheadAttention, SequenceBias
from opacus.utils.clipping import ConstantFlatClipper
class LayersGradTest(unittest.TestCase):
... | true | true |
790b597128276634ad90a628db9ba321c71a29d3 | 3,503 | py | Python | python/threadpool_example.py | russcollier/SamplesAndNuggets | c69f82801bf8d1fddc06cb3f25c87d4b3f1554f9 | [
"MIT"
] | null | null | null | python/threadpool_example.py | russcollier/SamplesAndNuggets | c69f82801bf8d1fddc06cb3f25c87d4b3f1554f9 | [
"MIT"
] | null | null | null | python/threadpool_example.py | russcollier/SamplesAndNuggets | c69f82801bf8d1fddc06cb3f25c87d4b3f1554f9 | [
"MIT"
] | null | null | null | import logging
import urllib.request
from datetime import datetime
from multiprocessing import Manager, Value
from multiprocessing.pool import ThreadPool
class EntryPoint:
Log = logging.getLogger(__name__)
def __init__(self):
self.__total_size = Value('i', 0)
self.__sizes_by_file ... | 35.383838 | 111 | 0.591493 | import logging
import urllib.request
from datetime import datetime
from multiprocessing import Manager, Value
from multiprocessing.pool import ThreadPool
class EntryPoint:
Log = logging.getLogger(__name__)
def __init__(self):
self.__total_size = Value('i', 0)
self.__sizes_by_file ... | true | true |
790b59a37e99d90e02621b138312db60daee8b61 | 10,928 | py | Python | 4_Coverage_Evaluation/MNIST/utils.py | j-chan-hkust/deep_testing_of_advanced_learning_systems | ec535e2b4dc489d407b664a138d3f5262b71d21e | [
"MIT"
] | null | null | null | 4_Coverage_Evaluation/MNIST/utils.py | j-chan-hkust/deep_testing_of_advanced_learning_systems | ec535e2b4dc489d407b664a138d3f5262b71d21e | [
"MIT"
] | null | null | null | 4_Coverage_Evaluation/MNIST/utils.py | j-chan-hkust/deep_testing_of_advanced_learning_systems | ec535e2b4dc489d407b664a138d3f5262b71d21e | [
"MIT"
] | null | null | null | # some utils taken from the DeepXplore Implementation
import random
from collections import defaultdict
import numpy as np
from keras import backend as K
from keras.models import Model
from keras.preprocessing import image
from keras import models, layers, activations
from scipy.spatial.distance import mahalanobis
f... | 42.521401 | 177 | 0.726116 |
import random
from collections import defaultdict
import numpy as np
from keras import backend as K
from keras.models import Model
from keras.preprocessing import image
from keras import models, layers, activations
from scipy.spatial.distance import mahalanobis
from numpy.linalg import inv
from itertools import com... | true | true |
790b5a2f3bee4f74cdcbd9e18c7d8e42cc5430da | 1,024 | py | Python | ElevatorBot/commands/miscellaneous/poll/remove.py | LukasSchmid97/elevatorbot | 77c45d8945c735c8dce9bc75563086bce265dc18 | [
"MIT"
] | null | null | null | ElevatorBot/commands/miscellaneous/poll/remove.py | LukasSchmid97/elevatorbot | 77c45d8945c735c8dce9bc75563086bce265dc18 | [
"MIT"
] | 89 | 2021-08-12T15:23:05.000Z | 2022-01-11T12:33:21.000Z | ElevatorBot/commands/miscellaneous/poll/remove.py | LukasSchmid97/elevatorbot | 77c45d8945c735c8dce9bc75563086bce265dc18 | [
"MIT"
] | 1 | 2021-10-20T20:07:22.000Z | 2021-10-20T20:07:22.000Z | from dis_snek.models import InteractionContext, OptionTypes, slash_command, slash_option
from ElevatorBot.commandHelpers.subCommandTemplates import poll_sub_command
from ElevatorBot.commands.base import BaseScale
from ElevatorBot.core.misc.poll import Poll
class PollRemove(BaseScale):
@slash_command(
**p... | 32 | 114 | 0.710938 | from dis_snek.models import InteractionContext, OptionTypes, slash_command, slash_option
from ElevatorBot.commandHelpers.subCommandTemplates import poll_sub_command
from ElevatorBot.commands.base import BaseScale
from ElevatorBot.core.misc.poll import Poll
class PollRemove(BaseScale):
@slash_command(
**p... | true | true |
790b5c68fae56c3a8a03c1c98b95774e0ef411e2 | 13,562 | py | Python | pyvisa-py/protocols/usbtmc.py | circuitfox/pyvisa-py | 66e41dd6ad5683f087ca8caca62df754b00648da | [
"MIT"
] | null | null | null | pyvisa-py/protocols/usbtmc.py | circuitfox/pyvisa-py | 66e41dd6ad5683f087ca8caca62df754b00648da | [
"MIT"
] | null | null | null | pyvisa-py/protocols/usbtmc.py | circuitfox/pyvisa-py | 66e41dd6ad5683f087ca8caca62df754b00648da | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
pyvisa-py.protocols.usbtmc
~~~~~~~~~~~~~~~~~~~~~~~~~~
Implements Session to control USBTMC instruments
Loosely based on PyUSBTMC:python module to handle USB-TMC(Test and
Measurement class) devices.
by Noboru Yamamot, Accl. Lab, KEK, JAPAN
This file is an offsp... | 31.393519 | 145 | 0.595045 |
from __future__ import (division, unicode_literals, print_function,
absolute_import)
import enum
from pyvisa.compat import struct
import time
from collections import namedtuple
import warnings
import usb
from .usbutil import (find_devices, find_interfaces, find_endpoint,
... | true | true |
790b5d452a362eacbee42beb11f6b3961f3c3d91 | 2,020 | py | Python | tests/core/test_constants.py | SmallCream/django-cool | 63b136da7ce39135c9f900e8161288f8fc8893a4 | [
"BSD-3-Clause"
] | 11 | 2020-05-19T09:52:35.000Z | 2022-02-25T10:39:56.000Z | tests/core/test_constants.py | SmallCream/django-cool | 63b136da7ce39135c9f900e8161288f8fc8893a4 | [
"BSD-3-Clause"
] | null | null | null | tests/core/test_constants.py | SmallCream/django-cool | 63b136da7ce39135c9f900e8161288f8fc8893a4 | [
"BSD-3-Clause"
] | 1 | 2020-12-24T08:14:58.000Z | 2020-12-24T08:14:58.000Z | # encoding: utf-8
import unittest
from cool.core import constants
class IntConstants(constants.Constants):
TEST0 = (0, 'test0')
TEST1 = (1, 'test1')
class IntStringCodeConstants(constants.Constants):
TEST = ('test', 'test0')
TEST1 = (1, 'test1')
class ConstantsTests(unittest.TestCase):
def te... | 33.114754 | 106 | 0.641584 |
import unittest
from cool.core import constants
class IntConstants(constants.Constants):
TEST0 = (0, 'test0')
TEST1 = (1, 'test1')
class IntStringCodeConstants(constants.Constants):
TEST = ('test', 'test0')
TEST1 = (1, 'test1')
class ConstantsTests(unittest.TestCase):
def test_unique(self):
... | true | true |
790b5d9bcbb9d5c5c2c40ab62afdba9b47d2525f | 626 | py | Python | common.py | ajyl/KEMP | d71d34e3fb1d636db7f2cf40f6a3aa0040681389 | [
"MIT"
] | null | null | null | common.py | ajyl/KEMP | d71d34e3fb1d636db7f2cf40f6a3aa0040681389 | [
"MIT"
] | null | null | null | common.py | ajyl/KEMP | d71d34e3fb1d636db7f2cf40f6a3aa0040681389 | [
"MIT"
] | null | null | null | """
Module Doc String
"""
EMOTIONS = [
"sentimental",
"afraid",
"proud",
"faithful",
"terrified",
"joyful",
"angry",
"sad",
"jealous",
"grateful",
"prepared",
"embarrassed",
"excited",
"annoyed",
"lonely",
"ashamed",
"guilty",
"surprised",
"no... | 12.77551 | 26 | 0.496805 |
EMOTIONS = [
"sentimental",
"afraid",
"proud",
"faithful",
"terrified",
"joyful",
"angry",
"sad",
"jealous",
"grateful",
"prepared",
"embarrassed",
"excited",
"annoyed",
"lonely",
"ashamed",
"guilty",
"surprised",
"nostalgic",
"confident",... | true | true |
790b5eaa8022d14560bfc4707727abb81d0adce1 | 21,056 | py | Python | src/starkware/starknet/apps/starkgate/cairo/token_test.py | starkware-libs/starkgate-contracts | 28f4032b101003b2c6682d753ea61c86b732012c | [
"Apache-2.0"
] | 9 | 2022-01-27T20:20:06.000Z | 2022-03-29T12:05:57.000Z | src/starkware/starknet/apps/starkgate/cairo/token_test.py | starkware-libs/starkgate-contracts | 28f4032b101003b2c6682d753ea61c86b732012c | [
"Apache-2.0"
] | 2 | 2022-02-16T17:05:56.000Z | 2022-02-16T17:06:54.000Z | src/starkware/starknet/apps/starkgate/cairo/token_test.py | starkware-libs/starkgate-contracts | 28f4032b101003b2c6682d753ea61c86b732012c | [
"Apache-2.0"
] | 1 | 2022-02-03T13:39:44.000Z | 2022-02-03T13:39:44.000Z | import asyncio
import copy
import random
from typing import Callable
import pytest
from starkware.starknet.apps.starkgate.cairo.contracts import erc20_contract_def
from starkware.starknet.apps.starkgate.conftest import str_to_felt
from starkware.starknet.testing.contract import StarknetContract
from starkware.starkne... | 40.885437 | 100 | 0.772226 | import asyncio
import copy
import random
from typing import Callable
import pytest
from starkware.starknet.apps.starkgate.cairo.contracts import erc20_contract_def
from starkware.starknet.apps.starkgate.conftest import str_to_felt
from starkware.starknet.testing.contract import StarknetContract
from starkware.starkne... | true | true |
790b6074975f08f6910415dfeafedc37eec6ef0a | 14,960 | py | Python | sdk/python/pulumi_azure_native/operationalinsights/storage_insight_config.py | sebtelko/pulumi-azure-native | 711ec021b5c73da05611c56c8a35adb0ce3244e4 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/operationalinsights/storage_insight_config.py | sebtelko/pulumi-azure-native | 711ec021b5c73da05611c56c8a35adb0ce3244e4 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/operationalinsights/storage_insight_config.py | sebtelko/pulumi-azure-native | 711ec021b5c73da05611c56c8a35adb0ce3244e4 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... | 44.391691 | 670 | 0.654412 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from . import outputs
from ._inputs import *
__all__ = ['StorageInsightConfigArgs', 'StorageInsightConfig']
@pulumi.input_type
class StorageInsightConfigArgs:
def ... | true | true |
790b60aed69857200e1eeae7fc3858ded428e58c | 10,715 | py | Python | homeassistant/components/ozw/entity.py | andersop91/core | 0e0ef0aa17073609eae7c974cf4c73306b7c414b | [
"Apache-2.0"
] | 22,481 | 2020-03-02T13:09:59.000Z | 2022-03-31T23:34:28.000Z | homeassistant/components/ozw/entity.py | andersop91/core | 0e0ef0aa17073609eae7c974cf4c73306b7c414b | [
"Apache-2.0"
] | 31,101 | 2020-03-02T13:00:16.000Z | 2022-03-31T23:57:36.000Z | homeassistant/components/ozw/entity.py | andersop91/core | 0e0ef0aa17073609eae7c974cf4c73306b7c414b | [
"Apache-2.0"
] | 11,411 | 2020-03-02T14:19:20.000Z | 2022-03-31T22:46:07.000Z | """Generic Z-Wave Entity Classes."""
import copy
import logging
from openzwavemqtt.const import (
EVENT_INSTANCE_STATUS_CHANGED,
EVENT_VALUE_CHANGED,
OZW_READY_STATES,
CommandClass,
ValueIndex,
)
from openzwavemqtt.models.node import OZWNode
from openzwavemqtt.models.value import OZWValue
from ho... | 35.131148 | 91 | 0.650863 |
import copy
import logging
from openzwavemqtt.const import (
EVENT_INSTANCE_STATUS_CHANGED,
EVENT_VALUE_CHANGED,
OZW_READY_STATES,
CommandClass,
ValueIndex,
)
from openzwavemqtt.models.node import OZWNode
from openzwavemqtt.models.value import OZWValue
from homeassistant.const import ATTR_NAME, A... | true | true |
790b60f8512838b13340af7d96cdcfece2d4199b | 214 | py | Python | cflearn_deploy/constants.py | carefree0910/carefree-learn-deploy | 53fa62d2bac52e396ed16e82ab0210459b6f13f0 | [
"MIT"
] | 1 | 2021-09-02T09:35:53.000Z | 2021-09-02T09:35:53.000Z | cflearn_deploy/constants.py | carefree0910/carefree-learn-deploy | 53fa62d2bac52e396ed16e82ab0210459b6f13f0 | [
"MIT"
] | null | null | null | cflearn_deploy/constants.py | carefree0910/carefree-learn-deploy | 53fa62d2bac52e396ed16e82ab0210459b6f13f0 | [
"MIT"
] | null | null | null | INFO_PREFIX = "> [ info ] "
ERROR_PREFIX = "> [warning] "
WARNING_PREFIX = "> [ error ] "
INPUT_KEY = "input"
LATENT_KEY = "latent"
PREDICTIONS_KEY = "predictions"
LABEL_KEY = "labels"
SQLITE_FILE = "sqlite.db"
| 19.454545 | 31 | 0.668224 | INFO_PREFIX = "> [ info ] "
ERROR_PREFIX = "> [warning] "
WARNING_PREFIX = "> [ error ] "
INPUT_KEY = "input"
LATENT_KEY = "latent"
PREDICTIONS_KEY = "predictions"
LABEL_KEY = "labels"
SQLITE_FILE = "sqlite.db"
| true | true |
790b638ddaf648a03ee15af7ba55ba7a69da742a | 3,311 | py | Python | feedputter.py | amake/puttools-py | 7c03356ba0bac59697c921ff9447f12be07390aa | [
"MIT"
] | null | null | null | feedputter.py | amake/puttools-py | 7c03356ba0bac59697c921ff9447f12be07390aa | [
"MIT"
] | null | null | null | feedputter.py | amake/puttools-py | 7c03356ba0bac59697c921ff9447f12be07390aa | [
"MIT"
] | null | null | null | '''
Created on 2012/09/03
@author: amake
'''
from __future__ import print_function
import os
import sys
import urllib
import codecs
from datetime import datetime
from xml.etree import ElementTree
import putio
CACHE_FILE = "cache.txt"
FEEDS_FILE = "feeds.txt"
DEBUG = True
PUTIOAPI = None
# Stupid CloudFlare decid... | 22.52381 | 77 | 0.578677 |
from __future__ import print_function
import os
import sys
import urllib
import codecs
from datetime import datetime
from xml.etree import ElementTree
import putio
CACHE_FILE = "cache.txt"
FEEDS_FILE = "feeds.txt"
DEBUG = True
PUTIOAPI = None
class CustomURLopener(urllib.FancyURLopener):
version = 'Mozilla/... | true | true |
790b64737ed269486552427906fc8ec51b4f21dd | 19,796 | py | Python | pecos/qeccs/surface_medial_4444/instructions.py | quantum-pecos/PECOS | 44bc614a9152f3b316bacef6ca034f6a8a611293 | [
"Apache-2.0"
] | 15 | 2019-04-11T16:02:38.000Z | 2022-03-15T16:56:36.000Z | pecos/qeccs/surface_medial_4444/instructions.py | quantum-pecos/PECOS | 44bc614a9152f3b316bacef6ca034f6a8a611293 | [
"Apache-2.0"
] | 4 | 2018-10-04T19:30:09.000Z | 2019-03-12T19:00:34.000Z | pecos/qeccs/surface_medial_4444/instructions.py | quantum-pecos/PECOS | 44bc614a9152f3b316bacef6ca034f6a8a611293 | [
"Apache-2.0"
] | 3 | 2020-10-07T16:47:16.000Z | 2022-02-01T05:34:54.000Z | # ========================================================================= #
# Copyright 2018 National Technology & Engineering Solutions of Sandia,
# LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS,
# the U.S. Government retains certain rights in this software.
#
# Licensed under the Apache... | 32.293638 | 121 | 0.547181 |
from ..instruction_parent_class import LogicalInstruction
from ...circuits.quantum_circuit import QuantumCircuit
from ..helper_functions import pos2qudit
class InstrSynExtraction(LogicalInstruction):
def __init__(self, qecc, symbol, **gate_params):
super().__init__(qecc, symbol, **gate_p... | true | true |
790b655cc3ef0d1d5d0c0c49c63148f7322be5a8 | 23,975 | py | Python | python/athena/gpu_ops/StreamExecutor.py | DMALab/TSplit | 8f86f987163aa06521bfeeb174616eb4a0a81b47 | [
"Apache-2.0"
] | 2 | 2021-05-29T11:18:14.000Z | 2021-09-09T14:29:21.000Z | python/athena/gpu_ops/StreamExecutor.py | DMALab/TSplit | 8f86f987163aa06521bfeeb174616eb4a0a81b47 | [
"Apache-2.0"
] | null | null | null | python/athena/gpu_ops/StreamExecutor.py | DMALab/TSplit | 8f86f987163aa06521bfeeb174616eb4a0a81b47 | [
"Apache-2.0"
] | 1 | 2021-05-01T16:34:37.000Z | 2021-05-01T16:34:37.000Z | """ library to take autodiff and execute a computation graph """
from __future__ import absolute_import
import numpy as np
from .Node import Op
from .. import ndarray
from ..stream import *
import ctypes
import os
from pynvml import *
FLAG_SHOW_GRAPH = False
G_NODE_ID = 0
NAME_RULE = 1
def communicate_init(worker_nu... | 40.091973 | 116 | 0.591074 | from __future__ import absolute_import
import numpy as np
from .Node import Op
from .. import ndarray
from ..stream import *
import ctypes
import os
from pynvml import *
FLAG_SHOW_GRAPH = False
G_NODE_ID = 0
NAME_RULE = 1
def communicate_init(worker_num, worker_id, source_ip, target_ip):
global lib_communicate
... | true | true |
790b663ab3c11448db059f1eb8ab6cd56ba588e3 | 502 | py | Python | djcommerce/models/profile.py | tdsprogramming/djcommerce | dc7f16a876b6c9cdd323a097a0b411e45b029373 | [
"MIT"
] | 1 | 2019-06-26T19:35:01.000Z | 2019-06-26T19:35:01.000Z | djcommerce/models/profile.py | tdsprogramming/djcommerce | dc7f16a876b6c9cdd323a097a0b411e45b029373 | [
"MIT"
] | 9 | 2019-06-28T01:29:25.000Z | 2022-02-10T12:19:32.000Z | djcommerce/models/profile.py | tdsprogramming/djcommerce | dc7f16a876b6c9cdd323a097a0b411e45b029373 | [
"MIT"
] | null | null | null | from django.db import models
from django.conf import settings
from django_extensions.db.models import TimeStampedModel
from djcommerce.utils import get_address_model
Address = get_address_model()
class Profile(TimeStampedModel):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete = mod... | 23.904762 | 56 | 0.723108 | from django.db import models
from django.conf import settings
from django_extensions.db.models import TimeStampedModel
from djcommerce.utils import get_address_model
Address = get_address_model()
class Profile(TimeStampedModel):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete = mod... | true | true |
790b665cda7be12dcf2d030c0739d514b867053b | 2,838 | py | Python | netbox/ipam/tests/test_models.py | 0xAalaoui/netbox | 07364abf9e9ff193bad49b790e657382cf186f0c | [
"Apache-2.0"
] | 1 | 2018-07-31T06:54:02.000Z | 2018-07-31T06:54:02.000Z | netbox/ipam/tests/test_models.py | 0xAalaoui/netbox | 07364abf9e9ff193bad49b790e657382cf186f0c | [
"Apache-2.0"
] | null | null | null | netbox/ipam/tests/test_models.py | 0xAalaoui/netbox | 07364abf9e9ff193bad49b790e657382cf186f0c | [
"Apache-2.0"
] | 1 | 2021-04-09T06:08:21.000Z | 2021-04-09T06:08:21.000Z | from __future__ import unicode_literals
import netaddr
from django.core.exceptions import ValidationError
from django.test import TestCase, override_settings
from ipam.models import IPAddress, Prefix, VRF
class TestPrefix(TestCase):
@override_settings(ENFORCE_GLOBAL_UNIQUE=False)
def test_duplicate_global(... | 45.774194 | 84 | 0.72093 | from __future__ import unicode_literals
import netaddr
from django.core.exceptions import ValidationError
from django.test import TestCase, override_settings
from ipam.models import IPAddress, Prefix, VRF
class TestPrefix(TestCase):
@override_settings(ENFORCE_GLOBAL_UNIQUE=False)
def test_duplicate_global(... | true | true |
790b683e58ce703e032cd4ecb9667601e4fdd9dd | 48,363 | py | Python | tensorflow/contrib/distribute/python/keras_test.py | unnir/tensorflow | 656b2fe018a7940595121ea08d4a1ddf29fa65d0 | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/distribute/python/keras_test.py | unnir/tensorflow | 656b2fe018a7940595121ea08d4a1ddf29fa65d0 | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/distribute/python/keras_test.py | unnir/tensorflow | 656b2fe018a7940595121ea08d4a1ddf29fa65d0 | [
"Apache-2.0"
] | null | null | null | # Copyright 2016 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-2.0
#
# Unless required by applica... | 40.847128 | 80 | 0.657507 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from absl.testing import parameterized
import numpy as np
from tensorflow.contrib.distribute.python import combinations
from tensorflow.contrib.distribute.python import mirrored_strateg... | true | true |
790b6887e682768cff2b7bca7afbf7c67192f24e | 2,942 | py | Python | scripts/json_validate.py | KhronosGroup/VulkanSC-Docs | 1a39268a1c690cacd8713a5ae3121937492685a5 | [
"ECL-2.0",
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | 15 | 2022-03-01T21:17:13.000Z | 2022-03-28T19:58:42.000Z | scripts/json_validate.py | KhronosGroup/VulkanSC-Docs | 1a39268a1c690cacd8713a5ae3121937492685a5 | [
"ECL-2.0",
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | null | null | null | scripts/json_validate.py | KhronosGroup/VulkanSC-Docs | 1a39268a1c690cacd8713a5ae3121937492685a5 | [
"ECL-2.0",
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | null | null | null | #!/usr/bin/python3 -i
#
# Copyright (c) 2020 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0
# Description:
# -----------
# This script validates a json pipeline file against the schema files.
import os,sys
import re
import argparse
import json
import jsonschema
base_schema_filename = os.path.join("..... | 34.209302 | 84 | 0.676071 |
import os,sys
import re
import argparse
import json
import jsonschema
base_schema_filename = os.path.join("..", "json", "vk.json")
vkpcc_schema_filename = os.path.join("..", "json", "vkpcc.json")
def ParseArgs():
parser = argparse.ArgumentParser()
parser.add_argument('json_file', help='The json fil... | true | true |
790b68ed00b159400b5367fe23b82c6baa01cf1b | 2,035 | py | Python | common/models/mixins/description.py | uktrade/tamato | 4ba2ffb25eea2887e4e081c81da7634cd7b4f9ca | [
"MIT"
] | 14 | 2020-03-25T11:11:29.000Z | 2022-03-08T20:41:33.000Z | common/models/mixins/description.py | uktrade/tamato | 4ba2ffb25eea2887e4e081c81da7634cd7b4f9ca | [
"MIT"
] | 352 | 2020-03-25T10:42:09.000Z | 2022-03-30T15:32:26.000Z | common/models/mixins/description.py | uktrade/tamato | 4ba2ffb25eea2887e4e081c81da7634cd7b4f9ca | [
"MIT"
] | 3 | 2020-08-06T12:22:41.000Z | 2022-01-16T11:51:12.000Z | from django.db.models.fields import Field
from django.urls import NoReverseMatch
from django.urls import reverse
from polymorphic.managers import PolymorphicManager
from common.business_rules import NoBlankDescription
from common.business_rules import UpdateValidity
from common.models.mixins.validity import ValiditySt... | 31.307692 | 82 | 0.679607 | from django.db.models.fields import Field
from django.urls import NoReverseMatch
from django.urls import reverse
from polymorphic.managers import PolymorphicManager
from common.business_rules import NoBlankDescription
from common.business_rules import UpdateValidity
from common.models.mixins.validity import ValiditySt... | true | true |
790b6a5adb8a57ca2f1be67f7f489b48f270744e | 6,711 | py | Python | tests/layers/test_layers_normalization.py | OliverZijia/tensorlayer2 | 01113b53e84a3bbb298b9c35ebd53254e487350f | [
"Apache-2.0"
] | null | null | null | tests/layers/test_layers_normalization.py | OliverZijia/tensorlayer2 | 01113b53e84a3bbb298b9c35ebd53254e487350f | [
"Apache-2.0"
] | null | null | null | tests/layers/test_layers_normalization.py | OliverZijia/tensorlayer2 | 01113b53e84a3bbb298b9c35ebd53254e487350f | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import *
from tensorlayer.models import Model
from tests.utils import CustomTestCase
class Laye_BatchNorm_Test(CustomTestCase):
... | 32.736585 | 124 | 0.573387 |
import os
import unittest
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import *
from tensorlayer.models import Model
from tests.utils import CustomTestCase
class Laye_BatchNorm_Test(CustomTestCase):
@classmethod
def setUpClass(cls):
... | true | true |
790b6af8adee979ccd9271e289e01f6aee09a4f1 | 1,256 | py | Python | studies/migrations/0016_auto_20170710_1438.py | enrobyn/lookit-api | 621fbb8b25100a21fd94721d39003b5d4f651dc5 | [
"MIT"
] | null | null | null | studies/migrations/0016_auto_20170710_1438.py | enrobyn/lookit-api | 621fbb8b25100a21fd94721d39003b5d4f651dc5 | [
"MIT"
] | null | null | null | studies/migrations/0016_auto_20170710_1438.py | enrobyn/lookit-api | 621fbb8b25100a21fd94721d39003b5d4f651dc5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-10 14:38
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('studies', '0015_auto_20170707_1820'),
]
operations = [
migrations.AlterModelOptions... | 62.8 | 890 | 0.700637 |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('studies', '0015_auto_20170707_1820'),
]
operations = [
migrations.AlterModelOptions(
name='study',
options={'ordering': ['name'], ... | true | true |
790b6d414919630962a222dd3ec287a10b3e49aa | 13,247 | py | Python | trimesh/exchange/dae.py | jengvi/trimesh | aeefe89a27ae17c3f4d6286b9a2ba1623329a286 | [
"MIT"
] | 1 | 2021-08-19T13:29:38.000Z | 2021-08-19T13:29:38.000Z | trimesh/exchange/dae.py | jengvi/trimesh | aeefe89a27ae17c3f4d6286b9a2ba1623329a286 | [
"MIT"
] | null | null | null | trimesh/exchange/dae.py | jengvi/trimesh | aeefe89a27ae17c3f4d6286b9a2ba1623329a286 | [
"MIT"
] | 3 | 2018-04-10T15:44:44.000Z | 2021-07-23T07:19:10.000Z | import io
import copy
import uuid
import numpy as np
try:
# pip install pycollada
import collada
except BaseException:
collada = None
try:
import PIL.Image
except ImportError:
pass
from .. import util
from .. import visual
from ..constants import log
def load_collada(file_obj, resolver=None, ... | 32.231144 | 86 | 0.566619 | import io
import copy
import uuid
import numpy as np
try:
import collada
except BaseException:
collada = None
try:
import PIL.Image
except ImportError:
pass
from .. import util
from .. import visual
from ..constants import log
def load_collada(file_obj, resolver=None, **kwargs):
c =... | true | true |
790b6d46830f4335c39e55e0db3124f4a021de64 | 7,161 | py | Python | tests/syft/grid/messages/group_msg_test.py | divinit7/PySyft | 261869e50852a24b2d76f3b44a5819050acd9eb8 | [
"Apache-2.0"
] | null | null | null | tests/syft/grid/messages/group_msg_test.py | divinit7/PySyft | 261869e50852a24b2d76f3b44a5819050acd9eb8 | [
"Apache-2.0"
] | null | null | null | tests/syft/grid/messages/group_msg_test.py | divinit7/PySyft | 261869e50852a24b2d76f3b44a5819050acd9eb8 | [
"Apache-2.0"
] | null | null | null | # stdlib
from typing import Any
from typing import Dict
# syft absolute
import syft as sy
from syft import serialize
from syft.core.io.address import Address
from syft.grid.messages.group_messages import CreateGroupMessage
from syft.grid.messages.group_messages import CreateGroupResponse
from syft.grid.messages.group_... | 27.228137 | 68 | 0.606898 |
from typing import Any
from typing import Dict
import syft as sy
from syft import serialize
from syft.core.io.address import Address
from syft.grid.messages.group_messages import CreateGroupMessage
from syft.grid.messages.group_messages import CreateGroupResponse
from syft.grid.messages.group_messages import DeleteG... | true | true |
790b6dcdb1277a0e88026226689352073e63443c | 3,531 | py | Python | qaseio/tests/qaseio/services/test_test_run_result.py | aleksandr-kotlyar/qase-python | 3e6916eb4bf3518651e0a8e2e62281bfe0bfa464 | [
"Apache-2.0"
] | null | null | null | qaseio/tests/qaseio/services/test_test_run_result.py | aleksandr-kotlyar/qase-python | 3e6916eb4bf3518651e0a8e2e62281bfe0bfa464 | [
"Apache-2.0"
] | null | null | null | qaseio/tests/qaseio/services/test_test_run_result.py | aleksandr-kotlyar/qase-python | 3e6916eb4bf3518651e0a8e2e62281bfe0bfa464 | [
"Apache-2.0"
] | null | null | null | import json
import pytest
import requests_mock
from apitist.constructor import converter
from tests.data import _list, _status_true, _test_run_result
from qaseio.client.models import (
TestRunResultCreate,
TestRunResultCreated,
TestRunResultFilters,
TestRunResultInfo,
TestRunResultList,
TestR... | 33 | 75 | 0.629283 | import json
import pytest
import requests_mock
from apitist.constructor import converter
from tests.data import _list, _status_true, _test_run_result
from qaseio.client.models import (
TestRunResultCreate,
TestRunResultCreated,
TestRunResultFilters,
TestRunResultInfo,
TestRunResultList,
TestR... | true | true |
790b6eb990f7c1e45ffe1e637b1c478df59fb388 | 5,598 | py | Python | Lib/distutils/command/build.py | arvindm95/unladen-swallow | 8175e37eaea7ca66ed03283b46bc1d2db0d3f9c3 | [
"PSF-2.0"
] | 2,293 | 2015-01-02T12:46:10.000Z | 2022-03-29T09:45:43.000Z | python/src/Lib/distutils/command/build.py | weiqiangzheng/sl4a | d3c17dca978cbeee545e12ea240a9dbf2a6999e9 | [
"Apache-2.0"
] | 315 | 2015-05-31T11:55:46.000Z | 2022-01-12T08:36:37.000Z | python/src/Lib/distutils/command/build.py | weiqiangzheng/sl4a | d3c17dca978cbeee545e12ea240a9dbf2a6999e9 | [
"Apache-2.0"
] | 1,033 | 2015-01-04T07:48:40.000Z | 2022-03-24T09:34:37.000Z | """distutils.command.build
Implements the Distutils 'build' command."""
# This module should be kept compatible with Python 2.1.
__revision__ = "$Id: build.py 62197 2008-04-07 01:53:39Z mark.hammond $"
import sys, os
from distutils.core import Command
from distutils.errors import DistutilsOptionError
from distutils... | 35.207547 | 76 | 0.58771 |
__revision__ = "$Id: build.py 62197 2008-04-07 01:53:39Z mark.hammond $"
import sys, os
from distutils.core import Command
from distutils.errors import DistutilsOptionError
from distutils.util import get_platform
def show_compilers ():
from distutils.ccompiler import show_compilers
show_compilers()
clas... | true | true |
790b6ebad99b78cef2085b5391f29db429f6fbbd | 14,610 | py | Python | src/python/pants/java/nailgun_executor.py | revl/pants | 8ad83e4ca80c095d44efceafd8b41e575da39c65 | [
"Apache-2.0"
] | null | null | null | src/python/pants/java/nailgun_executor.py | revl/pants | 8ad83e4ca80c095d44efceafd8b41e575da39c65 | [
"Apache-2.0"
] | null | null | null | src/python/pants/java/nailgun_executor.py | revl/pants | 8ad83e4ca80c095d44efceafd8b41e575da39c65 | [
"Apache-2.0"
] | null | null | null | # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import hashlib
import logging
import os
import re
import selectors
import threading
import time
from contextlib import closing
from pants.base.build_environment import get_buildroot
from ... | 40.470914 | 105 | 0.624298 |
import hashlib
import logging
import os
import re
import selectors
import threading
import time
from contextlib import closing
from pants.base.build_environment import get_buildroot
from pants.java.executor import Executor, SubprocessExecutor
from pants.java.nailgun_client import NailgunClient
from pants.pantsd.pro... | true | true |
790b6f9d96e763bc5221f516f7bd3579d162c531 | 6,968 | py | Python | src/python/pants/backend/python/util_rules/local_dists.py | chebbyChefNEQ/pants | a53b9d29a160f36f9af1d1a2c43a693b6a55fa55 | [
"Apache-2.0"
] | 1 | 2016-04-27T15:35:42.000Z | 2016-04-27T15:35:42.000Z | src/python/pants/backend/python/util_rules/local_dists.py | chebbyChefNEQ/pants | a53b9d29a160f36f9af1d1a2c43a693b6a55fa55 | [
"Apache-2.0"
] | null | null | null | src/python/pants/backend/python/util_rules/local_dists.py | chebbyChefNEQ/pants | a53b9d29a160f36f9af1d1a2c43a693b6a55fa55 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import logging
import os
import zipfile
from dataclasses import dataclass
from io import BytesIO
from typing import Iterable
from pants.backend.python.... | 40.045977 | 100 | 0.708668 |
from __future__ import annotations
import logging
import os
import zipfile
from dataclasses import dataclass
from io import BytesIO
from typing import Iterable
from pants.backend.python.subsystems.setuptools import PythonDistributionFieldSet
from pants.backend.python.util_rules.interpreter_constraints import Inter... | true | true |
790b6ff16d3728d62ee998ddd8af602b0035ffcb | 44,353 | py | Python | tensorflow/contrib/learn/python/learn/monitors.py | topsun888/tensorflow | bad7c50b9dc9789ad7dd0a62daca40b7269841ed | [
"Apache-2.0"
] | 1 | 2016-09-29T14:08:17.000Z | 2016-09-29T14:08:17.000Z | tensorflow/contrib/learn/python/learn/monitors.py | topsun888/tensorflow | bad7c50b9dc9789ad7dd0a62daca40b7269841ed | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/learn/python/learn/monitors.py | topsun888/tensorflow | bad7c50b9dc9789ad7dd0a62daca40b7269841ed | [
"Apache-2.0"
] | 1 | 2020-07-09T22:02:18.000Z | 2020-07-09T22:02:18.000Z | # Copyright 2016 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-2.0
#
# Unless required by applica... | 35.425719 | 89 | 0.69116 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import inspect
import os
import time
import numpy as np
import six
from tensorflow.contrib.framework import deprecated_arg_values
from tensorflow.contrib.framework.python.ops import variables ... | true | true |
790b7011c7cbd959fb9330d296ab2129185ff98d | 2,670 | py | Python | waves_gateway/model/polling_delay_config.py | NeolithEra/WavesGatewayFramework | e7ba892427e1d0444f2bfdc2922c45ff5f4c4add | [
"MIT"
] | 25 | 2018-03-04T07:49:21.000Z | 2022-03-28T05:20:50.000Z | waves_gateway/model/polling_delay_config.py | NeolithEra/WavesGatewayFramework | e7ba892427e1d0444f2bfdc2922c45ff5f4c4add | [
"MIT"
] | 22 | 2018-03-25T13:19:45.000Z | 2020-11-28T17:21:08.000Z | waves_gateway/model/polling_delay_config.py | NeolithEra/WavesGatewayFramework | e7ba892427e1d0444f2bfdc2922c45ff5f4c4add | [
"MIT"
] | 31 | 2018-03-25T09:45:13.000Z | 2022-03-24T05:32:18.000Z | """
PollingDelayConfig
"""
from typing import Any
class PollingDelayConfig(object):
"""
Summarized configuration for the polling_delay settings in the Gateway Application.
"""
DEFAULT_MIN_TRANSACTION_POLLING_DELAY_S = 0.0
DEFAULT_MAX_TRANSACTION_POLLING_DELAY_S = 60.0
DEFAULT_MIN_ATTEMPT_LIST... | 41.71875 | 115 | 0.762921 | from typing import Any
class PollingDelayConfig(object):
DEFAULT_MIN_TRANSACTION_POLLING_DELAY_S = 0.0
DEFAULT_MAX_TRANSACTION_POLLING_DELAY_S = 60.0
DEFAULT_MIN_ATTEMPT_LIST_WORKER_DELAY_S = 0.1
DEFAULT_MAX_ATTEMPT_LIST_WORKER_DELAY_S = 60.0
def __init__(self,
coin_min_polling_... | true | true |
790b701ad0a2e191a9ac54eb2d8a65fa9667669e | 3,592 | py | Python | leo/plugins/leowapp.py | leonidborisenko/leo-editor | db55bd00c94fb8501795284453891ad64ce12af9 | [
"MIT"
] | 2 | 2020-01-19T18:11:05.000Z | 2020-01-19T18:12:07.000Z | leo/plugins/leowapp.py | leonidborisenko/leo-editor | db55bd00c94fb8501795284453891ad64ce12af9 | [
"MIT"
] | 1 | 2020-06-19T02:28:25.000Z | 2020-06-19T02:28:25.000Z | leo/plugins/leowapp.py | leonidborisenko/leo-editor | db55bd00c94fb8501795284453891ad64ce12af9 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#@+leo-ver=5-thin
#@+node:ekr.20181028052650.1: * @file leowapp.py
#@@first
'''
This file is deprecated/obsolete. It may be removed soon.
leoflexx.py implements LeoWapp using flexx.
'''
#@+<< imports >>
#@+node:ekr.20181028052650.3: ** << imports >>
import leo.core.leoGlobals as g
import leo.c... | 30.700855 | 71 | 0.609131 |
import leo.core.leoGlobals as g
import leo.core.leoFrame as leoFrame
import leo.core.leoGui as leoGui
import sys
try:
import websockets
assert websockets
except ImportError:
websockets = None
print('leowapp.py requires websockets')
print('>pip install websockets')
import xml.sax.saxutils as sa... | true | true |
790b7245570a2e902f9ea79ecfed6a8a92ec5c54 | 2,627 | py | Python | python/html5lib/utils.py | gsnedders/html5lib | a426e4a96f0660b83f3f0bbe6c8160c6f625f199 | [
"MIT"
] | 10 | 2015-02-27T14:06:15.000Z | 2022-01-06T14:17:28.000Z | html5lib/utils.py | rcarmo/soup-strainer | 78304a23bf3a40590e3c322861367594ea28ee32 | [
"MIT"
] | null | null | null | html5lib/utils.py | rcarmo/soup-strainer | 78304a23bf3a40590e3c322861367594ea28ee32 | [
"MIT"
] | 3 | 2015-05-23T04:49:48.000Z | 2021-02-02T21:12:20.000Z | from __future__ import absolute_import
from types import ModuleType
class MethodDispatcher(dict):
u"""Dict with 2 special properties:
On initiation, keys that are lists, sets or tuples are converted to
multiple keys so accessing any one of the items in the original
list-like object returns the matchi... | 31.650602 | 78 | 0.633422 | from __future__ import absolute_import
from types import ModuleType
class MethodDispatcher(dict):
def __init__(self, items=()):
_dictEntries = []
for name,value in items:
if type(name) in (list, tuple, frozenset, set):
for item in name:
... | true | true |
790b72b5977bc41bc1fa4f394888d33023e6e512 | 1,309 | py | Python | array/bot/others/P_ex07.py | timkphd/examples | 04c162ec890a1c9ba83498b275fbdc81a4704062 | [
"Unlicense"
] | 5 | 2020-11-01T00:29:22.000Z | 2022-01-24T19:09:47.000Z | array/bot/others/P_ex07.py | timkphd/examples | 04c162ec890a1c9ba83498b275fbdc81a4704062 | [
"Unlicense"
] | 1 | 2022-02-09T01:59:47.000Z | 2022-02-09T01:59:47.000Z | array/bot/others/P_ex07.py | timkphd/examples | 04c162ec890a1c9ba83498b275fbdc81a4704062 | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python
#
# This program shows how to use MPI_Alltoall. Each processor
# send/rec a different random number to/from other processors.
#
# numpy is required
import numpy
from numpy import *
# mpi4py module
from mpi4py import MPI
import sys
def myquit(mes):
MPI.Finalize()
print(mes)
... | 20.453125 | 63 | 0.675325 |
import numpy
from numpy import *
from mpi4py import MPI
import sys
def myquit(mes):
MPI.Finalize()
print(mes)
sys.exit()
comm=MPI.COMM_WORLD
myid=comm.Get_rank()
numprocs=comm.Get_size()
print("hello from ",myid," of ",numprocs)
s_vals=zeros(numprocs,"i")
r_vals=zeros(numprocs,... | true | true |
790b72d7f3ae9ae0651615ee50721bcffe98f9a0 | 22,370 | py | Python | evennia/scripts/tickerhandler.py | pakhnu/my-world | 405983dca81e70fc64d58d6a60126ffa5e8ada8c | [
"BSD-3-Clause"
] | null | null | null | evennia/scripts/tickerhandler.py | pakhnu/my-world | 405983dca81e70fc64d58d6a60126ffa5e8ada8c | [
"BSD-3-Clause"
] | null | null | null | evennia/scripts/tickerhandler.py | pakhnu/my-world | 405983dca81e70fc64d58d6a60126ffa5e8ada8c | [
"BSD-3-Clause"
] | null | null | null | """
TickerHandler
This implements an efficient Ticker which uses a subscription
model to 'tick' subscribed objects at regular intervals.
The ticker mechanism is used by importing and accessing
the instantiated TICKER_HANDLER instance in this module. This
instance is run by the server; it will save its status across
s... | 38.568966 | 125 | 0.60903 | import inspect
from builtins import object
from twisted.internet.defer import inlineCallbacks
from django.core.exceptions import ObjectDoesNotExist
from evennia.scripts.scripts import ExtendedLoopingCall
from evennia.server.models import ServerConfig
from evennia.utils.logger import log_trace, log_err
from evennia.uti... | true | true |
790b73ae7c3db5599aebd76c699462b81c903bb3 | 3,134 | py | Python | contrib/example.py | MScienceLLC/python-mscience-cachetclient | f7a96685c05fdfed5723ed912ea6cc6a685f8c38 | [
"Apache-2.0"
] | 40 | 2016-07-28T04:09:47.000Z | 2020-10-01T13:00:48.000Z | contrib/example.py | MScienceLLC/python-mscience-cachetclient | f7a96685c05fdfed5723ed912ea6cc6a685f8c38 | [
"Apache-2.0"
] | 12 | 2016-08-15T23:17:20.000Z | 2018-12-17T15:15:25.000Z | contrib/example.py | MScienceLLC/python-mscience-cachetclient | f7a96685c05fdfed5723ed912ea6cc6a685f8c38 | [
"Apache-2.0"
] | 20 | 2016-07-28T04:09:57.000Z | 2021-11-06T11:04:42.000Z | # Copyright Red Hat, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 38.691358 | 79 | 0.674537 |
import cachetclient.cachet as cachet
import json
ENDPOINT = 'http://status.domain.tld/api/v1'
API_TOKEN = 'token'
ping = cachet.Ping(endpoint=ENDPOINT)
print(ping.get())
version = cachet.Version(endpoint=ENDPOINT)
print(version.get())
components = cachet.Components(endpoint=ENDPOINT, api_token=API... | true | true |
790b760f746e75581d92be5781f464a378d95276 | 1,152 | py | Python | spotdl/console/save.py | phcreery/spotdl-v4 | 3bd3768de10ae80b5e1ba3bbe6b792f7fc9f8dfc | [
"MIT"
] | null | null | null | spotdl/console/save.py | phcreery/spotdl-v4 | 3bd3768de10ae80b5e1ba3bbe6b792f7fc9f8dfc | [
"MIT"
] | null | null | null | spotdl/console/save.py | phcreery/spotdl-v4 | 3bd3768de10ae80b5e1ba3bbe6b792f7fc9f8dfc | [
"MIT"
] | null | null | null | """
Save module for the console.
"""
import json
from typing import List, Optional
from spotdl.utils.search import parse_query
from spotdl.utils.m3u import create_m3u_file
def save(
query: List[str],
save_path: str,
downloader,
m3u_file: Optional[str] = None,
) -> None:
"""
Save metadata fr... | 23.510204 | 88 | 0.653646 |
import json
from typing import List, Optional
from spotdl.utils.search import parse_query
from spotdl.utils.m3u import create_m3u_file
def save(
query: List[str],
save_path: str,
downloader,
m3u_file: Optional[str] = None,
) -> None:
songs = parse_query(query, downloader.threads)
... | true | true |
790b767e6c41a97298f27ea96ca9c7f56d49ea7b | 3,690 | py | Python | epinet_fun/util.py | marmus12/CornerView | f76cd1cb4c402c59bafbf66b5e038c2d1ab9610b | [
"MIT"
] | 3 | 2020-03-27T13:36:18.000Z | 2021-11-28T13:56:15.000Z | epinet_fun/util.py | marmus12/CornerView | f76cd1cb4c402c59bafbf66b5e038c2d1ab9610b | [
"MIT"
] | null | null | null | epinet_fun/util.py | marmus12/CornerView | f76cd1cb4c402c59bafbf66b5e038c2d1ab9610b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 23 15:54:01 2018
@author: shinyonsei2
"""
import numpy as np
import imageio
def read_pfm(fpath, expected_identifier="Pf"):
# PFM format definition: http://netpbm.sourceforge.net/doc/pfm.html
def _get_next_line(f):
next_line = f.readline().decode('... | 34.485981 | 122 | 0.566938 |
import numpy as np
import imageio
def read_pfm(fpath, expected_identifier="Pf"):
def _get_next_line(f):
next_line = f.readline().decode('utf-8').rstrip()
while next_line.startswith('#'):
next_line = f.readline().rstrip()
return next_line
with open... | true | true |
790b78db9dc64faf1a637d5079d688e7980bbbab | 8,543 | py | Python | env/lib/python3.8/site-packages/plotly/graph_objs/scatterternary/marker/colorbar/_tickfont.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 11,750 | 2015-10-12T07:03:39.000Z | 2022-03-31T20:43:15.000Z | env/lib/python3.8/site-packages/plotly/graph_objs/scatterternary/marker/colorbar/_tickfont.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 2,951 | 2015-10-12T00:41:25.000Z | 2022-03-31T22:19:26.000Z | env/lib/python3.8/site-packages/plotly/graph_objs/scatterternary/marker/colorbar/_tickfont.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 2,623 | 2015-10-15T14:40:27.000Z | 2022-03-28T16:05:50.000Z | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Tickfont(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatterternary.marker.colorbar"
_path_str = "scatterternary.marker.colorbar.tickfont"
_val... | 37.469298 | 84 | 0.569004 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Tickfont(_BaseTraceHierarchyType):
_parent_path_str = "scatterternary.marker.colorbar"
_path_str = "scatterternary.marker.colorbar.tickfont"
_valid_props = {"color", "family", "size"}
... | true | true |
790b792a2375b0c1f28dfbf256333d23569b151f | 2,154 | py | Python | piot/outputs/amqp.py | frantp/iot-sensor-reader | 8e9b95f7d8a72b594bf121a626cc16ebe54d9d7d | [
"Apache-2.0"
] | null | null | null | piot/outputs/amqp.py | frantp/iot-sensor-reader | 8e9b95f7d8a72b594bf121a626cc16ebe54d9d7d | [
"Apache-2.0"
] | null | null | null | piot/outputs/amqp.py | frantp/iot-sensor-reader | 8e9b95f7d8a72b594bf121a626cc16ebe54d9d7d | [
"Apache-2.0"
] | null | null | null | from queue import Queue, Empty, Full
from ..core import DriverBase, format_msg
import pika
class Driver(DriverBase):
def __init__(self, exchange, queue, routing_key=None, buffer_maxsize=None,
*args, **kwargs):
super().__init__()
self._args = args
self._kwargs = kwargs
... | 33.65625 | 78 | 0.539926 | from queue import Queue, Empty, Full
from ..core import DriverBase, format_msg
import pika
class Driver(DriverBase):
def __init__(self, exchange, queue, routing_key=None, buffer_maxsize=None,
*args, **kwargs):
super().__init__()
self._args = args
self._kwargs = kwargs
... | true | true |
790b793a127e65afd85e24cd9976853a08eef6e2 | 11,584 | py | Python | gammapy/data/data_store.py | qpiel/gammapy | cfb976909e63f4d5d578e1495245c0baad69482b | [
"BSD-3-Clause"
] | null | null | null | gammapy/data/data_store.py | qpiel/gammapy | cfb976909e63f4d5d578e1495245c0baad69482b | [
"BSD-3-Clause"
] | 1 | 2020-10-29T19:55:46.000Z | 2020-10-29T19:55:46.000Z | gammapy/data/data_store.py | qpiel/gammapy | cfb976909e63f4d5d578e1495245c0baad69482b | [
"BSD-3-Clause"
] | null | null | null | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import subprocess
from ..utils.scripts import make_path
from ..utils.testing import Checker
from .obs_table import ObservationTable
from .hdu_index_table impo... | 33.871345 | 87 | 0.601865 |
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import subprocess
from ..utils.scripts import make_path
from ..utils.testing import Checker
from .obs_table import ObservationTable
from .hdu_index_table import HDUIndexTable
from .obs_table import ObservationTableChecker... | true | true |
790b79aaea7d8319d1b7e5c77c5817e21eb1675a | 296 | py | Python | models/user/errors.py | nealwobuhei/pricing-service | 5ed936f169f91f341be6863464833540f37ce071 | [
"MIT"
] | null | null | null | models/user/errors.py | nealwobuhei/pricing-service | 5ed936f169f91f341be6863464833540f37ce071 | [
"MIT"
] | null | null | null | models/user/errors.py | nealwobuhei/pricing-service | 5ed936f169f91f341be6863464833540f37ce071 | [
"MIT"
] | null | null | null |
class UserError(Exception):
def __init__(self, message):
self.message = message
class UserNotFoundError(UserError):
pass
class UserAlreadyRegisteredError(UserError):
pass
class InvalidEmailError(UserError):
pass
class IncorrectPasswordError(UserError):
pass
| 13.454545 | 44 | 0.733108 |
class UserError(Exception):
def __init__(self, message):
self.message = message
class UserNotFoundError(UserError):
pass
class UserAlreadyRegisteredError(UserError):
pass
class InvalidEmailError(UserError):
pass
class IncorrectPasswordError(UserError):
pass
| true | true |
790b7b6ed4419196de8d4867231b93dc74b25ccd | 163 | py | Python | frontend/urls.py | yi-syong/Benga | ef8cff66b8853d03c9615ef36d566cec27b9d9fd | [
"MIT"
] | 2 | 2018-10-22T08:02:09.000Z | 2022-03-15T10:58:34.000Z | frontend/urls.py | yi-syong/Benga | ef8cff66b8853d03c9615ef36d566cec27b9d9fd | [
"MIT"
] | 81 | 2018-10-26T09:02:49.000Z | 2020-10-27T06:30:02.000Z | frontend/urls.py | yi-syong/Benga | ef8cff66b8853d03c9615ef36d566cec27b9d9fd | [
"MIT"
] | 4 | 2018-10-22T05:18:20.000Z | 2018-10-26T02:13:55.000Z | from django.urls import path
from . import views
urlpatterns = [
path('', views.IndexView.as_view()),
path('non-release/', views.NonRelease.as_view()),
]
| 20.375 | 53 | 0.680982 | from django.urls import path
from . import views
urlpatterns = [
path('', views.IndexView.as_view()),
path('non-release/', views.NonRelease.as_view()),
]
| true | true |
790b7d638e4db9ae17a0d926eacc5e9c422ba75b | 17,404 | py | Python | tests/helpers/test_entity_component.py | mhammo30/home-assistant | a7452c096847194e9df8d0f57106140871f00b2f | [
"Apache-2.0"
] | null | null | null | tests/helpers/test_entity_component.py | mhammo30/home-assistant | a7452c096847194e9df8d0f57106140871f00b2f | [
"Apache-2.0"
] | null | null | null | tests/helpers/test_entity_component.py | mhammo30/home-assistant | a7452c096847194e9df8d0f57106140871f00b2f | [
"Apache-2.0"
] | null | null | null | """The tests for the Entity component helper."""
# pylint: disable=protected-access
import asyncio
from collections import OrderedDict
import logging
import unittest
from unittest.mock import patch, Mock
from datetime import timedelta
import pytest
import homeassistant.core as ha
import homeassistant.loader as loader... | 35.230769 | 78 | 0.673006 |
import asyncio
from collections import OrderedDict
import logging
import unittest
from unittest.mock import patch, Mock
from datetime import timedelta
import pytest
import homeassistant.core as ha
import homeassistant.loader as loader
from homeassistant.exceptions import PlatformNotReady
from homeassistant.component... | true | true |
790b7e5bb86de78ff18ece74dc22b85fd64ae3b3 | 1,581 | py | Python | src/lab/split_names.py | decisionscients/Airbnb | f61bc76e4d2806bb827f625fd4acbf14e783b97e | [
"BSD-3-Clause"
] | null | null | null | src/lab/split_names.py | decisionscients/Airbnb | f61bc76e4d2806bb827f625fd4acbf14e783b97e | [
"BSD-3-Clause"
] | null | null | null | src/lab/split_names.py | decisionscients/Airbnb | f61bc76e4d2806bb827f625fd4acbf14e783b97e | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# ============================================================================ #
# Project : Airbnb #
# Version : 0.1.0 #
# File : split_names.py ... | 52.7 | 80 | 0.253004 |
import os
directory = "./data/raw/"
filenames = os.listdir(directory)
for filename in filenames:
name = filename.split(".")[0]
print(name)
| true | true |
790b7eb82afd42b7665db5d5d6e164b7173cb21d | 1,215 | py | Python | tests/test_reward.py | AlejandroCN7/sinergym | 4e89e478b5c939323e7ddf6a6ecf25a9a13251c6 | [
"MIT"
] | null | null | null | tests/test_reward.py | AlejandroCN7/sinergym | 4e89e478b5c939323e7ddf6a6ecf25a9a13251c6 | [
"MIT"
] | null | null | null | tests/test_reward.py | AlejandroCN7/sinergym | 4e89e478b5c939323e7ddf6a6ecf25a9a13251c6 | [
"MIT"
] | null | null | null | import pytest
import sinergym.utils.rewards as R
@pytest.mark.parametrize(
'power,temperatures,month,day,reward,reward_energy,reward_comfort',
[
# Input 1
(
186.5929171535975,
[22.16742570092868],
3,
31,
-0.009329645857679876,
... | 22.5 | 71 | 0.498765 | import pytest
import sinergym.utils.rewards as R
@pytest.mark.parametrize(
'power,temperatures,month,day,reward,reward_energy,reward_comfort',
[
(
186.5929171535975,
[22.16742570092868],
3,
31,
-0.009329645857679876,
-0.... | true | true |
790b7f3b5f7aa5eabe58e81bbe44ccabc0528705 | 2,728 | py | Python | automatminer/utils/tests/test_pkg.py | sgbaird/automatminer | 9a3996e37672b547f10645b53b816ee670940d56 | [
"BSD-3-Clause-LBNL"
] | 92 | 2018-11-28T17:36:42.000Z | 2022-03-26T07:45:22.000Z | automatminer/utils/tests/test_pkg.py | sgbaird/automatminer | 9a3996e37672b547f10645b53b816ee670940d56 | [
"BSD-3-Clause-LBNL"
] | 249 | 2018-11-30T22:09:15.000Z | 2022-01-06T22:25:12.000Z | automatminer/utils/tests/test_pkg.py | sgbaird/automatminer | 9a3996e37672b547f10645b53b816ee670940d56 | [
"BSD-3-Clause-LBNL"
] | 41 | 2018-11-21T22:33:52.000Z | 2022-03-03T02:24:32.000Z | """
Assorted package utils.
"""
import os
import unittest
import pandas as pd
from automatminer import __version__
from automatminer.base import DFTransformer
from automatminer.utils.pkg import (
AMM_SUPPORTED_EXTS,
check_fitted,
compare_columns,
get_version,
save_dict_to_file,
set_fitted,
)
fr... | 29.652174 | 78 | 0.637097 | import os
import unittest
import pandas as pd
from automatminer import __version__
from automatminer.base import DFTransformer
from automatminer.utils.pkg import (
AMM_SUPPORTED_EXTS,
check_fitted,
compare_columns,
get_version,
save_dict_to_file,
set_fitted,
)
from sklearn.exceptions import Not... | true | true |
790b7f78f12dd92d1977e1fc6cc9107b15ec9c8d | 8,916 | py | Python | supar/structs/fn.py | zysite/parser | 8ed9ccb8e542655fd6fd1b6f7faaf084d13a866e | [
"MIT"
] | 6 | 2018-10-26T14:08:45.000Z | 2019-01-26T02:42:17.000Z | supar/structs/fn.py | zysite/parser | 8ed9ccb8e542655fd6fd1b6f7faaf084d13a866e | [
"MIT"
] | 1 | 2019-01-16T14:44:29.000Z | 2019-01-17T07:55:38.000Z | supar/structs/fn.py | zysite/parser | 8ed9ccb8e542655fd6fd1b6f7faaf084d13a866e | [
"MIT"
] | 1 | 2018-12-31T07:43:16.000Z | 2018-12-31T07:43:16.000Z | # -*- coding: utf-8 -*-
import torch
from supar.utils.common import MIN
from supar.utils.fn import pad
from torch.autograd import Function
def tarjan(sequence):
r"""
Tarjan algorithm for finding Strongly Connected Components (SCCs) of a graph.
Args:
sequence (list):
List of head indi... | 34.55814 | 127 | 0.574361 |
import torch
from supar.utils.common import MIN
from supar.utils.fn import pad
from torch.autograd import Function
def tarjan(sequence):
sequence = [-1] + sequence
dfn = [-1] * len(sequence)
low = [-1] * len(sequence)
stack, onstack = [], [False] * len(sequence)
def connect(i, t... | true | true |
790b7fce83d886900a5fcc3446fe99b2c83b3bf4 | 9,579 | py | Python | cbpro/order_book.py | ibraaaa/coinbasepro-python | 0a9dbd86a25ae266d0e0eefeb112368c284b7dcc | [
"MIT"
] | 5 | 2019-05-04T01:30:34.000Z | 2020-11-26T05:07:08.000Z | cbpro/order_book.py | ibraaaa/coinbasepro-python | 0a9dbd86a25ae266d0e0eefeb112368c284b7dcc | [
"MIT"
] | 4 | 2021-03-19T02:41:55.000Z | 2022-03-11T23:55:52.000Z | cbpro/order_book.py | ibraaaa/coinbasepro-python | 0a9dbd86a25ae266d0e0eefeb112368c284b7dcc | [
"MIT"
] | 2 | 2018-01-15T23:37:49.000Z | 2018-06-24T16:27:53.000Z | #
# cbpro/order_book.py
# David Caseria
#
# Live order book updated from the Coinbase Websocket Feed
from sortedcontainers import SortedDict
from decimal import Decimal
import pickle
from cbpro.public_client import PublicClient
from cbpro.websocket_client import WebsocketClient
class OrderBook(WebsocketClient):
... | 32.036789 | 119 | 0.524167 |
from sortedcontainers import SortedDict
from decimal import Decimal
import pickle
from cbpro.public_client import PublicClient
from cbpro.websocket_client import WebsocketClient
class OrderBook(WebsocketClient):
def __init__(self, product_id='BTC-USD', log_to=None):
super(OrderBook, self).__init__(... | true | true |
790b81de9070d0250802693998ac3959dc4b0065 | 4,576 | py | Python | scripts/train_model.py | Voda88/mlops | 412e95b6580e9820d4e57f93bd4c52ec877162eb | [
"MIT"
] | null | null | null | scripts/train_model.py | Voda88/mlops | 412e95b6580e9820d4e57f93bd4c52ec877162eb | [
"MIT"
] | null | null | null | scripts/train_model.py | Voda88/mlops | 412e95b6580e9820d4e57f93bd4c52ec877162eb | [
"MIT"
] | null | null | null | """
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft Corporation (“Microsoft”) grants you a nonexclusive, perpetual,
royalty-free right to use, copy, and modify the software code provided by us
("Software Code"). You may not sublicense the Software Code or any use of it
(except to your affiliates... | 34.666667 | 79 | 0.696897 | from azureml.core.run import Run
import os
import argparse
from sklearn.linear_model import Ridge
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split
import joblib
import json
def train_model(run, data, alpha):
run.log("alpha", alpha)
run.parent.log("alpha", alp... | true | true |
790b820a6fc0f0a35e231d3e3a829a935b761f89 | 4,734 | py | Python | mlrun/runtimes/function_reference.py | Hedingber/mlrun | e2269718fcc7caa7e1aa379ac28495830b45f9da | [
"Apache-2.0"
] | 1 | 2021-02-17T08:12:33.000Z | 2021-02-17T08:12:33.000Z | mlrun/runtimes/function_reference.py | Hedingber/mlrun | e2269718fcc7caa7e1aa379ac28495830b45f9da | [
"Apache-2.0"
] | 1 | 2020-12-31T14:36:29.000Z | 2020-12-31T14:36:29.000Z | mlrun/runtimes/function_reference.py | Hedingber/mlrun | e2269718fcc7caa7e1aa379ac28495830b45f9da | [
"Apache-2.0"
] | 1 | 2021-08-30T21:43:38.000Z | 2021-08-30T21:43:38.000Z | # Copyright 2018 Iguazio
#
# 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, softwa... | 33.814286 | 83 | 0.586608 |
import os
from base64 import b64encode
from nuclio.build import mlrun_footer
import mlrun
from ..model import ModelObj
from ..utils import generate_object_uri
from .utils import enrich_function_from_dict
class FunctionReference(ModelObj):
def __init__(
self,
url=None,
ima... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.