hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f761c60b44b290f10e7f59856e2b1cf4e500a9c9 | 7,232 | py | Python | tests/test_special.py | janpipek/physt | bf6b05952b7d09bbbdae2b077f0989c392eac13e | [
"MIT"
] | 123 | 2016-04-05T10:29:02.000Z | 2021-12-15T21:18:23.000Z | tests/test_special.py | janpipek/physt | bf6b05952b7d09bbbdae2b077f0989c392eac13e | [
"MIT"
] | 70 | 2016-03-25T19:10:49.000Z | 2022-03-09T11:47:08.000Z | tests/test_special.py | janpipek/physt | bf6b05952b7d09bbbdae2b077f0989c392eac13e | [
"MIT"
] | 16 | 2016-09-07T14:07:20.000Z | 2020-07-23T16:13:59.000Z | import numpy as np
import pytest
from physt import special_histograms
from physt.special_histograms import AzimuthalHistogram, azimuthal
@pytest.fixture
def empty_azimuthal() -> AzimuthalHistogram:
return azimuthal(
np.zeros(
0,
),
np.zeros(
0,
),
)
c... | 36.525253 | 97 | 0.589049 | import numpy as np
import pytest
from physt import special_histograms
from physt.special_histograms import AzimuthalHistogram, azimuthal
@pytest.fixture
def empty_azimuthal() -> AzimuthalHistogram:
return azimuthal(
np.zeros(
0,
),
np.zeros(
0,
),
)
c... | true | true |
f761c63230b5f3dd342bbb9fc29c53cb2734a3df | 841 | py | Python | office365api/model/message.py | swimlane/python-office365 | 42c0c0cad0d92e4cd7f18fcf3e75153045a9ea0f | [
"MIT"
] | 21 | 2016-10-27T10:39:25.000Z | 2021-06-15T01:03:06.000Z | office365api/model/message.py | swimlane/python-office365 | 42c0c0cad0d92e4cd7f18fcf3e75153045a9ea0f | [
"MIT"
] | 6 | 2017-03-08T06:39:59.000Z | 2021-07-12T01:35:05.000Z | office365api/model/message.py | swimlane/python-office365 | 42c0c0cad0d92e4cd7f18fcf3e75153045a9ea0f | [
"MIT"
] | 15 | 2016-12-11T22:33:56.000Z | 2021-09-13T17:44:11.000Z | from office365api.model.model import Model
class Message(Model):
select = ['From', 'Subject', 'Body', 'ToRecipients', 'DateTimeReceived', 'HasAttachments']
def __init__(self, From, ToRecipients, Subject, Body,
HasAttachments=False, Id=None, DateTimeReceived=None):
self.Id = Id
... | 31.148148 | 94 | 0.612366 | from office365api.model.model import Model
class Message(Model):
select = ['From', 'Subject', 'Body', 'ToRecipients', 'DateTimeReceived', 'HasAttachments']
def __init__(self, From, ToRecipients, Subject, Body,
HasAttachments=False, Id=None, DateTimeReceived=None):
self.Id = Id
... | true | true |
f761c684b6d7588fbe34b45b9a49ab14fa1ea2b6 | 8,444 | py | Python | contrib/devtools/update-translations.py | pbitmonkey/bitmonkey-debug | f48bab02e88b1fcf445c59380e6fda018d86f462 | [
"MIT"
] | null | null | null | contrib/devtools/update-translations.py | pbitmonkey/bitmonkey-debug | f48bab02e88b1fcf445c59380e6fda018d86f462 | [
"MIT"
] | null | null | null | contrib/devtools/update-translations.py | pbitmonkey/bitmonkey-debug | f48bab02e88b1fcf445c59380e6fda018d86f462 | [
"MIT"
] | 1 | 2020-11-04T06:59:13.000Z | 2020-11-04T06:59:13.000Z | #!/usr/bin/env python3
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the foll... | 39.092593 | 142 | 0.638915 | import subprocess
import re
import sys
import os
import io
import xml.etree.ElementTree as ET
TX = 'tx'
SOURCE_LANG = 'bitmonkey_en.ts'
LOCALE_DIR = 'src/qt/locale'
MIN_NUM_MESSAGES = 10
ADDRESS_REGEXP = re.compile('([13]|bc1)[a-zA-Z0-9]{30,}')
def check_at_repository_root():
if not os.path.exists('.git'):
... | true | true |
f761c8101c2cf3d3370f4b299f86860a21c71c9b | 5,849 | py | Python | tests/test_editor.py | OmenApps/django-rest-framework-datatables-editor | fc35d96b7eed649a667eed057c0b768fb2c6fcbd | [
"MIT"
] | null | null | null | tests/test_editor.py | OmenApps/django-rest-framework-datatables-editor | fc35d96b7eed649a667eed057c0b768fb2c6fcbd | [
"MIT"
] | null | null | null | tests/test_editor.py | OmenApps/django-rest-framework-datatables-editor | fc35d96b7eed649a667eed057c0b768fb2c6fcbd | [
"MIT"
] | 1 | 2021-11-05T17:56:03.000Z | 2021-11-05T17:56:03.000Z | from django.db.models import Q
from django.test import TestCase
from rest_framework.test import APIClient
from albums.models import Album
from albums.views import AlbumViewSet
from rest_framework_datatables_editor.pagination import (
DatatablesPageNumberPagination
)
class DatatablesEditorTestCase(TestCase):
... | 37.018987 | 112 | 0.562318 | from django.db.models import Q
from django.test import TestCase
from rest_framework.test import APIClient
from albums.models import Album
from albums.views import AlbumViewSet
from rest_framework_datatables_editor.pagination import (
DatatablesPageNumberPagination
)
class DatatablesEditorTestCase(TestCase):
... | true | true |
f761c83615741ecf68c690257a269dbd02ed7d55 | 1,457 | py | Python | oled.py | Pixelschleuder/steelseries-oled | 0454e0c55353e8cd87748f2572122fd1698fd03b | [
"MIT"
] | null | null | null | oled.py | Pixelschleuder/steelseries-oled | 0454e0c55353e8cd87748f2572122fd1698fd03b | [
"MIT"
] | null | null | null | oled.py | Pixelschleuder/steelseries-oled | 0454e0c55353e8cd87748f2572122fd1698fd03b | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from PIL import Image, ImageSequence
from easyhid import Enumeration
from time import sleep
import signal
import sys
def signal_handler(sig, frame):
try:
# Blank screen on shutdown
dev.send_feature_report(bytearray([0x61] + [0x00] * 641))
dev.close()
print("\n")... | 23.5 | 79 | 0.66232 |
from PIL import Image, ImageSequence
from easyhid import Enumeration
from time import sleep
import signal
import sys
def signal_handler(sig, frame):
try:
dev.send_feature_report(bytearray([0x61] + [0x00] * 641))
dev.close()
print("\n")
sys.exit(0)
except:
sys.exit(... | true | true |
f761c904ea0c3f627d76decae869c5ea9349b6d9 | 876 | py | Python | casepro/cases/migrations/0015_contact.py | praekelt/helpdesk | 69a7242679c30d2f7cb30a433809e738b9756a3c | [
"BSD-3-Clause"
] | null | null | null | casepro/cases/migrations/0015_contact.py | praekelt/helpdesk | 69a7242679c30d2f7cb30a433809e738b9756a3c | [
"BSD-3-Clause"
] | null | null | null | casepro/cases/migrations/0015_contact.py | praekelt/helpdesk | 69a7242679c30d2f7cb30a433809e738b9756a3c | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.postgres.fields
class Migration(migrations.Migration):
dependencies = [
('cases', '0014_label_uuid_not_null'),
]
operations = [
migrations.CreateModel(
... | 35.04 | 182 | 0.639269 | from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.postgres.fields
class Migration(migrations.Migration):
dependencies = [
('cases', '0014_label_uuid_not_null'),
]
operations = [
migrations.CreateModel(
name='Contact',
... | true | true |
f761c94e89800f2e0698a968309cc7f4027a669c | 3,955 | py | Python | alipay/aop/api/request/AlipayOpenPublicMenuModifyRequest.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/request/AlipayOpenPublicMenuModifyRequest.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/request/AlipayOpenPublicMenuModifyRequest.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.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AlipayOpenPublicMenuModifyModel import AlipayOpenPublicMenuModifyModel
class AlipayOpenPublicMenuModifyRequest(object):
def __i... | 27.275862 | 148 | 0.643236 | import json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AlipayOpenPublicMenuModifyModel import AlipayOpenPublicMenuModifyModel
class AlipayOpenPublicMenuModifyRequest(object):
def __init__(self, biz_model=None):
self._biz... | true | true |
f761c9d8c1c482668c7249d5828554d073ee3a17 | 6,111 | py | Python | env/lib/python3.4/site-packages/bulbs/rest.py | mudbungie/NetExplorer | a2a7e027a40de75625aca8821646b63e5a844889 | [
"MIT"
] | 234 | 2015-01-06T20:39:38.000Z | 2022-01-09T06:37:51.000Z | env/lib/python3.4/site-packages/bulbs/rest.py | mudbungie/NetExplorer | a2a7e027a40de75625aca8821646b63e5a844889 | [
"MIT"
] | 10 | 2015-02-10T18:44:04.000Z | 2020-03-06T04:15:51.000Z | env/lib/python3.4/site-packages/bulbs/rest.py | mudbungie/NetExplorer | a2a7e027a40de75625aca8821646b63e5a844889 | [
"MIT"
] | 30 | 2015-01-06T08:06:19.000Z | 2020-03-05T16:18:02.000Z | # -*- coding: utf-8 -*-
#
# Copyright 2012 James Thornton (http://jamesthornton.com)
# BSD License (see LICENSE for details)
#
"""
Low-level module for connecting to the Rexster REST server and
returning a Response object.
"""
import httplib2
import bulbs
from bulbs.base import Response
from .utils import json, get_l... | 26.68559 | 83 | 0.604484 | import httplib2
import bulbs
from bulbs.base import Response
from .utils import json, get_logger, quote, urlencode, encode_dict
log = get_logger(__name__)
GET = "GET"
PUT = "PUT"
POST = "POST"
DELETE = "DELETE"
def ok(http_resp):
return
def created(http_resp):
return
def no_content(http_resp):
re... | true | true |
f761ca2afad3c8e3fe27c696a6f6e592fc9bfc22 | 85,414 | py | Python | selfdrive/car/hyundai/values.py | DS1SQM/OPKR083_210318 | f74f2f2bce7bd11b16c2168d3f87c9a0b4086431 | [
"MIT"
] | 1 | 2021-09-23T07:39:59.000Z | 2021-09-23T07:39:59.000Z | selfdrive/car/hyundai/values.py | DS1SQM/OPKR083_210318 | f74f2f2bce7bd11b16c2168d3f87c9a0b4086431 | [
"MIT"
] | null | null | null | selfdrive/car/hyundai/values.py | DS1SQM/OPKR083_210318 | f74f2f2bce7bd11b16c2168d3f87c9a0b4086431 | [
"MIT"
] | null | null | null | # flake8: noqa
from cereal import car
from selfdrive.car import dbc_dict
from common.params import Params
Ecu = car.CarParams.Ecu
# Steer torque limits
class CarControllerParams:
params = Params()
STEER_MAX = int(params.get('SteerMaxAdj')) # 409 is the max, 255 is stock
STEER_DELTA_UP = int(params.get('SteerD... | 132.630435 | 903 | 0.552158 |
from cereal import car
from selfdrive.car import dbc_dict
from common.params import Params
Ecu = car.CarParams.Ecu
class CarControllerParams:
params = Params()
STEER_MAX = int(params.get('SteerMaxAdj')) STEER_DELTA_UP = int(params.get('SteerDeltaUpAdj'))
STEER_DELTA_DOWN = int(params.get('SteerDeltaDownAdj'... | true | true |
f761caebaf76abb13c66d6734dd0ec5473e80df9 | 735 | py | Python | manim/project/myworks/sinh_poisson.py | KotaTakeda/visualizations | c92b7cb9d994c1804954c1741ad6a485d059c7e3 | [
"MIT"
] | null | null | null | manim/project/myworks/sinh_poisson.py | KotaTakeda/visualizations | c92b7cb9d994c1804954c1741ad6a485d059c7e3 | [
"MIT"
] | null | null | null | manim/project/myworks/sinh_poisson.py | KotaTakeda/visualizations | c92b7cb9d994c1804954c1741ad6a485d059c7e3 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from manim import *
class SinhPoisson(Scene):
def construct(self):
spe = MathTex(r"-\Delta", " \Psi", "=", "2 \sinh(-\\beta \Psi)")
self.play(Write(spe[:2]))
self.play(Write(spe[2]))
self.play(Write(spe[3]))
# self.play(FadeOut(spe[0]))
# spe... | 36.75 | 146 | 0.565986 | from manim import *
class SinhPoisson(Scene):
def construct(self):
spe = MathTex(r"-\Delta", " \Psi", "=", "2 \sinh(-\\beta \Psi)")
self.play(Write(spe[:2]))
self.play(Write(spe[2]))
self.play(Write(spe[3]))
self.play(FadeOut(*spe[1:]))
... | true | true |
f761caedd13288b3d150f6e3bbad747d096ceac4 | 3,157 | py | Python | src/oauth.py | mogron/ep_dyntest | 79722001c0d00dc361632628cf5b57a6dbd4727d | [
"BSD-3-Clause"
] | 6 | 2015-07-24T10:07:13.000Z | 2018-11-11T06:17:03.000Z | src/oauth.py | mogron/ep_dyntest | 79722001c0d00dc361632628cf5b57a6dbd4727d | [
"BSD-3-Clause"
] | 1 | 2021-02-23T12:54:04.000Z | 2021-02-23T12:54:04.000Z | src/oauth.py | mogron/ep_dyntest | 79722001c0d00dc361632628cf5b57a6dbd4727d | [
"BSD-3-Clause"
] | 5 | 2016-02-24T15:35:00.000Z | 2020-11-06T09:37:06.000Z | # -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, division
import sys
import requests
import urllib.parse
try:
from configparser import SafeConfigParser
except ImportError:
from ConfigParser import SafeConfigParser
__author__ = 'Florian Wilhelm'
__copyright__ = 'Blue Yonder'
__... | 32.885417 | 79 | 0.622743 |
from __future__ import print_function, absolute_import, division
import sys
import requests
import urllib.parse
try:
from configparser import SafeConfigParser
except ImportError:
from ConfigParser import SafeConfigParser
__author__ = 'Florian Wilhelm'
__copyright__ = 'Blue Yonder'
__license__ = 'new BSD'
... | true | true |
f761cb9c200a1f935e9ab78687b5c11170c2335e | 1,915 | py | Python | smartsexplore/util.py | UHH-CIW-Project2020/SMARTSexplore | 3969e33ab0c52ab6da3ed1792696c049786d71ca | [
"MIT"
] | 1 | 2021-04-07T12:38:15.000Z | 2021-04-07T12:38:15.000Z | smartsexplore/util.py | UHH-CIW-Project2020/SMARTSexplore | 3969e33ab0c52ab6da3ed1792696c049786d71ca | [
"MIT"
] | null | null | null | smartsexplore/util.py | UHH-CIW-Project2020/SMARTSexplore | 3969e33ab0c52ab6da3ed1792696c049786d71ca | [
"MIT"
] | 2 | 2021-03-28T14:40:46.000Z | 2021-04-09T09:04:39.000Z | """
Contains reusable utility code for the SMARTSexplore application.
"""
import subprocess
import logging
def run_process(cmd, timeout=None, stdout=None, stderr=None, reraise_exceptions=False, **kwargs):
"""
Helper function that wraps subprocess.run with some additional
exception handling that is useful... | 38.3 | 97 | 0.661097 |
import subprocess
import logging
def run_process(cmd, timeout=None, stdout=None, stderr=None, reraise_exceptions=False, **kwargs):
stdout = stdout or subprocess.PIPE
stderr = stderr or subprocess.PIPE
process = None
try:
process = subprocess.run(
cmd, stdout=stdout, stderr=stderr,... | true | true |
f761cbc4c414531b37443d2608ecf8cf3c9cf28e | 218 | py | Python | day3/test_day3.py | chrisb87/advent_of_code_2016 | 668a7c5e3f2aac036dcf0091ca62a47cb0c54ba8 | [
"Unlicense"
] | 1 | 2016-12-07T20:28:12.000Z | 2016-12-07T20:28:12.000Z | day3/test_day3.py | chrisb87/advent_of_code_2016 | 668a7c5e3f2aac036dcf0091ca62a47cb0c54ba8 | [
"Unlicense"
] | null | null | null | day3/test_day3.py | chrisb87/advent_of_code_2016 | 668a7c5e3f2aac036dcf0091ca62a47cb0c54ba8 | [
"Unlicense"
] | null | null | null | import unittest
from day3 import *
class TestDay3Part1(unittest.TestCase):
def test_solve_part_1(self):
self.assertEqual(solve_part_1(), 862)
def test_solve_part_2(self):
self.assertEqual(solve_part_2(), 1577)
| 21.8 | 40 | 0.784404 | import unittest
from day3 import *
class TestDay3Part1(unittest.TestCase):
def test_solve_part_1(self):
self.assertEqual(solve_part_1(), 862)
def test_solve_part_2(self):
self.assertEqual(solve_part_2(), 1577)
| true | true |
f761cbe7f21fb3f860ac38d47d5da3168db7276d | 4,720 | py | Python | grading_tool.py | pichetzh/jama16-retina-replication | ec7ea0c270c8e371549b2c8a1817cbf7b947ec25 | [
"MIT"
] | 108 | 2018-03-13T02:51:39.000Z | 2021-12-09T12:27:52.000Z | grading_tool.py | pichetzh/jama16-retina-replication | ec7ea0c270c8e371549b2c8a1817cbf7b947ec25 | [
"MIT"
] | 16 | 2018-03-15T14:01:28.000Z | 2021-04-29T02:19:43.000Z | grading_tool.py | pichetzh/jama16-retina-replication | ec7ea0c270c8e371549b2c8a1817cbf7b947ec25 | [
"MIT"
] | 41 | 2018-03-13T02:51:45.000Z | 2021-05-04T01:27:48.000Z | import PIL.Image
from tkinter import *
from tkinter import filedialog
import PIL.ImageTk
import os
import sys
from glob import glob
import csv
from shutil import copyfile
class GradingTool(Frame):
def chg_image(self):
self.image = PIL.ImageTk.PhotoImage(self.im)
self.label.config(image=self.image, ... | 33.714286 | 90 | 0.574364 | import PIL.Image
from tkinter import *
from tkinter import filedialog
import PIL.ImageTk
import os
import sys
from glob import glob
import csv
from shutil import copyfile
class GradingTool(Frame):
def chg_image(self):
self.image = PIL.ImageTk.PhotoImage(self.im)
self.label.config(image=self.image, ... | true | true |
f761cc39d306714a22c5904666393827332bb54d | 1,373 | py | Python | packages/fetchai/skills/weather_station/weather_station_data_model.py | lrahmani/agents-aea | 9bd1d51530fc21bf41b5adea031cda19a94b048b | [
"Apache-2.0"
] | null | null | null | packages/fetchai/skills/weather_station/weather_station_data_model.py | lrahmani/agents-aea | 9bd1d51530fc21bf41b5adea031cda19a94b048b | [
"Apache-2.0"
] | 1 | 2020-02-21T14:28:13.000Z | 2020-03-05T14:53:53.000Z | packages/fetchai/skills/weather_station/weather_station_data_model.py | cyenyxe/agents-aea | c2aec9127028ae13def3f69fbc80d35400de1565 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... | 36.131579 | 86 | 0.616169 |
from aea.helpers.search.models import Attribute, DataModel
SCHEME = {"country": "UK", "city": "Cambridge"}
class WEATHER_STATION_DATAMODEL(DataModel):
def __init__(self):
self.ATTRIBUTE_COUNTRY = Attribute("country", str, True)
self.ATTRIBUTE_CITY = Attribute("city", str, True)
super(... | true | true |
f761cc69e6ecca0a94ec0ede87e2639a244b61a8 | 2,595 | py | Python | Python/binary-tree-coloring-game.py | RideGreg/LeetCode | b70818b1e6947bf29519a24f78816e022ebab59e | [
"MIT"
] | 1 | 2022-01-30T06:55:28.000Z | 2022-01-30T06:55:28.000Z | Python/binary-tree-coloring-game.py | RideGreg/LeetCode | b70818b1e6947bf29519a24f78816e022ebab59e | [
"MIT"
] | null | null | null | Python/binary-tree-coloring-game.py | RideGreg/LeetCode | b70818b1e6947bf29519a24f78816e022ebab59e | [
"MIT"
] | 1 | 2021-12-31T03:56:39.000Z | 2021-12-31T03:56:39.000Z | # Time: O(n)
# Space: O(h)
# 1145
# Two players play a turn based game on a binary tree. We are given the root of this binary tree,
# and the number of nodes n in the tree. n is odd, and each node has a distinct value from 1 to n.
#
# Initially, the first player names a value x with 1 <= x <= n, and the second play... | 37.071429 | 103 | 0.641618 |
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def btreeGameWinningMove(self, root, n, x):
def dfs(node):
if not node:
return 0
left, right = dfs(node.left), dfs(... | true | true |
f761cc95812cd79f198b5336cee6dccef404aa70 | 521 | py | Python | lab8.py | ConAllen3/ia241 | 78ed2a8550dcbe6424df9f606a5832e5fdec8453 | [
"MIT"
] | null | null | null | lab8.py | ConAllen3/ia241 | 78ed2a8550dcbe6424df9f606a5832e5fdec8453 | [
"MIT"
] | null | null | null | lab8.py | ConAllen3/ia241 | 78ed2a8550dcbe6424df9f606a5832e5fdec8453 | [
"MIT"
] | null | null | null | '''
lab8
'''
#3.1
def count_words(input_str):
return len(input_str.split())
#3.2
demo_str = 'Hello World!'
print(count_words(demo_str))
#3.3
def find_min_num(input_list):
min_item = input_list[0]
for num in input_list:
if type(num) is not str:
if min_item>= ... | 14.081081 | 33 | 0.575816 |
def count_words(input_str):
return len(input_str.split())
demo_str = 'Hello World!'
print(count_words(demo_str))
def find_min_num(input_list):
min_item = input_list[0]
for num in input_list:
if type(num) is not str:
if min_item>= num:
min_ite... | true | true |
f761ccae7efded69efcf6f4b52ea33391b8db532 | 822 | py | Python | tools/plot.py | kbrezinski/complexity | 2077825c8ec64df03dfb9f791b7578d64cb35567 | [
"MIT"
] | null | null | null | tools/plot.py | kbrezinski/complexity | 2077825c8ec64df03dfb9f791b7578d64cb35567 | [
"MIT"
] | null | null | null | tools/plot.py | kbrezinski/complexity | 2077825c8ec64df03dfb9f791b7578d64cb35567 | [
"MIT"
] | null | null | null |
from scipy import stats
import matplotlib.pyplot as plt
import numpy as np
def loglog(sums2,interval=None,type=None,plot=False,smoothing=None):
if type is None:
y = [np.log(item) for item in sums2]
x = [1/(vel+1) for vel in interval]
slope, yInt, _,_,_ = stats.linregress(x,y)
elif t... | 26.516129 | 69 | 0.597324 |
from scipy import stats
import matplotlib.pyplot as plt
import numpy as np
def loglog(sums2,interval=None,type=None,plot=False,smoothing=None):
if type is None:
y = [np.log(item) for item in sums2]
x = [1/(vel+1) for vel in interval]
slope, yInt, _,_,_ = stats.linregress(x,y)
elif t... | true | true |
f761ccebef814b096ed84b73dda85ba3f568e84a | 3,134 | py | Python | features/steps/slots.py | kostiantyn-nemchenko/patroni | a431f50378007efebdcfcf492ea2ba4194adcf9d | [
"MIT"
] | 3 | 2020-01-08T22:06:19.000Z | 2021-04-30T19:41:54.000Z | features/steps/slots.py | kostiantyn-nemchenko/patroni | a431f50378007efebdcfcf492ea2ba4194adcf9d | [
"MIT"
] | 1 | 2018-10-05T17:52:07.000Z | 2018-10-05T17:52:07.000Z | features/steps/slots.py | kostiantyn-nemchenko/patroni | a431f50378007efebdcfcf492ea2ba4194adcf9d | [
"MIT"
] | 1 | 2021-11-29T06:46:09.000Z | 2021-11-29T06:46:09.000Z | import time
import psycopg2
from behave import step, then
@step('I create a logical replication slot {slot_name} on {pg_name:w} with the {plugin:w} plugin')
def create_logical_replication_slot(context, slot_name, pg_name, plugin):
try:
output = context.pctl.query(pg_name, ("SELECT pg_create_logical_repli... | 51.377049 | 116 | 0.656669 | import time
import psycopg2
from behave import step, then
@step('I create a logical replication slot {slot_name} on {pg_name:w} with the {plugin:w} plugin')
def create_logical_replication_slot(context, slot_name, pg_name, plugin):
try:
output = context.pctl.query(pg_name, ("SELECT pg_create_logical_repli... | true | true |
f761ccec090a5dd5d353640363eb4a8802ddf2d4 | 212 | py | Python | docs/examples/compute/azure/instantiate.py | rgharris/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | [
"Apache-2.0"
] | null | null | null | docs/examples/compute/azure/instantiate.py | rgharris/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | [
"Apache-2.0"
] | 1 | 2021-12-06T12:29:13.000Z | 2021-12-06T12:29:13.000Z | docs/examples/compute/azure/instantiate.py | rgharris/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | [
"Apache-2.0"
] | 1 | 2019-08-05T10:12:02.000Z | 2019-08-05T10:12:02.000Z | from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
cls = get_driver(Provider.AZURE)
driver = cls(subscription_id="subscription-id", key_file="/path/to/azure_cert.pem")
| 35.333333 | 83 | 0.816038 | from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
cls = get_driver(Provider.AZURE)
driver = cls(subscription_id="subscription-id", key_file="/path/to/azure_cert.pem")
| true | true |
f761d1923eef46415303b70b9ef52f8510f2edce | 3,180 | py | Python | sampling_methods/represent_cluster_centers.py | yuiiiiiiii/trashbin | f8af682a4aaf84ec2e35e03364d6a5248b2aeb52 | [
"Apache-2.0"
] | 917 | 2017-10-06T17:06:33.000Z | 2022-03-30T08:34:41.000Z | sampling_methods/represent_cluster_centers.py | yuiiiiiiii/trashbin | f8af682a4aaf84ec2e35e03364d6a5248b2aeb52 | [
"Apache-2.0"
] | 3 | 2019-05-10T06:15:06.000Z | 2020-02-22T06:12:50.000Z | sampling_methods/represent_cluster_centers.py | yuiiiiiiii/trashbin | f8af682a4aaf84ec2e35e03364d6a5248b2aeb52 | [
"Apache-2.0"
] | 215 | 2017-10-09T01:23:59.000Z | 2022-03-31T14:46:10.000Z | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 40.253165 | 95 | 0.731761 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from sklearn.cluster import MiniBatchKMeans
import numpy as np
from sampling_methods.sampling_def import SamplingMethod
class RepresentativeClusterMeanSampling(SamplingMethod):
def __init__(self, X, y, s... | true | true |
f761d1ad8b19ebda412be3ee06130bffc1d6ec1f | 3,310 | py | Python | src/calrissian/layers/max_pool_1d.py | awlange/brainsparks | 05baff28da347172083672c940406f5696893201 | [
"MIT"
] | 3 | 2015-10-30T04:04:02.000Z | 2020-02-13T19:08:42.000Z | src/calrissian/layers/max_pool_1d.py | awlange/brainsparks | 05baff28da347172083672c940406f5696893201 | [
"MIT"
] | null | null | null | src/calrissian/layers/max_pool_1d.py | awlange/brainsparks | 05baff28da347172083672c940406f5696893201 | [
"MIT"
] | null | null | null | from .layer import Layer
from ..activation import Activation
from .convolution_1d import Convolution1D
import numpy as np
class MaxPool1D(Layer):
"""
Convolve input but only feed forward the maximum activation
"""
def __init__(self, input_size=0, n_filters=0, pool_size=1, stride_length=1, flatten_ou... | 32.772277 | 102 | 0.580665 | from .layer import Layer
from ..activation import Activation
from .convolution_1d import Convolution1D
import numpy as np
class MaxPool1D(Layer):
def __init__(self, input_size=0, n_filters=0, pool_size=1, stride_length=1, flatten_output=False):
super().__init__("MaxPool1D", False)
self.input_siz... | true | true |
f761d2a3d67578ef5a56fbb17006784b0a23439f | 14,463 | py | Python | tests/test_tensor/test_tensor_2d.py | cnakhl/quimb | 482a21ebdaa0e8236924dbbdc435e8de68d86719 | [
"Apache-2.0"
] | null | null | null | tests/test_tensor/test_tensor_2d.py | cnakhl/quimb | 482a21ebdaa0e8236924dbbdc435e8de68d86719 | [
"Apache-2.0"
] | null | null | null | tests/test_tensor/test_tensor_2d.py | cnakhl/quimb | 482a21ebdaa0e8236924dbbdc435e8de68d86719 | [
"Apache-2.0"
] | 4 | 2021-11-04T00:07:40.000Z | 2022-03-15T21:15:20.000Z | import pytest
import itertools
import quimb as qu
import quimb.tensor as qtn
class TestPEPSConstruct:
@pytest.mark.parametrize('Lx', [3, 4, 5])
@pytest.mark.parametrize('Ly', [3, 4, 5])
def test_basic_rand(self, Lx, Ly):
psi = qtn.PEPS.rand(Lx, Ly, bond_dim=4)
assert psi.max_bond() == 4... | 35.977612 | 79 | 0.520155 | import pytest
import itertools
import quimb as qu
import quimb.tensor as qtn
class TestPEPSConstruct:
@pytest.mark.parametrize('Lx', [3, 4, 5])
@pytest.mark.parametrize('Ly', [3, 4, 5])
def test_basic_rand(self, Lx, Ly):
psi = qtn.PEPS.rand(Lx, Ly, bond_dim=4)
assert psi.max_bond() == 4... | true | true |
f761d2abad5153ea11c4b09dfa2d0cd8580de491 | 606 | py | Python | tests/test_isolated_class_variable_tests.py | paul-breen/cassava | ffb89dd966dedca23fc601bf5a3fbbe6106c3296 | [
"Apache-2.0"
] | null | null | null | tests/test_isolated_class_variable_tests.py | paul-breen/cassava | ffb89dd966dedca23fc601bf5a3fbbe6106c3296 | [
"Apache-2.0"
] | 12 | 2021-08-17T09:46:08.000Z | 2021-11-11T20:16:15.000Z | tests/test_isolated_class_variable_tests.py | paul-breen/cassava | ffb89dd966dedca23fc601bf5a3fbbe6106c3296 | [
"Apache-2.0"
] | null | null | null | import cassava
def test_not_providing_conf_persists_defaults_changes_ok():
"""
Initially the header_row config item in the class variable DEFAULTS is
None. If no conf kwarg is passed to the constructor, then it uses
DEFAULTS (directly, not a copy) as its configuration dict. In this case,
if we ch... | 31.894737 | 77 | 0.70132 | import cassava
def test_not_providing_conf_persists_defaults_changes_ok():
f = cassava.Cassava()
assert f.conf['header_row'] is None
f.conf['header_row'] = 0
del f
f = cassava.Cassava()
assert f.conf['header_row'] == 0
| true | true |
f761d42d352ac56042dd3b783eea315d02e41047 | 5,363 | py | Python | salt/_states/kubeconfig.py | daddyfatstacksBIG/metalk8s | 060809242310ce8720912b6c1d420be7ad92c999 | [
"Apache-2.0"
] | null | null | null | salt/_states/kubeconfig.py | daddyfatstacksBIG/metalk8s | 060809242310ce8720912b6c1d420be7ad92c999 | [
"Apache-2.0"
] | null | null | null | salt/_states/kubeconfig.py | daddyfatstacksBIG/metalk8s | 060809242310ce8720912b6c1d420be7ad92c999 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from base64 import b64encode, b64decode
from datetime import datetime, timedelta
import os
import stat
import yaml
__virtualname__ = 'metalk8s_kubeconfig'
def __virtual__():
return __virtualname__
def _validateKubeConfig(filename,
expected_ca_data,
... | 27.085859 | 79 | 0.56666 |
from base64 import b64encode, b64decode
from datetime import datetime, timedelta
import os
import stat
import yaml
__virtualname__ = 'metalk8s_kubeconfig'
def __virtual__():
return __virtualname__
def _validateKubeConfig(filename,
expected_ca_data,
expected_api_... | true | true |
f761d48f366b3d81c7fd4edbb34fab5c9e225946 | 652 | py | Python | trac/wiki/__init__.py | mikiec84/trac | d51a7119b9fcb9061d7fe135c7d648fa671555dd | [
"BSD-3-Clause"
] | null | null | null | trac/wiki/__init__.py | mikiec84/trac | d51a7119b9fcb9061d7fe135c7d648fa671555dd | [
"BSD-3-Clause"
] | null | null | null | trac/wiki/__init__.py | mikiec84/trac | d51a7119b9fcb9061d7fe135c7d648fa671555dd | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2020 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://trac.edgewall.org/wiki/TracLicense.
#
# This software cons... | 34.315789 | 67 | 0.76227 |
from trac.wiki.api import *
from trac.wiki.formatter import *
from trac.wiki.intertrac import *
from trac.wiki.model import *
from trac.wiki.parser import *
| true | true |
f761d49965dc0863788ba189468d3cbe12833851 | 1,771 | py | Python | tests/python/gaia-ui-tests/gaiatest/tests/functional/marketplace/test_marketplace_login.py | BReduardokramer/gaia | c00302cdcd435ab193e8365917cfc6abac9e4f2e | [
"Apache-2.0"
] | 1 | 2021-11-09T00:27:34.000Z | 2021-11-09T00:27:34.000Z | tests/python/gaia-ui-tests/gaiatest/tests/functional/marketplace/test_marketplace_login.py | AmyYLee/gaia | a5dbae8235163d7f985bdeb7d649268f02749a8b | [
"Apache-2.0"
] | null | null | null | tests/python/gaia-ui-tests/gaiatest/tests/functional/marketplace/test_marketplace_login.py | AmyYLee/gaia | a5dbae8235163d7f985bdeb7d649268f02749a8b | [
"Apache-2.0"
] | null | null | null | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette.by import By
from gaiatest import GaiaTestCase
from gaiatest.apps.marketplace.app import Marketplace
fro... | 35.42 | 136 | 0.696217 |
from marionette.by import By
from gaiatest import GaiaTestCase
from gaiatest.apps.marketplace.app import Marketplace
from gaiatest.mocks.persona_test_user import PersonaTestUser
class TestMarketplaceLogin(GaiaTestCase):
MARKETPLACE_DEV_NAME = 'Marketplace Dev'
def setUp(self):
GaiaTestCase.setUp(se... | true | true |
f761d4d62ba6b08d828cac3a542577de26843573 | 2,233 | py | Python | metadeploy/logging_middleware.py | oddbird/MetaDeploy | 561271a49ff4a93f8179424c26eb9daf64df6263 | [
"BSD-3-Clause"
] | 1 | 2019-10-09T15:16:04.000Z | 2019-10-09T15:16:04.000Z | metadeploy/logging_middleware.py | oddbird/MetaDeploy | 561271a49ff4a93f8179424c26eb9daf64df6263 | [
"BSD-3-Clause"
] | 1,696 | 2020-07-22T02:19:05.000Z | 2022-03-16T03:16:42.000Z | metadeploy/logging_middleware.py | oddbird/MetaDeploy | 561271a49ff4a93f8179424c26eb9daf64df6263 | [
"BSD-3-Clause"
] | null | null | null | import logging
import time
from django.conf import settings
from log_request_id import (
LOG_REQUESTS_SETTING,
REQUEST_ID_RESPONSE_HEADER_SETTING,
local,
)
from log_request_id.middleware import RequestIDMiddleware
from .logfmt import quote_logvalue
from sfdo_template_helpers.addresses import get_remote_ip
... | 29.773333 | 88 | 0.626511 | import logging
import time
from django.conf import settings
from log_request_id import (
LOG_REQUESTS_SETTING,
REQUEST_ID_RESPONSE_HEADER_SETTING,
local,
)
from log_request_id.middleware import RequestIDMiddleware
from .logfmt import quote_logvalue
from sfdo_template_helpers.addresses import get_remote_ip
... | true | true |
f761d5d06004b5e03edf14829437219f915ed8c2 | 28,042 | py | Python | sickbeard/sickbeard/search.py | Branlala/docker-sickbeardfr | 3ac85092dc4cc8a4171fb3c83e9682162245e13e | [
"MIT"
] | null | null | null | sickbeard/sickbeard/search.py | Branlala/docker-sickbeardfr | 3ac85092dc4cc8a4171fb3c83e9682162245e13e | [
"MIT"
] | null | null | null | sickbeard/sickbeard/search.py | Branlala/docker-sickbeardfr | 3ac85092dc4cc8a4171fb3c83e9682162245e13e | [
"MIT"
] | null | null | null | # Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lice... | 41.482249 | 246 | 0.607125 |
from __future__ import with_statement
import os
import traceback
import sickbeard
from common import SNATCHED, Quality, SEASON_RESULT, MULTI_EP_RESULT,ARCHIVED, IGNORED, UNAIRED, WANTED, SKIPPED
from sickbeard import logger, db, show_name_helpers, exceptions, helpers
from sickbeard import sab
from sickbeard import ... | false | true |
f761d8f9f4540ddacf456d908b711104797ec26d | 8,151 | py | Python | kanga/models.py | deptofdefense/kanga | 9c8d926a4828e2fca528915ddf35759d1c328c85 | [
"MIT"
] | 1 | 2022-03-05T01:17:59.000Z | 2022-03-05T01:17:59.000Z | kanga/models.py | deptofdefense/kanga | 9c8d926a4828e2fca528915ddf35759d1c328c85 | [
"MIT"
] | null | null | null | kanga/models.py | deptofdefense/kanga | 9c8d926a4828e2fca528915ddf35759d1c328c85 | [
"MIT"
] | null | null | null | # =================================================================
#
# Work of the U.S. Department of Defense, Defense Digital Service.
# Released as open source under the MIT License. See LICENSE file.
#
# =================================================================
import uuid
from slugify import slugify
fro... | 27.352349 | 97 | 0.666053 |
import uuid
from slugify import slugify
from django.db import models
from phonenumber_field.modelfields import PhoneNumberField
from phonenumber_field.phonenumber import PhoneNumber
from twilio.rest import Client as TwilioClient
from kanga import settings
class Base(models.Model):
id = models.AutoField(primar... | true | true |
f761da7a6b630523fb525d1c8e67c01460d18f69 | 10,400 | py | Python | languages/python/oso/polar/polar.py | hobofan/oso | 2656313dc46581a588fcf0c57dee7bf91afbb3d0 | [
"Apache-2.0"
] | null | null | null | languages/python/oso/polar/polar.py | hobofan/oso | 2656313dc46581a588fcf0c57dee7bf91afbb3d0 | [
"Apache-2.0"
] | null | null | null | languages/python/oso/polar/polar.py | hobofan/oso | 2656313dc46581a588fcf0c57dee7bf91afbb3d0 | [
"Apache-2.0"
] | null | null | null | """Communicate with the Polar virtual machine: load rules, make queries, etc."""
from datetime import datetime, timedelta
import os
from pathlib import Path
import sys
from typing import List, Union
from .exceptions import (
PolarRuntimeError,
InlineQueryFailedError,
ParserError,
PolarFileExtensionErr... | 34.323432 | 123 | 0.592692 |
from datetime import datetime, timedelta
import os
from pathlib import Path
import sys
from typing import List, Union
from .exceptions import (
PolarRuntimeError,
InlineQueryFailedError,
ParserError,
PolarFileExtensionError,
PolarFileNotFoundError,
InvalidQueryTypeError,
)
from .ffi import Pol... | true | true |
f761db0ce501004d11ad2ba706169665812a7f2c | 6,404 | py | Python | gluoncv/model_zoo/fcos/fcos_target.py | cxiang26/mygluon_cv | 1dfebd27afc7d788424b21dfd69007c7576dcbbe | [
"Apache-2.0"
] | 11 | 2019-12-11T12:47:30.000Z | 2021-01-21T16:36:56.000Z | gluoncv/model_zoo/fcos/fcos_target.py | liyongsheng-tech/mygluon_cv | 1dfebd27afc7d788424b21dfd69007c7576dcbbe | [
"Apache-2.0"
] | 3 | 2019-09-03T01:35:15.000Z | 2019-11-13T06:28:00.000Z | gluoncv/model_zoo/fcos/fcos_target.py | liyongsheng-tech/mygluon_cv | 1dfebd27afc7d788424b21dfd69007c7576dcbbe | [
"Apache-2.0"
] | 3 | 2020-01-10T16:50:08.000Z | 2020-11-13T06:59:13.000Z | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import sys
import numpy as np
import mxnet as mx
from mxnet import nd
from mxnet import autograd
from mxnet.gluon import nn
# from IPython import embed
class FCOSTargetGenerator(nn.Block):
"""Generate FCOS targets"""
def __init__(self, ... | 37.893491 | 98 | 0.521393 | from __future__ import absolute_import
import os
import sys
import numpy as np
import mxnet as mx
from mxnet import nd
from mxnet import autograd
from mxnet.gluon import nn
class FCOSTargetGenerator(nn.Block):
def __init__(self, retina_stages=5, base_stride=128,
valid_range=[(384, np.inf), (192,... | true | true |
f761db467ab8d9d07e77d7cb3aec19e39cf3540c | 1,888 | py | Python | SRC/common/IO/GUI/gtklogger/gtklogger/windowlogger.py | usnistgov/OOF3D | 4fd423a48aea9c5dc207520f02de53ae184be74c | [
"X11"
] | 31 | 2015-04-01T15:59:36.000Z | 2022-03-18T20:21:47.000Z | SRC/common/IO/GUI/gtklogger/gtklogger/windowlogger.py | usnistgov/OOF3D | 4fd423a48aea9c5dc207520f02de53ae184be74c | [
"X11"
] | 3 | 2015-02-06T19:30:24.000Z | 2017-05-25T14:14:31.000Z | SRC/common/IO/GUI/gtklogger/gtklogger/windowlogger.py | usnistgov/OOF3D | 4fd423a48aea9c5dc207520f02de53ae184be74c | [
"X11"
] | 7 | 2015-01-23T15:19:22.000Z | 2021-06-09T09:03:59.000Z | # -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we as... | 42.909091 | 80 | 0.597987 |
import widgetlogger
import loggers
import gtk
class WindowLogger(widgetlogger.WidgetLogger):
classes = (gtk.Window,)
def record(self, obj, signal, *args):
# action.
if signal == 'destroy':
return self.ignore
if signal == 'delete-event':
# Simpl... | true | true |
f761ddbf2f5c6be7d2061d070594cfa5289ba9e8 | 15,164 | py | Python | src-test/rogerthat_tests/mobicage/bizz/test_app.py | goubertbrent/oca-backend | b9f59cc02568aecb55d4b54aec05245790ea25fd | [
"Apache-2.0"
] | null | null | null | src-test/rogerthat_tests/mobicage/bizz/test_app.py | goubertbrent/oca-backend | b9f59cc02568aecb55d4b54aec05245790ea25fd | [
"Apache-2.0"
] | null | null | null | src-test/rogerthat_tests/mobicage/bizz/test_app.py | goubertbrent/oca-backend | b9f59cc02568aecb55d4b54aec05245790ea25fd | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | 51.931507 | 121 | 0.706872 |
from google.appengine.ext import db
import mc_unittest
from mcfw.properties import azzert
from rogerthat.bizz.friends import canBeFriends, makeFriends, breakFriendShip, areFriends, invite, ORIGIN_USER_INVITE
from rogerthat.bizz.profile import create_user_profile, create_service_profile
from rogerthat.bizz.service impo... | true | true |
f761de18bcb81b33e32713800ce5af299068b9ce | 20,347 | py | Python | code/Vegas Analysis.py | ryanofarrell/ncaa-basketball | 628bda58cb1320431edf38ab407ba70ca5f80008 | [
"MIT"
] | null | null | null | code/Vegas Analysis.py | ryanofarrell/ncaa-basketball | 628bda58cb1320431edf38ab407ba70ca5f80008 | [
"MIT"
] | null | null | null | code/Vegas Analysis.py | ryanofarrell/ncaa-basketball | 628bda58cb1320431edf38ab407ba70ca5f80008 | [
"MIT"
] | null | null | null |
# %% Imports
import pandas as pd
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier, GradientBoostingClassifier
from sklearn.metrics import r2_score, roc_curve, roc_auc_sco... | 31.35131 | 157 | 0.591979 |
import pandas as pd
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier, GradientBoostingClassifier
from sklearn.metrics import r2_score, roc_curve, roc_auc_score
from itert... | true | true |
f761de973b324867f05a84ac3e956ca78cec292c | 467 | py | Python | fix_octave_on_cygwin.py | e11bits/mlearn | 68fdaa178b9b00dbc2439010a4071ebffba1face | [
"MIT"
] | null | null | null | fix_octave_on_cygwin.py | e11bits/mlearn | 68fdaa178b9b00dbc2439010a4071ebffba1face | [
"MIT"
] | null | null | null | fix_octave_on_cygwin.py | e11bits/mlearn | 68fdaa178b9b00dbc2439010a4071ebffba1face | [
"MIT"
] | null | null | null | #!/usr/bin/python3
import os
if __name__ == '__main__':
# This will make sure that the octaverc user startup file will contain
# a line to set the graphics toolkit to gnuplut. It might add multiple
# lines, but this shouldn't hurt.
startup_path = os.path.expanduser('~/.octaverc')
option = 'grap... | 27.470588 | 75 | 0.66167 |
import os
if __name__ == '__main__':
startup_path = os.path.expanduser('~/.octaverc')
option = 'graphics_toolkit'
value = 'gnuplot'
with open(startup_path, 'a') as startup_file:
startup_file.write(option + ' ' + value + '\n')
| true | true |
f761dfb9efac90d52819cd121a4e69e1848f008d | 2,489 | py | Python | tests/test_docs.py | Contraz/demosys-py | 0479e0f3b0a3901f601bffd2d11e155f97b47555 | [
"0BSD"
] | 70 | 2017-03-31T12:01:41.000Z | 2022-01-05T06:30:57.000Z | tests/test_docs.py | Contraz/demosys-py | 0479e0f3b0a3901f601bffd2d11e155f97b47555 | [
"0BSD"
] | 69 | 2017-06-18T22:37:46.000Z | 2020-01-23T04:02:22.000Z | tests/test_docs.py | Contraz/demosys-py | 0479e0f3b0a3901f601bffd2d11e155f97b47555 | [
"0BSD"
] | 9 | 2017-05-13T21:13:02.000Z | 2020-10-01T18:09:49.000Z | """
Documentation testing
Inspired by:
https://github.com/cprogrammer1994/ModernGL/blob/master/tests/test_documentation.py
by Szabolcs Dombi
This version is simplified:
* Only test if the attribute or method is present in the class. Function parameters are not inspected.
* Include ignore pattern in the implemented se... | 38.292308 | 108 | 0.676577 | import os
import re
import unittest
from demosys.test.mocks import apply_mocks
from demosys.utils import module_loading
apply_mocks()
os.environ['DEMOSYS_SETTINGS_MODULE'] = 'tests.settings'
class TestCase(unittest.TestCase):
def validate(self, filename, module, classname, ignore):
with open(os.path.no... | true | true |
f761e0088cd77a118154bb9185380a8e68ac47d0 | 4,345 | py | Python | python/pyspark/tests/test_install_spark.py | kesavanvt/spark | a0f3b72e1c58fe66c122d7108fb8a076f068e171 | [
"BSD-2-Clause",
"Apache-2.0",
"CC0-1.0",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 35,083 | 2015-01-01T03:05:13.000Z | 2022-03-31T21:57:40.000Z | python/pyspark/tests/test_install_spark.py | kesavanvt/spark | a0f3b72e1c58fe66c122d7108fb8a076f068e171 | [
"BSD-2-Clause",
"Apache-2.0",
"CC0-1.0",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 32,117 | 2015-01-01T00:00:24.000Z | 2022-03-31T23:54:58.000Z | python/pyspark/tests/test_install_spark.py | kesavanvt/spark | a0f3b72e1c58fe66c122d7108fb8a076f068e171 | [
"BSD-2-Clause",
"Apache-2.0",
"CC0-1.0",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 29,687 | 2015-01-01T02:40:43.000Z | 2022-03-31T16:49:33.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 us... | 39.5 | 100 | 0.643728 | import os
import tempfile
import unittest
from pyspark.install import install_spark, DEFAULT_HADOOP, DEFAULT_HIVE, \
UNSUPPORTED_COMBINATIONS, checked_versions, checked_package_name
class SparkInstallationTestCase(unittest.TestCase):
def test_install_spark(self):
spark_version, hadoo... | true | true |
f761e0e1b5a0345128a5c73dfcbc6d544c843c4e | 52 | py | Python | enthought/traits/ui/context_value.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | 3 | 2016-12-09T06:05:18.000Z | 2018-03-01T13:00:29.000Z | enthought/traits/ui/context_value.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | 1 | 2020-12-02T00:51:32.000Z | 2020-12-02T08:48:55.000Z | enthought/traits/ui/context_value.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | null | null | null | # proxy module
from traitsui.context_value import *
| 17.333333 | 36 | 0.807692 | from traitsui.context_value import *
| true | true |
f761e0ecca1ac043735f60c76e3aae19d3fbfd3a | 1,354 | py | Python | setup.py | gazpachoking/notifico | 140b96eba15be71583646678c3f957b1e95a0571 | [
"MIT"
] | null | null | null | setup.py | gazpachoking/notifico | 140b96eba15be71583646678c3f957b1e95a0571 | [
"MIT"
] | null | null | null | setup.py | gazpachoking/notifico | 140b96eba15be71583646678c3f957b1e95a0571 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf8 -*-
"""
Notifico is my personal open source MIT replacement to the
now-defunct http://cia.vc service with my own little spin on things.
"""
from setuptools import setup, find_packages
def get_version():
"""
Load and return the current Notifico version.
"""
loca... | 24.618182 | 75 | 0.514771 | from setuptools import setup, find_packages
def get_version():
local_results = {}
execfile('notifico/version.py', {}, local_results)
return local_results['__version__']
if __name__ == '__main__':
setup(
name='Notifico',
version=get_version(),
long_description=__doc__,
... | true | true |
f761e2027c87201d80ef372c15b9572a8665c8f9 | 20,587 | py | Python | prog-o-meter.py | anubhavsinha98/prog-o-meter | b4ecd7340f804c532ddb34d5426745b5a44839ad | [
"MIT"
] | null | null | null | prog-o-meter.py | anubhavsinha98/prog-o-meter | b4ecd7340f804c532ddb34d5426745b5a44839ad | [
"MIT"
] | null | null | null | prog-o-meter.py | anubhavsinha98/prog-o-meter | b4ecd7340f804c532ddb34d5426745b5a44839ad | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The Prog-o-meter.py program is for tracking progress during a #100DaysofCode challenge (or any other #100DaysofX challenge).
The program gives a graphic overview of ones progress through the challenge, by showing a bar containing 100 fields, showing completed days... | 52.652174 | 292 | 0.657017 |
__appname__ = "Prog-o-meter"
__authour__ = "Linea Brink Andersen"
__version__ = "1.0.0"
__license__ = "MIT"
from random import randint
import datetime
from congratulations.Congratulations import Congratulations
try:
import Tkinter as Tk except ImportError:
import tkinter as Tk from us... | true | true |
f761e23ba51cac304681a604e7d4435a3b21a54d | 914 | py | Python | dupecheck.py | RazerMoon/Cex-Price-Tracker | 63835761199f90231f27211e712b0dd35879cf9c | [
"MIT"
] | 3 | 2020-02-10T14:10:27.000Z | 2021-07-23T16:55:04.000Z | dupecheck.py | RazerMoon/WeBuy-Cex-Price-Tracker | 63835761199f90231f27211e712b0dd35879cf9c | [
"MIT"
] | null | null | null | dupecheck.py | RazerMoon/WeBuy-Cex-Price-Tracker | 63835761199f90231f27211e712b0dd35879cf9c | [
"MIT"
] | null | null | null |
import id_list
#from cex import *
def dupeChecker():
dupes = 0
for id in range(len(id_list.id_list)):
id = id_list.id_list[id]
matching = [s for s in id_list.id_list if id in s]
if len(matching) > 1:
dupes = dupes+1
print(matching)
print(len(matching... | 25.388889 | 117 | 0.609409 |
import id_list
def dupeChecker():
dupes = 0
for id in range(len(id_list.id_list)):
id = id_list.id_list[id]
matching = [s for s in id_list.id_list if id in s]
if len(matching) > 1:
dupes = dupes+1
print(matching)
print(len(matching))
if not dupe... | true | true |
f761e23f1bf06901cbad5893f992ccaa1a9b0b82 | 1,425 | py | Python | tests/rest/media/v1/test_base.py | lukaslihotzki/synapse | 1dfdc87b9bb07cc3c958dde7f41f2af4322477e5 | [
"Apache-2.0"
] | 9,945 | 2015-01-02T07:41:06.000Z | 2022-03-31T23:22:42.000Z | tests/rest/media/v1/test_base.py | lukaslihotzki/synapse | 1dfdc87b9bb07cc3c958dde7f41f2af4322477e5 | [
"Apache-2.0"
] | 9,320 | 2015-01-08T14:09:03.000Z | 2022-03-31T21:11:24.000Z | tests/rest/media/v1/test_base.py | lukaslihotzki/synapse | 1dfdc87b9bb07cc3c958dde7f41f2af4322477e5 | [
"Apache-2.0"
] | 2,299 | 2015-01-31T22:16:29.000Z | 2022-03-31T06:08:26.000Z | # Copyright 2019 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 36.538462 | 84 | 0.659649 |
from synapse.rest.media.v1._base import get_filename_from_headers
from tests import unittest
class GetFileNameFromHeadersTests(unittest.TestCase):
TEST_CASES = {
b"inline; filename=abc.txt": "abc.txt",
b'inline; filename="azerty"': "azerty",
b'inline; filename="aze%20rty"': "aze%20rt... | true | true |
f761e2fdccea1b338af9d65fb45fe255f71d8844 | 1,464 | py | Python | dish/interpreter.py | dullbananas/dish | 01f1439bc38861c0890412becccc9135c05e621b | [
"MIT"
] | 13 | 2019-11-25T00:52:58.000Z | 2021-01-04T14:43:12.000Z | dish/interpreter.py | dullbananas/dish | 01f1439bc38861c0890412becccc9135c05e621b | [
"MIT"
] | null | null | null | dish/interpreter.py | dullbananas/dish | 01f1439bc38861c0890412becccc9135c05e621b | [
"MIT"
] | 1 | 2020-01-23T19:59:22.000Z | 2020-01-23T19:59:22.000Z | import os
import time
import click
from . import procs
class Interpreter:
def __init__(self, ctx, verbose):
self.ctx = ctx
self.verbose = verbose
self.lines = []
self.in_comment = False
def feed(self, line):
if len(self.lines) > 0:
# End of multi-line comment
if self.lines[0].startswith('#==') and... | 21.529412 | 63 | 0.646858 | import os
import time
import click
from . import procs
class Interpreter:
def __init__(self, ctx, verbose):
self.ctx = ctx
self.verbose = verbose
self.lines = []
self.in_comment = False
def feed(self, line):
if len(self.lines) > 0:
if self.lines[0].startswith('#==') and line.endswith('==#'):
s... | true | true |
f761e46a037e1f4cbc88b6a8c9fc19a30fc40ece | 3,640 | py | Python | audio.py | signofthefour/tacotron | 660d3448a0a0dcf6efd4f7629f203f121c271fff | [
"MIT"
] | null | null | null | audio.py | signofthefour/tacotron | 660d3448a0a0dcf6efd4f7629f203f121c271fff | [
"MIT"
] | null | null | null | audio.py | signofthefour/tacotron | 660d3448a0a0dcf6efd4f7629f203f121c271fff | [
"MIT"
] | null | null | null | from __future__ import print_function, division
import numpy as np
import librosa
from tqdm import tqdm
import math
import tensorflow as tf
import soundfile as sf
n_fft = 2048
win_length = 1200
hop_length = int(win_length/4)
max_audio_length = 108000
# decoder output width r
r = 2
def reshape_frames(signal, forward... | 34.339623 | 125 | 0.67033 | from __future__ import print_function, division
import numpy as np
import librosa
from tqdm import tqdm
import math
import tensorflow as tf
import soundfile as sf
n_fft = 2048
win_length = 1200
hop_length = int(win_length/4)
max_audio_length = 108000
r = 2
def reshape_frames(signal, forward=True):
if forward:
... | true | true |
f761e51d4f125b1efbda4d446e1f0e46e24d07a3 | 4,718 | py | Python | catkin_ws/src/pmcn/bot_arm/src/bot_arm_node.py | Cheng-Yi-Lin/Software2 | 8dffc04824acef06ac249a4ce43fe5abbbbd432a | [
"CC-BY-2.0"
] | null | null | null | catkin_ws/src/pmcn/bot_arm/src/bot_arm_node.py | Cheng-Yi-Lin/Software2 | 8dffc04824acef06ac249a4ce43fe5abbbbd432a | [
"CC-BY-2.0"
] | null | null | null | catkin_ws/src/pmcn/bot_arm/src/bot_arm_node.py | Cheng-Yi-Lin/Software2 | 8dffc04824acef06ac249a4ce43fe5abbbbd432a | [
"CC-BY-2.0"
] | null | null | null | #!/usr/bin/env python
import rospy
import pygame
import Adafruit_I2C
from duckietown_msgs.msg import Twist2DStamped, BoolStamped, StopLineReading
from std_msgs.msg import String, Int32, Int16
from sensor_msgs.msg import Joy
from Adafruit_PWM_Servo_Driver import PWM
from Adafruit_MotorHAT import Adafruit_MotorHAT
impor... | 41.385965 | 127 | 0.604917 | import rospy
import pygame
import Adafruit_I2C
from duckietown_msgs.msg import Twist2DStamped, BoolStamped, StopLineReading
from std_msgs.msg import String, Int32, Int16
from sensor_msgs.msg import Joy
from Adafruit_PWM_Servo_Driver import PWM
from Adafruit_MotorHAT import Adafruit_MotorHAT
import time
import urllib2
... | false | true |
f761e5d9869604b856d5ee4c2ad23b2597b15881 | 13,622 | py | Python | main.py | RachitKeertiDas/LitSocBot | 863c629eb53e8783ebaea50fedabce3971c8a33b | [
"MIT"
] | null | null | null | main.py | RachitKeertiDas/LitSocBot | 863c629eb53e8783ebaea50fedabce3971c8a33b | [
"MIT"
] | null | null | null | main.py | RachitKeertiDas/LitSocBot | 863c629eb53e8783ebaea50fedabce3971c8a33b | [
"MIT"
] | 1 | 2021-07-10T07:34:45.000Z | 2021-07-10T07:34:45.000Z | from typing import Optional
import discord as dc
import os
from discord.ext.commands.core import command
import requests
import json
from CowsAndBulls import CowsAndBulls
import Anagram as ana
import feedparser
import random
import discord
from discord.ext import commands
from dotenv import load_dotenv
from Crossword i... | 34.75 | 172 | 0.629863 | from typing import Optional
import discord as dc
import os
from discord.ext.commands.core import command
import requests
import json
from CowsAndBulls import CowsAndBulls
import Anagram as ana
import feedparser
import random
import discord
from discord.ext import commands
from dotenv import load_dotenv
from Crossword i... | true | true |
f761e6c932b9e6fa3784ff9717664fb3f6243c98 | 1,810 | py | Python | discord/types/member.py | brotherelric/deezcord.py | f7419bf2c67c2006702cccc4850cd9332bce00c6 | [
"MIT"
] | null | null | null | discord/types/member.py | brotherelric/deezcord.py | f7419bf2c67c2006702cccc4850cd9332bce00c6 | [
"MIT"
] | null | null | null | discord/types/member.py | brotherelric/deezcord.py | f7419bf2c67c2006702cccc4850cd9332bce00c6 | [
"MIT"
] | null | null | null | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
Copyright (c) 2021-present 404kuso
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
th... | 27.846154 | 75 | 0.768508 |
from typing import TypedDict
from .snowflake import SnowflakeList
from .user import User
class Nickname(TypedDict):
nick: str
class PartialMember(TypedDict):
roles: SnowflakeList
joined_at: str
deaf: str
mute: str
class Member(PartialMember, total=False):
avatar: str
user: User
ni... | true | true |
f761e70025e94aa0542ab71a66cc831a97df3750 | 3,545 | py | Python | pfin/utils.py | LilianBoulard/PassionFroidImageNet | 975ee66114207f138d58651aff9984e779468762 | [
"MIT"
] | 1 | 2021-02-22T08:52:16.000Z | 2021-02-22T08:52:16.000Z | pfin/utils.py | LilianBoulard/PassionFroidImageNet | 975ee66114207f138d58651aff9984e779468762 | [
"MIT"
] | null | null | null | pfin/utils.py | LilianBoulard/PassionFroidImageNet | 975ee66114207f138d58651aff9984e779468762 | [
"MIT"
] | 1 | 2021-04-26T09:42:59.000Z | 2021-04-26T09:42:59.000Z | import json
import base64
import logging
from PIL import Image
from io import BytesIO
from hashlib import sha256
from .config import SALT
def validate_fields(dictionary: dict, struct: dict) -> dict:
"""
Takes a dictionary and an architecture and checks if the types and structure are valid.
Corrects the ... | 32.227273 | 103 | 0.63244 | import json
import base64
import logging
from PIL import Image
from io import BytesIO
from hashlib import sha256
from .config import SALT
def validate_fields(dictionary: dict, struct: dict) -> dict:
def is_int(value) -> bool:
try:
int(value)
except ValueError:
return Fal... | true | true |
f761e770c809c0dc2303f764380229d9935b7967 | 1,894 | py | Python | custom_components/waste_collection_schedule/waste_collection_schedule/source/lerum_se.py | UBS-P/hacs_waste_collection_schedule | 9ce0fd55010bbab3948f1ee0aa5edb4b65b7d866 | [
"MIT"
] | 142 | 2020-04-13T18:56:12.000Z | 2022-03-30T19:44:08.000Z | custom_components/waste_collection_schedule/waste_collection_schedule/source/lerum_se.py | UBS-P/hacs_waste_collection_schedule | 9ce0fd55010bbab3948f1ee0aa5edb4b65b7d866 | [
"MIT"
] | 138 | 2020-04-30T18:11:30.000Z | 2022-03-30T20:56:33.000Z | custom_components/waste_collection_schedule/waste_collection_schedule/source/lerum_se.py | UBS-P/hacs_waste_collection_schedule | 9ce0fd55010bbab3948f1ee0aa5edb4b65b7d866 | [
"MIT"
] | 89 | 2020-06-16T05:13:08.000Z | 2022-03-28T09:28:25.000Z | # coding: utf-8
from datetime import datetime
import json
from urllib.parse import urlencode
import requests
from waste_collection_schedule import Collection # type: ignore[attr-defined]
TITLE = "Lerum Vatten och Avlopp"
DESCRIPTION = "Source for Lerum Vatten och Avlopp waste collection."
URL = "https://vatjanst.ler... | 33.22807 | 93 | 0.634636 | from datetime import datetime
import json
from urllib.parse import urlencode
import requests
from waste_collection_schedule import Collection
TITLE = "Lerum Vatten och Avlopp"
DESCRIPTION = "Source for Lerum Vatten och Avlopp waste collection."
URL = "https://vatjanst.lerum.se/FutureWeb/SimpleWastePickup/SimpleWaste... | true | true |
f761e7ef3e5a5620af1f9e5a100dba70f45d6885 | 1,660 | py | Python | django_rebel/migrations/0003_auto_20200310_1740.py | ozc/django-rebel | eebf19d104b67d303d06069fe4424530b86b94e2 | [
"MIT"
] | 2 | 2018-12-23T00:54:49.000Z | 2020-06-01T11:17:42.000Z | django_rebel/migrations/0003_auto_20200310_1740.py | ozc/django-rebel | eebf19d104b67d303d06069fe4424530b86b94e2 | [
"MIT"
] | 1 | 2020-06-02T01:32:12.000Z | 2020-06-02T01:32:12.000Z | django_rebel/migrations/0003_auto_20200310_1740.py | ozc/django-rebel | eebf19d104b67d303d06069fe4424530b86b94e2 | [
"MIT"
] | 1 | 2020-06-01T11:17:52.000Z | 2020-06-01T11:17:52.000Z | # Generated by Django 2.1.5 on 2020-03-10 17:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_rebel', '0002_auto_20190114_0443'),
]
operations = [
migrations.AddField(
model_name='mail',
name='has_accept... | 28.135593 | 53 | 0.545181 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_rebel', '0002_auto_20190114_0443'),
]
operations = [
migrations.AddField(
model_name='mail',
name='has_accepted',
field=models.BooleanField(defau... | true | true |
f761e928266e0096451331c84ee7d208b39dc5d3 | 1,701 | py | Python | test_matting.py | Pandinosaurus/closed-form-matting | 5fb39478fb9fc938c583a6786adc17cea6dd9c4c | [
"MIT"
] | 415 | 2016-11-24T14:24:15.000Z | 2022-03-31T03:46:41.000Z | test_matting.py | Pandinosaurus/closed-form-matting | 5fb39478fb9fc938c583a6786adc17cea6dd9c4c | [
"MIT"
] | 19 | 2017-03-23T21:40:51.000Z | 2022-03-12T21:44:13.000Z | test_matting.py | Pandinosaurus/closed-form-matting | 5fb39478fb9fc938c583a6786adc17cea6dd9c4c | [
"MIT"
] | 111 | 2016-11-13T14:36:08.000Z | 2022-03-15T08:40:58.000Z | """Tests for Closed-Form matting and foreground/background solver."""
import unittest
import cv2
import numpy as np
import closed_form_matting
class TestMatting(unittest.TestCase):
def test_solution_close_to_original_implementation(self):
image = cv2.imread('testdata/source.png', cv2.IMREAD_COLOR) / 255.... | 43.615385 | 98 | 0.726044 | import unittest
import cv2
import numpy as np
import closed_form_matting
class TestMatting(unittest.TestCase):
def test_solution_close_to_original_implementation(self):
image = cv2.imread('testdata/source.png', cv2.IMREAD_COLOR) / 255.0
scribles = cv2.imread('testdata/scribbles.png', cv2.IMREAD_C... | true | true |
f761e96c6c8edef6052dd6686c423ae4172f9de3 | 14,971 | py | Python | cirq-core/cirq/__init__.py | livenson/Cirq | b2fa642895089fba385999d675ab65d57a53e0df | [
"Apache-2.0"
] | null | null | null | cirq-core/cirq/__init__.py | livenson/Cirq | b2fa642895089fba385999d675ab65d57a53e0df | [
"Apache-2.0"
] | null | null | null | cirq-core/cirq/__init__.py | livenson/Cirq | b2fa642895089fba385999d675ab65d57a53e0df | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 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 ... | 22.048601 | 78 | 0.73462 |
from cirq import _import
from cirq import (
_version,
_doc,
type_workarounds,
)
with _import.delay_import('cirq.protocols'):
from cirq import (
protocols,
value,
linalg,
qis,
ops,
devices,
study,
)
from cirq import (
circ... | true | true |
f761ea1538ada6c50353f0d7621fc57a51450559 | 3,521 | py | Python | tests/objective/transmission/test_carbon_imports_tuning_costs.py | souissim/gridpath | 4eeca2be24b485edc56026e38cfda83f4a6b27ea | [
"Apache-2.0"
] | null | null | null | tests/objective/transmission/test_carbon_imports_tuning_costs.py | souissim/gridpath | 4eeca2be24b485edc56026e38cfda83f4a6b27ea | [
"Apache-2.0"
] | null | null | null | tests/objective/transmission/test_carbon_imports_tuning_costs.py | souissim/gridpath | 4eeca2be24b485edc56026e38cfda83f4a6b27ea | [
"Apache-2.0"
] | 1 | 2021-12-21T20:44:21.000Z | 2021-12-21T20:44:21.000Z | # Copyright 2016-2020 Blue Marble Analytics LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 31.720721 | 87 | 0.692417 |
from __future__ import print_function
from builtins import str
from collections import OrderedDict
from importlib import import_module
import os.path
import sys
import unittest
from tests.common_functions import create_abstract_model, add_components_and_load_data
TEST_DATA_DIRECTORY = os.path.join(os.path.dirname(_... | true | true |
f761ebbcb0d391073a64e0c146befdfc0c6ccd33 | 4,172 | py | Python | io_scene_halo/misc/import_fixup.py | General-101/Halo-Asset-Blender-Development-Toolset | 90d9c695cac2b5442151824ec1e8615db4260dd3 | [
"MIT"
] | 36 | 2020-11-29T04:36:19.000Z | 2022-03-16T22:54:45.000Z | io_scene_halo/misc/import_fixup.py | General-101/Halo-Asset-Blender-Development-Toolset | 90d9c695cac2b5442151824ec1e8615db4260dd3 | [
"MIT"
] | 12 | 2020-10-27T17:23:08.000Z | 2022-03-23T16:20:37.000Z | io_scene_halo/misc/import_fixup.py | General-101/Halo-Asset-Blender-Development-Toolset | 90d9c695cac2b5442151824ec1e8615db4260dd3 | [
"MIT"
] | 15 | 2020-12-02T13:28:52.000Z | 2022-03-12T00:14:10.000Z | # ##### BEGIN MIT LICENSE BLOCK #####
#
# MIT License
#
# Copyright (c) 2020 Steven Garcia
#
# 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 ... | 43.458333 | 173 | 0.651965 |
import bpy
from ..global_functions import global_functions, mesh_processing
def merge_normals():
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.merge_normals()
bpy.ops.mesh.select_all(action='DESELECT')
def merge_verts(material_idx_list, threshold):
for material_idx in material_idx_list:
... | true | true |
f761ec27ec1f7833db72bf45018cc0641f7a7612 | 787 | py | Python | gym_donkeycar/core/util.py | vihank/gym-donkeycar | 2e3cd780d92f3d5da5a0f9c67272a0cd3f08befe | [
"MIT"
] | 2 | 2021-04-19T03:10:46.000Z | 2021-06-02T08:15:13.000Z | gym_donkeycar/core/util.py | vihank/gym-donkeycar | 2e3cd780d92f3d5da5a0f9c67272a0cd3f08befe | [
"MIT"
] | null | null | null | gym_donkeycar/core/util.py | vihank/gym-donkeycar | 2e3cd780d92f3d5da5a0f9c67272a0cd3f08befe | [
"MIT"
] | null | null | null | import re
def replace_float_notation(string):
"""
Replace unity float notation for languages like
French or German that use comma instead of dot.
This convert the json sent by Unity to a valid one.
Ex: "test": 1,2, "key": 2 -> "test": 1.2, "key": 2
:param string: (str) The incorrect j... | 34.217391 | 64 | 0.587039 | import re
def replace_float_notation(string):
regex_french_notation = r'"[a-zA-Z_]+":(?P<num>[0-9,E-]+),'
regex_end = r'"[a-zA-Z_]+":(?P<num>[0-9,E-]+)}'
for regex in [regex_french_notation, regex_end]:
matches = re.finditer(regex, string, re.MULTILINE)
for match in matches:
... | true | true |
f761ecb9e3ee1af94d06bcbfde352ae34847f24c | 394 | py | Python | lcore/migrations/0006_auto_20200810_2035.py | GitDietz/sweb | 1c21f837d34c52878d44864ea794e7952914f492 | [
"MIT"
] | null | null | null | lcore/migrations/0006_auto_20200810_2035.py | GitDietz/sweb | 1c21f837d34c52878d44864ea794e7952914f492 | [
"MIT"
] | 2 | 2021-02-28T03:05:50.000Z | 2021-02-28T06:20:51.000Z | lcore/migrations/0006_auto_20200810_2035.py | GitDietz/sweb | 1c21f837d34c52878d44864ea794e7952914f492 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.9 on 2020-08-10 10:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lcore', '0005_remove_article_image_file'),
]
operations = [
migrations.AlterField(
model_name='article',
name='extra... | 20.736842 | 52 | 0.606599 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lcore', '0005_remove_article_image_file'),
]
operations = [
migrations.AlterField(
model_name='article',
name='extract',
field=models.CharField(max_leng... | true | true |
f761eccc8747727d0bf6e1fad1dd9fce6d73cf52 | 676 | py | Python | source/tws_futures/helpers/__init__.py | sudoMode/TWS-Futures | 4faf64761d200ec8915268b1582223ffd5cd50e1 | [
"MIT"
] | 1 | 2021-10-08T18:59:03.000Z | 2021-10-08T18:59:03.000Z | source/tws_futures/helpers/__init__.py | sudoMode/TWS-Futures | 4faf64761d200ec8915268b1582223ffd5cd50e1 | [
"MIT"
] | null | null | null | source/tws_futures/helpers/__init__.py | sudoMode/TWS-Futures | 4faf64761d200ec8915268b1582223ffd5cd50e1 | [
"MIT"
] | 2 | 2021-09-06T23:43:44.000Z | 2021-11-09T13:34:08.000Z | from tws_futures import __settings__ as project
from tws_futures.helpers._input_types import INPUT_TYPES
from tws_futures.helpers.validators import VALIDATION_MAP
from tws_futures.helpers import utils
from tws_futures.helpers.logger_setup import get_logger
from tws_futures.helpers.parsers import parse_user_args
from tw... | 32.190476 | 62 | 0.66716 | from tws_futures import __settings__ as project
from tws_futures.helpers._input_types import INPUT_TYPES
from tws_futures.helpers.validators import VALIDATION_MAP
from tws_futures.helpers import utils
from tws_futures.helpers.logger_setup import get_logger
from tws_futures.helpers.parsers import parse_user_args
from tw... | true | true |
f761ee0144e8833026e5cbc5f357bc32d7d4ca4b | 315 | py | Python | leanpub_multi_action/__init__.py | lykinsbd/leanpub-multi-action | 5723aa41369a26fca10522f74b0ce12d2548d521 | [
"Apache-2.0"
] | null | null | null | leanpub_multi_action/__init__.py | lykinsbd/leanpub-multi-action | 5723aa41369a26fca10522f74b0ce12d2548d521 | [
"Apache-2.0"
] | 7 | 2021-09-23T12:22:19.000Z | 2021-10-03T18:00:29.000Z | leanpub_multi_action/__init__.py | lykinsbd/leanpub-mullti-action | 5723aa41369a26fca10522f74b0ce12d2548d521 | [
"Apache-2.0"
] | null | null | null | """Leanpub Multi Action is used to interact with the Leanpub.com API in GitHub Actions."""
# Gather version information from project packaging
try:
from importlib import metadata
except ImportError:
# Python version < 3.8
import importlib_metadata as metadata
__version__ = metadata.version(__name__)
| 28.636364 | 90 | 0.771429 |
try:
from importlib import metadata
except ImportError:
import importlib_metadata as metadata
__version__ = metadata.version(__name__)
| true | true |
f761ef8b98084263abe61ea6052e27194d2e3bc8 | 7,809 | py | Python | lib/JumpScale/clients/racktivity/energyswitch/client.py | Jumpscale/jumpscale_core8 | f80ac9b1ab99b833ee7adb17700dcf4ef35f3734 | [
"Apache-2.0"
] | 8 | 2016-04-14T14:04:57.000Z | 2020-06-09T00:24:34.000Z | lib/JumpScale/clients/racktivity/energyswitch/client.py | Jumpscale/jumpscale_core8 | f80ac9b1ab99b833ee7adb17700dcf4ef35f3734 | [
"Apache-2.0"
] | 418 | 2016-01-25T10:30:00.000Z | 2021-09-08T12:29:13.000Z | lib/JumpScale/clients/racktivity/energyswitch/client.py | Jumpscale/jumpscale_core8 | f80ac9b1ab99b833ee7adb17700dcf4ef35f3734 | [
"Apache-2.0"
] | 9 | 2016-04-21T07:21:17.000Z | 2022-01-24T10:35:54.000Z | import time
from JumpScale.clients.racktivity.energyswitch.proxy import connection
from JumpScale.clients.racktivity.energyswitch.common import convert
from JumpScale.clients.racktivity.energyswitch.common.GUIDTable import Value
from JumpScale.clients.racktivity.energyswitch.modelfactory.modelfactory import ModelFacto... | 36.661972 | 111 | 0.548726 | import time
from JumpScale.clients.racktivity.energyswitch.proxy import connection
from JumpScale.clients.racktivity.energyswitch.common import convert
from JumpScale.clients.racktivity.energyswitch.common.GUIDTable import Value
from JumpScale.clients.racktivity.energyswitch.modelfactory.modelfactory import ModelFacto... | true | true |
f761f14664d21eb54e71178dfc057954de625b66 | 1,784 | py | Python | userbot/modules/fake_gs.py | Suraj-Suresh32/OpenUserBot | 041539c7961579729d63b211785848b148364a79 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 5 | 2020-06-07T12:45:21.000Z | 2020-10-21T03:37:21.000Z | userbot/modules/fake_gs.py | Suraj-Suresh32/OpenUserBot | 041539c7961579729d63b211785848b148364a79 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 4 | 2020-06-10T09:44:34.000Z | 2020-07-28T16:17:17.000Z | userbot/modules/fake_gs.py | Suraj-Suresh32/OpenUserBot | 041539c7961579729d63b211785848b148364a79 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 78 | 2020-03-11T10:59:44.000Z | 2022-01-13T15:50:46.000Z | """Get a user-customised google search meme!"""
# Plugin By - XlayerCharon[XCB]
# TG ~>>//@CharonCB21
# Ported for OUB by @AshSTR
import asyncio
import os
from PIL import Image, ImageDraw, ImageFont
from wget import download
from userbot import CMD_HELP
from userbot.events import register
@register(outgoing=True, p... | 31.298246 | 78 | 0.654148 |
import asyncio
import os
from PIL import Image, ImageDraw, ImageFont
from wget import download
from userbot import CMD_HELP
from userbot.events import register
@register(outgoing=True, pattern="^.fgs ((.*) ; (.*))")
async def FakeGoogleSearch(event):
input_str = event.pattern_match.group(1)
if input_str is ... | true | true |
f761f25dccaaf3073f8c5f54b39e134a930d9670 | 30,630 | py | Python | tests/test_mcc.py | luphord/monte-carlo-contracts | e7723e6304bb5df6f5f2b18225be8feeb09f60e6 | [
"MIT"
] | 2 | 2022-03-04T21:15:18.000Z | 2022-03-06T01:19:27.000Z | tests/test_mcc.py | luphord/monte-carlo-contracts | e7723e6304bb5df6f5f2b18225be8feeb09f60e6 | [
"MIT"
] | null | null | null | tests/test_mcc.py | luphord/monte-carlo-contracts | e7723e6304bb5df6f5f2b18225be8feeb09f60e6 | [
"MIT"
] | null | null | null | import unittest
import numpy as np
from pandas.testing import assert_frame_equal
from dataclasses import dataclass
from typing import Callable
from mcc import (
parser,
IndexedCashflows,
DateIndex,
Model,
TermStructuresModel,
ObservableBool,
KonstFloat,
LinearRate,
FixedAfter,
S... | 41.673469 | 88 | 0.584851 | import unittest
import numpy as np
from pandas.testing import assert_frame_equal
from dataclasses import dataclass
from typing import Callable
from mcc import (
parser,
IndexedCashflows,
DateIndex,
Model,
TermStructuresModel,
ObservableBool,
KonstFloat,
LinearRate,
FixedAfter,
S... | true | true |
f761f29d904b114ec1b82833ce356a18502baa0d | 2,806 | py | Python | tests/config.py | jaipradeesh/PyRFC | 40df01a52d71c6b9bfb5a57c416633d1fbc791df | [
"Apache-2.0"
] | null | null | null | tests/config.py | jaipradeesh/PyRFC | 40df01a52d71c6b9bfb5a57c416633d1fbc791df | [
"Apache-2.0"
] | null | null | null | tests/config.py | jaipradeesh/PyRFC | 40df01a52d71c6b9bfb5a57c416633d1fbc791df | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*
import datetime
try:
from configparser import ConfigParser
COPA = ConfigParser()
fc = open("tests/pyrfc.cfg", "r")
COPA.read_file(fc)
except ImportError as ex:
from configparser import config_parser
COPA = config_parser()
COPA.read_file("tests/pyrfc.cfg")
# Numer... | 33.404762 | 120 | 0.647185 |
import datetime
try:
from configparser import ConfigParser
COPA = ConfigParser()
fc = open("tests/pyrfc.cfg", "r")
COPA.read_file(fc)
except ImportError as ex:
from configparser import config_parser
COPA = config_parser()
COPA.read_file("tests/pyrfc.cfg")
RFC_MATH = {
"RFC_INT1": ... | true | true |
f761f2a8a41ee5ce4681a0e815052e79a271e7e7 | 6,979 | py | Python | util/visualizer.py | zengxinzhy/colorization-pytorch | a41e61dfc0d99532728af3cbfd21efbdaf6086c5 | [
"MIT"
] | null | null | null | util/visualizer.py | zengxinzhy/colorization-pytorch | a41e61dfc0d99532728af3cbfd21efbdaf6086c5 | [
"MIT"
] | null | null | null | util/visualizer.py | zengxinzhy/colorization-pytorch | a41e61dfc0d99532728af3cbfd21efbdaf6086c5 | [
"MIT"
] | null | null | null | import numpy as np
import os
import ntpath
import time
from . import util
from . import html
from PIL import Image
from torchvision import transforms
def imresize(image, size, interp=Image.BICUBIC):
return transforms.Resize(size=size, interpolation=interp)(image)
# save image to the disk
def save_images(webpag... | 41.295858 | 116 | 0.520992 | import numpy as np
import os
import ntpath
import time
from . import util
from . import html
from PIL import Image
from torchvision import transforms
def imresize(image, size, interp=Image.BICUBIC):
return transforms.Resize(size=size, interpolation=interp)(image)
def save_images(webpage, visuals, image_path, a... | true | true |
f761f303c4c9f784b8923f924d1729be98263243 | 5,380 | py | Python | quantulum/load.py | apcode/quantulum | 836720d7218e1f6f4057fd1a660b5f1109498956 | [
"MIT"
] | 115 | 2016-06-28T23:36:16.000Z | 2021-08-10T08:29:01.000Z | quantulum/load.py | apcode/quantulum | 836720d7218e1f6f4057fd1a660b5f1109498956 | [
"MIT"
] | 17 | 2016-08-13T20:19:03.000Z | 2022-03-02T12:35:31.000Z | quantulum/load.py | apcode/quantulum | 836720d7218e1f6f4057fd1a660b5f1109498956 | [
"MIT"
] | 19 | 2017-05-11T16:38:44.000Z | 2022-03-22T09:54:00.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""quantulum unit and entity loading functions."""
# Standard library
import os
import json
from collections import defaultdict
# Dependencies
import inflect
# Quantulum
from . import classes as c
TOPDIR = os.path.dirname(__file__) or "."
PLURALS = inflect.engine()
... | 33.006135 | 79 | 0.529926 |
import os
import json
from collections import defaultdict
import inflect
from . import classes as c
TOPDIR = os.path.dirname(__file__) or "."
PLURALS = inflect.engine()
def get_key_from_dimensions(dimensions):
return tuple(tuple(i.items()) for i in dimensions)
def get_dimension_permutations(entities, dime... | true | true |
f761f51c0aa9615634efbc569a3053663f502c72 | 158 | py | Python | radius_of_circle.py | sayaliborade/My-Programming-Space | a7ac4436afa76143f4961e043097d33076532b6d | [
"MIT"
] | null | null | null | radius_of_circle.py | sayaliborade/My-Programming-Space | a7ac4436afa76143f4961e043097d33076532b6d | [
"MIT"
] | null | null | null | radius_of_circle.py | sayaliborade/My-Programming-Space | a7ac4436afa76143f4961e043097d33076532b6d | [
"MIT"
] | null | null | null | rad = float(input("Enter the radius to find the area of the circle:"))
area_of_circle = 3.14*(rad*rad)
print("Area of circle is {0}".format(area_of_circle)) | 31.6 | 70 | 0.721519 | rad = float(input("Enter the radius to find the area of the circle:"))
area_of_circle = 3.14*(rad*rad)
print("Area of circle is {0}".format(area_of_circle)) | true | true |
f761f5345aade99a9cc467f7d69650f2eb57e56e | 1,245 | py | Python | du/docker/Preprocessor.py | spiricn/DevUtils | 58a035a08a7c58035c25f992c1b8aa33cc997cd2 | [
"MIT"
] | 1 | 2021-12-21T13:18:08.000Z | 2021-12-21T13:18:08.000Z | du/docker/Preprocessor.py | spiricn/DevUtils | 58a035a08a7c58035c25f992c1b8aa33cc997cd2 | [
"MIT"
] | null | null | null | du/docker/Preprocessor.py | spiricn/DevUtils | 58a035a08a7c58035c25f992c1b8aa33cc997cd2 | [
"MIT"
] | null | null | null | import os
class Preprocessor:
"""
Class used to preprocess Docker.in files
"""
@staticmethod
def preprocess(inputFilePath):
"""
Preprocess given input file
@param inputFilePath Path to the input dockerfile
"""
result = ""
# Dockerfile directory
... | 25.9375 | 80 | 0.497992 | import os
class Preprocessor:
@staticmethod
def preprocess(inputFilePath):
result = ""
dir = os.path.dirname(inputFilePath)
if not os.path.isfile(inputFilePath):
raise RuntimeError(
"Could not find input file: %r" % os.path.abspath(inputF... | true | true |
f761f7db401d5388938cb1690ee7a17600e8dfad | 1,347 | py | Python | infobip/api/model/sms/mt/send/binary/SMSMultiBinaryRequest.py | bahiamartins/infobip-api-python-client | 88f044901af5690d01fcb7bce90d0ed2ab1ba4d1 | [
"Apache-2.0"
] | null | null | null | infobip/api/model/sms/mt/send/binary/SMSMultiBinaryRequest.py | bahiamartins/infobip-api-python-client | 88f044901af5690d01fcb7bce90d0ed2ab1ba4d1 | [
"Apache-2.0"
] | null | null | null | infobip/api/model/sms/mt/send/binary/SMSMultiBinaryRequest.py | bahiamartins/infobip-api-python-client | 88f044901af5690d01fcb7bce90d0ed2ab1ba4d1 | [
"Apache-2.0"
] | 1 | 2020-04-08T19:03:26.000Z | 2020-04-08T19:03:26.000Z | # -*- coding: utf-8 -*-
"""This is a generated class and is not intended for modification!
TODO: Point to Github contribution instructions
"""
from datetime import datetime
from infobip.util.models import DefaultObject, serializable
from infobip.api.model.sms.mt.send.SMSData import SMSData
class SMSMultiBinaryReques... | 25.903846 | 66 | 0.664439 |
from datetime import datetime
from infobip.util.models import DefaultObject, serializable
from infobip.api.model.sms.mt.send.SMSData import SMSData
class SMSMultiBinaryRequest(DefaultObject):
@property
@serializable(name="bulkId", type=unicode)
def bulk_id(self):
return self.get_field_value("bulk... | true | true |
f761f7e3e54a9c303e84d4d0d7ed803cd9509050 | 5,802 | py | Python | src/olympia/devhub/tests/test_helpers.py | makyen/Mozilla-addons-server | 555d9f31cc4b00799466f16c8809edd5f1858ab8 | [
"BSD-3-Clause"
] | 1 | 2020-12-03T10:02:15.000Z | 2020-12-03T10:02:15.000Z | src/olympia/devhub/tests/test_helpers.py | makyen/Mozilla-addons-server | 555d9f31cc4b00799466f16c8809edd5f1858ab8 | [
"BSD-3-Clause"
] | null | null | null | src/olympia/devhub/tests/test_helpers.py | makyen/Mozilla-addons-server | 555d9f31cc4b00799466f16c8809edd5f1858ab8 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import urllib
from django.utils import translation
import pytest
from mock import Mock
from olympia import amo
from olympia.activity.models import ActivityLog
from olympia.amo import LOG
from olympia.amo.tests import addon_factory, days_ago, TestCase, user_factory
from olympia.amo.tests.test_... | 34.535714 | 78 | 0.654602 | import urllib
from django.utils import translation
import pytest
from mock import Mock
from olympia import amo
from olympia.activity.models import ActivityLog
from olympia.amo import LOG
from olympia.amo.tests import addon_factory, days_ago, TestCase, user_factory
from olympia.amo.tests.test_helpers import render
fr... | true | true |
f761f824c9532b63fce5db7eb9356b95bb43c3ae | 4,917 | py | Python | CQGrail/HolyGrailWar/initialization.py | bbbboom/nonebot-plugin | e41c1d64baf39c7ec04dd37be6ca490369ccdadd | [
"MIT"
] | 96 | 2020-02-17T16:17:37.000Z | 2022-03-25T02:58:46.000Z | CQGrail/HolyGrailWar/initialization.py | 1638527759/nonebot-plugin | 67bf1619145e97de107c18a11c476643fc57ff93 | [
"MIT"
] | 2 | 2020-03-03T04:01:50.000Z | 2020-07-30T17:14:25.000Z | CQGrail/HolyGrailWar/initialization.py | 1638527759/nonebot-plugin | 67bf1619145e97de107c18a11c476643fc57ff93 | [
"MIT"
] | 45 | 2020-05-13T05:28:15.000Z | 2022-03-05T14:37:32.000Z | # -*- coding: utf-8 -*-
import os
import aiofiles
import ujson
from . import Utils
from dateutil.parser import parse
import datetime
from .customException import GrailExcept
# Non fatal error type
error = 'error'
ok = 'ok'
async def getOrWriteNumber(sequence, group, model = 'user'):
userUID = 1
groupUID = 1
... | 35.890511 | 115 | 0.520236 |
import os
import aiofiles
import ujson
from . import Utils
from dateutil.parser import parse
import datetime
from .customException import GrailExcept
error = 'error'
ok = 'ok'
async def getOrWriteNumber(sequence, group, model = 'user'):
userUID = 1
groupUID = 1
if sequence != 0:
p = './HolyGr... | true | true |
f761f82e76745f5aa7a5c48fbf87826b1d2d03ca | 1,295 | py | Python | mailchimp3/entities/landingpageaction.py | michaelwalkerfl/python-mailchimp | 3515ab2a724a39825c2c0d3c0b254d43ec198d2b | [
"MIT"
] | 311 | 2015-11-27T07:15:42.000Z | 2019-03-06T15:55:40.000Z | mailchimp3/entities/landingpageaction.py | michaelwalkerfl/python-mailchimp | 3515ab2a724a39825c2c0d3c0b254d43ec198d2b | [
"MIT"
] | 144 | 2016-01-25T21:29:33.000Z | 2019-02-24T13:36:16.000Z | mailchimp3/entities/landingpageaction.py | michaelwalkerfl/python-mailchimp | 3515ab2a724a39825c2c0d3c0b254d43ec198d2b | [
"MIT"
] | 105 | 2015-10-21T14:34:38.000Z | 2019-03-01T21:34:44.000Z | # coding=utf-8
"""
The Landinge Page actions API endpoint
Documentation: https://mailchimp.com/developer/reference/landing-pages/
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class LandingPageAction(BaseApi):
"""
Manage your Landing Pages, including publishing and unpub... | 28.152174 | 88 | 0.646332 | from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class LandingPageAction(BaseApi):
def __init__(self, *args, **kwargs):
super(LandingPageAction, self).__init__(*args, **kwargs)
self.endpoint = 'landing-pages'
self.page_id = None
def publish(self, page_i... | true | true |
f761f839313e117a8fb39b8933e0e7f199f3c1e6 | 1,666 | py | Python | wep/axe.py | qwewqa/dl | d6a1d035178e1e67ae9045829c6ad5c85c3ec2e0 | [
"Apache-2.0"
] | null | null | null | wep/axe.py | qwewqa/dl | d6a1d035178e1e67ae9045829c6ad5c85c3ec2e0 | [
"Apache-2.0"
] | null | null | null | wep/axe.py | qwewqa/dl | d6a1d035178e1e67ae9045829c6ad5c85c3ec2e0 | [
"Apache-2.0"
] | null | null | null | conf = {
'xtype': 'melee',
'x1.dmg': 114 / 100.0,
'x1.sp': 200,
'x1.startup': 17 / 60.0,
'x1.recovery': 46 / 60.0,
'x1.hit': 1,
'x2.dmg': 122 / 100.0,
'x2.sp': 240,
'x2.startup': 0,
'x2.recovery': 61 / 60.0,
'x2.hit': 1,
'x3.dmg': 204 / 100.0,
'x3.sp': 360,
'x3... | 24.144928 | 172 | 0.516206 | conf = {
'xtype': 'melee',
'x1.dmg': 114 / 100.0,
'x1.sp': 200,
'x1.startup': 17 / 60.0,
'x1.recovery': 46 / 60.0,
'x1.hit': 1,
'x2.dmg': 122 / 100.0,
'x2.sp': 240,
'x2.startup': 0,
'x2.recovery': 61 / 60.0,
'x2.hit': 1,
'x3.dmg': 204 / 100.0,
'x3.sp': 360,
'x3... | true | true |
f761f8f2c9756ee9a1b554a6e039fe955d6a43ad | 80,480 | py | Python | src/sage/combinat/tiling.py | rwst/sage | a9d274b9338e6ee24bf35ea8d25875507e51e455 | [
"BSL-1.0"
] | 1 | 2016-11-04T16:31:48.000Z | 2016-11-04T16:31:48.000Z | src/sage/combinat/tiling.py | rwst/sage | a9d274b9338e6ee24bf35ea8d25875507e51e455 | [
"BSL-1.0"
] | null | null | null | src/sage/combinat/tiling.py | rwst/sage | a9d274b9338e6ee24bf35ea8d25875507e51e455 | [
"BSL-1.0"
] | null | null | null | r"""
Tiling Solver
Tiling a n-dimensional polyomino with n-dimensional polyominoes.
This module defines two classes:
- :class:`sage.combinat.tiling.Polyomino` class, to represent polyominoes
in arbitrary dimension. The goal of this class is to return all the
rotated, reflected and/or translated copies of a polyo... | 36.968305 | 232 | 0.502522 | from __future__ import division
from builtins import zip
from six import iteritems
from six.moves import range
import itertools
from sage.structure.sage_object import SageObject
from sage.modules.free_module_element import vector
from sage.misc.mrange import xmrange
from sage.misc.cachefunc import cached_method, cach... | true | true |
f761fb3ca5e751929ae46f00476f93cd61fcc327 | 538 | py | Python | createiter.py | ajayhk/Python | 5f5f93194ff5057aa1ee41470f258ed963973b92 | [
"MIT"
] | null | null | null | createiter.py | ajayhk/Python | 5f5f93194ff5057aa1ee41470f258ed963973b92 | [
"MIT"
] | null | null | null | createiter.py | ajayhk/Python | 5f5f93194ff5057aa1ee41470f258ed963973b92 | [
"MIT"
] | null | null | null | class CountN:
def __init__(self, count):
self.count = count
self.current = 1
return None
def __iter__(self):
self.current = 0
return self
def __next__(self):
self.current += 1
if self.current > self.count:
raise StopIteration
else:
return self.current
if __name__ ==... | 16.8125 | 68 | 0.641264 | class CountN:
def __init__(self, count):
self.count = count
self.current = 1
return None
def __iter__(self):
self.current = 0
return self
def __next__(self):
self.current += 1
if self.current > self.count:
raise StopIteration
else:
return self.current
if __name__ ==... | true | true |
f761fb62f71268232ec0e67ee545afd87f304816 | 1,437 | py | Python | a2ml/api/utils/json_utils.py | augerai/a2ml | 9d9ce0ac1b51cc81f1cb5ae331c4523131bc6a86 | [
"Apache-2.0"
] | 30 | 2019-07-01T13:23:27.000Z | 2022-03-16T21:19:33.000Z | a2ml/api/utils/json_utils.py | augerai/a2ml | 9d9ce0ac1b51cc81f1cb5ae331c4523131bc6a86 | [
"Apache-2.0"
] | 234 | 2019-07-04T13:56:15.000Z | 2021-11-04T10:12:55.000Z | a2ml/api/utils/json_utils.py | augerai/a2ml | 9d9ce0ac1b51cc81f1cb5ae331c4523131bc6a86 | [
"Apache-2.0"
] | 13 | 2019-07-04T14:00:34.000Z | 2020-07-13T11:18:44.000Z | import json
import numpy as np
import math
import numbers
def is_nan(x):
return (x is np.nan or x != x)
def convert_simple_numpy_type(obj):
if isinstance(obj, (np.int_, np.intc, np.intp, np.int8,
np.int16, np.int32, np.int64, np.uint8,
np.uint16, np.uint32, np.uint64)):
return int(obj... | 27.113208 | 70 | 0.633264 | import json
import numpy as np
import math
import numbers
def is_nan(x):
return (x is np.nan or x != x)
def convert_simple_numpy_type(obj):
if isinstance(obj, (np.int_, np.intc, np.intp, np.int8,
np.int16, np.int32, np.int64, np.uint8,
np.uint16, np.uint32, np.uint64)):
return int(obj... | true | true |
f761fb6fdd7444d5adfe4cdd0bb33af5a9090e06 | 2,380 | py | Python | awxkit/awxkit/api/pages/execution_environments.py | DamoR25/awxnew | 03ed6e97558ae090ea52703caf6ed1b196557981 | [
"Apache-2.0"
] | 11,396 | 2017-09-07T04:56:02.000Z | 2022-03-31T13:56:17.000Z | awxkit/awxkit/api/pages/execution_environments.py | DamoR25/awxnew | 03ed6e97558ae090ea52703caf6ed1b196557981 | [
"Apache-2.0"
] | 11,046 | 2017-09-07T09:30:46.000Z | 2022-03-31T20:28:01.000Z | awxkit/awxkit/api/pages/execution_environments.py | TinLe/awx | 73d8c12e3bf5b193305ed1202549331ea00088c1 | [
"Apache-2.0"
] | 3,592 | 2017-09-07T04:14:31.000Z | 2022-03-31T23:53:09.000Z | import logging
from awxkit.api.mixins import DSAdapter, HasCreate, HasCopy
from awxkit.api.pages import (
Credential,
Organization,
)
from awxkit.api.resources import resources
from awxkit.utils import random_title, PseudoNamespace, filter_by_class
from . import base
from . import page
log = logging.getLogg... | 37.777778 | 160 | 0.729832 | import logging
from awxkit.api.mixins import DSAdapter, HasCreate, HasCopy
from awxkit.api.pages import (
Credential,
Organization,
)
from awxkit.api.resources import resources
from awxkit.utils import random_title, PseudoNamespace, filter_by_class
from . import base
from . import page
log = logging.getLogg... | true | true |
f761fb8ffde84ef039f4d0f63fe0b0c4ff33dd48 | 3,621 | py | Python | python-kit/tests/test_socotra_marketplace_helpers.py | socotra-marketplace/tap-help-scripting | d9b4ff47173756e849d4d3325b5aa8bc6f054c68 | [
"MIT"
] | null | null | null | python-kit/tests/test_socotra_marketplace_helpers.py | socotra-marketplace/tap-help-scripting | d9b4ff47173756e849d4d3325b5aa8bc6f054c68 | [
"MIT"
] | null | null | null | python-kit/tests/test_socotra_marketplace_helpers.py | socotra-marketplace/tap-help-scripting | d9b4ff47173756e849d4d3325b5aa8bc6f054c68 | [
"MIT"
] | null | null | null | '''basic tests'''
import json
import os
import warnings
import pytest
import socotra_marketplace_helpers as helpers
from socotra_marketplace_helpers.jwt import sign
def test_disclaimer():
'''ack limited support'''
yes = input('Write YES to acknowledge this is BETA quality software: ')
assert yes == 'YES'... | 43.107143 | 77 | 0.646506 |
import json
import os
import warnings
import pytest
import socotra_marketplace_helpers as helpers
from socotra_marketplace_helpers.jwt import sign
def test_disclaimer():
yes = input('Write YES to acknowledge this is BETA quality software: ')
assert yes == 'YES', 'Sorry, but it is what it is.'
def open_test_... | true | true |
f761fc282b7a9d50ac47a6c6cf73469603db8c56 | 3,939 | py | Python | orchestra/contrib/contacts/admin.py | udm88/django-orchestra | 49c84f13a8f92427b01231615136549fb5be3a78 | [
"Unlicense"
] | 68 | 2015-02-09T10:28:44.000Z | 2022-03-12T11:08:36.000Z | orchestra/contrib/contacts/admin.py | ferminhg/django-orchestra | 49c84f13a8f92427b01231615136549fb5be3a78 | [
"Unlicense"
] | 17 | 2015-05-01T18:10:03.000Z | 2021-03-19T21:52:55.000Z | orchestra/contrib/contacts/admin.py | ferminhg/django-orchestra | 49c84f13a8f92427b01231615136549fb5be3a78 | [
"Unlicense"
] | 29 | 2015-03-31T04:51:03.000Z | 2022-02-17T02:58:50.000Z | from django import forms
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from orchestra.admin import AtLeastOneRequiredInlineFormSet, ExtendedModelAdmin
from orchestra.admin.actions import SendEmail
from orchestra.admin.utils import insertattr, change_url
from orchestra.contrib... | 34.552632 | 96 | 0.606245 | from django import forms
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from orchestra.admin import AtLeastOneRequiredInlineFormSet, ExtendedModelAdmin
from orchestra.admin.actions import SendEmail
from orchestra.admin.utils import insertattr, change_url
from orchestra.contrib... | true | true |
f761fd0b1d589b474b1c56e91c544835b6f0dd09 | 27,753 | py | Python | s2protocol/versions/protocol28667.py | cclauss/s2protocol | 81edbd3a850c2ce4c2213aad0b922e0634ff5ebe | [
"MIT"
] | 408 | 2015-01-02T01:22:48.000Z | 2022-03-20T10:41:41.000Z | s2protocol/versions/protocol28667.py | cclauss/s2protocol | 81edbd3a850c2ce4c2213aad0b922e0634ff5ebe | [
"MIT"
] | 89 | 2015-04-23T01:51:31.000Z | 2022-02-07T22:09:09.000Z | s2protocol/versions/protocol28667.py | cclauss/s2protocol | 81edbd3a850c2ce4c2213aad0b922e0634ff5ebe | [
"MIT"
] | 104 | 2015-01-03T15:13:23.000Z | 2022-03-26T15:14:23.000Z | # Copyright (c) 2015-2017 Blizzard Entertainment
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | 58.674419 | 1,784 | 0.620509 |
from s2protocol.decoders import *
typeinfos = [
('_int',[(0,7)]), ('_int',[(0,4)]), ('_int',[(0,5)]), ('_int',[(0,6)]), ('_int',[(0,14)]), ('_int',[(0,22)]), ('_int',[(0,32)]), ('_choice',[(0,2),{0:('m_uint6',3),1:('m_uint14',4),2:('m_uint22',5),3:('m_uint32',6)}]), ... | true | true |
f761fd7902a98e33dd46c32f71f76e7ec6b000b7 | 1,262 | py | Python | apps/sponsor/admin.py | CasualGaming/studlan | 63daed67c1d309e4d5bd755eb68163e2174d0e00 | [
"MIT"
] | 9 | 2016-03-15T21:03:49.000Z | 2020-12-02T19:45:44.000Z | apps/sponsor/admin.py | piyushd26/studlan | 6eb96ebda182f44759b430cd497a727e0ee5bb63 | [
"MIT"
] | 161 | 2016-02-05T14:11:50.000Z | 2020-10-14T10:13:21.000Z | apps/sponsor/admin.py | piyushd26/studlan | 6eb96ebda182f44759b430cd497a727e0ee5bb63 | [
"MIT"
] | 11 | 2016-07-27T12:20:05.000Z | 2021-04-18T05:49:17.000Z | # -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from apps.sponsor.models import Sponsor, SponsorRelation, SponsorRelationTranslation, SponsorTranslation
class SponsorTranslationInlineAdmin(admin.StackedInline):
ver... | 30.047619 | 104 | 0.766244 |
from django.conf import settings
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from apps.sponsor.models import Sponsor, SponsorRelation, SponsorRelationTranslation, SponsorTranslation
class SponsorTranslationInlineAdmin(admin.StackedInline):
verbose_name = _(u'partner ... | true | true |
f761fe422a9653495ce69816556846c613c9ee7b | 21,307 | py | Python | tests/test_nested_components.py | sjamaan/python-formio-data | bfbd2d6a14cde6c83444c7ae364494b0f7380677 | [
"MIT"
] | null | null | null | tests/test_nested_components.py | sjamaan/python-formio-data | bfbd2d6a14cde6c83444c7ae364494b0f7380677 | [
"MIT"
] | null | null | null | tests/test_nested_components.py | sjamaan/python-formio-data | bfbd2d6a14cde6c83444c7ae364494b0f7380677 | [
"MIT"
] | null | null | null | # Copyright Nova Code (http://www.novacode.nl)
# See LICENSE file for full licensing details.
import json
import logging
import unittest
from datetime import datetime, date, timezone, timedelta
from tests.utils import readfile
from formiodata.builder import Builder
from formiodata.form import Form
from formiodata.co... | 36.672978 | 118 | 0.588586 |
import json
import logging
import unittest
from datetime import datetime, date, timezone, timedelta
from tests.utils import readfile
from formiodata.builder import Builder
from formiodata.form import Form
from formiodata.components import columnsComponent, datetimeComponent, emailComponent, numberComponent, \
se... | true | true |
f761fe81191eaad064df04015466353db046e218 | 5,968 | py | Python | Old/TAKFreeServer.py | scottwedge/FreeTakServer | 3e09c399cb8a977ef7767c43970b8eef070317dc | [
"MIT"
] | null | null | null | Old/TAKFreeServer.py | scottwedge/FreeTakServer | 3e09c399cb8a977ef7767c43970b8eef070317dc | [
"MIT"
] | null | null | null | Old/TAKFreeServer.py | scottwedge/FreeTakServer | 3e09c399cb8a977ef7767c43970b8eef070317dc | [
"MIT"
] | null | null | null | #######################################################
#
# TAKFreeServer.py
# Original author: naman108
# This code is Open Source, made available under the EPL 2.0 license.
# https://www.eclipse.org/legal/eplfaq.php
# credit to Harshini73 for base code
#
#######################################################
import... | 29.84 | 133 | 0.670744 | import socket
import threading
import argparse
import logging
import time
import xml.etree.ElementTree as ET
class ThreadedServer(object):
def __init__(self, host, port):
self.host = host
self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.setsockopt(socket.SOL_SOCKET, sock... | true | true |
f761feddb0c89b0120f46f8ae205fd2e98296b5a | 10,344 | py | Python | metaflow/plugins/argo/argo_cli.py | sappier/metaflow | dfe1a216e342555d5fb127607b35491a4ef11627 | [
"Apache-2.0"
] | 1 | 2021-05-18T03:35:09.000Z | 2021-05-18T03:35:09.000Z | metaflow/plugins/argo/argo_cli.py | sappier/metaflow | dfe1a216e342555d5fb127607b35491a4ef11627 | [
"Apache-2.0"
] | null | null | null | metaflow/plugins/argo/argo_cli.py | sappier/metaflow | dfe1a216e342555d5fb127607b35491a4ef11627 | [
"Apache-2.0"
] | null | null | null | import click
import json
import re
import warnings
from metaflow import current, decorators, parameters, JSONType
from metaflow.metaflow_config import from_conf
from metaflow.package import MetaflowPackage
from metaflow.plugins import BatchDecorator
from .argo_workflow import ArgoWorkflow, dns_name
from metaflow.excep... | 37.34296 | 115 | 0.563225 | import click
import json
import re
import warnings
from metaflow import current, decorators, parameters, JSONType
from metaflow.metaflow_config import from_conf
from metaflow.package import MetaflowPackage
from metaflow.plugins import BatchDecorator
from .argo_workflow import ArgoWorkflow, dns_name
from metaflow.excep... | true | true |
f76200eed1abf8c9427ecec1a8b5a7e818ebe1f5 | 721 | py | Python | algorithm/base/data/rule.py | liuxiaokaiA/truck_scheduling | c883528913aaa7b802fe7d81974efac0fd3f43e8 | [
"MIT"
] | null | null | null | algorithm/base/data/rule.py | liuxiaokaiA/truck_scheduling | c883528913aaa7b802fe7d81974efac0fd3f43e8 | [
"MIT"
] | null | null | null | algorithm/base/data/rule.py | liuxiaokaiA/truck_scheduling | c883528913aaa7b802fe7d81974efac0fd3f43e8 | [
"MIT"
] | null | null | null | # coding: utf-8
"""
调度规则,将 model/rule.py 中的规则转换为算法需要的数据
"""
from model.rule import rules, levels
class Rule(object):
def __init__(self):
super(Rule, self).__init__()
# print('rules: %s' % str(rules))
self.order_level = {}
for item in rules['order_level']:
self.order_lev... | 30.041667 | 74 | 0.603329 | from model.rule import rules, levels
class Rule(object):
def __init__(self):
super(Rule, self).__init__()
self.order_level = {}
for item in rules['order_level']:
self.order_level[item['level']] = (item['start'], item['end'])
self.order_mast_take = {
... | true | true |
f76201a708981252a327794d20af1914f2ac6cd1 | 1,678 | py | Python | data/cleveland-clinic-hospital/scrape.py | Afellman/hospital-chargemaster | 1b87bc64d95d97c0538be7633f9e469e5db624e2 | [
"MIT"
] | 34 | 2019-01-18T00:15:58.000Z | 2022-03-26T15:01:08.000Z | data/cleveland-clinic-hospital/scrape.py | wsheffel/hospital-chargemaster | b3473c798fd2f343f7f02c1e32496f9eea9fa94d | [
"MIT"
] | 8 | 2019-01-16T22:06:11.000Z | 2019-02-25T00:59:25.000Z | data/cleveland-clinic-hospital/scrape.py | wsheffel/hospital-chargemaster | b3473c798fd2f343f7f02c1e32496f9eea9fa94d | [
"MIT"
] | 10 | 2019-02-20T14:58:16.000Z | 2021-11-22T21:57:04.000Z | #!/usr/bin/env python
import os
import requests
import json
import datetime
import shutil
from bs4 import BeautifulSoup
here = os.path.dirname(os.path.abspath(__file__))
hospital_id = os.path.basename(here)
url ='https://my.clevelandclinic.org/patients/billing-insurance/patient-price-lists'
today = datetime.datetim... | 28.440678 | 84 | 0.650179 |
import os
import requests
import json
import datetime
import shutil
from bs4 import BeautifulSoup
here = os.path.dirname(os.path.abspath(__file__))
hospital_id = os.path.basename(here)
url ='https://my.clevelandclinic.org/patients/billing-insurance/patient-price-lists'
today = datetime.datetime.today().strftime('%Y... | true | true |
f76201e0837a199a32bc60da8e55eb2e34126099 | 5,225 | py | Python | slogger.py | stkyle/sython | 4b0a7d86b1522c94e67f1754a6b241d55857d2a6 | [
"MIT"
] | 15 | 2015-01-31T12:40:50.000Z | 2022-01-18T01:03:27.000Z | logger.py | achicha/python-logger | 100066435d51df6c3ed4269cdf93502ba5164e1c | [
"MIT"
] | 2 | 2016-01-08T11:20:14.000Z | 2017-10-13T18:04:45.000Z | logger.py | achicha/python-logger | 100066435d51df6c3ed4269cdf93502ba5164e1c | [
"MIT"
] | 15 | 2015-03-31T10:46:55.000Z | 2021-08-11T15:46:43.000Z | #!/usr/bin/env python
#
# Simple wrapper for Python logging module. Adds information about location
# emitting the debug information (file, line, function) and timestamp.
#
# Copyright (C) 2010, 2011 Senko Rasic <senko.rasic@dobarkod.hr>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
#... | 37.589928 | 82 | 0.658182 |
import os.path
import logging
import traceback
from logging import DEBUG, WARNING, ERROR, INFO
class Logger(object):
show_source_location = True
def _raw_log(self, logfn, message, exc_info):
cname = ''
loc = ''
fn = ''
tb = traceback.extract_stack()
if len(t... | true | true |
f76202b21ac3bcd992b754b4e30ec2f4b08c5d2b | 698 | py | Python | api_site/src/api_x/application/cheque.py | webee/pay | b48c6892686bf3f9014bb67ed119506e41050d45 | [
"W3C"
] | 1 | 2019-10-14T11:51:49.000Z | 2019-10-14T11:51:49.000Z | api_site/src/api_x/application/cheque.py | webee/pay | b48c6892686bf3f9014bb67ed119506e41050d45 | [
"W3C"
] | null | null | null | api_site/src/api_x/application/cheque.py | webee/pay | b48c6892686bf3f9014bb67ed119506e41050d45 | [
"W3C"
] | null | null | null | # coding=utf-8
from __future__ import unicode_literals
from api_x.zyt.biz import cheque
from api_x.zyt.biz.models import ChequeType
def draw_cheque(channel, from_id, amount, order_id=None, valid_seconds=1800, cheque_type=ChequeType.INSTANT,
info='', client_notify_url=''):
return cheque.draw_chequ... | 30.347826 | 118 | 0.769341 | from __future__ import unicode_literals
from api_x.zyt.biz import cheque
from api_x.zyt.biz.models import ChequeType
def draw_cheque(channel, from_id, amount, order_id=None, valid_seconds=1800, cheque_type=ChequeType.INSTANT,
info='', client_notify_url=''):
return cheque.draw_cheque(channel, from... | true | true |
f76202b66b677dc129b511af91da64de14ddd05c | 170 | py | Python | python/testData/intentions/PyInvertIfConditionIntentionTest/generalNoElseFollowupReturn_after.py | Starmel/intellij-community | adb89951109732e585d04f33e3fabbc9f9d3b256 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/intentions/PyInvertIfConditionIntentionTest/generalNoElseFollowupReturn_after.py | Starmel/intellij-community | adb89951109732e585d04f33e3fabbc9f9d3b256 | [
"Apache-2.0"
] | null | null | null | python/testData/intentions/PyInvertIfConditionIntentionTest/generalNoElseFollowupReturn_after.py | Starmel/intellij-community | adb89951109732e585d04f33e3fabbc9f9d3b256 | [
"Apache-2.0"
] | null | null | null | def func():
value = "not-none"
if value is not None:
<selection>pass</selection><caret>
else:
print("None")
print(value)
return True | 17 | 42 | 0.558824 | def func():
value = "not-none"
if value is not None:
<selection>pass</selection><caret>
else:
print("None")
print(value)
return True | false | true |
f76202c50b906c8f2e2f7b28ef6a326e6a9c7be0 | 27,340 | py | Python | cogs/hentai.py | im-zach/FragBeta | 57f1dcfd5518aa558d03b779139923502cf49605 | [
"MIT"
] | null | null | null | cogs/hentai.py | im-zach/FragBeta | 57f1dcfd5518aa558d03b779139923502cf49605 | [
"MIT"
] | 3 | 2021-03-23T04:58:47.000Z | 2021-04-02T02:40:54.000Z | cogs/hentai.py | im-zach/FragBeta | 57f1dcfd5518aa558d03b779139923502cf49605 | [
"MIT"
] | null | null | null | from datetime import datetime
from random import random
from imgurpython import ImgurClient
from config import *
import discord
import requests
from discord.ext import commands
import nekos
import sys
imgur = ImgurClient(imgurC, ImgurL)
class NekosCog(commands.Cog):
def __init__(self, bot):
self.bot = ... | 35.832241 | 168 | 0.584272 | from datetime import datetime
from random import random
from imgurpython import ImgurClient
from config import *
import discord
import requests
from discord.ext import commands
import nekos
import sys
imgur = ImgurClient(imgurC, ImgurL)
class NekosCog(commands.Cog):
def __init__(self, bot):
self.bot = ... | true | true |
f76204346176d2ff077de029d58fa8a9c25d5e38 | 31,176 | py | Python | pyndl/preprocess.py | dekuenstle/pyndl | 5360c0863f21abe77effea770fd1ef027bf4e8b4 | [
"MIT"
] | 10 | 2017-03-24T17:59:59.000Z | 2022-03-31T08:13:15.000Z | pyndl/preprocess.py | dekuenstle/pyndl | 5360c0863f21abe77effea770fd1ef027bf4e8b4 | [
"MIT"
] | 156 | 2017-03-23T21:53:21.000Z | 2021-09-13T08:31:44.000Z | pyndl/preprocess.py | dekuenstle/pyndl | 5360c0863f21abe77effea770fd1ef027bf4e8b4 | [
"MIT"
] | 4 | 2018-01-31T15:27:44.000Z | 2022-03-03T11:48:35.000Z | """
pyndl.preprocess
----------------
*pyndl.preprocess* provides functions in order to preprocess data and create
event files from it.
"""
import collections
import gzip
import multiprocessing
import os
import random
import re
import sys
import time
def bandsample(population, sample_size=50000, *, cutoff=5, seed=N... | 37.42617 | 110 | 0.579388 | import collections
import gzip
import multiprocessing
import os
import random
import re
import sys
import time
def bandsample(population, sample_size=50000, *, cutoff=5, seed=None,
verbose=False):
population = [(word, freq) for word, freq in population.items() if freq >=
c... | true | true |
f76204724625014be5aaf0034cfec0bc0302f084 | 747 | py | Python | panel/__init__.py | monocilindro/panel | 6dc72b692f41f1ae51e8e2d66c3d1334c73c8cc6 | [
"BSD-3-Clause"
] | null | null | null | panel/__init__.py | monocilindro/panel | 6dc72b692f41f1ae51e8e2d66c3d1334c73c8cc6 | [
"BSD-3-Clause"
] | null | null | null | panel/__init__.py | monocilindro/panel | 6dc72b692f41f1ae51e8e2d66c3d1334c73c8cc6 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import, division, unicode_literals
import param as _param
from . import layout # noqa
from . import links # noqa
from . import pane # noqa
from . import param # noqa
from . import pipeline # noqa
from . import widgets # noqa
from .config import config, panel_extension as extension # n... | 32.478261 | 82 | 0.759036 | from __future__ import absolute_import, division, unicode_literals
import param as _param
from . import layout from . import links from . import pane from . import param from . import pipeline from . import widgets
from .config import config, panel_extension as extension from .interact import interact from .io impor... | true | true |
f762051d8a1b19bf27f7c5cac6b54e7c1aa37810 | 5,340 | py | Python | pygmt/helpers/testing.py | carocamargo/pygmt | 6139c1735cff7f7d615d243145c21b1efef3f2c6 | [
"BSD-3-Clause"
] | null | null | null | pygmt/helpers/testing.py | carocamargo/pygmt | 6139c1735cff7f7d615d243145c21b1efef3f2c6 | [
"BSD-3-Clause"
] | null | null | null | pygmt/helpers/testing.py | carocamargo/pygmt | 6139c1735cff7f7d615d243145c21b1efef3f2c6 | [
"BSD-3-Clause"
] | null | null | null | """
Helper functions for testing.
"""
import inspect
import os
import string
from matplotlib.testing.compare import compare_images
from ..exceptions import GMTImageComparisonFailure
def check_figures_equal(*, extensions=("png",), tol=0.0, result_dir="result_images"):
"""
Decorator for test cases that generat... | 38.695652 | 90 | 0.590824 | import inspect
import os
import string
from matplotlib.testing.compare import compare_images
from ..exceptions import GMTImageComparisonFailure
def check_figures_equal(*, extensions=("png",), tol=0.0, result_dir="result_images"):
ALLOWED_CHARS = set(string.digits + string.ascii_letters + "_-[]()")
KEYWOR... | true | true |
f76205c12e38980be00ce5aa90e80e5f75b8b0a0 | 478 | py | Python | python-datastructure-exercise/python-ds-practice/02_weekday_name/weekday_name.py | ryankrdh/Springboard-Assignments | 9c9b132a814fc818810978dce1f33c4052028353 | [
"MIT"
] | null | null | null | python-datastructure-exercise/python-ds-practice/02_weekday_name/weekday_name.py | ryankrdh/Springboard-Assignments | 9c9b132a814fc818810978dce1f33c4052028353 | [
"MIT"
] | null | null | null | python-datastructure-exercise/python-ds-practice/02_weekday_name/weekday_name.py | ryankrdh/Springboard-Assignments | 9c9b132a814fc818810978dce1f33c4052028353 | [
"MIT"
] | null | null | null | def weekday_name(day_of_week):
"""Return name of weekday.
>>> weekday_name(1)
'Sunday'
>>> weekday_name(7)
'Saturday'
For days not between 1 and 7, return None
>>> weekday_name(9)
>>> weekday_name(0)
"""
days = ['Sunday', 'Monda... | 25.157895 | 89 | 0.537657 | def weekday_name(day_of_week):
days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
if day_of_week < 1 or day_of_week > 7:
return None
return days[day_of_week - 1]
| true | true |
f76206c434cf96e0f28275b33941b3538e448a61 | 8,370 | py | Python | tests/test_cache/test_cache.py | PLPeeters/reppy | 7a1aceb273c25b47908a6f81cdd894da72798b45 | [
"MIT"
] | null | null | null | tests/test_cache/test_cache.py | PLPeeters/reppy | 7a1aceb273c25b47908a6f81cdd894da72798b45 | [
"MIT"
] | null | null | null | tests/test_cache/test_cache.py | PLPeeters/reppy | 7a1aceb273c25b47908a6f81cdd894da72798b45 | [
"MIT"
] | null | null | null | from __future__ import print_function
from reppy.cache import DefaultObjectPolicy, ReraiseExceptionPolicy
'''Tests about our caching utilities.'''
import unittest
import mock
import sys
from reppy import cache
from reppy import logger
from reppy.robots import AllowNone
import reppy.exceptions
from ..util import r... | 39.668246 | 117 | 0.647551 | from __future__ import print_function
from reppy.cache import DefaultObjectPolicy, ReraiseExceptionPolicy
import unittest
import mock
import sys
from reppy import cache
from reppy import logger
from reppy.robots import AllowNone
import reppy.exceptions
from ..util import requests_fixtures
class TestExpiringObje... | true | true |
f76207ecb35010384661a44559b2a1c2c4fdbd89 | 1,411 | py | Python | examples/undocumented/python/kernel_comm_word_string.py | ShankarNara/shogun | 8ab196de16b8d8917e5c84770924c8d0f5a3d17c | [
"BSD-3-Clause"
] | 1 | 2019-10-02T11:10:08.000Z | 2019-10-02T11:10:08.000Z | examples/undocumented/python/kernel_comm_word_string.py | ShankarNara/shogun | 8ab196de16b8d8917e5c84770924c8d0f5a3d17c | [
"BSD-3-Clause"
] | null | null | null | examples/undocumented/python/kernel_comm_word_string.py | ShankarNara/shogun | 8ab196de16b8d8917e5c84770924c8d0f5a3d17c | [
"BSD-3-Clause"
] | 1 | 2020-06-02T09:15:40.000Z | 2020-06-02T09:15:40.000Z | #!/usr/bin/env python
from tools.load import LoadMatrix
import shogun as sg
lm=LoadMatrix()
traindat = lm.load_dna('../data/fm_train_dna.dat')
testdat = lm.load_dna('../data/fm_test_dna.dat')
parameter_list = [[traindat,testdat,4,0,False, False],[traindat,testdat,4,0,False,False]]
def kernel_comm_word_string (fm_trai... | 35.275 | 124 | 0.805103 | from tools.load import LoadMatrix
import shogun as sg
lm=LoadMatrix()
traindat = lm.load_dna('../data/fm_train_dna.dat')
testdat = lm.load_dna('../data/fm_test_dna.dat')
parameter_list = [[traindat,testdat,4,0,False, False],[traindat,testdat,4,0,False,False]]
def kernel_comm_word_string (fm_train_dna=traindat, fm_tes... | true | true |
f7620802c52f6997eca672fbabbb00c460e59287 | 8,709 | py | Python | sovtoken/sovtoken/test/helpers/helper_request.py | ArtObr/token-plugin | 6d595ee6640c581fccab60d996b95242339be521 | [
"Apache-2.0"
] | null | null | null | sovtoken/sovtoken/test/helpers/helper_request.py | ArtObr/token-plugin | 6d595ee6640c581fccab60d996b95242339be521 | [
"Apache-2.0"
] | null | null | null | sovtoken/sovtoken/test/helpers/helper_request.py | ArtObr/token-plugin | 6d595ee6640c581fccab60d996b95242339be521 | [
"Apache-2.0"
] | null | null | null | import json
import time
from indy.ledger import build_nym_request, build_schema_request, \
build_acceptance_mechanism_request, build_txn_author_agreement_request, \
build_get_txn_author_agreement_request, append_txn_author_agreement_acceptance_to_request
from indy.payment import build_get_payment_sources_reque... | 38.535398 | 132 | 0.682283 | import json
import time
from indy.ledger import build_nym_request, build_schema_request, \
build_acceptance_mechanism_request, build_txn_author_agreement_request, \
build_get_txn_author_agreement_request, append_txn_author_agreement_acceptance_to_request
from indy.payment import build_get_payment_sources_reque... | true | true |
f7620b0246b1ee973fd753dbf25c98d9a003c903 | 8,619 | py | Python | dali/test/python/test_operator_warp.py | banasraf/DALI | f834f3e619b15e3df87bf0316ac8806d0998126e | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | dali/test/python/test_operator_warp.py | banasraf/DALI | f834f3e619b15e3df87bf0316ac8806d0998126e | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | dali/test/python/test_operator_warp.py | banasraf/DALI | f834f3e619b15e3df87bf0316ac8806d0998126e | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # Copyright (c) 2019, NVIDIA CORPORATION. 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... | 38.824324 | 152 | 0.651932 |
from nvidia.dali.pipeline import Pipeline
import nvidia.dali.ops as ops
import nvidia.dali.types as types
import nvidia.dali as dali
from nvidia.dali.backend_impl import TensorListGPU
import numpy as np
import math
from numpy.testing import assert_array_equal, assert_allclose
import os
import cv2
from test_utils impor... | true | true |
f7620b4bf5531394ace5f72bb8a830d07efc08d9 | 920 | py | Python | clcache/testfile.py | univert/aclcache | 87bb634ceb0c884219a22b3c64a8bdf03fbf25ca | [
"BSD-3-Clause"
] | 4 | 2022-02-28T17:52:17.000Z | 2022-03-11T14:07:07.000Z | clcache/testfile.py | univert/aclcache | 87bb634ceb0c884219a22b3c64a8bdf03fbf25ca | [
"BSD-3-Clause"
] | null | null | null | clcache/testfile.py | univert/aclcache | 87bb634ceb0c884219a22b3c64a8bdf03fbf25ca | [
"BSD-3-Clause"
] | null | null | null | import sys
import time
from ctypes import windll, wintypes, create_unicode_buffer, byref
def file1(n):
for i in range(n):
try:
with open(r'U:\bin\RunRoot\Debug64\dbxsdk\dbxsdkrereg.wixout:aaaa','r') as f:
a = f.read()
pass
except:pass
C... | 23 | 90 | 0.559783 | import sys
import time
from ctypes import windll, wintypes, create_unicode_buffer, byref
def file1(n):
for i in range(n):
try:
with open(r'U:\bin\RunRoot\Debug64\dbxsdk\dbxsdkrereg.wixout:aaaa','r') as f:
a = f.read()
pass
except:pass
C... | true | true |
f7620b7c00036fe760c7fdaf000d327add0efccc | 19,114 | py | Python | test/test_mqtt.py | belyalov/tinymqtt | aad84c820e6aa096826a96c145e0dae90dab7926 | [
"MIT"
] | 3 | 2021-03-29T16:38:19.000Z | 2021-08-15T04:35:59.000Z | test/test_mqtt.py | belyalov/tinymqtt | aad84c820e6aa096826a96c145e0dae90dab7926 | [
"MIT"
] | 3 | 2020-01-05T21:41:24.000Z | 2021-05-21T01:08:36.000Z | test/test_mqtt.py | belyalov/tinymqtt | aad84c820e6aa096826a96c145e0dae90dab7926 | [
"MIT"
] | 2 | 2020-12-16T12:16:53.000Z | 2021-01-05T12:43:53.000Z | #!/usr/bin/env micropython
"""
Unittests for async MQTT client
MIT license
(C) Konstantin Belyalov 2018
"""
import utime
import logging
import unittest
import uasyncio
import uselect
import uerrno
import tinymqtt
from tinymqtt import MQTTClient
# Exception to be raised by MockSocketConnect()
ConnectException = OSErr... | 34.010676 | 92 | 0.609135 |
import utime
import logging
import unittest
import uasyncio
import uselect
import uerrno
import tinymqtt
from tinymqtt import MQTTClient
ConnectException = OSError(uerrno.EINPROGRESS)
MockReaderData = ''
MockReaderException = None
PollResult = 0
def mock_getaddrinfo(*args):
return [(1, 1), (1, 1)]
class Mock... | true | true |
f7620bc8ba3d349bd3e881c572827633c5fbd49c | 6,545 | py | Python | mpl/models/base_model.py | jiangyuang/ModelPruningLibrary | 9c8ba5a3c5d118f37768d5d42254711f48d88745 | [
"MIT"
] | 13 | 2020-02-24T16:57:37.000Z | 2021-12-14T16:47:41.000Z | mpl/models/base_model.py | jiangyuang/ModelPruningLibrary | 9c8ba5a3c5d118f37768d5d42254711f48d88745 | [
"MIT"
] | 3 | 2021-01-08T14:06:33.000Z | 2021-09-07T13:39:46.000Z | mpl/models/base_model.py | jiangyuang/ModelPruningLibrary | 9c8ba5a3c5d118f37768d5d42254711f48d88745 | [
"MIT"
] | 3 | 2020-05-30T17:59:43.000Z | 2021-04-13T04:55:33.000Z | from abc import ABC, abstractmethod
from typing import Union, Sized, List, Tuple
from copy import deepcopy
import torch
from torch import nn as nn
from ..nn.linear import DenseLinear
from ..nn.conv2d import DenseConv2d
from .utils import collect_leaf_modules, is_parameterized
class BaseModel(nn.Module, ABC):
de... | 40.153374 | 117 | 0.648128 | from abc import ABC, abstractmethod
from typing import Union, Sized, List, Tuple
from copy import deepcopy
import torch
from torch import nn as nn
from ..nn.linear import DenseLinear
from ..nn.conv2d import DenseConv2d
from .utils import collect_leaf_modules, is_parameterized
class BaseModel(nn.Module, ABC):
de... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.