hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k โ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 โ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 โ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k โ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 โ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 โ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k โ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 โ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 โ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7486b905e9f76e705f824626c61ea7b0fff7e07 | 2,973 | py | Python | dataset/iam_handwriting_word_database.py | belosthomas/socr-text | 6aa143abbc62ca1f8f582eecb3b6e0b055c1aadb | [
"MIT"
] | 1 | 2018-08-22T06:59:21.000Z | 2018-08-22T06:59:21.000Z | dataset/iam_handwriting_word_database.py | belosthomas/socr-text | 6aa143abbc62ca1f8f582eecb3b6e0b055c1aadb | [
"MIT"
] | null | null | null | dataset/iam_handwriting_word_database.py | belosthomas/socr-text | 6aa143abbc62ca1f8f582eecb3b6e0b055c1aadb | [
"MIT"
] | null | null | null | import os
from os.path import isfile
from lxml import etree
import torch
from PIL import Image
from torch.utils.data.dataset import Dataset
from utils.image import image_pillow_to_numpy
class IAMHandwritingWordDatabase(Dataset):
def __init__(self, path, height=32, loss=None):
self.height = height
... | 31.967742 | 158 | 0.536831 | import os
from os.path import isfile
from lxml import etree
import torch
from PIL import Image
from torch.utils.data.dataset import Dataset
from utils.image import image_pillow_to_numpy
class IAMHandwritingWordDatabase(Dataset):
def __init__(self, path, height=32, loss=None):
self.height = height
... | true | true |
f7486d4460a98a3067c26ffffd168e9badc41f57 | 991 | py | Python | twitoff/predict.py | DanielMartinAlarcon/TwitOff | b3686714d28756b3abdb537b86b79ada6ce43aa5 | [
"MIT"
] | null | null | null | twitoff/predict.py | DanielMartinAlarcon/TwitOff | b3686714d28756b3abdb537b86b79ada6ce43aa5 | [
"MIT"
] | 3 | 2021-03-18T22:51:44.000Z | 2021-09-08T00:59:24.000Z | twitoff/predict.py | DanielMartinAlarcon/TwitOff | b3686714d28756b3abdb537b86b79ada6ce43aa5 | [
"MIT"
] | null | null | null | """Prediction of Users based on Tweet embeddings."""
import numpy as np
from sklearn.linear_model import LogisticRegression
from .models import User
from .twitter import BASILICA
def predict_user(user1_name, user2_name, tweet_text, cache=None):
"""Determine and return which user is more likely to say a given Twee... | 52.157895 | 78 | 0.729566 | import numpy as np
from sklearn.linear_model import LogisticRegression
from .models import User
from .twitter import BASILICA
def predict_user(user1_name, user2_name, tweet_text, cache=None):
user1 = User.query.filter(User.name == user1_name).one()
user2 = User.query.filter(User.name == user2_name).one()
... | true | true |
f7486df80150c6969f1fee1e4596bf55e2515321 | 256 | py | Python | src/SRM-147/ccipher.py | mikefeneley/topcoder | 175a7a05367c0458a900a3fea16af68ae5ee53ec | [
"MIT"
] | null | null | null | src/SRM-147/ccipher.py | mikefeneley/topcoder | 175a7a05367c0458a900a3fea16af68ae5ee53ec | [
"MIT"
] | null | null | null | src/SRM-147/ccipher.py | mikefeneley/topcoder | 175a7a05367c0458a900a3fea16af68ae5ee53ec | [
"MIT"
] | null | null | null | class CCipher:
def decode(self, cipherText, shift):
decode_txt = ""
for char in cipherText:
new = chr(ord(char) - shift)
if(new < 'A'):
new = chr(ord(new) + ord('Z') - ord('A') + 1)
decode_txt = decode_txt + new
return decode_txt
| 19.692308 | 49 | 0.597656 | class CCipher:
def decode(self, cipherText, shift):
decode_txt = ""
for char in cipherText:
new = chr(ord(char) - shift)
if(new < 'A'):
new = chr(ord(new) + ord('Z') - ord('A') + 1)
decode_txt = decode_txt + new
return decode_txt
| true | true |
f7486e04c7d51b691516e79885ad3aa192e49f5e | 3,588 | py | Python | lib/python3.8/site-packages/ansible_collections/f5networks/f5_modules/plugins/doc_fragments/f5_rest_cli.py | cjsteel/python3-venv-ansible-2.10.5 | c95395c4cae844dc66fddde9b4343966f4b2ecd5 | [
"Apache-1.1"
] | null | null | null | lib/python3.8/site-packages/ansible_collections/f5networks/f5_modules/plugins/doc_fragments/f5_rest_cli.py | cjsteel/python3-venv-ansible-2.10.5 | c95395c4cae844dc66fddde9b4343966f4b2ecd5 | [
"Apache-1.1"
] | null | null | null | lib/python3.8/site-packages/ansible_collections/f5networks/f5_modules/plugins/doc_fragments/f5_rest_cli.py | cjsteel/python3-venv-ansible-2.10.5 | c95395c4cae844dc66fddde9b4343966f4b2ecd5 | [
"Apache-1.1"
] | null | null | null | # -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
class ModuleDocFragment(object):
# Standard F5 documentation fragment
DOCUMENTATION = r'''
options:
pro... | 40.314607 | 128 | 0.659699 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
class ModuleDocFragment(object):
DOCUMENTATION = r'''
options:
provider:
description:
- A dict object containing connection details.
type: dict
version_added: "1.0.0"
suboptions:
password:
... | true | true |
f7486feddae2d322314e7631a1a3f281a6574198 | 11,178 | py | Python | perms_test.py | klokan/googlecrisismap | e31b68706f7a4921037b0e513703483f2ac3b830 | [
"Apache-2.0"
] | 40 | 2015-06-24T12:31:14.000Z | 2021-01-30T23:33:54.000Z | perms_test.py | klokan/googlecrisismap | e31b68706f7a4921037b0e513703483f2ac3b830 | [
"Apache-2.0"
] | 16 | 2015-07-30T14:24:42.000Z | 2021-02-24T22:30:56.000Z | perms_test.py | klokan/googlecrisismap | e31b68706f7a4921037b0e513703483f2ac3b830 | [
"Apache-2.0"
] | 27 | 2015-06-21T07:31:58.000Z | 2021-02-12T08:47:42.000Z | #!/usr/bin/python
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at: http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | 43.494163 | 80 | 0.703614 |
import domains
import model
import perms
import test_utils
def GetRolesForMap(map_object):
return {r for r in perms.MAP_ROLES if perms.CheckAccess(r, target=map_object)}
class PermsTests(test_utils.BaseTest):
def testUserRoles(self):
m = test_utils.CreateMap(
owners=['owner'], editor... | true | true |
f74873f707cbd05155e01008b4b20c2856b96d7a | 12,707 | py | Python | Lib/site-packages/wx/lib/throbber.py | 15008477526/- | e58e4879bd9001b4b27eafcbddce9daeadd5aa51 | [
"bzip2-1.0.6"
] | 3 | 2019-10-06T15:39:39.000Z | 2020-09-29T23:51:50.000Z | Venv-IDE/Lib/site-packages/wx/lib/throbber.py | myhumankit/Blind_IDE | 5262a5dd106f3f52a374a6c1ef68ff53d8847001 | [
"MIT"
] | 9 | 2021-03-18T23:10:27.000Z | 2022-03-11T23:43:55.000Z | Venv-IDE/Lib/site-packages/wx/lib/throbber.py | myhumankit/Blind_IDE | 5262a5dd106f3f52a374a6c1ef68ff53d8847001 | [
"MIT"
] | 2 | 2019-03-11T05:06:49.000Z | 2019-03-22T21:48:49.000Z | """
A throbber displays an animated image that can be
started, stopped, reversed, etc. Useful for showing
an ongoing process (like most web browsers use) or
simply for adding eye-candy to an application.
Throbbers utilize a wxTimer so that normal processing
can continue unencumbered.
"""
#
# throbber.py - Cliff Well... | 29.898824 | 93 | 0.564964 |
import os
import wx
THROBBER_EVENT = wx.NewEventType()
EVT_UPDATE_THROBBER = wx.PyEventBinder(THROBBER_EVENT, 0)
class UpdateThrobberEvent(wx.PyEvent):
def __init__(self):
wx.PyEvent.__init__(self)
self.SetEventType(THROBBER_EVENT)
class Throbber(wx.Panel):
def __init__(sel... | true | true |
f74875edc002a1e03f2b2745eeb98c1b119e6e61 | 4,482 | py | Python | tweets/api/views.py | nelsondude/tweetmymouth | b7614850189c21c18dc291b9167cc5afedacf386 | [
"MIT"
] | null | null | null | tweets/api/views.py | nelsondude/tweetmymouth | b7614850189c21c18dc291b9167cc5afedacf386 | [
"MIT"
] | null | null | null | tweets/api/views.py | nelsondude/tweetmymouth | b7614850189c21c18dc291b9167cc5afedacf386 | [
"MIT"
] | null | null | null | from rest_framework import generics
from django.db.models import Q
from rest_framework import permissions
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import authentication, permissions
from .serializers import TweetModelSerializer
from .pagination import St... | 36.145161 | 91 | 0.673583 | from rest_framework import generics
from django.db.models import Q
from rest_framework import permissions
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import authentication, permissions
from .serializers import TweetModelSerializer
from .pagination import St... | true | true |
f74875f48c7a3c575e6324b175d4b10fe8d0a101 | 2,826 | py | Python | alipay/aop/api/domain/Principal.py | snowxmas/alipay-sdk-python-all | 96870ced60facd96c5bce18d19371720cbda3317 | [
"Apache-2.0"
] | 213 | 2018-08-27T16:49:32.000Z | 2021-12-29T04:34:12.000Z | alipay/aop/api/domain/Principal.py | snowxmas/alipay-sdk-python-all | 96870ced60facd96c5bce18d19371720cbda3317 | [
"Apache-2.0"
] | 29 | 2018-09-29T06:43:00.000Z | 2021-09-02T03:27:32.000Z | alipay/aop/api/domain/Principal.py | snowxmas/alipay-sdk-python-all | 96870ced60facd96c5bce18d19371720cbda3317 | [
"Apache-2.0"
] | 59 | 2018-08-27T16:59:26.000Z | 2022-03-25T10:08:15.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class Principal(object):
def __init__(self):
self._cert_no = None
self._cert_type = None
self._signer_type = None
self._user_name = None
self._verify_type = None... | 27.980198 | 73 | 0.577495 |
import json
from alipay.aop.api.constant.ParamConstants import *
class Principal(object):
def __init__(self):
self._cert_no = None
self._cert_type = None
self._signer_type = None
self._user_name = None
self._verify_type = None
@property
def cert_no(self):
... | true | true |
f748777e615e4c57ce88fcf0cd17ccc89725b961 | 131 | py | Python | subaligner/__init__.py | baxtree/subaligner | 0a72a54d5271c6ce86b556860992584ef4a51012 | [
"MIT"
] | 227 | 2020-01-05T18:47:15.000Z | 2022-03-19T20:19:33.000Z | subaligner/__init__.py | baxtree/subaligner | 0a72a54d5271c6ce86b556860992584ef4a51012 | [
"MIT"
] | 43 | 2019-12-16T09:15:38.000Z | 2022-03-21T10:39:40.000Z | subaligner/__init__.py | baxtree/subaligner | 0a72a54d5271c6ce86b556860992584ef4a51012 | [
"MIT"
] | 9 | 2020-11-16T03:33:11.000Z | 2022-03-11T22:12:38.000Z | import multiprocessing as mp
from ._version import __version__
__all__ = ["__version__"]
mp.set_start_method("spawn", force=True)
| 21.833333 | 40 | 0.793893 | import multiprocessing as mp
from ._version import __version__
__all__ = ["__version__"]
mp.set_start_method("spawn", force=True)
| true | true |
f74877d45e0f9cc0ee28ac4e85f77b18123fd1bf | 2,504 | py | Python | script/DoggoBot.py | ruslanalas/BurgerTranslate | 01275483a87dedf216ed994e380253cbe74dcc2c | [
"MIT"
] | null | null | null | script/DoggoBot.py | ruslanalas/BurgerTranslate | 01275483a87dedf216ed994e380253cbe74dcc2c | [
"MIT"
] | null | null | null | script/DoggoBot.py | ruslanalas/BurgerTranslate | 01275483a87dedf216ed994e380253cbe74dcc2c | [
"MIT"
] | null | null | null | import logging
import re
import requests
from telegram.ext import Updater, Filters, CommandHandler, MessageHandler
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.NOTSET)
def get_url():
contents = requests.get('https://random.dog/woof.json').j... | 41.733333 | 203 | 0.696486 | import logging
import re
import requests
from telegram.ext import Updater, Filters, CommandHandler, MessageHandler
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.NOTSET)
def get_url():
contents = requests.get('https://random.dog/woof.json').j... | true | true |
f74880fb5bb0c9751a07a7983f2e9145905a210e | 8,220 | py | Python | train.py | AdamWang00/yolov3-tf2 | 956ebe38d3a90de585444b33fa1c01259434f701 | [
"MIT"
] | null | null | null | train.py | AdamWang00/yolov3-tf2 | 956ebe38d3a90de585444b33fa1c01259434f701 | [
"MIT"
] | 5 | 2021-08-25T15:14:21.000Z | 2022-02-10T06:10:26.000Z | train.py | AdamWang00/yolov3-tf2 | 956ebe38d3a90de585444b33fa1c01259434f701 | [
"MIT"
] | null | null | null | from absl import app, flags, logging
from absl.flags import FLAGS
import tensorflow as tf
import numpy as np
import cv2
from tensorflow.keras.callbacks import (
ReduceLROnPlateau,
EarlyStopping,
ModelCheckpoint,
TensorBoard
)
from yolov3_tf2.models import (
YoloV3, YoloV3Tiny, YoloLoss,
yolo_an... | 41.515152 | 103 | 0.61764 | from absl import app, flags, logging
from absl.flags import FLAGS
import tensorflow as tf
import numpy as np
import cv2
from tensorflow.keras.callbacks import (
ReduceLROnPlateau,
EarlyStopping,
ModelCheckpoint,
TensorBoard
)
from yolov3_tf2.models import (
YoloV3, YoloV3Tiny, YoloLoss,
yolo_an... | true | true |
f74881ebbf1f3fffe0c32cb688d7f30359439fb9 | 9,151 | py | Python | monai/transforms/croppad/array.py | xidchen/MONAI | 4eae383f1abbbb62a69e054c016a3b4e53af3ea7 | [
"Apache-2.0"
] | null | null | null | monai/transforms/croppad/array.py | xidchen/MONAI | 4eae383f1abbbb62a69e054c016a3b4e53af3ea7 | [
"Apache-2.0"
] | null | null | null | monai/transforms/croppad/array.py | xidchen/MONAI | 4eae383f1abbbb62a69e054c016a3b4e53af3ea7 | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, s... | 46.217172 | 119 | 0.664627 |
from typing import Optional, Callable
import numpy as np
from monai.data.utils import get_random_patch, get_valid_patch_size
from monai.transforms.compose import Transform, Randomizable
from monai.transforms.utils import generate_spatial_bounding_box
from monai.utils.misc import ensure_tuple, ensure_tuple_... | true | true |
f748826ea1f47b539eda529456ffc3475991ace2 | 2,989 | py | Python | ground/core/boxed.py | lycantropos/ground | ef6f54b8cb555af8d9202d621cac57a892ecb78d | [
"MIT"
] | 4 | 2021-05-15T19:15:56.000Z | 2021-11-30T06:19:47.000Z | ground/core/boxed.py | lycantropos/ground | ef6f54b8cb555af8d9202d621cac57a892ecb78d | [
"MIT"
] | null | null | null | ground/core/boxed.py | lycantropos/ground | ef6f54b8cb555af8d9202d621cac57a892ecb78d | [
"MIT"
] | null | null | null | from typing import (Iterable,
Tuple,
Type)
from .hints import (Box,
Contour,
Point,
Polygon,
Scalar,
Segment)
def from_contour(contour: Contour, box_cls: Type[Box]) -> Box:
... | 32.48913 | 77 | 0.61994 | from typing import (Iterable,
Tuple,
Type)
from .hints import (Box,
Contour,
Point,
Polygon,
Scalar,
Segment)
def from_contour(contour: Contour, box_cls: Type[Box]) -> Box:
... | true | true |
f7488354934b2a58344c43d9b24cc83e8f441d74 | 485 | py | Python | tests/test_my_module.py | sverhoeven/justatest2 | 4fd45a4d962dc638f68cf27e594071e3e5213aa2 | [
"Apache-2.0"
] | null | null | null | tests/test_my_module.py | sverhoeven/justatest2 | 4fd45a4d962dc638f68cf27e594071e3e5213aa2 | [
"Apache-2.0"
] | 11 | 2021-05-04T07:21:53.000Z | 2021-05-10T11:12:56.000Z | tests/test_my_module.py | sverhoeven/justatest2 | 4fd45a4d962dc638f68cf27e594071e3e5213aa2 | [
"Apache-2.0"
] | null | null | null | """Tests for the justatest2.my_module module.
"""
import pytest
from justatest2.my_module import hello
def test_hello():
assert hello('nlesc') == 'Hello nlesc!'
def test_hello_with_error():
with pytest.raises(ValueError) as excinfo:
hello('nobody')
assert 'Can not say hello to nobody' in str(ex... | 19.4 | 62 | 0.71134 | import pytest
from justatest2.my_module import hello
def test_hello():
assert hello('nlesc') == 'Hello nlesc!'
def test_hello_with_error():
with pytest.raises(ValueError) as excinfo:
hello('nobody')
assert 'Can not say hello to nobody' in str(excinfo.value)
@pytest.fixture
def some_name():
... | true | true |
f7488524c58ac1adff3b13b2a7b7d351a845d649 | 144 | py | Python | malcolm/modules/scanning/parts/__init__.py | MattTaylorDLS/pymalcolm | 995a8e4729bd745f8f617969111cc5a34ce1ac14 | [
"Apache-2.0"
] | null | null | null | malcolm/modules/scanning/parts/__init__.py | MattTaylorDLS/pymalcolm | 995a8e4729bd745f8f617969111cc5a34ce1ac14 | [
"Apache-2.0"
] | null | null | null | malcolm/modules/scanning/parts/__init__.py | MattTaylorDLS/pymalcolm | 995a8e4729bd745f8f617969111cc5a34ce1ac14 | [
"Apache-2.0"
] | null | null | null | from .runnablechildpart import RunnableChildPart
# Expose all the classes
__all__ = sorted(k for k, v in globals().items() if type(v) == type)
| 28.8 | 68 | 0.743056 | from .runnablechildpart import RunnableChildPart
__all__ = sorted(k for k, v in globals().items() if type(v) == type)
| true | true |
f74885337c7f15803d266fbc7c3579cc458e2f8f | 1,663 | py | Python | Autoupdate/scatterinfluxtemp.py | Yuri-Njathi/Dash_Temperature_Plot | d911755fdf179a592df3e1683af91f60e68f5f65 | [
"MIT"
] | null | null | null | Autoupdate/scatterinfluxtemp.py | Yuri-Njathi/Dash_Temperature_Plot | d911755fdf179a592df3e1683af91f60e68f5f65 | [
"MIT"
] | null | null | null | Autoupdate/scatterinfluxtemp.py | Yuri-Njathi/Dash_Temperature_Plot | d911755fdf179a592df3e1683af91f60e68f5f65 | [
"MIT"
] | null | null | null | import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
from influxdb import InfluxDBClient
from pandas import DataFrame, Series
from pandas.io.json import json_normalize
from influxdb import InfluxDBClient
from datetime import datetime, timedelta
import plotly.graph_obj... | 25.984375 | 155 | 0.669272 | import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
from influxdb import InfluxDBClient
from pandas import DataFrame, Series
from pandas.io.json import json_normalize
from influxdb import InfluxDBClient
from datetime import datetime, timedelta
import plotly.graph_obj... | true | true |
f748856d3a833d5a3d3ac8ba1ff4071f38f24123 | 372 | py | Python | slide_06/exercicios/q06.py | lordjack/aula_python_slides | 38ad45ac1843fc83c3349addb9d49f7d182a574f | [
"MIT"
] | null | null | null | slide_06/exercicios/q06.py | lordjack/aula_python_slides | 38ad45ac1843fc83c3349addb9d49f7d182a574f | [
"MIT"
] | null | null | null | slide_06/exercicios/q06.py | lordjack/aula_python_slides | 38ad45ac1843fc83c3349addb9d49f7d182a574f | [
"MIT"
] | null | null | null | '''
6. Faรงa um programa em Python utilizando a biblioteca fractions,
para determinar o resultado da multiplicaรงรฃo entre as fraรงรตes:
1/2 x 3/2 x 6/7 x 9/3 = ?
- Resultado deve ser: 27/14
'''
import fractions
a = fractions.Fraction(1, 2)
b = fractions.Fraction(3, 2)
c = fractions.Fraction(6, 7)
d = fractions.Fraction(9,... | 21.882353 | 64 | 0.682796 | import fractions
a = fractions.Fraction(1, 2)
b = fractions.Fraction(3, 2)
c = fractions.Fraction(6, 7)
d = fractions.Fraction(9, 3)
r = a * b * c * d
print("O resultado รฉ: ", r)
| true | true |
f74885d08dac2d8e0c5e9356e2058d80a842af1e | 7,363 | py | Python | cirq-google/cirq_google/engine/abstract_local_program.py | Zshan0/Cirq | 93bbaa853305faa65117bcbdc2063f741cb2977c | [
"Apache-2.0"
] | 1 | 2022-02-02T07:13:54.000Z | 2022-02-02T07:13:54.000Z | cirq-google/cirq_google/engine/abstract_local_program.py | bradyb/Cirq | 610b0d4ea3a7862169610797266734c844ddcc1f | [
"Apache-2.0"
] | null | null | null | cirq-google/cirq_google/engine/abstract_local_program.py | bradyb/Cirq | 610b0d4ea3a7862169610797266734c844ddcc1f | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 35.570048 | 84 | 0.627462 |
import copy
import datetime
from typing import Dict, List, Optional, Sequence, Set, TYPE_CHECKING, Union
import cirq
from cirq_google.engine.client import quantum
from cirq_google.engine.abstract_program import AbstractProgram
if TYPE_CHECKING:
from cirq_google.engine.abstract_local_job import Abstrac... | true | true |
f7488654de586cc84331626f353a4e8556191870 | 398 | py | Python | posts/migrations/0003_auto_20200530_1519.py | Brenda-M/instagram-clone | 4f30d7168db6c6cc36c1ebf012771f6df1ce4975 | [
"MIT"
] | null | null | null | posts/migrations/0003_auto_20200530_1519.py | Brenda-M/instagram-clone | 4f30d7168db6c6cc36c1ebf012771f6df1ce4975 | [
"MIT"
] | 6 | 2021-03-30T13:40:47.000Z | 2022-01-13T02:48:38.000Z | posts/migrations/0003_auto_20200530_1519.py | Brenda-M/instagram-clone | 4f30d7168db6c6cc36c1ebf012771f6df1ce4975 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.6 on 2020-05-30 12:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posts', '0002_auto_20200529_1448'),
]
operations = [
migrations.AlterField(
model_name='image',
name='img_name',
... | 20.947368 | 63 | 0.603015 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posts', '0002_auto_20200529_1448'),
]
operations = [
migrations.AlterField(
model_name='image',
name='img_name',
field=models.CharField(blank=True, max... | true | true |
f7488714bd7b47e39d3a7d87ed1b1b792ff8fc8d | 6,539 | py | Python | app/pulzarcore/core_jobs.py | cleve/varidb | fc1b10aa4d708cee1c83909f10773948cee0c539 | [
"Apache-2.0"
] | null | null | null | app/pulzarcore/core_jobs.py | cleve/varidb | fc1b10aa4d708cee1c83909f10773948cee0c539 | [
"Apache-2.0"
] | 6 | 2020-11-05T02:18:15.000Z | 2022-03-12T00:50:09.000Z | app/pulzarcore/core_jobs.py | cleve/pulzar | fc1b10aa4d708cee1c83909f10773948cee0c539 | [
"Apache-2.0"
] | null | null | null | from abc import abstractmethod
from abc import ABCMeta
from pulzarutils.utils import Utils
from pulzarutils.utils import Constants
from pulzarutils.file_utils import FileUtils
from pulzarutils.constants import ReqType
from pulzarutils.stream import Config
from pulzarcore.core_rdb import RDB
from pulzarcore.core_request... | 33.362245 | 89 | 0.606209 | from abc import abstractmethod
from abc import ABCMeta
from pulzarutils.utils import Utils
from pulzarutils.utils import Constants
from pulzarutils.file_utils import FileUtils
from pulzarutils.constants import ReqType
from pulzarutils.stream import Config
from pulzarcore.core_rdb import RDB
from pulzarcore.core_request... | true | true |
f748880ba72b144cd2a47ad45f9d14205dbccb46 | 1,033 | py | Python | alipay/aop/api/domain/MybankCreditUserRoleQueryModel.py | articuly/alipay-sdk-python-all | 0259cd28eca0f219b97dac7f41c2458441d5e7a6 | [
"Apache-2.0"
] | null | null | null | alipay/aop/api/domain/MybankCreditUserRoleQueryModel.py | articuly/alipay-sdk-python-all | 0259cd28eca0f219b97dac7f41c2458441d5e7a6 | [
"Apache-2.0"
] | null | null | null | alipay/aop/api/domain/MybankCreditUserRoleQueryModel.py | articuly/alipay-sdk-python-all | 0259cd28eca0f219b97dac7f41c2458441d5e7a6 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.Member import Member
class MybankCreditUserRoleQueryModel(object):
def __init__(self):
self._member = None
@property
def member(self):
... | 22.955556 | 63 | 0.592449 |
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.Member import Member
class MybankCreditUserRoleQueryModel(object):
def __init__(self):
self._member = None
@property
def member(self):
return self._member
@member.setter
... | true | true |
f7488a56d2960275c585d5153dbecf40c83081b4 | 8,854 | py | Python | napalm_yang/models/openconfig/interfaces/interface/ethernet/switched_vlan/__init__.py | ckishimo/napalm-yang | 8f2bd907bd3afcde3c2f8e985192de74748baf6c | [
"Apache-2.0"
] | 64 | 2016-10-20T15:47:18.000Z | 2021-11-11T11:57:32.000Z | napalm_yang/models/openconfig/interfaces/interface/ethernet/switched_vlan/__init__.py | ckishimo/napalm-yang | 8f2bd907bd3afcde3c2f8e985192de74748baf6c | [
"Apache-2.0"
] | 126 | 2016-10-05T10:36:14.000Z | 2019-05-15T08:43:23.000Z | napalm_yang/models/openconfig/interfaces/interface/ethernet/switched_vlan/__init__.py | ckishimo/napalm-yang | 8f2bd907bd3afcde3c2f8e985192de74748baf6c | [
"Apache-2.0"
] | 63 | 2016-11-07T15:23:08.000Z | 2021-09-22T14:41:16.000Z | # -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | 36.891667 | 353 | 0.603682 |
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.y... | true | true |
f7488b4ab7511b54fd9793320413862364d2a611 | 8,870 | py | Python | augur/housekeeper/housekeeper.py | parthsharma2/augur | 6d59c8c80f3c21eb97bfa4ea4817908ea9a7d10b | [
"MIT"
] | null | null | null | augur/housekeeper/housekeeper.py | parthsharma2/augur | 6d59c8c80f3c21eb97bfa4ea4817908ea9a7d10b | [
"MIT"
] | null | null | null | augur/housekeeper/housekeeper.py | parthsharma2/augur | 6d59c8c80f3c21eb97bfa4ea4817908ea9a7d10b | [
"MIT"
] | null | null | null | import logging
import requests
from multiprocessing import Process, Queue
import time
import sqlalchemy as s
import pandas as pd
import os
import zmq
logging.basicConfig(filename='housekeeper.log')
class Housekeeper:
def __init__(self, jobs, broker, broker_port, user, password, host, port, dbname):
self.... | 40.135747 | 155 | 0.495265 | import logging
import requests
from multiprocessing import Process, Queue
import time
import sqlalchemy as s
import pandas as pd
import os
import zmq
logging.basicConfig(filename='housekeeper.log')
class Housekeeper:
def __init__(self, jobs, broker, broker_port, user, password, host, port, dbname):
self.... | true | true |
f7488bb055279adf219064b358ed7a46cbaeef33 | 1,480 | py | Python | python/ray/data/tests/test_mars.py | mgelbart/ray | 4cec2286572e368a4bd64aae467751a384eff62d | [
"Apache-2.0"
] | 1 | 2022-03-07T06:40:06.000Z | 2022-03-07T06:40:06.000Z | python/ray/data/tests/test_mars.py | mgelbart/ray | 4cec2286572e368a4bd64aae467751a384eff62d | [
"Apache-2.0"
] | 73 | 2021-09-25T07:11:39.000Z | 2022-03-26T07:10:59.000Z | python/ray/data/tests/test_mars.py | mgelbart/ray | 4cec2286572e368a4bd64aae467751a384eff62d | [
"Apache-2.0"
] | 1 | 2019-09-24T16:24:49.000Z | 2019-09-24T16:24:49.000Z | import pytest
import ray
import mars
import mars.dataframe as md
import pyarrow as pa
@pytest.fixture(scope="module")
def ray_start_regular(request): # pragma: no cover
try:
yield ray.init(num_cpus=16)
finally:
ray.shutdown()
def test_mars(ray_start_regular):
import pandas as pd
cl... | 25.964912 | 83 | 0.623649 | import pytest
import ray
import mars
import mars.dataframe as md
import pyarrow as pa
@pytest.fixture(scope="module")
def ray_start_regular(request):
try:
yield ray.init(num_cpus=16)
finally:
ray.shutdown()
def test_mars(ray_start_regular):
import pandas as pd
cluster = mars.new_c... | true | true |
f7488c2d30bb79ca0eba3c8e4b60c55c3c42c3ed | 12,172 | py | Python | pythonpy/pyeval.py | scauligi/pythonpy-fork | 76d643465fde751ed7818242d80d7fbbde6dcd52 | [
"BSD-3-Clause"
] | null | null | null | pythonpy/pyeval.py | scauligi/pythonpy-fork | 76d643465fde751ed7818242d80d7fbbde6dcd52 | [
"BSD-3-Clause"
] | null | null | null | pythonpy/pyeval.py | scauligi/pythonpy-fork | 76d643465fde751ed7818242d80d7fbbde6dcd52 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
from __future__ import (unicode_literals, absolute_import,
print_function, division)
from functools import lru_cache
from itertools import count, islice
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL)
import argparse
import collections
import collec... | 33.256831 | 111 | 0.538942 |
from __future__ import (unicode_literals, absolute_import,
print_function, division)
from functools import lru_cache
from itertools import count, islice
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL)
import argparse
import collections
import collections.abc
import conte... | true | true |
f7488c6511b7aa1837ec983104d11586dd32e326 | 7,290 | py | Python | src/text_corpus/util.py | issa-project/knowledge-graph | e3f70de3248534672a32fbdc7d3768db1a0122e5 | [
"Apache-2.0"
] | null | null | null | src/text_corpus/util.py | issa-project/knowledge-graph | e3f70de3248534672a32fbdc7d3768db1a0122e5 | [
"Apache-2.0"
] | null | null | null | src/text_corpus/util.py | issa-project/knowledge-graph | e3f70de3248534672a32fbdc7d3768db1a0122e5 | [
"Apache-2.0"
] | 1 | 2021-06-10T08:21:03.000Z | 2021-06-10T08:21:03.000Z | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 8 16:35:35 2021
@author: abobashe
"""
import os
import datetime
import logging
import sys
#%%
def always_log_exceptions(exctype, value, tb):
#read last element in hope that this is the one we need
#TODO:refactor
logger=[logging.getLogger(name) for name... | 27.100372 | 147 | 0.611385 |
import os
import datetime
import logging
import sys
def always_log_exceptions(exctype, value, tb):
logger=[logging.getLogger(name) for name in logging.root.manager.loggerDict][-1]
logger.exception('Uncaught exception', exc_info=(exctype, value, tb))
def open_timestamp_logger(l... | true | true |
f7488cb9c35433dbe8c185ae5443d2e97f6c91f6 | 1,154 | py | Python | test/programytest/config/file/test_load_files.py | whackur/chatbot | bb4b4dace89f1f8aae2b6377bf7d2601e66af7a7 | [
"MIT"
] | 2 | 2018-06-16T09:32:22.000Z | 2019-07-21T13:16:00.000Z | test/programytest/config/file/test_load_files.py | whackur/chatbot | bb4b4dace89f1f8aae2b6377bf7d2601e66af7a7 | [
"MIT"
] | 3 | 2020-07-16T04:00:42.000Z | 2021-03-31T18:52:22.000Z | test/programytest/config/file/test_load_files.py | whackur/chatbot | bb4b4dace89f1f8aae2b6377bf7d2601e66af7a7 | [
"MIT"
] | 4 | 2018-06-29T23:50:44.000Z | 2020-11-05T08:13:47.000Z | import os
from programy.config.file.factory import ConfigurationFactory
from programy.clients.events.console.config import ConsoleConfiguration
from programytest.config.file.base_file_tests import ConfigurationBaseFileTests
# Hint
# Created the appropriate yaml file, then convert to json and xml using the following ... | 44.384615 | 149 | 0.80156 | import os
from programy.config.file.factory import ConfigurationFactory
from programy.clients.events.console.config import ConsoleConfiguration
from programytest.config.file.base_file_tests import ConfigurationBaseFileTests
class LoadConfigurationDataTests(ConfigurationBaseFileTests):
def test_load_config_d... | true | true |
f7488e6ec93852f4e8599b1f6b8d23b39c0f7403 | 648 | py | Python | setup.py | juzb/torchsupport | 30c3f6987e28aefdc90d6a6be6aa21e6714df366 | [
"MIT"
] | null | null | null | setup.py | juzb/torchsupport | 30c3f6987e28aefdc90d6a6be6aa21e6714df366 | [
"MIT"
] | null | null | null | setup.py | juzb/torchsupport | 30c3f6987e28aefdc90d6a6be6aa21e6714df366 | [
"MIT"
] | 1 | 2020-04-24T10:32:22.000Z | 2020-04-24T10:32:22.000Z | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="torchsupport",
version="0.0.1",
author="Michael Jendrusch",
author_email="jendrusch@stud.uni-heidelberg.de",
description="Support for advanced pytorch usage.",
long_description=long_de... | 29.454545 | 54 | 0.677469 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="torchsupport",
version="0.0.1",
author="Michael Jendrusch",
author_email="jendrusch@stud.uni-heidelberg.de",
description="Support for advanced pytorch usage.",
long_description=long_de... | true | true |
f7488e701ca8f6986dc71fb3c64ce4dd5db03954 | 647 | py | Python | examples/prompts/validate-input.py | gerrishons/quo | 58a1c54105e3663d62e473f8dad57a2cf1b8cc20 | [
"MIT"
] | 5 | 2021-06-17T21:06:39.000Z | 2022-03-11T06:45:51.000Z | examples/prompts/validate-input.py | gerrishons/quo | 58a1c54105e3663d62e473f8dad57a2cf1b8cc20 | [
"MIT"
] | 39 | 2021-07-19T19:36:18.000Z | 2022-02-23T14:55:08.000Z | examples/prompts/validate-input.py | gerrishons/quo | 58a1c54105e3663d62e473f8dad57a2cf1b8cc20 | [
"MIT"
] | 1 | 2021-05-31T17:19:15.000Z | 2021-05-31T17:19:15.000Z | import quo
session = quo.Prompt()
class NumberValidator(quo.types.Validator):
def validate(self, document):
text = document.text
if text and not text.isdigit():
i = 0
# Get index of first non numeric character.
# We want to move the cursor here.
... | 24.884615 | 110 | 0.601236 | import quo
session = quo.Prompt()
class NumberValidator(quo.types.Validator):
def validate(self, document):
text = document.text
if text and not text.isdigit():
i = 0
for i, cursor in enumerate(text):
if not cursor.isdigit():
... | true | true |
f7488f48db402ab8dbabded977cf5159c7604250 | 14,044 | py | Python | stravaio.py | tylerdave/stravaio | a2de2ef68ef59b906d53e6f3086ff10ffba4f507 | [
"MIT"
] | null | null | null | stravaio.py | tylerdave/stravaio | a2de2ef68ef59b906d53e6f3086ff10ffba4f507 | [
"MIT"
] | null | null | null | stravaio.py | tylerdave/stravaio | a2de2ef68ef59b906d53e6f3086ff10ffba4f507 | [
"MIT"
] | null | null | null | import swagger_client
from swagger_client.rest import ApiException
import maya
import os
import json
import datetime
import pandas as pd
import glob
import datetime
from loguru import logger
import requests
import socket
import urllib
import webbrowser
from http.server import BaseHTTPRequestHandler, HTTPServer
class ... | 31.278396 | 153 | 0.606665 | import swagger_client
from swagger_client.rest import ApiException
import maya
import os
import json
import datetime
import pandas as pd
import glob
import datetime
from loguru import logger
import requests
import socket
import urllib
import webbrowser
from http.server import BaseHTTPRequestHandler, HTTPServer
class ... | true | true |
f7489053b0573720ad934703fc10aeac9eabce70 | 2,760 | py | Python | cibyl/outputs/cli/ci/env/impl/colored.py | rhos-infra/cibyl | 842a993ddf3552d1b4f2e85025dcf928f76fe7fb | [
"Apache-2.0"
] | 3 | 2022-02-17T18:07:07.000Z | 2022-03-19T10:22:38.000Z | cibyl/outputs/cli/ci/env/impl/colored.py | rhos-infra/cibyl | 842a993ddf3552d1b4f2e85025dcf928f76fe7fb | [
"Apache-2.0"
] | 58 | 2022-02-14T14:41:22.000Z | 2022-03-31T10:54:28.000Z | cibyl/outputs/cli/ci/env/impl/colored.py | rhos-infra/cibyl | 842a993ddf3552d1b4f2e85025dcf928f76fe7fb | [
"Apache-2.0"
] | 6 | 2022-02-14T19:21:26.000Z | 2022-03-29T09:31:31.000Z | """
# Copyright 2022 Red Hat
#
# 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.857143 | 78 | 0.659058 | import logging
from overrides import overrides
from cibyl.models.ci.base.system import JobsSystem
from cibyl.models.ci.zuul.system import ZuulSystem
from cibyl.outputs.cli.ci.env.printer import CIPrinter
from cibyl.outputs.cli.ci.system.impls.base.colored import \
ColoredBaseSystemPrinter
from cibyl.outputs.cli.c... | true | true |
f74890ad858ef6e45b6830eb12c77c43cc9801c6 | 1,725 | py | Python | dev/gaussian_beam.py | JoshKarpel/simulacra | e5770ced1bef860caec25ce8c77a61ff0bb78907 | [
"MIT"
] | 1 | 2018-05-24T08:01:26.000Z | 2018-05-24T08:01:26.000Z | dev/gaussian_beam.py | JoshKarpel/simulacra | e5770ced1bef860caec25ce8c77a61ff0bb78907 | [
"MIT"
] | 1 | 2019-10-08T21:03:46.000Z | 2019-10-08T21:03:46.000Z | dev/gaussian_beam.py | JoshKarpel/simulacra | e5770ced1bef860caec25ce8c77a61ff0bb78907 | [
"MIT"
] | 2 | 2017-07-03T18:33:16.000Z | 2018-10-16T01:52:57.000Z | import logging
from pathlib import Path
import numpy as np
import simulacra as si
import simulacra.units as u
import matplotlib.pyplot as plt
FILE_NAME = Path(__file__).stem
OUT_DIR = Path(__file__).parent / "out" / FILE_NAME
def w(z, w_0, z_0):
return w_0 * np.sqrt(1 + ((z / z_0) ** 2))
def R(z, z_0):
... | 23.958333 | 139 | 0.541449 | import logging
from pathlib import Path
import numpy as np
import simulacra as si
import simulacra.units as u
import matplotlib.pyplot as plt
FILE_NAME = Path(__file__).stem
OUT_DIR = Path(__file__).parent / "out" / FILE_NAME
def w(z, w_0, z_0):
return w_0 * np.sqrt(1 + ((z / z_0) ** 2))
def R(z, z_0):
... | true | true |
f748914f195acab8ecdb143911025bd5b4fdb4cc | 5,171 | py | Python | app.py | obfrap/sqlalchemy-challenge | 54dd0a62c7bf05012e48307fc2799abcc2dde30a | [
"Apache-2.0"
] | null | null | null | app.py | obfrap/sqlalchemy-challenge | 54dd0a62c7bf05012e48307fc2799abcc2dde30a | [
"Apache-2.0"
] | null | null | null | app.py | obfrap/sqlalchemy-challenge | 54dd0a62c7bf05012e48307fc2799abcc2dde30a | [
"Apache-2.0"
] | null | null | null | #matplotlib inline
from matplotlib import style
style.use('fivethirtyeight')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import datetime as dt
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from ... | 30.964072 | 236 | 0.652678 |
from matplotlib import style
style.use('fivethirtyeight')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import datetime as dt
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from sqlalchemy import ... | true | true |
f748924b3f9e688752476f1123cd6605b4994b08 | 32,926 | py | Python | env/channel_pruning_env.py | lightconeWJA/amc_with_annotation | 3fadc69944e7e6692c37949309ab03e37d2e30a2 | [
"MIT"
] | null | null | null | env/channel_pruning_env.py | lightconeWJA/amc_with_annotation | 3fadc69944e7e6692c37949309ab03e37d2e30a2 | [
"MIT"
] | null | null | null | env/channel_pruning_env.py | lightconeWJA/amc_with_annotation | 3fadc69944e7e6692c37949309ab03e37d2e30a2 | [
"MIT"
] | null | null | null | # Code for "AMC: AutoML for Model Compression and Acceleration on Mobile Devices"
# Yihui He*, Ji Lin*, Zhijian Liu, Hanrui Wang, Li-Jia Li, Song Han
# {jilin, songhan}@mit.edu
import time
import torch
import torch.nn as nn
from lib.utils import AverageMeter, accuracy, prGreen
from lib.data import get_split_dataset
fr... | 43.437995 | 127 | 0.571646 |
import time
import torch
import torch.nn as nn
from lib.utils import AverageMeter, accuracy, prGreen
from lib.data import get_split_dataset
from env.rewards import *
import math
import numpy as np
import copy
class ChannelPruningEnv:
def __init__(self, model, checkpoint, data, preserve_ratio, args, n_data_wo... | true | true |
f7489431896dabb7f30995c58d9ddf04aee363c1 | 770 | py | Python | py2/config/config.py | ti-ginkgo/Severstal | 57f37dc61cfd910b575afa7dc51094c94e3511c0 | [
"MIT"
] | 2 | 2020-01-08T02:58:18.000Z | 2020-01-28T16:42:00.000Z | py2/config/config.py | ti-ginkgo/Severstal | 57f37dc61cfd910b575afa7dc51094c94e3511c0 | [
"MIT"
] | null | null | null | py2/config/config.py | ti-ginkgo/Severstal | 57f37dc61cfd910b575afa7dc51094c94e3511c0 | [
"MIT"
] | null | null | null | # TODO: change
import os
ope = os.path.exists
import numpy as np
import socket
import warnings
warnings.filterwarnings('ignore')
sk = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
hostname = socket.gethostname()
print('run on %s' % hostname)
RESULT_DIR = '../output/result'
DATA_DIR = '../input'
PRETRAINED_DIR = '... | 22.647059 | 72 | 0.697403 |
import os
ope = os.path.exists
import numpy as np
import socket
import warnings
warnings.filterwarnings('ignore')
sk = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
hostname = socket.gethostname()
print('run on %s' % hostname)
RESULT_DIR = '../output/result'
DATA_DIR = '../input'
PRETRAINED_DIR = '../input/pretr... | true | true |
f7489625a9a8851fc70211fc9d772bb642396c22 | 2,774 | py | Python | source/conf.py | luhuadong/rtt-ptqs100x | ea68566ad8044cc753cfe1de81de4cae1ac15006 | [
"Apache-2.0"
] | 2 | 2020-12-05T10:24:37.000Z | 2021-03-16T13:27:24.000Z | source/conf.py | luhuadong/rtt-ptqs100x | ea68566ad8044cc753cfe1de81de4cae1ac15006 | [
"Apache-2.0"
] | null | null | null | source/conf.py | luhuadong/rtt-ptqs100x | ea68566ad8044cc753cfe1de81de4cae1ac15006 | [
"Apache-2.0"
] | 1 | 2020-12-05T10:24:50.000Z | 2020-12-05T10:24:50.000Z | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 31.168539 | 79 | 0.678443 |
project = 'ใๆชๆฅๅๅ
ฅไฝๆๅใ'
copyright = '2020, luhuadong'
author = 'luhuadong'
release = 'v1.0'
master_doc = 'index'
extensions = [
'recommonmark',
'sphinx_markdown_tables',
'sphinxemoji.sphinxemoji'
]
source_suffix = {
'.rst': 'restructuredtext',
'.md': 'markdown',
}
templ... | true | true |
f748969a3893b8d1317621ccb2f48bf92fc504d0 | 1,941 | py | Python | utils/emailConfig/email_config.py | wdangelo/file-collector-afd | 068078c5dc224f86035da0fefb75e09745255023 | [
"MIT"
] | 1 | 2021-12-08T13:58:55.000Z | 2021-12-08T13:58:55.000Z | utils/emailConfig/email_config.py | wdangelo/file-collector-afd | 068078c5dc224f86035da0fefb75e09745255023 | [
"MIT"
] | null | null | null | utils/emailConfig/email_config.py | wdangelo/file-collector-afd | 068078c5dc224f86035da0fefb75e09745255023 | [
"MIT"
] | null | null | null | import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
from datetime import datetime
def sending(message):
date_hour_now = datetime.now()
date_hour_now_format = date_hour_now.strftime(f" data: %d/%m... | 34.052632 | 94 | 0.652241 | import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
from datetime import datetime
def sending(message):
date_hour_now = datetime.now()
date_hour_now_format = date_hour_now.strftime(f" data: %d/%m... | true | true |
f74897b63e73b411a9dd6129ab9cd03095e5be20 | 8,734 | py | Python | tardis/adapters/batchsystems/htcondor.py | wiene/tardis | 60d00ae8a6adc720903632ef823941418210ccd7 | [
"MIT"
] | null | null | null | tardis/adapters/batchsystems/htcondor.py | wiene/tardis | 60d00ae8a6adc720903632ef823941418210ccd7 | [
"MIT"
] | null | null | null | tardis/adapters/batchsystems/htcondor.py | wiene/tardis | 60d00ae8a6adc720903632ef823941418210ccd7 | [
"MIT"
] | null | null | null | from ...configuration.configuration import Configuration
from ...exceptions.executorexceptions import CommandExecutionFailure
from ...interfaces.batchsystemadapter import BatchSystemAdapter
from ...interfaces.batchsystemadapter import MachineStatus
from ...utilities.utils import async_run_command
from ...utilities.util... | 37.008475 | 107 | 0.639341 | from ...configuration.configuration import Configuration
from ...exceptions.executorexceptions import CommandExecutionFailure
from ...interfaces.batchsystemadapter import BatchSystemAdapter
from ...interfaces.batchsystemadapter import MachineStatus
from ...utilities.utils import async_run_command
from ...utilities.util... | true | true |
f74897e3a1afdc2c2b9a8e9210243f4667b15bee | 6,606 | py | Python | simulation/utils/machine_learning/cycle_gan/models/cycle_gan_model.py | LeonardII/KitCarFork | b2802c5b08cc8250446ce3731cb622af064db4ca | [
"MIT"
] | null | null | null | simulation/utils/machine_learning/cycle_gan/models/cycle_gan_model.py | LeonardII/KitCarFork | b2802c5b08cc8250446ce3731cb622af064db4ca | [
"MIT"
] | null | null | null | simulation/utils/machine_learning/cycle_gan/models/cycle_gan_model.py | LeonardII/KitCarFork | b2802c5b08cc8250446ce3731cb622af064db4ca | [
"MIT"
] | null | null | null | import torch
from torch import Tensor, nn
from torch.nn.functional import mse_loss
from simulation.utils.machine_learning.data.image_pool import ImagePool
from simulation.utils.machine_learning.models.helper import set_requires_grad
from .base_model import BaseModel
from .cycle_gan_stats import CycleGANStats
class ... | 34.768421 | 92 | 0.597639 | import torch
from torch import Tensor, nn
from torch.nn.functional import mse_loss
from simulation.utils.machine_learning.data.image_pool import ImagePool
from simulation.utils.machine_learning.models.helper import set_requires_grad
from .base_model import BaseModel
from .cycle_gan_stats import CycleGANStats
class ... | true | true |
f7489904f6ccc3d6835d16af01bcf69de8db76be | 5,588 | py | Python | netket/driver/steady_state.py | gpescia/MyNetKet | 958510966a5870d9d491de0628903cf1fc210921 | [
"Apache-2.0"
] | 352 | 2018-04-24T16:45:10.000Z | 2022-03-31T01:15:34.000Z | netket/driver/steady_state.py | gpescia/MyNetKet | 958510966a5870d9d491de0628903cf1fc210921 | [
"Apache-2.0"
] | 947 | 2018-04-24T20:16:17.000Z | 2022-03-31T17:33:52.000Z | netket/driver/steady_state.py | gpescia/MyNetKet | 958510966a5870d9d491de0628903cf1fc210921 | [
"Apache-2.0"
] | 148 | 2018-04-25T02:44:20.000Z | 2022-03-11T11:42:34.000Z | # Copyright 2021 The NetKet Authors - All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 34.282209 | 134 | 0.596457 |
import jax
import jax.numpy as jnp
from netket.operator import Squared, AbstractSuperOperator
from netket.vqs import MCMixedState
from netket.utils import warn_deprecation
from netket.optimizer import (
identity_preconditioner,
PreconditionerT,
)
from .vmc_common import info
from .abstract_varia... | true | true |
f7489a2d5e6660a985174858bdca25641c9aa3b3 | 1,195 | py | Python | Sticky-Notes/markdown_functionality.py | v2thegreat/sticky-notes | e79dd10b8fb88e0195ac1ca90d6b8dcb0f56e002 | [
"Apache-2.0"
] | null | null | null | Sticky-Notes/markdown_functionality.py | v2thegreat/sticky-notes | e79dd10b8fb88e0195ac1ca90d6b8dcb0f56e002 | [
"Apache-2.0"
] | null | null | null | Sticky-Notes/markdown_functionality.py | v2thegreat/sticky-notes | e79dd10b8fb88e0195ac1ca90d6b8dcb0f56e002 | [
"Apache-2.0"
] | null | null | null | from os import startfile
from base_functions import base_functions
from markdown import markdownFromFile
class markdown_functionality(base_functions):
"""Seperate Class to hold markdown methods"""
def __init__(self):
super(markdown_functionality, self).__init__()
def compileAndDisplayMarkdown(self, label_index)... | 28.452381 | 134 | 0.779916 | from os import startfile
from base_functions import base_functions
from markdown import markdownFromFile
class markdown_functionality(base_functions):
def __init__(self):
super(markdown_functionality, self).__init__()
def compileAndDisplayMarkdown(self, label_index):
self._compileMarkDownFile(label_index)
se... | true | true |
f7489bf7ca70b7bafc39b779ab6c3d3b3d0e4c27 | 13,436 | py | Python | server/vcr-server/vcr_server/settings.py | crubn/aries-vcr | 403da51a1b758918c8f30f48290d989f65982910 | [
"Apache-2.0"
] | null | null | null | server/vcr-server/vcr_server/settings.py | crubn/aries-vcr | 403da51a1b758918c8f30f48290d989f65982910 | [
"Apache-2.0"
] | null | null | null | server/vcr-server/vcr_server/settings.py | crubn/aries-vcr | 403da51a1b758918c8f30f48290d989f65982910 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/setting... | 31.688679 | 109 | 0.689119 |
import os
import os.path
from pathlib import Path
from snowplow_tracker import Subject, Tracker, AsyncEmitter
from . import authentication, permissions
try:
from . import database
except:
import database
try:
from . import haystack
except:
import haystack
def parse_bool(val):
return val and ... | true | true |
f7489c8de454c96fb4f0c99822269a63283cfce4 | 2,588 | py | Python | aliyun-python-sdk-emr/aliyunsdkemr/request/v20160408/ModifyAlertContactRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-emr/aliyunsdkemr/request/v20160408/ModifyAlertContactRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-emr/aliyunsdkemr/request/v20160408/ModifyAlertContactRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | null | null | null | # 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 ... | 35.452055 | 82 | 0.765842 |
from aliyunsdkcore.request import RpcRequest
from aliyunsdkemr.endpoint import endpoint_data
class ModifyAlertContactRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'Emr', '2016-04-08', 'ModifyAlertContact','emr')
if hasattr(self, "endpoint_map"):
setattr(self, "e... | true | true |
f748a056cf0f8d9687219f34409a9739215aa508 | 1,125 | py | Python | arucoloc/test-aruco-search.py | obo/loev3go | 763c6cf61133add914d231d07bc8c3c29672aba9 | [
"MIT"
] | 1 | 2018-09-05T20:57:40.000Z | 2018-09-05T20:57:40.000Z | arucoloc/test-aruco-search.py | obo/loev3go | 763c6cf61133add914d231d07bc8c3c29672aba9 | [
"MIT"
] | null | null | null | arucoloc/test-aruco-search.py | obo/loev3go | 763c6cf61133add914d231d07bc8c3c29672aba9 | [
"MIT"
] | 2 | 2019-10-05T23:02:41.000Z | 2020-06-25T20:21:02.000Z | #!/usr/bin/env python2
# From: https://gist.github.com/hauptmech/6b8ca2c05a3d935c97b1c75ec9ad85ff
# Needs to install: sudo pip2 install opencv-contrib-python
# Runs video capture and locates aruco markers from the given dictionary.
import numpy as np
import cv2
cap = cv2.VideoCapture(1)
#dictionary = cv2.aruco.getPre... | 32.142857 | 78 | 0.739556 |
import numpy as np
import cv2
cap = cv2.VideoCapture(1)
dictionary = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_6X6_250)
while(True):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
res = cv2.aruco.detectMarkers(gray,dictionary)
if len(res[0]) > 0:
... | true | true |
f748a2120a3ad41564019a8239df63c253827008 | 3,254 | py | Python | duplyaml/yconst.py | peterkmurphy/duplyaml | 7ce59cacb4ea04c6b12c6abb27a3e1eec2cca0cf | [
"MIT"
] | null | null | null | duplyaml/yconst.py | peterkmurphy/duplyaml | 7ce59cacb4ea04c6b12c6abb27a3e1eec2cca0cf | [
"MIT"
] | null | null | null | duplyaml/yconst.py | peterkmurphy/duplyaml | 7ce59cacb4ea04c6b12c6abb27a3e1eec2cca0cf | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# The duplyaml YAML processor.
# The yconst.py file.
# Common constants used in YAML.
# First, get the Python version
import sys
PY_VER = sys.version
# These are the constants used to define the Node kinds used with YAML nodes
YAMLNODE_DEF = 0 # Used with the YAMLNode ... | 32.54 | 87 | 0.71051 |
import sys
PY_VER = sys.version
YAMLNODE_DEF = 0
YAMLNODE_SCA = 1
YAMLNODE_SEQ = 2
YAMLNODE_MAP = 3
YAMLMAP_STATUS_KEYREADY = 0
YAMLMAP_STATUS_VALREADY = 1
YAML_NAME_PREFIX = "tag:yaml.org,2002:"
C_SECONDARY_TAG_HANDLE = "!!"
TAG_MAP = "!!map"
TAG_OMAP = "!!omap"
TAG_PAIRS = "!!pairs"
TAG... | true | true |
f748a3a0c6400faa531ec4b771be2573bfd6af4e | 186 | py | Python | student/urls.py | mr-bhuvaneswaran/cms-backend | 74100f3db018ae87564bd1bb7e9887031349f5c7 | [
"MIT"
] | null | null | null | student/urls.py | mr-bhuvaneswaran/cms-backend | 74100f3db018ae87564bd1bb7e9887031349f5c7 | [
"MIT"
] | null | null | null | student/urls.py | mr-bhuvaneswaran/cms-backend | 74100f3db018ae87564bd1bb7e9887031349f5c7 | [
"MIT"
] | null | null | null | from django.conf.urls import url,include
from rest_framework import routers
# router = routers.SimpleRouter()
# router.register(r'^profile/$' ,ProfileView.as_view(),base_name='profile') | 37.2 | 75 | 0.784946 | from django.conf.urls import url,include
from rest_framework import routers
| true | true |
f748a42f6e30f5675e0a5a2d00ae0e3afc5fc379 | 141 | py | Python | streaming/app/config.py | Ingimarsson/gatekeeper | 799031a8c7267866b52ec5fb3b1cd14a7869ce94 | [
"MIT"
] | null | null | null | streaming/app/config.py | Ingimarsson/gatekeeper | 799031a8c7267866b52ec5fb3b1cd14a7869ce94 | [
"MIT"
] | null | null | null | streaming/app/config.py | Ingimarsson/gatekeeper | 799031a8c7267866b52ec5fb3b1cd14a7869ce94 | [
"MIT"
] | null | null | null | import os
config = {
"MAX_LIVE_AGE": int(os.environ.get("GK_MAX_LIVE_AGE", 60)),
"DATA_PATH": os.environ.get("GK_DATA_PATH", "/data/")
} | 23.5 | 61 | 0.673759 | import os
config = {
"MAX_LIVE_AGE": int(os.environ.get("GK_MAX_LIVE_AGE", 60)),
"DATA_PATH": os.environ.get("GK_DATA_PATH", "/data/")
} | true | true |
f748a503ccb9f779ac4667653cd3f6c102e72728 | 472 | py | Python | blog/migrations/0012_post_type_food.py | GhasemMatoo/Mysite_Restaurants | f44e0b0374016850cc47f212db0d5693d6de2ee6 | [
"MIT"
] | null | null | null | blog/migrations/0012_post_type_food.py | GhasemMatoo/Mysite_Restaurants | f44e0b0374016850cc47f212db0d5693d6de2ee6 | [
"MIT"
] | null | null | null | blog/migrations/0012_post_type_food.py | GhasemMatoo/Mysite_Restaurants | f44e0b0374016850cc47f212db0d5693d6de2ee6 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.10 on 2021-12-09 14:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0011_post_tags'),
]
operations = [
migrations.AddField(
model_name='post',
name='Type_Food',
fi... | 24.842105 | 148 | 0.57839 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0011_post_tags'),
]
operations = [
migrations.AddField(
model_name='post',
name='Type_Food',
field=models.CharField(choices=[('D', 'drinks'), (... | true | true |
f748a559cc484cceaf075e6f4e67f10d3407e857 | 56,276 | py | Python | tests/test_model.py | bzaczynski/microanalyst | 915d8b3111b98a5e369dbcfe0b88c84ade9faec8 | [
"MIT"
] | 3 | 2017-06-06T18:54:28.000Z | 2021-06-11T13:06:40.000Z | tests/test_model.py | bzaczynski/microanalyst | 915d8b3111b98a5e369dbcfe0b88c84ade9faec8 | [
"MIT"
] | null | null | null | tests/test_model.py | bzaczynski/microanalyst | 915d8b3111b98a5e369dbcfe0b88c84ade9faec8 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2013 Bartosz Zaczynski
#
# 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... | 28.829918 | 104 | 0.492892 |
import unittest
import numpy
from random import random
from microanalyst.model import Model
from microanalyst.model.genes import Gene
class TestFilenames(unittest.TestCase):
def test_show_full_path_by_default(self):
model = TestModel.with_filenames(
['C:\\wi... | true | true |
f748a66025da1ae3a88823d6c870dbb990637df0 | 1,258 | py | Python | decorest/HEAD.py | druid8/decorest | c9d78394f3e84828bb31d4b266ad93eb32703277 | [
"Apache-2.0"
] | null | null | null | decorest/HEAD.py | druid8/decorest | c9d78394f3e84828bb31d4b266ad93eb32703277 | [
"Apache-2.0"
] | null | null | null | decorest/HEAD.py | druid8/decorest | c9d78394f3e84828bb31d4b266ad93eb32703277 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright 2018 Bartosz Kryza <bkryza@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | 31.45 | 74 | 0.704293 |
from functools import wraps
from .decorators import HttpMethodDecorator, set_decor
from .types import HttpMethod
class HEAD(HttpMethodDecorator):
def __init__(self, path):
super(HEAD, self).__init__(path)
def __call__(self, func):
set_decor(func, 'http_method', HttpMethod.HE... | true | true |
f748a69274813fbb601c2ba537eaace5caf66344 | 3,370 | py | Python | intent_model/metrics.py | amarflybot/intent_classifier | 1a03a0809adf402157df0cd1f906bcf4d38337a8 | [
"Apache-2.0"
] | 88 | 2017-12-29T11:40:29.000Z | 2022-01-04T07:59:47.000Z | intent_model/metrics.py | deepmipt/intent_classifier | 3192644110f0ff1b032eab448ac3197ef52326a7 | [
"Apache-2.0"
] | 8 | 2018-02-11T14:14:45.000Z | 2018-12-03T02:32:21.000Z | intent_model/metrics.py | amarflybot/intent_classifier | 1a03a0809adf402157df0cd1f906bcf4d38337a8 | [
"Apache-2.0"
] | 30 | 2017-12-30T13:37:35.000Z | 2021-03-04T08:34:55.000Z | # Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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... | 32.718447 | 88 | 0.674184 |
import numpy as np
from keras import backend as K
import sklearn.metrics
def precision_K(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
precision = true_positives / (predicted_positives + K.epsilon(... | true | true |
f748a6bbbc68afe44cd78f619498ebb53dd58f5e | 516 | py | Python | components/ota/script/gen_key.py | LinusZhao/LiteOS | 361678b1eec1d5255534ab9628d11cad2edbaa61 | [
"BSD-3-Clause"
] | 4,335 | 2018-05-08T16:55:45.000Z | 2022-03-31T03:52:42.000Z | components/ota/script/gen_key.py | LinusZhao/LiteOS | 361678b1eec1d5255534ab9628d11cad2edbaa61 | [
"BSD-3-Clause"
] | 106 | 2018-05-16T11:30:54.000Z | 2021-12-27T01:50:33.000Z | components/ota/script/gen_key.py | LinusZhao/LiteOS | 361678b1eec1d5255534ab9628d11cad2edbaa61 | [
"BSD-3-Clause"
] | 1,387 | 2018-05-08T11:06:50.000Z | 2022-03-26T16:03:05.000Z | from Crypto import Random
from Crypto.PublicKey import RSA
DEFAULT_PRIAVTE_KEY_FILE_NAME = 'private_key.pem'
DEFAULT_PUBLIC_KEY_FILE_NAME = 'public_key.pem'
def main():
random_generator = Random.new().read
rsa = RSA.generate(2048, random_generator)
private_pem = rsa.exportKey()
with open(DEFAULT_PRIAVTE_KEY_FIL... | 25.8 | 52 | 0.763566 | from Crypto import Random
from Crypto.PublicKey import RSA
DEFAULT_PRIAVTE_KEY_FILE_NAME = 'private_key.pem'
DEFAULT_PUBLIC_KEY_FILE_NAME = 'public_key.pem'
def main():
random_generator = Random.new().read
rsa = RSA.generate(2048, random_generator)
private_pem = rsa.exportKey()
with open(DEFAULT_PRIAVTE_KEY_FIL... | true | true |
f748a6c8e010f96292a6873cc76d200ebb0a01fa | 894 | py | Python | slack_sdk/socket_mode/response.py | priya1puresoftware/python-slack-sdk | 3503182feaaf4d41b57fd8bf10038ebc99f1f3c7 | [
"MIT"
] | 2,486 | 2016-11-03T14:31:43.000Z | 2020-10-26T23:07:44.000Z | slack_sdk/socket_mode/response.py | priya1puresoftware/python-slack-sdk | 3503182feaaf4d41b57fd8bf10038ebc99f1f3c7 | [
"MIT"
] | 721 | 2016-11-03T21:26:56.000Z | 2020-10-26T12:41:29.000Z | slack_sdk/socket_mode/response.py | priya1puresoftware/python-slack-sdk | 3503182feaaf4d41b57fd8bf10038ebc99f1f3c7 | [
"MIT"
] | 627 | 2016-11-02T19:04:19.000Z | 2020-10-25T19:21:13.000Z | from typing import Union, Optional
from slack_sdk.models import JsonObject
class SocketModeResponse:
envelope_id: str
payload: dict
def __init__(
self, envelope_id: str, payload: Optional[Union[dict, JsonObject, str]] = None
):
self.envelope_id = envelope_id
if payload is No... | 28.83871 | 86 | 0.611857 | from typing import Union, Optional
from slack_sdk.models import JsonObject
class SocketModeResponse:
envelope_id: str
payload: dict
def __init__(
self, envelope_id: str, payload: Optional[Union[dict, JsonObject, str]] = None
):
self.envelope_id = envelope_id
if payload is No... | true | true |
f748a71df3a389820ab6ee00e7e50594678aad86 | 1,419 | py | Python | ChromaLibrary.py | devinhunsberger/PyLaunchpad | 787c4545afad4c92a3f643951492fb842e29a1a6 | [
"MIT"
] | null | null | null | ChromaLibrary.py | devinhunsberger/PyLaunchpad | 787c4545afad4c92a3f643951492fb842e29a1a6 | [
"MIT"
] | null | null | null | ChromaLibrary.py | devinhunsberger/PyLaunchpad | 787c4545afad4c92a3f643951492fb842e29a1a6 | [
"MIT"
] | null | null | null | import mido
import cv2
#Color library using dictionary from RGB to velocity value of the Launchpad MK2
from ClearLaunchpad import RemoveNotes, ClearScreen
from FirstMido import FillNotes
cap = cv2.imread("Velocity2RGB.png")
Complete = cap.copy()
while(True):
Mat = cv2.inRange(cap, (0, 0, 0), (254, 254, 254))
... | 38.351351 | 134 | 0.59549 | import mido
import cv2
from ClearLaunchpad import RemoveNotes, ClearScreen
from FirstMido import FillNotes
cap = cv2.imread("Velocity2RGB.png")
Complete = cap.copy()
while(True):
Mat = cv2.inRange(cap, (0, 0, 0), (254, 254, 254))
cv2.imshow("Mat", Mat)
contours, hierarchy = cv2.findContours(Mat, cv2.RETR... | true | true |
f748a7ad890b9579b425139f4f76ba6323f756ca | 101 | py | Python | primeiros exercicios/sucessor_antecessor.py | Pedroluis1/python | d949fa2646c049aa51a41a32dc62de7b14eae90f | [
"MIT"
] | null | null | null | primeiros exercicios/sucessor_antecessor.py | Pedroluis1/python | d949fa2646c049aa51a41a32dc62de7b14eae90f | [
"MIT"
] | null | null | null | primeiros exercicios/sucessor_antecessor.py | Pedroluis1/python | d949fa2646c049aa51a41a32dc62de7b14eae90f | [
"MIT"
] | null | null | null | a = int(input('Digite um nรบmero: '))
print(f'O antecessor de {a} รฉ {a-1}\nO sucessor de {a} รฉ {a+1}') | 50.5 | 64 | 0.613861 | a = int(input('Digite um nรบmero: '))
print(f'O antecessor de {a} รฉ {a-1}\nO sucessor de {a} รฉ {a+1}') | true | true |
f748a883c4b24564550bc8cd98b7f8b40ee5d07f | 754 | py | Python | tests/fixture_data/build/lambdas/pre-batch/lambda_function.py | kave/cirrus-geo | cc10a6df55c5e124d87663e9c32b53b871216a62 | [
"Apache-2.0"
] | null | null | null | tests/fixture_data/build/lambdas/pre-batch/lambda_function.py | kave/cirrus-geo | cc10a6df55c5e124d87663e9c32b53b871216a62 | [
"Apache-2.0"
] | null | null | null | tests/fixture_data/build/lambdas/pre-batch/lambda_function.py | kave/cirrus-geo | cc10a6df55c5e124d87663e9c32b53b871216a62 | [
"Apache-2.0"
] | null | null | null | import uuid
from os import getenv
from boto3utils import s3
from cirruslib import Catalog, get_task_logger
# envvars
CATALOG_BUCKET = getenv('CIRRUS_CATALOG_BUCKET')
def lambda_handler(payload, context):
catalog = Catalog.from_payload(payload)
logger = get_task_logger("task.pre-batch", catalog=catalog)
... | 26 | 76 | 0.659151 | import uuid
from os import getenv
from boto3utils import s3
from cirruslib import Catalog, get_task_logger
CATALOG_BUCKET = getenv('CIRRUS_CATALOG_BUCKET')
def lambda_handler(payload, context):
catalog = Catalog.from_payload(payload)
logger = get_task_logger("task.pre-batch", catalog=catalog)
url = f"... | true | true |
f748a88d34818677c034c77d9b8b4efb63f3784f | 20,243 | py | Python | python/osmosis_proto/cosmos/bank/v1beta1/__init__.py | fabio-nukui/osmosis.proto | 4780f22681881626b853109971602a6e29a3fb69 | [
"Apache-2.0"
] | 1 | 2022-02-22T06:18:40.000Z | 2022-02-22T06:18:40.000Z | python/osmosis_proto/cosmos/bank/v1beta1/__init__.py | fabio-nukui/osmosis.proto | 4780f22681881626b853109971602a6e29a3fb69 | [
"Apache-2.0"
] | null | null | null | python/osmosis_proto/cosmos/bank/v1beta1/__init__.py | fabio-nukui/osmosis.proto | 4780f22681881626b853109971602a6e29a3fb69 | [
"Apache-2.0"
] | null | null | null | # Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: cosmos/bank/v1beta1/bank.proto, cosmos/bank/v1beta1/genesis.proto, cosmos/bank/v1beta1/query.proto, cosmos/bank/v1beta1/tx.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import Dict, List, Optional
import betterprot... | 32.492777 | 139 | 0.674949 |
from dataclasses import dataclass
from typing import Dict, List, Optional
import betterproto
from betterproto.grpc.grpclib_server import ServiceBase
import grpclib
@dataclass(eq=False, repr=False)
class Params(betterproto.Message):
send_enabled: List["SendEnabled"] = betterproto.message_field(1)
default_... | true | true |
f748a900f58b9ee8ab469b767af6c4a284f6b710 | 2,579 | py | Python | rf/test/RegFile_test.py | pnnl/open-cgra | c19bc3a1baca3da659dc8f3cbfe32dd6003a2c65 | [
"BSD-3-Clause"
] | 49 | 2020-09-17T19:22:53.000Z | 2022-03-25T18:55:13.000Z | rf/test/RegFile_test.py | pnnl/open-cgra | c19bc3a1baca3da659dc8f3cbfe32dd6003a2c65 | [
"BSD-3-Clause"
] | 8 | 2020-12-30T20:22:29.000Z | 2022-03-29T04:47:27.000Z | rf/test/RegFile_test.py | pnnl/open-cgra | c19bc3a1baca3da659dc8f3cbfe32dd6003a2c65 | [
"BSD-3-Clause"
] | 12 | 2020-12-12T21:38:59.000Z | 2022-03-15T02:21:15.000Z | """
==========================================================================
Phi_test.py
==========================================================================
Test cases for functional unit Phi.
Author : Cheng Tan
Date : November 27, 2019
"""
from pymtl3 import *
from pymtl3.stdlib.test import Tes... | 29.643678 | 74 | 0.577356 |
from pymtl3 import *
from pymtl3.stdlib.test import TestSinkCL
from pymtl3.stdlib.test.test_srcs import TestSrcRTL
from ..RegFile import RegFile
from ...lib.opt_type import *
from ...lib.messages import *
class TestHarness( Component ):
def construct( s, Fu... | true | true |
f748a95c76d0add0894d1f3f835b7d1d5c434db4 | 12,462 | py | Python | qa/rpc-tests/util.py | dmocoin/domino | 68a97e6a47dd508970a3194ada7857c49c09f3d3 | [
"MIT"
] | null | null | null | qa/rpc-tests/util.py | dmocoin/domino | 68a97e6a47dd508970a3194ada7857c49c09f3d3 | [
"MIT"
] | null | null | null | qa/rpc-tests/util.py | dmocoin/domino | 68a97e6a47dd508970a3194ada7857c49c09f3d3 | [
"MIT"
] | 1 | 2018-06-14T17:09:50.000Z | 2018-06-14T17:09:50.000Z | # Copyright (c) 2014 The Bitcoin Core developers
# Copyright (c) 2014-2015 The Dash developers
# Copyright (c) 2015-2017 The PIVX developers
# Copyright (c) 2017-2018 The Domino developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-lic... | 35.913545 | 106 | 0.648211 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitcoinrpc"))
from decimal import Decimal, ROUND_DOWN
import json
import random
import shutil
import subprocess
import time
import re
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
fro... | true | true |
f748a9a909a78e48671f0ce4cbe555ee3d14a07b | 16,432 | py | Python | tools/run_tests/artifacts/artifact_targets.py | Akrog/grpc | 14800b0c1acc2d10d4fd0826731ecae2cb448143 | [
"Apache-2.0"
] | 9 | 2020-12-04T07:34:08.000Z | 2022-03-07T21:10:35.000Z | tools/run_tests/artifacts/artifact_targets.py | Akrog/grpc | 14800b0c1acc2d10d4fd0826731ecae2cb448143 | [
"Apache-2.0"
] | 62 | 2020-02-27T00:53:36.000Z | 2021-02-05T06:10:53.000Z | tools/run_tests/artifacts/artifact_targets.py | Akrog/grpc | 14800b0c1acc2d10d4fd0826731ecae2cb448143 | [
"Apache-2.0"
] | 5 | 2021-02-19T09:46:00.000Z | 2022-03-13T17:33:34.000Z | #!/usr/bin/env python
# Copyright 2016 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 41.08 | 104 | 0.571994 |
import os.path
import random
import string
import sys
sys.path.insert(0, os.path.abspath('..'))
import python_utils.jobset as jobset
def create_docker_jobspec(name,
dockerfile_dir,
shell_command,
environ={},
... | true | true |
f748aa3d2684c9e425f0043e8a6ca5a1c8916a15 | 4,981 | py | Python | finetune/src/evaluate_v1_0.py | Beomi/KoELECTRA | 0e64b1597b567f0f74701dcc53d74aad1dab2aec | [
"Apache-2.0"
] | 1 | 2021-10-04T11:22:13.000Z | 2021-10-04T11:22:13.000Z | finetune/src/evaluate_v1_0.py | Beomi/KoELECTRA | 0e64b1597b567f0f74701dcc53d74aad1dab2aec | [
"Apache-2.0"
] | 1 | 2021-08-10T14:53:09.000Z | 2021-08-10T14:53:09.000Z | finetune/src/evaluate_v1_0.py | SIC98/KoELECTRA | 19fd5f2b698b297a8cf1e2c0c3995c93509298f3 | [
"Apache-2.0"
] | null | null | null | from __future__ import print_function
from collections import Counter
import string
import re
import argparse
import json
import sys
import os
'''KorQuAD v1.0์ ๋ํ ๊ณต์ ํ๊ฐ ์คํฌ๋ฆฝํธ '''
'''๋ณธ ์คํฌ๋ฆฝํธ๋ SQuAD v1.1 ํ๊ฐ ์คํฌ๋ฆฝํธ https://rajpurkar.github.io/SQuAD-explorer/ ๋ฅผ ๋ฐํ์ผ๋ก ์์ฑ๋จ.'''
def normalize_answer(s):
def remove_(text):
... | 34.590278 | 88 | 0.620157 | from __future__ import print_function
from collections import Counter
import string
import re
import argparse
import json
import sys
import os
def normalize_answer(s):
def remove_(text):
text = re.sub("'", " ", text)
text = re.sub('"', " ", text)
text = re.sub('ใ', " ", text)
text... | true | true |
f748aa7805daad0ebf6c10e12c341455a23ea816 | 13,335 | py | Python | tests/test_netmiko_commit.py | zunya58/netmiko | f12d7640d1dbaa2d3b70912b7ea8448928602f1e | [
"MIT"
] | 2 | 2019-07-23T02:27:19.000Z | 2019-07-23T02:27:25.000Z | tests/test_netmiko_commit.py | tyler-8/netmiko | df317927fcf5d742b5096c0db5ccbd0847c19f84 | [
"MIT"
] | null | null | null | tests/test_netmiko_commit.py | tyler-8/netmiko | df317927fcf5d742b5096c0db5ccbd0847c19f84 | [
"MIT"
] | 1 | 2019-10-16T19:02:32.000Z | 2019-10-16T19:02:32.000Z | #!/usr/bin/env python
"""
test_ssh_connect: verify ssh connectivity
test_config_mode: verify enter config mode
test_commit_base: test std .commit()
test_commit_confirm: test commit with confirm
test_confirm_delay: test commit-confirm with non-std delay
test_no_confirm: test commit-confirm with no confirm
test_commit_ch... | 33.254364 | 88 | 0.715336 |
import time
import re
import random
import string
def gen_random(N=6):
return "".join(
[
random.choice(
string.ascii_lowercase + string.ascii_uppercase + string.digits
)
for x in range(N)
]
)
def retrieve_commands(commands):
config_c... | true | true |
f748ab09a93931b9a55e1b7853d638ff08c42e11 | 1,520 | py | Python | Make_It_Hot_Cold/cold/code.py | gamblor21/Adafruit_Learning_System_Guides | f5dab4a758bc82d0bfc3c299683fe89dc093912a | [
"MIT"
] | 665 | 2017-09-27T21:20:14.000Z | 2022-03-31T09:09:25.000Z | Make_It_Hot_Cold/cold/code.py | gamblor21/Adafruit_Learning_System_Guides | f5dab4a758bc82d0bfc3c299683fe89dc093912a | [
"MIT"
] | 641 | 2017-10-03T19:46:37.000Z | 2022-03-30T18:28:46.000Z | Make_It_Hot_Cold/cold/code.py | gamblor21/Adafruit_Learning_System_Guides | f5dab4a758bc82d0bfc3c299683fe89dc093912a | [
"MIT"
] | 734 | 2017-10-02T22:47:38.000Z | 2022-03-30T14:03:51.000Z | import time
import board
from analogio import AnalogIn
from adafruit_crickit import crickit
import neopixel
print("Peltier Module Demo")
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, auto_write=False)
def show_value(time_val): # Show time on NeoPixels on CPX
num_pixels = int(10-time_val)
for i in ra... | 30.4 | 75 | 0.634868 | import time
import board
from analogio import AnalogIn
from adafruit_crickit import crickit
import neopixel
print("Peltier Module Demo")
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, auto_write=False)
def show_value(time_val):
num_pixels = int(10-time_val)
for i in range(num_pixels):
pixels... | true | true |
f748abbfbfb93d5983d81006036f5239c218a838 | 843 | py | Python | ms_coffee.py | Manojpvr/VoxelDEM | bee9cebb83617bc2b58a770a13c3f651518ffb2b | [
"MIT"
] | null | null | null | ms_coffee.py | Manojpvr/VoxelDEM | bee9cebb83617bc2b58a770a13c3f651518ffb2b | [
"MIT"
] | null | null | null | ms_coffee.py | Manojpvr/VoxelDEM | bee9cebb83617bc2b58a770a13c3f651518ffb2b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 21 15:13:07 2021
@author: pvrma
"""
"""
This is the script for voxelising the ellipsoidal super quadric particle
data.
"""
import voxelization
zmax = -0.003 #removes particles above this height, to avoid heaping effect
par_data = voxelization.import_ms_data(... | 36.652174 | 137 | 0.748517 |
import voxelization
zmax = -0.003
par_data = voxelization.import_ms_data('ms_coffee_dem_out.csv','coffee_sphere_data.csv', zmax)
print
rmin = 0.0006
normalized_voxel_size = 0.1
bounding_box_dimensions = [-0.0125,0.0125,-0.0125,0.0125,-0.05,-0.001]
voxel = voxelization.ms_vox(par_data, rmin, bounding_box_dimensi... | true | true |
f748ac86b64501703d56c326aab76b897ebfcb53 | 15,243 | py | Python | tests/humanize_tests/tests.py | Yoann-Vie/esgi-hearthstone | 115d03426c7e8e80d89883b78ac72114c29bed12 | [
"PSF-2.0",
"BSD-3-Clause"
] | null | null | null | tests/humanize_tests/tests.py | Yoann-Vie/esgi-hearthstone | 115d03426c7e8e80d89883b78ac72114c29bed12 | [
"PSF-2.0",
"BSD-3-Clause"
] | null | null | null | tests/humanize_tests/tests.py | Yoann-Vie/esgi-hearthstone | 115d03426c7e8e80d89883b78ac72114c29bed12 | [
"PSF-2.0",
"BSD-3-Clause"
] | null | null | null | import datetime
from decimal import Decimal
from django.contrib.humanize.templatetags import humanize
from django.template import Context, Template, defaultfilters
from django.test import SimpleTestCase, modify_settings, override_settings
from django.utils import translation
from django.utils.html import escape... | 44.70088 | 120 | 0.55678 | import datetime
from decimal import Decimal
from django.contrib.humanize.templatetags import humanize
from django.template import Context, Template, defaultfilters
from django.test import SimpleTestCase, modify_settings, override_settings
from django.utils import translation
from django.utils.html import escape... | true | true |
f748ae553048f63e923f9af90a368dae2c03a09f | 7,958 | py | Python | imgreco/end_operation.py | LittleNightmare/ArknightsAutoHelper | c8df51f00e0d17c636f74ed58c4b16e12459ddbe | [
"MIT"
] | 1 | 2021-05-03T13:39:08.000Z | 2021-05-03T13:39:08.000Z | imgreco/end_operation.py | ZhouZiHao-Moon/ArknightsAutoHelper | 3135b54d69f2255f99c13d42dc936065701c3129 | [
"MIT"
] | null | null | null | imgreco/end_operation.py | ZhouZiHao-Moon/ArknightsAutoHelper | 3135b54d69f2255f99c13d42dc936065701c3129 | [
"MIT"
] | null | null | null | import sys
import pickle
import numpy as np
from PIL import Image, ImageOps
from richlog import get_logger
from . import util
from . import imgops
from . import item
from . import minireco
from . import resources
from .util import any_in
LOGFILE = 'log/drop-recognition.html'
class RecognizeSession:
def __init__... | 34.008547 | 125 | 0.655567 | import sys
import pickle
import numpy as np
from PIL import Image, ImageOps
from richlog import get_logger
from . import util
from . import imgops
from . import item
from . import minireco
from . import resources
from .util import any_in
LOGFILE = 'log/drop-recognition.html'
class RecognizeSession:
def __init__... | true | true |
f748ae72f85779619f6c009846e9a268ccd536d0 | 2,159 | py | Python | dashboard/dashboard/app.py | phtruongan/state-machine-editor | f0bbf4260c5821237d253870a9fb07304111f94b | [
"Apache-2.0"
] | null | null | null | dashboard/dashboard/app.py | phtruongan/state-machine-editor | f0bbf4260c5821237d253870a9fb07304111f94b | [
"Apache-2.0"
] | null | null | null | dashboard/dashboard/app.py | phtruongan/state-machine-editor | f0bbf4260c5821237d253870a9fb07304111f94b | [
"Apache-2.0"
] | 1 | 2019-07-02T12:15:56.000Z | 2019-07-02T12:15:56.000Z | # -*- coding: utf-8 -*-
"""The app module, containing the app factory function."""
from flask import Flask, render_template
from dashboard import commands, public, user
from dashboard.extensions import bcrypt, cache, csrf_protect, db, debug_toolbar, login_manager, migrate, webpack
def create_app(config_object='dashb... | 29.575342 | 112 | 0.699398 |
from flask import Flask, render_template
from dashboard import commands, public, user
from dashboard.extensions import bcrypt, cache, csrf_protect, db, debug_toolbar, login_manager, migrate, webpack
def create_app(config_object='dashboard.settings'):
app = Flask(__name__.split('.')[0])
app.config.from_objec... | true | true |
f748aee2f097de143a41e445a0826d64a3e44e2b | 2,315 | py | Python | code_examples/Python/sync_HPC_preprocessor_with_file/app/PrepWithFile.py | VPoser/docs-and-training | 55d4aa4c5b964f3c810d58008db4c5b75260322b | [
"Zlib"
] | null | null | null | code_examples/Python/sync_HPC_preprocessor_with_file/app/PrepWithFile.py | VPoser/docs-and-training | 55d4aa4c5b964f3c810d58008db4c5b75260322b | [
"Zlib"
] | 4 | 2019-05-29T06:16:56.000Z | 2021-03-31T19:03:36.000Z | code_examples/Python/sync_HPC_preprocessor_with_file/app/PrepWithFile.py | VPoser/docs-and-training | 55d4aa4c5b964f3c810d58008db4c5b75260322b | [
"Zlib"
] | 3 | 2019-04-02T08:48:31.000Z | 2020-09-23T08:13:35.000Z | """HPC preprocessor for an HPC demo job
Example of an HPC preprocessor which takes a file and a text input and creates
the necessary parameters for the HPC service.
"""
import os
import logging
from spyne import Application, srpc, ServiceBase, Unicode
from spyne.protocol.soap import Soap11
from spyne.model.fault impo... | 34.044118 | 82 | 0.692441 | import os
import logging
from spyne import Application, srpc, ServiceBase, Unicode
from spyne.protocol.soap import Soap11
from spyne.model.fault import Fault
from clfpy import AuthClient, ExtraParameters
TNS = "prepwithfile.sintef.no"
SERVICENAME = "PrepWithFile"
class TokenValidationFailedFault(Fault):
pass... | true | true |
f748af0b9935c5ae65f33ac36cca647e2ae152ff | 2,614 | py | Python | dags/tezosetl_airflow/variables.py | blockchain-etl/tezos-etl-airflow | 4ca43bb9b1bb53c07e79fdcec9787998a2634fbc | [
"MIT"
] | 1 | 2020-06-20T14:15:57.000Z | 2020-06-20T14:15:57.000Z | dags/tezosetl_airflow/variables.py | blockchain-etl/tezos-etl-airflow | 4ca43bb9b1bb53c07e79fdcec9787998a2634fbc | [
"MIT"
] | 1 | 2021-05-20T06:18:35.000Z | 2021-05-20T06:18:35.000Z | dags/tezosetl_airflow/variables.py | blockchain-etl/tezos-etl-airflow | 4ca43bb9b1bb53c07e79fdcec9787998a2634fbc | [
"MIT"
] | null | null | null | from datetime import datetime
from airflow.models import Variable
def read_export_dag_vars(var_prefix, **kwargs):
"""Read Airflow variables for Export DAG"""
export_start_date = read_var('export_start_date', var_prefix, True, **kwargs)
export_start_date = datetime.strptime(export_start_date, '%Y-%m-%d')
... | 42.852459 | 113 | 0.709258 | from datetime import datetime
from airflow.models import Variable
def read_export_dag_vars(var_prefix, **kwargs):
export_start_date = read_var('export_start_date', var_prefix, True, **kwargs)
export_start_date = datetime.strptime(export_start_date, '%Y-%m-%d')
export_end_date = read_var('export_end_date... | true | true |
f748af5921c7f560eab80978c8b992c0e13b3697 | 511 | py | Python | mathgenerator/funcs/binaryComplement1sFunc.py | mahimadubey/mathgenerator | 32d7fe0da1cc6d80a9e6ea241b1968866044db3f | [
"MIT"
] | null | null | null | mathgenerator/funcs/binaryComplement1sFunc.py | mahimadubey/mathgenerator | 32d7fe0da1cc6d80a9e6ea241b1968866044db3f | [
"MIT"
] | null | null | null | mathgenerator/funcs/binaryComplement1sFunc.py | mahimadubey/mathgenerator | 32d7fe0da1cc6d80a9e6ea241b1968866044db3f | [
"MIT"
] | null | null | null | from .__init__ import *
from ..__init__ import Generator
def binaryComplement1sFunc(maxDigits=10):
question = ''
answer = ''
for i in range(random.randint(1, maxDigits)):
temp = str(random.randint(0, 1))
question += temp
answer += "0" if temp == "1" else "1"
problem = questio... | 24.333333 | 74 | 0.60274 | from .__init__ import *
from ..__init__ import Generator
def binaryComplement1sFunc(maxDigits=10):
question = ''
answer = ''
for i in range(random.randint(1, maxDigits)):
temp = str(random.randint(0, 1))
question += temp
answer += "0" if temp == "1" else "1"
problem = questio... | true | true |
f748b1172f3e0ca2af960e6acfaccec75a395009 | 1,051 | py | Python | src/compas_cem/elements/trail.py | dylau/compas_cem | 643c7d60cb9d6a9999cb96d39c44175cc8662a25 | [
"MIT"
] | 15 | 2020-12-11T14:35:19.000Z | 2022-03-31T03:12:30.000Z | src/compas_cem/elements/trail.py | dylau/compas_cem | 643c7d60cb9d6a9999cb96d39c44175cc8662a25 | [
"MIT"
] | 8 | 2020-10-09T00:08:05.000Z | 2021-11-18T00:24:20.000Z | src/compas_cem/elements/trail.py | dylau/compas_cem | 643c7d60cb9d6a9999cb96d39c44175cc8662a25 | [
"MIT"
] | 2 | 2021-12-28T02:29:47.000Z | 2022-03-15T14:04:23.000Z | from compas_cem.elements import Edge
class TrailEdge(Edge):
"""
A trail edge.
Notes
-----
If a plane is defined, it will override the absolute length of the trail edge.
However, the sign of the length (e.g. the combinatorial state) is preserved.
TODO: addexplicit combinatorial state to t... | 30.911765 | 102 | 0.519505 | from compas_cem.elements import Edge
class TrailEdge(Edge):
def __init__(self, u, v, length, plane=None):
super(TrailEdge, self).__init__(u, v)
self.attributes = {"length": length, "type": "trail", "plane": plane}
def __repr__(self):
st = "{0}(length={1!r}, plane={2!... | true | true |
f748b21d9a282f9b2725cbd7731825ef62698595 | 6,219 | py | Python | gubernator/github/models.py | liubin/test-infra | 4c30b2d5d95bb9b4088ec4df0212905ab73fc495 | [
"Apache-2.0"
] | 1 | 2021-04-12T03:45:55.000Z | 2021-04-12T03:45:55.000Z | gubernator/github/models.py | andyzhangx/test-infra | 4c30b2d5d95bb9b4088ec4df0212905ab73fc495 | [
"Apache-2.0"
] | null | null | null | gubernator/github/models.py | andyzhangx/test-infra | 4c30b2d5d95bb9b4088ec4df0212905ab73fc495 | [
"Apache-2.0"
] | null | null | null | # Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | 31.095 | 99 | 0.636758 |
import datetime
import json
import google.appengine.ext.ndb as ndb
class GithubResource(ndb.Model):
@staticmethod
def make_key(repo, number):
return ndb.Key(GithubResource, '%s %s' % (repo, number))
def shrink(body):
toremove = []
for key, value in body.iteritems():
... | true | true |
f748b226fc05290c729462c2584dde8cc872cb64 | 1,994 | py | Python | day4/day4.py | jberends/aoc2021 | 063a0b19bb13b3a084f367e7c279afddc4f39113 | [
"MIT"
] | null | null | null | day4/day4.py | jberends/aoc2021 | 063a0b19bb13b3a084f367e7c279afddc4f39113 | [
"MIT"
] | null | null | null | day4/day4.py | jberends/aoc2021 | 063a0b19bb13b3a084f367e7c279afddc4f39113 | [
"MIT"
] | null | null | null | # uri: https://adventofcode.com/2021/day/4
from typing import Optional
from base import get_input
file_path = get_input(4, ".txt")
INPUT = """7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1
22 13 17 11 0
8 2 23 4 24
21 9 14 16 7
6 10 3 18 5
1 12 20 15 19
3 15 0 2 22
9 18 13 17 ... | 25.564103 | 90 | 0.591274 |
from typing import Optional
from base import get_input
file_path = get_input(4, ".txt")
INPUT = """7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1
22 13 17 11 0
8 2 23 4 24
21 9 14 16 7
6 10 3 18 5
1 12 20 15 19
3 15 0 2 22
9 18 13 17 5
19 8 7 25 23
20 11 10 24 4
14 21 16 ... | true | true |
f748b24b27483ef7323c784bdd0c56f69fe4f7b4 | 1,082 | py | Python | examples/servo_control/main.py | zerynth/lib-xinabox-oc05 | 6baa0677660c3b312207a14a99d42a93f7160f83 | [
"MIT"
] | null | null | null | examples/servo_control/main.py | zerynth/lib-xinabox-oc05 | 6baa0677660c3b312207a14a99d42a93f7160f83 | [
"MIT"
] | null | null | null | examples/servo_control/main.py | zerynth/lib-xinabox-oc05 | 6baa0677660c3b312207a14a99d42a93f7160f83 | [
"MIT"
] | null | null | null | ###############################################
# This is an example for the OC05 8-channel
# servo driver.
#
# A servo on channel 1 is positioned according
# to a desired degree of rotation.
###############################################
import streams
from xinabox.oc05 import oc05
# create a serial console... | 27.05 | 70 | 0.57671 | true | true | |
f748b3735fe3bcb7905fab7c85053e6d978932b1 | 72 | py | Python | conan/tools/meson/__init__.py | ssaavedra/conan | e15dc7902fbbeaf469798a3b9948ead1ecfc8e3c | [
"MIT"
] | 1 | 2021-08-05T15:33:08.000Z | 2021-08-05T15:33:08.000Z | conan/tools/meson/__init__.py | ssaavedra/conan | e15dc7902fbbeaf469798a3b9948ead1ecfc8e3c | [
"MIT"
] | null | null | null | conan/tools/meson/__init__.py | ssaavedra/conan | e15dc7902fbbeaf469798a3b9948ead1ecfc8e3c | [
"MIT"
] | null | null | null | # noinspection PyUnresolvedReferences
from .meson import MesonToolchain
| 24 | 37 | 0.875 |
from .meson import MesonToolchain
| true | true |
f748b42717f60eb64a5d7d5a261582b6132790d2 | 1,413 | py | Python | api/plots/bridge.py | equinor/lcm | 338bf67e6eb412446e469b4c73f7000990445ebd | [
"MIT"
] | 3 | 2020-12-02T11:14:31.000Z | 2021-12-09T16:53:53.000Z | api/plots/bridge.py | equinor/lcm | 338bf67e6eb412446e469b4c73f7000990445ebd | [
"MIT"
] | 76 | 2020-09-29T10:59:10.000Z | 2022-01-03T07:41:29.000Z | api/plots/bridge.py | equinor/lcm | 338bf67e6eb412446e469b4c73f7000990445ebd | [
"MIT"
] | 2 | 2021-01-25T14:24:57.000Z | 2021-01-25T14:51:16.000Z | import base64
from io import BytesIO
import matplotlib.pyplot as plt
from matplotlib.ticker import ScalarFormatter
from calculators.bridge import calculate_blend_cumulative, SIZE_STEPS, theoretical_bridge
from classes.product import Product
from controllers.products import products_get
def bridge_plot(products: dic... | 32.860465 | 113 | 0.716207 | import base64
from io import BytesIO
import matplotlib.pyplot as plt
from matplotlib.ticker import ScalarFormatter
from calculators.bridge import calculate_blend_cumulative, SIZE_STEPS, theoretical_bridge
from classes.product import Product
from controllers.products import products_get
def bridge_plot(products: dic... | true | true |
f748b42b42ca0aa1d8afc76e26cfefaf5bacf6cb | 8,448 | py | Python | tests/test_sequence_sampler.py | ZheyuYe/gluon-nlp | 23d9d73f89ed83376def818434684eca17a3dea6 | [
"Apache-2.0"
] | 1 | 2020-08-19T09:31:04.000Z | 2020-08-19T09:31:04.000Z | tests/test_sequence_sampler.py | ZheyuYe/gluon-nlp | 23d9d73f89ed83376def818434684eca17a3dea6 | [
"Apache-2.0"
] | null | null | null | tests/test_sequence_sampler.py | ZheyuYe/gluon-nlp | 23d9d73f89ed83376def818434684eca17a3dea6 | [
"Apache-2.0"
] | null | null | null | import collections
import functools
import mxnet as mx
import numpy as np
import scipy
import pytest
from mxnet.gluon import nn, HybridBlock
from numpy.testing import assert_allclose
from gluonnlp.sequence_sampler import BeamSearchScorer, BeamSearchSampler
mx.npx.set_np()
@pytest.mark.parametrize('length', [False, Tr... | 37.883408 | 104 | 0.609257 | import collections
import functools
import mxnet as mx
import numpy as np
import scipy
import pytest
from mxnet.gluon import nn, HybridBlock
from numpy.testing import assert_allclose
from gluonnlp.sequence_sampler import BeamSearchScorer, BeamSearchSampler
mx.npx.set_np()
@pytest.mark.parametrize('length', [False, Tr... | true | true |
f748b461907f6fb977ff9306cb09a346a41eaa24 | 37,316 | py | Python | Lib/test/test_hashlib.py | KinkowanWinter/Transcendental-Number-Utilization | 5f6d1d32850ad2cd2d03cc6f796d32ba7876fc39 | [
"PSF-2.0"
] | 27 | 2017-04-21T14:57:04.000Z | 2021-11-03T22:10:38.000Z | Lib/test/test_hashlib.py | KinkowanWinter/Transcendental-Number-Utilization | 5f6d1d32850ad2cd2d03cc6f796d32ba7876fc39 | [
"PSF-2.0"
] | 3 | 2017-04-24T13:25:31.000Z | 2017-04-24T13:27:12.000Z | Lib/test/test_hashlib.py | KinkowanWinter/Transcendental-Number-Utilization | 5f6d1d32850ad2cd2d03cc6f796d32ba7876fc39 | [
"PSF-2.0"
] | 11 | 2015-01-12T14:50:00.000Z | 2021-08-18T00:48:02.000Z | # Test hashlib module
#
# $Id$
#
# Copyright (C) 2005-2010 Gregory P. Smith (greg@krypto.org)
# Licensed to PSF under a Contributor Agreement.
#
import array
from binascii import unhexlify
import hashlib
import itertools
import os
import sys
try:
import threading
except ImportError:
threading = None
import... | 40.605005 | 202 | 0.629167 |
import array
from binascii import unhexlify
import hashlib
import itertools
import os
import sys
try:
import threading
except ImportError:
threading = None
import unittest
import warnings
from test import support
from test.support import _4G, bigmemtest, import_fresh_module
from http.client import HTTPE... | true | true |
f748b5051ed00d134f348635410b081d58185c28 | 1,585 | py | Python | brainbox/examples/docs_scatter_raster_plot.py | nbonacchi/ibllib | 9066c00a8e9a65a1d209144a2ac54d0b87bec0b3 | [
"MIT"
] | null | null | null | brainbox/examples/docs_scatter_raster_plot.py | nbonacchi/ibllib | 9066c00a8e9a65a1d209144a2ac54d0b87bec0b3 | [
"MIT"
] | null | null | null | brainbox/examples/docs_scatter_raster_plot.py | nbonacchi/ibllib | 9066c00a8e9a65a1d209144a2ac54d0b87bec0b3 | [
"MIT"
] | null | null | null | """
Plot raster across session
==========================
Example of how to plot scatter plot of spike depths vs spike times with colour and size of scatter
points scaled by spike amplitude
"""
import numpy as np
from brainbox.ephys_plots import scatter_raster_plot
from brainbox.plot_base import plot_scatter
... | 34.456522 | 99 | 0.688328 |
import numpy as np
from brainbox.ephys_plots import scatter_raster_plot
from brainbox.plot_base import plot_scatter
from oneibl.one import ONE
import matplotlib.pyplot as plt
import matplotlib
one = ONE()
eid = '671c7ea7-6726-4fbe-adeb-f89c2c8e489b'
probe = 'probe00'
spikes = one.load_object(eid, obj='... | true | true |
f748b5d586242012e243a06eb784f214b0d7898b | 27,015 | py | Python | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_redirects_operations.py | fhoering/autorest | b36c77ebb6a5c92aca72eea0894a683506af5817 | [
"MIT"
] | null | null | null | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_redirects_operations.py | fhoering/autorest | b36c77ebb6a5c92aca72eea0894a683506af5817 | [
"MIT"
] | null | null | null | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_redirects_operations.py | fhoering/autorest | b36c77ebb6a5c92aca72eea0894a683506af5817 | [
"MIT"
] | null | null | null | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 37.210744 | 90 | 0.637683 |
from msrest.pipeline import ClientRawResponse
from .. import models
class HttpRedirectsOperations(object):
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.config = ... | true | true |
f748b6299ebf950b66545fbfd0f12ef81e4bb378 | 88,853 | py | Python | template_container_macaque/labels/slice_12.py | lkondratova/Brainplot | 3c8a88c1995dedeaa5cbd88ee71499c7cf9c571d | [
"MIT"
] | null | null | null | template_container_macaque/labels/slice_12.py | lkondratova/Brainplot | 3c8a88c1995dedeaa5cbd88ee71499c7cf9c571d | [
"MIT"
] | null | null | null | template_container_macaque/labels/slice_12.py | lkondratova/Brainplot | 3c8a88c1995dedeaa5cbd88ee71499c7cf9c571d | [
"MIT"
] | null | null | null | coordinates_7F0030 = ((137, 134),
(137, 136), (138, 133), (138, 136), (139, 132), (139, 134), (139, 136), (140, 132), (140, 134), (140, 135), (140, 137), (141, 131), (141, 133), (141, 134), (141, 135), (141, 137), (142, 131), (142, 133), (142, 134), (142, 135), (142, 136), (142, 138), (143, 130), (143, 132), (143, 13... | 765.974138 | 865 | 0.499364 | coordinates_7F0030 = ((137, 134),
(137, 136), (138, 133), (138, 136), (139, 132), (139, 134), (139, 136), (140, 132), (140, 134), (140, 135), (140, 137), (141, 131), (141, 133), (141, 134), (141, 135), (141, 137), (142, 131), (142, 133), (142, 134), (142, 135), (142, 136), (142, 138), (143, 130), (143, 132), (143, 13... | true | true |
f748b6424aa449c100d06c2e428638ab969c9ba9 | 1,010 | py | Python | alphatwirl/loop/merge.py | shane-breeze/AlphaTwirl | 59dbd5348af31d02e133d43fd5bfaad6b99a155e | [
"BSD-3-Clause"
] | null | null | null | alphatwirl/loop/merge.py | shane-breeze/AlphaTwirl | 59dbd5348af31d02e133d43fd5bfaad6b99a155e | [
"BSD-3-Clause"
] | null | null | null | alphatwirl/loop/merge.py | shane-breeze/AlphaTwirl | 59dbd5348af31d02e133d43fd5bfaad6b99a155e | [
"BSD-3-Clause"
] | null | null | null | # Tai Sakuma <tai.sakuma@gmail.com>
##__________________________________________________________________||
def merge_in_order(map_, id_, data):
## merge to prev
idx = list(map_.keys()).index(id_)
idx_prev = idx - 1
if idx_prev < 0:
map_[id_] = data
else:
data_prev = list(map_.value... | 29.705882 | 70 | 0.591089 |
idx_prev = idx - 1
if idx_prev < 0:
map_[id_] = data
else:
data_prev = list(map_.values())[idx_prev]
id_prev = list(map_.keys())[idx_prev]
if data_prev is None:
map_[id_] = data
else:
if hasattr(data_prev, 'merge'):
data_prev.m... | true | true |
f748b76720a865c6fd6d0bdb6e9513830e33f897 | 1,644 | py | Python | examples/solutions/plot_brain_size.py | cogmaster-stats/python-cogstats | e8a7082a27370b5ac27721190a05ed2b5a463a10 | [
"CC-BY-3.0"
] | 14 | 2015-07-31T17:28:05.000Z | 2021-09-24T12:47:06.000Z | examples/solutions/plot_brain_size.py | cogmaster-stats/python-cogstats | e8a7082a27370b5ac27721190a05ed2b5a463a10 | [
"CC-BY-3.0"
] | null | null | null | examples/solutions/plot_brain_size.py | cogmaster-stats/python-cogstats | e8a7082a27370b5ac27721190a05ed2b5a463a10 | [
"CC-BY-3.0"
] | 8 | 2015-02-03T11:33:38.000Z | 2019-07-24T20:39:56.000Z | """
Relating Gender and IQ
=======================
Going back to the brain size + IQ data, test if the VIQ of male and
female are different after removing the effect of brain size, height and
weight.
"""
import pandas
from statsmodels.formula.api import ols
data = pandas.read_csv('../brain_size.csv', sep=';', na_valu... | 34.25 | 79 | 0.666667 | import pandas
from statsmodels.formula.api import ols
data = pandas.read_csv('../brain_size.csv', sep=';', na_values='.')
model = ols('VIQ ~ Gender + MRI_Count + Height', data).fit()
print(model.summary())
# coefficient of our model, and not a combination of coefficients.
# However, defining a contrast, which would... | true | true |
f748b7af3d1de5cc5d708d168de2539b8387a982 | 933 | py | Python | publisher/managers.py | akandada/django-model-publisher | ed58426b49c94a55454cf202fa1f129e191073b9 | [
"BSD-3-Clause"
] | null | null | null | publisher/managers.py | akandada/django-model-publisher | ed58426b49c94a55454cf202fa1f129e191073b9 | [
"BSD-3-Clause"
] | null | null | null | publisher/managers.py | akandada/django-model-publisher | ed58426b49c94a55454cf202fa1f129e191073b9 | [
"BSD-3-Clause"
] | null | null | null | from django.db import models
from django.db.models.query import QuerySet
from model_utils.managers import PassThroughManagerMixin
from .signals import publisher_pre_delete
from .middleware import get_draft_status
class PublisherQuerySet(QuerySet):
def drafts(self):
from .models import PublisherModelBas... | 30.096774 | 81 | 0.760986 | from django.db import models
from django.db.models.query import QuerySet
from model_utils.managers import PassThroughManagerMixin
from .signals import publisher_pre_delete
from .middleware import get_draft_status
class PublisherQuerySet(QuerySet):
def drafts(self):
from .models import PublisherModelBas... | true | true |
f748b87258b94d3a1f5805fc6b1259db2612f3c8 | 2,328 | py | Python | airflow/kubernetes/volume_mount.py | Hartorn/airflow | a79e2d4c4aa105f3fac5ae6a28e29af9cd572407 | [
"Apache-2.0"
] | 3 | 2015-08-25T13:56:44.000Z | 2020-03-21T10:26:58.000Z | airflow/kubernetes/volume_mount.py | Hartorn/airflow | a79e2d4c4aa105f3fac5ae6a28e29af9cd572407 | [
"Apache-2.0"
] | 37 | 2020-07-21T07:50:02.000Z | 2022-03-29T22:31:28.000Z | airflow/kubernetes/volume_mount.py | Hartorn/airflow | a79e2d4c4aa105f3fac5ae6a28e29af9cd572407 | [
"Apache-2.0"
] | 2 | 2018-07-24T08:54:45.000Z | 2018-08-31T13:41:50.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... | 31.459459 | 92 | 0.689433 |
import copy
import kubernetes.client.models as k8s
from airflow.kubernetes.k8s_model import K8SModel
class VolumeMount(K8SModel):
def __init__(self, name, mount_path, sub_path, read_only):
self.name = name
self.mount_path = mount_path
self.sub_path = sub_path
sel... | true | true |
f748b9ed8135410be809d0b12f49e88b1b82c486 | 857 | py | Python | roomate/migrations/0012_auto_20211027_2331.py | TheRK420/roommate | 89b9146cc57e45e32dcc308f859e5f06190159da | [
"Apache-2.0"
] | 1 | 2021-11-12T13:45:35.000Z | 2021-11-12T13:45:35.000Z | roomate/migrations/0012_auto_20211027_2331.py | TheRK420/roommate | 89b9146cc57e45e32dcc308f859e5f06190159da | [
"Apache-2.0"
] | null | null | null | roomate/migrations/0012_auto_20211027_2331.py | TheRK420/roommate | 89b9146cc57e45e32dcc308f859e5f06190159da | [
"Apache-2.0"
] | null | null | null | # Generated by Django 3.1.4 on 2021-10-27 18:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('roomate', '0011_auto_20211027_1651'),
]
operations = [
migrations.AlterField(
model_name='contactus',
name='id',
... | 29.551724 | 108 | 0.605601 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('roomate', '0011_auto_20211027_1651'),
]
operations = [
migrations.AlterField(
model_name='contactus',
name='id',
field=models.AutoField(auto_created=Tr... | true | true |
f748bb598e328e383c03742983690257b2903ec5 | 4,980 | py | Python | tasks.py | catamorphisms/cookiecutter-modern-pypackage | a8fd55a5f3f19e008cf6c536e68e46f51a91d994 | [
"MIT"
] | 1 | 2020-11-21T03:53:56.000Z | 2020-11-21T03:53:56.000Z | tasks.py | catamorphisms/cookiecutter-modern-pypackage | a8fd55a5f3f19e008cf6c536e68e46f51a91d994 | [
"MIT"
] | 168 | 2020-12-11T07:05:32.000Z | 2022-03-28T06:12:05.000Z | tasks.py | m4ta1l/cookiecutter-modern-pypackage | 38d98ffea681ea8a0b3bf089428e824622cc5a03 | [
"MIT"
] | null | null | null | """
Tasks for maintaining the project.
Execute 'invoke --list' for guidance on using Invoke
"""
import platform
import webbrowser
from pathlib import Path
from invoke import call, task
from invoke.context import Context
from invoke.runners import Result
ROOT_DIR = Path(__file__).parent
DOCS_DIR = ROOT_DIR.joinpath("... | 26.210526 | 96 | 0.599799 | import platform
import webbrowser
from pathlib import Path
from invoke import call, task
from invoke.context import Context
from invoke.runners import Result
ROOT_DIR = Path(__file__).parent
DOCS_DIR = ROOT_DIR.joinpath("docs")
DOCS_BUILD_DIR = DOCS_DIR.joinpath("_build")
DOCS_INDEX = DOCS_BUILD_DIR.joinpath("index.h... | true | true |
f748bc112bbf210ee71318efd0bb6a6adaba6770 | 7,079 | py | Python | lib/models/ctvae.py | kushaltirumala/callibratable_style_consistency_flies | d4e87d78bfa61068feff2169523bb963941163e2 | [
"MIT"
] | 1 | 2020-06-20T21:08:40.000Z | 2020-06-20T21:08:40.000Z | lib/models/ctvae.py | kushaltirumala/callibratable_style_consistency_flies | d4e87d78bfa61068feff2169523bb963941163e2 | [
"MIT"
] | null | null | null | lib/models/ctvae.py | kushaltirumala/callibratable_style_consistency_flies | d4e87d78bfa61068feff2169523bb963941163e2 | [
"MIT"
] | 2 | 2019-11-13T19:27:36.000Z | 2020-07-17T12:18:15.000Z | import torch
import torch.nn as nn
import numpy as np
from lib.models.core import BaseSequentialModel
from lib.distributions import Normal
class CTVAE(BaseSequentialModel):
name = 'ctvae' # conditional trajectory VAE policy
model_args = ['state_dim', 'action_dim', 'z_dim', 'h_dim', 'rnn_dim', 'num_layers']
... | 48.486301 | 242 | 0.595988 | import torch
import torch.nn as nn
import numpy as np
from lib.models.core import BaseSequentialModel
from lib.distributions import Normal
class CTVAE(BaseSequentialModel):
name = 'ctvae'
model_args = ['state_dim', 'action_dim', 'z_dim', 'h_dim', 'rnn_dim', 'num_layers']
requires_labels = True
def... | true | true |
f748bd2bdfb1deaf507ae931e2f3e7cc009bb2b8 | 2,465 | py | Python | src/condor_pytorch/losses.py | GarrettJenkinson/condor_pytorch | 53406e11c0b6e27483b81f91f555013cd7d02a71 | [
"MIT"
] | 3 | 2021-11-01T03:14:48.000Z | 2022-02-22T10:25:34.000Z | src/condor_pytorch/losses.py | GarrettJenkinson/condor_pytorch | 53406e11c0b6e27483b81f91f555013cd7d02a71 | [
"MIT"
] | null | null | null | src/condor_pytorch/losses.py | GarrettJenkinson/condor_pytorch | 53406e11c0b6e27483b81f91f555013cd7d02a71 | [
"MIT"
] | null | null | null | import torch.nn.functional as F
import torch
def CondorOrdinalCrossEntropy(logits, levels, importance_weights=None, reduction='mean'):
"""Computes the CONDOR loss described in
CONDOR TBD.
Parameters
----------
logits : torch.tensor, shape(num_examples, num_classes-1)
Outputs of the CONDO... | 32.434211 | 93 | 0.590669 | import torch.nn.functional as F
import torch
def CondorOrdinalCrossEntropy(logits, levels, importance_weights=None, reduction='mean'):
if not logits.shape == levels.shape:
raise ValueError("Please ensure that logits (%s) has the same shape as levels (%s). "
% (logits.shape, level... | true | true |
f748bde925781977b733b5d6a69cbbac329ef5f7 | 14,703 | py | Python | colorthief.py | gsornsen/color-thief-py | 44d582185aa339b4a7d7c664ff70a9f16c624786 | [
"BSD-3-Clause"
] | 2 | 2020-05-13T12:11:05.000Z | 2021-05-26T05:49:05.000Z | colorthief.py | gsornsen/color-thief-py | 44d582185aa339b4a7d7c664ff70a9f16c624786 | [
"BSD-3-Clause"
] | null | null | null | colorthief.py | gsornsen/color-thief-py | 44d582185aa339b4a7d7c664ff70a9f16c624786 | [
"BSD-3-Clause"
] | 2 | 2020-05-13T09:30:22.000Z | 2021-01-13T16:19:25.000Z | # -*- coding: utf-8 -*-
"""
colorthief
~~~~~~~~~~
Grabbing the color palette from an image.
:copyright: (c) 2015 by Shipeng Feng.
:license: BSD, see LICENSE for more details.
"""
__version__ = '0.2.1'
import math
from PIL import Image
class cached_property(object):
"""Decorator that create... | 33.264706 | 82 | 0.507447 |
__version__ = '0.2.1'
import math
from PIL import Image
class cached_property(object):
def __init__(self, func):
self.func = func
def __get__(self, instance, type):
res = instance.__dict__[self.func.__name__] = self.func(instance)
return res
class ColorThief(object):
def __in... | true | true |
f748be9967e6a8f958890992acca5b3581085f21 | 50,221 | py | Python | src/textacy/vsm/vectorizers.py | 8W9aG/textacy | 7f3bd999a79d85e967bcba66aa57816ed1172089 | [
"Apache-2.0"
] | 1 | 2021-11-03T19:11:11.000Z | 2021-11-03T19:11:11.000Z | src/textacy/vsm/vectorizers.py | 8W9aG/textacy | 7f3bd999a79d85e967bcba66aa57816ed1172089 | [
"Apache-2.0"
] | null | null | null | src/textacy/vsm/vectorizers.py | 8W9aG/textacy | 7f3bd999a79d85e967bcba66aa57816ed1172089 | [
"Apache-2.0"
] | 1 | 2022-02-20T14:23:03.000Z | 2022-02-20T14:23:03.000Z | """
:mod:`textacy.vsm.vectorizers`: Transform a collection of tokenized documents into
a document-term matrix of shape (# docs, # unique terms), with various ways to filter
or limit included terms and flexible weighting schemes for their values.
A second option aggregates terms in tokenized documents by provided grou... | 42.704932 | 100 | 0.597758 | import collections
import operator
from array import array
from typing import Dict, List
import numpy as np
import scipy.sparse as sp
from sklearn.preprocessing import normalize as normalize_mat
from .. import errors
from .matrix_utils import get_doc_lengths, get_inverse_doc_freqs, filter_terms_by_df
BM25_K1 = 1.6 ... | true | true |
f748bea0cea50b8cf8c56f16094e6249031f8d4e | 10,351 | py | Python | test/functional/zerocoin_publicSpend_reorg.py | MichaelHDesigns/abet | cc1d37ea4e43b48eca5dacc7e0a54c39e9e9f5a6 | [
"MIT"
] | 31 | 2018-10-20T03:48:53.000Z | 2022-03-10T08:41:53.000Z | test/functional/zerocoin_publicSpend_reorg.py | MichaelHDesigns/abet | cc1d37ea4e43b48eca5dacc7e0a54c39e9e9f5a6 | [
"MIT"
] | 25 | 2018-11-09T17:16:11.000Z | 2019-10-19T12:37:12.000Z | test/functional/zerocoin_publicSpend_reorg.py | MichaelHDesigns/abet | cc1d37ea4e43b48eca5dacc7e0a54c39e9e9f5a6 | [
"MIT"
] | 55 | 2018-10-20T13:40:39.000Z | 2022-03-07T07:13:02.000Z | # !/usr/bin/env python3
# Copyright (c) 2019 The PIVX developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Covers the scenario of two valid PoS blocks with same height
and same coinstake input.
'''
from copy import deep... | 49.526316 | 126 | 0.638103 |
from copy import deepcopy
from io import BytesIO
import time
from test_framework.messages import CTransaction, CBlock
from test_framework.util import bytes_to_hex_str, hex_str_to_bytes, assert_equal
from fake_stake.base_test import ABET_FakeStakeTest
class ZerocoinPublicSpendReorg(ABET_FakeStakeTest):
def ... | true | true |
f748bed96aca55d0c319396de63520e170016d9a | 30,445 | py | Python | wofry/propagator/wavefront1D/generic_wavefront.py | lucarebuffi/wofry | 07d1d00c828599b225a96e44713911830b3f0d6b | [
"MIT"
] | 3 | 2020-04-05T22:10:03.000Z | 2021-11-03T04:12:14.000Z | wofry/propagator/wavefront1D/generic_wavefront.py | lucarebuffi/wofry | 07d1d00c828599b225a96e44713911830b3f0d6b | [
"MIT"
] | 2 | 2018-11-09T09:05:17.000Z | 2019-04-03T09:39:47.000Z | wofry/propagator/wavefront1D/generic_wavefront.py | oasys-kit/wofry | 07d1d00c828599b225a96e44713911830b3f0d6b | [
"MIT"
] | 4 | 2019-02-14T10:10:59.000Z | 2021-02-24T22:26:45.000Z | import numpy, copy
import scipy.constants as codata
from srxraylib.util.data_structures import ScaledArray, ScaledMatrix
from wofry.propagator.wavefront import Wavefront, WavefrontDimension
from wofry.propagator.util.gaussian_schell_model import GaussianSchellModel1D
# needed for h5 i/o
import os
import sys
import ... | 47.274845 | 147 | 0.644802 | import numpy, copy
import scipy.constants as codata
from srxraylib.util.data_structures import ScaledArray, ScaledMatrix
from wofry.propagator.wavefront import Wavefront, WavefrontDimension
from wofry.propagator.util.gaussian_schell_model import GaussianSchellModel1D
import os
import sys
import time
from wofry.pro... | true | true |
f748c01cbd4ce872f44d6a8f29cc40f9c21d068a | 345 | py | Python | src/participants/helpers.py | leopiresgoss/django-etest | 55ec087999b53fc734c32e6b6a6d73885f224af5 | [
"MIT"
] | 6 | 2022-02-18T17:43:01.000Z | 2022-02-21T23:24:37.000Z | src/participants/helpers.py | leopiresgoss/django-etest | 55ec087999b53fc734c32e6b6a6d73885f224af5 | [
"MIT"
] | null | null | null | src/participants/helpers.py | leopiresgoss/django-etest | 55ec087999b53fc734c32e6b6a6d73885f224af5 | [
"MIT"
] | null | null | null | from tests.models import Test
from datetime import datetime
# To check and return test and participant
def check_test_participant(request, test_code):
test = Test.objects.filter(test_code=test_code, deadline__gte=datetime.now())
participant = request.session.get('participant')
return {'test': test, 'p... | 38.333333 | 81 | 0.765217 | from tests.models import Test
from datetime import datetime
def check_test_participant(request, test_code):
test = Test.objects.filter(test_code=test_code, deadline__gte=datetime.now())
participant = request.session.get('participant')
return {'test': test, 'participant': participant} | true | true |
f748c194a5a19f79f72df3ce0c61500978f55a22 | 3,185 | py | Python | data_conversions/prepare_amsterdam_filelists.py | dmitrykudinov/PointCNN | 2e25f6cb3907728adc602d1d25938c66b7ebacc9 | [
"MIT"
] | 1 | 2021-09-20T09:34:14.000Z | 2021-09-20T09:34:14.000Z | data_conversions/prepare_amsterdam_filelists.py | dmitrykudinov/PointCNN | 2e25f6cb3907728adc602d1d25938c66b7ebacc9 | [
"MIT"
] | null | null | null | data_conversions/prepare_amsterdam_filelists.py | dmitrykudinov/PointCNN | 2e25f6cb3907728adc602d1d25938c66b7ebacc9 | [
"MIT"
] | 1 | 2021-09-20T09:34:20.000Z | 2021-09-20T09:34:20.000Z | #!/usr/bin/python3
'''Prepare Filelists for Semantic3D Segmentation Task.'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import math
import random
import argparse
from datetime import datetime
def main():
parser = argparse.ArgumentParser... | 40.833333 | 119 | 0.613815 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import math
import random
import argparse
from datetime import datetime
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--folder', '-f', help='Path to data folder')
... | true | true |
f748c1f616c0358865083d3f51ce9d9d8c0fe515 | 4,213 | py | Python | mongoengine_migrate/utils.py | vmdhhh/mongoengine-migrate | 9ac00fa9fcc77f56fe5867a68b20e5d64d2c0688 | [
"Apache-2.0"
] | null | null | null | mongoengine_migrate/utils.py | vmdhhh/mongoengine-migrate | 9ac00fa9fcc77f56fe5867a68b20e5d64d2c0688 | [
"Apache-2.0"
] | null | null | null | mongoengine_migrate/utils.py | vmdhhh/mongoengine-migrate | 9ac00fa9fcc77f56fe5867a68b20e5d64d2c0688 | [
"Apache-2.0"
] | null | null | null | __all__ = [
'UNSET',
'Diff',
'Slotinit',
'get_closest_parent',
'get_document_type',
'document_type_to_class_name'
]
import inspect
from typing import Type, Iterable, Optional, NamedTuple, Any
from mongoengine import EmbeddedDocument
from mongoengine.base import BaseDocument
from .flags import... | 28.659864 | 98 | 0.642535 | __all__ = [
'UNSET',
'Diff',
'Slotinit',
'get_closest_parent',
'get_document_type',
'document_type_to_class_name'
]
import inspect
from typing import Type, Iterable, Optional, NamedTuple, Any
from mongoengine import EmbeddedDocument
from mongoengine.base import BaseDocument
from .flags import... | true | true |
f748c25d725c017ebcca12ceb07e300983027167 | 1,923 | py | Python | parser/cmds/predict.py | Jacob-Zhou/spw-parser | 5f746a54d9a1da0591fc34f024eac2639bc3f407 | [
"MIT"
] | null | null | null | parser/cmds/predict.py | Jacob-Zhou/spw-parser | 5f746a54d9a1da0591fc34f024eac2639bc3f407 | [
"MIT"
] | null | null | null | parser/cmds/predict.py | Jacob-Zhou/spw-parser | 5f746a54d9a1da0591fc34f024eac2639bc3f407 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from datetime import datetime
from parser import Model
from parser.cmds.cmd import CMD
from parser.utils.corpus import Corpus
from parser.utils.data import TextDataset, batchify
import torch
class Predict(CMD):
def add_subparser(self, name, parser):
subparser = parser.add_parser... | 34.963636 | 73 | 0.580343 |
from datetime import datetime
from parser import Model
from parser.cmds.cmd import CMD
from parser.utils.corpus import Corpus
from parser.utils.data import TextDataset, batchify
import torch
class Predict(CMD):
def add_subparser(self, name, parser):
subparser = parser.add_parser(
name, hel... | true | true |
f748c35b3d373522690182e71799f77c8cb89984 | 4,586 | py | Python | McFee_Functions.py | AntayaScienceAndTechnology/McFee | 96a9a6d552253c622147fe9c9c1c253ba7bc66a2 | [
"MIT"
] | null | null | null | McFee_Functions.py | AntayaScienceAndTechnology/McFee | 96a9a6d552253c622147fe9c9c1c253ba7bc66a2 | [
"MIT"
] | null | null | null | McFee_Functions.py | AntayaScienceAndTechnology/McFee | 96a9a6d552253c622147fe9c9c1c253ba7bc66a2 | [
"MIT"
] | null | null | null | __author__ = 'Chris Jones'
import numpy as np
from scipy.integrate import quad
import heat_xfer as hx
# Values for default parameters
default_rrr = 150
default_I = 200.
default_res_increase = 0.
default_rho_273 = 1.71e-6
linspace_num = 500
def get_kr_ave1(u_l, u_h):
"""
Returns the average k*r value from u... | 24.524064 | 105 | 0.633232 | __author__ = 'Chris Jones'
import numpy as np
from scipy.integrate import quad
import heat_xfer as hx
default_rrr = 150
default_I = 200.
default_res_increase = 0.
default_rho_273 = 1.71e-6
linspace_num = 500
def get_kr_ave1(u_l, u_h):
if u_l == u_h:
return 0.
kr_func = lambda u: hx.therm_cond_cu(... | true | true |
f748c3a0b569e9edf17976133f343a47b0b392bf | 52,491 | py | Python | heat/tests/test_software_deployment.py | maestro-hybrid-cloud/heat | 91a4bb3170bd81b1c67a896706851e55709c9b5a | [
"Apache-2.0"
] | null | null | null | heat/tests/test_software_deployment.py | maestro-hybrid-cloud/heat | 91a4bb3170bd81b1c67a896706851e55709c9b5a | [
"Apache-2.0"
] | null | null | null | heat/tests/test_software_deployment.py | maestro-hybrid-cloud/heat | 91a4bb3170bd81b1c67a896706851e55709c9b5a | [
"Apache-2.0"
] | null | null | null | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | 38.286652 | 79 | 0.575127 |
import copy
import re
import uuid
import mock
import six
from heat.common import exception as exc
from heat.common.i18n import _
from heat.engine.clients.os import nova
from heat.engine.clients.os import swift
from heat.engine.clients.os import zaqar
from heat.engine.resources.openstack.heat import softw... | true | true |
f748c460a3179ff60a98f6203774feea81eee84f | 2,013 | py | Python | chatspace/dataset.py | bestend/chatspace | 04819eaaf4e9e2d43f8aa8ed5b39f3100b33f921 | [
"Apache-2.0"
] | 1 | 2021-01-13T19:22:09.000Z | 2021-01-13T19:22:09.000Z | chatspace/dataset.py | HongSic/chatspace | 04819eaaf4e9e2d43f8aa8ed5b39f3100b33f921 | [
"Apache-2.0"
] | null | null | null | chatspace/dataset.py | HongSic/chatspace | 04819eaaf4e9e2d43f8aa8ed5b39f3100b33f921 | [
"Apache-2.0"
] | 1 | 2021-01-13T23:55:12.000Z | 2021-01-13T23:55:12.000Z | import tensorflow as tf
def make_chatspace_training_dataset(
lookup_table: tf.lookup.StaticHashTable,
space_skip_prob: float,
):
"""
Chatspace ๋ชจ๋ธ์ ๋ฃ์ Input์ ๋ง๋๋ ํจ์๋ฅผ ๋ฐํํฉ๋๋ค.
์ ์ ๋ฌธ์ฅ์ ์
๋ ฅ์ผ๋ก ๋ฐ์ ๋๋คํ๊ฒ ๋์ด์ฐ๊ธฐ๋ฅผ ์ง์๋๋ค.
:param lookup_table: Vocab ์ ๋ณด๋ก ์ด๊ธฐํ๋ ``tf.lookup.StaticHashTable``
:param space_skip_p... | 30.5 | 81 | 0.518629 | import tensorflow as tf
def make_chatspace_training_dataset(
lookup_table: tf.lookup.StaticHashTable,
space_skip_prob: float,
):
@tf.function
def _mapping_function(
sentence: tf.Tensor,
):
sentence = tf.strings.unicode_split(sentence, "UTF-8")
sentence = tf.strings.regex_r... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.