hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
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 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f74629bde46e9eec2b88d3e3f9c3d44899f50383 | 754 | py | Python | stocal/examples/brusselator.py | MrLiono21/stocal | 7f7110c5b6401e7332d5d35c843b6fedafd464c2 | [
"MIT"
] | null | null | null | stocal/examples/brusselator.py | MrLiono21/stocal | 7f7110c5b6401e7332d5d35c843b6fedafd464c2 | [
"MIT"
] | null | null | null | stocal/examples/brusselator.py | MrLiono21/stocal | 7f7110c5b6401e7332d5d35c843b6fedafd464c2 | [
"MIT"
] | null | null | null | """Brusselator
A stochastic realization of the famous Brusselator system, first
proposed in I. Prigogine and R. Lefever, Symmetry Breaking Instabilities
in Dissipative Systems, J. Chem. Phys. 48, 1695 (1968).
This is a simple example of a process with only static (non-infered)
reactions. The deterministic system exhi... | 29 | 72 | 0.649867 |
import stocal
a = 2.
b = 10.
traj = stocal.Process([
stocal.MassAction({}, {"x": 1}, a),
stocal.MassAction({"x": 2, "y": 1}, {"x": 3}, 1.),
stocal.MassAction({"x": 1}, {"y": 1, "c": 1}, b),
stocal.MassAction({"x": 1}, {"d": 1}, 1.),
]).trajectory({}, tmax=50)
print("# time\tx\ty\tc\td")
for transiti... | true | true |
f7462ac7c5ac5e712a88cf9551322732b096d85e | 1,448 | py | Python | libs/models/DotProductClassifier.py | rahulvigneswaran/TailCalibX | 0ed18cc8903715c0e31934c54226a53b1bbfc198 | [
"MIT"
] | 34 | 2021-11-09T01:24:03.000Z | 2022-03-07T08:13:12.000Z | libs/models/DotProductClassifier.py | rahulvigneswaran/TailCalibX | 0ed18cc8903715c0e31934c54226a53b1bbfc198 | [
"MIT"
] | 6 | 2021-12-06T10:09:40.000Z | 2022-03-11T03:15:02.000Z | libs/models/DotProductClassifier.py | rahulvigneswaran/TailCalibX | 0ed18cc8903715c0e31934c54226a53b1bbfc198 | [
"MIT"
] | null | null | null | # Imports
import torch.nn as nn
from os import path
import torch
import torch.nn.functional as F
class DotProduct_Classifier(nn.Module):
def __init__(self, num_classes=1000, feat_dim=2048, *args):
super(DotProduct_Classifier, self).__init__()
self.fc = nn.Linear(feat_dim, num_classes)
def forw... | 30.166667 | 87 | 0.618785 |
import torch.nn as nn
from os import path
import torch
import torch.nn.functional as F
class DotProduct_Classifier(nn.Module):
def __init__(self, num_classes=1000, feat_dim=2048, *args):
super(DotProduct_Classifier, self).__init__()
self.fc = nn.Linear(feat_dim, num_classes)
def forward(self,... | true | true |
f7462ace2147906df3c974bbeec2ef419e52b2bb | 7,061 | py | Python | test/functional/maxuploadtarget.py | bwsnetwork/bwscoin | 3e71428f47a9923a024ea7b63dbdc9fd84afa266 | [
"MIT"
] | null | null | null | test/functional/maxuploadtarget.py | bwsnetwork/bwscoin | 3e71428f47a9923a024ea7b63dbdc9fd84afa266 | [
"MIT"
] | null | null | null | test/functional/maxuploadtarget.py | bwsnetwork/bwscoin | 3e71428f47a9923a024ea7b63dbdc9fd84afa266 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test behavior of -maxuploadtarget.
* Verify that getdata requests for old blocks (>1week) are dropped
... | 40.58046 | 107 | 0.67186 |
from collections import defaultdict
import time
from test_framework.mininode import *
from test_framework.test_framework import BWScoinTestFramework
from test_framework.util import *
class TestNode(NodeConnCB):
def __init__(self):
super().__init__()
self.block_receive_map = defaultdict(int)
... | true | true |
f7462bd2d298f20531e034a878027d0c57e34fba | 28,849 | py | Python | contrib/sign-releases.py | zebra-lucky/electrum-zcash | 2e66d47fa043d8c5ea536cd27a09dfb9e4ec314b | [
"MIT"
] | 11 | 2018-08-06T22:37:42.000Z | 2021-09-19T12:44:16.000Z | contrib/sign-releases.py | zebra-lucky/electrum-zcash | 2e66d47fa043d8c5ea536cd27a09dfb9e4ec314b | [
"MIT"
] | 9 | 2019-04-28T18:33:24.000Z | 2021-07-12T07:17:48.000Z | contrib/sign-releases.py | zebra-lucky/electrum-zcash | 2e66d47fa043d8c5ea536cd27a09dfb9e4ec314b | [
"MIT"
] | 14 | 2018-04-29T16:30:44.000Z | 2022-03-25T13:42:40.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Sign releases on github, make/upload ppa to launchpad.net
NOTE on ppa: To build a ppa you may need to install some more packages.
On ubuntu:
sudo apt-get install devscripts libssl-dev python3-dev \
debhelper python3-setuptools dh-python
NOTE on apk sig... | 37.760471 | 90 | 0.556622 |
import os
import os.path
import re
import sys
import time
import getpass
import shutil
import hashlib
import tempfile
import json
import zipfile
from subprocess import check_call, CalledProcessError
from functools import cmp_to_key
from time import localtime, strftime
try:
import click
import certifi
im... | true | true |
f7462bda0cfdece53a7a310429c15cc95cd30192 | 6,668 | py | Python | testing.py | Pavivenkatesan/TicTacToe-RL-MM- | fbaab6bb9574b82ae0d79c818ba74d049375bfd4 | [
"MIT"
] | null | null | null | testing.py | Pavivenkatesan/TicTacToe-RL-MM- | fbaab6bb9574b82ae0d79c818ba74d049375bfd4 | [
"MIT"
] | null | null | null | testing.py | Pavivenkatesan/TicTacToe-RL-MM- | fbaab6bb9574b82ae0d79c818ba74d049375bfd4 | [
"MIT"
] | null | null | null | import numpy as np
from math import inf as infinity
from itertools import product
from collections import defaultdict
import random
import time
# Initializing the Tic-Tac-Toe environment
# Three rows-Three columns, creating an empty list of three empty lists
state_space = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ... | 36.637363 | 115 | 0.589232 | import numpy as np
from math import inf as infinity
from itertools import product
from collections import defaultdict
import random
import time
state_space = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ' ']]
players = ['X', 'O']
def play(sv, each_player, cell):
if sv[int((cell - 1) / 3)][(cell - 1) % 3] is... | true | true |
f7462ce37ba91d11ca56ac67776e936d9e0ccbae | 672 | py | Python | osmchadjango/changeset/migrations/0011_import.py | juusokor/osmcha-django | 5daafa015d5e341aa8ad6f847be2b7cc1a204e2b | [
"BSD-2-Clause"
] | 27 | 2015-09-06T00:39:39.000Z | 2021-12-09T10:30:52.000Z | osmchadjango/changeset/migrations/0011_import.py | juusokor/osmcha-django | 5daafa015d5e341aa8ad6f847be2b7cc1a204e2b | [
"BSD-2-Clause"
] | 494 | 2015-09-10T19:39:38.000Z | 2022-03-29T08:07:37.000Z | osmchadjango/changeset/migrations/0011_import.py | juusokor/osmcha-django | 5daafa015d5e341aa8ad6f847be2b7cc1a204e2b | [
"BSD-2-Clause"
] | 17 | 2015-08-10T22:58:56.000Z | 2021-09-24T17:03:16.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('changeset', '0010_auto_20151227_1306'),
]
operations = [
migrations.CreateModel(
name='Import',
fiel... | 28 | 114 | 0.580357 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('changeset', '0010_auto_20151227_1306'),
]
operations = [
migrations.CreateModel(
name='Import',
fields=[
('... | true | true |
f7462d85c6a556d88fe2addea11601d34715df15 | 313 | py | Python | composite/errors.py | Skydipper/Composite | 5b44e0d773331cc586a02769d21fb7603fa4027d | [
"MIT"
] | null | null | null | composite/errors.py | Skydipper/Composite | 5b44e0d773331cc586a02769d21fb7603fa4027d | [
"MIT"
] | null | null | null | composite/errors.py | Skydipper/Composite | 5b44e0d773331cc586a02769d21fb7603fa4027d | [
"MIT"
] | null | null | null | """ERRORS"""
class Error(Exception):
"""Main Error Class"""
def __init__(self, message):
self.message = message
@property
def serialize(self):
return {
'message': self.message
}
class CompositeError(Error):
pass
class GeostoreNotFound(Error):
pass | 15.65 | 35 | 0.591054 |
class Error(Exception):
def __init__(self, message):
self.message = message
@property
def serialize(self):
return {
'message': self.message
}
class CompositeError(Error):
pass
class GeostoreNotFound(Error):
pass | true | true |
f7463004147e32c288f83832b3dab0761e6836fd | 1,207 | py | Python | Blob Rage App/random/PongBall.py | povellesto/blobydouche | 7d9eda9d262fa3ea99661b1a419a17f85dd21b17 | [
"Unlicense"
] | 1 | 2015-07-30T20:52:55.000Z | 2015-07-30T20:52:55.000Z | Blob Rage App/random/PongBall.py | povellesto/blobydouche | 7d9eda9d262fa3ea99661b1a419a17f85dd21b17 | [
"Unlicense"
] | 1 | 2015-11-23T23:56:08.000Z | 2015-11-23T23:56:08.000Z | Blob Rage App/random/PongBall.py | povellesto/blobydouche | 7d9eda9d262fa3ea99661b1a419a17f85dd21b17 | [
"Unlicense"
] | null | null | null | from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ReferenceListProperty,\
ObjectProperty
from kivy.vector import Vector
from kivy.clock import Clock
from random import randint
class PongBall(Widget):
velocity_x = NumericProperty(0)
velocity_y = Numeri... | 25.680851 | 68 | 0.652858 | from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ReferenceListProperty,\
ObjectProperty
from kivy.vector import Vector
from kivy.clock import Clock
from random import randint
class PongBall(Widget):
velocity_x = NumericProperty(0)
velocity_y = Numeri... | true | true |
f746305cdd91687d07ef5dfd8ff69e0ba361e3d4 | 158 | py | Python | test/test_sample.py | gbroiles/tax | 1f0873db85a8ee489b991e9d129fd2395087b95a | [
"MIT"
] | 1 | 2022-03-03T13:15:31.000Z | 2022-03-03T13:15:31.000Z | test/test_sample.py | gbroiles/tax | 1f0873db85a8ee489b991e9d129fd2395087b95a | [
"MIT"
] | null | null | null | test/test_sample.py | gbroiles/tax | 1f0873db85a8ee489b991e9d129fd2395087b95a | [
"MIT"
] | null | null | null | # pylint: disable=invalid-name,missing-module-docstring,missing-function-docstring
def func(x):
return x + 1
def test_answer():
assert func(3) == 4
| 19.75 | 82 | 0.708861 |
def func(x):
return x + 1
def test_answer():
assert func(3) == 4
| true | true |
f74632014b9c8bab8859a4a3e60fc8a2885d2413 | 6,058 | py | Python | myvenv/lib/python3.5/site-packages/allauth/socialaccount/providers/twitter/south_migrations/0002_snowflake.py | tuvapp/tuvappcom | 5ca2be19f4b0c86a1d4a9553711a4da9d3f32841 | [
"MIT"
] | 3 | 2018-10-28T13:45:22.000Z | 2021-06-14T11:20:53.000Z | myvenv/lib/python3.5/site-packages/allauth/socialaccount/providers/twitter/south_migrations/0002_snowflake.py | tuvapp/tuvappcom | 5ca2be19f4b0c86a1d4a9553711a4da9d3f32841 | [
"MIT"
] | 9 | 2020-06-05T17:18:43.000Z | 2022-03-11T23:15:04.000Z | myvenv/lib/python3.5/site-packages/allauth/socialaccount/providers/twitter/south_migrations/0002_snowflake.py | tuvapp/tuvappcom | 5ca2be19f4b0c86a1d4a9553711a4da9d3f32841 | [
"MIT"
] | 3 | 2018-10-28T13:45:24.000Z | 2020-03-28T02:27:56.000Z | # encoding: utf-8
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'TwitterAccount.social_id'
db.alter_column('twitter_twitteraccount', 'social_id', self.gf('django.db.models.fields.BigIntegerField')(u... | 67.311111 | 182 | 0.572961 |
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
db.alter_column('twitter_twitteraccount', 'social_id', self.gf('django.db.models.fields.BigIntegerField')(unique=True))
def backwards(self, orm):
... | true | true |
f7463228e7902d5da3bb1aca0ac1207d701837ca | 5,237 | py | Python | src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/pacman/operations/router_compressors/malloc_based_route_merger.py | Roboy/LSM_SpiNNaker_MyoArm | 04fa1eaf78778edea3ba3afa4c527d20c491718e | [
"BSD-3-Clause"
] | 2 | 2020-11-01T13:22:11.000Z | 2020-11-01T13:22:20.000Z | src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/pacman/operations/router_compressors/malloc_based_route_merger.py | Roboy/LSM_SpiNNaker_MyoArm | 04fa1eaf78778edea3ba3afa4c527d20c491718e | [
"BSD-3-Clause"
] | null | null | null | src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/pacman/operations/router_compressors/malloc_based_route_merger.py | Roboy/LSM_SpiNNaker_MyoArm | 04fa1eaf78778edea3ba3afa4c527d20c491718e | [
"BSD-3-Clause"
] | null | null | null | from pacman.model.routing_tables.multicast_routing_table\
import MulticastRoutingTable
from pacman.model.routing_tables.multicast_routing_tables\
import MulticastRoutingTables
from spinn_machine.utilities.progress_bar import ProgressBar
from spinn_machine.multicast_routing_entry import MulticastRoutingEntry
im... | 42.233871 | 78 | 0.561199 | from pacman.model.routing_tables.multicast_routing_table\
import MulticastRoutingTable
from pacman.model.routing_tables.multicast_routing_tables\
import MulticastRoutingTables
from spinn_machine.utilities.progress_bar import ProgressBar
from spinn_machine.multicast_routing_entry import MulticastRoutingEntry
im... | false | true |
f746329abd608811188266f337aeff7de7396a2c | 8,090 | py | Python | ondewo/nlu/convenience/shared_request_data.py | foldvaridominic/ondewo-nlu-client-python | a4e766252fc2fdd2372860755082480b4234609a | [
"Apache-2.0"
] | null | null | null | ondewo/nlu/convenience/shared_request_data.py | foldvaridominic/ondewo-nlu-client-python | a4e766252fc2fdd2372860755082480b4234609a | [
"Apache-2.0"
] | 5 | 2021-11-23T09:43:28.000Z | 2021-12-17T15:09:06.000Z | ondewo/nlu/convenience/shared_request_data.py | foldvaridominic/ondewo-nlu-client-python | a4e766252fc2fdd2372860755082480b4234609a | [
"Apache-2.0"
] | 1 | 2022-02-22T08:54:57.000Z | 2022-02-22T08:54:57.000Z | # Copyright 2021 ONDEWO GmbH
#
# 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, ... | 40.049505 | 118 | 0.630532 |
from dataclasses import dataclass
from typing import Optional, TypeVar, Dict, Type, Any
from uuid import uuid4
from google.protobuf.message import Message
from ondewo.nlu.context_pb2 import CreateContextRequest, ListContextsRequest, UpdateContextRequest, \
DeleteContextRequest, DeleteAllContextsReq... | true | true |
f74632a77271f1c3e58a85e3b3b8550fe87b7433 | 6,226 | py | Python | adafruit_epd/il0373.py | ladyada/Adafruit_CircuitPython_EPD | 4b2bbed6096cc9febb36abf71bc9f093ca175b3f | [
"MIT"
] | null | null | null | adafruit_epd/il0373.py | ladyada/Adafruit_CircuitPython_EPD | 4b2bbed6096cc9febb36abf71bc9f093ca175b3f | [
"MIT"
] | null | null | null | adafruit_epd/il0373.py | ladyada/Adafruit_CircuitPython_EPD | 4b2bbed6096cc9febb36abf71bc9f093ca175b3f | [
"MIT"
] | 1 | 2019-10-08T14:05:52.000Z | 2019-10-08T14:05:52.000Z | # The MIT License (MIT)
#
# Copyright (c) 2018 Dean Miller 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 righ... | 38.432099 | 86 | 0.676839 |
import time
from micropython import const
import adafruit_framebuf
from adafruit_epd.epd import Adafruit_EPD
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_EPD.git"
_IL0373_PANEL_SETTING = const(0x00)
_IL0373_POWER_SETTING = const(0x01)
_IL0373_POWER_... | true | true |
f74632da87bc118e8ef70accfd01c8d085a9cbd9 | 2,299 | py | Python | modspectra/tests/test_spectrum_creation.py | Deech08/modspectra | 4af177418f9ac3e1ff30bf99968251ac143a96bc | [
"BSD-3-Clause"
] | 2 | 2020-06-04T13:09:50.000Z | 2020-06-04T13:10:03.000Z | modspectra/tests/test_spectrum_creation.py | Deech08/modspectra | 4af177418f9ac3e1ff30bf99968251ac143a96bc | [
"BSD-3-Clause"
] | 1 | 2020-10-29T19:55:57.000Z | 2020-10-29T19:55:57.000Z | modspectra/tests/test_spectrum_creation.py | Deech08/modspectra | 4af177418f9ac3e1ff30bf99968251ac143a96bc | [
"BSD-3-Clause"
] | null | null | null | import pytest
from numpy.random import randn
from numpy.random import random
import numpy as np
def test_non_detection():
from ..cube import EmissionCube
from astropy.coordinates import SkyCoord
import astropy.units as u
'''
Test that an anti-center pointing returns zero emission
'''
l = 18... | 32.842857 | 94 | 0.638104 | import pytest
from numpy.random import randn
from numpy.random import random
import numpy as np
def test_non_detection():
from ..cube import EmissionCube
from astropy.coordinates import SkyCoord
import astropy.units as u
l = 180. + randn()*130.
b = 0. + randn()*20.
while (l > 340.) | (l < 20.):... | true | true |
f74633c22a37d101ac85f8910da6786906416b29 | 1,144 | py | Python | tests/test_compress_string_in_memory.py | chrisbrake/PythonSandbox | 8cd2ea847676d6a300b55c560f49cd980f760b00 | [
"BSD-3-Clause"
] | 1 | 2018-10-19T17:35:01.000Z | 2018-10-19T17:35:01.000Z | tests/test_compress_string_in_memory.py | chrisbrake/PythonSandbox | 8cd2ea847676d6a300b55c560f49cd980f760b00 | [
"BSD-3-Clause"
] | null | null | null | tests/test_compress_string_in_memory.py | chrisbrake/PythonSandbox | 8cd2ea847676d6a300b55c560f49cd980f760b00 | [
"BSD-3-Clause"
] | null | null | null | import unittest
from hypothesis import given, settings
from hypothesis.strategies import text
from sys import getsizeof
from compressStr import compress_string, decompress_string
class TestMyGzip(unittest.TestCase):
"""
Unit tests for the my_gzip module.
"""
@given(string=text())
@settings(max_ex... | 28.6 | 78 | 0.687937 | import unittest
from hypothesis import given, settings
from hypothesis.strategies import text
from sys import getsizeof
from compressStr import compress_string, decompress_string
class TestMyGzip(unittest.TestCase):
@given(string=text())
@settings(max_examples=100)
def test_combined(self, string):
... | true | true |
f7463443523d397e921c65423c1b8bc69d31ce42 | 3,908 | py | Python | Non-React Stuff/alexa/lambda/skill_env/ask_sdk_model/interfaces/geolocation/altitude.py | ReciPull/reciprogram | b8c7e4610f95c5beafad3c9880fc5beceec523e7 | [
"MIT"
] | 1 | 2019-09-16T19:13:13.000Z | 2019-09-16T19:13:13.000Z | Non-React Stuff/alexa/lambda/skill_env/ask_sdk_model/interfaces/geolocation/altitude.py | ReciPull/reciprogram | b8c7e4610f95c5beafad3c9880fc5beceec523e7 | [
"MIT"
] | 5 | 2021-03-09T03:30:14.000Z | 2022-02-26T10:42:17.000Z | alexa/reciPullLambda/ask_sdk_model/interfaces/geolocation/altitude.py | ReciPull/recipull.github.io | e6b800af02658bb7948297c4ddc1b7af6d978839 | [
"MIT"
] | null | null | null | # coding: utf-8
#
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "lice... | 33.982609 | 108 | 0.614893 |
import pprint
import re
import six
import typing
from enum import Enum
if typing.TYPE_CHECKING:
from typing import Dict, List, Optional
from datetime import datetime
class Altitude(object):
deserialized_types = {
'altitude_in_meters': 'float',
'accuracy_in_meters': 'floa... | true | true |
f74634f6d834e3416a312a3b1d3e86102db1d471 | 13,687 | py | Python | pymatgen/util/provenance.py | frssp/pymatgen | bdd977f065b66191557c7398b31a1571bc541fdb | [
"MIT"
] | 5 | 2019-04-11T20:57:38.000Z | 2021-12-01T05:00:42.000Z | pymatgen/util/provenance.py | frssp/pymatgen | bdd977f065b66191557c7398b31a1571bc541fdb | [
"MIT"
] | null | null | null | pymatgen/util/provenance.py | frssp/pymatgen | bdd977f065b66191557c7398b31a1571bc541fdb | [
"MIT"
] | 3 | 2019-10-14T19:47:34.000Z | 2020-07-02T08:10:45.000Z | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import unicode_literals
import sys
import re
import datetime
from collections import namedtuple
import json
from six.moves import map, cStringIO
from six import string_types
from monty.json i... | 37.914127 | 79 | 0.582597 |
from __future__ import unicode_literals
import sys
import re
import datetime
from collections import namedtuple
import json
from six.moves import map, cStringIO
from six import string_types
from monty.json import MontyDecoder, MontyEncoder
from monty.string import remove_non_ascii
from pymatgen.core.structure i... | true | true |
f746354c8bc97f12b0e70462cad6ce3a683e32d9 | 14,735 | py | Python | weather_class.py | RickyMexx/ML-weather | 6d0a1b718b7b946ebb0c5df6ae990de9724ca5a0 | [
"Apache-2.0"
] | null | null | null | weather_class.py | RickyMexx/ML-weather | 6d0a1b718b7b946ebb0c5df6ae990de9724ca5a0 | [
"Apache-2.0"
] | null | null | null | weather_class.py | RickyMexx/ML-weather | 6d0a1b718b7b946ebb0c5df6ae990de9724ca5a0 | [
"Apache-2.0"
] | null | null | null | # *************** SETTINGS *************** #
MODEL_NAME = 'VGG16-TL'
BATCH_SIZE = 6
EPOCHS = 100
EXIF_FLAG = 0 # Set on 1 if the program is running for the first time with a dataset D, 0 otherwise.
MODELS_DIR = 'models/'
trainingset = "Train_New/"
testset1 = "Test_New/"
testset2 = "Weather_Testset/"
blindtest = "Bli... | 34.267442 | 122 | 0.612827 | MODEL_NAME = 'VGG16-TL'
BATCH_SIZE = 6
EPOCHS = 100
EXIF_FLAG = 0
MODELS_DIR = 'models/'
trainingset = "Train_New/"
testset1 = "Test_New/"
testset2 = "Weather_Testset/"
blindtest = "BlindTest/"
mytestset = "MyTestSet/"
imgstype = "*/*.jpg"
csv_file = '1743168.csv'
img_w = 136
img_h = 136
import tensorflow as tf... | true | true |
f7463705b85deb5e40fa3c6ea526af21d0c215db | 18,952 | py | Python | trax/supervised/trainer_lib_test.py | pkozakowski/trax | 31215c378017347e0b66ba51c37cd3cbedf60b17 | [
"Apache-2.0"
] | null | null | null | trax/supervised/trainer_lib_test.py | pkozakowski/trax | 31215c378017347e0b66ba51c37cd3cbedf60b17 | [
"Apache-2.0"
] | null | null | null | trax/supervised/trainer_lib_test.py | pkozakowski/trax | 31215c378017347e0b66ba51c37cd3cbedf60b17 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2021 The Trax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 32.067682 | 113 | 0.64732 |
import functools
import os
from absl.testing import absltest
from absl.testing import parameterized
from jax import test_util
from jax.config import config
from jax.lib import xla_bridge
import tensorflow.compat.v2 as tf
from trax import fastmath
from trax import layers as tl
from trax import models
... | true | true |
f746380c9e6babb6ad16bd75200d914d0728130a | 570 | py | Python | modules/test/test_wuvt.py | shardulc/phenny | 950a247cc9f3335e671d7c68ddbae6abdca1c9db | [
"EFL-2.0"
] | null | null | null | modules/test/test_wuvt.py | shardulc/phenny | 950a247cc9f3335e671d7c68ddbae6abdca1c9db | [
"EFL-2.0"
] | null | null | null | modules/test/test_wuvt.py | shardulc/phenny | 950a247cc9f3335e671d7c68ddbae6abdca1c9db | [
"EFL-2.0"
] | null | null | null | """
test_wuvt.py - tests for the wuvt module
author: mutantmonkey <mutantmonkey@mutantmonkey.in>
"""
import re
import unittest
from mock import MagicMock
from modules import wuvt
from web import catch_timeout
@catch_timeout
class TestWuvt(unittest.TestCase):
def setUp(self):
self.phenny = MagicMock()
... | 22.8 | 63 | 0.664912 | import re
import unittest
from mock import MagicMock
from modules import wuvt
from web import catch_timeout
@catch_timeout
class TestWuvt(unittest.TestCase):
def setUp(self):
self.phenny = MagicMock()
@catch_timeout
def test_wuvt(self):
wuvt.wuvt(self.phenny, None)
out = self.phe... | true | true |
f7463ae1524cfa45817e7c26efac69fb7460cdbb | 1,126 | py | Python | 30 Days of Code/day24_more_linked_lists.py | quqixun/Hackerrank_Python | 024084a5a77878ce2b4b99d731be28b221f58e41 | [
"MIT"
] | 1 | 2018-11-12T01:48:22.000Z | 2018-11-12T01:48:22.000Z | 30 Days of Code/day24_more_linked_lists.py | quqixun/Hackerrank_Python | 024084a5a77878ce2b4b99d731be28b221f58e41 | [
"MIT"
] | null | null | null | 30 Days of Code/day24_more_linked_lists.py | quqixun/Hackerrank_Python | 024084a5a77878ce2b4b99d731be28b221f58e41 | [
"MIT"
] | null | null | null | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Solution:
def insert(self, head, data):
p = Node(data)
if head is None:
head = p
elif head.next is None:
head.next = p
else:
start = head
... | 21.653846 | 49 | 0.525755 | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Solution:
def insert(self, head, data):
p = Node(data)
if head is None:
head = p
elif head.next is None:
head.next = p
else:
start = head
... | true | true |
f7463d2fac9a8c36fcec7fb3b00aff253cdd4fbe | 2,741 | py | Python | libs/networks/builder.py | liyongsheng-tech/pkuseg | e5bd8a4f7e2589a3c132c291433abd3be5c69dba | [
"Apache-2.0"
] | 2 | 2020-02-03T13:33:23.000Z | 2020-05-13T07:24:37.000Z | libs/networks/builder.py | liyongsheng-tech/pkuseg | e5bd8a4f7e2589a3c132c291433abd3be5c69dba | [
"Apache-2.0"
] | null | null | null | libs/networks/builder.py | liyongsheng-tech/pkuseg | e5bd8a4f7e2589a3c132c291433abd3be5c69dba | [
"Apache-2.0"
] | null | null | null | import importlib
import torch
from torch import nn
from torch.nn import functional as F
from heads import FCNHead
class ModelBuilder(nn.Module):
def __init__(self, net_config, aux_config=None):
super(ModelBuilder, self).__init__()
num_classes = net_config['num_classes']
out_planes = int... | 28.257732 | 68 | 0.556731 | import importlib
import torch
from torch import nn
from torch.nn import functional as F
from heads import FCNHead
class ModelBuilder(nn.Module):
def __init__(self, net_config, aux_config=None):
super(ModelBuilder, self).__init__()
num_classes = net_config['num_classes']
out_planes = int... | true | true |
f7463d6a84bc7270044b8aa02b63f623251d1087 | 8,397 | py | Python | src/population.py | Eccsx/CVRP-Genetic-Tournament | 8b428ec8ef976489bd701e2d11253249fe46ff88 | [
"MIT"
] | null | null | null | src/population.py | Eccsx/CVRP-Genetic-Tournament | 8b428ec8ef976489bd701e2d11253249fe46ff88 | [
"MIT"
] | null | null | null | src/population.py | Eccsx/CVRP-Genetic-Tournament | 8b428ec8ef976489bd701e2d11253249fe46ff88 | [
"MIT"
] | null | null | null | from math import floor
from numpy import delete, fliplr
from itertools import chain
from random import random, sample
from copy import deepcopy
from chromosome import fitness, pmx, obx
from utils import create_shuffle_array
from genetic import POPULATION_SIZE, PROBABILITY_ELITISM, \
NUMBER_TOURNAMENT_SELECTION, CRO... | 28.272727 | 79 | 0.572705 | from math import floor
from numpy import delete, fliplr
from itertools import chain
from random import random, sample
from copy import deepcopy
from chromosome import fitness, pmx, obx
from utils import create_shuffle_array
from genetic import POPULATION_SIZE, PROBABILITY_ELITISM, \
NUMBER_TOURNAMENT_SELECTION, CRO... | true | true |
f7463d91867620389278280cba3c2424f7c4cd8b | 1,241 | py | Python | duo_client/accounts.py | Shoobx/duo_client_python | 3e1fa81073aa19a68197236b77a42c7a9cf17ff2 | [
"Apache-2.0"
] | null | null | null | duo_client/accounts.py | Shoobx/duo_client_python | 3e1fa81073aa19a68197236b77a42c7a9cf17ff2 | [
"Apache-2.0"
] | null | null | null | duo_client/accounts.py | Shoobx/duo_client_python | 3e1fa81073aa19a68197236b77a42c7a9cf17ff2 | [
"Apache-2.0"
] | null | null | null | """
Duo Security Accounts API reference client implementation.
<http://www.duosecurity.com/docs/accountsapi>
"""
import client
class Accounts(client.Client):
def get_child_accounts(self):
"""
Return a list of all child accounts of the integration's account.
"""
params = {}
... | 29.547619 | 73 | 0.489122 | import client
class Accounts(client.Client):
def get_child_accounts(self):
params = {}
response = self.json_api_call('POST',
'/accounts/v1/account/list',
params)
return response
def create_account(self, name):
... | true | true |
f7463e5c895ffa8076e2f5d973fb48afea709f68 | 9,101 | py | Python | docs/conf.py | Wh1t3Fox/CS547-Project | 55c60704a4cdced5131bec8784cd4712fd925676 | [
"MIT"
] | null | null | null | docs/conf.py | Wh1t3Fox/CS547-Project | 55c60704a4cdced5131bec8784cd4712fd925676 | [
"MIT"
] | null | null | null | docs/conf.py | Wh1t3Fox/CS547-Project | 55c60704a4cdced5131bec8784cd4712fd925676 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#
# PIR documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 13 20:02:20 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... | 32.159011 | 79 | 0.717723 |
import sys
import os
import shlex
extensions = []
templates_path = ['_templates']
source_suffix = ['.rst']
master_doc = 'index'
project = u'PIR'
copyright = u'2015, Craig West and Michael Kouremetis'
author = u'Craig West and Michael Kouremetis'
# |version| and |release|, also u... | true | true |
f7463ef1c588fb0dcb0adaec3d4247e196e26037 | 5,583 | py | Python | imf/tests/test_distributions.py | segasai/imf | 9a33b9e68b0af677dab86511e343d6099d9ea530 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | imf/tests/test_distributions.py | segasai/imf | 9a33b9e68b0af677dab86511e343d6099d9ea530 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | imf/tests/test_distributions.py | segasai/imf | 9a33b9e68b0af677dab86511e343d6099d9ea530 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | import numpy as np
import scipy.interpolate
from .. import distributions as D
np.random.seed(1)
def sampltest(distr, left=None, right=None, bounds=None):
# check that mean and stddev from the generated sample
# match what we get from integrating the PDF
def FF1(x):
return distr.pdf(x) * x
d... | 29.539683 | 88 | 0.535913 | import numpy as np
import scipy.interpolate
from .. import distributions as D
np.random.seed(1)
def sampltest(distr, left=None, right=None, bounds=None):
def FF1(x):
return distr.pdf(x) * x
def FF2(x):
return distr.pdf(x) * x**2
if left is None:
left = 0
if right ... | true | true |
f7463ff2558c9bd41bca5ff6fb1a5c665f095f51 | 14,935 | py | Python | arsrl/ars.py | Seanny123/ARS | f445a870feac13286fe2d8b14ee508f789c9ef7d | [
"BSD-2-Clause"
] | null | null | null | arsrl/ars.py | Seanny123/ARS | f445a870feac13286fe2d8b14ee508f789c9ef7d | [
"BSD-2-Clause"
] | null | null | null | arsrl/ars.py | Seanny123/ARS | f445a870feac13286fe2d8b14ee508f789c9ef7d | [
"BSD-2-Clause"
] | null | null | null | '''
Parallel implementation of the Augmented Random Search method.
Horia Mania --- hmania@berkeley.edu
Aurelia Guy
Benjamin Recht
'''
import os
import socket
import time
import gym
import numpy as np
import ray
from arsrl import utils, logz, optimizers
from arsrl.policies import LinearPolicy
from arsrl.shared_noise ... | 36.25 | 104 | 0.584064 |
import os
import socket
import time
import gym
import numpy as np
import ray
from arsrl import utils, logz, optimizers
from arsrl.policies import LinearPolicy
from arsrl.shared_noise import SharedNoiseTable, create_shared_noise
@ray.remote
class Worker(object):
def __init__(self, env_seed,
en... | true | true |
f7464013eeebcdb4986304f0e5c49ade64cbb57c | 113 | py | Python | commit_checker/tests/__main__.py | hrome/commit_checker | b212cb9cf6728b6bb9006097fa8211e9a06537b8 | [
"MIT"
] | 2 | 2017-11-24T12:28:50.000Z | 2018-12-28T10:13:40.000Z | commit_checker/tests/functional/__main__.py | hrome/commit_checker | b212cb9cf6728b6bb9006097fa8211e9a06537b8 | [
"MIT"
] | null | null | null | commit_checker/tests/functional/__main__.py | hrome/commit_checker | b212cb9cf6728b6bb9006097fa8211e9a06537b8 | [
"MIT"
] | null | null | null | import os
from nose.core import TestProgram
os.chdir(os.path.abspath(os.path.dirname(__file__)))
TestProgram()
| 16.142857 | 52 | 0.787611 | import os
from nose.core import TestProgram
os.chdir(os.path.abspath(os.path.dirname(__file__)))
TestProgram()
| true | true |
f7464034718df8a60b7d3a7755fdaeb277227ff4 | 7,900 | py | Python | synthesizer/audio.py | vitek2577/Multi-Tacotron-Voice-Cloning-GST | a47d7f8412add19f7a154d70cc55698e2bb0a6da | [
"MIT"
] | 1 | 2020-04-12T08:03:11.000Z | 2020-04-12T08:03:11.000Z | synthesizer/audio.py | vitek2577/Multi-Tacotron-Voice-Cloning-GST | a47d7f8412add19f7a154d70cc55698e2bb0a6da | [
"MIT"
] | null | null | null | synthesizer/audio.py | vitek2577/Multi-Tacotron-Voice-Cloning-GST | a47d7f8412add19f7a154d70cc55698e2bb0a6da | [
"MIT"
] | 1 | 2020-04-12T07:30:59.000Z | 2020-04-12T07:30:59.000Z | import librosa
import librosa.filters
import numpy as np
import tensorflow as tf
from scipy import signal
from scipy.io import wavfile
def load_wav(path, sr):
return librosa.core.load(path, sr=sr)[0]
def save_wav(wav, path, sr):
wav *= 32767 / max(0.01, np.max(np.abs(wav)))
#proposed by @dsmiller
wav... | 37.980769 | 136 | 0.671139 | import librosa
import librosa.filters
import numpy as np
import tensorflow as tf
from scipy import signal
from scipy.io import wavfile
def load_wav(path, sr):
return librosa.core.load(path, sr=sr)[0]
def save_wav(wav, path, sr):
wav *= 32767 / max(0.01, np.max(np.abs(wav)))
wavfile.write(path, sr, w... | true | true |
f746409aadfc9ec61b870cc2f1b6a4dcaafbdf13 | 27,431 | py | Python | pandas/tseries/tools.py | tacaswell/pandas | 81c57e20da278494dfebc2f1043f5ff361a234f3 | [
"PSF-2.0",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"BSD-3-Clause"
] | 1 | 2019-04-28T13:48:34.000Z | 2019-04-28T13:48:34.000Z | pandas/tseries/tools.py | tacaswell/pandas | 81c57e20da278494dfebc2f1043f5ff361a234f3 | [
"PSF-2.0",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"BSD-3-Clause"
] | null | null | null | pandas/tseries/tools.py | tacaswell/pandas | 81c57e20da278494dfebc2f1043f5ff361a234f3 | [
"PSF-2.0",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"BSD-3-Clause"
] | 1 | 2021-02-20T14:17:15.000Z | 2021-02-20T14:17:15.000Z | from datetime import datetime, timedelta, time
import numpy as np
from collections import MutableMapping
import pandas.lib as lib
import pandas.tslib as tslib
from pandas.types.common import (_ensure_object,
is_datetime64_ns_dtype,
is_datetime64_dtype,... | 34.899491 | 79 | 0.567387 | from datetime import datetime, timedelta, time
import numpy as np
from collections import MutableMapping
import pandas.lib as lib
import pandas.tslib as tslib
from pandas.types.common import (_ensure_object,
is_datetime64_ns_dtype,
is_datetime64_dtype,... | true | true |
f746419d08b41ede9d1b4f9211822d4765fdfaf3 | 156,686 | py | Python | chb/mips/MIPSOpcode.py | psifertex/CodeHawk-Binary | 1711d7b16d32a2e9ffa9d22af483182b3f9ded77 | [
"MIT"
] | null | null | null | chb/mips/MIPSOpcode.py | psifertex/CodeHawk-Binary | 1711d7b16d32a2e9ffa9d22af483182b3f9ded77 | [
"MIT"
] | null | null | null | chb/mips/MIPSOpcode.py | psifertex/CodeHawk-Binary | 1711d7b16d32a2e9ffa9d22af483182b3f9ded77 | [
"MIT"
] | null | null | null | # ------------------------------------------------------------------------------
# Access to the CodeHawk Binary Analyzer Analysis Results
# Author: Henny Sipma
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2016-2020 Kestrel Technology LLC
# C... | 40.529229 | 101 | 0.565156 |
import chb.util.fileutil as UF
import chb.api.LinuxSyscalls as SC
import chb.mips.MIPSOpcodeBase as X
import chb.simulate.SimUtil as SU
import chb.simulate.SimSymbolicValue as SSV
import chb.simulate.SimValue as SV
mips_opcode_constructors = {
'add' : lambda x: MIPSAdd(*x),
'and'... | true | true |
f74641a56b99504347024e167afbc98719ef7b52 | 40,120 | py | Python | src/onelogin/saml2/utils.py | maykinmedia/python3-saml | e000b39ed0ce38270e6351ec6634e6b3a53bbc3d | [
"MIT"
] | null | null | null | src/onelogin/saml2/utils.py | maykinmedia/python3-saml | e000b39ed0ce38270e6351ec6634e6b3a53bbc3d | [
"MIT"
] | 1 | 2021-10-01T14:41:51.000Z | 2021-10-01T14:41:51.000Z | src/onelogin/saml2/utils.py | maykinmedia/python3-saml | e000b39ed0ce38270e6351ec6634e6b3a53bbc3d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
""" OneLogin_Saml2_Utils class
Copyright (c) 2010-2021 OneLogin, Inc.
MIT License
Auxiliary class of OneLogin's Python Toolkit.
"""
import base64
import warnings
from copy import deepcopy
import calendar
from datetime import datetime
from hashlib import sha1, sha256, sha384, sha512
from iso... | 35.789474 | 165 | 0.619392 |
import base64
import warnings
from copy import deepcopy
import calendar
from datetime import datetime
from hashlib import sha1, sha256, sha384, sha512
from isodate import parse_duration as duration_parser
import re
from textwrap import wrap
from functools import wraps
from uuid import uuid4
from xml.dom.minidom impo... | true | true |
f74641a5b08e7bfc833a89b717f43281e0c19e5c | 897 | py | Python | test/py/boolean/test11h.py | cvdlab/lar-cc | 7092965acf7c0c78a5fab4348cf2c2aa01c4b130 | [
"MIT",
"Unlicense"
] | 1 | 2016-09-20T04:48:12.000Z | 2016-09-20T04:48:12.000Z | test/py/boolean/test11h.py | Ahdhn/lar-cc | 7092965acf7c0c78a5fab4348cf2c2aa01c4b130 | [
"MIT",
"Unlicense"
] | 1 | 2018-02-20T21:57:07.000Z | 2018-02-21T07:18:11.000Z | test/py/boolean/test11h.py | Ahdhn/lar-cc | 7092965acf7c0c78a5fab4348cf2c2aa01c4b130 | [
"MIT",
"Unlicense"
] | 7 | 2016-11-04T10:47:42.000Z | 2018-04-10T17:32:50.000Z |
from larlib import *
""" Visualization of indices of the boundary triangulation """
V,[VV,EV,FV,CV] = larCuboids([1,1,1],True)
cubeGrid = Struct([(V,FV,EV)],"cubeGrid")
cubeGrids = Struct(2*[cubeGrid,t(1.5,1.5,0),r(0,0,PI/6)])
V,FV,EV = struct2lar(cubeGrids)
VIEW(EXPLODE(1.2,1.2,1.2)(MKPOLS((V,FV))))
V,CV,FV,EV,CF,... | 35.88 | 127 | 0.654404 |
from larlib import *
V,[VV,EV,FV,CV] = larCuboids([1,1,1],True)
cubeGrid = Struct([(V,FV,EV)],"cubeGrid")
cubeGrids = Struct(2*[cubeGrid,t(1.5,1.5,0),r(0,0,PI/6)])
V,FV,EV = struct2lar(cubeGrids)
VIEW(EXPLODE(1.2,1.2,1.2)(MKPOLS((V,FV))))
V,CV,FV,EV,CF,CE,COE,FE = thePartition(V,FV,EV)
cellLengths = AA(len)(CF)
bo... | true | true |
f74642a2a6f3111cde6d0ca1929794acd601c5dd | 814 | py | Python | megnet/utils/tests/test_general.py | Lalf-Klein/megnet | e3977ce372b74380268659e964c85bf59c1aac34 | [
"BSD-3-Clause"
] | 1 | 2019-10-04T09:39:16.000Z | 2019-10-04T09:39:16.000Z | megnet/utils/tests/test_general.py | Lalf-Klein/megnet | e3977ce372b74380268659e964c85bf59c1aac34 | [
"BSD-3-Clause"
] | null | null | null | megnet/utils/tests/test_general.py | Lalf-Klein/megnet | e3977ce372b74380268659e964c85bf59c1aac34 | [
"BSD-3-Clause"
] | null | null | null | import unittest
import numpy as np
from megnet.utils.general import expand_1st, to_list, fast_label_binarize
class TestGeneralUtils(unittest.TestCase):
def test_expand_dim(self):
x = np.array([1, 2, 3])
self.assertListEqual(list(expand_1st(x).shape), [1, 3])
def test_to_list(self):
x... | 27.133333 | 73 | 0.589681 | import unittest
import numpy as np
from megnet.utils.general import expand_1st, to_list, fast_label_binarize
class TestGeneralUtils(unittest.TestCase):
def test_expand_dim(self):
x = np.array([1, 2, 3])
self.assertListEqual(list(expand_1st(x).shape), [1, 3])
def test_to_list(self):
x... | true | true |
f74642f8c5d44381bccf8a928734777c60abd7ba | 394 | py | Python | prado/datasets/constants.py | suflaj/prado | 844ff63cfab1198e717cf72c72ec74caf9f4888d | [
"Apache-2.0"
] | 2 | 2021-03-31T18:34:31.000Z | 2021-07-15T09:11:48.000Z | prado/datasets/constants.py | suflaj/prado | 844ff63cfab1198e717cf72c72ec74caf9f4888d | [
"Apache-2.0"
] | null | null | null | prado/datasets/constants.py | suflaj/prado | 844ff63cfab1198e717cf72c72ec74caf9f4888d | [
"Apache-2.0"
] | null | null | null | import re
DECORATOR_GROUP_PATTERN = r"([^\w\d\s\']+)"
DECORATOR_GROUP_REGEX = re.compile(DECORATOR_GROUP_PATTERN)
DOUBLE_QUOTE_PATTERN = r"\""
DOUBLE_QUOTE_REGEX = re.compile(DOUBLE_QUOTE_PATTERN)
QUOTED_TEXT_PATTERN = r"\'([^\"\'\s]+)\'"
QUOTED_TEXT_REGEX = re.compile(QUOTED_TEXT_PATTERN)
MEANINGLESS_PATTERN = r"^... | 30.307692 | 59 | 0.733503 | import re
DECORATOR_GROUP_PATTERN = r"([^\w\d\s\']+)"
DECORATOR_GROUP_REGEX = re.compile(DECORATOR_GROUP_PATTERN)
DOUBLE_QUOTE_PATTERN = r"\""
DOUBLE_QUOTE_REGEX = re.compile(DOUBLE_QUOTE_PATTERN)
QUOTED_TEXT_PATTERN = r"\'([^\"\'\s]+)\'"
QUOTED_TEXT_REGEX = re.compile(QUOTED_TEXT_PATTERN)
MEANINGLESS_PATTERN = r"^... | true | true |
f746443516aecfc2df8df7fe43126f74827cdeb8 | 1,879 | py | Python | apps/web/anandtech/anandtech_pages.py | timo95/knausj_talon | 735b6fda064b12c832fce2ba4ca8e0186e7db48a | [
"MIT"
] | 1 | 2021-09-08T05:45:03.000Z | 2021-09-08T05:45:03.000Z | apps/web/anandtech/anandtech_pages.py | timo95/knausj_talon | 735b6fda064b12c832fce2ba4ca8e0186e7db48a | [
"MIT"
] | null | null | null | apps/web/anandtech/anandtech_pages.py | timo95/knausj_talon | 735b6fda064b12c832fce2ba4ca8e0186e7db48a | [
"MIT"
] | null | null | null | from talon import Context, actions, scope
# Main page (subpath 2)
# /[Page/<page>]
ctx = Context()
ctx.matches = r"""
app: anandtech
browser.path: /^\/(Page\/\d+\/?)?$/
"""
ctx.tags = ["user.pages"]
@ctx.action_class("user")
class UserActions:
# user.pages
def page_current():
tokens = scope.get("brows... | 28.907692 | 71 | 0.597126 | from talon import Context, actions, scope
ctx = Context()
ctx.matches = r"""
app: anandtech
browser.path: /^\/(Page\/\d+\/?)?$/
"""
ctx.tags = ["user.pages"]
@ctx.action_class("user")
class UserActions:
def page_current():
tokens = scope.get("browser.path").rstrip("/").split("/")
return int... | true | true |
f74645c19a1e74a465669a231fb077330b4d64f6 | 23,649 | py | Python | src/solutions/common/models/loyalty.py | goubertbrent/oca-backend | b9f59cc02568aecb55d4b54aec05245790ea25fd | [
"Apache-2.0"
] | null | null | null | src/solutions/common/models/loyalty.py | goubertbrent/oca-backend | b9f59cc02568aecb55d4b54aec05245790ea25fd | [
"Apache-2.0"
] | null | null | null | src/solutions/common/models/loyalty.py | goubertbrent/oca-backend | b9f59cc02568aecb55d4b54aec05245790ea25fd | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | 36.439137 | 186 | 0.729756 |
import urllib
from google.appengine.api import images
from google.appengine.ext import db, blobstore
from rogerthat.bizz.gcs import get_serving_url
from rogerthat.dal import parent_key, parent_key_unsafe
from rogerthat.rpc import users
from rogerthat.utils import now
from rogerthat.utils.app import c... | true | true |
f74646ee02291bfaa3082692f130646578db9f51 | 16,332 | py | Python | sdk/python/v1beta1/kubeflow/katib/api/katib_client.py | oneconvergence/katib | 16e0574647ace79ccedd248d072c77139feab5e5 | [
"Apache-2.0"
] | 1,177 | 2018-04-23T08:45:19.000Z | 2022-03-23T19:09:13.000Z | sdk/python/v1beta1/kubeflow/katib/api/katib_client.py | oneconvergence/katib | 16e0574647ace79ccedd248d072c77139feab5e5 | [
"Apache-2.0"
] | 1,791 | 2018-04-20T00:10:17.000Z | 2022-03-31T18:18:36.000Z | sdk/python/v1beta1/kubeflow/katib/api/katib_client.py | oneconvergence/katib | 16e0574647ace79ccedd248d072c77139feab5e5 | [
"Apache-2.0"
] | 349 | 2018-04-20T01:03:28.000Z | 2022-03-30T16:11:35.000Z | # Copyright 2021 The Kubeflow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 38.248244 | 103 | 0.601763 |
import multiprocessing
from kubeflow.katib import V1beta1Experiment
from kubeflow.katib import V1beta1Trial
from kubeflow.katib.api_client import ApiClient
from kubeflow.katib.constants import constants
from kubeflow.katib.utils import utils
from kubernetes import client, config
class KatibClient(objec... | true | true |
f746475b55103d17017ae1c963104242a624369b | 2,392 | py | Python | client_example.py | izevg/ProstoPyPleer | d6a8d0411991d91771d3dc520f032c13ac017571 | [
"MIT"
] | 2 | 2015-03-02T11:55:13.000Z | 2015-04-13T14:56:26.000Z | client_example.py | izevg/ProstoPyPleer | d6a8d0411991d91771d3dc520f032c13ac017571 | [
"MIT"
] | null | null | null | client_example.py | izevg/ProstoPyPleer | d6a8d0411991d91771d3dc520f032c13ac017571 | [
"MIT"
] | null | null | null | '''
The MIT License (MIT)
Copyright (c) 2014 Eugene Zhukov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modif... | 34.666667 | 105 | 0.743729 |
import pleer
from vars import debug
my_pleer = pleer.Pleer()
app_id = 'Insert here your App ID'
app_secret_key = 'Insert here your App Secret Key'
query = {
'query': 'artist:Red hot chilli peppers',
'quality': 'best'
}
my_pleer.token = my_pleer.get_access_token(app_id, app_secret_key)
if de... | true | true |
f74647ada53b32bbaaa82bfaa5513aca01ad89cb | 12,522 | py | Python | src/textual/layout.py | NoblySP/textual | 0995fbc69e4740edb31fdf6f645617650e3376bb | [
"MIT"
] | 1 | 2021-08-10T11:46:19.000Z | 2021-08-10T11:46:19.000Z | src/textual/layout.py | NoblySP/textual | 0995fbc69e4740edb31fdf6f645617650e3376bb | [
"MIT"
] | null | null | null | src/textual/layout.py | NoblySP/textual | 0995fbc69e4740edb31fdf6f645617650e3376bb | [
"MIT"
] | null | null | null | from __future__ import annotations
from abc import ABC, abstractmethod, abstractmethod
from dataclasses import dataclass
from itertools import chain
from operator import itemgetter
import sys
from typing import Iterable, Iterator, NamedTuple, TYPE_CHECKING
from rich import segment
import rich.repr
from rich.control ... | 31.781726 | 92 | 0.583134 | from __future__ import annotations
from abc import ABC, abstractmethod, abstractmethod
from dataclasses import dataclass
from itertools import chain
from operator import itemgetter
import sys
from typing import Iterable, Iterator, NamedTuple, TYPE_CHECKING
from rich import segment
import rich.repr
from rich.control ... | true | true |
f746489abdb7d7e7019a542221de4996fca5bd6e | 1,224 | py | Python | domains/nav/problems/auto/problem1116_SD.py | patras91/rae_release | 0e5faffb7eb732fdb8e3bbf2c6d2f2cbd520aa30 | [
"BSD-3-Clause"
] | 1 | 2021-09-28T12:56:56.000Z | 2021-09-28T12:56:56.000Z | domains/nav/problems/auto/problem1116_SD.py | patras91/rae_release | 0e5faffb7eb732fdb8e3bbf2c6d2f2cbd520aa30 | [
"BSD-3-Clause"
] | null | null | null | domains/nav/problems/auto/problem1116_SD.py | patras91/rae_release | 0e5faffb7eb732fdb8e3bbf2c6d2f2cbd520aa30 | [
"BSD-3-Clause"
] | 1 | 2022-03-31T16:30:39.000Z | 2022-03-31T16:30:39.000Z | __author__ = 'patras'
from domain_springDoor import *
from timer import DURATION
from state import state, rv
DURATION.TIME = {
'unlatch1': 5,
'unlatch2': 5,
'holdDoor': 2,
'passDoor': 3,
'releaseDoor': 2,
'closeDoors': 3,
'move': 7,
'take': 2,
'put': 2,
}
DURATION.COUNTER = {
... | 24 | 88 | 0.487745 | __author__ = 'patras'
from domain_springDoor import *
from timer import DURATION
from state import state, rv
DURATION.TIME = {
'unlatch1': 5,
'unlatch2': 5,
'holdDoor': 2,
'passDoor': 3,
'releaseDoor': 2,
'closeDoors': 3,
'move': 7,
'take': 2,
'put': 2,
}
DURATION.COUNTER = {
... | true | true |
f74648c0866f27238413a8d3452ffc12b9252651 | 22,688 | py | Python | g3ar/threadutils/threadpoolex.py | VillanCh/g3ar | 99e01dacc130b02a3759ff04b1d36c6b9e0111ff | [
"BSD-2-Clause"
] | 48 | 2016-12-20T18:48:07.000Z | 2021-07-28T07:39:38.000Z | g3ar/threadutils/threadpoolex.py | VillanCh/g3ar | 99e01dacc130b02a3759ff04b1d36c6b9e0111ff | [
"BSD-2-Clause"
] | null | null | null | g3ar/threadutils/threadpoolex.py | VillanCh/g3ar | 99e01dacc130b02a3759ff04b1d36c6b9e0111ff | [
"BSD-2-Clause"
] | 24 | 2016-12-21T02:18:12.000Z | 2021-11-30T04:19:45.000Z | #!/usr/bin/env python
#coding:utf-8
"""
Author: --<v1ll4n>
Purpose: ThreadPool From Twisted and Add Common Resource
Created: 05/13/17
"""
from __future__ import unicode_literals
import uuid
import threading
import traceback
try:
import queue
except:
import Queue as queue
import time
import random
cla... | 29.312661 | 104 | 0.435781 |
from __future__ import unicode_literals
import uuid
import threading
import traceback
try:
import queue
except:
import Queue as queue
import time
import random
class LaborQuit(Exception):
pass
_callback_chain_lock = threading.Lock()
elf):
return self._inuse
@inuse.setter
def inus... | true | true |
f74649f2d8fc5d9ebda3e129de35a289fc60f05d | 2,499 | py | Python | openGaussBase/testcase/SQL/DDL/directory/Opengauss_Function_DDL_Create_Directory_Case0005.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | openGaussBase/testcase/SQL/DDL/directory/Opengauss_Function_DDL_Create_Directory_Case0005.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | openGaussBase/testcase/SQL/DDL/directory/Opengauss_Function_DDL_Create_Directory_Case0005.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... | 32.454545 | 84 | 0.603441 |
import os
import unittest
from testcase.utils.CommonSH import CommonSH
from testcase.utils.Logger import Logger
from yat.test import Node
from yat.test import macro
logger = Logger()
class Function(unittest.TestCase):
def setUp(self):
logger.info(f"-----{os.path.basename(__file__)}开始执行-----")
... | true | true |
f7464c3f1d64f27226897fde14b087f7a781104d | 1,841 | py | Python | longqiao/longqiao/apps/users/utils.py | yktimes/longqiao | 80f98c3f5816c08af9fb8ed6dc43f61c4cc9893d | [
"Apache-2.0"
] | 1 | 2019-09-11T10:24:47.000Z | 2019-09-11T10:24:47.000Z | longqiao/longqiao/apps/users/utils.py | yktimes/longqiao | 80f98c3f5816c08af9fb8ed6dc43f61c4cc9893d | [
"Apache-2.0"
] | null | null | null | longqiao/longqiao/apps/users/utils.py | yktimes/longqiao | 80f98c3f5816c08af9fb8ed6dc43f61c4cc9893d | [
"Apache-2.0"
] | null | null | null | import datetime
import re
from rest_framework_jwt.settings import api_settings
from django.contrib.auth.backends import ModelBackend
from .models import User
# def get_user_by_account(account):
# """
# 根据帐号获取user对象
# :param account: 账号,可以是用户名,也可以是手机号
# :return: User对象 或者 None
# """
# try:
# ... | 21.406977 | 90 | 0.624117 | import datetime
import re
from rest_framework_jwt.settings import api_settings
from django.contrib.auth.backends import ModelBackend
from .models import User
# 根据帐号获取user对象
# :param account: 账号,可以是用户名,也可以是手机号
# :return: User对象 或者 None
# """
UsernameMobileAuthBackend(ModelBackend):
def authe... | true | true |
f7464c75a95b7caa0a1d00744ad0eff4f444aaa2 | 5,302 | py | Python | process_launchers.py | node21challenge/rank3_node21_detection | bac22d4aef5e83481c3ff1db3f8f0891ce05f8d6 | [
"Apache-2.0"
] | null | null | null | process_launchers.py | node21challenge/rank3_node21_detection | bac22d4aef5e83481c3ff1db3f8f0891ce05f8d6 | [
"Apache-2.0"
] | null | null | null | process_launchers.py | node21challenge/rank3_node21_detection | bac22d4aef5e83481c3ff1db3f8f0891ce05f8d6 | [
"Apache-2.0"
] | 1 | 2022-02-13T14:58:24.000Z | 2022-02-13T14:58:24.000Z | import logging
import os
from collections import OrderedDict
from pathlib import Path
import torch
import itertools
import detectron2.utils.comm as comm
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from detectron2.data import MetadataCatalog
from detectron2.engine impor... | 30.647399 | 99 | 0.700868 | import logging
import os
from collections import OrderedDict
from pathlib import Path
import torch
import itertools
import detectron2.utils.comm as comm
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from detectron2.data import MetadataCatalog
from detectron2.engine impor... | true | true |
f7464dc51ab3ea9751a2a49c3e005d90df108c43 | 1,015 | py | Python | main.py | IntensifyScratch/MessageAPI | 825d8619cb7ddccbdf9c232cefe213e28d843e36 | [
"MIT"
] | null | null | null | main.py | IntensifyScratch/MessageAPI | 825d8619cb7ddccbdf9c232cefe213e28d843e36 | [
"MIT"
] | null | null | null | main.py | IntensifyScratch/MessageAPI | 825d8619cb7ddccbdf9c232cefe213e28d843e36 | [
"MIT"
] | null | null | null | import os
import time
import scratchconnect
login = scratchconnect.ScratchConnect("-IntensifyServer-", "Intens1!")
print("Logged In!")
project = login.connect_project(project_id=599331245)
print("Connected Project!")
variables = project.connect_cloud_variables()
print("Connected Cloud Variables!")
while True:
... | 36.25 | 90 | 0.6867 | import os
import time
import scratchconnect
login = scratchconnect.ScratchConnect("-IntensifyServer-", "Intens1!")
print("Logged In!")
project = login.connect_project(project_id=599331245)
print("Connected Project!")
variables = project.connect_cloud_variables()
print("Connected Cloud Variables!")
while True:
... | true | true |
f7464e0f0c15dbd35fddf3e1712cf665bf0d2b48 | 15,563 | py | Python | python/mxnet/gluon/nn/binary_layers.py | simonmaurer/BMXNet-v2 | 91fcc480d66415c9c70254e00114b839e5229f10 | [
"Apache-2.0"
] | null | null | null | python/mxnet/gluon/nn/binary_layers.py | simonmaurer/BMXNet-v2 | 91fcc480d66415c9c70254e00114b839e5229f10 | [
"Apache-2.0"
] | null | null | null | python/mxnet/gluon/nn/binary_layers.py | simonmaurer/BMXNet-v2 | 91fcc480d66415c9c70254e00114b839e5229f10 | [
"Apache-2.0"
] | null | null | null | from functools import reduce
from operator import mul
from .basic_layers import Dense, HybridBlock
from .conv_layers import _Conv
from ...base import numeric_types
from ...symbol import Symbol
from sys import version_info
class BinaryLayerConfig:
def __init__(self, grad_cancel=1.0, bits=1, bits_a=1, activation=... | 44.087819 | 120 | 0.643578 | from functools import reduce
from operator import mul
from .basic_layers import Dense, HybridBlock
from .conv_layers import _Conv
from ...base import numeric_types
from ...symbol import Symbol
from sys import version_info
class BinaryLayerConfig:
def __init__(self, grad_cancel=1.0, bits=1, bits_a=1, activation=... | true | true |
f7464e998ed4587196805b0042dfff3ca7d923a1 | 109,864 | py | Python | src/contrib/thriftfs/gen-py/hadoopfs/ThriftHadoopFileSystem.py | serranoble/mxor_hadoop_0.20 | c395e14f098bd09b1028651fbdeb4cb2be442b11 | [
"Apache-2.0"
] | null | null | null | src/contrib/thriftfs/gen-py/hadoopfs/ThriftHadoopFileSystem.py | serranoble/mxor_hadoop_0.20 | c395e14f098bd09b1028651fbdeb4cb2be442b11 | [
"Apache-2.0"
] | null | null | null | src/contrib/thriftfs/gen-py/hadoopfs/ThriftHadoopFileSystem.py | serranoble/mxor_hadoop_0.20 | c395e14f098bd09b1028651fbdeb4cb2be442b11 | [
"Apache-2.0"
] | null | null | null | #
# Autogenerated by Thrift
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
from thrift.Thrift import *
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
try:
from thrift.protocol import fastbinary
exce... | 30.500833 | 188 | 0.654354 |
from thrift.Thrift import *
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
try:
from thrift.protocol import fastbinary
except:
fastbinary = None
class Iface:
def setInactivityTimeoutPeriod(self, periodInSeconds)... | false | true |
f7465007555703204a8dda0d194c178d16f15263 | 27,035 | py | Python | mrtalha31.py | talha123444e441/mrtalha31.py | 32113f65c4d2010c1a135f6603e9100fad73ca79 | [
"Apache-2.0"
] | null | null | null | mrtalha31.py | talha123444e441/mrtalha31.py | 32113f65c4d2010c1a135f6603e9100fad73ca79 | [
"Apache-2.0"
] | null | null | null | mrtalha31.py | talha123444e441/mrtalha31.py | 32113f65c4d2010c1a135f6603e9100fad73ca79 | [
"Apache-2.0"
] | null | null | null | ó
˜fÃac @ s yð d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l
Z
d d l Z d d l Z d d l
Z
d d l Z d d l Z d d l Z d d l m Z d d l m Z Wn+ e k
re j d ƒ e j d ƒ n Xd d... | 76.370056 | 1,156 | 0.441946 | ó
˜fÃac @ s yð d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l
Z
d d l Z d d l Z d d l
Z
d d l Z d d l Z d d l Z d d l m Z d d l m Z Wn+ e k
re j d ƒ e j d ƒ n Xd d... | false | true |
f746500fc02a6a1d5107e7545b93382ce91299c0 | 3,334 | py | Python | telelbirds/settings.py | kngeno/telelbirds | 924bb2f1c397bbab2bd626d582c8e86704d86176 | [
"MIT"
] | 2 | 2021-01-05T06:16:32.000Z | 2021-09-09T10:42:53.000Z | telelbirds/settings.py | kngeno/telelbirds | 924bb2f1c397bbab2bd626d582c8e86704d86176 | [
"MIT"
] | null | null | null | telelbirds/settings.py | kngeno/telelbirds | 924bb2f1c397bbab2bd626d582c8e86704d86176 | [
"MIT"
] | null | null | null | """
Django settings for telelbirds project.
Generated by 'django-admin startproject' using Django 3.1.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
... | 24.880597 | 91 | 0.695261 | import os
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'bzb(%44=gi!3@3+6e^a1d8b-#6jak=fd@kj^@lpekyrrql(7@4'
DEBUG = True
SITE_ID = 1
# Run management command 'set_site_values to set these values
SITE_NAME = 'TelelBirds'
SITE_DOMAIN = 'telelbirds.com'
ALLOWED_HOSTS ... | true | true |
f746505f545be7e9c5ee1e10af7eb72bd7d56eb9 | 536 | py | Python | Python/number-of-matching-subsequences.py | ycsheu/LeetCode-Solutions | 32c3b4d5c130b6ade3c7db8212f0eb8ec4396cc0 | [
"MIT"
] | 7 | 2019-04-13T13:44:26.000Z | 2021-05-08T07:59:41.000Z | Python/number-of-matching-subsequences.py | cchen767/LeetCode-Solutions | 79c1c5b422fb88253f586350ddfc7d774c9d2ffc | [
"MIT"
] | null | null | null | Python/number-of-matching-subsequences.py | cchen767/LeetCode-Solutions | 79c1c5b422fb88253f586350ddfc7d774c9d2ffc | [
"MIT"
] | 5 | 2019-06-21T13:36:41.000Z | 2021-11-29T04:42:24.000Z | # Time: O(n + w), n is the size of S, w is the size of words
# Space: O(1)
import collections
class Solution(object):
def numMatchingSubseq(self, S, words):
"""
:type S: str
:type words: List[str]
:rtype: int
"""
waiting = collections.defaultdict(list)
for... | 24.363636 | 61 | 0.533582 |
import collections
class Solution(object):
def numMatchingSubseq(self, S, words):
waiting = collections.defaultdict(list)
for word in words:
waiting[word[0]].append(iter(word[1:]))
for c in S:
for it in waiting.pop(c, ()):
waiting[next(it, None)].... | true | true |
f74650bca27cd98f848ab712fe6441c4342d001e | 878 | py | Python | setup.py | filipeandre/f_tools | 3ac9cf87ced81459fd7f534b287f9cb450ec8806 | [
"MIT"
] | null | null | null | setup.py | filipeandre/f_tools | 3ac9cf87ced81459fd7f534b287f9cb450ec8806 | [
"MIT"
] | null | null | null | setup.py | filipeandre/f_tools | 3ac9cf87ced81459fd7f534b287f9cb450ec8806 | [
"MIT"
] | null | null | null | """Setup for the f_tools package."""
import setuptools
with open('README.md') as f:
README = f.read()
setuptools.setup(
author="Filipe Ferreira",
author_email="py@filipeandre.com",
name='f_tools',
license="MIT",
description='A set of low level framework utilities',
version='1.2.3',
long_description=README,
... | 27.4375 | 65 | 0.6959 |
import setuptools
with open('README.md') as f:
README = f.read()
setuptools.setup(
author="Filipe Ferreira",
author_email="py@filipeandre.com",
name='f_tools',
license="MIT",
description='A set of low level framework utilities',
version='1.2.3',
long_description=README,
url='https://github.com/filipeandre/... | true | true |
f74651872fe5deb51046334f7572a7f69c539cd4 | 13,265 | py | Python | tests/script_tests.py | anukaal/pywikibot | 086e99d686ceebb40cb2e3dc7989e78ce6de3b85 | [
"MIT"
] | 1 | 2021-07-28T11:48:03.000Z | 2021-07-28T11:48:03.000Z | tests/script_tests.py | anukaal/pywikibot | 086e99d686ceebb40cb2e3dc7989e78ce6de3b85 | [
"MIT"
] | null | null | null | tests/script_tests.py | anukaal/pywikibot | 086e99d686ceebb40cb2e3dc7989e78ce6de3b85 | [
"MIT"
] | null | null | null | """Test that each script can be compiled and executed."""
#
# (C) Pywikibot team, 2014-2021
#
# Distributed under the terms of the MIT license.
#
import os
import sys
import unittest
from contextlib import suppress
from pywikibot.tools import has_module
from tests import join_root_path, unittest_print
from tests.aspec... | 35.467914 | 79 | 0.572333 |
import os
import sys
import unittest
from contextlib import suppress
from pywikibot.tools import has_module
from tests import join_root_path, unittest_print
from tests.aspects import DefaultSiteTestCase, MetaTestCaseClass, PwbTestCase
from tests.utils import execute_pwb
scripts_path = join_root_path('scripts')
... | true | true |
f746538a7c2a3bfe29d874de132ca682050fd11b | 1,599 | py | Python | detection/yolov3/yolov3.py | benoitLemoine/stage2A | a81de38deaf786227e6d34c04803da5e5854c9f1 | [
"MIT"
] | 1 | 2019-11-20T18:44:33.000Z | 2019-11-20T18:44:33.000Z | detection/yolov3/yolov3.py | benoitLemoine/stage2A | a81de38deaf786227e6d34c04803da5e5854c9f1 | [
"MIT"
] | 4 | 2020-01-28T22:12:51.000Z | 2021-03-19T00:47:24.000Z | detection/yolov3/yolov3.py | benoitLemoine/peopleCounting | a81de38deaf786227e6d34c04803da5e5854c9f1 | [
"MIT"
] | null | null | null | import tensorflow as tf
import cv2 as cv
import numpy as np
from PIL import Image
from core import utils
classesPath = "../../data/coco.names"
modelPath = "../../checkpoint/yolov3_cpu_nms.pb"
IMAGE_H, IMAGE_W = 416, 416
classes = utils.read_coco_names(classesPath)
num_classes = len(classes)
input_tensor, output_tens... | 30.75 | 116 | 0.6404 | import tensorflow as tf
import cv2 as cv
import numpy as np
from PIL import Image
from core import utils
classesPath = "../../data/coco.names"
modelPath = "../../checkpoint/yolov3_cpu_nms.pb"
IMAGE_H, IMAGE_W = 416, 416
classes = utils.read_coco_names(classesPath)
num_classes = len(classes)
input_tensor, output_tens... | true | true |
f74654c1eab56d82c107b8d5f591840165ea5a13 | 604 | py | Python | tools.py | Doraemon-h/Information-Retrieval | 48a12b7420a9da77dd7a00cafcd81356a350ad84 | [
"MIT"
] | null | null | null | tools.py | Doraemon-h/Information-Retrieval | 48a12b7420a9da77dd7a00cafcd81356a350ad84 | [
"MIT"
] | null | null | null | tools.py | Doraemon-h/Information-Retrieval | 48a12b7420a9da77dd7a00cafcd81356a350ad84 | [
"MIT"
] | null | null | null | import json
import os
projectpath ="./"
reuterspath = "./Reuters"
def writeToFile(item,filename):
# 将数据写入到文件中
file = open(filename,'w')
str = json.JSONEncoder().encode(item)
file.write(str)
file.close()
#获取文档名中的文档的id
def getDocID(filename):
end = filename.find('.')
docId... | 20.827586 | 42 | 0.634106 | import json
import os
projectpath ="./"
reuterspath = "./Reuters"
def writeToFile(item,filename):
file = open(filename,'w')
str = json.JSONEncoder().encode(item)
file.write(str)
file.close()
def getDocID(filename):
end = filename.find('.')
docId = filename[0:end]
re... | true | true |
f746553ae824b7143283649925ff265e0cf466de | 1,665 | py | Python | akebono/commands/models/inspect.py | OTA2000/akebono | 11f88f3605a66989ac5cf11cb6af7b93987bcf59 | [
"MIT"
] | 3 | 2018-09-28T01:35:41.000Z | 2020-06-22T07:09:14.000Z | akebono/commands/models/inspect.py | OTA2000/akebono | 11f88f3605a66989ac5cf11cb6af7b93987bcf59 | [
"MIT"
] | 1 | 2020-01-06T08:15:10.000Z | 2020-01-06T08:15:10.000Z | akebono/commands/models/inspect.py | OTA2000/akebono | 11f88f3605a66989ac5cf11cb6af7b93987bcf59 | [
"MIT"
] | 6 | 2018-08-10T03:04:28.000Z | 2020-02-03T02:28:08.000Z | import datetime
import copy
import pprint
from .base import CommandBase
from akebono.inspector import get_scenario_summary
def _get_fixed_length_str(s, length):
if not isinstance(s, str):
raise TypeError('invalid type')
l = length - len(s)
if l < 0:
raise Exception('invalid length')
r... | 36.195652 | 96 | 0.563964 | import datetime
import copy
import pprint
from .base import CommandBase
from akebono.inspector import get_scenario_summary
def _get_fixed_length_str(s, length):
if not isinstance(s, str):
raise TypeError('invalid type')
l = length - len(s)
if l < 0:
raise Exception('invalid length')
r... | true | true |
f74655406b7d7e59061c29d572b77a797ffa5b38 | 2,025 | py | Python | main.py | LaoKpa/T-1000 | 5d88f74ddb2a0d47c3101072d6b9f6971fb2ba26 | [
"MIT"
] | 111 | 2019-10-30T01:12:49.000Z | 2022-03-10T04:54:43.000Z | main.py | charlesedwards/T-1000 | 5d88f74ddb2a0d47c3101072d6b9f6971fb2ba26 | [
"MIT"
] | 16 | 2019-10-24T15:52:05.000Z | 2022-02-05T17:55:02.000Z | main.py | charlesedwards/T-1000 | 5d88f74ddb2a0d47c3101072d6b9f6971fb2ba26 | [
"MIT"
] | 33 | 2019-11-03T14:51:23.000Z | 2021-12-02T07:40:25.000Z | if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(description='T-1000 bot')
parser.add_argument('-a', action="store", dest='assets', nargs='+', help='assets to test')
parser.add_argument('-c', action="store", dest="currency", type=str, default='DAI')
parser.add_argument('-g', action="sto... | 46.022727 | 99 | 0.721975 | if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(description='T-1000 bot')
parser.add_argument('-a', action="store", dest='assets', nargs='+', help='assets to test')
parser.add_argument('-c', action="store", dest="currency", type=str, default='DAI')
parser.add_argument('-g', action="sto... | true | true |
f74655e64b0b3241641d247965d896e4533502d1 | 1,380 | py | Python | scripts/backup/s3cleanup.py | MTES-MCT/biocarburants | ff084916e18cdbdc41400f36fa6cc76a5e05900e | [
"MIT"
] | 4 | 2020-03-22T18:13:12.000Z | 2021-01-25T10:33:31.000Z | scripts/backup/s3cleanup.py | MTES-MCT/carbure | 2876756b760ab4866fa783bb40e61a046eebb1ab | [
"MIT"
] | 20 | 2020-07-06T14:33:14.000Z | 2022-03-15T16:54:17.000Z | scripts/backup/s3cleanup.py | MTES-MCT/biocarburants | ff084916e18cdbdc41400f36fa6cc76a5e05900e | [
"MIT"
] | 4 | 2020-04-03T12:19:12.000Z | 2021-06-15T12:20:57.000Z | import sys
import os
import boto3
import datetime
import argparse
def cleanup_s3db(args):
s3 = boto3.resource('s3', aws_access_key_id=os.environ['AWS_ACCESS_KEY_ID'], aws_secret_access_key=os.environ['AWS_SECRET_ACCESS_KEY'], region_name=os.environ['AWS_S3_REGION_NAME'], endpoint_url=os.environ['AWS_S3_ENDPOINT_UR... | 32.857143 | 271 | 0.676812 | import sys
import os
import boto3
import datetime
import argparse
def cleanup_s3db(args):
s3 = boto3.resource('s3', aws_access_key_id=os.environ['AWS_ACCESS_KEY_ID'], aws_secret_access_key=os.environ['AWS_SECRET_ACCESS_KEY'], region_name=os.environ['AWS_S3_REGION_NAME'], endpoint_url=os.environ['AWS_S3_ENDPOINT_UR... | true | true |
f746561d2e6febb8c9a9e2a0a2f369ef9ea25cea | 847 | py | Python | python_modules/libraries/dagster-postgres/dagster_postgres/utils.py | shahvineet98/dagster | 2471d39c52f660e23e8c0d8e8ded873ddc3df036 | [
"Apache-2.0"
] | 1 | 2019-11-25T19:03:32.000Z | 2019-11-25T19:03:32.000Z | python_modules/libraries/dagster-postgres/dagster_postgres/utils.py | shahvineet98/dagster | 2471d39c52f660e23e8c0d8e8ded873ddc3df036 | [
"Apache-2.0"
] | null | null | null | python_modules/libraries/dagster-postgres/dagster_postgres/utils.py | shahvineet98/dagster | 2471d39c52f660e23e8c0d8e8ded873ddc3df036 | [
"Apache-2.0"
] | null | null | null | import time
import psycopg2
def get_conn(conn_string):
conn = psycopg2.connect(conn_string)
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
return conn
def get_conn_string(username, password, hostname, db_name, port='5432'):
return 'postgresql://{username}:{password}@{hostn... | 25.666667 | 95 | 0.693034 | import time
import psycopg2
def get_conn(conn_string):
conn = psycopg2.connect(conn_string)
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
return conn
def get_conn_string(username, password, hostname, db_name, port='5432'):
return 'postgresql://{username}:{password}@{hostn... | true | true |
f746566e6654c9d0903c29149dd8a3faeebbbb6a | 3,177 | py | Python | eth/vm/message.py | ggs134/py-evm | 5ad87356181b03c14a2452131f50fe8762127c84 | [
"MIT"
] | 1,641 | 2017-11-24T04:24:22.000Z | 2022-03-31T14:59:30.000Z | eth/vm/message.py | ggs134/py-evm | 5ad87356181b03c14a2452131f50fe8762127c84 | [
"MIT"
] | 1,347 | 2017-11-23T10:37:36.000Z | 2022-03-20T16:31:44.000Z | eth/vm/message.py | ggs134/py-evm | 5ad87356181b03c14a2452131f50fe8762127c84 | [
"MIT"
] | 567 | 2017-11-22T18:03:27.000Z | 2022-03-28T17:49:08.000Z | import logging
from eth_typing import Address
from eth.abc import MessageAPI
from eth.constants import (
CREATE_CONTRACT_ADDRESS,
)
from eth.typing import (
BytesOrView,
)
from eth.validation import (
validate_canonical_address,
validate_is_bytes,
validate_is_bytes_or_view,
validate_is_integer... | 29.146789 | 89 | 0.633617 | import logging
from eth_typing import Address
from eth.abc import MessageAPI
from eth.constants import (
CREATE_CONTRACT_ADDRESS,
)
from eth.typing import (
BytesOrView,
)
from eth.validation import (
validate_canonical_address,
validate_is_bytes,
validate_is_bytes_or_view,
validate_is_integer... | true | true |
f746575b0e87cb800e494f0905cce68409b6d6ab | 329 | py | Python | mutations/mutation_organization/__init__.py | akarapun/elearning | fe116d5815925269819061ea183cbfdb773844cf | [
"MIT"
] | 1 | 2020-03-14T11:00:14.000Z | 2020-03-14T11:00:14.000Z | mutations/mutation_organization/__init__.py | akarapun/elearning | fe116d5815925269819061ea183cbfdb773844cf | [
"MIT"
] | null | null | null | mutations/mutation_organization/__init__.py | akarapun/elearning | fe116d5815925269819061ea183cbfdb773844cf | [
"MIT"
] | null | null | null | import graphene
from graphene import (
String,
Int
)
# Org schema Base class
from schema_models import Org
class OrgCreateInput(graphene.InputObjectType):
orgCode = String(required=True)
strCode = String()
parentOrgCode = String()
orgTypeCode = String()
orgDesc = String()
createdBy = ... | 18.277778 | 47 | 0.696049 | import graphene
from graphene import (
String,
Int
)
from schema_models import Org
class OrgCreateInput(graphene.InputObjectType):
orgCode = String(required=True)
strCode = String()
parentOrgCode = String()
orgTypeCode = String()
orgDesc = String()
createdBy = String()
| true | true |
f74658e2dd606c2a8b4288efb0b7a945d40c22d8 | 1,094 | py | Python | mycode/test_03_ch5_4.py | JamesWang007/Dive-into-DL-PyTorch | 267b54168322ab37da44e83008fba4f24b70fa9f | [
"Apache-2.0"
] | 1 | 2019-11-15T18:35:36.000Z | 2019-11-15T18:35:36.000Z | mycode/test_03_ch5_4.py | JamesWang007/Dive-into-DL-PyTorch | 267b54168322ab37da44e83008fba4f24b70fa9f | [
"Apache-2.0"
] | null | null | null | mycode/test_03_ch5_4.py | JamesWang007/Dive-into-DL-PyTorch | 267b54168322ab37da44e83008fba4f24b70fa9f | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 25 23:09:40 2020
5.4 池化层
https://tangshusen.me/Dive-into-DL-PyTorch/#/chapter05_CNN/5.4_pooling
@author: bejin
"""
import torch
from torch import nn
def pool2d(X, pool_size, mode='max'):
X = X.float()
p_h, p_w = pool_size
Y = torch.zeros(X.shape[0] ... | 13.675 | 74 | 0.526508 |
import torch
from torch import nn
def pool2d(X, pool_size, mode='max'):
X = X.float()
p_h, p_w = pool_size
Y = torch.zeros(X.shape[0] - p_h + 1, X.shape[1] - p_w + 1)
for i in range(Y.shape[0]):
for j in range(Y.shape[1]):
if mode == 'max':
Y[i, j] = X[i: i + p_h... | true | true |
f74659e6a5d3ef3eba4b6d5de9c4e424fb7564e8 | 693 | py | Python | prob-78.py | tushargayan2324/Project_Euler | 874accc918e23337510056d7140cd85a1656dd3e | [
"MIT"
] | null | null | null | prob-78.py | tushargayan2324/Project_Euler | 874accc918e23337510056d7140cd85a1656dd3e | [
"MIT"
] | null | null | null | prob-78.py | tushargayan2324/Project_Euler | 874accc918e23337510056d7140cd85a1656dd3e | [
"MIT"
] | null | null | null | #Project Euler Problem-78
#Author Tushar Gayan
#Multinomial Theorem
import math
import numpy as np
def mod_list(pow,terms):
m = []
for i in range(terms):
if i%pow == 0:
m.append(1)
else:
m.append(0)
return m[::-1]
def partition(n):
num_l... | 20.382353 | 53 | 0.545455 |
import math
import numpy as np
def mod_list(pow,terms):
m = []
for i in range(terms):
if i%pow == 0:
m.append(1)
else:
m.append(0)
return m[::-1]
def partition(n):
num_list = []
for i in range(1,n+1):
num_list.append(i)
... | true | true |
f7465aa17531ab2069fea78139986db5f8232c2b | 4,622 | py | Python | src/app/section_3/sectionWrInjGraph.py | dheerajgupta0001/rtm_daily_report_generator | 591a21ed1888df8b50eb8e873e03387df5d5a6e7 | [
"MIT"
] | null | null | null | src/app/section_3/sectionWrInjGraph.py | dheerajgupta0001/rtm_daily_report_generator | 591a21ed1888df8b50eb8e873e03387df5d5a6e7 | [
"MIT"
] | null | null | null | src/app/section_3/sectionWrInjGraph.py | dheerajgupta0001/rtm_daily_report_generator | 591a21ed1888df8b50eb8e873e03387df5d5a6e7 | [
"MIT"
] | 1 | 2021-10-21T09:08:46.000Z | 2021-10-21T09:08:46.000Z | import datetime as dt
from src.repos.metricsData.metricsDataRepo import MetricsDataRepo
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.max_open_warning': 0})
import matplotlib.dates as mdates
def fetchWrInjGraphContext(appDbConnStr: str, startDt: dt.datetime, endDt: dt.datetime) -> ... | 45.762376 | 131 | 0.718736 | import datetime as dt
from src.repos.metricsData.metricsDataRepo import MetricsDataRepo
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.max_open_warning': 0})
import matplotlib.dates as mdates
def fetchWrInjGraphContext(appDbConnStr: str, startDt: dt.datetime, endDt: dt.datetime) -> ... | true | true |
f7465b2fbf84774444410d20d5b8469a940a6c5c | 2,059 | py | Python | umu-python/app/service/umm_client_async.py | suomitek/cubeai | cc4c0f5f445a552d239910da63944307c1f06e37 | [
"Apache-2.0"
] | null | null | null | umu-python/app/service/umm_client_async.py | suomitek/cubeai | cc4c0f5f445a552d239910da63944307c1f06e37 | [
"Apache-2.0"
] | null | null | null | umu-python/app/service/umm_client_async.py | suomitek/cubeai | cc4c0f5f445a552d239910da63944307c1f06e37 | [
"Apache-2.0"
] | null | null | null | import json
from app.service.http_client_async import async_http_client
service_name = 'umm'
async def create_task(task, jwt):
return await async_http_client('post', service_name, '/api/tasks', body=json.dumps(task.__dict__), jwt=jwt)
async def update_task(task, jwt):
return await async_http_client('put',... | 35.5 | 121 | 0.745993 | import json
from app.service.http_client_async import async_http_client
service_name = 'umm'
async def create_task(task, jwt):
return await async_http_client('post', service_name, '/api/tasks', body=json.dumps(task.__dict__), jwt=jwt)
async def update_task(task, jwt):
return await async_http_client('put',... | true | true |
f7465b4c4708bf7194086e63ed3e8dded867a3b8 | 279 | py | Python | catalog/bindings/gmd/vertical_cstype.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | catalog/bindings/gmd/vertical_cstype.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | catalog/bindings/gmd/vertical_cstype.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | from dataclasses import dataclass
from bindings.gmd.abstract_coordinate_system_type import AbstractCoordinateSystemType
__NAMESPACE__ = "http://www.opengis.net/gml"
@dataclass
class VerticalCstype(AbstractCoordinateSystemType):
class Meta:
name = "VerticalCSType"
| 25.363636 | 85 | 0.810036 | from dataclasses import dataclass
from bindings.gmd.abstract_coordinate_system_type import AbstractCoordinateSystemType
__NAMESPACE__ = "http://www.opengis.net/gml"
@dataclass
class VerticalCstype(AbstractCoordinateSystemType):
class Meta:
name = "VerticalCSType"
| true | true |
f7465b68629a068e3b32847c3fdb67764d9689d2 | 3,607 | py | Python | examples/pytorch/example04_housing_validation.py | ii-research-yu/pgbm | d050a5f71f1a458d8269c4f5201744c0d7c4d487 | [
"Apache-2.0"
] | 79 | 2021-06-02T06:59:08.000Z | 2022-03-10T20:27:02.000Z | examples/pytorch/example04_housing_validation.py | ii-research-yu/pgbm | d050a5f71f1a458d8269c4f5201744c0d7c4d487 | [
"Apache-2.0"
] | 11 | 2021-06-07T17:39:34.000Z | 2022-01-10T14:00:21.000Z | examples/pytorch/example04_housing_validation.py | ii-research-yu/pgbm | d050a5f71f1a458d8269c4f5201744c0d7c4d487 | [
"Apache-2.0"
] | 10 | 2021-06-08T01:04:03.000Z | 2022-03-31T23:41:23.000Z | """
Copyright (c) 2021 Olivier Sprangers as part of Airlab Amsterdam
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 require... | 35.712871 | 121 | 0.693374 |
import torch
from pgbm import PGBM
from sklearn.model_selection import train_test_split
from sklearn.datasets import fetch_california_housing
import matplotlib.pyplot as plt
def mseloss_objective(yhat, y, sample_weight=None):
gradient = (yhat - y)
hessian = torch.ones_like(yhat)
return gradient, hessian... | true | true |
f7465b8b5dce012009d013d220d056c339c49b48 | 387 | py | Python | Dictionary_1.py | SahilSandasani/Py | edd96992f862425aca9182ac781acb6a91eaed06 | [
"MIT"
] | null | null | null | Dictionary_1.py | SahilSandasani/Py | edd96992f862425aca9182ac781acb6a91eaed06 | [
"MIT"
] | null | null | null | Dictionary_1.py | SahilSandasani/Py | edd96992f862425aca9182ac781acb6a91eaed06 | [
"MIT"
] | null | null | null | student = {"Name":"Drax", "Age":13, "Class":"First"}
print(student["Name"])
print(student["Age"])
print(student["Class"])
student["Name"] = "Quill"
print(student["Name"])
student["School"] = "Falletone"
print(student["School"])
print(student)
print(len(student))
#del student["Name"]
print(student)
#student.clear()
prin... | 22.764706 | 52 | 0.692506 | student = {"Name":"Drax", "Age":13, "Class":"First"}
print(student["Name"])
print(student["Age"])
print(student["Class"])
student["Name"] = "Quill"
print(student["Name"])
student["School"] = "Falletone"
print(student["School"])
print(student)
print(len(student))
print(student)
print(student)
print(student)
print(stu... | true | true |
f7465be3544cf5da84cf8b1b04ca7226091800a2 | 808 | py | Python | 17 GuessNo/main.py | codewithsandy/Python-Basic-Exp | 4c70ada4a042923a94301453c7bd76e704cd2989 | [
"MIT"
] | 3 | 2021-05-08T13:11:41.000Z | 2021-05-14T02:43:20.000Z | 17 GuessNo/main.py | codewithsandy/Python-Basic-Exp | 4c70ada4a042923a94301453c7bd76e704cd2989 | [
"MIT"
] | null | null | null | 17 GuessNo/main.py | codewithsandy/Python-Basic-Exp | 4c70ada4a042923a94301453c7bd76e704cd2989 | [
"MIT"
] | null | null | null | n = 18
number_of_guesses=1
print("Number of guesses is limited to only 9 times from 1 to 100")
while (number_of_guesses<=9):
guess_number = int(input("Guess the number :\n"))
if guess_number<20:
print("You enter Less No. Please enter greator no.\n")
elif guess_number<40:
print("Please enter ... | 38.47619 | 72 | 0.674505 | n = 18
number_of_guesses=1
print("Number of guesses is limited to only 9 times from 1 to 100")
while (number_of_guesses<=9):
guess_number = int(input("Guess the number :\n"))
if guess_number<20:
print("You enter Less No. Please enter greator no.\n")
elif guess_number<40:
print("Please enter ... | true | true |
f7465cd9d9a542e1082a13dffc61193fe367e269 | 5,324 | py | Python | main_ver2.py | leenuu/discord-bot | f2ff4bea8c65a5b780c41bbe12b40ee8e8f827db | [
"MIT"
] | null | null | null | main_ver2.py | leenuu/discord-bot | f2ff4bea8c65a5b780c41bbe12b40ee8e8f827db | [
"MIT"
] | null | null | null | main_ver2.py | leenuu/discord-bot | f2ff4bea8c65a5b780c41bbe12b40ee8e8f827db | [
"MIT"
] | null | null | null | import openpyxl
import json
from datetime import datetime
class bank:
def __init__(self):
self.log = dict()
self.log['server'] = list()
self.data = dict()
self.goods = {1 : 1000, 2 : 800, 3 : 600, 4 : 550, 5 : 500, 6 : 400, 7 : 350, 8 : 300, 9 : 100, 10 : 50}
self.files = ... | 33.275 | 167 | 0.509016 | import openpyxl
import json
from datetime import datetime
class bank:
def __init__(self):
self.log = dict()
self.log['server'] = list()
self.data = dict()
self.goods = {1 : 1000, 2 : 800, 3 : 600, 4 : 550, 5 : 500, 6 : 400, 7 : 350, 8 : 300, 9 : 100, 10 : 50}
self.files = ... | true | true |
f7465d9aec98e76d4b6de70ba5a9759ac139ed39 | 1,254 | py | Python | lib/surface/assured/operations/__init__.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2a48a04df14be46c8745050f98768e30474a1aac | [
"Apache-2.0"
] | 2 | 2019-11-10T09:17:07.000Z | 2019-12-18T13:44:08.000Z | lib/surface/assured/operations/__init__.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2a48a04df14be46c8745050f98768e30474a1aac | [
"Apache-2.0"
] | null | null | null | lib/surface/assured/operations/__init__.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2a48a04df14be46c8745050f98768e30474a1aac | [
"Apache-2.0"
] | 1 | 2020-07-25T01:40:19.000Z | 2020-07-25T01:40:19.000Z | # -*- coding: utf-8 -*- #
# Copyright 2020 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 requir... | 33.891892 | 82 | 0.759171 |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope.base import ReleaseTrack
@base.ReleaseTracks(ReleaseTrack.GA, ReleaseTrack.BETA, ReleaseTrack.ALPHA)
class Operations(base... | true | true |
f7465f80f5bc1996a23bf77fdee9783fb3241a29 | 12,898 | py | Python | src/ZODB/BaseStorage.py | unkloud/ZODB | 63dcee8d3bf0df6a05b75a378292a1a6061ce0c2 | [
"ZPL-2.1"
] | null | null | null | src/ZODB/BaseStorage.py | unkloud/ZODB | 63dcee8d3bf0df6a05b75a378292a1a6061ce0c2 | [
"ZPL-2.1"
] | null | null | null | src/ZODB/BaseStorage.py | unkloud/ZODB | 63dcee8d3bf0df6a05b75a378292a1a6061ce0c2 | [
"ZPL-2.1"
] | null | null | null | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... | 33.853018 | 79 | 0.615754 | preget = preindex.get
# restore() is a new storage API method which has an identical
# signature to store() except that it does not return anything.
# Semantically, restore() is also identical to store() except that it
# doesn't do the ConflictError or VersionLockError consistency
... | true | true |
f746617989b89082050161578363de81d03d25bc | 5,901 | py | Python | modules/synApps_5_6/support/devIocStats-3-1-7/iocAdmin/src/iocReleaseCreateDb.py | A2-Collaboration/epics | b764a53bf449d9f6b54a1173c5e75a22cf95098c | [
"OML"
] | null | null | null | modules/synApps_5_6/support/devIocStats-3-1-7/iocAdmin/src/iocReleaseCreateDb.py | A2-Collaboration/epics | b764a53bf449d9f6b54a1173c5e75a22cf95098c | [
"OML"
] | null | null | null | modules/synApps_5_6/support/devIocStats-3-1-7/iocAdmin/src/iocReleaseCreateDb.py | A2-Collaboration/epics | b764a53bf449d9f6b54a1173c5e75a22cf95098c | [
"OML"
] | null | null | null | #!/usr/bin/env python
import sys
import os
import subprocess
import optparse
__all__ = ['export_db_file', 'module_versions', 'process_options']
def export_db_file(module_versions, path=None):
"""
Use the contents of a dictionary of module versions to create a database
of module release stringin PVs. Th... | 32.96648 | 137 | 0.572276 |
import sys
import os
import subprocess
import optparse
__all__ = ['export_db_file', 'module_versions', 'process_options']
def export_db_file(module_versions, path=None):
"""
Use the contents of a dictionary of module versions to create a database
of module release stringin PVs. The database
is w... | false | true |
f746633cba5fbfdc11de4a68623ff3616c7e5e5e | 1,233 | py | Python | build/titanium_developer.py | marshall/titanium | 8ca85adf061aca5cfc974ff5dcbfdea86a60350d | [
"Apache-2.0"
] | 2 | 2015-03-06T02:50:40.000Z | 2016-05-08T15:13:06.000Z | build/titanium_developer.py | jackingod/titanium | 8ca85adf061aca5cfc974ff5dcbfdea86a60350d | [
"Apache-2.0"
] | null | null | null | build/titanium_developer.py | jackingod/titanium | 8ca85adf061aca5cfc974ff5dcbfdea86a60350d | [
"Apache-2.0"
] | null | null | null | # quick script to automate build/run of titanium developer
import os, sys, platform, shutil, distutils.dir_util as dir_util
import titanium_version
cwd = os.path.dirname(os.path.abspath(__file__))
os_map = { 'Windows': 'win32', 'Darwin': 'osx', 'Linux': 'linux' }
os_name = os_map[platform.system()]
developer_path = os... | 31.615385 | 85 | 0.70884 |
import os, sys, platform, shutil, distutils.dir_util as dir_util
import titanium_version
cwd = os.path.dirname(os.path.abspath(__file__))
os_map = { 'Windows': 'win32', 'Darwin': 'osx', 'Linux': 'linux' }
os_name = os_map[platform.system()]
developer_path = os.path.abspath(os.path.join(cwd, '..', '..', 'titanium_deve... | false | true |
f74663c775b9d66e801488139184466fb325657e | 6,050 | py | Python | pyconcz/programme/models.py | webknjaz/cz.pycon.org-2019 | cead95a962892cba8dd0f530eb2a68d6c34a84b9 | [
"MIT"
] | null | null | null | pyconcz/programme/models.py | webknjaz/cz.pycon.org-2019 | cead95a962892cba8dd0f530eb2a68d6c34a84b9 | [
"MIT"
] | null | null | null | pyconcz/programme/models.py | webknjaz/cz.pycon.org-2019 | cead95a962892cba8dd0f530eb2a68d6c34a84b9 | [
"MIT"
] | null | null | null | from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.urls import reverse
class Speaker(models.Model):
full_name = models.CharField(max_length=200)
bio = models.TextF... | 36.890244 | 180 | 0.668926 | from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.urls import reverse
class Speaker(models.Model):
full_name = models.CharField(max_length=200)
bio = models.TextF... | true | true |
f74663fe94d2f7be48bb1d8290e4be2b67471bbd | 5,928 | py | Python | cykel/settings.py | exmatrikulator/cykel | 37f71ce7ac2ce8fb94956eed0c496b50d60b9020 | [
"MIT"
] | null | null | null | cykel/settings.py | exmatrikulator/cykel | 37f71ce7ac2ce8fb94956eed0c496b50d60b9020 | [
"MIT"
] | null | null | null | cykel/settings.py | exmatrikulator/cykel | 37f71ce7ac2ce8fb94956eed0c496b50d60b9020 | [
"MIT"
] | null | null | null | """Django settings for cykel project.
Generated by 'django-admin startproject' using Django 2.0.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
impo... | 28.5 | 105 | 0.727227 |
import os
import environ
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
env = environ.Env(
DEBUG=(bool, False)
)
environ.Env.read_env()
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = env("SECRET_KEY")
DEBUG = env("DEBUG")
ALLO... | true | true |
f746656ccab7774acec8e6d4c08f2a558a8f3933 | 234 | py | Python | test/ROUTER/router_connect.py | huiyaozheng/Mirage-zmq | af288a3378a7c357bd5646a3abf4fd5ae777369b | [
"ISC"
] | 8 | 2019-05-09T09:27:12.000Z | 2019-05-13T14:44:48.000Z | test/ROUTER/router_connect.py | huiyaozheng/0MQ-MirageOS | af288a3378a7c357bd5646a3abf4fd5ae777369b | [
"ISC"
] | null | null | null | test/ROUTER/router_connect.py | huiyaozheng/0MQ-MirageOS | af288a3378a7c357bd5646a3abf4fd5ae777369b | [
"ISC"
] | 1 | 2019-05-09T09:22:36.000Z | 2019-05-09T09:22:36.000Z | import zmq
import time
context = zmq.Context()
socket = context.socket(zmq.ROUTER)
socket.connect("tcp://127.0.0.1:5556")
time.sleep(1)
socket.send_multipart([b'router',b'Hello'])
address, msg = socket.recv_multipart()
print(msg)
| 23.4 | 43 | 0.730769 | import zmq
import time
context = zmq.Context()
socket = context.socket(zmq.ROUTER)
socket.connect("tcp://127.0.0.1:5556")
time.sleep(1)
socket.send_multipart([b'router',b'Hello'])
address, msg = socket.recv_multipart()
print(msg)
| true | true |
f7466644154d90181574be5be94e98e8a3df0a8c | 213 | py | Python | Python/DTypes.py | sid-146/Python-RePo-sEm-6 | daf23074a411d38013329baf9eb2b8fb0c42fc54 | [
"MIT"
] | null | null | null | Python/DTypes.py | sid-146/Python-RePo-sEm-6 | daf23074a411d38013329baf9eb2b8fb0c42fc54 | [
"MIT"
] | null | null | null | Python/DTypes.py | sid-146/Python-RePo-sEm-6 | daf23074a411d38013329baf9eb2b8fb0c42fc54 | [
"MIT"
] | null | null | null | a = int(10)
print(a, type(a))
b = 1.0
# b = float(1.0)
print(b,type(b))
c = 1+2j
print(c,type(c))
l = [1,2,3,4,5]
print(l ,type(l))
t = (1,2,3,4,5)
print(t,type(t))
s = 'Sudhanwa Kaveeshwar'
print(s,type(s))
| 11.210526 | 25 | 0.553991 | a = int(10)
print(a, type(a))
b = 1.0
print(b,type(b))
c = 1+2j
print(c,type(c))
l = [1,2,3,4,5]
print(l ,type(l))
t = (1,2,3,4,5)
print(t,type(t))
s = 'Sudhanwa Kaveeshwar'
print(s,type(s))
| true | true |
f746665a4be2371d32ed54b112ebfdc033a4e04b | 2,409 | py | Python | tasks/tests/test_get_task_comments.py | aradz1997/beyond-os-06-group-2 | 5c8970b65b82fb2b9be243c252360fb7feb0d3b8 | [
"MIT"
] | 7 | 2021-11-06T20:30:41.000Z | 2021-12-15T09:13:17.000Z | tasks/tests/test_get_task_comments.py | aradz1997/beyond-os-06-group-2 | 5c8970b65b82fb2b9be243c252360fb7feb0d3b8 | [
"MIT"
] | 131 | 2021-11-02T07:23:29.000Z | 2022-01-01T18:12:51.000Z | tasks/tests/test_get_task_comments.py | aradz1997/beyond-os-06-group-2 | 5c8970b65b82fb2b9be243c252360fb7feb0d3b8 | [
"MIT"
] | 5 | 2021-10-30T07:17:57.000Z | 2021-11-01T18:52:26.000Z | from django.db.models.query import QuerySet
import pytest
from tasks.models import Comment, Priority, Status, Task
from users.models import Role, User
NUM_COMMENTS_PER_USER = 3
@pytest.mark.django_db
class TestTaskComments:
@pytest.fixture
def user_and_manager(self, users):
user = users[1][0]
... | 42.263158 | 101 | 0.594853 | from django.db.models.query import QuerySet
import pytest
from tasks.models import Comment, Priority, Status, Task
from users.models import Role, User
NUM_COMMENTS_PER_USER = 3
@pytest.mark.django_db
class TestTaskComments:
@pytest.fixture
def user_and_manager(self, users):
user = users[1][0]
... | true | true |
f7466a15eb3a2166af14f5bbedb2f57c189841ad | 5,274 | py | Python | L1Trigger/L1CaloTrigger/python/L1TowerCalibrationProducer_cfi.py | thesps/cmssw | ad5315934948ce96699b29cc1d5b03a59f99634f | [
"Apache-2.0"
] | null | null | null | L1Trigger/L1CaloTrigger/python/L1TowerCalibrationProducer_cfi.py | thesps/cmssw | ad5315934948ce96699b29cc1d5b03a59f99634f | [
"Apache-2.0"
] | null | null | null | L1Trigger/L1CaloTrigger/python/L1TowerCalibrationProducer_cfi.py | thesps/cmssw | ad5315934948ce96699b29cc1d5b03a59f99634f | [
"Apache-2.0"
] | null | null | null | import FWCore.ParameterSet.Config as cms
L1TowerCalibrationProducer = cms.EDProducer("L1TowerCalibrator",
# Choosen settings 6 March 2019, 10_3_X MTD samples
HcalTpEtMin = cms.double(0.5),
EcalTpEtMin = cms.double(0.5),
HGCalHadTpEtMin = cms.double(0.25),
HGCalEmTpEtMin = cms.double(0.25),
HFTp... | 28.354839 | 93 | 0.610922 | import FWCore.ParameterSet.Config as cms
L1TowerCalibrationProducer = cms.EDProducer("L1TowerCalibrator",
HcalTpEtMin = cms.double(0.5),
EcalTpEtMin = cms.double(0.5),
HGCalHadTpEtMin = cms.double(0.25),
HGCalEmTpEtMin = cms.double(0.25),
HFTpEtMin = cms.double(0.5),
puThreshold = cms.doub... | true | true |
f7466b1d1e26141a6f5bcafa5a12db73034c5dab | 13,449 | py | Python | lib/python3.8/site-packages/ansible_collections/community/aws/plugins/modules/aws_api_gateway.py | cjsteel/python3-venv-ansible-2.10.5 | c95395c4cae844dc66fddde9b4343966f4b2ecd5 | [
"Apache-1.1"
] | null | null | null | lib/python3.8/site-packages/ansible_collections/community/aws/plugins/modules/aws_api_gateway.py | cjsteel/python3-venv-ansible-2.10.5 | c95395c4cae844dc66fddde9b4343966f4b2ecd5 | [
"Apache-1.1"
] | null | null | null | lib/python3.8/site-packages/ansible_collections/community/aws/plugins/modules/aws_api_gateway.py | cjsteel/python3-venv-ansible-2.10.5 | c95395c4cae844dc66fddde9b4343966f4b2ecd5 | [
"Apache-1.1"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: aws_api_gateway
version_added: 1.0... | 36.447154 | 141 | 0.693955 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: aws_api_gateway
version_added: 1.0.0
short_description: Manage AWS API Gateway APIs
description:
- Allows for the management of API Gateway APIs.
- Normally you should give the api_id ... | true | true |
f7466c3fd6f78170fd547a1885605d89989e138e | 572,517 | py | Python | codespace/python/tencentcloud/cwp/v20180228/models.py | tzpBingo/github-trending | 05dc0a4a5aae91871a57b9c6db5d9faee243173e | [
"MIT"
] | 37 | 2017-10-12T01:50:42.000Z | 2022-02-24T02:44:45.000Z | codespace/python/tencentcloud/cwp/v20180228/models.py | tzpBingo/github-trending | 05dc0a4a5aae91871a57b9c6db5d9faee243173e | [
"MIT"
] | null | null | null | codespace/python/tencentcloud/cwp/v20180228/models.py | tzpBingo/github-trending | 05dc0a4a5aae91871a57b9c6db5d9faee243173e | [
"MIT"
] | 12 | 2018-07-31T10:04:56.000Z | 2022-02-07T00:08:06.000Z | # -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | 29.097225 | 226 | 0.586086 |
import warnings
from tencentcloud.common.abstract_model import AbstractModel
class AccountStatistics(AbstractModel):
def __init__(self):
self.Username = None
self.MachineNum = None
def _deserialize(self, params):
self.Username = params.get("Username")
self.Ma... | true | true |
f7466c6fb8542e5def1c710dca00b390de18b84a | 432 | py | Python | datasets/document_dataset_base.py | ktodorov/historical-ocr | d4d7bf0addf5ff98b7182c00ff716e79c97e050e | [
"MIT"
] | null | null | null | datasets/document_dataset_base.py | ktodorov/historical-ocr | d4d7bf0addf5ff98b7182c00ff716e79c97e050e | [
"MIT"
] | null | null | null | datasets/document_dataset_base.py | ktodorov/historical-ocr | d4d7bf0addf5ff98b7182c00ff716e79c97e050e | [
"MIT"
] | null | null | null | from typing import Dict, List
from overrides.overrides import overrides
from datasets.dataset_base import DatasetBase
class DocumentDatasetBase(DatasetBase):
def __init__(self):
super().__init__()
def get_indices_per_document(self) -> Dict[int, List[int]]:
return {}
def use_collate_func... | 22.736842 | 63 | 0.706019 | from typing import Dict, List
from overrides.overrides import overrides
from datasets.dataset_base import DatasetBase
class DocumentDatasetBase(DatasetBase):
def __init__(self):
super().__init__()
def get_indices_per_document(self) -> Dict[int, List[int]]:
return {}
def use_collate_func... | true | true |
f7466d01e23333824c958e9a28cea6043c83cc97 | 20,640 | py | Python | menu.py | edubevi/PTIN-AComRe | 9c62a7db16b09999c374e7b7183b760ea22ca1c6 | [
"MIT"
] | null | null | null | menu.py | edubevi/PTIN-AComRe | 9c62a7db16b09999c374e7b7183b760ea22ca1c6 | [
"MIT"
] | null | null | null | menu.py | edubevi/PTIN-AComRe | 9c62a7db16b09999c374e7b7183b760ea22ca1c6 | [
"MIT"
] | 3 | 2018-05-15T06:54:52.000Z | 2019-04-28T15:27:57.000Z | #!/usr/bin/env python
from tkinter import *
import time, docker, subprocess, sys, json, os
# List of allowed devices with their type id.
devices = {"doctor":1, "patient":2, "ambulance":3,"smoke":4,"weather":5,"air":6, "nurse":7, "stretcher":8}
# stores the number of devices by type.
num_devices = {"doctor":0, "patien... | 38.364312 | 141 | 0.584496 |
from tkinter import *
import time, docker, subprocess, sys, json, os
devices = {"doctor":1, "patient":2, "ambulance":3,"smoke":4,"weather":5,"air":6, "nurse":7, "stretcher":8}
num_devices = {"doctor":0, "patient":0, "ambulance":0,"smoke":0,"weather":0,"air":0, "nurse":0, "stretcher":0}
def runcontainers():
d... | true | true |
f7466d3bb02f09ebc73a80fd021fea6330428ac0 | 4,173 | py | Python | helloworld/settings.py | keisukeee-ma/hello | f3a32b14132e3086cf81d6a6ccc45dfe025b5f23 | [
"MIT"
] | null | null | null | helloworld/settings.py | keisukeee-ma/hello | f3a32b14132e3086cf81d6a6ccc45dfe025b5f23 | [
"MIT"
] | null | null | null | helloworld/settings.py | keisukeee-ma/hello | f3a32b14132e3086cf81d6a6ccc45dfe025b5f23 | [
"MIT"
] | null | null | null | """
Django settings for helloworld project on Heroku. For more info, see:
https://github.com/heroku/heroku-django-template
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/setting... | 30.23913 | 91 | 0.719626 |
import os
import dj_database_url
import django_heroku
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
SECRET_KEY = "tf)!7lw(kb4q0o1(xjedy_l8t+8+s1uzc-35fs21j71vw+56n5"
DEBUG = True
# Application definition
INSTALLED_APPS = [
... | true | true |
f7466d9a9a39cd526767a4db9c03ebc587a1cffc | 19,181 | py | Python | cbor2/decoder.py | waveform80/cbor2 | 4e1e7624e0e8dbef1eea19e86d3f808f13d2518e | [
"MIT"
] | 2 | 2020-12-09T17:26:25.000Z | 2021-05-07T02:21:57.000Z | cbor2/decoder.py | waveform80/cbor2 | 4e1e7624e0e8dbef1eea19e86d3f808f13d2518e | [
"MIT"
] | 1 | 2020-11-09T22:22:06.000Z | 2020-11-09T22:22:06.000Z | cbor2/decoder.py | waveform80/cbor2 | 4e1e7624e0e8dbef1eea19e86d3f808f13d2518e | [
"MIT"
] | 1 | 2021-05-12T14:19:10.000Z | 2021-05-12T14:19:10.000Z | import re
import struct
from .compat import Mapping
from datetime import datetime, timedelta
from io import BytesIO
from .compat import timezone, range, byte_as_integer, unpack_float16
from .types import (
CBORDecodeValueError, CBORDecodeEOF, CBORTag, undefined, break_marker,
CBORSimpleValue, FrozenDict)
time... | 33.300347 | 84 | 0.587508 | import re
import struct
from .compat import Mapping
from datetime import datetime, timedelta
from io import BytesIO
from .compat import timezone, range, byte_as_integer, unpack_float16
from .types import (
CBORDecodeValueError, CBORDecodeEOF, CBORTag, undefined, break_marker,
CBORSimpleValue, FrozenDict)
time... | true | true |
f7466e9a3b5900cc589832c16653c8c65cafc66f | 9,382 | py | Python | other_methods/coteaching/data/utils.py | cgnorthcutt/confidentlearning-data | 2f3155636663eb0813363dc06cd822aae6526c34 | [
"MIT"
] | null | null | null | other_methods/coteaching/data/utils.py | cgnorthcutt/confidentlearning-data | 2f3155636663eb0813363dc06cd822aae6526c34 | [
"MIT"
] | null | null | null | other_methods/coteaching/data/utils.py | cgnorthcutt/confidentlearning-data | 2f3155636663eb0813363dc06cd822aae6526c34 | [
"MIT"
] | null | null | null | import os
import os.path
import copy
import hashlib
import errno
import numpy as np
from numpy.testing import assert_array_almost_equal
def check_integrity(fpath, md5):
if not os.path.isfile(fpath):
return False
md5o = hashlib.md5()
with open(fpath, 'rb') as f:
# read in 1MB chunks
... | 32.576389 | 147 | 0.61117 | import os
import os.path
import copy
import hashlib
import errno
import numpy as np
from numpy.testing import assert_array_almost_equal
def check_integrity(fpath, md5):
if not os.path.isfile(fpath):
return False
md5o = hashlib.md5()
with open(fpath, 'rb') as f:
for chunk in iter(la... | false | true |
f7466eda650f91e778bb606ecca1bf76221997a7 | 518 | py | Python | flavio/__init__.py | jasonaebischerGIT/flavio | b8d833c8380c619112ed75175cb7db52b788b1cd | [
"MIT"
] | null | null | null | flavio/__init__.py | jasonaebischerGIT/flavio | b8d833c8380c619112ed75175cb7db52b788b1cd | [
"MIT"
] | null | null | null | flavio/__init__.py | jasonaebischerGIT/flavio | b8d833c8380c619112ed75175cb7db52b788b1cd | [
"MIT"
] | null | null | null | from ._version import __version__
from . import physics
from . import statistics
from . import io
from . import parameters
from . import measurements
from . import classes
from .classes import Measurement, Parameter, ParameterConstraints, Observable, NamedInstanceClass
from .config import config
from flavio.physics.eft... | 39.846154 | 121 | 0.84749 | from ._version import __version__
from . import physics
from . import statistics
from . import io
from . import parameters
from . import measurements
from . import classes
from .classes import Measurement, Parameter, ParameterConstraints, Observable, NamedInstanceClass
from .config import config
from flavio.physics.eft... | true | true |
f7466ef116c6e0267b787907c8763fbd487f5e8d | 8,859 | py | Python | test/integration_test/test_multi_transfer.py | heshu-by/likelib | 76a06b0df7dea5520d5b43e6cf9ef4b9e81dad83 | [
"Apache-2.0"
] | 1 | 2020-10-23T19:09:27.000Z | 2020-10-23T19:09:27.000Z | test/integration_test/test_multi_transfer.py | heshu-by/likelib | 76a06b0df7dea5520d5b43e6cf9ef4b9e81dad83 | [
"Apache-2.0"
] | null | null | null | test/integration_test/test_multi_transfer.py | heshu-by/likelib | 76a06b0df7dea5520d5b43e6cf9ef4b9e81dad83 | [
"Apache-2.0"
] | 1 | 2020-12-08T11:16:30.000Z | 2020-12-08T11:16:30.000Z | from tester import test_case, Node, NodePoll
import concurrent.futures
@test_case("multi_transfer")
def main(env, logger):
settings_node_1 = Node.Settings(Node.Id(20300, 50150))
settings_node_2 = Node.Settings(Node.Id(20301, 50151), nodes=[settings_node_1.id, ])
with Node(env, settings_node_1, logger) as... | 40.085973 | 133 | 0.637205 | from tester import test_case, Node, NodePoll
import concurrent.futures
@test_case("multi_transfer")
def main(env, logger):
settings_node_1 = Node.Settings(Node.Id(20300, 50150))
settings_node_2 = Node.Settings(Node.Id(20301, 50151), nodes=[settings_node_1.id, ])
with Node(env, settings_node_1, logger) as... | true | true |
f7466fd7b861e4976f6d3248fd57ea0c5d9af782 | 2,186 | py | Python | matrix_cp_one.py | zhangkaifang/cp_decomposition | 75eb5f3df302c08ad2e62f41e6d93bb990a16797 | [
"MIT"
] | 1 | 2021-07-21T15:51:09.000Z | 2021-07-21T15:51:09.000Z | matrix_cp_one.py | zhangkaifang/cp_decomposition | 75eb5f3df302c08ad2e62f41e6d93bb990a16797 | [
"MIT"
] | null | null | null | matrix_cp_one.py | zhangkaifang/cp_decomposition | 75eb5f3df302c08ad2e62f41e6d93bb990a16797 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''=====================================
@Author :Kaifang Zhang
@Time :2021/7/5 1:31
@Contact: kaifang.zkf@dtwave-inc.com
========================================'''
import numpy as np
def LFM_grad_desc(R, K, max_iter, alpha=1e-4, lamda=1e-4):
"""
实现矩阵缺失元素补全使用梯度... | 25.126437 | 93 | 0.39936 |
import numpy as np
def LFM_grad_desc(R, K, max_iter, alpha=1e-4, lamda=1e-4):
M = len(R)
N = len(R[0])
P = np.random.rand(M, K)
Q = np.random.rand(N, K)
Q = Q.T
for step in range(max_iter):
for u in range(M):
for i in range(N):
... | true | true |
f7466ffb92c2778c6a1d0e803d106aa0c557aeec | 2,071 | py | Python | Array/532K-diffPairsArray.py | john-the-dev/leetcode | f1038a5357c841a0d3c8aca1ae1a7d0387f77545 | [
"Apache-2.0"
] | null | null | null | Array/532K-diffPairsArray.py | john-the-dev/leetcode | f1038a5357c841a0d3c8aca1ae1a7d0387f77545 | [
"Apache-2.0"
] | null | null | null | Array/532K-diffPairsArray.py | john-the-dev/leetcode | f1038a5357c841a0d3c8aca1ae1a7d0387f77545 | [
"Apache-2.0"
] | null | null | null | # 532. K-diff Pairs in an Array
'''
Given an array of integers nums and an integer k, return the number of unique k-diff pairs in the array.
A k-diff pair is an integer pair (nums[i], nums[j]), where the following are true:
0 <= i, j < nums.length
i != j
|nums[i] - nums[j]| == k
Notice that |val| denotes the absolute... | 26.896104 | 104 | 0.573153 |
from common import *
from collections import defaultdict
class Solution:
def findPairs(self, nums: List[int], k: int) -> int:
out = 0
if k == 0:
h = defaultdict(int)
for num in nums:
h[num] += 1
for num in h:
if h[num] > 1: out += ... | true | true |
f7466ffef38bf7b1d2b839cabccd8db1f6d14389 | 7,619 | py | Python | assn-1/code-DJQQ/view_main.py | DJ-LESSON/UCB-EE122 | 934a50e25fe314bdd169e13fc979205ebe90ee86 | [
"MIT"
] | 1 | 2021-12-18T17:54:10.000Z | 2021-12-18T17:54:10.000Z | assn-1/code-DJQQ/view_main.py | dj-lesson/ucb-ee122 | 934a50e25fe314bdd169e13fc979205ebe90ee86 | [
"MIT"
] | null | null | null | assn-1/code-DJQQ/view_main.py | dj-lesson/ucb-ee122 | 934a50e25fe314bdd169e13fc979205ebe90ee86 | [
"MIT"
] | null | null | null | # coding=gbk
# the main view of this software including friends list
import Tkinter
from view_chat import ChatView
from socket import *
import time
import thread
import os
# the class of main view
class MainView(Tkinter.Frame):
# ADDR is the socket address
# udpCliSock is the udp socket object which input by ... | 41.63388 | 114 | 0.551122 |
import Tkinter
from view_chat import ChatView
from socket import *
import time
import thread
import os
class MainView(Tkinter.Frame):
def __init__(self, ADDR, udpCliSock, hostname, master):
Tkinter.Frame.__init__(self, master, padx=10, pady=10)
self.master.iconbitmap('andj_icon.... | false | true |
f74672c64d84c81ad650e391b98b90c0c5e23d05 | 3,202 | py | Python | Research/website/reqs/reqs/settings.py | R2-A2-07/reqs | cc07dfcaa69b193dc389f8566a622776539eedda | [
"MIT"
] | null | null | null | Research/website/reqs/reqs/settings.py | R2-A2-07/reqs | cc07dfcaa69b193dc389f8566a622776539eedda | [
"MIT"
] | null | null | null | Research/website/reqs/reqs/settings.py | R2-A2-07/reqs | cc07dfcaa69b193dc389f8566a622776539eedda | [
"MIT"
] | null | null | null | """
Django settings for reqs project.
Generated by 'django-admin startproject' using Django 2.1.3.
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/
"""
imp... | 26.46281 | 92 | 0.668332 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'ulm4!r3dj%@6&lc+9u11!*xffrv2g#4y4&^0@7@-(oy#rp25sy'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'dja... | true | true |
f7467317540c0060911f989c35fe309dfef3d2e4 | 4,570 | py | Python | frappe/contacts/address_and_contact.py | chaitraliw/mws_frappe | 52182a27f3b9a61d080e741e349a308be3e94582 | [
"MIT"
] | 1 | 2020-08-12T23:07:02.000Z | 2020-08-12T23:07:02.000Z | frappe/contacts/address_and_contact.py | chaitraliw/mws_frappe | 52182a27f3b9a61d080e741e349a308be3e94582 | [
"MIT"
] | null | null | null | frappe/contacts/address_and_contact.py | chaitraliw/mws_frappe | 52182a27f3b9a61d080e741e349a308be3e94582 | [
"MIT"
] | 2 | 2018-03-22T02:33:53.000Z | 2018-08-03T14:31:58.000Z | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def load_address_and_contact(doc, key=None):
"""Loads address list and contact list in `__onload`"""
from frappe.contacts.doctype.addre... | 30.466667 | 116 | 0.706346 |
from __future__ import unicode_literals
import frappe
def load_address_and_contact(doc, key=None):
from frappe.contacts.doctype.address.address import get_address_display
filters = [
["Dynamic Link", "link_doctype", "=", doc.doctype],
["Dynamic Link", "link_name", "=", doc.name],
["Dynamic Link", "parentty... | true | true |
f74673388abb88c36cad2ef74c11409967a84c8f | 2,672 | py | Python | ga4ghtest/services/drs/client.py | ga4gh/workflow-interop | e2b3422f6867ce632c65e017d7b558f3cce9fcf1 | [
"Apache-2.0"
] | 5 | 2019-04-15T17:37:33.000Z | 2020-04-24T15:18:06.000Z | ga4ghtest/services/drs/client.py | Sage-Bionetworks/synevalharness | e2b3422f6867ce632c65e017d7b558f3cce9fcf1 | [
"Apache-2.0"
] | 58 | 2018-12-07T15:55:35.000Z | 2022-02-18T15:42:27.000Z | ga4ghtest/services/drs/client.py | Sage-Bionetworks/synapse-orchestrator | e2b3422f6867ce632c65e017d7b558f3cce9fcf1 | [
"Apache-2.0"
] | 4 | 2018-07-18T23:00:09.000Z | 2018-07-31T20:01:21.000Z | import logging
import json
import requests
from ga4gh.drs.cli.methods.get import get
def api_reponse(postresult):
if postresult.status_code != 200:
error = str(json.loads(postresult.text))
logging.error(error)
raise Exception(error)
return json.loads(postresult.text)
class DRSClien... | 29.362637 | 89 | 0.516841 | import logging
import json
import requests
from ga4gh.drs.cli.methods.get import get
def api_reponse(postresult):
if postresult.status_code != 200:
error = str(json.loads(postresult.text))
logging.error(error)
raise Exception(error)
return json.loads(postresult.text)
class DRSClien... | true | true |
f746744d04e673a5beedb0b9b86e287617465a83 | 8,962 | py | Python | python/nano/src/bigdl/nano/pytorch/onnx/onnxrt_inference.py | EmiCareOfCell44/BigDL | 6278ee8eed09b5072da53dab3a99530cf5f69ba2 | [
"Apache-2.0"
] | null | null | null | python/nano/src/bigdl/nano/pytorch/onnx/onnxrt_inference.py | EmiCareOfCell44/BigDL | 6278ee8eed09b5072da53dab3a99530cf5f69ba2 | [
"Apache-2.0"
] | null | null | null | python/nano/src/bigdl/nano/pytorch/onnx/onnxrt_inference.py | EmiCareOfCell44/BigDL | 6278ee8eed09b5072da53dab3a99530cf5f69ba2 | [
"Apache-2.0"
] | null | null | null | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 44.81 | 98 | 0.597969 |
from pytorch_lightning import LightningModule
import onnxruntime as ort
from functools import partial
import warnings
import torch
import math
import numpy as np
ONNXRT_BINDED_COMPONENTS = ['_ortsess_up_to_date',
'_ortsess',
'_build_ortsess',
... | true | true |
f7467469129901657e4b53cc9687b8c54304318a | 17,593 | py | Python | echopype/convert/set_groups_ad2cp.py | gavinmacaulay/echopype | 1698b6076a16506f638e691d4d014c8649cc735d | [
"Apache-2.0"
] | null | null | null | echopype/convert/set_groups_ad2cp.py | gavinmacaulay/echopype | 1698b6076a16506f638e691d4d014c8649cc735d | [
"Apache-2.0"
] | null | null | null | echopype/convert/set_groups_ad2cp.py | gavinmacaulay/echopype | 1698b6076a16506f638e691d4d014c8649cc735d | [
"Apache-2.0"
] | null | null | null | from typing import List, Optional
import numpy as np
import xarray as xr
from .parse_ad2cp import Ad2cpDataPacket, Field, HeaderOrDataRecordFormats
from .set_groups_base import SetGroupsBase, set_encodings
def merge_attrs(datasets: List[xr.Dataset]) -> List[xr.Dataset]:
"""
Merges attrs from a list of datas... | 44.539241 | 89 | 0.547263 | from typing import List, Optional
import numpy as np
import xarray as xr
from .parse_ad2cp import Ad2cpDataPacket, Field, HeaderOrDataRecordFormats
from .set_groups_base import SetGroupsBase, set_encodings
def merge_attrs(datasets: List[xr.Dataset]) -> List[xr.Dataset]:
total_attrs = dict()
for ds in datas... | true | true |
f74674d3d04e992c9b38b8f5f7cfef8b4888cf75 | 1,290 | py | Python | cycling_in_france/helper_func.py | nenb/cycling_in_france | 6cddc433a2136f52be996719db0a1d876fcf5c59 | [
"MIT"
] | null | null | null | cycling_in_france/helper_func.py | nenb/cycling_in_france | 6cddc433a2136f52be996719db0a1d876fcf5c59 | [
"MIT"
] | null | null | null | cycling_in_france/helper_func.py | nenb/cycling_in_france | 6cddc433a2136f52be996719db0a1d876fcf5c59 | [
"MIT"
] | null | null | null | import regionmask
import numpy as np
import dask
def create_windmax_dict(u, v, names, borders, longitude, latitude):
"""Produce a dictionary of masked maximum wind speeds in units of mph."""
if u.units != "m s**-1":
raise ValueError("U field does not have units m/s")
if v.units != "m s**-1":
... | 40.3125 | 79 | 0.662791 | import regionmask
import numpy as np
import dask
def create_windmax_dict(u, v, names, borders, longitude, latitude):
if u.units != "m s**-1":
raise ValueError("U field does not have units m/s")
if v.units != "m s**-1":
raise ValueError("V field does not have units m/s")
metre_to_mile = 36... | true | true |
f7467591ae6761e546c213db7a2ec4b80d04fc60 | 195 | py | Python | Containers-&-Orchestration/Docker/python-hello-world/app.py | kibetamos/Everything-Tech | 25edb8e3be35bda13faf258c18d5c6653b9e73a7 | [
"Apache-2.0"
] | 371 | 2021-11-15T12:50:58.000Z | 2022-03-11T19:53:40.000Z | Containers-&-Orchestration/Docker/python-hello-world/app.py | a-abukar/Everything-Tech | eb513519f607501339b628b3c4bf002293d61513 | [
"Apache-2.0"
] | 19 | 2021-11-15T18:22:17.000Z | 2022-03-06T11:20:04.000Z | Containers-&-Orchestration/Docker/python-hello-world/app.py | a-abukar/Everything-Tech | eb513519f607501339b628b3c4bf002293d61513 | [
"Apache-2.0"
] | 111 | 2021-11-15T13:04:51.000Z | 2022-03-29T11:51:00.000Z | from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
return "<h1>Hello world</h1>"
if __name__ == "__main__":
app.run(host='0.0.0.0', debug=True) | 17.727273 | 40 | 0.651282 | from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
return "<h1>Hello world</h1>"
if __name__ == "__main__":
app.run(host='0.0.0.0', debug=True) | true | true |
f74675c0730e34b83b01be82622c62b1f662e778 | 679 | py | Python | RegularizedFastMarching/RegularizedFastMarchingLib/Regularization.py | AldrickF/SlicerRegularizedFastMarching | 3841be22f23f411f7f4639d3b792c05cb4ce20e6 | [
"Apache-2.0"
] | 1 | 2021-09-22T19:50:56.000Z | 2021-09-22T19:50:56.000Z | RegularizedFastMarching/RegularizedFastMarchingLib/Regularization.py | lassoan/SlicerRegularizedFastMarching | 8a04a594cf5dd6c98e1f9dd93e61af6e6852339f | [
"Apache-2.0"
] | null | null | null | RegularizedFastMarching/RegularizedFastMarchingLib/Regularization.py | lassoan/SlicerRegularizedFastMarching | 8a04a594cf5dd6c98e1f9dd93e61af6e6852339f | [
"Apache-2.0"
] | 2 | 2021-05-26T13:24:14.000Z | 2021-05-28T13:38:04.000Z | def regularization(InputImage, StructuringElementRadius=3):
"""
Compute the 3D scalar field that will be used to regularize the seeds propagation
Inputs:
* InputImage: the 3D image that will be segmented. Must be a 3D numpy array.
* StructuringElementRadius: A structuring element of size (1+2*St... | 52.230769 | 173 | 0.745214 | def regularization(InputImage, StructuringElementRadius=3):
from scipy import ndimage
MSE = StructuringElementRadius
return ndimage.morphological_gradient(InputImage, size=(MSE, MSE, MSE)) | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.