hexsha stringlengths 40 40 | size int64 4 996k | ext stringclasses 8
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 4 996k | avg_line_length float64 1.33 58.2k | max_line_length int64 2 323k | alphanum_fraction float64 0 0.97 | content_no_comment stringlengths 0 946k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7f572baae6462e177d7aaf6b1e4878d7035945f | 19 | py | Python | torrentool/__init__.py | erikdejonge/torrentool | e2670fc1ba8a5356726b9ba91f287414c921e626 | [
"BSD-3-Clause"
] | null | null | null | torrentool/__init__.py | erikdejonge/torrentool | e2670fc1ba8a5356726b9ba91f287414c921e626 | [
"BSD-3-Clause"
] | null | null | null | torrentool/__init__.py | erikdejonge/torrentool | e2670fc1ba8a5356726b9ba91f287414c921e626 | [
"BSD-3-Clause"
] | null | null | null | VERSION = (1, 0, 2) | 19 | 19 | 0.526316 | VERSION = (1, 0, 2) | true | true |
f7f572efec2d623a7fcbb9aa147367db2515b481 | 6,497 | py | Python | KaSaAn/functions/snapshot_visualizer_subcomponent.py | hmedina/KaSaAn | 83e4e31ff0e0062762aacfbc65bbdd290808bb51 | [
"MIT"
] | 1 | 2020-05-11T14:31:54.000Z | 2020-05-11T14:31:54.000Z | KaSaAn/functions/snapshot_visualizer_subcomponent.py | hmedina/KaSaAn | 83e4e31ff0e0062762aacfbc65bbdd290808bb51 | [
"MIT"
] | 4 | 2017-08-31T11:16:08.000Z | 2020-07-10T22:31:45.000Z | KaSaAn/functions/snapshot_visualizer_subcomponent.py | hmedina/KaSaAn | 83e4e31ff0e0062762aacfbc65bbdd290808bb51 | [
"MIT"
] | 2 | 2018-02-06T20:53:26.000Z | 2019-05-11T18:05:38.000Z | #! /usr/bin/env python3
import ast
import squarify
import warnings
import networkx as nx
import matplotlib as mpl
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
from networkx.drawing.nx_agraph import graphviz_layout
from typing import List, Tuple
from ..core import KappaSnapshot, KappaComplex, K... | 53.694215 | 119 | 0.658766 |
import ast
import squarify
import warnings
import networkx as nx
import matplotlib as mpl
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
from networkx.drawing.nx_agraph import graphviz_layout
from typing import List, Tuple
from ..core import KappaSnapshot, KappaComplex, KappaAgent
from .snapsho... | true | true |
f7f5736590d965ae539f000b45a5a34df6fc363d | 3,816 | py | Python | python/ccxt/async_support/okex.py | 15210770501/ccxt | 4a682d92a23ccb768234dd7c0557a8ce4ccf8118 | [
"MIT"
] | null | null | null | python/ccxt/async_support/okex.py | 15210770501/ccxt | 4a682d92a23ccb768234dd7c0557a8ce4ccf8118 | [
"MIT"
] | null | null | null | python/ccxt/async_support/okex.py | 15210770501/ccxt | 4a682d92a23ccb768234dd7c0557a8ce4ccf8118 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.okcoinusd import okcoinusd
class okex (okcoinusd):
def describe(self):
return self.deep_extend(super... | 36.692308 | 126 | 0.527778 |
rt.okcoinusd import okcoinusd
class okex (okcoinusd):
def describe(self):
return self.deep_extend(super(okex, self).describe(), {
'id': 'okex',
'name': 'OKEX',
'countries': ['CN', 'US'],
'has': {
'CORS': False,
'futures': ... | true | true |
f7f5749e96191da7b79aa26f88ab3c8cbd56f24b | 10,761 | py | Python | doc/sphinxext/gallery_generator.py | EwoutH/seaborn | 630c08d7bd1c2a39362eda2389e8822357057775 | [
"BSD-3-Clause"
] | null | null | null | doc/sphinxext/gallery_generator.py | EwoutH/seaborn | 630c08d7bd1c2a39362eda2389e8822357057775 | [
"BSD-3-Clause"
] | null | null | null | doc/sphinxext/gallery_generator.py | EwoutH/seaborn | 630c08d7bd1c2a39362eda2389e8822357057775 | [
"BSD-3-Clause"
] | null | null | null | """
Sphinx plugin to run example scripts and create a gallery page.
Lightly modified from the mpld3 project.
"""
import os
import os.path as op
import re
import glob
import token
import tokenize
import shutil
import warnings
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt # noqa: E402
# Py... | 26.9025 | 79 | 0.534151 | import os
import os.path as op
import re
import glob
import token
import tokenize
import shutil
import warnings
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def execfile(filename, globals=None, locals=None):
with open(filename, "rb") as fp:
exec(compile(fp.read(), filename, ... | true | true |
f7f574ba66c71f974f9f9f8760bb96a83b66813b | 9,175 | py | Python | train_loc.py | VITA-Group/VGAI | c36746383da42b011dddf182303f8c2618d5ca42 | [
"MIT"
] | 3 | 2021-07-11T16:15:17.000Z | 2021-08-24T07:50:10.000Z | train_loc.py | VITA-Group/VGAI | c36746383da42b011dddf182303f8c2618d5ca42 | [
"MIT"
] | null | null | null | train_loc.py | VITA-Group/VGAI | c36746383da42b011dddf182303f8c2618d5ca42 | [
"MIT"
] | 1 | 2022-01-07T14:37:21.000Z | 2022-01-07T14:37:21.000Z | import os
import sys
import time
import glob
import numpy as np
import torch
import logging
import argparse
import torch.nn as nn
import torch.utils
import torch.backends.cudnn as cudnn
import joint_network as models
from dataset_loc import OneHopDataset
from torch.utils.data import Dataset, DataLoader
import shutil
... | 37.757202 | 196 | 0.669537 | import os
import sys
import time
import glob
import numpy as np
import torch
import logging
import argparse
import torch.nn as nn
import torch.utils
import torch.backends.cudnn as cudnn
import joint_network as models
from dataset_loc import OneHopDataset
from torch.utils.data import Dataset, DataLoader
import shutil
... | true | true |
f7f5754fc2fafcdc2dbb7f43617a7ad530693822 | 1,929 | py | Python | data-mining/model2http-api.py | RoderickLi/python-snippet | 7cc672c455a768864cf38d6bbebdf8337b9c510c | [
"MIT"
] | 6 | 2019-11-06T02:11:43.000Z | 2021-03-21T02:48:10.000Z | data-mining/model2http-api.py | RoderickLi/python-snippet | 7cc672c455a768864cf38d6bbebdf8337b9c510c | [
"MIT"
] | null | null | null | data-mining/model2http-api.py | RoderickLi/python-snippet | 7cc672c455a768864cf38d6bbebdf8337b9c510c | [
"MIT"
] | 2 | 2019-11-06T02:11:44.000Z | 2019-11-06T02:46:00.000Z | import tensorflow as tf
def save_model_to_serving(model, export_version, export_path='model/'):
print(model.input, model.output)
signature = tf.saved_model.signature_def_utils.predict_signature_def(
inputs={'img_input': model.input[... | 48.225 | 158 | 0.488336 | import tensorflow as tf
def save_model_to_serving(model, export_version, export_path='model/'):
print(model.input, model.output)
signature = tf.saved_model.signature_def_utils.predict_signature_def(
inputs={'img_input': model.input[... | true | true |
f7f575a9dc57ea85a1fa0b1f4bc84d180b7b541d | 2,080 | py | Python | addons/mod_watch.py | xGhostBoyx/Kurisu | 4ce89e0914fdde113f5b5c749644af1e59c52193 | [
"Apache-2.0"
] | 3 | 2019-05-24T09:31:04.000Z | 2021-09-07T18:56:29.000Z | addons/mod_watch.py | xGhostBoyx/Kurisu | 4ce89e0914fdde113f5b5c749644af1e59c52193 | [
"Apache-2.0"
] | 1 | 2018-05-31T01:13:49.000Z | 2018-05-31T01:13:49.000Z | addons/mod_watch.py | T3CHNOLOG1C/Zoidbot | 0100816670ad988e51ffbce1d3c2725f8ed69439 | [
"Apache-2.0"
] | 1 | 2019-05-24T07:01:37.000Z | 2019-05-24T07:01:37.000Z | import discord
import json
from discord.ext import commands
from sys import argv
class Modwatch:
"""
User watch management commands.
"""
def __init__(self, bot):
self.bot = bot
print('Addon "{}" loaded'.format(self.__class__.__name__))
@commands.has_permissions(manage_nicknames=Tru... | 40.784314 | 149 | 0.638462 | import discord
import json
from discord.ext import commands
from sys import argv
class Modwatch:
def __init__(self, bot):
self.bot = bot
print('Addon "{}" loaded'.format(self.__class__.__name__))
@commands.has_permissions(manage_nicknames=True)
@commands.command(pass_context=True)
asyn... | true | true |
f7f57624632a6f3123b1d590975b1dd756279944 | 321 | py | Python | main.py | patrickstocklin/pychallongesearch | b3d523881a8485ab7af3ce5f0f785bb0de3277f0 | [
"MIT"
] | 3 | 2018-09-19T23:49:27.000Z | 2019-06-07T13:58:45.000Z | main.py | patrickstocklin/pychallongesearch | b3d523881a8485ab7af3ce5f0f785bb0de3277f0 | [
"MIT"
] | 1 | 2021-06-01T22:37:56.000Z | 2021-06-01T22:37:56.000Z | main.py | patrickstocklin/pychallongesearch | b3d523881a8485ab7af3ce5f0f785bb0de3277f0 | [
"MIT"
] | 1 | 2019-04-24T10:38:06.000Z | 2019-04-24T10:38:06.000Z | # -*- coding: utf-8 -*-
from pychallongesearch import pychallongesearch as pcs
'''
CONSTANTS
'''
def main():
print "Starting Main"
pcsearch = pcs.PyChallongeSearch("127.0.0.1","9200")
pcsearch.brackets.ingest_bracket();
# pcsearch.stats.test() //analysis
print "Done"
if __name__ == '__main__':
main(... | 17.833333 | 54 | 0.672897 |
from pychallongesearch import pychallongesearch as pcs
'''
CONSTANTS
'''
def main():
print "Starting Main"
pcsearch = pcs.PyChallongeSearch("127.0.0.1","9200")
pcsearch.brackets.ingest_bracket();
print "Done"
if __name__ == '__main__':
main() | false | true |
f7f576b68002f19e0d3f32fe10ae94dfbdd87326 | 514 | py | Python | examples/00_howdoi/static.py | Kitware/trame | 41c4d62e7a6f5dba41fd9305b314c87fa8ed7b6f | [
"Apache-2.0"
] | 42 | 2021-09-24T22:10:32.000Z | 2022-03-30T19:39:25.000Z | examples/00_howdoi/static.py | Kitware/trame | 41c4d62e7a6f5dba41fd9305b314c87fa8ed7b6f | [
"Apache-2.0"
] | 31 | 2021-10-01T21:19:56.000Z | 2022-03-04T00:14:28.000Z | examples/00_howdoi/static.py | Kitware/trame | 41c4d62e7a6f5dba41fd9305b314c87fa8ed7b6f | [
"Apache-2.0"
] | 7 | 2021-11-17T16:12:06.000Z | 2022-03-26T21:08:40.000Z | r"""
Version for trame 1.x - https://github.com/Kitware/trame/blob/release-v1/examples/howdoi/static.py
Delta v1..v2 - https://github.com/Kitware/trame/commit/25ce0c5b46f1f5ae1f0838fe2a539e0b8b0d7f5e
"""
from trame.app import get_server
from trame.ui.vuetify import VAppLayout
server = get_server()
html = ""... | 21.416667 | 104 | 0.700389 |
from trame.app import get_server
from trame.ui.vuetify import VAppLayout
server = get_server()
html = """
<h3>Welcome to trame...</h3>
<div>
<i>Hello</i> <b>World</b>
</div>
"""
with VAppLayout(server) as layout:
layout.root.add_child(html)
if __name__ == "__main__":
server.start()
| true | true |
f7f578479b3ba0e098c67c2d23574c822a4d1645 | 10,328 | py | Python | python/GafferTest/StandardSetTest.py | pier-robot/gaffer | 9267f2ba3822b14430d8a283c745261110b0f570 | [
"BSD-3-Clause"
] | null | null | null | python/GafferTest/StandardSetTest.py | pier-robot/gaffer | 9267f2ba3822b14430d8a283c745261110b0f570 | [
"BSD-3-Clause"
] | null | null | null | python/GafferTest/StandardSetTest.py | pier-robot/gaffer | 9267f2ba3822b14430d8a283c745261110b0f570 | [
"BSD-3-Clause"
] | null | null | null | ##########################################################################
#
# Copyright (c) 2011, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... | 24.018605 | 77 | 0.631487 | ) )
self.assertEqual( len( s ), len( all ) )
for e in all :
self.assertTrue( e in s )
self.assertEqual( s.remove( evens ), len( evens ) )
self.assertEqual( len( s ), len( odds ) )
for e in odds :
self.assertTrue( e in s )
def testSlicing( self ) :
l = [ IECore.IntData( i ) for i in range( 0, 10 )... | true | true |
f7f578684babacac24d27a28f613944927ffee1c | 6,148 | py | Python | contextlab/utils/layer_misc.py | SHTUPLUS/ContextLab | 4e12f0af9d0640f29c763b915f02de763b577200 | [
"MIT"
] | 41 | 2019-09-28T08:12:34.000Z | 2021-03-17T02:52:17.000Z | contextlab/utils/layer_misc.py | SHTUPLUS/ContextLab | 4e12f0af9d0640f29c763b915f02de763b577200 | [
"MIT"
] | null | null | null | contextlab/utils/layer_misc.py | SHTUPLUS/ContextLab | 4e12f0af9d0640f29c763b915f02de763b577200 | [
"MIT"
] | 4 | 2019-12-24T08:59:35.000Z | 2022-02-26T14:39:23.000Z | import torch
from torch import nn
import torch.nn.functional as F
__all__ = ['ConvBNReLU']
class ConvBNReLU(nn.Module):
def __init__(self,
in_channels,
out_channels,
kernel_size,
norm_layer=nn.BatchNorm2d,
with_relu=True,
... | 33.053763 | 73 | 0.508133 | import torch
from torch import nn
import torch.nn.functional as F
__all__ = ['ConvBNReLU']
class ConvBNReLU(nn.Module):
def __init__(self,
in_channels,
out_channels,
kernel_size,
norm_layer=nn.BatchNorm2d,
with_relu=True,
... | true | true |
f7f5793ab6dd3269a5cdd6a91d20c88c3b1e74e8 | 345 | py | Python | django-channles-tutorial/chat/routing.py | masa1203/django_mypractice | c3ffef6f19a4dd16e2947f36c88f1f5773b427ce | [
"MIT"
] | null | null | null | django-channles-tutorial/chat/routing.py | masa1203/django_mypractice | c3ffef6f19a4dd16e2947f36c88f1f5773b427ce | [
"MIT"
] | 26 | 2019-12-25T19:26:23.000Z | 2021-09-22T19:11:28.000Z | django-channles-tutorial/chat/routing.py | sawady1203/django_mypractice | c3ffef6f19a4dd16e2947f36c88f1f5773b427ce | [
"MIT"
] | 1 | 2021-06-10T05:14:02.000Z | 2021-06-10T05:14:02.000Z | # chat\routing.py
from django.urls import re_path
from . import consumers
websocket_urlpatterns = [
re_path(r'ws/chat/(?P<room_name>\w+)/$', consumers.ChatConsumer)
]
# ここでre_pathを使う理由がよくわからない
# (Note we use re_path() due to limitations in URLRouter.)
# https://channels.readthedocs.io/en/latest/topics... | 26.538462 | 74 | 0.730435 |
from django.urls import re_path
from . import consumers
websocket_urlpatterns = [
re_path(r'ws/chat/(?P<room_name>\w+)/$', consumers.ChatConsumer)
]
| true | true |
f7f579e6488daea2866663f03c95cc4c106a392d | 5,466 | py | Python | tests/test_serialization.py | jaykang920/x2py | b8bd473f94ff4b9576e984cc384f4159ab71278d | [
"MIT"
] | null | null | null | tests/test_serialization.py | jaykang920/x2py | b8bd473f94ff4b9576e984cc384f4159ab71278d | [
"MIT"
] | 1 | 2019-06-05T09:35:09.000Z | 2020-07-02T09:46:46.000Z | tests/test_serialization.py | jaykang920/x2py | b8bd473f94ff4b9576e984cc384f4159ab71278d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (c) 2017, 2018 Jae-jun Kang
# See the file LICENSE for details.
import datetime
import sys
import pytest
sys.path.append('..')
import x2py
from x2py.deserializer import Deserializer
from x2py.serializer import Serializer
from test import *
def test_byte():
buffer = bytearr... | 26.028571 | 97 | 0.629162 |
import datetime
import sys
import pytest
sys.path.append('..')
import x2py
from x2py.deserializer import Deserializer
from x2py.serializer import Serializer
from test import *
def test_byte():
buffer = bytearray()
s = Serializer(buffer)
d = Deserializer(buffer)
for test_value in [0, 1, 0x07f, ... | true | true |
f7f57abc2a3d0ab45a5d8414a116e8a23bbed7e7 | 5,944 | py | Python | flask_web_application/Complete_Python3_app/Adafruit_Python_DHT/Adafruit_DHT/Beaglebone_Black.py | NguyenDangLamPhuong/face_recognization | 55c2537c6352eea44b5f8442a50ceb6d873bca62 | [
"MIT"
] | null | null | null | flask_web_application/Complete_Python3_app/Adafruit_Python_DHT/Adafruit_DHT/Beaglebone_Black.py | NguyenDangLamPhuong/face_recognization | 55c2537c6352eea44b5f8442a50ceb6d873bca62 | [
"MIT"
] | null | null | null | flask_web_application/Complete_Python3_app/Adafruit_Python_DHT/Adafruit_DHT/Beaglebone_Black.py | NguyenDangLamPhuong/face_recognization | 55c2537c6352eea44b5f8442a50ceb6d873bca62 | [
"MIT"
] | null | null | null | # Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# 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, mo... | 27.266055 | 95 | 0.495121 |
import re
from . import common
from . import Beaglebone_Black_Driver as driver
pin_to_gpio = {
"P9_11": (0, 30),
"P9_12": (1, 28),
"P9_13": (0, 31),
"P9_14": (1, 18),
"P9_15": (1, 16),
"P9_16": (1, 19),
"P9_17": (0, 5),
"P9_18": (0, 4),
"P9_19": (0, 13),
"... | true | true |
f7f57b4c32e312280ee8b38d7dfed7a7d52abfab | 4,903 | py | Python | 101-sutter-county/final-results/parse_sutter.py | worace/california-2016-election-precinct-maps | 39e9a6e797aca1b5b5f5129294807dfadb5a795d | [
"MIT"
] | 82 | 2016-12-30T02:07:31.000Z | 2022-02-26T00:39:38.000Z | 101-sutter-county/final-results/parse_sutter.py | worace/california-2016-election-precinct-maps | 39e9a6e797aca1b5b5f5129294807dfadb5a795d | [
"MIT"
] | 3 | 2017-01-16T19:12:31.000Z | 2017-04-03T03:07:29.000Z | 101-sutter-county/final-results/parse_sutter.py | worace/california-2016-election-precinct-maps | 39e9a6e797aca1b5b5f5129294807dfadb5a795d | [
"MIT"
] | 29 | 2017-01-02T08:45:30.000Z | 2021-11-17T15:19:31.000Z | import sys
import os
import re
import csv
import pandas as pd
import numpy as np
from subprocess import call
fips = '101'
call(['pdftotext','-layout',sys.argv[1]])
pages = []
currentPage = ''
pageNo = 0
if not os.path.exists('results/'):
os.makedirs('results/')
with open(sys.argv[1].replace('pdf','txt')) as file:... | 61.2875 | 212 | 0.674485 | import sys
import os
import re
import csv
import pandas as pd
import numpy as np
from subprocess import call
fips = '101'
call(['pdftotext','-layout',sys.argv[1]])
pages = []
currentPage = ''
pageNo = 0
if not os.path.exists('results/'):
os.makedirs('results/')
with open(sys.argv[1].replace('pdf','txt')) as file:... | false | true |
f7f57b4cf9e07d363a5f52022fb6ab77136ae4e1 | 29,817 | py | Python | tests/git_cl_test.py | yetu/repotools | 1f52004a33ee27f539bb4c831b8e8a37751550a8 | [
"BSD-3-Clause"
] | null | null | null | tests/git_cl_test.py | yetu/repotools | 1f52004a33ee27f539bb4c831b8e8a37751550a8 | [
"BSD-3-Clause"
] | null | null | null | tests/git_cl_test.py | yetu/repotools | 1f52004a33ee27f539bb4c831b8e8a37751550a8 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for git_cl.py."""
import os
import StringIO
import stat
import sys
import unittest
import re
sys.path.insert(0, os.... | 34.193807 | 79 | 0.552504 |
import os
import StringIO
import stat
import sys
import unittest
import re
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from testing_support.auto_stub import TestCase
import git_cl
import git_common
import subprocess2
import presubmit_support
class PresubmitMock(object):
d... | true | true |
f7f57b728d4c43cf0efb7380942ba9d305ce6c06 | 495 | py | Python | exercicios/exercicio011.py | callebbs/curosemvideo-python | 63c2aac1f671973e92b753ec487e82c8871a3ded | [
"MIT"
] | null | null | null | exercicios/exercicio011.py | callebbs/curosemvideo-python | 63c2aac1f671973e92b753ec487e82c8871a3ded | [
"MIT"
] | null | null | null | exercicios/exercicio011.py | callebbs/curosemvideo-python | 63c2aac1f671973e92b753ec487e82c8871a3ded | [
"MIT"
] | null | null | null | '''
Faça um programa que leia a largura e a altura de uma parede em metros, calcule a sua área e a quantidade de tinta necessária para pintá-la, sabendo que cada litro de tinta pinta uma área de 2m².
'''
largura = float(input("Digite a largura da parede em metros: "))
altura = float(input("Digite a altura da parede em... | 41.25 | 195 | 0.713131 |
largura = float(input("Digite a largura da parede em metros: "))
altura = float(input("Digite a altura da parede em metros: "))
area = largura * altura
tinta = area / 2
print('A área da parede de {}x{} é de {}. Logo é necessário {} litros de tinta.'.format(largura, altura, area, tinta)) | true | true |
f7f57c2dd18df37cd6f56735ad2e04968110d998 | 11,220 | py | Python | models/base_model.py | herobd/GAN_aug | b240da32d4f3ae9a00a9d395ac8f29728623f6b4 | [
"BSD-3-Clause"
] | null | null | null | models/base_model.py | herobd/GAN_aug | b240da32d4f3ae9a00a9d395ac8f29728623f6b4 | [
"BSD-3-Clause"
] | null | null | null | models/base_model.py | herobd/GAN_aug | b240da32d4f3ae9a00a9d395ac8f29728623f6b4 | [
"BSD-3-Clause"
] | null | null | null | import os
import torch
from collections import OrderedDict
from abc import ABC, abstractmethod
from . import networks
class BaseModel(ABC):
"""This class is an abstract base class (ABC) for models.
To create a subclass, you need to implement the following five functions:
-- <__init__>: ... | 44.347826 | 260 | 0.602496 | import os
import torch
from collections import OrderedDict
from abc import ABC, abstractmethod
from . import networks
class BaseModel(ABC):
def __init__(self, opt):
self.opt = opt
self.gpu_ids = opt.gpu_ids
self.isTrain = opt.isTrain
self.device = torch.device('cuda:{}'.format(sel... | true | true |
f7f57c4ab5df4e6c887af8e236c4f9d839e0bf42 | 4,532 | py | Python | src/m2_functions.py | archulca/02-ObjectsFunctionsAndMethods | c14e2558f61b1edf257460f4362311f977fe9a38 | [
"MIT"
] | null | null | null | src/m2_functions.py | archulca/02-ObjectsFunctionsAndMethods | c14e2558f61b1edf257460f4362311f977fe9a38 | [
"MIT"
] | null | null | null | src/m2_functions.py | archulca/02-ObjectsFunctionsAndMethods | c14e2558f61b1edf257460f4362311f977fe9a38 | [
"MIT"
] | null | null | null | """
Practice DEFINING and CALLING
FUNCTIONS
Authors: David Mutchler, Vibha Alangar, Matt Boutell, Dave Fisher,
Aaron Wilkin, their colleagues, and Carla Archuleta.
""" # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE.
###############################################################################
# DONE: 2.
... | 35.40625 | 79 | 0.553398 | true | true | |
f7f57d00224792a4f3f8c2d4ac015d89da307f56 | 38 | py | Python | atom_babies/set_orientation_upside_down.py | 3110/atom-babies | 4cd326308ec407df0b23b5833213bea43d598934 | [
"MIT"
] | 2 | 2022-02-09T02:02:31.000Z | 2022-03-20T09:18:06.000Z | atom_babies/set_orientation_upside_down.py | 3110/atom-babies | 4cd326308ec407df0b23b5833213bea43d598934 | [
"MIT"
] | null | null | null | atom_babies/set_orientation_upside_down.py | 3110/atom-babies | 4cd326308ec407df0b23b5833213bea43d598934 | [
"MIT"
] | null | null | null | _ab_set_orientation('ORI_UPSIDE_DOWN') | 38 | 38 | 0.894737 | _ab_set_orientation('ORI_UPSIDE_DOWN') | true | true |
f7f57dc0f8eda2451475c2281b00aa262d0eaddb | 1,658 | py | Python | wagtail/admin/tests/test_jinja2.py | stevedya/wagtail | 52e5abfe62547cdfd90ea7dfeb8bf5a52f16324c | [
"BSD-3-Clause"
] | 1 | 2022-02-09T05:25:30.000Z | 2022-02-09T05:25:30.000Z | wagtail/admin/tests/test_jinja2.py | stevedya/wagtail | 52e5abfe62547cdfd90ea7dfeb8bf5a52f16324c | [
"BSD-3-Clause"
] | null | null | null | wagtail/admin/tests/test_jinja2.py | stevedya/wagtail | 52e5abfe62547cdfd90ea7dfeb8bf5a52f16324c | [
"BSD-3-Clause"
] | null | null | null | from django.contrib.auth.models import AnonymousUser
from django.http import HttpRequest
from django.template import engines
from django.test import TestCase
from wagtail.models import PAGE_TEMPLATE_VAR, Page, Site
from wagtail.test.utils import WagtailTestUtils
class TestCoreJinja(TestCase, WagtailTestUtils):
d... | 31.283019 | 80 | 0.630277 | from django.contrib.auth.models import AnonymousUser
from django.http import HttpRequest
from django.template import engines
from django.test import TestCase
from wagtail.models import PAGE_TEMPLATE_VAR, Page, Site
from wagtail.test.utils import WagtailTestUtils
class TestCoreJinja(TestCase, WagtailTestUtils):
d... | true | true |
f7f57e45f77bb0814cd3ee2ef6492a0c115ad7a6 | 3,020 | py | Python | axopy/pipeline/sources.py | jdekarske/axopy | a60abb44a12c5e833b9033170825773bb0691394 | [
"MIT"
] | 13 | 2019-01-23T13:00:00.000Z | 2022-01-17T14:45:32.000Z | axopy/pipeline/sources.py | jdekarske/axopy | a60abb44a12c5e833b9033170825773bb0691394 | [
"MIT"
] | 45 | 2017-01-16T22:44:59.000Z | 2018-12-18T18:43:08.000Z | axopy/pipeline/sources.py | jdekarske/axopy | a60abb44a12c5e833b9033170825773bb0691394 | [
"MIT"
] | 5 | 2017-01-13T00:14:08.000Z | 2018-11-08T13:16:24.000Z | """Data streams for processing with a pipeline."""
import warnings
import numpy as np
def segment(data, length, overlap=0):
"""Generate segments of an array.
Each segment is of a specified length and optional overlap with the
previous segment. Only segments of the specified length are retrieved (if
... | 27.207207 | 78 | 0.57649 |
import warnings
import numpy as np
def segment(data, length, overlap=0):
data = np.atleast_2d(data)
n = data.shape[1]
for f, t in segment_indices(n, length, overlap=overlap):
yield data[:, f:t]
def segment_indices(n, length, overlap=0):
skip = length - overlap
if (n - length) % skip !=... | true | true |
f7f57f8ae16fcbcdde095c7223d6c9f1f054ceb4 | 4,456 | py | Python | donkeycar/parts/transform.py | swapdha/donkey | 6f9db7bbd50db48222ff1ecdf61fb00456ef5e79 | [
"MIT"
] | 1 | 2019-02-05T08:38:06.000Z | 2019-02-05T08:38:06.000Z | donkeycar/parts/transform.py | swapdha/donkey | 6f9db7bbd50db48222ff1ecdf61fb00456ef5e79 | [
"MIT"
] | null | null | null | donkeycar/parts/transform.py | swapdha/donkey | 6f9db7bbd50db48222ff1ecdf61fb00456ef5e79 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import time
class Lambda:
"""
Wraps a function into a donkey part.
"""
def __init__(self, f):
"""
Accepts the function to use.
"""
self.f = f
def run(self, *args, **kwargs):
return self.f(*args, **kwargs)
def shutdow... | 29.124183 | 98 | 0.549596 |
import time
class Lambda:
def __init__(self, f):
self.f = f
def run(self, *args, **kwargs):
return self.f(*args, **kwargs)
def shutdown(self):
return
class PIDController:
def __init__(self, p=0, i=0, d=0, debug=False):
self.Kp = p
s... | true | true |
f7f57fd9406fda4ec772a4a95816b704f1fd60ba | 5,968 | py | Python | renderer/renderer.py | h3nnn4n/colosseum_renderer | e8fb2e94ca333b4465b2cb4283822338f07d69ff | [
"MIT"
] | null | null | null | renderer/renderer.py | h3nnn4n/colosseum_renderer | e8fb2e94ca333b4465b2cb4283822338f07d69ff | [
"MIT"
] | null | null | null | renderer/renderer.py | h3nnn4n/colosseum_renderer | e8fb2e94ca333b4465b2cb4283822338f07d69ff | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import itertools
import sys
from time import sleep, time
import numpy as np
import pygame
from pygame.colordict import THECOLORS as colors
def load_image(name):
image = pygame.image.load(name).convert_alpha()
return image
def get_food_sprite():
image = load_image("./renderer/spr... | 31.246073 | 81 | 0.553284 |
import itertools
import sys
from time import sleep, time
import numpy as np
import pygame
from pygame.colordict import THECOLORS as colors
def load_image(name):
image = pygame.image.load(name).convert_alpha()
return image
def get_food_sprite():
image = load_image("./renderer/sprites/food.png")
im... | true | true |
f7f580a6f147126fac2e6cb06c27e2e83ea87609 | 2,949 | py | Python | numtotext/convert.py | poikNplop/pynumtotext | 871a6049f150353bd301f027ac5d0d78f1a4fbe6 | [
"MIT"
] | null | null | null | numtotext/convert.py | poikNplop/pynumtotext | 871a6049f150353bd301f027ac5d0d78f1a4fbe6 | [
"MIT"
] | null | null | null | numtotext/convert.py | poikNplop/pynumtotext | 871a6049f150353bd301f027ac5d0d78f1a4fbe6 | [
"MIT"
] | null | null | null | from math import log10
from typing import Type
from .languages.base import NumbersBase
from .languages.en import Numbers_EN
def int_to_words(n: int, numbers: Type[NumbersBase] = Numbers_EN) -> str:
n = int(n)
if n == 0:
# ZERO is special case
return numbers.ZERO
elif n < 0:
# prefi... | 31.042105 | 98 | 0.557816 | from math import log10
from typing import Type
from .languages.base import NumbersBase
from .languages.en import Numbers_EN
def int_to_words(n: int, numbers: Type[NumbersBase] = Numbers_EN) -> str:
n = int(n)
if n == 0:
return numbers.ZERO
elif n < 0:
text = [numbers.NEGA... | true | true |
f7f58157a4ea7cc06f543dcf34904436c17df17f | 824 | py | Python | virtual/lib/python3.8/site-packages/werkzeug/wrappers/auth.py | Esther-Anyona/mylearner | d49d1c4c8dbeb93cc384f2037c48236be5dc89e1 | [
"MIT"
] | 20 | 2022-01-20T15:26:57.000Z | 2022-02-10T21:55:03.000Z | virtual/lib/python3.8/site-packages/werkzeug/wrappers/auth.py | Esther-Anyona/mylearner | d49d1c4c8dbeb93cc384f2037c48236be5dc89e1 | [
"MIT"
] | 3 | 2022-03-18T06:16:45.000Z | 2022-03-23T14:26:58.000Z | virtual/lib/python3.8/site-packages/werkzeug/wrappers/auth.py | Esther-Anyona/mylearner | d49d1c4c8dbeb93cc384f2037c48236be5dc89e1 | [
"MIT"
] | 11 | 2022-01-20T20:33:55.000Z | 2022-02-16T02:00:51.000Z | import typing as t
import warnings
class AuthorizationMixin:
def __init__(self, *args: t.Any, **kwargs: t.Any) -> None:
warnings.warn(
"'AuthorizationMixin' is deprecated and will be removed in"
" Werkzeug 2.1. 'Request' now includes the functionality"
" directly.",
... | 30.518519 | 71 | 0.584951 | import typing as t
import warnings
class AuthorizationMixin:
def __init__(self, *args: t.Any, **kwargs: t.Any) -> None:
warnings.warn(
"'AuthorizationMixin' is deprecated and will be removed in"
" Werkzeug 2.1. 'Request' now includes the functionality"
" directly.",
... | true | true |
f7f582747464a2619533996ccfc6f93e75c468a4 | 407 | py | Python | client/lib/jtalk.py | jphacks/TK_1621 | 1de15ba79744087b13bfa400dc3d0eb3f90030a8 | [
"MIT"
] | 5 | 2016-10-28T14:11:06.000Z | 2021-01-22T01:07:47.000Z | client/lib/jtalk.py | jphacks/TK_1621 | 1de15ba79744087b13bfa400dc3d0eb3f90030a8 | [
"MIT"
] | null | null | null | client/lib/jtalk.py | jphacks/TK_1621 | 1de15ba79744087b13bfa400dc3d0eb3f90030a8 | [
"MIT"
] | 3 | 2016-10-30T01:55:24.000Z | 2017-10-28T19:51:07.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# created by Keisuke Okumura
# == Kei18 PC ==
# sudo open_jtalk -x /usr/local/Cellar/open-jtalk/1.09/dic
# -m /usr/local/Cellar/open-jtalk/1.09/voice/mei/mei_normal.htsvoice
# -ow out.wav sample.txt
#
# afplay out.wav
import subprocess
def speak(t):
script = '/hom... | 20.35 | 68 | 0.663391 |
import subprocess
def speak(t):
script = '/home/pi/Desktop/client/lib/jtalk.sh'
cmd = ['sh', script, t]
subprocess.call(cmd)
| true | true |
f7f582a430dcae315464eccc27574a1e8df88cc6 | 6,111 | py | Python | refnx/analysis/test/test_globalfitting.py | dcortie/refnx | 037434fa0a64755f72c540d75063986bd517ab10 | [
"BSD-3-Clause"
] | 32 | 2016-04-18T15:29:59.000Z | 2022-03-27T08:35:29.000Z | refnx/analysis/test/test_globalfitting.py | dcortie/refnx | 037434fa0a64755f72c540d75063986bd517ab10 | [
"BSD-3-Clause"
] | 116 | 2015-10-27T04:33:09.000Z | 2022-02-22T02:02:47.000Z | refnx/analysis/test/test_globalfitting.py | dcortie/refnx | 037434fa0a64755f72c540d75063986bd517ab10 | [
"BSD-3-Clause"
] | 22 | 2015-09-29T23:21:15.000Z | 2022-02-27T18:12:18.000Z | """
Test co-refinement of datasets by fitting 3 neutron reflectivity datasets. The
overall construction of the models can be done in a few different ways.
"""
import os.path
import numpy as np
from numpy.testing import (
assert_,
assert_equal,
assert_almost_equal,
assert_allclose,
)
from refnx.analysi... | 36.375 | 78 | 0.620684 | import os.path
import numpy as np
from numpy.testing import (
assert_,
assert_equal,
assert_almost_equal,
assert_allclose,
)
from refnx.analysis import CurveFitter, Objective, GlobalObjective, Transform
from refnx.dataset import ReflectDataset
from refnx.reflect import Slab, SLD, ReflectModel
SEED = ... | true | true |
f7f582bfe75a807f37c6dc30c126ec9b5ae596ba | 122,034 | py | Python | tensorflow/python/keras/_impl/keras/backend.py | destenson/tensorflow--tensorflow | 7f84d88d39f236e5c0cea492a2248782e696c972 | [
"Apache-2.0"
] | null | null | null | tensorflow/python/keras/_impl/keras/backend.py | destenson/tensorflow--tensorflow | 7f84d88d39f236e5c0cea492a2248782e696c972 | [
"Apache-2.0"
] | null | null | null | tensorflow/python/keras/_impl/keras/backend.py | destenson/tensorflow--tensorflow | 7f84d88d39f236e5c0cea492a2248782e696c972 | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 28.781604 | 84 | 0.646623 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import json
import os
import numpy as np
from tensorflow.core.protobuf import config_pb2
from tensorflow.python.client import session as session_module
from tensorflow.pyth... | true | true |
f7f5832af9f1ee27321f865cb69e9f0c465c1b73 | 1,352 | py | Python | Python3/config.py | RealKevinApetrei/GUI-Hangman | d2fef126be60f012a455af3f69ab1a1f1f7004c6 | [
"MIT"
] | 1 | 2020-12-07T21:28:01.000Z | 2020-12-07T21:28:01.000Z | Python3/config.py | RealKevinApetrei/GUI-Hangman | d2fef126be60f012a455af3f69ab1a1f1f7004c6 | [
"MIT"
] | null | null | null | Python3/config.py | RealKevinApetrei/GUI-Hangman | d2fef126be60f012a455af3f69ab1a1f1f7004c6 | [
"MIT"
] | null | null | null | # DEVELOPER CONFIG (EDIT NOT RECOMMENDED)
BUILD_VERSION = "v1.13.23-public"
AUTHOR = "Kevin Apetrei"
PROGRAM_NAME = "GUI Hangman"
TOTAL_GUESSES_ALLOWED = 5
BLANK = "_____"
"""
CREDITS:
'back.png' Icon made by 'Kiranshastry' from www.flaticon.com (24px)
GUI HANGMAN
"""
"""
MIT License
Copyright (c) 2020 Kevin Ape... | 33.8 | 78 | 0.784024 |
BUILD_VERSION = "v1.13.23-public"
AUTHOR = "Kevin Apetrei"
PROGRAM_NAME = "GUI Hangman"
TOTAL_GUESSES_ALLOWED = 5
BLANK = "_____"
| true | true |
f7f583415c6f1c00760c8f767031302a8aeb35de | 500 | py | Python | data/scripts/templates/object/tangible/loot/collectible/collectible_parts/shared_blue_rug_thread_07.py | obi-two/GameServer | 7d37024e2291a97d49522610cd8f1dbe5666afc2 | [
"MIT"
] | 20 | 2015-02-23T15:11:56.000Z | 2022-03-18T20:56:48.000Z | data/scripts/templates/object/tangible/loot/collectible/collectible_parts/shared_blue_rug_thread_07.py | apathyboy/swganh | 665128efe9154611dec4cb5efc61d246dd095984 | [
"MIT"
] | null | null | null | data/scripts/templates/object/tangible/loot/collectible/collectible_parts/shared_blue_rug_thread_07.py | apathyboy/swganh | 665128efe9154611dec4cb5efc61d246dd095984 | [
"MIT"
] | 20 | 2015-04-04T16:35:59.000Z | 2022-03-24T14:54:37.000Z | #### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/loot/collectible/collectible_parts/shared_blue_rug_thread_07.iff"
r... | 29.411765 | 101 | 0.752 | true | true | |
f7f5838ae0f5ee4578be1ef08bf5040b2c666c8e | 5,656 | py | Python | tensormonk/architectures/trees.py | Tensor46/TensorMONK | 67617d3fdf8fde072ba9cab42de7d67c79b17494 | [
"MIT"
] | 29 | 2018-07-06T23:57:23.000Z | 2022-03-08T20:38:57.000Z | tensormonk/architectures/trees.py | Johnson-yue/TensorMONK | 1785132b82c685c3b3fc05b00dec46b1fccfc948 | [
"MIT"
] | 3 | 2018-12-14T22:21:26.000Z | 2020-06-19T02:13:34.000Z | tensormonk/architectures/trees.py | Johnson-yue/TensorMONK | 1785132b82c685c3b3fc05b00dec46b1fccfc948 | [
"MIT"
] | 8 | 2018-07-06T23:58:03.000Z | 2021-04-12T01:35:54.000Z | """ TensorMONK :: architectures """
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from ..layers import Linear
class NeuralTree(nn.Module):
r""" A neural tree for Neural Decision Forest!
Args:
tensor_size: shape of 2D/4D tensor
2D - (None/any intege... | 37.456954 | 77 | 0.571075 |
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from ..layers import Linear
class NeuralTree(nn.Module):
def __init__(self,
tensor_size: tuple,
n_labels: int,
depth: int,
dropout: float = 0.2,
... | true | true |
f7f5842133e855664724eb818f7cc747b9af23ec | 169 | py | Python | 03/src/prob/abc137_a.py | fumiyanll23/PythonLearning | 5d72af4c75ce5032eeef2212a8d1c74acbe2c711 | [
"MIT"
] | 1 | 2021-03-20T06:25:16.000Z | 2021-03-20T06:25:16.000Z | 03/src/prob/abc137_a.py | fumiyanll23/PythonLearning | 5d72af4c75ce5032eeef2212a8d1c74acbe2c711 | [
"MIT"
] | null | null | null | 03/src/prob/abc137_a.py | fumiyanll23/PythonLearning | 5d72af4c75ce5032eeef2212a8d1c74acbe2c711 | [
"MIT"
] | 1 | 2021-04-03T04:24:55.000Z | 2021-04-03T04:24:55.000Z | # ABC137A - +-x
def main():
# input
A, B = map(int, input().split())
# compute
"""WRITE BELOW"""
# output
if __name__ == '__main__':
main()
| 11.266667 | 36 | 0.491124 |
def main():
A, B = map(int, input().split())
if __name__ == '__main__':
main()
| true | true |
f7f58498b30fce896c5595a55802dcf62d967be5 | 10,979 | py | Python | test/functional/tests/cache_ops/test_multistream_seq_cutoff.py | andreatomassetti/open-cas-linux | 6a6a0267d76dca86de8695a959991ecefdc0ddf8 | [
"BSD-3-Clause"
] | 1 | 2022-01-23T23:50:23.000Z | 2022-01-23T23:50:23.000Z | test/functional/tests/cache_ops/test_multistream_seq_cutoff.py | andreatomassetti/open-cas-linux | 6a6a0267d76dca86de8695a959991ecefdc0ddf8 | [
"BSD-3-Clause"
] | 1 | 2022-03-21T22:05:26.000Z | 2022-03-21T22:05:26.000Z | test/functional/tests/cache_ops/test_multistream_seq_cutoff.py | andreatomassetti/open-cas-linux | 6a6a0267d76dca86de8695a959991ecefdc0ddf8 | [
"BSD-3-Clause"
] | null | null | null | #
# Copyright(c) 2020-2021 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
import os
import random
from time import sleep
import pytest
from api.cas import casadm
from api.cas.cache_config import CacheMode, SeqCutOffPolicy, CacheModeTrait
from core.test_run_utils import TestRun
from storage_devices.disk i... | 44.270161 | 100 | 0.676109 |
import os
import random
from time import sleep
import pytest
from api.cas import casadm
from api.cas.cache_config import CacheMode, SeqCutOffPolicy, CacheModeTrait
from core.test_run_utils import TestRun
from storage_devices.disk import DiskTypeSet, DiskTypeLowerThan, DiskType
from test_tools.dd import Dd
from te... | true | true |
f7f584d3d3cdb8b88ab3c13af892680fdaed39f5 | 63,165 | py | Python | numpy/core/fromnumeric.py | illume/numpy3k | 42171a679b0ef24932fe08fc88cce039abf6de2b | [
"BSD-3-Clause"
] | 2 | 2020-07-03T12:00:29.000Z | 2021-04-18T06:54:30.000Z | numpy/core/fromnumeric.py | illume/numpy3k | 42171a679b0ef24932fe08fc88cce039abf6de2b | [
"BSD-3-Clause"
] | null | null | null | numpy/core/fromnumeric.py | illume/numpy3k | 42171a679b0ef24932fe08fc88cce039abf6de2b | [
"BSD-3-Clause"
] | null | null | null | # Module containing non-deprecated functions borrowed from Numeric.
__docformat__ = "restructuredtext en"
# functions that are now methods
__all__ = ['take', 'reshape', 'choose', 'repeat', 'put',
'swapaxes', 'transpose', 'sort', 'argsort', 'argmax', 'argmin',
'searchsorted', 'alen',
'r... | 27.72827 | 79 | 0.580068 |
__docformat__ = "restructuredtext en"
__all__ = ['take', 'reshape', 'choose', 'repeat', 'put',
'swapaxes', 'transpose', 'sort', 'argsort', 'argmax', 'argmin',
'searchsorted', 'alen',
'resize', 'diagonal', 'trace', 'ravel', 'nonzero', 'shape',
'compress', 'clip', 'sum', 'pr... | true | true |
f7f586269f133a5ac939c850bf82dc77c738daf0 | 18,321 | py | Python | megatron/data/indexed_dataset.py | sourcery-ai-bot/Megatron-LM | f27f44e2c49d1cb39b2288bef6f7d837e11094cb | [
"MIT"
] | null | null | null | megatron/data/indexed_dataset.py | sourcery-ai-bot/Megatron-LM | f27f44e2c49d1cb39b2288bef6f7d837e11094cb | [
"MIT"
] | null | null | null | megatron/data/indexed_dataset.py | sourcery-ai-bot/Megatron-LM | f27f44e2c49d1cb39b2288bef6f7d837e11094cb | [
"MIT"
] | null | null | null | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# copied from fairseq/fairseq/data/indexed_dataset.py
# Removed IndexedRawTextDataset since it relied on Fairseq dictionary
# other slight mo... | 32.484043 | 105 | 0.582828 |
from functools import lru_cache
import os
import shutil
import struct
from itertools import accumulate
import numpy as np
import torch
from megatron import print_rank_0
def __best_fitting_dtype(vocab_size=None):
if vocab_size is not None and vocab_size < 65500:
return np.uint16
else:
... | true | true |
f7f5873669ac7813b11f6043827be50764aa2778 | 2,215 | py | Python | libs/jieba/cut_text.py | dnxbjyj/python-basic | 14cba06cd84715ebb8acc6dd3cef84789316d81e | [
"MIT"
] | 3 | 2018-03-19T07:57:10.000Z | 2021-07-05T08:55:14.000Z | libs/jieba/cut_text.py | dnxbjyj/python-basic | 14cba06cd84715ebb8acc6dd3cef84789316d81e | [
"MIT"
] | 6 | 2020-03-24T15:40:18.000Z | 2021-12-13T19:46:09.000Z | libs/jieba/cut_text.py | dnxbjyj/python-basic | 14cba06cd84715ebb8acc6dd3cef84789316d81e | [
"MIT"
] | 4 | 2018-03-29T21:59:55.000Z | 2019-12-16T14:56:38.000Z | # coding:utf-8
import jieba.posseg as psg
from collections import Counter
import sys
def cut_and_cache(text):
'''
对文本分词并标注词性,并缓存到文件
将文本分词,并附带上词性,因为数据量比较大,防止每次运行脚本都花大量时间,所以第一次分词后就将结果存入文件cut_result.txt中
相当于做一个缓存,格式为每个词占一行,每一行的内容为:
词,词性
:param text: 要进行分词的文本
:return: None
'''
... | 25.45977 | 106 | 0.578781 |
import jieba.posseg as psg
from collections import Counter
import sys
def cut_and_cache(text):
'''
对文本分词并标注词性,并缓存到文件
将文本分词,并附带上词性,因为数据量比较大,防止每次运行脚本都花大量时间,所以第一次分词后就将结果存入文件cut_result.txt中
相当于做一个缓存,格式为每个词占一行,每一行的内容为:
词,词性
:param text: 要进行分词的文本
:return: None
'''
words_with... | false | true |
f7f587622de60fe300b5b2617de3c56677e5e899 | 560 | py | Python | nemde/tests/test_io_casefile.py | akxen/nemde | 23afcdf128352f12d3074194a1321a8f810f4407 | [
"Apache-2.0"
] | null | null | null | nemde/tests/test_io_casefile.py | akxen/nemde | 23afcdf128352f12d3074194a1321a8f810f4407 | [
"Apache-2.0"
] | null | null | null | nemde/tests/test_io_casefile.py | akxen/nemde | 23afcdf128352f12d3074194a1321a8f810f4407 | [
"Apache-2.0"
] | 1 | 2022-01-16T01:48:54.000Z | 2022-01-16T01:48:54.000Z | """
Test loading of casefiles
"""
import os
import pytest
import context
from nemde.io.casefile import load_xml_from_archive
@pytest.mark.skip(reason='Not including casefile archive in container')
def test_load_casefile_from_database():
"""Load casefile from a database"""
year = int(os.environ['TEST_YEAR'... | 23.333333 | 79 | 0.694643 |
import os
import pytest
import context
from nemde.io.casefile import load_xml_from_archive
@pytest.mark.skip(reason='Not including casefile archive in container')
def test_load_casefile_from_database():
year = int(os.environ['TEST_YEAR'])
month = int(os.environ['TEST_MONTH'])
casefile = load_xml_from... | true | true |
f7f587ad39dc444cf6f490e5a93aee8bcd5f1ceb | 1,967 | py | Python | tests/test_model_form_field.py | mfogel/django-timezone-field | 66337bcea5f9eb66923e0c85239dc1a652c93472 | [
"BSD-2-Clause"
] | 263 | 2015-01-10T01:07:22.000Z | 2022-03-25T08:56:31.000Z | tests/test_model_form_field.py | mfogel/django-timezone-field | 66337bcea5f9eb66923e0c85239dc1a652c93472 | [
"BSD-2-Clause"
] | 67 | 2015-02-06T01:15:40.000Z | 2022-03-17T16:51:48.000Z | tests/test_model_form_field.py | mfogel/django-timezone-field | 66337bcea5f9eb66923e0c85239dc1a652c93472 | [
"BSD-2-Clause"
] | 74 | 2015-01-09T02:35:40.000Z | 2022-03-04T21:44:20.000Z | import pytest
@pytest.mark.django_db
def test_valid_with_defaults(Model, ModelForm, pst, pst_tz, gmt, gmt_tz):
# seems there should be a better way to get a form's default values...?
# http://stackoverflow.com/questions/7399490/
data = dict(
(field_name, field.initial)
for field_name, fiel... | 30.261538 | 84 | 0.663955 | import pytest
@pytest.mark.django_db
def test_valid_with_defaults(Model, ModelForm, pst, pst_tz, gmt, gmt_tz):
# http://stackoverflow.com/questions/7399490/
data = dict(
(field_name, field.initial)
for field_name, field in ModelForm().fields.items()
)
data.update({'tz': gmt})
... | true | true |
f7f58862b8bc91b085ff5d83efcab50cf1a57351 | 5,976 | py | Python | tests/test_grouping.py | NoraRo/trimesh | ac23bba6ef6de584f822dc00ac0e941e6065ae73 | [
"MIT"
] | null | null | null | tests/test_grouping.py | NoraRo/trimesh | ac23bba6ef6de584f822dc00ac0e941e6065ae73 | [
"MIT"
] | null | null | null | tests/test_grouping.py | NoraRo/trimesh | ac23bba6ef6de584f822dc00ac0e941e6065ae73 | [
"MIT"
] | 1 | 2019-05-31T03:37:21.000Z | 2019-05-31T03:37:21.000Z | try:
from . import generic as g
except BaseException:
import generic as g
class GroupTests(g.unittest.TestCase):
def test_unique_rows(self):
count = 10000
subset = int(count / 10)
# check unique_rows on float data
data = g.np.arange(count * 3).reshape((-1, 3)).astype(g.np... | 34.148571 | 85 | 0.547858 | try:
from . import generic as g
except BaseException:
import generic as g
class GroupTests(g.unittest.TestCase):
def test_unique_rows(self):
count = 10000
subset = int(count / 10)
data = g.np.arange(count * 3).reshape((-1, 3)).astype(g.np.float)
data[:subset] = d... | true | true |
f7f5886c92cc4500bda948ea7952ec1d46de279f | 961 | py | Python | Examples/Demos.py | SimpleITK/SimpleITK-MICCAI-2011-Tutorial | c8cffa8888fda71b9e4f2fdb3e10c2c66dba8371 | [
"CC-BY-3.0"
] | 25 | 2015-03-08T16:24:13.000Z | 2021-07-23T02:44:04.000Z | Examples/Demos.py | SimpleITK/SimpleITK-MICCAI-2011-Tutorial | c8cffa8888fda71b9e4f2fdb3e10c2c66dba8371 | [
"CC-BY-3.0"
] | null | null | null | Examples/Demos.py | SimpleITK/SimpleITK-MICCAI-2011-Tutorial | c8cffa8888fda71b9e4f2fdb3e10c2c66dba8371 | [
"CC-BY-3.0"
] | 4 | 2015-01-29T21:29:40.000Z | 2022-03-11T08:14:07.000Z | import IPython.lib.demo as ipd
# To use, run ipython, then
#
# In [1]: %run Demos.py
# In [2]: d = ImageDemo()
# In [3]: d()
# In [4]: d()
def ImageDemo ():
return ipd.ClearIPDemo ( 'BasicTutorial1/Image.py' )
def InputOutputDemo ():
return ipd.ClearIPDemo ( 'BasicTutorial1/InputOutput.py' )
def MemoryManag... | 25.972973 | 76 | 0.712799 | import IPython.lib.demo as ipd
def ImageDemo ():
return ipd.ClearIPDemo ( 'BasicTutorial1/Image.py' )
def InputOutputDemo ():
return ipd.ClearIPDemo ( 'BasicTutorial1/InputOutput.py' )
def MemoryManagementDemo ():
return ipd.ClearIPDemo ( 'BasicTutorial1/MemoryManagement.py' )
def FiltersDemo ():... | true | true |
f7f589ed57b8383158a5429826280a32ecb8c87c | 16,228 | py | Python | hou_parm.py | rbland/HouNodeLib | 50d7c36bddb58f2e2c6be1fa005973fba0b39084 | [
"Unlicense"
] | null | null | null | hou_parm.py | rbland/HouNodeLib | 50d7c36bddb58f2e2c6be1fa005973fba0b39084 | [
"Unlicense"
] | null | null | null | hou_parm.py | rbland/HouNodeLib | 50d7c36bddb58f2e2c6be1fa005973fba0b39084 | [
"Unlicense"
] | null | null | null | # The MetaHouParm and HouParm class..
import os
import re
import hou
class MetaHouParm(type):
"""
The MetaHouParm class is a metaclass that keeps track of which
classes support which parameter types.
"""
PARM_TYPE_TO_CLASS = dict()
def __new__(cls, class_name, bases, class_d... | 35.35512 | 85 | 0.584607 |
import os
import re
import hou
class MetaHouParm(type):
"""
The MetaHouParm class is a metaclass that keeps track of which
classes support which parameter types.
"""
PARM_TYPE_TO_CLASS = dict()
def __new__(cls, class_name, bases, class_dict):
"""
Called whe... | false | true |
f7f58a9be17de85b79d5dbeed2f7997e9169472e | 1,060 | py | Python | extraPackages/matplotlib-3.0.3/examples/pie_and_polar_charts/polar_legend.py | dolboBobo/python3_ios | 877f8c2c5890f26292ddd14909bea62a04fe2889 | [
"BSD-3-Clause"
] | 130 | 2018-02-03T10:25:54.000Z | 2022-03-25T22:27:22.000Z | extraPackages/matplotlib-3.0.2/examples/pie_and_polar_charts/polar_legend.py | spacetime314/python3_ios | e149f1bc2e50046c8810f83dae7739a8dea939ee | [
"BSD-3-Clause"
] | 9 | 2018-12-14T07:31:42.000Z | 2020-12-09T20:29:28.000Z | extraPackages/matplotlib-3.0.2/examples/pie_and_polar_charts/polar_legend.py | spacetime314/python3_ios | e149f1bc2e50046c8810f83dae7739a8dea939ee | [
"BSD-3-Clause"
] | 64 | 2018-04-25T08:51:57.000Z | 2022-01-29T14:13:57.000Z | """
============
Polar Legend
============
Demo of a legend on a polar-axis plot.
"""
import matplotlib.pyplot as plt
import numpy as np
# radar green, solid grid lines
plt.rc('grid', color='#316931', linewidth=1, linestyle='-')
plt.rc('xtick', labelsize=15)
plt.rc('ytick', labelsize=15)
# force square figure and s... | 23.555556 | 77 | 0.601887 |
import matplotlib.pyplot as plt
import numpy as np
plt.rc('grid', color='#316931', linewidth=1, linestyle='-')
plt.rc('xtick', labelsize=15)
plt.rc('ytick', labelsize=15)
fig = plt.figure(figsize=(8, 8))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8],
projection='polar', facecolor='#d5de9c')
r = np.aran... | true | true |
f7f58b45440a505c55f2ede98b7a12a7c8c062c0 | 30,778 | py | Python | plugin/documents.py | mitranim/LSP | 3d4aebe1959b308a97e8464e7d278e067dffd545 | [
"MIT"
] | null | null | null | plugin/documents.py | mitranim/LSP | 3d4aebe1959b308a97e8464e7d278e067dffd545 | [
"MIT"
] | null | null | null | plugin/documents.py | mitranim/LSP | 3d4aebe1959b308a97e8464e7d278e067dffd545 | [
"MIT"
] | null | null | null | from .code_actions import actions_manager
from .code_actions import CodeActionsByConfigName
from .completion import LspResolveDocsCommand
from .completion import resolve
from .core.css import css
from .core.logging import debug
from .core.protocol import Diagnostic
from .core.protocol import DocumentHighlightKind
from ... | 45.195301 | 120 | 0.637371 | from .code_actions import actions_manager
from .code_actions import CodeActionsByConfigName
from .completion import LspResolveDocsCommand
from .completion import resolve
from .core.css import css
from .core.logging import debug
from .core.protocol import Diagnostic
from .core.protocol import DocumentHighlightKind
from ... | true | true |
f7f58b922259909efa6f4df3c512c9c669ab78e9 | 2,442 | py | Python | pybrain/structure/networks/rbm.py | sveilleux1/pybrain | 1e1de73142c290edb84e29ca7850835f3e7bca8b | [
"BSD-3-Clause"
] | 2,208 | 2015-01-02T02:14:41.000Z | 2022-03-31T04:45:46.000Z | pybrain/structure/networks/rbm.py | sveilleux1/pybrain | 1e1de73142c290edb84e29ca7850835f3e7bca8b | [
"BSD-3-Clause"
] | 91 | 2015-01-08T16:42:16.000Z | 2021-12-11T19:16:35.000Z | pybrain/structure/networks/rbm.py | sveilleux1/pybrain | 1e1de73142c290edb84e29ca7850835f3e7bca8b | [
"BSD-3-Clause"
] | 786 | 2015-01-02T15:18:20.000Z | 2022-02-23T23:42:40.000Z | # -*- coding: utf-8 -*-
__author__ = 'Justin S Bayer, bayer.justin@googlemail.com'
__version__ = '$Id$'
from pybrain.structure import (LinearLayer, SigmoidLayer, FullConnection,
BiasUnit, FeedForwardNetwork)
class Rbm(object):
"""Class that holds a network and offers some shortcu... | 29.780488 | 81 | 0.613841 |
__author__ = 'Justin S Bayer, bayer.justin@googlemail.com'
__version__ = '$Id$'
from pybrain.structure import (LinearLayer, SigmoidLayer, FullConnection,
BiasUnit, FeedForwardNetwork)
class Rbm(object):
@property
def params(self):
return self.con.params
pass... | true | true |
f7f58bc625e88884f49f3c299371408da0cfb542 | 5,174 | py | Python | upydev/commandlib.py | Carglglz/upydev | 6f852e145be63705c9c8306931ffc2adac5cec12 | [
"MIT"
] | 36 | 2019-08-14T15:59:44.000Z | 2022-01-17T17:33:47.000Z | upydev/commandlib.py | Carglglz/upydev | 6f852e145be63705c9c8306931ffc2adac5cec12 | [
"MIT"
] | 21 | 2019-08-15T06:11:38.000Z | 2021-01-30T22:05:24.000Z | upydev/commandlib.py | Carglglz/upydev | 6f852e145be63705c9c8306931ffc2adac5cec12 | [
"MIT"
] | 3 | 2020-05-01T22:32:34.000Z | 2021-01-30T20:16:19.000Z | UID = "from machine import unique_id;\
from ubinascii import hexlify;hexlify(unique_id());gc.collect()"
UPYSH = "from upysh import *;gc.collect()"
HELP = "help();gc.collect()"
MODULES = "help('modules');gc.collect()"
MEM = "from micropython import mem_info;mem_info();gc.collect()"
OS_STAT = "import os;os.stat('{}'... | 40.740157 | 138 | 0.65056 | UID = "from machine import unique_id;\
from ubinascii import hexlify;hexlify(unique_id());gc.collect()"
UPYSH = "from upysh import *;gc.collect()"
HELP = "help();gc.collect()"
MODULES = "help('modules');gc.collect()"
MEM = "from micropython import mem_info;mem_info();gc.collect()"
OS_STAT = "import os;os.stat('{}'... | true | true |
f7f58c05da9f21eb33d4f2039e6f14989f11ab40 | 268 | py | Python | faq/models.py | VenkataRavitejaGullapudi/StudentAnalysisSystem | 8ae853e620f84906a89e8db4b45300b73665a1b3 | [
"CC-BY-3.0"
] | null | null | null | faq/models.py | VenkataRavitejaGullapudi/StudentAnalysisSystem | 8ae853e620f84906a89e8db4b45300b73665a1b3 | [
"CC-BY-3.0"
] | null | null | null | faq/models.py | VenkataRavitejaGullapudi/StudentAnalysisSystem | 8ae853e620f84906a89e8db4b45300b73665a1b3 | [
"CC-BY-3.0"
] | null | null | null | from django.db import models
# Create your models here.
class Faqs(models.Model):
email=models.EmailField()
query=models.CharField(max_length=1000)
answer=models.CharField(max_length=1000,default=" none ")
def __str__(self):
return self.query
| 26.8 | 61 | 0.723881 | from django.db import models
class Faqs(models.Model):
email=models.EmailField()
query=models.CharField(max_length=1000)
answer=models.CharField(max_length=1000,default=" none ")
def __str__(self):
return self.query
| true | true |
f7f58c41a053fb20180cc4661a0af635c7527fcc | 4,414 | py | Python | resqs/sts/models.py | UMass-Rescue/moto | 3aa52aca28c622be9708da5fd31a8c8b92801634 | [
"Apache-2.0"
] | null | null | null | resqs/sts/models.py | UMass-Rescue/moto | 3aa52aca28c622be9708da5fd31a8c8b92801634 | [
"Apache-2.0"
] | null | null | null | resqs/sts/models.py | UMass-Rescue/moto | 3aa52aca28c622be9708da5fd31a8c8b92801634 | [
"Apache-2.0"
] | null | null | null | from __future__ import unicode_literals
from base64 import b64decode
import datetime
import xmltodict
from resqs.core import BaseBackend, BaseModel
from resqs.core.utils import iso_8601_datetime_with_milliseconds
from resqs.core import ACCOUNT_ID
from resqs.sts.utils import (
random_access_key_id,
random_secret... | 33.439394 | 103 | 0.656094 | from __future__ import unicode_literals
from base64 import b64decode
import datetime
import xmltodict
from resqs.core import BaseBackend, BaseModel
from resqs.core.utils import iso_8601_datetime_with_milliseconds
from resqs.core import ACCOUNT_ID
from resqs.sts.utils import (
random_access_key_id,
random_secret... | true | true |
f7f58c9bb4ac82658d6bd77c7a33a909b3368cd0 | 10,779 | py | Python | doc/large-def/update_formula.py | ajey091/neml | 23dd2cdb83057fdd17a37fa19f4592c54f821dbf | [
"MIT"
] | 6 | 2020-05-06T17:04:29.000Z | 2021-08-03T20:02:22.000Z | doc/large-def/update_formula.py | ajey091/neml | 23dd2cdb83057fdd17a37fa19f4592c54f821dbf | [
"MIT"
] | 66 | 2018-10-26T01:32:43.000Z | 2022-02-01T03:02:18.000Z | doc/large-def/update_formula.py | ajey091/neml | 23dd2cdb83057fdd17a37fa19f4592c54f821dbf | [
"MIT"
] | 14 | 2018-11-28T17:07:24.000Z | 2022-01-06T16:57:15.000Z | #!/usr/bin/env python
from __future__ import division
import numpy as np
import copy
import itertools
from sympy import *
mandel = ((0,0),(1,1),(2,2),(1,2),(0,2),(0,1))
mandel_mults = (1,1,1,sqrt(2),sqrt(2),sqrt(2))
skew_inds = ((1,2),(0,2),(0,1))
skew_mults = (-1,1,-1)
def object_einsum(string, *arrays):
"""Si... | 27.288608 | 168 | 0.557287 |
from __future__ import division
import numpy as np
import copy
import itertools
from sympy import *
mandel = ((0,0),(1,1),(2,2),(1,2),(0,2),(0,1))
mandel_mults = (1,1,1,sqrt(2),sqrt(2),sqrt(2))
skew_inds = ((1,2),(0,2),(0,1))
skew_mults = (-1,1,-1)
def object_einsum(string, *arrays):
try:
return np.einsum(... | true | true |
f7f58d3f28889bcfd896a6890a818feedfcd250c | 11,653 | py | Python | detectron2/evaluation/panoptic_evaluation.py | mvdelt/detectron2 | c320a6f0e6facb9c5d6dda8263c8e76834c04246 | [
"Apache-2.0"
] | null | null | null | detectron2/evaluation/panoptic_evaluation.py | mvdelt/detectron2 | c320a6f0e6facb9c5d6dda8263c8e76834c04246 | [
"Apache-2.0"
] | null | null | null | detectron2/evaluation/panoptic_evaluation.py | mvdelt/detectron2 | c320a6f0e6facb9c5d6dda8263c8e76834c04246 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) Facebook, Inc. and its affiliates.
import contextlib
import io
import itertools
import json
import logging
import numpy as np
import os
import tempfile
from collections import OrderedDict
from PIL import Image
from tabulate import tabulate
from detectron2.data import MetadataCatalog
from detectron2.uti... | 47.563265 | 186 | 0.58766 |
import contextlib
import io
import itertools
import json
import logging
import numpy as np
import os
import tempfile
from collections import OrderedDict
from PIL import Image
from tabulate import tabulate
from detectron2.data import MetadataCatalog
from detectron2.utils import comm
from detectron2.utils.file_io impor... | true | true |
f7f58e1019d4aea7b585a250b57f6708dbd91c3f | 4,464 | py | Python | ethicophysics/sim.py | advancedresearch/ethicophysics | 52806b53d6d3ee92e1bd2a8c00f7728cebc9e684 | [
"Apache-2.0"
] | 7 | 2018-04-26T17:10:58.000Z | 2021-06-19T01:56:36.000Z | ethicophysics/sim.py | advancedresearch/ethicophysics | 52806b53d6d3ee92e1bd2a8c00f7728cebc9e684 | [
"Apache-2.0"
] | 46 | 2018-04-26T16:25:59.000Z | 2018-12-15T10:13:05.000Z | ethicophysics/sim.py | advancedresearch/ethicophysics | 52806b53d6d3ee92e1bd2a8c00f7728cebc9e684 | [
"Apache-2.0"
] | 1 | 2018-05-13T17:37:48.000Z | 2018-05-13T17:37:48.000Z | import numpy as np
dims = [('evil', 'good'), ('poor', 'rich'), ('unskilled', 'skilled'), ('tool', 'agent')]
ndim = len(dims)
# drives that the agents in the simulation are capable of having, as
# well as the effects that each drive has on the agent's soul
drives = [
('greed for possessions', ['evil', 'rich', 'ski... | 45.090909 | 88 | 0.708333 | import numpy as np
dims = [('evil', 'good'), ('poor', 'rich'), ('unskilled', 'skilled'), ('tool', 'agent')]
ndim = len(dims)
drives = [
('greed for possessions', ['evil', 'rich', 'skilled', 'agent']),
('hunger for power', ['evil', 'rich', 'skilled', 'agent']),
('desire to be of service', ['good', 'rich'... | false | true |
f7f5906a9982cc23d6cf123e100050c5490b92dd | 3,561 | py | Python | synapse/streams/config.py | Cadair/synapse | 466866a1d9dd1fcf82348a36c0532cb0c6614767 | [
"Apache-2.0"
] | 1 | 2019-09-14T03:24:03.000Z | 2019-09-14T03:24:03.000Z | synapse/streams/config.py | Cadair/synapse | 466866a1d9dd1fcf82348a36c0532cb0c6614767 | [
"Apache-2.0"
] | 4 | 2020-03-04T23:47:05.000Z | 2021-12-09T21:41:44.000Z | synapse/streams/config.py | Cadair/synapse | 466866a1d9dd1fcf82348a36c0532cb0c6614767 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 34.240385 | 88 | 0.650941 |
import logging
from synapse.api.errors import SynapseError
from synapse.http.servlet import parse_integer, parse_string
from synapse.types import StreamToken
logger = logging.getLogger(__name__)
MAX_LIMIT = 1000
class SourcePaginationConfig(object):
def __init__(self, from_key=None, to_key=No... | true | true |
f7f590a990f276e6b4e36e1e66cbe1ece8c4b733 | 3,721 | py | Python | di/utils/inspection/abstract.py | dlski/python-di | 04dcdf58f3cf820e2d2ba5086e4e89822ae1f409 | [
"MIT"
] | 8 | 2021-02-05T16:17:31.000Z | 2022-03-03T00:01:33.000Z | di/utils/inspection/abstract.py | dlski/python-di | 04dcdf58f3cf820e2d2ba5086e4e89822ae1f409 | [
"MIT"
] | null | null | null | di/utils/inspection/abstract.py | dlski/python-di | 04dcdf58f3cf820e2d2ba5086e4e89822ae1f409 | [
"MIT"
] | null | null | null | import dis
import inspect
import re
from types import DynamicClassAttribute
from typing import Callable, Iterable, Set, Type
from di.utils.inspection.typing import BUILTIN_TYPES
class AbstractInspector:
@classmethod
def is_abstract(cls, obj, duck_typing: bool = True) -> bool:
if inspect.isfunction(ob... | 32.929204 | 82 | 0.572964 | import dis
import inspect
import re
from types import DynamicClassAttribute
from typing import Callable, Iterable, Set, Type
from di.utils.inspection.typing import BUILTIN_TYPES
class AbstractInspector:
@classmethod
def is_abstract(cls, obj, duck_typing: bool = True) -> bool:
if inspect.isfunction(ob... | true | true |
f7f590bdf8530fbf1636509f70f94d23f501a76e | 4,323 | py | Python | src/onelogin/saml2/xml_utils.py | colinjeanne/python3-saml | c45c0f8ae029254642db036cf06058ec9e302098 | [
"MIT"
] | null | null | null | src/onelogin/saml2/xml_utils.py | colinjeanne/python3-saml | c45c0f8ae029254642db036cf06058ec9e302098 | [
"MIT"
] | 1 | 2021-06-10T23:08:35.000Z | 2021-06-10T23:08:35.000Z | src/onelogin/saml2/xml_utils.py | colinjeanne/python3-saml | c45c0f8ae029254642db036cf06058ec9e302098 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
""" OneLogin_Saml2_XML class
Copyright (c) 2015, OneLogin, Inc.
All rights reserved.
Auxiliary class of OneLogin's Python Toolkit.
"""
from os.path import join, dirname
from lxml import etree
from onelogin.saml2 import compat
from onelogin.saml2.constants import OneLogin_Saml2_Constants
f... | 31.554745 | 82 | 0.643072 |
from os.path import join, dirname
from lxml import etree
from onelogin.saml2 import compat
from onelogin.saml2.constants import OneLogin_Saml2_Constants
for prefix, url in OneLogin_Saml2_Constants.NSMAP.items():
etree.register_namespace(prefix, url)
class OneLogin_Saml2_XML(object):
_element_class = type... | true | true |
f7f590bdfafbd830ae8b6bd39eb4fd1d69c52e35 | 1,174 | py | Python | spInDP/PushBehavior.py | henkmollema/spInDP | a12f4bc6674565009c21179bbcd371f0982a13d7 | [
"MIT"
] | null | null | null | spInDP/PushBehavior.py | henkmollema/spInDP | a12f4bc6674565009c21179bbcd371f0982a13d7 | [
"MIT"
] | null | null | null | spInDP/PushBehavior.py | henkmollema/spInDP | a12f4bc6674565009c21179bbcd371f0982a13d7 | [
"MIT"
] | null | null | null | from spInDP.Behavior import Behavior
import time
from spInDP.AnimationController import AnimationController
class PushBehavior(Behavior):
frameNr = 1
lastZ = 0
animationController = None
remoteContext = None
def __init__(self, spider):
print("Initializing push (spider gap) behavior."... | 33.542857 | 110 | 0.655026 | from spInDP.Behavior import Behavior
import time
from spInDP.AnimationController import AnimationController
class PushBehavior(Behavior):
frameNr = 1
lastZ = 0
animationController = None
remoteContext = None
def __init__(self, spider):
print("Initializing push (spider gap) behavior."... | true | true |
f7f5914fbc095c47e45b16badfd3c89dd70d6ac4 | 35,189 | py | Python | rplugin/python3/denite/ui/default.py | skt041959/denite.nvim | 73f6567b683aaf43457d49bea7a5ed19816baec1 | [
"MIT"
] | null | null | null | rplugin/python3/denite/ui/default.py | skt041959/denite.nvim | 73f6567b683aaf43457d49bea7a5ed19816baec1 | [
"MIT"
] | null | null | null | rplugin/python3/denite/ui/default.py | skt041959/denite.nvim | 73f6567b683aaf43457d49bea7a5ed19816baec1 | [
"MIT"
] | null | null | null | # ============================================================================
# FILE: default.py
# AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
# License: MIT license
# ============================================================================
import re
import typing
from denite.util import echo, error, c... | 38.207383 | 79 | 0.548495 |
import re
import typing
from denite.util import echo, error, clearmatch, regex_convert_py_vim
from denite.util import Nvim, UserContext, Candidates, Candidate
from denite.parent import SyncParent
class Default(object):
@property
def is_async(self) -> bool:
return self._is_async
def __init_... | true | true |
f7f592f03076ad9090c98d42b193285284984cb3 | 18,667 | py | Python | cogs/general.py | SohamGhugare/coding-bot-v4 | 2ffe614d4747e0a47725d4c155326a73a2f80f80 | [
"MIT"
] | null | null | null | cogs/general.py | SohamGhugare/coding-bot-v4 | 2ffe614d4747e0a47725d4c155326a73a2f80f80 | [
"MIT"
] | null | null | null | cogs/general.py | SohamGhugare/coding-bot-v4 | 2ffe614d4747e0a47725d4c155326a73a2f80f80 | [
"MIT"
] | null | null | null | """
Coding Bot v4
~~~~~~~~~~~~~~~~~~
This file contains elements that are under the following licenses:
Copyright (c) 2015 Rapptz
license MIT, see
https://github.com/Rapptz/RoboDanny/blob/e1c3c28fe20eb192463f7fc224a399141f0d915d/LICENSE.txt
for more details.
"""
import discord
import time
import asyncio
import datetim... | 40.492408 | 154 | 0.577597 |
import discord
import time
import asyncio
import datetime
import re
import aiohttp
import asyncpg
import os
import sys
import traceback
import url_parser
import humanize
import inspect
from jishaku.codeblocks import codeblock_converter
from discord.ext import commands, menus
class ClientSession(aiohttp.ClientSession... | true | true |
f7f5942ba6d287222de417153ba8a3d8eb0a0369 | 123 | py | Python | mcts_player/removeSpace.py | MPARASHA/Gomoku-Players | f26f5aac6e719b0e5f758a34a275feaf885ae162 | [
"MIT"
] | null | null | null | mcts_player/removeSpace.py | MPARASHA/Gomoku-Players | f26f5aac6e719b0e5f758a34a275feaf885ae162 | [
"MIT"
] | null | null | null | mcts_player/removeSpace.py | MPARASHA/Gomoku-Players | f26f5aac6e719b0e5f758a34a275feaf885ae162 | [
"MIT"
] | null | null | null | import sys
for line in sys.stdin:
if line=='\n' or line=='= \n':
continue
else:
print(line,end="") | 17.571429 | 34 | 0.520325 | import sys
for line in sys.stdin:
if line=='\n' or line=='= \n':
continue
else:
print(line,end="") | true | true |
f7f5947403b33ae9b46baebb225ea75b212f9297 | 3,199 | py | Python | xos/synchronizer/test_voltha_client.py | etrirepo/olt_synchronizer | 493d20a2e404fe7aeca73eaa6d4bb18275faf4ec | [
"Apache-2.0"
] | null | null | null | xos/synchronizer/test_voltha_client.py | etrirepo/olt_synchronizer | 493d20a2e404fe7aeca73eaa6d4bb18275faf4ec | [
"Apache-2.0"
] | null | null | null | xos/synchronizer/test_voltha_client.py | etrirepo/olt_synchronizer | 493d20a2e404fe7aeca73eaa6d4bb18275faf4ec | [
"Apache-2.0"
] | null | null | null | # Copyright 2020-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | 32.642857 | 114 | 0.648328 |
import unittest
from time import sleep
import grpc
import os
from concurrent.futures import ThreadPoolExecutor
from voltha_client import VolthaClient, ConnectionError
from mock_voltha_server import VolthaServerMock, MOCK_VOLTHA_SERVER_ADDRESS, MOCK_VOLTHA_SERVER_PORT
from google.protobuf import json_for... | true | true |
f7f5953df70a457cdcfa1364dcff1a4ea0d3973b | 4,490 | py | Python | tests/features/test_build_features.py | catalyst-cooperative/epacems_ramp_rates | 5a5ea6f9571823f7ef3f9c66abb4d9acb79820be | [
"MIT"
] | 1 | 2021-07-02T15:31:22.000Z | 2021-07-02T15:31:22.000Z | tests/features/test_build_features.py | catalyst-cooperative/epacems_ramp_rates | 5a5ea6f9571823f7ef3f9c66abb4d9acb79820be | [
"MIT"
] | 4 | 2021-07-30T19:42:10.000Z | 2021-08-16T19:12:21.000Z | tests/features/test_build_features.py | catalyst-cooperative/epacems_ramp_rates | 5a5ea6f9571823f7ef3f9c66abb4d9acb79820be | [
"MIT"
] | null | null | null | import pytest
import pandas as pd
import numpy as np
from ramprate.build_features import _find_uptime
def test__find_uptime_start_and_end_nonzero():
dt_idx = pd.date_range(start="2020-01-01 00:00", periods=6, freq="h", tz="UTC")
data = [2, 2, 0, 0, 0, 2]
# downtime=True
# first zero after non-zero
... | 42.358491 | 89 | 0.675724 | import pytest
import pandas as pd
import numpy as np
from ramprate.build_features import _find_uptime
def test__find_uptime_start_and_end_nonzero():
dt_idx = pd.date_range(start="2020-01-01 00:00", periods=6, freq="h", tz="UTC")
data = [2, 2, 0, 0, 0, 2]
shutdown = pd.to_datetime(["2020-01-01 ... | true | true |
f7f59690fe12952f92183a35d3046fabb355c286 | 35 | py | Python | stereovis/spiking/algorithms/__init__.py | gdikov/hybrid-stereo-matching | 6e9b6e499098d884618ecf3c1503891abdee3ce6 | [
"MIT"
] | 16 | 2017-07-05T07:20:53.000Z | 2020-12-29T19:33:38.000Z | stereovis/spiking/algorithms/__init__.py | gdikov/hybrid-stereo-matching | 6e9b6e499098d884618ecf3c1503891abdee3ce6 | [
"MIT"
] | 1 | 2020-06-02T13:57:45.000Z | 2020-06-02T13:59:21.000Z | stereovis/spiking/algorithms/__init__.py | gdikov/hybrid-stereo-matching | 6e9b6e499098d884618ecf3c1503891abdee3ce6 | [
"MIT"
] | 2 | 2019-02-18T20:25:54.000Z | 2020-12-07T07:28:33.000Z | from vvf import VelocityVectorField | 35 | 35 | 0.914286 | from vvf import VelocityVectorField | true | true |
f7f596e079123ca2234da0e9420a47383c9d9c09 | 4,007 | py | Python | cubicsplines.py | nguyenvu2589/Numerical | 23eee7d31a8871d5d53871ebc9950866cf11ad23 | [
"MIT"
] | null | null | null | cubicsplines.py | nguyenvu2589/Numerical | 23eee7d31a8871d5d53871ebc9950866cf11ad23 | [
"MIT"
] | null | null | null | cubicsplines.py | nguyenvu2589/Numerical | 23eee7d31a8871d5d53871ebc9950866cf11ad23 | [
"MIT"
] | null | null | null | import numpy as np
import re
import matplotlib.pyplot as plt
debug = False
# Takes a string of points in the string form: '(-1,3), (0,5), (3,1), (4,1), (5,1)'
# and optionally, the graph resolution.
# Prints the cubic spline functions to stdout and displays an interpolated line plot
# Example usage: cubicSpline('(-1... | 28.827338 | 120 | 0.519591 | import numpy as np
import re
import matplotlib.pyplot as plt
debug = False
def cubicSpline(points, resolution=100):
if not points:
raise Exception('You must provide in data points.')
return
if not points.count('(') == points.count(')'):
raise Exception('Input coordinates w... | true | true |
f7f59816b91874032a4a92dde9df9453888f9420 | 482 | py | Python | databutler/pat/analysis/clock.py | rbavishi/databutler | 222263672dae8b519d0592a6bbe68a01dc4ce95d | [
"BSD-2-Clause"
] | null | null | null | databutler/pat/analysis/clock.py | rbavishi/databutler | 222263672dae8b519d0592a6bbe68a01dc4ce95d | [
"BSD-2-Clause"
] | 1 | 2022-02-11T06:19:45.000Z | 2022-02-11T06:19:45.000Z | databutler/pat/analysis/clock.py | rbavishi/databutler | 222263672dae8b519d0592a6bbe68a01dc4ce95d | [
"BSD-2-Clause"
] | null | null | null | import attr
@attr.s(cmp=False, repr=False)
class LogicalClock:
"""
A basic clock implementation supporting getters and increment methods.
"""
_time: int = attr.ib(init=False)
def __attrs_post_init__(self):
self.reset()
def reset(self, init_time: int = 0):
self._time = init_ti... | 20.956522 | 74 | 0.620332 | import attr
@attr.s(cmp=False, repr=False)
class LogicalClock:
_time: int = attr.ib(init=False)
def __attrs_post_init__(self):
self.reset()
def reset(self, init_time: int = 0):
self._time = init_time
def get_time(self) -> int:
return self._time
def increment(self, step:... | true | true |
f7f5981c7727d4ad30c6795c8d8b0f605691a60c | 1,862 | py | Python | vsts/vsts/gallery/v4_1/models/qn_aItem.py | kenkuo/azure-devops-python-api | 9e920bd25e938fa89ff7f60153e5b9e113ca839d | [
"MIT"
] | null | null | null | vsts/vsts/gallery/v4_1/models/qn_aItem.py | kenkuo/azure-devops-python-api | 9e920bd25e938fa89ff7f60153e5b9e113ca839d | [
"MIT"
] | null | null | null | vsts/vsts/gallery/v4_1/models/qn_aItem.py | kenkuo/azure-devops-python-api | 9e920bd25e938fa89ff7f60153e5b9e113ca839d | [
"MIT"
] | null | null | null | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 40.478261 | 105 | 0.548872 |
from msrest.serialization import Model
class QnAItem(Model):
_attribute_map = {
'created_date': {'key': 'createdDate', 'type': 'iso-8601'},
'id': {'key': 'id', 'type': 'long'},
'status': {'key': 'status', 'type': 'object'},
'text': {'key': 'text', 'type': 'str'},
'... | true | true |
f7f5987e700ca936a3caf26863d5683d4f4b8224 | 3,230 | py | Python | tests/integration/test_tostac.py | csiro-easi/eo-datasets | 7805c569763f828cb0ace84c93932bddb882a6a3 | [
"Apache-2.0"
] | null | null | null | tests/integration/test_tostac.py | csiro-easi/eo-datasets | 7805c569763f828cb0ace84c93932bddb882a6a3 | [
"Apache-2.0"
] | null | null | null | tests/integration/test_tostac.py | csiro-easi/eo-datasets | 7805c569763f828cb0ace84c93932bddb882a6a3 | [
"Apache-2.0"
] | null | null | null | import json
import shutil
from functools import partial
from pathlib import Path
from pprint import pformat
import pytest
from deepdiff import DeepDiff
from eodatasets3 import serialise
from eodatasets3.scripts import tostac
from tests.integration.common import run_prepare_cli
TO_STAC_DATA: Path = Path(__file__).pare... | 32.626263 | 93 | 0.744892 | import json
import shutil
from functools import partial
from pathlib import Path
from pprint import pformat
import pytest
from deepdiff import DeepDiff
from eodatasets3 import serialise
from eodatasets3.scripts import tostac
from tests.integration.common import run_prepare_cli
TO_STAC_DATA: Path = Path(__file__).pare... | true | true |
f7f598b3a2d44bdedeae8e590488565af415da3a | 2,656 | py | Python | aliyun-python-sdk-core/aliyunsdkcore/auth/signers/ecs_ram_role_singer.py | DataDog/aliyun-openapi-python-sdk | 5cbee29bce6416dd62f61f0c3786b1af6ea0d84f | [
"Apache-2.0"
] | 1 | 2019-12-23T12:36:43.000Z | 2019-12-23T12:36:43.000Z | aliyun-python-sdk-core/aliyunsdkcore/auth/signers/ecs_ram_role_singer.py | liusc27/aliyun-openapi-python-sdk | 5e3db3535dd21de987dc5981e71151327d5a884f | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-core/aliyunsdkcore/auth/signers/ecs_ram_role_singer.py | liusc27/aliyun-openapi-python-sdk | 5e3db3535dd21de987dc5981e71151327d5a884f | [
"Apache-2.0"
] | 1 | 2021-02-23T11:27:54.000Z | 2021-02-23T11:27:54.000Z | # coding:utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"... | 38.492754 | 122 | 0.687877 |
import time
import json
import urllib2
import logging
from aliyunsdkcore.auth.signers.signer import Signer
class EcsRamRoleSigner(Signer):
_REFRESH_SCALE = 0.8
def __init__(self, ecs_ram_role_credential):
self._credential = ecs_ram_role_credential
self._last_update_time ... | true | true |
f7f599066e774b28747c46edc011e399bff0fcc6 | 3,686 | py | Python | splearn/data/sample_ssvep.py | jinglescode/python-signal-processing | c3de02b12905f14a2350377d7f4a868bd7a40bc7 | [
"BSD-3-Clause"
] | 10 | 2020-12-24T09:27:06.000Z | 2021-12-09T14:48:10.000Z | splearn/data/sample_ssvep.py | jinglescode/python-signal-processing | c3de02b12905f14a2350377d7f4a868bd7a40bc7 | [
"BSD-3-Clause"
] | null | null | null | splearn/data/sample_ssvep.py | jinglescode/python-signal-processing | c3de02b12905f14a2350377d7f4a868bd7a40bc7 | [
"BSD-3-Clause"
] | 3 | 2021-11-09T21:06:15.000Z | 2022-03-28T09:08:41.000Z | # -*- coding: utf-8 -*-
"""A 40-target SSVEP dataset recorded from a single subject.
"""
import numpy as np
from scipy.io import loadmat
import os
class SampleSSVEPData():
r"""
A 40-target SSVEP dataset recorded from a single subject.
Data description:
Original Data shape : (40, 9, 1250, 6) [... | 38 | 237 | 0.582474 |
import numpy as np
from scipy.io import loadmat
import os
class SampleSSVEPData():
def __init__(self, path=None):
if path is None:
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "sample")
data = loadmat(os.path.join(path,"ssvep.mat"))
data = ... | true | true |
f7f5991ffbc6f4cc8961f561fa79454bd4c1b374 | 1,769 | py | Python | PyQt6/example.py | avazevfx/pyqt-colorpicker-widget | 07447a8f63582bef9a413cfd7b03eb8bbe27a3a6 | [
"MIT"
] | 4 | 2021-05-21T09:13:39.000Z | 2021-12-08T05:13:32.000Z | PyQt6/example.py | avazevfx/pyqt-colorpicker-widget | 07447a8f63582bef9a413cfd7b03eb8bbe27a3a6 | [
"MIT"
] | 1 | 2021-05-15T08:48:24.000Z | 2021-05-15T10:17:31.000Z | PyQt6/example.py | avazevfx/pyqt-colorpicker-widget | 07447a8f63582bef9a413cfd7b03eb8bbe27a3a6 | [
"MIT"
] | 1 | 2021-05-21T07:48:24.000Z | 2021-05-21T07:48:24.000Z | from PyQt6.QtWidgets import *
from example_window import Ui_MainWindow
from colorpicker import ColorPicker
# Basic Window class using QtDesigner & pyuic5
class My_Window(QMainWindow):
def __init__(self, *args, **kwargs):
super(My_Window, self).__init__(*args, **kwargs)
# set up your custom UI... | 31.035088 | 95 | 0.673827 | from PyQt6.QtWidgets import *
from example_window import Ui_MainWindow
from colorpicker import ColorPicker
class My_Window(QMainWindow):
def __init__(self, *args, **kwargs):
super(My_Window, self).__init__(*args, **kwargs)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
... | true | true |
f7f59955b810d4bc1e989801468b0a2efd4a63c0 | 922 | py | Python | main.py | ronanhansel/juvenile | d9e79cc21ebfac7127e22f059a298601a7906348 | [
"MIT"
] | 1 | 2021-08-18T16:26:24.000Z | 2021-08-18T16:26:24.000Z | main.py | ronanhansel/juvenile | d9e79cc21ebfac7127e22f059a298601a7906348 | [
"MIT"
] | null | null | null | main.py | ronanhansel/juvenile | d9e79cc21ebfac7127e22f059a298601a7906348 | [
"MIT"
] | null | null | null | from discord.ext import commands
import os
# Import and load all files
client = commands.Bot(command_prefix="-")
client.remove_command('help')
@client.command(hidden=True)
@commands.is_owner()
async def load(ctx, extension):
client.load_extension(f'cogs.{extension}')
await ctx.send(f'Loaded: {extension}')
... | 25.611111 | 54 | 0.71692 | from discord.ext import commands
import os
client = commands.Bot(command_prefix="-")
client.remove_command('help')
@client.command(hidden=True)
@commands.is_owner()
async def load(ctx, extension):
client.load_extension(f'cogs.{extension}')
await ctx.send(f'Loaded: {extension}')
@client.command(hidden=True... | true | true |
f7f599c0f7464cc5f91e7f3bda1d649d81b875b2 | 877,808 | py | Python | treeno/grammar/gen/SqlBaseParser.py | OneRaynyDay/treeno | ce11b8447f471c0b5ea596a211b3855625ec43eb | [
"MIT"
] | 1 | 2021-12-28T19:00:01.000Z | 2021-12-28T19:00:01.000Z | treeno/grammar/gen/SqlBaseParser.py | OneRaynyDay/treeno | ce11b8447f471c0b5ea596a211b3855625ec43eb | [
"MIT"
] | null | null | null | treeno/grammar/gen/SqlBaseParser.py | OneRaynyDay/treeno | ce11b8447f471c0b5ea596a211b3855625ec43eb | [
"MIT"
] | null | null | null | # Generated from SqlBase.g4 by ANTLR 4.9.2
# encoding: utf-8
import sys
from io import StringIO
from antlr4 import *
if sys.version_info[1] > 5:
from typing import TextIO
else:
from typing.io import TextIO
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u... | 44.783838 | 7,703 | 0.587619 |
import sys
from io import StringIO
from antlr4 import *
if sys.version_info[1] > 5:
from typing import TextIO
else:
from typing.io import TextIO
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\u011c")
buf.write("\u09bd\4\2\t\2\4\3\... | true | true |
f7f599c755ab1a2b2a72a7f20c40f3bdc7832bc9 | 400 | py | Python | tf_covid19_care/trainers/_init_pathes.py | wangjuncongyu/COVID-19-Deep-Learning | 7a2613a978c7537a541ae1ac1ea89643d2fa9081 | [
"Apache-2.0"
] | null | null | null | tf_covid19_care/trainers/_init_pathes.py | wangjuncongyu/COVID-19-Deep-Learning | 7a2613a978c7537a541ae1ac1ea89643d2fa9081 | [
"Apache-2.0"
] | null | null | null | tf_covid19_care/trainers/_init_pathes.py | wangjuncongyu/COVID-19-Deep-Learning | 7a2613a978c7537a541ae1ac1ea89643d2fa9081 | [
"Apache-2.0"
] | 1 | 2021-12-03T04:17:51.000Z | 2021-12-03T04:17:51.000Z | import os.path as osp
import sys
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
this_dir = osp.dirname(__file__)
add_path(osp.join(this_dir, '..'))
# Add data_loader to PYTHONPATH
data_loader_path = osp.join(this_dir, '..', 'data_loader')
add_path(data_loader_path)
# Add util to P... | 22.222222 | 58 | 0.7125 | import os.path as osp
import sys
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
this_dir = osp.dirname(__file__)
add_path(osp.join(this_dir, '..'))
data_loader_path = osp.join(this_dir, '..', 'data_loader')
add_path(data_loader_path)
| true | true |
f7f59b62bb3925d5a26dd4052ddb689617179e89 | 104 | py | Python | tests/exog/random/random_exog_300_1280.py | shaido987/pyaf | b9afd089557bed6b90b246d3712c481ae26a1957 | [
"BSD-3-Clause"
] | 377 | 2016-10-13T20:52:44.000Z | 2022-03-29T18:04:14.000Z | tests/exog/random/random_exog_300_1280.py | ysdede/pyaf | b5541b8249d5a1cfdc01f27fdfd99b6580ed680b | [
"BSD-3-Clause"
] | 160 | 2016-10-13T16:11:53.000Z | 2022-03-28T04:21:34.000Z | tests/exog/random/random_exog_300_1280.py | ysdede/pyaf | b5541b8249d5a1cfdc01f27fdfd99b6580ed680b | [
"BSD-3-Clause"
] | 63 | 2017-03-09T14:51:18.000Z | 2022-03-27T20:52:57.000Z | import tests.exog.test_random_exogenous as testrandexog
testrandexog.test_random_exogenous( 300,1280); | 26 | 55 | 0.865385 | import tests.exog.test_random_exogenous as testrandexog
testrandexog.test_random_exogenous( 300,1280); | true | true |
f7f59ca20dbf6defb9e9a297c84353a29f08b414 | 4,209 | py | Python | topi/python/topi/nn/pooling.py | baowenlei/tvm | 6b2e18ed96fad26b4a5e5f8a6dcbedf9206c9a65 | [
"Apache-2.0"
] | 1 | 2019-04-26T18:35:40.000Z | 2019-04-26T18:35:40.000Z | topi/python/topi/nn/pooling.py | baowenlei/tvm | 6b2e18ed96fad26b4a5e5f8a6dcbedf9206c9a65 | [
"Apache-2.0"
] | null | null | null | topi/python/topi/nn/pooling.py | baowenlei/tvm | 6b2e18ed96fad26b4a5e5f8a6dcbedf9206c9a65 | [
"Apache-2.0"
] | 2 | 2019-05-24T17:22:38.000Z | 2019-06-14T23:30:24.000Z | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 36.284483 | 87 | 0.677833 |
from __future__ import absolute_import
from .. import cpp
POOL_TYPE_CODE = {
"avg": 0,
"max": 1
}
def global_pool(data, pool_type, layout="NCHW"):
return cpp.nn.global_pool(data, POOL_TYPE_CODE[pool_type], layout)
def pool(data,
kernel,
stride,
padding,
... | true | true |
f7f59cfc76764e2d9333ff393aef46fdfa2c2ac8 | 8,832 | py | Python | networks/modular_downscaling_model/core_modules/ResUNetSuper.py | khoehlein/CNNs-for-Wind-Field-Downscaling | eb8418d4d893fcb2beb929abb241281b7a9b6a95 | [
"MIT"
] | 5 | 2021-05-05T06:08:52.000Z | 2022-03-24T04:57:52.000Z | networks/modular_downscaling_model/core_modules/ResUNetSuper.py | khoehlein/CNNs-for-Wind-Field-Downscaling | eb8418d4d893fcb2beb929abb241281b7a9b6a95 | [
"MIT"
] | null | null | null | networks/modular_downscaling_model/core_modules/ResUNetSuper.py | khoehlein/CNNs-for-Wind-Field-Downscaling | eb8418d4d893fcb2beb929abb241281b7a9b6a95 | [
"MIT"
] | 2 | 2021-08-07T05:18:05.000Z | 2022-03-31T03:48:37.000Z | import torch.nn as nn
from networks.modular_downscaling_model.base_modules import ConvBlock, ResNetMultiBlock, ConvMultiBlock
from networks.modular_downscaling_model.core_modules.unet_template import BaseUNet
from networks.modular_downscaling_model.core_modules.unet_template.SkipConnectionModule import SkipConnectionMo... | 40.328767 | 115 | 0.658741 | import torch.nn as nn
from networks.modular_downscaling_model.base_modules import ConvBlock, ResNetMultiBlock, ConvMultiBlock
from networks.modular_downscaling_model.core_modules.unet_template import BaseUNet
from networks.modular_downscaling_model.core_modules.unet_template.SkipConnectionModule import SkipConnectionMo... | true | true |
f7f59d1f6caa35429df9a2262629db0c7253b18c | 4,078 | py | Python | io_equalizerviz.py | PROPHESSOR/Blender-Equalizer-Audio-Visualizer | 0405f2c47a76b47f22948a65561db5efe66f5bd8 | [
"MIT"
] | null | null | null | io_equalizerviz.py | PROPHESSOR/Blender-Equalizer-Audio-Visualizer | 0405f2c47a76b47f22948a65561db5efe66f5bd8 | [
"MIT"
] | 2 | 2020-01-03T23:53:04.000Z | 2020-01-03T23:54:49.000Z | io_equalizerviz.py | PROPHESSOR/Blender-Equalizer-Audio-Visualizer | 0405f2c47a76b47f22948a65561db5efe66f5bd8 | [
"MIT"
] | null | null | null | # EqualizerViz - Audio visualization plugin
# Created by PROPHESSOR for Blender 2.80 (04.01.2020)
#
# Based on sirrandalot's "Audio visualisation script" for Blender 2.71
import bpy
from bpy_extras.io_utils import ImportHelper
from bpy.props import IntProperty, StringProperty
from bpy.types import Operator
from bpy_e... | 39.592233 | 128 | 0.619667 |
import bpy
from bpy_extras.io_utils import ImportHelper
from bpy.props import IntProperty, StringProperty
from bpy.types import Operator
from bpy_extras.wm_utils.progress_report import ProgressReport
bl_info = {
"name": "Import Equalizer Audio",
"author": "PROPHESSOR",
"description": "Imports the aud... | true | true |
f7f59ebdf95a70dd2250fac6bef87b26ce986d59 | 245 | py | Python | examples/add_profile.py | vshn/hatchbuck | 0af768195dd3bc8b5e3899dccba121f42d307603 | [
"BSD-3-Clause"
] | null | null | null | examples/add_profile.py | vshn/hatchbuck | 0af768195dd3bc8b5e3899dccba121f42d307603 | [
"BSD-3-Clause"
] | 13 | 2018-03-27T10:08:52.000Z | 2021-01-05T17:53:21.000Z | examples/add_profile.py | vshn/hatchbuck | 0af768195dd3bc8b5e3899dccba121f42d307603 | [
"BSD-3-Clause"
] | 1 | 2018-05-15T13:10:34.000Z | 2018-05-15T13:10:34.000Z | from hatchbuck import Hatchbuck
import pprint
import sys
pp = pprint.PrettyPrinter()
hatchbuck = Hatchbuck(sys.argv[1])
profile = hatchbuck.profile_add(
"emails", "address", "baschar.said@hotmail.com", {"type": "Home"}
)
pp.pprint(profile)
| 22.272727 | 69 | 0.734694 | from hatchbuck import Hatchbuck
import pprint
import sys
pp = pprint.PrettyPrinter()
hatchbuck = Hatchbuck(sys.argv[1])
profile = hatchbuck.profile_add(
"emails", "address", "baschar.said@hotmail.com", {"type": "Home"}
)
pp.pprint(profile)
| true | true |
f7f59f58422e9f6da30460938aab47c459498a56 | 18,253 | py | Python | ifis_tools/from_taudem.py | nicolas998/ifis_tools | f7b06473a916324fc37937bc5e9034cc57bc1623 | [
"MIT"
] | 3 | 2019-09-05T14:47:02.000Z | 2021-11-12T15:31:56.000Z | ifis_tools/from_taudem.py | nicolas998/ifis_tools | f7b06473a916324fc37937bc5e9034cc57bc1623 | [
"MIT"
] | 2 | 2019-11-13T21:36:22.000Z | 2019-12-16T21:16:43.000Z | ifis_tools/from_taudem.py | nicolas998/ifis_tools | f7b06473a916324fc37937bc5e9034cc57bc1623 | [
"MIT"
] | null | null | null | import pandas as pd
import geopandas as gp
import numpy as np
import pylab as pl
from struct import pack, unpack
import io
import gdal
from osgeo import ogr
import osgeo
#from wmf import wmf
pd.options.mode.chained_assignment = None
def read_raster(path_map,isDEMorDIR=False,dxp=None, noDataP = None,isDIR = False,D... | 42.847418 | 235 | 0.571468 | import pandas as pd
import geopandas as gp
import numpy as np
import pylab as pl
from struct import pack, unpack
import io
import gdal
from osgeo import ogr
import osgeo
pd.options.mode.chained_assignment = None
def read_raster(path_map,isDEMorDIR=False,dxp=None, noDataP = None,isDIR = False,DIRformat = 'r.watersh... | true | true |
f7f59fcc1e9fbb91dc59e012b1a47669aaef4598 | 16,229 | py | Python | spam/02_spam_data_augmentation_tutorial.py | jsnlp/snorkel-tutorials | b4cda9f918daf77f4011ec1598c08d9bd7e51c39 | [
"Apache-2.0"
] | 315 | 2019-07-27T22:49:20.000Z | 2022-03-30T10:02:02.000Z | spam/02_spam_data_augmentation_tutorial.py | jsnlp/snorkel-tutorials | b4cda9f918daf77f4011ec1598c08d9bd7e51c39 | [
"Apache-2.0"
] | 133 | 2019-07-25T02:07:37.000Z | 2022-03-29T12:08:32.000Z | spam/02_spam_data_augmentation_tutorial.py | jsnlp/snorkel-tutorials | b4cda9f918daf77f4011ec1598c08d9bd7e51c39 | [
"Apache-2.0"
] | 173 | 2019-08-13T02:27:11.000Z | 2022-03-30T05:26:40.000Z | # -*- coding: utf-8 -*-
# %% [markdown]
# # 📈 Snorkel Intro Tutorial: Data Augmentation
# %% [markdown]
# In this tutorial, we will walk through the process of using *transformation functions* (TFs) to perform data augmentation.
# Like the labeling tutorial, our goal is to train a classifier to YouTube comments as `S... | 42.595801 | 212 | 0.732146 |
ansformation functions.
import os
import random
import numpy as np
if os.path.basename(os.getcwd()) == "snorkel-tutorials":
os.chdir("spam")
# Turn off TensorFlow logging messages
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
# For reproducibility
seed = 0
os.environ["PYTHONHASHSEED"] = s... | true | true |
f7f5a0158e7bfdf099d6d0b6a95fc1b96aec2327 | 2,823 | py | Python | heuristic.py | gaurav952/puzzle-game-tetris-using-genetic-algorithm- | 266a71003119d7b2d2f631ad51cabd8d86b76cb4 | [
"Apache-2.0"
] | null | null | null | heuristic.py | gaurav952/puzzle-game-tetris-using-genetic-algorithm- | 266a71003119d7b2d2f631ad51cabd8d86b76cb4 | [
"Apache-2.0"
] | null | null | null | heuristic.py | gaurav952/puzzle-game-tetris-using-genetic-algorithm- | 266a71003119d7b2d2f631ad51cabd8d86b76cb4 | [
"Apache-2.0"
] | 1 | 2019-12-03T08:21:30.000Z | 2019-12-03T08:21:30.000Z | """These heuristics attempt to assess how favourable a given board is.
The board should already have the dummy 23rd row stripped out.
When the heuristic says "block" it means one individual cell of a stone.
How you weight the different heuristics is up to you.
Most are designed to indicate bad things, and so should h... | 28.806122 | 107 | 0.690755 |
def _is_block(cell):
return cell != 0
def _is_empty(cell):
return cell == 0
def _holes_in_board(board):
holes = []
block_in_col = False
for x in range(len(board[0])):
for y in range(len(board)):
if block_in_col and _is_empty(board[y][x]):
holes.append((x,y))
elif _is_block(board[y][x]):
block_in... | true | true |
f7f5a2ea065f28f9a2ca4b205085be35bc1e9cc2 | 3,999 | py | Python | custom_components/tesla_custom/climate.py | carleeno/tesla | 81c342d5c2564eed3659cc5a0711b4c209dd6773 | [
"Apache-2.0"
] | 108 | 2021-04-29T11:38:05.000Z | 2022-03-25T10:35:28.000Z | custom_components/tesla_custom/climate.py | carleeno/tesla | 81c342d5c2564eed3659cc5a0711b4c209dd6773 | [
"Apache-2.0"
] | 120 | 2021-04-29T07:49:59.000Z | 2022-03-31T04:45:15.000Z | custom_components/tesla_custom/climate.py | carleeno/tesla | 81c342d5c2564eed3659cc5a0711b4c209dd6773 | [
"Apache-2.0"
] | 33 | 2021-05-01T16:03:07.000Z | 2022-03-12T21:54:40.000Z | """Support for Tesla HVAC system."""
from __future__ import annotations
import logging
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE,
)
from homeassista... | 31.488189 | 84 | 0.664416 | from __future__ import annotations
import logging
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE,
)
from homeassistant.const import ATTR_TEMPERATURE, TEM... | true | true |
f7f5a314dab51c1252d7afe85641cb59e070a7e8 | 8,962 | py | Python | uncore_csv_json.py | neolinsu/event-converter-for-linux-perf | 5bc53af2e79d81345cef6672f130167d00c0e441 | [
"BSD-3-Clause"
] | 6 | 2021-04-13T08:02:07.000Z | 2022-02-09T20:08:48.000Z | uncore_csv_json.py | neolinsu/event-converter-for-linux-perf | 5bc53af2e79d81345cef6672f130167d00c0e441 | [
"BSD-3-Clause"
] | 3 | 2020-11-17T18:40:17.000Z | 2022-03-17T23:57:53.000Z | uncore_csv_json.py | neolinsu/event-converter-for-linux-perf | 5bc53af2e79d81345cef6672f130167d00c0e441 | [
"BSD-3-Clause"
] | 4 | 2020-11-17T07:38:36.000Z | 2022-02-17T04:10:56.000Z | #!/usr/bin/python
# Copyright (c) 2020, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | 34.337165 | 163 | 0.600647 |
from __future__ import print_function
import json
import sys
import csv
import copy
import argparse
import itertools
import re
repl_events = {
"UNC_M_CLOCKTICKS": "UNC_M_DCLOCKTICKS"
}
ap = argparse.ArgumentParser()
ap.add_argument('csvfile')
ap.add_argument('jsonfile')
ap.add_argume... | true | true |
f7f5a326326a4966f92a93d23568b99d4d8f1093 | 1,003 | py | Python | src/decisionengine_modules/util/testutils.py | hyunwoo18/decisionengine_modules | a67462628c2074e768d0825edee4ee5d570030e0 | [
"BSD-3-Clause"
] | null | null | null | src/decisionengine_modules/util/testutils.py | hyunwoo18/decisionengine_modules | a67462628c2074e768d0825edee4ee5d570030e0 | [
"BSD-3-Clause"
] | null | null | null | src/decisionengine_modules/util/testutils.py | hyunwoo18/decisionengine_modules | a67462628c2074e768d0825edee4ee5d570030e0 | [
"BSD-3-Clause"
] | null | null | null | '''
Utils to simplify testing
'''
# These imports needed for the `eval` blocks
from classad import classad # noqa
import datetime # noqa
import pandas as pd # noqa
def input_from_file(fname):
with open(fname) as fd:
return eval(fd.read())
def raw_input_from_file(fname):
wi... | 23.880952 | 50 | 0.581256 |
from classad import classad
import datetime
import pandas as pd
def input_from_file(fname):
with open(fname) as fd:
return eval(fd.read())
def raw_input_from_file(fname):
with open(fname) as fd:
return fd.read()
def compare_dfs(df1, df2):
if df1.shape[0] != d... | true | true |
f7f5a3778c355a59e3379cd699be3b3027c9ff73 | 432 | py | Python | pycs/races/elf.py | dwagon/pycs | 4d02acbf380526d3bf0380f6bb8b757a827024b8 | [
"MIT"
] | null | null | null | pycs/races/elf.py | dwagon/pycs | 4d02acbf380526d3bf0380f6bb8b757a827024b8 | [
"MIT"
] | null | null | null | pycs/races/elf.py | dwagon/pycs | 4d02acbf380526d3bf0380f6bb8b757a827024b8 | [
"MIT"
] | null | null | null | """https://www.dndbeyond.com/races/elf"""
from pycs.race import Race
##############################################################################
##############################################################################
##############################################################################
class Elf(Ra... | 27 | 78 | 0.273148 | from pycs.race import Race
| true | true |
f7f5a4048eba5ac128f8d5bee493374049f2c750 | 310 | py | Python | vmapper/map_element/__init__.py | wcchin/mappy | 38015bfc58d39552939d36e0e7eaa696ddbb2c5c | [
"MIT"
] | 2 | 2017-06-10T13:19:58.000Z | 2017-06-25T18:09:04.000Z | vmapper/map_element/__init__.py | wcchin/vmapper | 38015bfc58d39552939d36e0e7eaa696ddbb2c5c | [
"MIT"
] | null | null | null | vmapper/map_element/__init__.py | wcchin/vmapper | 38015bfc58d39552939d36e0e7eaa696ddbb2c5c | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
### this folder is for the items that use the svg coordinate system, not the projected map coordinates
## not implement yet
from Legend import ColorLegend
from MapScale import MapScale
from TextBox import TextBox
from GridLines import GridLines
import common_function# import get_loc
| 28.181818 | 102 | 0.790323 | true | true | |
f7f5a4adfd883001034c4520dc6ea2b47d1fc20f | 28,993 | py | Python | hosts/utils/nmap_discovery_server.py | reven-tang/ITMP | 8d6686edb19fcc26c9cf1f7e14037f9d38a6e702 | [
"BSD-2-Clause"
] | null | null | null | hosts/utils/nmap_discovery_server.py | reven-tang/ITMP | 8d6686edb19fcc26c9cf1f7e14037f9d38a6e702 | [
"BSD-2-Clause"
] | 11 | 2020-06-05T19:40:52.000Z | 2022-03-11T23:38:17.000Z | hosts/utils/nmap_discovery_server.py | reven-tang/ITMP | 8d6686edb19fcc26c9cf1f7e14037f9d38a6e702 | [
"BSD-2-Clause"
] | null | null | null | # -*- coding:utf-8 -*-
import os
import re
import telnetlib
PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__))
from pysnmp.entity.rfc3413.oneliner import cmdgen
import nmap
import time
# import sys
from hosts.models import HostsInfo
from hosts.lib.J_do import J_ssh_do
from hosts.lib.utils import mac_trans,sn... | 53.295956 | 215 | 0.532715 |
import os
import re
import telnetlib
PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__))
from pysnmp.entity.rfc3413.oneliner import cmdgen
import nmap
import time
from hosts.models import HostsInfo
from hosts.lib.J_do import J_ssh_do
from hosts.lib.utils import mac_trans,sn_trans,machine_type_trans
from hos... | true | true |
f7f5a516c0e2b72a9ae5b2b71a5aab1a65000d86 | 2,147 | py | Python | xfel/command_line/cxi_cspad_pinwheel.py | rimmartin/cctbx_project | 644090f9432d9afc22cfb542fc3ab78ca8e15e5d | [
"BSD-3-Clause-LBNL"
] | null | null | null | xfel/command_line/cxi_cspad_pinwheel.py | rimmartin/cctbx_project | 644090f9432d9afc22cfb542fc3ab78ca8e15e5d | [
"BSD-3-Clause-LBNL"
] | null | null | null | xfel/command_line/cxi_cspad_pinwheel.py | rimmartin/cctbx_project | 644090f9432d9afc22cfb542fc3ab78ca8e15e5d | [
"BSD-3-Clause-LBNL"
] | null | null | null | from __future__ import division
# LIBTBX_SET_DISPATCHER_NAME cxi.cspad_pinwheel
#
# Removes all but the central sensors from a CSPAD CBF
#
import dxtbx, sys, os
import libtbx.option_parser
from xfel.cftbx.detector.cspad_cbf_tbx import cbf_file_to_basis_dict, write_cspad_cbf
from libtbx.utils import Usage
def run(argv... | 34.079365 | 128 | 0.681416 | from __future__ import division
import dxtbx, sys, os
import libtbx.option_parser
from xfel.cftbx.detector.cspad_cbf_tbx import cbf_file_to_basis_dict, write_cspad_cbf
from libtbx.utils import Usage
def run(argv=None):
if argv is None:
argv = sys.argv[1:]
command_line = libtbx.option_parser.option_parser... | true | true |
f7f5a6d24ae8d8102312982ab72dc82c86d62d15 | 788 | py | Python | src/antidote/lib/lazy/__init__.py | Finistere/dependency_manager | 5a183d46ac5d760944dc507d1281813d02d2c75e | [
"MIT"
] | null | null | null | src/antidote/lib/lazy/__init__.py | Finistere/dependency_manager | 5a183d46ac5d760944dc507d1281813d02d2c75e | [
"MIT"
] | null | null | null | src/antidote/lib/lazy/__init__.py | Finistere/dependency_manager | 5a183d46ac5d760944dc507d1281813d02d2c75e | [
"MIT"
] | null | null | null | from .constant import (
Const,
Constant,
ConstantFactory,
ConstantValueProviderFunction,
TypedConstantFactory,
ConstantValueProvider,
)
from .lazy import lazy, LazyWrappedFunction
from ..._internal import API
__all__ = [
"ConstantFactory",
"TypedConstantFactory",
"ConstantValueProv... | 18.325581 | 44 | 0.706853 | from .constant import (
Const,
Constant,
ConstantFactory,
ConstantValueProviderFunction,
TypedConstantFactory,
ConstantValueProvider,
)
from .lazy import lazy, LazyWrappedFunction
from ..._internal import API
__all__ = [
"ConstantFactory",
"TypedConstantFactory",
"ConstantValueProv... | true | true |
f7f5a6d6911455764ba26f751a9e0e2614ddceea | 722 | py | Python | tests/extmod/urandom_basic.py | rxchen/micropython | 037b2c72a1d5b54a5508a58ab2044628a7a39fa4 | [
"MIT"
] | 13,648 | 2015-01-01T01:34:51.000Z | 2022-03-31T16:19:53.000Z | tests/extmod/urandom_basic.py | rxchen/micropython | 037b2c72a1d5b54a5508a58ab2044628a7a39fa4 | [
"MIT"
] | 7,092 | 2015-01-01T07:59:11.000Z | 2022-03-31T23:52:18.000Z | tests/extmod/urandom_basic.py | rxchen/micropython | 037b2c72a1d5b54a5508a58ab2044628a7a39fa4 | [
"MIT"
] | 4,942 | 2015-01-02T11:48:50.000Z | 2022-03-31T19:57:10.000Z | try:
import urandom as random
except ImportError:
try:
import random
except ImportError:
print("SKIP")
raise SystemExit
# check getrandbits returns a value within the bit range
for b in (1, 2, 3, 4, 16, 32):
for i in range(50):
assert random.getrandbits(b) < (1 << b)
# ... | 21.878788 | 56 | 0.68144 | try:
import urandom as random
except ImportError:
try:
import random
except ImportError:
print("SKIP")
raise SystemExit
for b in (1, 2, 3, 4, 16, 32):
for i in range(50):
assert random.getrandbits(b) < (1 << b)
random.seed(0)
print(random.getrandbits(16) != 0)
rando... | true | true |
f7f5a6e86c4bd5c0356b3aa92255f319f2f13124 | 7,874 | py | Python | mixmo/core/loss.py | JiarunLiu/mixmo-pytorch | a9ad674122d9b6512094b8292280a4045bb5a400 | [
"Apache-2.0"
] | 72 | 2021-03-26T12:34:52.000Z | 2022-03-27T06:39:57.000Z | mixmo/core/loss.py | JiarunLiu/mixmo-pytorch | a9ad674122d9b6512094b8292280a4045bb5a400 | [
"Apache-2.0"
] | 7 | 2021-08-06T02:13:54.000Z | 2022-02-08T01:20:32.000Z | mixmo/core/loss.py | JiarunLiu/mixmo-pytorch | a9ad674122d9b6512094b8292280a4045bb5a400 | [
"Apache-2.0"
] | 15 | 2021-04-10T17:34:45.000Z | 2022-03-02T11:49:34.000Z | """
Base loss definitions
"""
from collections import OrderedDict
import copy
import torch
import torch.nn as nn
from mixmo.utils import misc, logger
LOGGER = logger.get_logger(__name__, level="DEBUG")
class AbstractLoss(nn.modules.loss._Loss):
"""
Base loss class defining printing and logging utilies
"... | 32.945607 | 99 | 0.604648 | from collections import OrderedDict
import copy
import torch
import torch.nn as nn
from mixmo.utils import misc, logger
LOGGER = logger.get_logger(__name__, level="DEBUG")
class AbstractLoss(nn.modules.loss._Loss):
def __init__(self, config_args, device, config_loss=None):
self.device = device
s... | true | true |
f7f5a71c2e457365064ffae96243d732cf2df886 | 946 | py | Python | setup.py | rajibchakravorty/QDataSet | 8eb21b8c7dad5654358021dd73b93ab90443f6d0 | [
"MIT"
] | null | null | null | setup.py | rajibchakravorty/QDataSet | 8eb21b8c7dad5654358021dd73b93ab90443f6d0 | [
"MIT"
] | null | null | null | setup.py | rajibchakravorty/QDataSet | 8eb21b8c7dad5654358021dd73b93ab90443f6d0 | [
"MIT"
] | null | null | null | """Set up for qmldataset package
"""
import setuptools
# with open("README.md", "r", encoding="utf-8") as fh:
# long_description = fh.read()
setuptools.setup(
name="qmldataset",
version="0.1.0",
author="Rajib Chakravorty",
author_email="4748396+rajibchakravorty@users.noreply.github.com",
desc... | 32.62069 | 90 | 0.655391 |
import setuptools
setuptools.setup(
name="qmldataset",
version="0.1.0",
author="Rajib Chakravorty",
author_email="4748396+rajibchakravorty@users.noreply.github.com",
description="Synthetic data generator for ML applications in Quantum Hardware system",
long_description="",
long_descript... | true | true |
f7f5a7aac926c7d5197ded9047c24bae9c5020b3 | 3,895 | py | Python | caffe2/python/operator_test/mkl_speed_test.py | KevinKecc/caffe2 | a2b6c6e2f0686358a84277df65e9489fb7d9ddb2 | [
"Apache-2.0"
] | 58 | 2019-01-03T02:20:41.000Z | 2022-02-25T14:24:13.000Z | caffe2/python/operator_test/mkl_speed_test.py | KevinKecc/caffe2 | a2b6c6e2f0686358a84277df65e9489fb7d9ddb2 | [
"Apache-2.0"
] | 27 | 2018-04-14T06:44:22.000Z | 2018-08-01T18:02:39.000Z | caffe2/python/operator_test/mkl_speed_test.py | KevinKecc/caffe2 | a2b6c6e2f0686358a84277df65e9489fb7d9ddb2 | [
"Apache-2.0"
] | 23 | 2018-04-13T10:47:31.000Z | 2021-05-06T08:38:06.000Z | # Copyright (c) 2016-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | 40.572917 | 84 | 0.63543 | true | true | |
f7f5a8054c4429dd898a8fa648632b6869d56a41 | 2,852 | py | Python | sendSMSSkillLambda/package/ask_sdk_model/interfaces/geolocation/geolocation_interface.py | shneydor/aws-alexa-lambda-workshop | 0fa6b7067b04fc85c46b9ce1c2cc04554ed5baf4 | [
"Apache-2.0"
] | null | null | null | sendSMSSkillLambda/package/ask_sdk_model/interfaces/geolocation/geolocation_interface.py | shneydor/aws-alexa-lambda-workshop | 0fa6b7067b04fc85c46b9ce1c2cc04554ed5baf4 | [
"Apache-2.0"
] | null | null | null | sendSMSSkillLambda/package/ask_sdk_model/interfaces/geolocation/geolocation_interface.py | shneydor/aws-alexa-lambda-workshop | 0fa6b7067b04fc85c46b9ce1c2cc04554ed5baf4 | [
"Apache-2.0"
] | 1 | 2019-10-11T17:15:20.000Z | 2019-10-11T17:15:20.000Z | # 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... | 29.102041 | 96 | 0.565217 |
import pprint
import re
import six
import typing
from enum import Enum
if typing.TYPE_CHECKING:
from typing import Dict, List, Optional, Union
from datetime import datetime
class GeolocationInterface(object):
deserialized_types = {
}
attribute_map = {
}
def __init_... | true | true |
f7f5a8705d3c517124eae802368d5bf49e085781 | 47,821 | py | Python | google/cloud/notebooks_v1/services/notebook_service/transports/grpc.py | LaudateCorpus1/python-notebooks | 72925babe34fb97639336e443b2ee588d6727680 | [
"Apache-2.0"
] | 17 | 2020-09-19T18:30:50.000Z | 2022-03-15T11:35:50.000Z | google/cloud/notebooks_v1/services/notebook_service/transports/grpc.py | LaudateCorpus1/python-notebooks | 72925babe34fb97639336e443b2ee588d6727680 | [
"Apache-2.0"
] | 42 | 2020-08-05T00:16:45.000Z | 2022-03-07T17:06:48.000Z | google/cloud/notebooks_v1/services/notebook_service/transports/grpc.py | LaudateCorpus1/python-notebooks | 72925babe34fb97639336e443b2ee588d6727680 | [
"Apache-2.0"
] | 5 | 2020-08-04T23:40:58.000Z | 2022-03-13T19:02:02.000Z | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 43.198735 | 90 | 0.638255 |
import warnings
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
from google.api_core import grpc_helpers
from google.api_core import operations_v1
from google.api_core import gapic_v1
import google.auth
from google.auth import credentials as ga_credentials
from google.auth.transp... | true | true |
f7f5a8b1312d0b9e0bf9392e892850a42ae60dc6 | 4,146 | py | Python | pgoapi/protos/pogoprotos/networking/requests/messages/add_fort_modifier_message_pb2.py | linherest/pgoapi | e3bdce71b06c099663e9796c8df166883059edd9 | [
"MIT"
] | 14 | 2017-03-28T16:32:24.000Z | 2021-03-13T23:03:57.000Z | pgoapi/protos/pogoprotos/networking/requests/messages/add_fort_modifier_message_pb2.py | linherest/pgoapi | e3bdce71b06c099663e9796c8df166883059edd9 | [
"MIT"
] | 8 | 2017-03-01T07:56:09.000Z | 2017-08-15T07:37:12.000Z | pgoapi/protos/pogoprotos/networking/requests/messages/add_fort_modifier_message_pb2.py | linherest/pgoapi | e3bdce71b06c099663e9796c8df166883059edd9 | [
"MIT"
] | 15 | 2017-02-24T01:30:23.000Z | 2021-06-27T08:46:43.000Z | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/networking/requests/messages/add_fort_modifier_message.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as... | 44.106383 | 466 | 0.790159 |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google... | true | true |
f7f5a913b1a8d7482826a294101b9d878c06db31 | 162 | py | Python | CodingBat/Warmup-1/diff21.py | N-l1/dmoj | bbd55ab45731774385805eb31ea790454a3a6819 | [
"MIT"
] | null | null | null | CodingBat/Warmup-1/diff21.py | N-l1/dmoj | bbd55ab45731774385805eb31ea790454a3a6819 | [
"MIT"
] | null | null | null | CodingBat/Warmup-1/diff21.py | N-l1/dmoj | bbd55ab45731774385805eb31ea790454a3a6819 | [
"MIT"
] | null | null | null | """
Warmup-1 > diff21
Find this problem at:
https://codingbat.com/prob/p197466
"""
def diff21(n):
if n > 21:
return abs(2*(n-21))
return 21 - n
| 13.5 | 34 | 0.58642 |
def diff21(n):
if n > 21:
return abs(2*(n-21))
return 21 - n
| true | true |
f7f5ab09d521d1856fbecab111d78475713ab1df | 114,757 | py | Python | jenkins_jobs/modules/triggers.py | temeo/jenkins-job-builder | 9337c8d61497316ed832c427ee5cc8ebadf27a03 | [
"Apache-2.0"
] | null | null | null | jenkins_jobs/modules/triggers.py | temeo/jenkins-job-builder | 9337c8d61497316ed832c427ee5cc8ebadf27a03 | [
"Apache-2.0"
] | null | null | null | jenkins_jobs/modules/triggers.py | temeo/jenkins-job-builder | 9337c8d61497316ed832c427ee5cc8ebadf27a03 | [
"Apache-2.0"
] | 1 | 2022-03-31T07:54:13.000Z | 2022-03-31T07:54:13.000Z | # Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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... | 41.338977 | 98 | 0.612093 |
import logging
import pkg_resources
import re
import sys
import xml.etree.ElementTree as XML
import six
from jenkins_jobs.errors import InvalidAttributeError
from jenkins_jobs.errors import JenkinsJobsException
from jenkins_jobs.errors import MissingAttributeError
import jenkins_jobs.modules.base
from... | true | true |
f7f5ab402543350738c8f26b34c5651f4a0db17e | 1,824 | py | Python | transformer_model/masker.py | zbloss/TransformerModel | da4712fe5631accd22156f129e69c98b4ffe1146 | [
"MIT"
] | 61 | 2019-08-18T20:21:25.000Z | 2021-07-22T03:17:51.000Z | transformer_model/masker.py | zbloss/TransformerModel | da4712fe5631accd22156f129e69c98b4ffe1146 | [
"MIT"
] | 1 | 2019-08-18T20:31:51.000Z | 2019-08-19T01:11:41.000Z | transformer_model/masker.py | zbloss/TransformerModel | da4712fe5631accd22156f129e69c98b4ffe1146 | [
"MIT"
] | 10 | 2019-08-19T05:36:15.000Z | 2021-08-04T14:12:54.000Z | import tensorflow as tf
class Masker(object):
def __init__(self):
"""
This class holds a collection of masking functions that are used across the entire package.
"""
@staticmethod
def create_padding_mask(seq):
"""
:param seq: the sequence to mask
:return: ... | 33.777778 | 106 | 0.63432 | import tensorflow as tf
class Masker(object):
def __init__(self):
@staticmethod
def create_padding_mask(seq):
seq = tf.cast(tf.math.equal(seq, 0), tf.float32)
return seq[:, tf.newaxis, tf.newaxis, :]
@staticmethod
def create_look_ahead_mask(size):
mask... | true | true |
f7f5add40d638e0ae6100797e88af42c838f64a1 | 2,925 | py | Python | tests/ObjectTree.py | PJB3005/ByondToolsv3 | da80d87d474e83f13350acb730173d21e9a6e1ff | [
"MIT"
] | 2 | 2016-11-28T18:26:46.000Z | 2016-11-29T13:27:38.000Z | tests/ObjectTree.py | PJB3005/ByondToolsv3 | da80d87d474e83f13350acb730173d21e9a6e1ff | [
"MIT"
] | 3 | 2016-11-19T04:01:32.000Z | 2020-06-06T12:39:01.000Z | tests/ObjectTree.py | PJB3005/ByondToolsv3 | da80d87d474e83f13350acb730173d21e9a6e1ff | [
"MIT"
] | 2 | 2017-05-18T05:59:23.000Z | 2020-06-06T11:27:59.000Z | '''
Created on Jan 5, 2014
@author: Rob
'''
import unittest
class ObjectTreeTests(unittest.TestCase):
def setUp(self):
from byond.objtree import ObjectTree
self.tree = ObjectTree()
def test_consumeVariable_basics(self):
test_string = 'var/obj/item/weapon/chainsaw = new'
... | 39 | 66 | 0.62735 | import unittest
class ObjectTreeTests(unittest.TestCase):
def setUp(self):
from byond.objtree import ObjectTree
self.tree = ObjectTree()
def test_consumeVariable_basics(self):
test_string = 'var/obj/item/weapon/chainsaw = new'
name, data = self.tree.consumeVariable(test... | true | true |
f7f5ae86640c93cc2f1dfe6dd1ac1d60fa07919b | 343 | py | Python | PYSection508/PDFAudit.py | bengjerstad/PDF | 289a304f0c755d604de621165c5a53becc8ab11f | [
"MIT"
] | null | null | null | PYSection508/PDFAudit.py | bengjerstad/PDF | 289a304f0c755d604de621165c5a53becc8ab11f | [
"MIT"
] | null | null | null | PYSection508/PDFAudit.py | bengjerstad/PDF | 289a304f0c755d604de621165c5a53becc8ab11f | [
"MIT"
] | null | null | null | from pdfrw import PdfReader, PdfWriter
import os
defaultlang = '(en-US)'
#read all files in the folder called 'files'
files = os.listdir('files')
for file in files:
print(file)
trailer = PdfReader('files\\'+file)
print("Lang: ",trailer.Root.Lang)
print("Title: ",trailer.Info.Title)
print("MarkInfo: ",trailer.Roo... | 22.866667 | 44 | 0.71137 | from pdfrw import PdfReader, PdfWriter
import os
defaultlang = '(en-US)'
files = os.listdir('files')
for file in files:
print(file)
trailer = PdfReader('files\\'+file)
print("Lang: ",trailer.Root.Lang)
print("Title: ",trailer.Info.Title)
print("MarkInfo: ",trailer.Root.MarkInfo)
print("")
| true | true |
f7f5b066a218c8a3aa63aa68f035a8eeab67da95 | 998 | py | Python | tests/zolegame/room_test.py | marisabele/Zole | 19ab7b417ad54d1072b010d62a09b7ff9d7c1fd0 | [
"Apache-2.0"
] | 2 | 2017-10-31T21:45:16.000Z | 2018-12-09T15:51:48.000Z | tests/zolegame/room_test.py | marisabele/Zole | 19ab7b417ad54d1072b010d62a09b7ff9d7c1fd0 | [
"Apache-2.0"
] | null | null | null | tests/zolegame/room_test.py | marisabele/Zole | 19ab7b417ad54d1072b010d62a09b7ff9d7c1fd0 | [
"Apache-2.0"
] | null | null | null | import unittest
from zolegame.room import Room
from zolegame.player import Player
from bots.random_player import RandomPlayer
from zolegame.players import PlayerInterface
class RoomTest(unittest.TestCase):
def setUp(self):
self.playerA = PlayerInterface()
self.playerB = PlayerInterface(... | 34.413793 | 55 | 0.621242 | import unittest
from zolegame.room import Room
from zolegame.player import Player
from bots.random_player import RandomPlayer
from zolegame.players import PlayerInterface
class RoomTest(unittest.TestCase):
def setUp(self):
self.playerA = PlayerInterface()
self.playerB = PlayerInterface(... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.